forked from tiff/wysihtml5
/
wysihtml5-0.2.0.min.js
242 lines (238 loc) · 102 KB
/
wysihtml5-0.2.0.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*
wysihtml5 v0.2.0
https://github.com/xing/wysihtml5
Author: Christopher Blum (https://github.com/tiff)
Copyright (C) 2011 XING AG
Licensed under GNU General Public License
Rangy, a cross-browser JavaScript range and selection library
http://code.google.com/p/rangy/
Copyright 2011, Tim Down
Licensed under the MIT license.
Version: 1.1
Build date: 12 March 2011
*/
var wysihtml5={version:"0.2.0",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46},rangy=function(){function a(a,b){var c=typeof a[b];return c==k||!!(c==i&&a[b])||c=="unknown"}function c(a,b){return!!(typeof a[b]==i&&a[b])}function b(a,b){return typeof a[b]!=j}function d(a){return function(b,c){for(var g=c.length;g--;)if(!a(b,c[g]))return!1;
return!0}}function e(a){window.alert("Rangy not supported in your browser. Reason: "+a);r.initialized=!0;r.supported=!1}function h(){if(!r.initialized){var b,f=!1,d=!1;a(document,"createRange")&&(b=document.createRange(),t(b,l)&&w(b,g)&&(f=!0),b.detach());if((b=c(document,"body")?document.body:document.getElementsByTagName("body")[0])&&a(b,"createTextRange"))b=b.createTextRange(),t(b,q)&&w(b,n)&&(d=!0);!f&&!d&&e("Neither Range nor TextRange are implemented");r.initialized=!0;r.features={implementsDomRange:f,
implementsTextRange:d};f=x.concat(s);d=0;for(b=f.length;d<b;++d)try{f[d](r)}catch(j){c(window,"console")&&a(window.console,"log")&&console.log("Init listener threw an exception. Continuing.",j)}}}function f(a){this.name=a;this.supported=this.initialized=!1}var i="object",k="function",j="undefined",g=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer","START_TO_START","START_TO_END","END_TO_START","END_TO_END"],l=["setStart","setStartBefore","setStartAfter",
"setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],n=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],q=["collapse","compareEndPoints","duplicate","getBookmark","moveToBookmark","moveToElementText","parentElement","pasteHTML","select","setEndPoint"],t=d(a),o=d(c),w=d(b),r={initialized:!1,supported:!0,
util:{isHostMethod:a,isHostObject:c,isHostProperty:b,areHostMethods:t,areHostObjects:o,areHostProperties:w},features:{},modules:{},config:{alertOnWarn:!1}};r.fail=e;r.warn=function(a){a="Rangy warning: "+a;r.config.alertOnWarn?window.alert(a):typeof window.console!=j&&typeof window.console.log!=j&&window.console.log(a)};r.init=h;var s=[],x=[];r.addInitListener=function(a){r.initialized?a(r):s.push(a)};var p=[];r.addCreateMissingNativeApiListener=function(a){p.push(a)};r.createMissingNativeApi=function(a){a=
a||window;h();for(var b=0,c=p.length;b<c;++b)p[b](a)};f.prototype.fail=function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);};f.prototype.createError=function(a){return Error("Error in Rangy "+this.name+" module: "+a)};r.createModule=function(a,b){var c=new f(a);r.modules[a]=c;x.push(function(a){b(a,c);c.initialized=!0;c.supported=!0})};r.requireModules=function(a){for(var b=0,c=a.length,g,d;b<c;++b){d=a[b];g=r.modules[d];if(!g||!(g instanceof
f))throw Error("Module '"+d+"' not found");if(!g.supported)throw Error("Module '"+d+"' not supported");}};var v=!1,o=function(){v||(v=!0,r.initialized||h())};if(typeof window==j)e("No window found");else if(typeof document==j)e("No document found");else return a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",o,!1),a(window,"addEventListener")?window.addEventListener("load",o,!1):a(window,"attachEvent")?window.attachEvent("onload",o):e("Window does not have required addEventListener or attachEvent method"),
r}();
rangy.createModule("DomUtil",function(a,c){function b(a){for(var b=0;a=a.previousSibling;)b++;return b}function d(a,b){var c=[],g;for(g=a;g;g=g.parentNode)c.push(g);for(g=b;g;g=g.parentNode)if(o(c,g))return g;return null}function e(a,b,c){for(c=c?a:a.parentNode;c;){a=c.parentNode;if(a===b)return c;c=a}return null}function h(a){a=a.nodeType;return a==3||a==4||a==8}function f(a,b){var c=b.nextSibling,g=b.parentNode;c?g.insertBefore(a,c):g.appendChild(a);return a}function i(a){if(a.nodeType==9)return a;else if(typeof a.ownerDocument!=
n)return a.ownerDocument;else if(typeof a.document!=n)return a.document;else if(a.parentNode)return i(a.parentNode);else throw Error("getDocument: no document found for node");}function k(a){if(!a)return"[No node]";return h(a)?'"'+a.data+'"':a.nodeType==1?"<"+a.nodeName+(a.id?' id="'+a.id+'"':"")+">["+a.childNodes.length+"]":a.nodeName}function j(a){this._next=this.root=a}function g(a,b){this.node=a;this.offset=b}function l(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName}
var n="undefined",q=a.util;q.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||c.fail("document missing a Node creation method");q.isHostMethod(document,"getElementsByTagName")||c.fail("document missing getElementsByTagName method");var t=document.createElement("div");q.areHostMethods(t,["insertBefore","appendChild","cloneNode"])||c.fail("Incomplete Element implementation");t=document.createTextNode("test");q.areHostMethods(t,["splitText","deleteData","insertData",
"appendData","cloneNode"])||c.fail("Incomplete Text Node implementation");var o=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};j.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}};g.prototype={equals:function(a){return this.node===
a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+k(this.node)+":"+this.offset+")]"}};l.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};l.prototype.toString=function(){return this.message};a.dom={arrayContains:o,getNodeIndex:b,getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;)if(b===a)return!0;else b=b.parentNode;return!1},getClosestAncestorIn:e,
isCharacterDataNode:h,insertAfter:f,splitDataNode:function(a,b){var c;a.nodeType==3?c=a.splitText(b):(c=a.cloneNode(),c.deleteData(0,b),a.deleteData(0,a.length-b),f(c,a));return c},getDocument:i,getWindow:function(a){a=i(a);if(typeof a.defaultView!=n)return a.defaultView;else if(typeof a.parentWindow!=n)return a.parentWindow;else throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=n)return a.contentWindow;else if(typeof a.contentDocument!=n)return a.contentDocument.defaultView;
else throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=n)return a.contentDocument;else if(typeof a.contentWindow!=n)return a.contentWindow.document;else throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return q.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},comparePoints:function(a,c,g,f){var j;if(a==g)return c===f?0:c<f?-1:1;else if(j=e(g,a,!0))return c<=
b(j)?-1:1;else if(j=e(a,g,!0))return b(j)<f?-1:1;else if(c=d(a,g),a=a===c?c:e(a,c,!0),g=g===c?c:e(g,c,!0),a===g)throw Error("comparePoints got to case 4 and childA and childB are the same!");else{for(c=c.firstChild;c;){if(c===a)return-1;else if(c===g)return 1;c=c.nextSibling}throw Error("Should not be here!");}},inspectNode:k,createIterator:function(a){return new j(a)},DomPosition:g};a.DOMException=l});
rangy.createModule("DomRange",function(a){function c(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&m.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===c&&!m.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:m.getClosestAncestorIn(this.sc,
c,!0),this._last=this.ec===c&&!m.isCharacterDataNode(this.ec)?this.ec.childNodes[this.eo-1]:m.getClosestAncestorIn(this.ec,c,!0))}}function b(a){this.code=this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function d(a){return m.getDocument(a.startContainer)}function e(a,b,c){if(b=a._listeners[b])for(var g=0,f=b.length;g<f;++g)b[g].call(a,{target:a,args:c})}function h(a){return new K(a.parentNode,m.getNodeIndex(a))}function f(a){return new K(a.parentNode,m.getNodeIndex(a)+1)}function i(a){return m.isCharacterDataNode(a)?
a.length:a.childNodes?a.childNodes.length:0}function k(a,b,c){var g=a.nodeType==11?a.firstChild:a;m.isCharacterDataNode(b)?c==b.length?m.insertAfter(a,b):b.parentNode.insertBefore(a,c==0?b:m.splitDataNode(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]);return g}function j(a){for(var b,c,g=d(a.range).createDocumentFragment();c=a.next();){b=a.isPartiallySelectedSubtree();c=c.cloneNode(!b);b&&(b=a.getSubtreeIterator(),c.appendChild(j(b)),b.detach(!0));if(c.nodeType==10)throw new D("HIERARCHY_REQUEST_ERR");
g.appendChild(c)}return g}function g(a,b,c){for(var f,d,c=c||{stop:!1};f=a.next();)if(a.isPartiallySelectedSubtree())if(b(f)===!1){c.stop=!0;break}else{if(f=a.getSubtreeIterator(),g(f,b,c),f.detach(!0),c.stop)break}else for(f=m.createIterator(f);d=f.next();)if(b(d)===!1){c.stop=!0;return}}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach(!0)):a.remove()}function n(a){for(var b,c=d(a.range).createDocumentFragment(),g;b=a.next();){a.isPartiallySelectedSubtree()?
(b=b.cloneNode(!1),g=a.getSubtreeIterator(),b.appendChild(n(g)),g.detach(!0)):a.remove();if(b.nodeType==10)throw new D("HIERARCHY_REQUEST_ERR");c.appendChild(b)}return c}function q(a,b,f){var d=!(!b||!b.length),j,e=!!f;d&&(j=RegExp("^("+b.join("|")+")$"));var l=[];g(new c(a,!1),function(a){(!d||j.test(a.nodeType))&&(!e||f(a))&&l.push(a)});return l}function t(a){return"["+(typeof a.getName=="undefined"?"Range":a.getName())+"("+m.inspectNode(a.startContainer)+":"+a.startOffset+", "+m.inspectNode(a.endContainer)+
":"+a.endOffset+")]"}function o(a,b,c){this.nodes=q(a,b,c);this._next=this.nodes[0];this._pointer=0}function w(a,b){return a.nodeType!=3&&(m.isAncestorOf(a,b.startContainer,!0)||m.isAncestorOf(a,b.endContainer,!0))}function r(a){return function(b,c){for(var g,f=c?b:b.parentNode;f;){g=f.nodeType;if(m.arrayContains(a,g))return f;f=f.parentNode}return null}}function s(a){for(var b;b=a.parentNode;)a=b;return a}function x(a,c){if(U(a,c))throw new b("INVALID_NODE_TYPE_ERR");}function p(a){if(!a.startContainer)throw new D("INVALID_STATE_ERR");
}function v(a,c){if(!m.arrayContains(c,a.nodeType))throw new b("INVALID_NODE_TYPE_ERR");}function B(a,b){if(b<0||b>(m.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new D("INDEX_SIZE_ERR");}function A(a,b){if(I(a,!0)!==I(b,!0))throw new D("WRONG_DOCUMENT_ERR");}function F(a){if(V(a,!0))throw new D("NO_MODIFICATION_ALLOWED_ERR");}function H(a,b){if(!a)throw new D(b);}function y(a){if(!I(a.startContainer,!0)||!I(a.endContainer,!0)||!(a.startOffset<=(m.isCharacterDataNode(a.startContainer)?
a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(m.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function G(a){a.START_TO_START=L;a.START_TO_END=O;a.END_TO_END=W;a.END_TO_START=P;a.NODE_BEFORE=Q;a.NODE_AFTER=R;a.NODE_BEFORE_AND_AFTER=S;a.NODE_INSIDE=M}function u(a){G(a);G(a.prototype)}function E(a,e,K){function r(a,b){return function(c){p(this);
v(c,T);v(s(c),X);c=(a?h:f)(c);(b?I:C)(this,c.node,c.offset)}}function I(a,b,c){var g=a.endContainer,f=a.endOffset;if(b!==a.startContainer||c!==this.startOffset){if(s(b)!=s(g)||m.comparePoints(b,c,g,f)==1)g=b,f=c;e(a,b,c,g,f)}}function C(a,b,c){var g=a.startContainer,f=a.startOffset;if(b!==a.endContainer||c!==this.endOffset){if(s(b)!=s(g)||m.comparePoints(b,c,g,f)==-1)g=b,f=c;e(a,g,f,b,c)}}function G(a,b,c){(b!==a.startContainer||c!==this.startOffset||b!==a.endContainer||c!==this.endOffset)&&e(a,b,
c,b,c)}function E(a){return function(){p(this);y(this);var b=this.startContainer,d=this.startOffset,j=this.commonAncestorContainer,l=new c(this,!0);if(b!==j)b=m.getClosestAncestorIn(b,j,!0),d=f(b),b=d.node,d=d.offset;g(l,F);l.reset();j=a(l);l.detach();e(this,b,d,b,d);return j}}a.prototype={attachListener:function(a,b){this._listeners[a].push(b)},setStart:function(a,b){p(this);x(a,!0);B(a,b);I(this,a,b)},setEnd:function(a,b){p(this);x(a,!0);B(a,b);C(this,a,b)},setStartBefore:r(!0,!0),setStartAfter:r(!1,
!0),setEndBefore:r(!0,!1),setEndAfter:r(!1,!1),collapse:function(a){p(this);y(this);a?e(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):e(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){p(this);x(a,!0);e(this,a,0,a,i(a))},selectNode:function(a){p(this);x(a,!1);v(a,T);var b=h(a),a=f(a);e(this,b.node,b.offset,a.node,a.offset)},compareBoundaryPoints:function(a,b){p(this);y(this);A(this.startContainer,b.startContainer);
var c=a==P||a==L?"start":"end",g=a==O||a==L?"start":"end";return m.comparePoints(this[c+"Container"],this[c+"Offset"],b[g+"Container"],b[g+"Offset"])},insertNode:function(a){p(this);y(this);v(a,Y);F(this.startContainer);if(m.isAncestorOf(a,this.startContainer,!0))throw new D("HIERARCHY_REQUEST_ERR");this.setStartBefore(k(a,this.startContainer,this.startOffset))},cloneContents:function(){p(this);y(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();else{if(this.startContainer===
this.endContainer&&m.isCharacterDataNode(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;else b=new c(this,!0),a=j(b),b.detach();return a}},extractContents:E(n),deleteContents:E(l),canSurroundContents:function(){p(this);y(this);F(this.startContainer);F(this.endContainer);var a=new c(this,!0),b=a._first&&w(a._first,this)||a._last&&w(a._last,this);a.detach();return!b},surroundContents:function(a){v(a,
Z);if(!this.canSurroundContents())throw new b("BAD_BOUNDARYPOINTS_ERR");var c=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);k(a,this.startContainer,this.startOffset);a.appendChild(c);this.selectNode(a)},cloneRange:function(){p(this);y(this);for(var a=new z(d(this)),b=N.length,c;b--;)c=N[b],a[c]=this[c];return a},detach:function(){K(this)},toString:function(){p(this);y(this);var a=this.startContainer;if(a===this.endContainer&&m.isCharacterDataNode(a))return a.nodeType==
3||a.nodeType==4?a.data.slice(this.startOffset,this.endOffset):"";else{var b=[],a=new c(this,!0);g(a,function(a){(a.nodeType==3||a.nodeType==4)&&b.push(a.data)});a.detach();return b.join("")}},compareNode:function(a){p(this);y(this);var b=a.parentNode,c=m.getNodeIndex(a);if(!b)throw new D("NOT_FOUND_ERR");a=this.comparePoint(b,c);b=this.comparePoint(b,c+1);return a<0?b>0?S:Q:b>0?R:M},comparePoint:function(a,b){p(this);y(this);H(a,"HIERARCHY_REQUEST_ERR");A(a,this.startContainer);if(m.comparePoints(a,
b,this.startContainer,this.startOffset)<0)return-1;else if(m.comparePoints(a,b,this.endContainer,this.endOffset)>0)return 1;return 0},createContextualFragment:function(a){p(this);var b=d(this),c=b.createElement("div");c.innerHTML=a;for(a=b.createDocumentFragment();b=c.firstChild;)a.appendChild(b);return a},intersectsNode:function(a,b){p(this);y(this);H(a,"NOT_FOUND_ERR");if(m.getDocument(a)!==d(this))return!1;var c=a.parentNode,g=m.getNodeIndex(a);H(c,"NOT_FOUND_ERR");var f=m.comparePoints(c,g,this.endContainer,
this.endOffset),c=m.comparePoints(c,g+1,this.startContainer,this.startOffset);return b?f<=0&&c>=0:f<0&&c>0},isPointInRange:function(a,b){p(this);y(this);H(a,"HIERARCHY_REQUEST_ERR");A(a,this.startContainer);return m.comparePoints(a,b,this.startContainer,this.startOffset)>=0&&m.comparePoints(a,b,this.endContainer,this.endOffset)<=0},intersectsRange:function(a){p(this);y(this);if(d(a)!=d(this))throw new D("WRONG_DOCUMENT_ERR");return m.comparePoints(this.startContainer,this.startOffset,a.endContainer,
a.endOffset)<0&&m.comparePoints(this.endContainer,this.endOffset,a.startContainer,a.startOffset)>0},intersection:function(a){if(this.intersectsRange(a)){var b=m.comparePoints(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=m.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),g=this.cloneRange();b==-1&&g.setStart(a.startContainer,a.startOffset);c==1&&g.setEnd(a.endContainer,a.endOffset);return g}return null},containsNode:function(a,b){return b?this.intersectsNode(a,
!1):this.compareNode(a)==M},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,i(a))<=0},splitBoundaries:function(){p(this);y(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,g=this.endOffset,f=a===c;m.isCharacterDataNode(c)&&g<c.length&&m.splitDataNode(c,g);m.isCharacterDataNode(a)&&b>0&&(a=m.splitDataNode(a,b),f&&(g-=b,c=a),b=0);e(this,a,b,c,g)},normalizeBoundaries:function(){p(this);y(this);var a=this.startContainer,b=this.startOffset,c=
this.endContainer,g=this.endOffset,f=function(a){var b=a.nextSibling;if(b&&b.nodeType==a.nodeType)c=a,g=a.length,a.appendData(b.data),b.parentNode.removeChild(b)},d=function(f){var d=f.previousSibling;if(d&&d.nodeType==f.nodeType)a=f,b=d.length,f.insertData(0,d.data),d.parentNode.removeChild(d),a==c&&(g+=b,c=a)},j=!0;m.isCharacterDataNode(c)?c.length==g&&f(c):(g>0&&(j=c.childNodes[g-1])&&m.isCharacterDataNode(j)&&f(j),j=!this.collapsed);j?m.isCharacterDataNode(a)?b==0&&d(a):b<a.childNodes.length&&
(f=a.childNodes[b])&&m.isCharacterDataNode(f)&&d(f):(a=c,b=g);e(this,a,b,c,g)},createNodeIterator:function(a,b){p(this);y(this);return new o(this,a,b)},getNodes:function(a,b){p(this);y(this);return q(this,a,b)},collapseToPoint:function(a,b){p(this);y(this);x(a,!0);B(a,b);G(this,a,b)},collapseBefore:function(a){p(this);this.setEndBefore(a);this.collapse(!1)},collapseAfter:function(a){p(this);this.setStartAfter(a);this.collapse(!0)},getName:function(){return"DomRange"},equals:function(a){return z.rangesEqual(this,
a)},inspect:function(){return t(this)}};u(a)}function J(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;a.commonAncestorContainer=a.collapsed?a.startContainer:m.getCommonAncestor(a.startContainer,a.endContainer)}function C(a,b,c,g,f){var d=a.startContainer!==b||a.startOffset!==c,j=a.endContainer!==g||a.endOffset!==f;a.startContainer=b;a.startOffset=c;a.endContainer=g;a.endOffset=f;J(a);e(a,"boundarychange",{startMoved:d,endMoved:j})}function z(a){this.startContainer=
a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};J(this)}a.requireModules(["DomUtil"]);var m=a.dom,K=m.DomPosition,D=a.DOMException;c.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null;this._next=this._first},hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next;if(a)this._next=a!==this._last?a.nextSibling:null,m.isCharacterDataNode(a)&&this.clonePartiallySelectedTextNodes&&
(a===this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so));return a},remove:function(){var a=this._current,b,c;m.isCharacterDataNode(a)&&(a===this.sc||a===this.ec)?(b=a===this.sc?this.so:0,c=a===this.ec?this.eo:a.length,b!=c&&a.deleteData(b,c-b)):a.parentNode&&a.parentNode.removeChild(a)},isPartiallySelectedSubtree:function(){return w(this._current,this.range)},getSubtreeIterator:function(){var a;if(this.isSingleCharacterDataNode)a=
this.range.cloneRange(),a.collapse();else{a=new z(d(this.range));var b=this._current,g=b,f=0,j=b,e=i(b);if(m.isAncestorOf(b,this.sc,!0))g=this.sc,f=this.so;if(m.isAncestorOf(b,this.ec,!0))j=this.ec,e=this.eo;C(a,g,f,j,e)}return new c(a,this.clonePartiallySelectedTextNodes)},detach:function(a){a&&this.range.detach();this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};b.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};b.prototype.toString=function(){return this.message};
o.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){this._current=this._next;this._next=this.nodes[++this._pointer];return this._current},detach:function(){this._current=this._next=this.nodes=null}};var T=[1,3,4,5,7,8,10],X=[2,9,11],Y=[1,3,4,5,7,8,10,11],Z=[1,3,4,5,7,8],I=r([9,11]),V=r([5,6,10,12]),U=r([6,10,12]),N=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],L=0,O=1,W=2,P=3,Q=0,R=1,S=2,M=3;E(z,C,function(a){p(a);a.startContainer=
a.startOffset=a.endContainer=a.endOffset=null;a.collapsed=a.commonAncestorContainer=null;e(a,"detach",null);a._listeners=null});z.fromRange=function(a){var b=new z(d(a));C(b,a.startContainer,a.startOffset,a.endContainer,a.endOffset);return b};z.rangeProperties=N;z.RangeIterator=c;z.copyComparisonConstants=u;z.createPrototypeRange=E;z.inspect=t;z.getRangeDocument=d;z.rangesEqual=function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&
a.endOffset===b.endOffset};z.getEndOffset=i;a.DomRange=z;a.RangeException=b});
rangy.createModule("WrappedRange",function(a){function c(a,b,c,f){var d=a.duplicate();d.collapse(c);var i=d.parentElement();e.isAncestorOf(b,i,!0)||(i=b);if(!i.canHaveHTML)return new h(i.parentNode,e.getNodeIndex(i));var b=e.getDocument(i).createElement("span"),t,o=c?"StartToStart":"StartToEnd";do i.insertBefore(b,b.previousSibling),d.moveToElementText(b);while((t=d.compareEndPoints(o,a))>0&&b.previousSibling);o=b.nextSibling;if(t==-1&&o&&e.isCharacterDataNode(o)){d.setEndPoint(c?"EndToStart":"EndToEnd",
a);if(/[\r\n]/.test(o.data)){i=d.duplicate();c=i.text.replace(/\r\n/g,"\r").length;for(c=i.moveStart("character",c);i.compareEndPoints("StartToEnd",i)==-1;)c++,i.moveStart("character",1)}else c=d.text.length;i=new h(o,c)}else o=(f||!c)&&b.previousSibling,i=(c=(f||c)&&b.nextSibling)&&e.isCharacterDataNode(c)?new h(c,0):o&&e.isCharacterDataNode(o)?new h(o,o.length):new h(i,e.getNodeIndex(b));b.parentNode.removeChild(b);return i}function b(a,b){var c,f,d=a.offset,i=e.getDocument(a.node),h=i.body.createTextRange(),
o=e.isCharacterDataNode(a.node);o?(c=a.node,f=c.parentNode):(c=a.node.childNodes,c=d<c.length?c[d]:null,f=a.node);i=i.createElement("span");i.innerHTML="&#feff;";c?f.insertBefore(i,c):f.appendChild(i);h.moveToElementText(i);h.collapse(!b);f.removeChild(i);if(o)h[b?"moveStart":"moveEnd"]("character",d);return h}a.requireModules(["DomUtil","DomRange"]);var d,e=a.dom,h=e.DomPosition,f=a.DomRange;if(a.features.implementsDomRange)(function(){function a(b){for(var f=c.length,d;f--;)d=c[f],b[d]=b.nativeRange[d]}
var b,c=f.rangeProperties,i;d=function(b){if(!b)throw Error("Range must be specified");this.nativeRange=b;a(this)};f.createPrototypeRange(d,function(a,b,c,g,f){var d=a.startContainer!==b||a.startOffset!=c;(a.endContainer!==g||a.endOffset!=f)&&a.setEnd(g,f);d&&a.setStart(b,c)},function(a){a.nativeRange.detach();a.detached=!0;for(var b=c.length,f;b--;)f=c[b],a[f]=null});b=d.prototype;b.selectNode=function(b){this.nativeRange.selectNode(b);a(this)};b.deleteContents=function(){this.nativeRange.deleteContents();
a(this)};b.extractContents=function(){var b=this.nativeRange.extractContents();a(this);return b};b.cloneContents=function(){return this.nativeRange.cloneContents()};b.surroundContents=function(b){this.nativeRange.surroundContents(b);a(this)};b.collapse=function(b){this.nativeRange.collapse(b);a(this)};b.cloneRange=function(){return new d(this.nativeRange.cloneRange())};b.refresh=function(){a(this)};b.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");e.getBody(document).appendChild(h);
var q=document.createRange();q.setStart(h,0);q.setEnd(h,0);try{q.setStart(h,1),b.setStart=function(b,c){this.nativeRange.setStart(b,c);a(this)},b.setEnd=function(b,c){this.nativeRange.setEnd(b,c);a(this)},i=function(b){return function(c){this.nativeRange[b](c);a(this)}}}catch(t){b.setStart=function(b,c){try{this.nativeRange.setStart(b,c)}catch(g){this.nativeRange.setEnd(b,c),this.nativeRange.setStart(b,c)}a(this)},b.setEnd=function(b,c){try{this.nativeRange.setEnd(b,c)}catch(g){this.nativeRange.setStart(b,
c),this.nativeRange.setEnd(b,c)}a(this)},i=function(b,c){return function(g){try{this.nativeRange[b](g)}catch(f){this.nativeRange[c](g),this.nativeRange[b](g)}a(this)}}}b.setStartBefore=i("setStartBefore","setEndBefore");b.setStartAfter=i("setStartAfter","setEndAfter");b.setEndBefore=i("setEndBefore","setStartBefore");b.setEndAfter=i("setEndAfter","setStartAfter");q.selectNodeContents(h);b.selectNodeContents=q.startContainer==h&&q.endContainer==h&&q.startOffset==0&&q.endOffset==h.length?function(b){this.nativeRange.selectNodeContents(b);
a(this)}:function(a){this.setStart(a,0);this.setEnd(a,f.getEndOffset(a))};q.selectNodeContents(h);q.setEnd(h,3);i=document.createRange();i.selectNodeContents(h);i.setEnd(h,4);i.setStart(h,2);b.compareBoundaryPoints=q.compareBoundaryPoints(q.START_TO_END,i)==-1&&q.compareBoundaryPoints(q.END_TO_START,i)==1?function(a,b){b=b.nativeRange||b;if(a==b.START_TO_END)a=b.END_TO_START;else if(a==b.END_TO_START)a=b.START_TO_END;return this.nativeRange.compareBoundaryPoints(a,b)}:function(a,b){return this.nativeRange.compareBoundaryPoints(a,
b.nativeRange||b)};e.getBody(document).removeChild(h);q.detach();i.detach()})();else if(a.features.implementsTextRange){d=function(a){this.textRange=a;this.refresh()};d.prototype=new f(document);d.prototype.refresh=function(){var a,b,g=this.textRange;a=g.parentElement();var f=g.duplicate();f.collapse(!0);b=f.parentElement();f=g.duplicate();f.collapse(!1);g=f.parentElement();b=b==g?b:e.getCommonAncestor(b,g);b=b==a?b:e.getCommonAncestor(a,b);this.textRange.compareEndPoints("StartToEnd",this.textRange)==
0?b=a=c(this.textRange,b,!0,!0):(a=c(this.textRange,b,!0,!1),b=c(this.textRange,b,!1,!1));this.setStart(a.node,a.offset);this.setEnd(b.node,b.offset)};d.rangeToTextRange=function(a){if(a.collapsed)return b(new h(a.startContainer,a.startOffset),!0,!0);else{var c=b(new h(a.startContainer,a.startOffset),!0,!1),g=b(new h(a.endContainer,a.endOffset),!1,!1),a=e.getDocument(a.startContainer).body.createTextRange();a.setEndPoint("StartToStart",c);a.setEndPoint("EndToEnd",g);return a}};f.copyComparisonConstants(d);
var i=function(){return this}();if(typeof i.Range=="undefined")i.Range=d}d.prototype.getName=function(){return"WrappedRange"};a.WrappedRange=d;a.createNativeRange=function(b){b=b||document;if(a.features.implementsDomRange)return b.createRange();else if(a.features.implementsTextRange)return b.body.createTextRange()};a.createRange=function(b){return new d(a.createNativeRange(b||document))};a.createRangyRange=function(a){return new f(a||document)};a.createIframeRange=function(b){return a.createRange(e.getIframeDocument(b))};
a.createIframeRangyRange=function(b){return a.createRangyRange(e.getIframeDocument(b))};a.addCreateMissingNativeApiListener(function(b){b=b.document;if(typeof b.createRange=="undefined")b.createRange=function(){return a.createRange(this)};b=b=null})});
rangy.createModule("WrappedSelection",function(a,c){function b(a,b,c){var g=c?"end":"start",c=c?"start":"end";a.anchorNode=b[g+"Container"];a.anchorOffset=b[g+"Offset"];a.focusNode=b[c+"Container"];a.focusOffset=b[c+"Offset"]}function d(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function e(b){var c;if(b instanceof n){if(c=b._selectionNativeRange,!c)c=a.createNativeRange(g.getDocument(b.startContainer)),c.setEnd(b.endContainer,
b.endOffset),c.setStart(b.startContainer,b.startOffset),b._selectionNativeRange=c,b.attachListener("detach",function(){this._selectionNativeRange=null})}else b instanceof q?c=b.nativeRange:window.Range&&b instanceof Range&&(c=b);return c}function h(a){var b=a.getNodes(),c;a:if(!b.length||b[0].nodeType!=1)c=!1;else{c=1;for(var f=b.length;c<f;++c)if(!g.isAncestorOf(b[0],b[c])){c=!1;break a}c=!0}if(!c)throw Error("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");
return b[0]}function f(c){c._ranges.length=0;if(c.nativeSelection.type=="None")d(c);else{var f=c.nativeSelection.createRange();c.rangeCount=f.length;for(var j,e=g.getDocument(f.item(0)),i=0;i<c.rangeCount;++i)j=a.createRange(e),j.selectNode(f.item(i)),c._ranges.push(j);c.isCollapsed=c.rangeCount==1&&c._ranges[0].collapsed;b(c,c._ranges[c.rangeCount-1],!1)}}function i(a){this.nativeSelection=a;this._ranges=[];this.refresh()}function k(a,b){if(a.anchorNode&&g.getDocument(a.anchorNode)!==g.getDocument(b))throw new t("WRONG_DOCUMENT_ERR");
}function j(a){var b=[],c=new o(a.anchorNode,a.anchorOffset),g=new o(a.focusNode,a.focusOffset),f=typeof a.getName=="function"?a.getName():"Selection";if(typeof a.rangeCount!="undefined")for(var d=0,j=a.rangeCount;d<j;++d)b[d]=n.inspect(a.getRangeAt(d));return"["+f+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+g.inspect()+"]"}a.requireModules(["DomUtil","DomRange","WrappedRange"]);a.config.checkSelectionRanges=!0;var g=a.dom,l=a.util,n=a.DomRange,q=a.WrappedRange,t=a.DOMException,
o=g.DomPosition,w,r;a.util.isHostMethod(window,"getSelection")?w=function(a){return(a||window).getSelection()}:a.util.isHostObject(document,"selection")?w=function(a){return(a||window).document.selection}:c.fail("No means of obtaining a selection object");a.getNativeSelection=w;var s=w(),x=a.createNativeRange(document),p=g.getBody(document),v=l.areHostObjects(s,l.areHostProperties(s,["anchorOffset","focusOffset"]));a.features.selectionHasAnchorAndFocus=v;var B=l.isHostMethod(s,"extend");a.features.selectionHasExtend=
B;var A=typeof s.rangeCount=="number";a.features.selectionHasRangeCount=A;var F=!1,H=!0;l.areHostMethods(s,["addRange","getRangeAt","removeAllRanges"])&&typeof s.rangeCount=="number"&&a.features.implementsDomRange&&function(){var b=p.appendChild(document.createTextNode("One")),c=p.appendChild(document.createTextNode("Two")),g=a.createNativeRange(document);g.selectNodeContents(b);var f=a.createNativeRange(document);f.selectNodeContents(c);s.removeAllRanges();s.addRange(g);s.addRange(f);F=s.rangeCount==
2;s.removeAllRanges();b.parentNode.removeChild(b);c.parentNode.removeChild(c);b=document.createElement("p");b.contentEditable=!1;c=b.appendChild(document.createTextNode("test"));p.appendChild(b);g=a.createRange();g.collapseToPoint(c,1);s.addRange(g.nativeRange);H=s.rangeCount==1;s.removeAllRanges();p.removeChild(b)}();a.features.selectionSupportsMultipleRanges=F;a.features.collapsedNonEditableSelectionsSupported=H;var y=l.isHostProperty(s,"type"),G=!1,u;p&&l.isHostMethod(p,"createControlRange")&&
(u=p.createControlRange(),l.areHostProperties(u,["item","add"])&&(G=!0));a.features.implementsControlRange=G;r=v?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var E;l.isHostMethod(s,"getRangeAt")?E=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:v&&(E=function(b){var c=g.getDocument(b.anchorNode),c=a.createRange(c);c.setStart(b.anchorNode,b.anchorOffset);c.setEnd(b.focusNode,
b.focusOffset);c.collapsed!==this.isCollapsed&&(c.setStart(b.focusNode,b.focusOffset),c.setEnd(b.anchorNode,b.anchorOffset));return c});a.getSelection=function(a){var a=a||window,b=a._rangySelection;b?(b.nativeSelection=w(a),b.refresh()):(b=new i(w(a)),a._rangySelection=b);return b};a.getIframeSelection=function(b){return a.getSelection(g.getIframeWindow(b))};u=i.prototype;if(v&&l.areHostMethods(s,["removeAllRanges","addRange"])){u.removeAllRanges=function(){this.nativeSelection.removeAllRanges();
d(this)};var J=function(b,c){var g=n.getRangeDocument(c),g=a.createRange(g);g.collapseToPoint(c.endContainer,c.endOffset);b.nativeSelection.addRange(e(g));b.nativeSelection.extend(c.startContainer,c.startOffset);b.refresh()};u.addRange=A?function(c,g){if(g&&B)J(this,c);else{var f;F?f=this.rangeCount:(this.removeAllRanges(),f=0);this.nativeSelection.addRange(e(c));this.rangeCount=this.nativeSelection.rangeCount;this.rangeCount==f+1?(a.config.checkSelectionRanges&&(f=E(this.nativeSelection,this.rangeCount-
1))&&!n.rangesEqual(f,c)&&(c=new q(f)),this._ranges[this.rangeCount-1]=c,b(this,c,m(this.nativeSelection)),this.isCollapsed=r(this)):this.refresh()}}:function(a,b){b&&B?J(this,a):(this.nativeSelection.addRange(e(a)),this.refresh())};u.setRanges=function(a){this.removeAllRanges();for(var b=0,c=a.length;b<c;++b)this.addRange(a[b])}}else if(l.isHostMethod(s,"empty")&&l.isHostMethod(x,"select")&&y&&G)u.removeAllRanges=function(){try{if(this.nativeSelection.empty(),this.nativeSelection.type!="None"){var a;
if(this.anchorNode)a=g.getDocument(this.anchorNode);else if(this.nativeSelection.type=="Control"){var b=this.nativeSelection.createRange();b.length&&(a=g.getDocument(b.item(0)).body.createTextRange())}a&&(a.body.createTextRange().select(),this.nativeSelection.empty())}}catch(c){}d(this)},u.addRange=function(a){if(this.nativeSelection.type=="Control"){for(var c=this.nativeSelection.createRange(),a=h(a),d=g.getDocument(c.item(0)),d=g.getBody(d).createControlRange(),j=0,e=c.length;j<e;++j)d.add(c.item(j));
try{d.add(a)}catch(i){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}d.select();f(this)}else q.rangeToTextRange(a).select(),this._ranges[0]=a,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,b(this,a,!1)},u.setRanges=function(a){this.removeAllRanges();var b=a.length;if(b>1){for(var c=g.getDocument(a[0].startContainer),c=g.getBody(c).createControlRange(),d=0,j;d<b;++d){j=h(a[d]);try{c.add(j)}catch(e){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");
}}c.select();f(this)}else b&&this.addRange(a[0])};else return c.fail("No means of selecting a Range or TextRange was found"),!1;u.getRangeAt=function(a){if(a<0||a>=this.rangeCount)throw new t("INDEX_SIZE_ERR");else return this._ranges[a]};var C;if(l.isHostMethod(s,"getRangeAt")&&typeof s.rangeCount=="number")C=function(c){c._ranges.length=c.rangeCount=c.nativeSelection.rangeCount;if(c.rangeCount){for(var g=0,f=c.rangeCount;g<f;++g)c._ranges[g]=new a.WrappedRange(c.nativeSelection.getRangeAt(g));b(c,
c._ranges[c.rangeCount-1],m(c.nativeSelection));c.isCollapsed=r(c)}else d(c)};else if(v&&typeof s.isCollapsed=="boolean"&&typeof x.collapsed=="boolean"&&a.features.implementsDomRange)C=function(a){var b;b=a.nativeSelection;b.anchorNode?(b=E(b,0),a._ranges=[b],a.rangeCount=1,b=a.nativeSelection,a.anchorNode=b.anchorNode,a.anchorOffset=b.anchorOffset,a.focusNode=b.focusNode,a.focusOffset=b.focusOffset,a.isCollapsed=r(a)):d(a)};else if(l.isHostMethod(s,"createRange")&&a.features.implementsTextRange)C=
function(a){var c=a.nativeSelection.createRange();a.nativeSelection.type=="Control"?f(a):c&&typeof c.text!="undefined"?(c=new q(c),a._ranges=[c],b(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed):d(a)};else return c.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;u.refresh=function(a){var b=a?this._ranges.slice(0):null;C(this);if(a){a=b.length;if(a!=this._ranges.length)return!1;for(;a--;)if(!n.rangesEqual(b[a],this._ranges[a]))return!1;return!0}};var z=function(a,
b){var c=a.getAllRanges(),g=!1;a.removeAllRanges();for(var f=0,j=c.length;f<j;++f)g||b!==c[f]?a.addRange(c[f]):g=!0;a.rangeCount||d(a)};u.removeRange=y&&G?function(a){if(this.nativeSelection.type=="Control"){for(var b=this.nativeSelection.createRange(),a=h(a),c=g.getDocument(b.item(0)),c=g.getBody(c).createControlRange(),d,j=!1,e=0,i=b.length;e<i;++e)d=b.item(e),d!==a||j?c.add(b.item(e)):j=!0;c.select();f(this)}else z(this,a)}:function(a){z(this,a)};var m;v&&a.features.implementsDomRange?(m=function(a){var b=
!1;a.anchorNode&&(b=g.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset)==1);return b},u.isBackwards=function(){return m(this)}):m=u.isBackwards=function(){return!1};u.toString=function(){for(var a=[],b=0,c=this.rangeCount;b<c;++b)a[b]=""+this._ranges[b];return a.join("")};u.collapse=function(b,c){k(this,b);var f=a.createRange(g.getDocument(b));f.collapseToPoint(b,c);this.removeAllRanges();this.addRange(f);this.isCollapsed=!0};u.collapseToStart=function(){if(this.rangeCount){var a=
this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new t("INVALID_STATE_ERR");};u.collapseToEnd=function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new t("INVALID_STATE_ERR");};u.selectAllChildren=function(b){k(this,b);var c=a.createRange(g.getDocument(b));c.selectNodeContents(b);this.removeAllRanges();this.addRange(c)};u.deleteFromDocument=function(){if(this.rangeCount){var a=this.getAllRanges();this.removeAllRanges();
for(var b=0,c=a.length;b<c;++b)a[b].deleteContents();this.addRange(a[c-1])}};u.getAllRanges=function(){return this._ranges.slice(0)};u.setSingleRange=function(a){this.setRanges([a])};u.containsNode=function(a,b){for(var c=0,g=this._ranges.length;c<g;++c)if(this._ranges[c].containsNode(a,b))return!0;return!1};u.getName=function(){return"WrappedSelection"};u.inspect=function(){return j(this)};u.detach=function(){this.anchorNode&&(g.getWindow(this.anchorNode)._rangySelection=null)};i.inspect=j;a.Selection=
i;a.addCreateMissingNativeApiListener(function(b){if(typeof b.getSelection=="undefined")b.getSelection=function(){return a.getSelection(this)};b=null})});var Base=function(){};
Base.extend=function(a,c){var b=Base.prototype.extend;Base._prototyping=!0;var d=new this;b.call(d,a);d.base=function(){};delete Base._prototyping;var e=d.constructor,h=d.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==h)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(arguments[0]!=null)return(arguments[0].extend||b).call(arguments[0],d)};h.ancestor=this;h.extend=this.extend;h.forEach=this.forEach;h.implement=this.implement;h.prototype=
d;h.toString=this.toString;h.valueOf=function(a){return a=="object"?h:e.valueOf()};b.call(h,c);typeof h.init=="function"&&h.init();return h};
Base.prototype={extend:function(a,c){if(arguments.length>1){var b=this[a];if(b&&typeof c=="function"&&(!b.valueOf||b.valueOf()!=c.valueOf())&&/\bbase\b/.test(c)){var d=c.valueOf(),c=function(){var a=this.base||Base.prototype.base;this.base=b;var c=d.apply(this,arguments);this.base=a;return c};c.valueOf=function(a){return a=="object"?c:d};c.toString=Base.toString}this[a]=c}else if(a){var e=Base.prototype.extend;!Base._prototyping&&typeof this!="function"&&(e=this.extend||e);for(var h={toSource:null},
f=["constructor","toString","valueOf"],i=Base._prototyping?0:1;k=f[i++];)a[k]!=h[k]&&e.call(this,k,a[k]);for(var k in a)h[k]||e.call(this,k,a[k])}return this}};
Base=Base.extend({constructor:function(a){this.extend(a)}},{ancestor:Object,version:"1.1",forEach:function(a,c,b){for(var d in a)this.prototype[d]===void 0&&c.call(b,a[d],d,a)},implement:function(){for(var a=0;a<arguments.length;a++)if(typeof arguments[a]=="function")arguments[a](this.prototype);else this.prototype.extend(arguments[a]);return this},toString:function(){return String(this.valueOf())}});
wysihtml5.browser=function(){var a=navigator.userAgent,c=document.createElement("div"),b=a.indexOf("MSIE")!==-1&&a.indexOf("Opera")===-1,d=a.indexOf("Gecko")!==-1&&a.indexOf("KHTML")===-1,e=a.indexOf("AppleWebKit/")!==-1,h=a.indexOf("Opera/")!==-1;return{USER_AGENT:a,supported:function(){var a=this.USER_AGENT.toLowerCase(),b="contentEditable"in c,d=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,j=document.querySelector&&document.querySelectorAll,a=a.indexOf("webkit")!==
-1&&a.indexOf("mobile")!==-1||a.indexOf("opera mobi")!==-1;return b&&d&&j&&!a},supportsSandboxedIframes:function(){return b},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return!d},hasCurrentStyleProperty:function(){return"currentStyle"in c},insertsLineBreaksOnReturn:function(){return d},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){var b;if(!(b="on"+
a in c))c.setAttribute("on"+a,"return;"),b=typeof c["on"+a]==="function";return b},supportsEventsInIframeCorrectly:function(){return!h},firesOnDropOnlyWhenOnDragOverIsCancelled:function(){return e||d},supportsDataTransfer:function(){try{return e&&(window.Clipboard||window.DataTransfer).prototype.getData}catch(a){return!1}},supportsHTML5Tags:function(a){a=a.createElement("div");a.innerHTML="<article>foo</article>";return a.innerHTML.toLowerCase()==="<article>foo</article>"},supportsCommand:function(){var a=
{formatBlock:b,insertUnorderedList:b||h,insertOrderedList:b||h};return function(b,c){if(!a[c]){try{return b.queryCommandSupported(c)}catch(d){}try{return b.queryCommandEnabled(c)}catch(g){}}return!1}}(),doesAutoLinkingInContentEditable:function(){return b},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return d||h||e},supportsGetAttributeCorrectly:function(){return document.createElement("td").getAttribute("rowspan")!=
"1"},canSelectImagesInContentEditable:function(){return d||b||h},clearsListsInContentEditableCorrectly:function(){return d||b||e},autoScrollsToCaret:function(){return!e},autoClosesUnclosedTags:function(){var a=c.cloneNode(!1),b;a.innerHTML="<p><div></div>";a=a.innerHTML.toLowerCase();b=a==="<p></p><div></div>"||a==="<p><div></div></p>";this.autoClosesUnclosedTags=function(){return b};return b},supportsNativeGetElementsByClassName:function(){return String(document.getElementsByClassName).indexOf("[native code]")!==
-1},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},supportsClassList:function(){return"classList"in c},needsSpaceAfterLineBreak:function(){return h},supportsSpeechApiOn:function(b){return(a.match(/Chrome\/(\d+)/)||[,0])[1]>=11&&("onwebkitspeechchange"in b||"speech"in b)},crashesWhenDefineProperty:function(a){return b&&(a==="XMLHttpRequest"||a==="XDomainRequest")}}}();
wysihtml5.lang.array=function(a){return{contains:function(c){if(a.indexOf)return a.indexOf(c)!==-1;else{for(var b=0,d=a.length;b<d;b++)if(a[b]===c)return!0;return!1}},without:function(c){for(var c=wysihtml5.lang.array(c),b=[],d=0,e=a.length;d<e;d++)c.contains(a[d])||b.push(a[d]);return b},get:function(){for(var c=0,b=a.length,d=[];c<b;c++)d.push(a[c]);return d}}};
wysihtml5.lang.Dispatcher=Base.extend({observe:function(a,c){this.events=this.events||{};this.events[a]=this.events[a]||[];this.events[a].push(c);return this},fire:function(a,c){this.events=this.events||{};for(var b=this.events[a]||[],d=0;d<b.length;d++)b[d].call(this,c);return this},stopObserving:function(a,c){this.events=this.events||{};var b=0,d,e;if(a){d=this.events[a]||[];for(e=[];b<d.length;b++)d[b]!==c&&e.push(d[b]);this.events[a]=e}else this.events={};return this}});
wysihtml5.lang.object=function(a){return{merge:function(c){for(var b in c)a[b]=c[b];return this},get:function(){return a},clone:function(){var c={},b;for(b in a)c[b]=a[b];return c},isArray:function(){return Object.prototype.toString.call(a)==="[object Array]"}}};(function(){var a=/^\s+/,c=/\s+$/;wysihtml5.lang.string=function(b){b=String(b);return{trim:function(){return b.replace(a,"").replace(c,"")},interpolate:function(a){for(var c in a)b=this.replace("#{"+c+"}").by(a[c]);return b},replace:function(a){return{by:function(c){return b.split(a).join(c)}}}}}})();
(function(a){function c(a){return a.replace(e,function(a,b){var c=(b.match(h)||[])[1]||"",d=i[c],b=b.replace(h,"");b.split(d).length>b.split(c).length&&(b+=c,c="");var e=d=b;b.length>f&&(e=e.substr(0,f)+"...");d.substr(0,4)==="www."&&(d="http://"+d);return'<a href="'+d+'">'+e+"</a>"+c})}function b(f){if(!d.contains(f.nodeName))if(f.nodeType===a.TEXT_NODE&&f.data.match(e)){var j=f.parentNode,g;g=j.ownerDocument;var i=g._wysihtml5_tempElement;if(!i)i=g._wysihtml5_tempElement=g.createElement("div");
g=i;g.innerHTML="<span></span>"+c(f.data);for(g.removeChild(g.firstChild);g.firstChild;)j.insertBefore(g.firstChild,f);j.removeChild(f)}else{j=a.lang.array(f.childNodes).get();g=j.length;for(i=0;i<g;i++)b(j[i]);return f}}var d=a.lang.array(["CODE","PRE","A","SCRIPT","HEAD","TITLE","STYLE"]),e=/((https?:\/\/|www\.)[^\s<]{3,})/gi,h=/([^\w\/\-](,?))$/i,f=100,i={")":"(","]":"[","}":"{"};a.dom.autoLink=function(a){var c;a:{c=a;for(var g;c.parentNode;)if(c=c.parentNode,g=c.nodeName,d.contains(g)){c=!0;
break a}else if(g==="body")break;c=!1}if(c)return a;if(a===a.ownerDocument.documentElement)a=a.ownerDocument.body;return b(a)};a.dom.autoLink.URL_REG_EXP=e})(wysihtml5);
(function(a){var c=a.browser.supportsClassList(),b=a.dom;b.addClass=function(a,e){if(c)return a.classList.add(e);b.hasClass(a,e)||(a.className+=" "+e)};b.removeClass=function(a,b){if(c)return a.classList.remove(b);a.className=a.className.replace(RegExp("(^|\\s+)"+b+"(\\s+|$)")," ")};b.hasClass=function(a,b){if(c)return a.classList.contains(b);var h=a.className;return h.length>0&&(h==b||RegExp("(^|\\s)"+b+"(\\s|$)").test(h))}})(wysihtml5);
wysihtml5.dom.contains=function(){var a=document.documentElement;if(a.contains)return function(a,b){if(b.nodeType!==wysihtml5.ELEMENT_NODE)b=b.parentNode;return a!==b&&a.contains(b)};else if(a.compareDocumentPosition)return function(a,b){return!!(a.compareDocumentPosition(b)&16)}}();
wysihtml5.dom.convertToList=function(){function a(a,b){var d=a.createElement("li");b.appendChild(d);return d}return function(c,b){if(c.nodeName==="UL"||c.nodeName==="OL"||c.nodeName==="MENU")return c;for(var d=c.ownerDocument,e=d.createElement(b),h=wysihtml5.lang.array(c.childNodes).get(),f=h.length,i,k,j,g,l=0;l<f;l++)g=g||a(d,e),i=h[l],k=wysihtml5.dom.getStyle("display").from(i)==="block",j=i.nodeName==="BR",k?(g=g.firstChild?a(d,e):g,g.appendChild(i),g=null):j?g=g.firstChild?null:g:g.appendChild(i);
c.parentNode.replaceChild(e,c);return e}}();wysihtml5.dom.copyAttributes=function(a){return{from:function(c){return{to:function(b){for(var d,e=0,h=a.length;e<h;e++)d=a[e],c[d]&&(b[d]=c[d]);return{andTo:arguments.callee}}}}}};
(function(a){var c=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],b=function(b){var e;a:for(var h=0,f=c.length;h<f;h++)if(a.getStyle(c[h]).from(b)==="border-box"){e=c[h];break a}if(e)return parseInt(a.getStyle("width").from(b),10)<b.offsetWidth;return!1};a.copyStyles=function(d){return{from:function(e){b(e)&&(d=wysihtml5.lang.array(d).without(c));for(var h="",f=d.length,i=0,k;i<f;i++)k=d[i],h+=k+":"+a.getStyle(k).from(e)+";";return{to:function(b){a.setStyles(h).on(b);return{andTo:arguments.callee}}}}}}})(wysihtml5.dom);
(function(a){a.dom.delegate=function(c,b,d,e){return a.dom.observe(c,d,function(d){for(var f=d.target,i=a.lang.array(c.querySelectorAll(b));f&&f!==c;){if(i.contains(f)){e.call(f,d);break}f=f.parentNode}})}})(wysihtml5);
wysihtml5.dom.getAsDom=function(){var a=["abbr","article","aside","audio","bdi","canvas","command","datalist","details","figcaption","figure","footer","header","hgroup","keygen","mark","meter","nav","output","progress","rp","rt","ruby","svg","section","source","summary","time","track","video","wbr"];return function(c,b){var b=b||document,d;if(typeof c==="object"&&c.nodeType)d=b.createElement("div"),d.appendChild(c);else if(wysihtml5.browser.supportsHTML5Tags(b))d=b.createElement("div"),d.innerHTML=
c;else{d=b;if(!d._wysihtml5_supportsHTML5Tags){for(var e=0,h=a.length;e<h;e++)d.createElement(a[e]);d._wysihtml5_supportsHTML5Tags=!0}d=b;e=d.createElement("div");e.style.display="none";d.body.appendChild(e);try{e.innerHTML=c}catch(f){}d.body.removeChild(e);d=e}return d}}();
wysihtml5.dom.getParentElement=function(){function a(a,b){if(!b||!b.length)return!0;return typeof b==="string"?a===b:wysihtml5.lang.array(b).contains(a)}return function(c,b,d){d=d||50;if(b.className||b.classRegExp)a:{for(var e=b.nodeName,h=b.className,b=b.classRegExp;d--&&c&&c.nodeName!=="BODY";){var f;if(f=c.nodeType===wysihtml5.ELEMENT_NODE)if(f=a(c.nodeName,e)){f=h;var i=(c.className||"").match(b)||[];f=f?i[i.length-1]===f:!!i.length}if(f)break a;c=c.parentNode}c=null}else a:{e=b.nodeName;for(h=
d;h--&&c&&c.nodeName!=="BODY";){if(a(c.nodeName,e))break a;c=c.parentNode}c=null}return c}}();
wysihtml5.dom.getStyle=function(){function a(a){return a.replace(b,function(a){return a.charAt(1).toUpperCase()})}var c={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},b=/\-[a-z]/g;return function(b){return{from:function(e){if(e.nodeType===wysihtml5.ELEMENT_NODE){var h=e.ownerDocument,f=c[b]||a(b),i=e.style,k=e.currentStyle,j=i[f];if(j)return j;if(k)return k[f];var f=h.defaultView||h.parentWindow,h=(b==="height"||b==="width")&&e.nodeName==="TEXTAREA",g;if(f.getComputedStyle){if(h)g=
i.overflow,i.overflow="hidden";e=f.getComputedStyle(e,null).getPropertyValue(b);if(h)i.overflow=g||"";return e}}}}}}();wysihtml5.dom.hasElementWithTagName=function(){var a={},c=1;return function(b,d){var e=(b._wysihtml5_identifier||(b._wysihtml5_identifier=c++))+":"+d,h=a[e];h||(h=a[e]=b.getElementsByTagName(d));return h.length>0}}();
(function(a){var c={},b=1;a.dom.hasElementWithClassName=function(d,e){if(!a.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var h=(d._wysihtml5_identifier||(d._wysihtml5_identifier=b++))+":"+e,f=c[h];f||(f=c[h]=d.getElementsByClassName(e));return f.length>0}})(wysihtml5);wysihtml5.dom.insert=function(a){return{after:function(c){c.parentNode.insertBefore(a,c.nextSibling)},before:function(c){c.parentNode.insertBefore(a,c)},into:function(c){c.appendChild(a)}}};
wysihtml5.dom.insertCSS=function(a){a=a.join("\n");return{into:function(c){var b=c.head||c.getElementsByTagName("head")[0],d=c.createElement("style");d.type="text/css";d.styleSheet?d.styleSheet.cssText=a:d.appendChild(c.createTextNode(a));b&&b.appendChild(d)}}};
wysihtml5.dom.observe=function(a,c,b){for(var c=typeof c==="string"?[c]:c,d,e,h=0,f=c.length;h<f;h++)e=c[h],a.addEventListener?a.addEventListener(e,b,!1):(d=function(c){if(!("target"in c))c.target=c.srcElement;c.preventDefault=c.preventDefault||function(){this.returnValue=!1};c.stopPropagation=c.stopPropagation||function(){this.cancelBubble=!0};b.call(a,c)},a.attachEvent("on"+e,d));return{stop:function(){for(var f,e=0,j=c.length;e<j;e++)f=c[e],a.removeEventListener?a.removeEventListener(f,b,!1):a.detachEvent("on"+
f,d)}}};
wysihtml5.dom.parse=function(){function a(c,f){var j=c.childNodes,e=j.length,i;i=b[c.nodeType];var h=0;i=i&&i(c);if(!i)return null;for(h=0;h<e;h++)(newChild=a(j[h],f))&&i.appendChild(newChild);if(f&&i.childNodes.length<=1&&i.nodeName.toLowerCase()===d&&i.innerHTML!==wysihtml5.selection.PLACEHOLDER_TEXT&&!i.attributes.length)return i.firstChild;return i}function c(a,b){var b=b.toLowerCase(),c;if(c=a.nodeName=="IMG")if(c=b=="src"){var f;try{f=a.complete&&!a.mozMatchesSelector(":-moz-broken")}catch(d){a.complete&&a.readyState===
"complete"&&(f=!0)}c=f===!0}return c?a.src:i&&"outerHTML"in a?a.outerHTML.toLowerCase().indexOf(" "+b+"=")!=-1?a.getAttribute(b):null:a.getAttribute(b)}var b={1:function(a){var b,i,h=f.tags;i=a.nodeName.toLowerCase();b=a.scopeName;if(a._wysihtml5)return null;a._wysihtml5=1;b&&b!="HTML"&&(i=b+":"+i);"outerHTML"in a&&!wysihtml5.browser.autoClosesUnclosedTags()&&a.nodeName==="P"&&a.outerHTML.slice(-4).toLowerCase()!=="</p>"&&(i="div");if(i in h){b=h[i];if(!b||b.remove)return null;b=typeof b==="string"?
{rename_tag:b}:b}else if(a.firstChild)b={rename_tag:d};else return null;i=a.ownerDocument.createElement(b.rename_tag||i);var h={},t=b.set_class,o=b.add_class,w=b.set_attributes,r=b.check_attributes,s=f.classes,x=0,p=[];b=[];var v=[],B=[],A;w&&(h=wysihtml5.lang.object(w).clone());if(r)for(A in r)if(w=k[r[A]])w=w(c(a,A)),typeof w==="string"&&(h[A]=w);t&&p.push(t);if(o)for(A in o)if(w=j[o[A]])t=w(c(a,A)),typeof t==="string"&&p.push(t);(B=a.getAttribute("class"))&&(p=p.concat(B.split(e)));for(o=p.length;x<
o;x++)a=p[x],s[a]&&b.push(a);for(s=b.length;s--;)a=b[s],wysihtml5.lang.array(v).contains(a)||v.unshift(a);v.length&&(h["class"]=v.join(" "));for(A in h)try{i.setAttribute(A,h[A])}catch(F){}h.src&&(typeof h.width!=="undefined"&&i.setAttribute("width",h.width),typeof h.height!=="undefined"&&i.setAttribute("height",h.height));return i},3:function(a){return a.ownerDocument.createTextNode(a.data)}},d="span",e=/\s+/,h={tags:{},classes:{}},f={},i=!wysihtml5.browser.supportsGetAttributeCorrectly(),k={url:function(){var a=
/^https?:\/\//i;return function(b){if(!b||!b.match(a))return null;return b.replace(a,function(a){return a.toLowerCase()})}}(),alt:function(){var a=/[^ a-z0-9_\-]/gi;return function(b){if(!b)return"";return b.replace(a,"")}}(),numbers:function(){var a=/\D/g;return function(b){return(b=(b||"").replace(a,""))||null}}()},j={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[String(b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",
right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[String(b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[String(b).toLowerCase()]}}(),size_font:function(){var a={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",
6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(b){return a[String(b).charAt(0)]}}()};return function(b,c,d,j){wysihtml5.lang.object(f).merge(h).merge(c).get();for(var d=d||b.ownerDocument||document,c=d.createDocumentFragment(),e=typeof b==="string",b=e?wysihtml5.dom.getAsDom(b,d):b;b.firstChild;)d=b.firstChild,b.removeChild(d),(d=a(d,j))&&c.appendChild(d);b.innerHTML="";b.appendChild(c);return e?wysihtml5.quirks.getCorrectInnerHTML(b):
b}}();wysihtml5.dom.removeEmptyTextNodes=function(a){for(var c=wysihtml5.lang.array(a.childNodes).get(),b=c.length,d=0;d<b;d++)a=c[d],a.nodeType===wysihtml5.TEXT_NODE&&a.data===""&&a.parentNode.removeChild(a)};wysihtml5.dom.renameElement=function(a,c){for(var b=a.ownerDocument.createElement(c),d;d=a.firstChild;)b.appendChild(d);wysihtml5.dom.copyAttributes(["align","className"]).from(a).to(b);a.parentNode.replaceChild(b,a);return b};
wysihtml5.dom.replaceWithChildNodes=function(a){if(a.parentNode)if(a.firstChild){for(var c=a.ownerDocument.createDocumentFragment();a.firstChild;)c.appendChild(a.firstChild);a.parentNode.replaceChild(c,a)}else a.parentNode.removeChild(a)};
(function(a){function c(a){var c=a.ownerDocument.createElement("br");a.appendChild(c)}a.resolveList=function(b){if(!(b.nodeName!=="MENU"&&b.nodeName!=="UL"&&b.nodeName!=="OL")){var d=b.ownerDocument.createDocumentFragment(),e=b.previousSibling,h,f,i;for(e&&a.getStyle("display").from(e)!=="block"&&c(d);i=b.firstChild;){for(h=i.lastChild;e=i.firstChild;)f=(f=e===h)&&a.getStyle("display").from(e)!=="block"&&e.nodeName!=="BR",d.appendChild(e),f&&c(d);i.parentNode.removeChild(i)}b.parentNode.replaceChild(d,
b)}}})(wysihtml5.dom);
(function(a){var c={uaCompatible:"IE=Edge"},b=document,d=["parent","top","opener","frameElement","frames","localStorage","globalStorage","sessionStorage","indexedDB"],e=["open","close","openDialog","showModalDialog","alert","confirm","prompt","openDatabase","postMessage","XMLHttpRequest","XDomainRequest"],h=["referrer","write","open","close"];a.dom.Sandbox=Base.extend({constructor:function(b,d){this.callback=b||a.EMPTY_FUNCTION;this.config=a.lang.object({}).merge(c).merge(d).get();this.iframe=this._createIframe()},
insertInto:function(a){typeof a==="string"&&(a=b.getElementById(a));a.appendChild(this.iframe)},getIframe:function(){return this.iframe},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet");},_createIframe:function(){var c=this,d=b.createElement("iframe");d.className="wysihtml5-sandbox";a.dom.setAttributes({security:"restricted",
allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d);if(a.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty())d.src="javascript:'<html></html>'";d.onload=function(){d.onreadystatechange=d.onload=null;c._onLoadIframe(d)};d.onreadystatechange=function(){if(/loaded|complete/.test(d.readyState))d.onreadystatechange=d.onload=null,c._onLoadIframe(d)};return d},_onLoadIframe:function(c){if(a.dom.contains(b.documentElement,c)){var i=this,k=c.contentWindow,j=c.contentDocument||
c.contentWindow.document,c=this._getHtml({charset:b.characterSet||b.charset||"utf-8",stylesheets:this.config.stylesheets,uaCompatible:this.config.uaCompatible});j.open("text/html","replace");j.write(c);j.close();this.getWindow=function(){return k};this.getDocument=function(){return j};k.onerror=function(a,b,c){throw Error("wysihtml5.Sandbox: "+a,b,c);};if(!a.browser.supportsSandboxedIframes()){var g,c=0;for(g=d.length;c<g;c++)this._unset(k,d[c]);c=0;for(g=e.length;c<g;c++)this._unset(k,e[c],a.EMPTY_FUNCTION);
c=0;for(g=h.length;c<g;c++)this._unset(j,h[c]);this._unset(j,"cookie","",!0)}this.loaded=!0;setTimeout(function(){i.callback(i)},0)}},_getHtml:function(b){var c=b.stylesheets,d="",j=0,g;if(c=typeof c==="string"?[c]:c)for(g=c.length;j<g;j++)d+='<link rel="stylesheet" href="'+c[j]+'">';b.stylesheets=d;return a.lang.string('<!DOCTYPE html><html><head><meta http-equiv="X-UA-Compatible" content="#{uaCompatible}"><meta charset="#{charset}">#{stylesheets}</head><body></body></html>').interpolate(b)},_unset:function(b,
c,d,j){try{b[c]=d}catch(g){}try{b.__defineGetter__(c,function(){return d})}catch(e){}if(j)try{b.__defineSetter__(c,function(){})}catch(h){}if(!a.browser.crashesWhenDefineProperty(c))try{var q={get:function(){return d}};if(j)q.set=function(){};Object.defineProperty(b,c,q)}catch(t){}}})})(wysihtml5);(function(){var a={className:"class"};wysihtml5.dom.setAttributes=function(c){return{on:function(b){for(var d in c)b.setAttribute(a[d]||d,c[d])}}}})();
wysihtml5.dom.setStyles=function(a){return{on:function(c){c=c.style;if(typeof a==="string")c.cssText+=";"+a;else for(var b in a)b==="float"?(c.cssFloat=a[b],c.styleFloat=a[b]):c[b]=a[b]}}};
(function(a){a.simulatePlaceholder=function(c,b,d){var e=function(){b.hasPlaceholderSet()&&b.clear();a.removeClass(b.element,"placeholder")},h=function(){b.isEmpty()&&(b.setValue(d),a.addClass(b.element,"placeholder"))};c.observe("set_placeholder",h).observe("unset_placeholder",e).observe("focus:composer",e).observe("paste:composer",e).observe("blur:composer",h);h()}})(wysihtml5.dom);
(function(a){var c=document.documentElement;"textContent"in c?(a.setTextContent=function(a,c){a.textContent=c},a.getTextContent=function(a){return a.textContent}):"innerText"in c?(a.setTextContent=function(a,c){a.innerText=c},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,c){a.nodeValue=c},a.getTextContent=function(a){return a.nodeValue})})(wysihtml5.dom);
wysihtml5.quirks.cleanPastedHTML=function(){var a={"a u":wysihtml5.dom.replaceWithChildNodes};return function(c,b,d){var b=b||a,d=d||c.ownerDocument||document,e=typeof c==="string",h,f,i,k=0,c=e?wysihtml5.dom.getAsDom(c,d):c;for(i in b){h=c.querySelectorAll(i);d=b[i];for(f=h.length;k<f;k++)d(h[k])}return e?c.innerHTML:c}}();
(function(a){var c=a.dom;a.quirks.ensureProperClearing=function(){var a=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();if(b=="<p> </p>"||b=="<p> </p><p> </p>")a.innerHTML=""},0)};return function(d){c.observe(d,["cut","keydown"],a)}}();a.quirks.ensureProperClearingOfLists=function(){var b=["OL","UL","MENU"];return function(d){c.observe(d,"keydown",function(e){e.keyCode===a.BACKSPACE_KEY&&(e=a.selection.getSelectedNode(d.ownerDocument),d.firstChild&&a.lang.array(b).contains(d.firstChild.nodeName)&&
(e=c.getParentElement(e,{nodeName:b}))&&e==d.firstChild&&e.childNodes.length<=1&&(e.firstChild?e.firstChild.innerHTML==="":1)&&e.parentNode.removeChild(e))})}}()})(wysihtml5);(function(a){a.quirks.getCorrectInnerHTML=function(c){var b=c.innerHTML;if(b.indexOf("%7E")===-1)return b;var c=c.querySelectorAll("[href*='~'], [src*='~']"),d,e,h,f;f=0;for(h=c.length;f<h;f++)d=c[f].href||c[f].src,e=a.lang.string(d).replace("~").by("%7E"),b=a.lang.string(b).replace(e).by(d);return b}})(wysihtml5);
(function(a){function c(c){var f=c.keyCode;if(!(c.shiftKey||f!==a.ENTER_KEY&&f!==a.BACKSPACE_KEY)){var i=c.target,k=a.selection.getSelectedNode(i.ownerDocument);(k=b.getParentElement(k,{nodeName:d},4))?k.nodeName==="LI"&&(f===a.ENTER_KEY||f===a.BACKSPACE_KEY)&&setTimeout(function(){var c=a.selection.getSelectedNode(i.ownerDocument);c&&!b.getParentElement(c,{nodeName:e},2)&&c.parentNode.nodeName==="P"&&(c=b.renameElement(c.parentNode,"div"),a.selection.selectNode(c))},0):f===a.ENTER_KEY&&(a.commands.exec(i,
"insertLineBreak"),c.preventDefault())}}var b=a.dom,d=["LI","DIV","P","H1","H2","H3","H4","H5","H6"],e=["UL","OL","MENU"];a.quirks.insertLineBreakOnReturn=function(a){b.observe(a.ownerDocument,"keydown",c)}})(wysihtml5);(function(a){a.quirks.redraw=function(c){a.dom.addClass(c,"wysihtml5-quirks-redraw");a.dom.removeClass(c,"wysihtml5-quirks-redraw");try{var b=c.ownerDocument;b.execCommand("italic",!1,null);b.execCommand("italic",!1,null)}catch(d){}}})(wysihtml5);
(function(a){function c(a){var f;f=a._wysihtml5CaretPlaceholder=a._wysihtml5CaretPlaceholder||a.createElement("span"),a=f;a.innerHTML=e;return a}function b(a){var b=c(a),d=h.getTextContent(b),e=a.getElementById(b.id),g=0;if(h.contains(a.body,b))return b;else if(e)return e;else{b=a.getElementsByTagName("*");for(e=b.length;g<e;g++)if(a=b[g],a.innerHTML===d)return a;return null}}function d(a){var b=0;if(a.parentNode){do b+=a.offsetTop||0,a=a.offsetParent;while(a)}return b}var e="--_CARET_--",h=a.dom;
a.selection={PLACEHOLDER_TEXT:e,getBookmark:function(a){return(a=this.getRange(a))&&a.cloneRange()},setBookmark:function(a){a&&this.setSelection(a)},setBefore:function(a){var b=rangy.createRange(a.ownerDocument);b.setStartBefore(a);b.setEndBefore(a);return this.setSelection(b)},setAfter:function(a){var b=rangy.createRange(a.ownerDocument);b.setStartAfter(a);b.setEndAfter(a);return this.setSelection(b)},selectNode:function(b){var c=rangy.createRange(b.ownerDocument),d=b.nodeType===a.ELEMENT_NODE,e=
"canHaveHTML"in b?b.canHaveHTML:b.nodeName!=="IMG",g=d?b.innerHTML:b.data,g=g===""||g===a.INVISIBLE_SPACE,l=h.getStyle("display").from(b),l=l==="block"||l==="list-item";if(g&&d&&e)try{b.innerHTML=a.INVISIBLE_SPACE}catch(n){}e?c.selectNodeContents(b):c.selectNode(b);e&&g&&d?c.collapse(l):e&&g&&(c.setStartAfter(b),c.setEndAfter(b));this.setSelection(c)},getSelectedNode:function(a,b){var c;if(b&&a.selection&&a.selection.type==="Control"&&(c=a.selection.createRange())&&c.length)return c.item(0);c=this.getSelection(a);
return c.focusNode===c.anchorNode?c.focusNode:(c=this.getRange(a))?c.commonAncestorContainer:a.body},executeAndRestore:function(a,d,e){if(!window.getSelection)return this.executeAndRestoreSimple(a,d);var j=a.body,g=j.scrollTop,h=j.scrollLeft,n=this.getRange(a),q=c(a);if(n){n.insertNode(q);try{d(n.startContainer,n.endContainer)}catch(t){setTimeout(function(){throw t;},0)}if(d=b(a))a=rangy.createRange(a),a.selectNode(d),a.deleteContents(),this.setSelection(a);if(e)j.scrollTop=g,j.scrollLeft=h;try{d.parentNode.removeChild(d)}catch(o){}}else d(j,
j)},executeAndRestoreSimple:function(a,b){var c=this.getRange(a),d,g;if(c){g=c.getNodes([3]);d=g[0]||c.startContainer;g=g[g.length-1]||c.endContainer;d={collapsed:c.collapsed,startContainer:d,startOffset:d===c.startContainer?c.startOffset:0,endContainer:g,endOffset:g===c.endContainer?c.endOffset:g.length};try{b(c.startContainer,c.endContainer)}catch(e){setTimeout(function(){throw e;},0)}c=rangy.createRange(a);try{c.setStart(d.startContainer,d.startOffset)}catch(h){}try{c.setEnd(d.endContainer,d.endOffset)}catch(q){}try{this.setSelection(c)}catch(t){}}else b(a.body,
a.body)},insertHTML:function(a,b){var c=rangy.createRange(a).createContextualFragment(b),d=c.lastChild;this.insertNode(c);d&&this.setAfter(d)},insertNode:function(a){var b=this.getRange(a.ownerDocument);if(b)b.insertNode(a);else return!1},surround:function(a){var b=this.getRange(a.ownerDocument);if(b)try{b.surroundContents(a),this.selectNode(a)}catch(c){a.appendChild(b.extractContents()),b.insertNode(a)}},scrollIntoView:function(b){var c=b.ownerDocument,e=c.documentElement.scrollHeight>c.documentElement.offsetHeight,
j=c._wysihtml5ScrollIntoViewElement=c._wysihtml5ScrollIntoViewElement||function(){var b=c.createElement("span");b.innerHTML=a.INVISIBLE_SPACE;return b}();if(e&&(this.insertNode(j),e=d(j),j.parentNode.removeChild(j),e>b.scrollTop))b.scrollTop=e},selectLine:function(b){a.browser.supportsSelectionModify()?this._selectLine_W3C(b):b.selection&&this._selectLine_MSIE(b)},_selectLine_W3C:function(a){a=a.defaultView.getSelection();a.modify("extend","left","lineboundary");a.modify("extend","right","lineboundary")},
_selectLine_MSIE:function(a){var b=a.selection.createRange(),c=b.boundingTop,d=a.body.scrollWidth,g;if(b.moveToPoint){if(c===0)g=a.createElement("span"),this.insertNode(g),c=g.offsetTop,g.parentNode.removeChild(g);c+=1;for(g=-10;g<d;g+=2)try{b.moveToPoint(g,c);break}catch(e){}for(a=a.selection.createRange();d>=0;d--)try{a.moveToPoint(d,c);break}catch(h){}b.setEndPoint("EndToEnd",a);b.select()}},getText:function(a){return(a=this.getSelection(a))?a.toString():""},getNodes:function(a,b,c){return(a=this.getRange(a))?
a.getNodes([b],c):[]},getRange:function(a){return(a=this.getSelection(a))&&a.rangeCount&&a.getRangeAt(0)},getSelection:function(a){return rangy.getSelection(a.defaultView||a.parentWindow)},setSelection:function(a){var b=(a.startContainer||a.endContainer).ownerDocument;return rangy.getSelection(b.defaultView||b.parentWindow).setSingleRange(a)}}})(wysihtml5);
(function(a,c){function b(a,b){if(a.attributes.length!=b.attributes.length)return!1;for(var c=0,d=a.attributes.length,e,f;c<d;++c)if(e=a.attributes[c],f=e.name,f!="class"){f=b.attributes.getNamedItem(f);if(e.specified!=f.specified)return!1;if(e.specified&&e.nodeValue!==f.nodeValue)return!1}return!0}function d(a,b){if(c.dom.isCharacterDataNode(a))return b==0?!!a.previousSibling:b==a.length?!!a.nextSibling:!0;return b>0&&b<a.childNodes.length}function e(a,b,d){var f;if(c.dom.isCharacterDataNode(b))d==
0?(d=c.dom.getNodeIndex(b),b=b.parentNode):d==b.length?(d=c.dom.getNodeIndex(b)+1,b=b.parentNode):f=c.dom.splitDataNode(b,d);if(!f){f=b.cloneNode(!1);f.id&&f.removeAttribute("id");for(var h;h=b.childNodes[d];)f.appendChild(h);c.dom.insertAfter(f,b)}return b==a?f:e(a,f.parentNode,c.dom.getNodeIndex(f))}function h(b){this.firstTextNode=(this.isElementMerge=b.nodeType==a.ELEMENT_NODE)?b.lastChild:b;this.textNodes=[this.firstTextNode]}function f(a,b,c,d){this.tagNames=a||[i];this.cssClass=b||"";this.similarClassRegExp=
c;this.normalize=d;this.applyToAnyTagName=!1}var i="span",k=/\s+/g;h.prototype={doMerge:function(){for(var a=[],b,c,d=0,e=this.textNodes.length;d<e;++d)b=this.textNodes[d],c=b.parentNode,a[d]=b.data,d&&(c.removeChild(b),c.hasChildNodes()||c.parentNode.removeChild(c));return this.firstTextNode.data=a=a.join("")},getLength:function(){for(var a=this.textNodes.length,b=0;a--;)b+=this.textNodes[a].length;return b},toString:function(){for(var a=[],b=0,c=this.textNodes.length;b<c;++b)a[b]="'"+this.textNodes[b].data+
"'";return"[Merge("+a.join(",")+")]"}};f.prototype={getAncestorWithClass:function(b){for(var d;b;){if(this.cssClass)if(d=this.cssClass,b.className){var e=b.className.match(this.similarClassRegExp)||[];d=e[e.length-1]===d}else d=!1;else d=!0;if(b.nodeType==a.ELEMENT_NODE&&c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())&&d)return b;b=b.parentNode}return!1},postApply:function(a,b){for(var c=a[0],d=a[a.length-1],e=[],f,i=c,k=d,r=0,s=d.length,x,p,v=0,B=a.length;v<B;++v)if(x=a[v],p=this.getAdjacentMergeableTextNode(x.parentNode,
!1)){f||(f=new h(p),e.push(f));f.textNodes.push(x);if(x===c)i=f.firstTextNode,r=i.length;if(x===d)k=f.firstTextNode,s=f.getLength()}else f=null;if(c=this.getAdjacentMergeableTextNode(d.parentNode,!0))f||(f=new h(d),e.push(f)),f.textNodes.push(c);if(e.length){v=0;for(B=e.length;v<B;++v)e[v].doMerge();b.setStart(i,r);b.setEnd(k,s)}},getAdjacentMergeableTextNode:function(b,c){var d=b.nodeType==a.TEXT_NODE,e=d?b.parentNode:b,f=c?"nextSibling":"previousSibling";if(d){if((d=b[f])&&d.nodeType==a.TEXT_NODE)return d}else if((d=
e[f])&&this.areElementsMergeable(b,d))return d[c?"firstChild":"lastChild"];return null},areElementsMergeable:function(a,d){return c.dom.arrayContains(this.tagNames,(a.tagName||"").toLowerCase())&&c.dom.arrayContains(this.tagNames,(d.tagName||"").toLowerCase())&&a.className.replace(k," ")==d.className.replace(k," ")&&b(a,d)},createContainer:function(a){a=a.createElement(this.tagNames[0]);if(this.cssClass)a.className=this.cssClass;return a},applyToTextNode:function(a){var b=a.parentNode;if(b.childNodes.length==
1&&c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())){if(this.cssClass)if(a=this.cssClass,b.className){if(b.className)b.className=b.className.replace(this.similarClassRegExp,"");b.className+=" "+a}else b.className=a}else b=this.createContainer(c.dom.getDocument(a)),a.parentNode.insertBefore(b,a),b.appendChild(a)},isRemovable:function(b){return c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())&&a.lang.string(b.className).trim()==this.cssClass},undoToTextNode:function(a,b,c){b.containsNode(c)||
(a=b.cloneRange(),a.selectNode(c),a.isPointInRange(b.endContainer,b.endOffset)&&d(b.endContainer,b.endOffset)&&(e(c,b.endContainer,b.endOffset),b.setEndAfter(c)),a.isPointInRange(b.startContainer,b.startOffset)&&d(b.startContainer,b.startOffset)&&(c=e(c,b.startContainer,b.startOffset)));if(this.similarClassRegExp&&c.className)c.className=c.className.replace(this.similarClassRegExp,"");if(this.isRemovable(c)){b=c;for(c=b.parentNode;b.firstChild;)c.insertBefore(b.firstChild,b);c.removeChild(b)}},applyToRange:function(b){var c=
b.getNodes([a.TEXT_NODE]);if(!c.length)try{var d=this.createContainer(b.endContainer.ownerDocument);b.surroundContents(d);this.selectNode(b,d);return}catch(e){}b.splitBoundaries();c=b.getNodes([a.TEXT_NODE]);if(c.length){for(var f=0,h=c.length;f<h;++f)d=c[f],this.getAncestorWithClass(d)||this.applyToTextNode(d);b.setStart(c[0],0);d=c[c.length-1];b.setEnd(d,d.length);this.normalize&&this.postApply(c,b)}},undoToRange:function(b){var c=b.getNodes([a.TEXT_NODE]),d,e;c.length?(b.splitBoundaries(),c=b.getNodes([a.TEXT_NODE])):
(c=b.endContainer.ownerDocument.createTextNode(a.INVISIBLE_SPACE),b.insertNode(c),b.selectNode(c),c=[c]);for(var f=0,h=c.length;f<h;++f)d=c[f],(e=this.getAncestorWithClass(d))&&this.undoToTextNode(d,b,e);h==1?this.selectNode(b,c[0]):(b.setStart(c[0],0),d=c[c.length-1],b.setEnd(d,d.length),this.normalize&&this.postApply(c,b))},selectNode:function(b,c){var d=c.nodeType===a.ELEMENT_NODE,e="canHaveHTML"in c?c.canHaveHTML:!0,f=d?c.innerHTML:c.data;if((f=f===""||f===a.INVISIBLE_SPACE)&&d&&e)try{c.innerHTML=
a.INVISIBLE_SPACE}catch(h){}b.selectNodeContents(c);f&&d?b.collapse(!1):f&&(b.setStartAfter(c),b.setEndAfter(c))},getTextSelectedByRange:function(a,b){var c=b.cloneRange();c.selectNodeContents(a);var d=c.intersection(b),d=d?d.toString():"";c.detach();return d},isAppliedToRange:function(b){var c=[],d,e=b.getNodes([a.TEXT_NODE]);if(!e.length)return(d=this.getAncestorWithClass(b.startContainer))?[d]:!1;for(var f=0,h=e.length,i;f<h;++f)if(i=this.getTextSelectedByRange(e[f],b),d=this.getAncestorWithClass(e[f]),
i!=""&&!d)return!1;else c.push(d);return c},toggleRange:function(a){this.isAppliedToRange(a)?this.undoToRange(a):this.applyToRange(a)}};a.selection.HTMLApplier=f})(wysihtml5,rangy);
wysihtml5.views.View=Base.extend({constructor:function(a,c,b){this.parent=a;this.element=c;this.config=b;this._observeViewChange()},_observeViewChange:function(){var a=this;this.parent.observe("beforeload",function(){a.parent.observe("change_view",function(c){c===a.name?(a.parent.currentView=a,a.show(),setTimeout(function(){a.focus()},0)):a.hide()})})},focus:function(){if(this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element.focus()}catch(a){}},hide:function(){this.element.style.display=
"none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}});
(function(a){var c=a.dom,b=a.browser,d=a.selection;a.views.Composer=a.views.View.extend({name:"composer",CARET_HACK:"<br>",constructor:function(a,b,c){this.base(a,b,c);this.textarea=this.parent.textarea;this._initSandbox()},clear:function(){this.element.innerHTML=b.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(b){var c=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);b&&(c=this.parent.parse(c));c=a.lang.string(c).replace(a.INVISIBLE_SPACE).by("");
return c=a.lang.string(c).replace(d.PLACEHOLDER_TEXT).by("")},setValue:function(a,b){b&&(a=this.parent.parse(a));this.element.innerHTML=a},show:function(){this.iframe.style.display=this._displayStyle||"";this.disable();this.enable()},hide:function(){this._displayStyle=c.getStyle("display").from(this.iframe);if(this._displayStyle==="none")this._displayStyle=null;this.iframe.style.display="none"},disable:function(){this.element.removeAttribute("contentEditable");this.base()},enable:function(){this.element.setAttribute("contentEditable",
"true");this.base()},getTextContent:function(){return c.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==this.textarea.element.getAttribute("placeholder")},isEmpty:function(){var a=this.element.innerHTML;return a===""||a===this.CARET_HACK||this.hasPlaceholderSet()||this.getTextContent()===""&&!this.element.querySelector("blockquote, ul, ol, img, embed, object, table, iframe, svg, video, audio, button, input, select, textarea")},_initSandbox:function(){var a=
this;this.sandbox=new c.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets,uaCompatible:"IE=7"});this.iframe=this.sandbox.getIframe();var b=document.createElement("input");b.type="hidden";b.name="_wysihtml5_mode";b.value=1;var d=this.textarea.element;c.insert(this.iframe).after(d);c.insert(b).after(d)},_create:function(){var d=this;this.element=this.sandbox.getDocument().body;this.textarea=this.parent.textarea;this.element.innerHTML=this.textarea.getValue(!0);this.enable();window.rangy.init();
c.copyAttributes(["className","spellcheck","title","lang","dir","accessKey"]).from(this.textarea.element).to(this.element);c.addClass(this.element,this.config.composerClassName);this.config.style&&this.style();this.observe();var h=this.config.name;h&&(c.addClass(this.element,h),c.addClass(this.iframe,h));(h=typeof this.config.placeholder==="string"?this.config.placeholder:this.textarea.element.getAttribute("placeholder"))&&c.simulatePlaceholder(this.parent,this,h);a.commands.exec(this.element,"styleWithCSS",
!1);this._initAutoLinking();this._initObjectResizing();(this.textarea.element.hasAttribute("autofocus")||document.querySelector(":focus")==this.textarea.element)&&setTimeout(function(){d.focus()},100);b.insertsLineBreaksOnReturn()||a.quirks.insertLineBreakOnReturn(this.element);b.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this.element);b.clearsListsInContentEditableCorrectly()||a.quirks.ensureProperClearingOfLists(this.element);this.initSync&&this.config.sync&&this.initSync();
this.textarea.hide();this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var e=b.canDisableAutoLinking(),h=b.doesAutoLinkingInContentEditable();e&&a.commands.exec(this.element,"autoUrlDetect",!1);if(this.config.autoLink){var f=this.sandbox.getDocument();(!h||h&&e)&&this.parent.observe("newword:composer",function(){d.executeAndRestore(f,function(a,b){c.autoLink(b.parentNode)})});var i=f.getElementsByTagName("a"),k=c.autoLink.URL_REG_EXP,j=function(b){b=a.lang.string(c.getTextContent(b)).trim();
b.substr(0,4)==="www."&&(b="http://"+b);return b};c.observe(this.element,"keydown",function(a){if(i.length){var a=d.getSelectedNode(a.target.ownerDocument),b=c.getParentElement(a,{nodeName:"A"},4),e;b&&(e=j(b),setTimeout(function(){var a=j(b);a!==e&&a.match(k)&&b.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){var d=["width","height"],h=d.length,f=this.element;a.commands.exec(f,"enableObjectResizing",this.config.allowObjectResizing);this.config.allowObjectResizing?b.supportsEvent("resizeend")&&
c.observe(f,"resizeend",function(b){for(var b=b.target||b.srcElement,c=b.style,j=0,g;j<h;j++)g=d[j],c[g]&&(b.setAttribute(g,parseInt(c[g],10)),c[g]="");a.quirks.redraw(f)}):b.supportsEvent("resizestart")&&c.observe(f,"resizestart",function(a){a.preventDefault()})}})})(wysihtml5);
(function(a){var c=a.dom,b=document,d=window,e=b.createElement("div"),h=["background-color","color","cursor","font-family","font-size","font-style","font-variant","font-weight","line-height","letter-spacing","text-align","text-decoration","text-indent","text-rendering","word-break","word-wrap","word-spacing"],f=["background-color","border-collapse","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width","border-right-color","border-right-style",
"border-right-width","border-top-color","border-top-style","border-top-width","clear","display","float","margin-bottom","margin-left","margin-right","margin-top","outline-color","outline-offset","outline-width","outline-style","padding-left","padding-right","padding-top","padding-bottom","position","top","left","right","bottom","z-index","vertical-align","text-align","-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing","-webkit-box-shadow","-moz-box-shadow","-ms-box-shadow","box-shadow",
"width","height"],i=["width","height","top","left","right","bottom"],k=["html { height: 100%; }","body { min-height: 100%; padding: 0; margin: 0; margin-top: -1px; padding-top: 1px; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","body[disabled] { background-color: #eee !important; color: #999 !important; cursor: default !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],
j=function(a){if(a.setActive)a.setActive();else{var e=a.style,f=b.documentElement.scrollTop||b.body.scrollTop,h=b.documentElement.scrollLeft||b.body.scrollLeft,e={position:e.position,top:e.top,left:e.left,WebkitUserSelect:e.WebkitUserSelect};c.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a);a.focus();c.setStyles(e).on(a);d.scrollTo&&d.scrollTo(h,f)}};a.views.Composer.prototype.style=function(){var g=this,l=b.querySelector(":focus"),n=this.textarea.element,
q=n.hasAttribute("placeholder"),t=q&&n.getAttribute("placeholder");this.focusStylesHost=this.focusStylesHost||e.cloneNode(!1);this.blurStylesHost=this.blurStylesHost||e.cloneNode(!1);q&&n.removeAttribute("placeholder");n===l&&n.blur();c.copyStyles(f).from(n).to(this.iframe).andTo(this.blurStylesHost);c.copyStyles(h).from(n).to(this.element).andTo(this.blurStylesHost);c.insertCSS(k).into(this.element.ownerDocument);j(n);c.copyStyles(f).from(n).to(this.focusStylesHost);c.copyStyles(h).from(n).to(this.focusStylesHost);
var o=a.lang.array(f).without(["display"]);l?l.focus():n.blur();q&&n.setAttribute("placeholder",t);a.browser.hasCurrentStyleProperty()||c.observe(d,"resize",function(){var a=c.getStyle("display").from(n);n.style.display="";c.copyStyles(i).from(n).to(g.iframe).andTo(g.focusStylesHost).andTo(g.blurStylesHost);n.style.display=a});this.parent.observe("focus:composer",function(){c.copyStyles(o).from(g.focusStylesHost).to(g.iframe);c.copyStyles(h).from(g.focusStylesHost).to(g.element)});this.parent.observe("blur:composer",
function(){c.copyStyles(o).from(g.blurStylesHost).to(g.iframe);c.copyStyles(h).from(g.blurStylesHost).to(g.element)});return this}})(wysihtml5);
(function(a){var c=a.dom,b=a.browser,d={66:"bold",73:"italic",85:"underline"};a.views.Composer.prototype.observe=function(){var e=this,h=this.getValue(),f=this.sandbox.getIframe(),i=this.element,k=b.supportsEventsInIframeCorrectly()?i:this.sandbox.getWindow(),j=b.supportsEvent("drop")?["drop","paste"]:["dragdrop","paste"];c.observe(f,"DOMNodeRemoved",function(){clearInterval(g);e.parent.fire("destroy:composer")});var g=setInterval(function(){c.contains(document.documentElement,f)||(clearInterval(g),
e.parent.fire("destroy:composer"))},250);c.observe(k,"focus",function(){e.parent.fire("focus").fire("focus:composer");setTimeout(function(){h=e.getValue()},0)});c.observe(k,"blur",function(){h!==e.getValue()&&e.parent.fire("change").fire("change:composer");e.parent.fire("blur").fire("blur:composer")});c.observe(i,"dragenter",function(){e.parent.fire("unset_placeholder")});b.firesOnDropOnlyWhenOnDragOverIsCancelled()&&c.observe(i,["dragover","dragenter"],function(a){a.preventDefault()});c.observe(i,
j,function(c){var d=c.dataTransfer,f;d&&b.supportsDataTransfer()&&(f=d.getData("text/html")||d.getData("text/plain"));f?(i.focus(),a.commands.exec(i,"insertHTML",f),e.parent.fire("paste").fire("paste:composer"),c.stopPropagation(),c.preventDefault()):setTimeout(function(){e.parent.fire("paste").fire("paste:composer")},0)});c.observe(i,"keyup",function(b){b=b.keyCode;(b===a.SPACE_KEY||b===a.ENTER_KEY)&&e.parent.fire("newword:composer")});this.parent.observe("paste:composer",function(){setTimeout(function(){e.parent.fire("newword:composer")},
0)});b.canSelectImagesInContentEditable()||c.observe(i,"mousedown",function(b){var c=b.target;c.nodeName==="IMG"&&(a.selection.selectNode(c),b.preventDefault())});c.observe(i,"keydown",function(b){var c=d[b.keyCode];if((b.ctrlKey||b.metaKey)&&c)a.commands.exec(i,c),b.preventDefault()});c.observe(i,"keydown",function(b){var c=a.selection.getSelectedNode(i.ownerDocument,!0),d=b.keyCode;if(c&&c.nodeName==="IMG"&&(d===a.BACKSPACE_KEY||d===a.DELETE_KEY))d=c.parentNode,d.removeChild(c),d.nodeName==="A"&&
!d.firstChild&&d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(i)},0),b.preventDefault()});var l={IMG:"Image: ",A:"Link: "};c.observe(i,"mouseover",function(a){var a=a.target,b=a.nodeName;b!=="A"&&b!=="IMG"||(b=l[b]+(a.getAttribute("href")||a.getAttribute("src")),a.setAttribute("title",b))})}})(wysihtml5);
(function(a){a.views.Synchronizer=Base.extend({constructor:function(a,b,d){this.editor=a;this.textarea=b;this.composer=d;this._observe()},fromComposerToTextarea:function(c){this.textarea.setValue(a.lang.string(this.composer.getValue()).trim(),c)},fromTextareaToComposer:function(a){var b=this.textarea.getValue();b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){this.editor.currentView.name==="textarea"?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)},
_observe:function(){var c,b=this,d=this.textarea.element.form,e=function(){c=setInterval(function(){b.fromComposerToTextarea()},400)},h=function(){clearInterval(c);c=null};e();d&&(a.dom.observe(d,"submit",function(){b.sync(!0)}),a.dom.observe(d,"reset",function(){setTimeout(function(){b.fromTextareaToComposer()},0)}));this.editor.observe("change_view",function(a){a==="composer"&&!c?(b.fromTextareaToComposer(!0),e()):a==="textarea"&&(b.fromComposerToTextarea(!0),h())});this.editor.observe("destroy:composer",
h)}})})(wysihtml5);
wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(a,c,b){this.base(a,c,b);this._observe()},clear:function(){this.element.value=""},getValue:function(a){var c=this.isEmpty()?"":this.element.value;a&&(c=this.parent.parse(c));return c},setValue:function(a,c){c&&(a=this.parent.parse(a));this.element.value=a},hasPlaceholderSet:function(){var a=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,b=this.element.value;
return a&&!b||b===c},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var a=this.element,c=this.parent,b={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.observe("beforeload",function(){wysihtml5.dom.observe(a,d,function(a){a=b[a.type]||a.type;c.fire(a).fire(a+":textarea")});wysihtml5.dom.observe(a,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")},
0)})})}});
(function(a){var c=a.dom;a.toolbar.Dialog=a.lang.Dispatcher.extend({constructor:function(a,c){this.link=a;this.container=c},_observe:function(){if(!this._observed){var b=this,d=function(a){var c=b._serialize();c==b.elementToChange?b.fire("edit",c):b.fire("save",c);b.hide();a.preventDefault();a.stopPropagation()};c.observe(b.link,"click",function(){c.hasClass(b.link,"wysihtml5-command-dialog-opened")&&setTimeout(function(){b.hide()},0)});c.observe(this.container,"keydown",function(c){var e=c.keyCode;
e===a.ENTER_KEY&&d(c);e===a.ESCAPE_KEY&&b.hide()});c.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",d);c.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(a){b.fire("cancel");b.hide();a.preventDefault();a.stopPropagation()});for(var e=this.container.querySelectorAll("input, select, textarea"),h=0,f=e.length,i=function(){clearInterval(b.interval)};h<f;h++)c.observe(e[h],"change",i);this._observed=!0}},_serialize:function(){for(var a=this.elementToChange||
{},c=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),e=c.length,h=0;h<e;h++)a[c[h].getAttribute("data-wysihtml5-dialog-field")]=c[h].value;return a},_interpolate:function(){for(var a,c,e=document.querySelector(":focus"),h=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),f=h.length,i=0;i<f;i++)if(a=h[i],a!==e)c=a.getAttribute("data-wysihtml5-dialog-field"),c=this.elementToChange?this.elementToChange[c]||"":a.defaultValue,a.value=c},show:function(a){var d=this,e=this.container.querySelector("input, select, textarea");
this.elementToChange=a;this._observe();this._interpolate();if(a)this.interval=setInterval(function(){d._interpolate()},500);c.addClass(this.link,"wysihtml5-command-dialog-opened");this.container.style.display="";this.fire("show");if(e&&!a)try{e.focus()}catch(h){}},hide:function(){clearInterval(this.interval);this.elementToChange=null;c.removeClass(this.link,"wysihtml5-command-dialog-opened");this.container.style.display="none";this.fire("hide")}})})(wysihtml5);
(function(a){var c=a.dom,b={position:"relative"},d={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},e={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-12px",top:"50%"},h={"x-webkit-speech":"",speech:""};a.toolbar.Speech=function(f,i){var k=document.createElement("input");if(a.browser.supportsSpeechApiOn(k)){var j=document.createElement("div");a.lang.object(d).merge({width:i.offsetWidth+"px",
height:i.offsetHeight+"px"});c.insert(k).into(j);c.insert(j).into(i);c.setStyles(e).on(k);c.setAttributes(h).on(k);c.setStyles(d).on(j);c.setStyles(b).on(i);c.observe(k,"onwebkitspeechchange"in k?"webkitspeechchange":"speechchange",function(){f.execCommand("insertText",k.value);k.value=""});c.observe(k,"click",function(a){c.hasClass(i,"wysihtml5-command-disabled")&&a.preventDefault();a.stopPropagation()})}else i.style.display="none"}})(wysihtml5);
(function(a){var c=a.dom;a.toolbar.Toolbar=Base.extend({constructor:function(b,c){this.editor=b;this.container=typeof c==="string"?document.getElementById(c):c;this.composer=b.composer;this._getLinks("command");this._getLinks("action");this._observe();this.show();for(var e=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),h=e.length,f=0;f<h;f++)new a.toolbar.Speech(this,e[f])},_getLinks:function(b){for(var c=this[b+"Links"]=a.lang.array(this.container.querySelectorAll("a[data-wysihtml5-"+
b+"]")).get(),e=c.length,h=0,f=this[b+"Mapping"]={},i,k,j,g;h<e;h++)i=c[h],k=i.getAttribute("data-wysihtml5-"+b),j=i.getAttribute("data-wysihtml5-"+b+"-value"),g=this._getDialog(i,k),f[k+":"+j]={link:i,name:k,value:j,dialog:g,state:!1}},_getDialog:function(b,c){var e=this,h=this.container.querySelector("[data-wysihtml5-dialog='"+c+"']"),f=this.composer.sandbox.getDocument(),i,k;h&&(i=new a.toolbar.Dialog(b,h),i.observe("show",function(){k=a.selection.getBookmark(f)}),i.observe("save",function(b){e.editor.focus(!1);
k&&a.selection.setBookmark(k);e._execCommand(c,b)}),i.observe("cancel",function(){e.editor.focus(!1)}));return i},execCommand:function(a,c){if(!this.commandsDisabled){var e=this.commandMapping[a+":"+c];e&&e.dialog&&!e.state?e.dialog.show():this._execCommand(a,c)}},_execCommand:function(b,c){this.editor.focus(!1);a.commands.exec(this.composer.element,b,c);this._updateLinkStates()},execAction:function(a){var c=this.editor;switch(a){case "change_view":c.currentView===c.textarea?c.fire("change_view",
"composer"):c.fire("change_view","textarea")}},_observe:function(){for(var a=this,d=this.editor,e=this.container,h=this.commandLinks.concat(this.actionLinks),f=h.length,i=0;i<f;i++)c.setAttributes({href:"javascript:;",unselectable:"on"}).on(h[i]);c.delegate(e,"[data-wysihtml5-command]","mousedown",function(a){a.preventDefault()});c.delegate(e,"[data-wysihtml5-command]","click",function(c){var d=c.target,e=d.getAttribute("data-wysihtml5-command"),d=d.getAttribute("data-wysihtml5-command-value");a.execCommand(e,
d);c.preventDefault()});c.delegate(e,"[data-wysihtml5-action]","click",function(c){var d=c.target.getAttribute("data-wysihtml5-action");a.execAction(d);c.preventDefault()});d.observe("focus:composer",function(){a.bookmark=null;clearInterval(a.interval);a.interval=setInterval(function(){a._updateLinkStates()},500)});d.observe("blur:composer",function(){clearInterval(a.interval)});d.observe("destroy:composer",function(){clearInterval(a.interval)});d.observe("change_view",function(d){setTimeout(function(){a.commandsDisabled=
d!=="composer";a._updateLinkStates();a.commandsDisabled?c.addClass(e,"wysihtml5-commands-disabled"):c.removeClass(e,"wysihtml5-commands-disabled")},0)})},_updateLinkStates:function(){var b=this.composer.element,d=this.commandMapping,e,h,f;for(e in d)if(f=d[e],this.commandsDisabled?(h=!1,c.removeClass(f.link,"wysihtml5-command-active"),f.dialog&&f.dialog.hide()):(h=a.commands.state(b,f.name,f.value),a.lang.object(h).isArray()&&(h=h.length===1?h[0]:!0),c.removeClass(f.link,"wysihtml5-command-disabled")),
f.state!==h)(f.state=h)?(c.addClass(f.link,"wysihtml5-command-active"),f.dialog&&(typeof h==="object"?f.dialog.show(h):f.dialog.hide())):(c.removeClass(f.link,"wysihtml5-command-active"),f.dialog&&f.dialog.hide())},show:function(){this.container.style.display=""},hide:function(){this.container.style.display="none"}})})(wysihtml5);
wysihtml5.commands={support:function(a,c){return wysihtml5.browser.supportsCommand(a.ownerDocument,c)},exec:function(a,c,b){var d=this[c],e=d&&d.exec;if(e)return e.call(d,a,c,b);else try{return a.ownerDocument.execCommand(c,!1,b)}catch(h){}},state:function(a,c,b){var d=this[c],e=d&&d.state;if(e)return e.call(d,a,c,b);else try{return a.ownerDocument.queryCommandState(c)}catch(h){return!1}},value:function(a,c){var b=this[c];if(b=b&&b.value)b(a,c);else try{return a.ownerDocument.queryCommandValue(c)}catch(d){return null}}};
(function(a){a.commands.bold={exec:function(c,b){return a.commands.formatInline.exec(c,b,"b")},state:function(c,b){return a.commands.formatInline.state(c,b,"b")},value:function(){}}})(wysihtml5);
(function(a){function c(c,f){var i=c.ownerDocument,k="_wysihtml5-temp-"+(new Date).getTime(),j=0,g,l,n;a.commands.formatInline.exec(c,b,d,k,/non-matching-class/g);g=i.querySelectorAll(d+"."+k);for(k=g.length;j<k;j++)for(n in l=g[j],l.removeAttribute("class"),f)l.setAttribute(n,f[n]);j=l;k===1&&(n=e.getTextContent(l),k=!!l.querySelector("*"),n=n===""||n===a.INVISIBLE_SPACE,!k&&n&&(e.setTextContent(l,l.href),i=i.createTextNode(" "),a.selection.setAfter(l),a.selection.insertNode(i),j=i));a.selection.setAfter(j)}
var b,d="A",e=a.dom;a.commands.createLink={exec:function(b,d,i){var k=b.ownerDocument,j=this.state(b,d);j?a.selection.executeAndRestore(k,function(){for(var a=j.length,b=0,c,d,f;b<a;b++)c=j[b],d=e.getParentElement(c,{nodeName:"code"}),f=e.getTextContent(c),f.match(e.autoLink.URL_REG_EXP)&&!d?e.renameElement(c,"code"):e.replaceWithChildNodes(c)}):(i=typeof i==="object"?i:{href:i},c(b,i))},state:function(b,c){return a.commands.formatInline.state(b,c,"A")},value:function(){return b}}})(wysihtml5);
(function(a){var c=/wysiwyg-font-size-[a-z]+/g;a.commands.fontSize={exec:function(b,d,e){return a.commands.formatInline.exec(b,d,"span","wysiwyg-font-size-"+e,c)},state:function(b,d,e){return a.commands.formatInline.state(b,d,"span","wysiwyg-font-size-"+e,c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-color-[a-z]+/g;a.commands.foreColor={exec:function(b,d,e){return a.commands.formatInline.exec(b,d,"span","wysiwyg-color-"+e,c)},state:function(b,d,e){return a.commands.formatInline.state(b,d,"span","wysiwyg-color-"+e,c)},value:function(){}}})(wysihtml5);
(function(a){function c(b){for(b=b.previousSibling;b&&b.nodeType===a.TEXT_NODE&&!a.lang.string(b.data).trim();)b=b.previousSibling;return b}function b(b){for(b=b.nextSibling;b&&b.nodeType===a.TEXT_NODE&&!a.lang.string(b.data).trim();)b=b.nextSibling;return b}function d(a){if(a.nodeName==="BR")return!0;if(f.getStyle("display").from(a)==="block")return!0;return!1}function e(b,c,d,e){if(e)var h=f.observe(b,"DOMNodeInserted",function(b){b=b.target;b.nodeType===a.ELEMENT_NODE&&f.getStyle("display").from(b).substr(0,
6)!=="inline"&&(b.className+=" "+e)});b.execCommand(c,!1,d);h&&h.stop()}function h(a){i.selectLine(a.ownerDocument);i.surround(a);var d=b(a),e=c(a);d&&d.nodeName==="BR"&&d.parentNode.removeChild(d);e&&e.nodeName==="BR"&&e.parentNode.removeChild(e);(d=a.lastChild)&&d.nodeName==="BR"&&d.parentNode.removeChild(d);i.selectNode(a)}var f=a.dom,i=a.selection,k=["H1","H2","H3","H4","H5","H6","P","BLOCKQUOTE","DIV"];a.commands.formatBlock={exec:function(j,g,l,n,q){var t=j.ownerDocument,o=this.state(j,g,l,
n,q),w,l=typeof l==="string"?l.toUpperCase():l;if(o)i.executeAndRestoreSimple(t,function(){if(q)o.className=o.className.replace(q,"");var e=!!a.lang.string(o.className).trim();if(!e&&o.nodeName===(l||"DIV")){var e=o,g=e.ownerDocument,h=b(e),i=c(e);h&&!d(h)&&e.parentNode.insertBefore(g.createElement("br"),h);i&&!d(i)&&e.parentNode.insertBefore(g.createElement("br"),e);f.replaceWithChildNodes(o)}else e&&f.renameElement(o,"DIV")});else{if(l===null||a.lang.array(k).contains(l))if(w=i.getSelectedNode(t),
o=f.getParentElement(w,{nodeName:k})){i.executeAndRestoreSimple(t,function(){l&&(o=f.renameElement(o,l));if(n){var a=o;a.className?(a.className=a.className.replace(q,""),a.className+=" "+n):a.className=n}});return}if(a.commands.support(j,g))e(t,g,l||"DIV",n);else{o=t.createElement(l||"DIV");if(n)o.className=n;h(o)}}},state:function(a,b,c,d,e){c=typeof c==="string"?c.toUpperCase():c;a=i.getSelectedNode(a.ownerDocument);return f.getParentElement(a,{nodeName:c,className:d,classRegExp:e})},value:function(){}}})(wysihtml5);
(function(a){function c(c,h,f){var i=c+":"+h;if(!d[i]){var k=d,j=a.selection.HTMLApplier,g=b[c],c=g?[c.toLowerCase(),g.toLowerCase()]:[c.toLowerCase()];k[i]=new j(c,h,f,!0)}return d[i]}var b={strong:"b",em:"i",b:"strong",i:"em"},d={};a.commands.formatInline={exec:function(b,d,f,i,k){b=a.selection.getRange(b.ownerDocument);if(!b)return!1;c(f,i,k).toggleRange(b);a.selection.setSelection(b)},state:function(d,h,f,i,k){d=d.ownerDocument;h=b[f]||f;if(!a.dom.hasElementWithTagName(d,f)&&!a.dom.hasElementWithTagName(d,
h))return!1;if(i&&!a.dom.hasElementWithClassName(d,i))return!1;d=a.selection.getRange(d);if(!d)return!1;return c(f,i,k).isAppliedToRange(d)},value:function(){}}})(wysihtml5);(function(a){a.commands.insertHTML={exec:function(c,b,d){a.commands.support(c,b)?c.ownerDocument.execCommand(b,!1,d):a.selection.insertHTML(c.ownerDocument,d)},state:function(){return!1},value:function(){}}})(wysihtml5);
(function(a){a.commands.insertImage={exec:function(c,b,d){var d=typeof d==="object"?d:{src:d},e=c.ownerDocument,b=this.state(c),h;if(b)a.selection.setBefore(b),d=b.parentNode,d.removeChild(b),a.dom.removeEmptyTextNodes(d),d.nodeName==="A"&&!d.firstChild&&(a.selection.setAfter(d),d.parentNode.removeChild(d)),a.quirks.redraw(c);else{b=e.createElement("IMG");for(h in d)b[h]=d[h];a.selection.insertNode(b);a.selection.setAfter(b)}},state:function(c){var c=c.ownerDocument,b;if(!a.dom.hasElementWithTagName(c,
"IMG"))return!1;b=a.selection.getSelectedNode(c);if(!b)return!1;if(b.nodeName==="IMG")return b;if(b.nodeType!==a.ELEMENT_NODE)return!1;b=a.selection.getText(c);if(b=a.lang.string(b).trim())return!1;c=a.selection.getNodes(c,a.ELEMENT_NODE,function(a){return a.nodeName==="IMG"});if(c.length!==1)return!1;return c[0]},value:function(a){return(a=this.state(a))&&a.src}}})(wysihtml5);
(function(a){var c="<br>"+(a.browser.needsSpaceAfterLineBreak()?" ":"");a.commands.insertLineBreak={exec:function(b,d){a.commands.support(b,d)?(b.ownerDocument.execCommand(d,!1,null),a.browser.autoScrollsToCaret()||a.selection.scrollIntoView(b)):a.commands.exec(b,"insertHTML",c)},state:function(){return!1},value:function(){}}})(wysihtml5);
(function(a){a.commands.insertOrderedList={exec:function(c,b){var d=c.ownerDocument,e,h,f;a.commands.support(c,b)?d.execCommand(b,!1,null):(e=a.selection.getSelectedNode(d),(f=a.dom.getParentElement(e,{nodeName:["UL","OL"]},4))?a.selection.executeAndRestoreSimple(d,function(){f.nodeName==="OL"?a.dom.resolveList(f):(f.nodeName==="UL"||f.nodeName==="MENU")&&a.dom.renameElement(f,"ol")}):(h=d.createElement("span"),a.selection.surround(h),e=h.innerHTML===""||h.innerHTML===a.INVISIBLE_SPACE,a.selection.executeAndRestoreSimple(d,
function(){f=a.dom.convertToList(h,"ol")}),e&&a.selection.selectNode(f.querySelector("li"))))},state:function(a,b){try{return a.ownerDocument.queryCommandState(b)}catch(d){return!1}},value:function(){}}})(wysihtml5);
(function(a){a.commands.insertUnorderedList={exec:function(c,b){var d=c.ownerDocument,e,h,f;a.commands.support(c,b)?d.execCommand(b,!1,null):(e=a.selection.getSelectedNode(d),(f=a.dom.getParentElement(e,{nodeName:["UL","OL"]}))?a.selection.executeAndRestoreSimple(d,function(){f.nodeName==="UL"?a.dom.resolveList(f):(f.nodeName==="OL"||f.nodeName==="MENU")&&a.dom.renameElement(f,"ul")}):(h=d.createElement("span"),a.selection.surround(h),e=h.innerHTML===""||h.innerHTML===a.INVISIBLE_SPACE,a.selection.executeAndRestoreSimple(d,
function(){f=a.dom.convertToList(h,"ul")}),e&&a.selection.selectNode(f.querySelector("li"))))},state:function(a,b){try{return a.ownerDocument.queryCommandState(b)}catch(d){return!1}},value:function(){}}})(wysihtml5);(function(a){a.commands.italic={exec:function(c,b){return a.commands.formatInline.exec(c,b,"i")},state:function(c,b){return a.commands.formatInline.state(c,b,"i")},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-align-[a-z]+/g;a.commands.justifyCenter={exec:function(b){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-center",c)},state:function(b){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-center",c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-align-[a-z]+/g;a.commands.justifyLeft={exec:function(b){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-left",c)},state:function(b){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-left",c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-align-[a-z]+/g;a.commands.justifyRight={exec:function(b){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-right",c)},state:function(b){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-right",c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-decoration-underline/g;a.commands.underline={exec:function(b,d){return a.commands.formatInline.exec(b,d,"span","wysiwyg-text-decoration-underline",c)},state:function(b,d){return a.commands.formatInline.state(b,d,"span","wysiwyg-text-decoration-underline",c)},value:function(){}}})(wysihtml5);
(function(a){var c={name:void 0,style:!0,toolbar:void 0,autoLink:!0,parserRules:{tags:{br:{},span:{},div:{},p:{}},classes:{}},parser:a.dom.parse,composerClassName:"wysihtml5-editor",bodyClassName:"wysihtml5-supported",stylesheets:[],placeholderText:void 0,allowObjectResizing:!0};a.Editor=a.lang.Dispatcher.extend({constructor:function(b,d){this.textareaElement=typeof b==="string"?document.getElementById(b):b;this.config=a.lang.object({}).merge(c).merge(d).get();this.currentView=this.textarea=new a.views.Textarea(this,
this.textareaElement,this.config);if(this._isCompatible=a.browser.supported()){a.dom.addClass(document.body,this.config.bodyClassName);this.currentView=this.composer=new a.views.Composer(this,this.textareaElement,this.config);typeof this.config.parser==="function"&&this._initParser();this.observe("beforeload",function(){this.synchronizer=new a.views.Synchronizer(this,this.textarea,this.composer);if(this.config.toolbar)this.toolbar=new a.toolbar.Toolbar(this,this.config.toolbar)});try{console.log("Heya! This page is using wysihtml5 for rich text editing. Check out https://github.com/xing/wysihtml5")}catch(e){}}else{var h=
this;setTimeout(function(){h.fire("beforeload").fire("load")},0)}},isCompatible:function(){return this._isCompatible},clear:function(){this.currentView.clear();return this},getValue:function(a){return this.currentView.getValue(a)},setValue:function(a,c){if(!a)return this.clear();this.currentView.setValue(a,c);return this},focus:function(a){this.currentView.focus(a);return this},disable:function(){this.currentView.disable();return this},enable:function(){this.currentView.enable();return this},isEmpty:function(){return this.currentView.isEmpty()},
hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},parse:function(b){var c=this.config.parser(b,this.config.parserRules,this.composer.sandbox.getDocument(),!0);typeof b==="object"&&a.quirks.redraw(b);return c},_initParser:function(){this.observe("paste:composer",function(){var b=this;a.selection.executeAndRestore(this.composer.sandbox.getDocument(),function(){a.quirks.cleanPastedHTML(b.composer.element);b.parse(b.composer.element)},!0)});this.observe("paste:textarea",function(){this.textarea.setValue(this.parse(this.textarea.getValue()))})}})})(wysihtml5);