%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/thread-self/root/www/varak.net/losik.varak.net/www/js/
Upload File :
Create Path :
Current File : //proc/thread-self/root/www/varak.net/losik.varak.net/www/js/wysihtml5.js

var wysihtml5={version:"0.3.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};window.rangy=function(){var o="object",r="function",n="undefined",a=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer","START_TO_START","START_TO_END","END_TO_START","END_TO_END"],c=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],t=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],i=["collapse","compareEndPoints","duplicate","getBookmark","moveToBookmark","moveToElementText","parentElement","pasteHTML","select","setEndPoint","getBoundingClientRect"];function l(e,t){var n=typeof e[t];return n==r||!(n!=o||!e[t])||"unknown"==n}function d(e,t){return!(typeof e[t]!=o||!e[t])}function e(e,t){return typeof e[t]!=n}function s(o){return function(e,t){for(var n=t.length;n--;)if(!o(e,t[n]))return!1;return!0}}var u=s(l),f=s(d),h=s(e);function m(e){return e&&u(e,i)&&h(e,t)}var g={version:"1.2.2",initialized:!1,supported:!0,util:{isHostMethod:l,isHostObject:d,isHostProperty:e,areHostMethods:u,areHostObjects:f,areHostProperties:h,isTextRange:m},features:{},modules:{},config:{alertOnWarn:!1,preferTextRange:!1}};function p(e){window.alert("Rangy not supported in your browser. Reason: "+e),g.initialized=!0,g.supported=!1}g.fail=p,g.warn=function(e){var t="Rangy warning: "+e;g.config.alertOnWarn?window.alert(t):typeof window.console!=n&&typeof window.console.log!=n&&window.console.log(t)},!{}.hasOwnProperty?p("hasOwnProperty not supported"):g.util.extend=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};var v=[],y=[];function C(){if(!g.initialized){var e,t=!1,n=!1;l(document,"createRange")&&(e=document.createRange(),u(e,c)&&h(e,a)&&(t=!0),e.detach());var o=d(document,"body")?document.body:document.getElementsByTagName("body")[0];o&&l(o,"createTextRange")&&m(e=o.createTextRange())&&(n=!0),t||n||p("Neither Range nor TextRange are implemented"),g.initialized=!0,g.features={implementsDomRange:t,implementsTextRange:n};for(var r=y.concat(v),i=0,s=r.length;i<s;++i)try{r[i](g)}catch(e){d(window,"console")&&l(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.",e)}}}g.init=C,g.addInitListener=function(e){g.initialized?e(g):v.push(e)};var w=[];function N(e){this.name=e,this.initialized=!1,this.supported=!1}g.addCreateMissingNativeApiListener=function(e){w.push(e)},g.createMissingNativeApi=function(e){e=e||window,C();for(var t=0,n=w.length;t<n;++t)w[t](e)},N.prototype.fail=function(e){throw this.initialized=!0,this.supported=!1,new Error("Module '"+this.name+"' failed to load: "+e)},N.prototype.warn=function(e){g.warn("Module "+this.name+": "+e)},N.prototype.createError=function(e){return new Error("Error in Rangy "+this.name+" module: "+e)},g.createModule=function(e,t){var n=new N(e);g.modules[e]=n,y.push(function(e){t(e,n),n.initialized=!0,n.supported=!0})};var E=!(g.requireModules=function(e){for(var t,n,o=0,r=e.length;o<r;++o){if(n=e[o],!((t=g.modules[n])&&t instanceof N))throw new Error("Module '"+n+"' not found");if(!t.supported)throw new Error("Module '"+n+"' not supported")}}),b=function(e){E||(E=!0,g.initialized||C())};if(typeof window!=n){if(typeof document!=n)return l(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",b,!1),l(window,"addEventListener")?window.addEventListener("load",b,!1):l(window,"attachEvent")?window.attachEvent("onload",b):p("Window does not have required addEventListener or attachEvent method"),g;p("No document found")}else p("No window found")}(),rangy.createModule("DomUtil",function(e,t){var n="undefined",o=e.util;o.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),o.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var r=document.createElement("div");o.areHostMethods(r,["insertBefore","appendChild","cloneNode"])||t.fail("Incomplete Element implementation"),o.isHostProperty(r,"innerHTML")||t.fail("Element is missing innerHTML property");var i=document.createTextNode("test");o.areHostMethods(i,["splitText","deleteData","insertData","appendData","cloneNode"])||t.fail("Incomplete Text Node implementation");var s=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1};function l(e){for(var t=0;e=e.previousSibling;)t++;return t}function d(e,t){var n,o=[];for(n=e;n;n=n.parentNode)o.push(n);for(n=t;n;n=n.parentNode)if(s(o,n))return n;return null}function u(e,t,n){for(var o,r=n?e:e.parentNode;r;){if((o=r.parentNode)===t)return r;r=o}return null}function a(e){var t=e.nodeType;return 3==t||4==t||8==t}function c(e,t){var n=t.nextSibling,o=t.parentNode;return n?o.insertBefore(e,n):o.appendChild(e),e}function f(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=n)return e.ownerDocument;if(typeof e.document!=n)return e.document;if(e.parentNode)return f(e.parentNode);throw new Error("getDocument: no document found for node")}function h(e){if(!e)return"[No node]";if(a(e))return'"'+e.data+'"';if(1!=e.nodeType)return e.nodeName;var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">["+e.childNodes.length+"]"}function m(e){this.root=e,this._next=e}function g(e,t){this.node=e,this.offset=t}function p(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}m.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},g.prototype={equals:function(e){return this.node===e.node&this.offset==e.offset},inspect:function(){return"[DomPosition("+h(this.node)+":"+this.offset+")]"}},(p.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}).toString=function(){return this.message},e.dom={arrayContains:s,isHtmlNamespace:function(e){var t;return typeof e.namespaceURI==n||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t},parentElement:function(e){var t=e.parentNode;return 1==t.nodeType?t:null},getNodeIndex:l,getNodeLength:function(e){var t;return a(e)?e.length:(t=e.childNodes)?t.length:0},getCommonAncestor:d,isAncestorOf:function(e,t,n){for(var o=n?t:t.parentNode;o;){if(o===e)return!0;o=o.parentNode}return!1},getClosestAncestorIn:u,isCharacterDataNode:a,insertAfter:c,splitDataNode:function(e,t){var n=e.cloneNode(!1);return n.deleteData(0,t),e.deleteData(t,e.length-t),c(n,e),n},getDocument:f,getWindow:function(e){var t=f(e);if(typeof t.defaultView!=n)return t.defaultView;if(typeof t.parentWindow!=n)return t.parentWindow;throw new Error("Cannot get a window object for node")},getIframeWindow:function(e){if(typeof e.contentWindow!=n)return e.contentWindow;if(typeof e.contentDocument!=n)return e.contentDocument.defaultView;throw new Error("getIframeWindow: No Window object found for iframe element")},getIframeDocument:function(e){if(typeof e.contentDocument!=n)return e.contentDocument;if(typeof e.contentWindow!=n)return e.contentWindow.document;throw new Error("getIframeWindow: No Document object found for iframe element")},getBody:function(e){return o.isHostObject(e,"body")?e.body:e.getElementsByTagName("body")[0]},getRootContainer:function(e){for(var t;t=e.parentNode;)e=t;return e},comparePoints:function(e,t,n,o){var r,i,s,a,c;if(e==n)return t===o?0:t<o?-1:1;if(r=u(n,e,!0))return t<=l(r)?-1:1;if(r=u(e,n,!0))return l(r)<o?-1:1;if((s=e===(i=d(e,n))?i:u(e,i,!0))===(a=n===i?i:u(n,i,!0)))throw new Error("comparePoints got to case 4 and childA and childB are the same!");for(c=i.firstChild;c;){if(c===s)return-1;if(c===a)return 1;c=c.nextSibling}throw new Error("Should not be here!")},inspectNode:h,fragmentFromNodeChildren:function(e){for(var t,n=f(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n},createIterator:function(e){return new m(e)},DomPosition:g},e.DOMException=p}),rangy.createModule("DomRange",function(o,e){o.requireModules(["DomUtil"]);var d=o.dom,t=d.DomPosition,s=o.DOMException;function a(e,t){return 3!=e.nodeType&&(d.isAncestorOf(e,t.startContainer,!0)||d.isAncestorOf(e,t.endContainer,!0))}function c(e){return d.getDocument(e.startContainer)}function l(e,t,n){var o=e._listeners[t];if(o)for(var r=0,i=o.length;r<i;++r)o[r].call(e,{target:e,args:n})}function u(e){return new t(e.parentNode,d.getNodeIndex(e))}function f(e){return new t(e.parentNode,d.getNodeIndex(e)+1)}function n(e,t,n){var o=11==e.nodeType?e.firstChild:e;return d.isCharacterDataNode(t)?n==t.length?d.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:d.splitDataNode(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),o}function h(e,t,n){var o,r,i,s;for(n=n||{stop:!1};i=e.next();)if(e.isPartiallySelectedSubtree()){if(!1===t(i))return void(n.stop=!0);if(h(s=e.getSubtreeIterator(),t,n),s.detach(!0),n.stop)return}else for(o=d.createIterator(i);r=o.next();)if(!1===t(r))return void(n.stop=!0)}function m(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(m(t=e.getSubtreeIterator()),t.detach(!0)):e.remove()}function g(e){for(var t,n,o=c(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),n=e.getSubtreeIterator(),t.appendChild(g(n)),n.detach(!0)):e.remove(),10==t.nodeType)throw new s("HIERARCHY_REQUEST_ERR");o.appendChild(t)}return o}function r(e,t,n){var o,r=!(!t||!t.length),i=!!n;r&&(o=new RegExp("^("+t.join("|")+")$"));var s=[];return h(new p(e,!1),function(e){r&&!o.test(e.nodeType)||i&&!n(e)||s.push(e)}),s}function i(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+d.inspectNode(e.startContainer)+":"+e.startOffset+", "+d.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function p(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&d.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||d.isCharacterDataNode(this.sc)?d.getClosestAncestorIn(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||d.isCharacterDataNode(this.ec)?d.getClosestAncestorIn(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function v(e){this.code=this[e],this.codeName=e,this.message="RangeException: "+this.codeName}function y(e,t,n){this.nodes=r(e,t,n),this._next=this.nodes[0],this._position=0}p.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 e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,d.isCharacterDataNode(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!d.isCharacterDataNode(n)||n!==this.sc&&n!==this.ec?n.parentNode&&n.parentNode.removeChild(n):(e=n===this.sc?this.so:0)!=(t=n===this.ec?this.eo:n.length)&&n.deleteData(e,t-e)},isPartiallySelectedSubtree:function(){return a(this._current,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)(e=this.range.cloneRange()).collapse();else{e=new ne(c(this.range));var t=this._current,n=t,o=0,r=t,i=d.getNodeLength(t);d.isAncestorOf(t,this.sc,!0)&&(n=this.sc,o=this.so),d.isAncestorOf(t,this.ec,!0)&&(r=this.ec,i=this.eo),te(e,n,o,r,i)}return new p(e,this.clonePartiallySelectedTextNodes)},detach:function(e){e&&this.range.detach(),this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}},(v.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2}).toString=function(){return this.message},y.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){return this._current=this._next,this._next=this.nodes[++this._position],this._current},detach:function(){this._current=this._next=this.nodes=null}};var C=[1,3,4,5,7,8,10],w=[2,9,11],N=[1,3,4,5,7,8,10,11],E=[1,3,4,5,7,8];function b(r){return function(e,t){for(var n,o=t?e:e.parentNode;o;){if(n=o.nodeType,d.arrayContains(r,n))return o;o=o.parentNode}return null}}var S=d.getRootContainer,T=b([9,11]),x=b([5,6,10,12]),R=b([6,10,12]);function _(e,t){if(R(e,t))throw new v("INVALID_NODE_TYPE_ERR")}function A(e){if(!e.startContainer)throw new s("INVALID_STATE_ERR")}function D(e,t){if(!d.arrayContains(t,e.nodeType))throw new v("INVALID_NODE_TYPE_ERR")}function O(e,t){if(t<0||t>(d.isCharacterDataNode(e)?e.length:e.childNodes.length))throw new s("INDEX_SIZE_ERR")}function L(e,t){if(T(e,!0)!==T(t,!0))throw new s("WRONG_DOCUMENT_ERR")}function I(e){if(x(e,!0))throw new s("NO_MODIFICATION_ALLOWED_ERR")}function P(e,t){if(!e)throw new s(t)}function M(e){return!d.arrayContains(w,e.nodeType)&&!T(e,!0)}function k(e,t){return t<=(d.isCharacterDataNode(e)?e.length:e.childNodes.length)}function B(e){if(A(e),M(e.startContainer)||M(e.endContainer)||!k(e.startContainer,e.startOffset)||!k(e.endContainer,e.endOffset))throw new Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}var H=document.createElement("style"),V=!1;try{H.innerHTML="<b>x</b>",V=3==H.firstChild.nodeType}catch(e){}o.features.htmlParsingConforms=V;var W=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],z=0,q=1,U=2,j=3,F=0,K=1,Y=2,G=3;function X(){}function Q(e){e.START_TO_START=z,e.START_TO_END=q,e.END_TO_END=U,e.END_TO_START=j,e.NODE_BEFORE=F,e.NODE_AFTER=K,e.NODE_BEFORE_AND_AFTER=Y,e.NODE_INSIDE=G}function $(e){Q(e),Q(e.prototype)}function Z(s,a){return function(){B(this);var e,t=this.startContainer,n=this.startOffset,o=this.commonAncestorContainer,r=new p(this,!0);t!==o&&(t=(e=f(d.getClosestAncestorIn(t,o,!0))).node,n=e.offset),h(r,I),r.reset();var i=s(r);return r.detach(),a(this,t,n,t,n),i}}function J(e,l,t){function n(n,o){return function(e){A(this),D(e,C),D(S(e),w);var t=(n?u:f)(e);(o?r:i)(this,t.node,t.offset)}}function r(e,t,n){var o=e.endContainer,r=e.endOffset;t===e.startContainer&&n===e.startOffset||(S(t)==S(o)&&1!=d.comparePoints(t,n,o,r)||(o=t,r=n),l(e,t,n,o,r))}function i(e,t,n){var o=e.startContainer,r=e.startOffset;t===e.endContainer&&n===e.endOffset||(S(t)==S(o)&&-1!=d.comparePoints(t,n,o,r)||(o=t,r=n),l(e,o,r,t,n))}e.prototype=new X,o.util.extend(e.prototype,{setStart:function(e,t){A(this),_(e,!0),O(e,t),r(this,e,t)},setEnd:function(e,t){A(this),_(e,!0),O(e,t),i(this,e,t)},setStartBefore:n(!0,!0),setStartAfter:n(!1,!0),setEndBefore:n(!0,!1),setEndAfter:n(!1,!1),collapse:function(e){B(this),e?l(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):l(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){A(this),_(e,!0),l(this,e,0,e,d.getNodeLength(e))},selectNode:function(e){A(this),_(e,!1),D(e,C);var t=u(e),n=f(e);l(this,t.node,t.offset,n.node,n.offset)},extractContents:Z(g,l),deleteContents:Z(m,l),canSurroundContents:function(){B(this),I(this.startContainer),I(this.endContainer);var e=new p(this,!0),t=e._first&&a(e._first,this)||e._last&&a(e._last,this);return e.detach(),!t},detach:function(){t(this)},splitBoundaries:function(){B(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,o=this.endOffset,r=e===n;d.isCharacterDataNode(n)&&0<o&&o<n.length&&d.splitDataNode(n,o),d.isCharacterDataNode(e)&&0<t&&t<e.length&&(e=d.splitDataNode(e,t),r?(o-=t,n=e):n==e.parentNode&&o>=d.getNodeIndex(e)&&o++,t=0),l(this,e,t,n,o)},normalizeBoundaries:function(){B(this);var r=this.startContainer,i=this.startOffset,s=this.endContainer,a=this.endOffset,e=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(a=(s=e).length,e.appendData(t.data),t.parentNode.removeChild(t))},t=function(e){var t=e.previousSibling;if(t&&t.nodeType==e.nodeType){var n=(r=e).length;if(i=t.length,e.insertData(0,t.data),t.parentNode.removeChild(t),r==s)a+=i,s=r;else if(s==e.parentNode){var o=d.getNodeIndex(e);a==o?(s=e,a=n):o<a&&a--}}},n=!0;if(d.isCharacterDataNode(s))s.length==a&&e(s);else{if(0<a){var o=s.childNodes[a-1];o&&d.isCharacterDataNode(o)&&e(o)}n=!this.collapsed}if(n){if(d.isCharacterDataNode(r))0==i&&t(r);else if(i<r.childNodes.length){var c=r.childNodes[i];c&&d.isCharacterDataNode(c)&&t(c)}}else r=s,i=a;l(this,r,i,s,a)},collapseToPoint:function(e,t){var n,o,r;A(this),_(e,!0),O(e,t),r=t,(o=e)===(n=this).startContainer&&r===n.startOffset&&o===n.endContainer&&r===n.endOffset||l(n,o,r,o,r)}}),$(e)}function ee(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:d.getCommonAncestor(e.startContainer,e.endContainer)}function te(e,t,n,o,r){var i=e.startContainer!==t||e.startOffset!==n,s=e.endContainer!==o||e.endOffset!==r;e.startContainer=t,e.startOffset=n,e.endContainer=o,e.endOffset=r,ee(e),l(e,"boundarychange",{startMoved:i,endMoved:s})}function ne(e){this.startContainer=e,this.startOffset=0,this.endContainer=e,this.endOffset=0,this._listeners={boundarychange:[],detach:[]},ee(this)}X.prototype={attachListener:function(e,t){this._listeners[e].push(t)},compareBoundaryPoints:function(e,t){var n,o,r,i;B(this),L(this.startContainer,t.startContainer);var s=e==j||e==z?"start":"end",a=e==q||e==z?"start":"end";return n=this[s+"Container"],o=this[s+"Offset"],r=t[a+"Container"],i=t[a+"Offset"],d.comparePoints(n,o,r,i)},insertNode:function(e){if(B(this),D(e,N),I(this.startContainer),d.isAncestorOf(e,this.startContainer,!0))throw new s("HIERARCHY_REQUEST_ERR");var t=n(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var e,t;if(B(this),this.collapsed)return c(this).createDocumentFragment();if(this.startContainer===this.endContainer&&d.isCharacterDataNode(this.startContainer))return(e=this.startContainer.cloneNode(!0)).data=e.data.slice(this.startOffset,this.endOffset),(t=c(this).createDocumentFragment()).appendChild(e),t;var n=new p(this,!0);return e=function e(t){for(var n,o,r,i=c(t.range).createDocumentFragment();o=t.next();){if(n=t.isPartiallySelectedSubtree(),o=o.cloneNode(!n),n&&(r=t.getSubtreeIterator(),o.appendChild(e(r)),r.detach(!0)),10==o.nodeType)throw new s("HIERARCHY_REQUEST_ERR");i.appendChild(o)}return i}(n),n.detach(),e},canSurroundContents:function(){B(this),I(this.startContainer),I(this.endContainer);var e=new p(this,!0),t=e._first&&a(e._first,this)||e._last&&a(e._last,this);return e.detach(),!t},surroundContents:function(e){if(D(e,E),!this.canSurroundContents())throw new v("BAD_BOUNDARYPOINTS_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);n(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){B(this);for(var e,t=new ne(c(this)),n=W.length;n--;)t[e=W[n]]=this[e];return t},toString:function(){B(this);var e=this.startContainer;if(e===this.endContainer&&d.isCharacterDataNode(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new p(this,!0);return h(n,function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){B(this);var t=e.parentNode,n=d.getNodeIndex(e);if(!t)throw new s("NOT_FOUND_ERR");var o=this.comparePoint(t,n),r=this.comparePoint(t,n+1);return o<0?0<r?Y:F:0<r?K:G},comparePoint:function(e,t){return B(this),P(e,"HIERARCHY_REQUEST_ERR"),L(e,this.startContainer),d.comparePoints(e,t,this.startContainer,this.startOffset)<0?-1:0<d.comparePoints(e,t,this.endContainer,this.endOffset)?1:0},createContextualFragment:V?function(e){var t=this.startContainer,n=d.getDocument(t);if(!t)throw new s("INVALID_STATE_ERR");var o=null;return 1==t.nodeType?o=t:d.isCharacterDataNode(t)&&(o=d.parentElement(t)),(o=null===o||"HTML"==o.nodeName&&d.isHtmlNamespace(d.getDocument(o).documentElement)&&d.isHtmlNamespace(o)?n.createElement("body"):o.cloneNode(!1)).innerHTML=e,d.fragmentFromNodeChildren(o)}:function(e){A(this);var t=c(this).createElement("body");return t.innerHTML=e,d.fragmentFromNodeChildren(t)},toHtml:function(){B(this);var e=c(this).createElement("div");return e.appendChild(this.cloneContents()),e.innerHTML},intersectsNode:function(e,t){if(B(this),P(e,"NOT_FOUND_ERR"),d.getDocument(e)!==c(this))return!1;var n=e.parentNode,o=d.getNodeIndex(e);P(n,"NOT_FOUND_ERR");var r=d.comparePoints(n,o,this.endContainer,this.endOffset),i=d.comparePoints(n,o+1,this.startContainer,this.startOffset);return t?r<=0&&0<=i:r<0&&0<i},isPointInRange:function(e,t){return B(this),P(e,"HIERARCHY_REQUEST_ERR"),L(e,this.startContainer),0<=d.comparePoints(e,t,this.startContainer,this.startOffset)&&d.comparePoints(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e,t){if(B(this),c(e)!=c(this))throw new s("WRONG_DOCUMENT_ERR");var n=d.comparePoints(this.startContainer,this.startOffset,e.endContainer,e.endOffset),o=d.comparePoints(this.endContainer,this.endOffset,e.startContainer,e.startOffset);return t?n<=0&&0<=o:n<0&&0<o},intersection:function(e){if(this.intersectsRange(e)){var t=d.comparePoints(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=d.comparePoints(this.endContainer,this.endOffset,e.endContainer,e.endOffset),o=this.cloneRange();return-1==t&&o.setStart(e.startContainer,e.startOffset),1==n&&o.setEnd(e.endContainer,e.endOffset),o}return null},union:function(e){if(this.intersectsRange(e,!0)){var t=this.cloneRange();return-1==d.comparePoints(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==d.comparePoints(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new v("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==G},containsNodeContents:function(e){return 0<=this.comparePoint(e,0)&&this.comparePoint(e,d.getNodeLength(e))<=0},containsRange:function(e){return this.intersection(e).equals(e)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(0<n.length){t.setStart(n[0],0);var o=n.pop();t.setEnd(o,o.length);var r=this.containsRange(t);return t.detach(),r}return this.containsNodeContents(e)},createNodeIterator:function(e,t){return B(this),new y(this,e,t)},getNodes:function(e,t){return B(this),r(this,e,t)},getDocument:function(){return c(this)},collapseBefore:function(e){A(this),this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){A(this),this.setStartAfter(e),this.collapse(!0)},getName:function(){return"DomRange"},equals:function(e){return ne.rangesEqual(this,e)},inspect:function(){return i(this)}},J(ne,te,function(e){A(e),e.startContainer=e.startOffset=e.endContainer=e.endOffset=null,e.collapsed=e.commonAncestorContainer=null,l(e,"detach",null),e._listeners=null}),o.rangePrototype=X.prototype,ne.rangeProperties=W,ne.RangeIterator=p,ne.copyComparisonConstants=$,ne.createPrototypeRange=J,ne.inspect=i,ne.getRangeDocument=c,ne.rangesEqual=function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset},o.DomRange=ne,o.RangeException=v}),rangy.createModule("WrappedRange",function(a,e){var c;a.requireModules(["DomUtil","DomRange"]);var p=a.dom,v=p.DomPosition,l=a.DomRange;function r(e,t,n,o){var r=e.duplicate();r.collapse(n);var i=r.parentElement();if(p.isAncestorOf(t,i,!0)||(i=t),!i.canHaveHTML)return new v(i.parentNode,p.getNodeIndex(i));for(var s,a,c,l,d,u=p.getDocument(i).createElement("span"),f=n?"StartToStart":"StartToEnd";i.insertBefore(u,u.previousSibling),r.moveToElementText(u),0<(s=r.compareEndPoints(f,e))&&u.previousSibling;);if(d=u.nextSibling,-1==s&&d&&p.isCharacterDataNode(d)){var h;if(r.setEndPoint(n?"EndToStart":"EndToEnd",e),/[\r\n]/.test(d.data)){var m=r.duplicate(),g=m.text.replace(/\r\n/g,"\r").length;for(h=m.moveStart("character",g);-1==(s=m.compareEndPoints("StartToEnd",m));)h++,m.moveStart("character",1)}else h=r.text.length;l=new v(d,h)}else a=(o||!n)&&u.previousSibling,l=(c=(o||n)&&u.nextSibling)&&p.isCharacterDataNode(c)?new v(c,0):a&&p.isCharacterDataNode(a)?new v(a,a.length):new v(i,p.getNodeIndex(u));return u.parentNode.removeChild(u),l}function i(e,t){var n,o,r,i,s=e.offset,a=p.getDocument(e.node),c=a.body.createTextRange(),l=p.isCharacterDataNode(e.node);return o=l?(n=e.node).parentNode:(n=s<(i=e.node.childNodes).length?i[s]:null,e.node),(r=a.createElement("span")).innerHTML="&#feff;",n?o.insertBefore(r,n):o.appendChild(r),c.moveToElementText(r),c.collapse(!t),o.removeChild(r),l&&c[t?"moveStart":"moveEnd"]("character",s),c}if(!a.features.implementsDomRange||a.features.implementsTextRange&&a.config.preferTextRange){if(a.features.implementsTextRange){(c=function(e){this.textRange=e,this.refresh()}).prototype=new l(document),c.prototype.refresh=function(){var e,t,n,o=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var o=n.parentElement();(n=e.duplicate()).collapse(!1);var r=n.parentElement(),i=o==r?o:p.getCommonAncestor(o,r);return i==t?i:p.getCommonAncestor(t,i)}(this.textRange);t=0==(n=this.textRange).compareEndPoints("StartToEnd",n)?e=r(this.textRange,o,!0,!0):(e=r(this.textRange,o,!0,!1),r(this.textRange,o,!1,!1)),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},l.copyComparisonConstants(c);var t=function(){return this}();void 0===t.Range&&(t.Range=c),a.createNativeRange=function(e){return(e=e||document).body.createTextRange()}}}else!function(){var t,n,o=l.rangeProperties;function r(e){for(var t,n=o.length;n--;)e[t=o[n]]=e.nativeRange[t]}c=function(e){if(!e)throw new Error("Range must be specified");this.nativeRange=e,r(this)},l.createPrototypeRange(c,function(e,t,n,o,r){var i=e.startContainer!==t||e.startOffset!=n,s=e.endContainer!==o||e.endOffset!=r;(i||s)&&(e.setEnd(o,r),e.setStart(t,n))},function(e){e.nativeRange.detach(),e.detached=!0;for(var t=o.length;t--;)e[o[t]]=null}),(t=c.prototype).selectNode=function(e){this.nativeRange.selectNode(e),r(this)},t.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},t.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e},t.cloneContents=function(){return this.nativeRange.cloneContents()},t.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},t.collapse=function(e){this.nativeRange.collapse(e),r(this)},t.cloneRange=function(){return new c(this.nativeRange.cloneRange())},t.refresh=function(){r(this)},t.toString=function(){return this.nativeRange.toString()};var e=document.createTextNode("test");p.getBody(document).appendChild(e);var i=document.createRange();i.setStart(e,0),i.setEnd(e,0);try{i.setStart(e,1),!0,t.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},t.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},n=function(t){return function(e){this.nativeRange[t](e),r(this)}}}catch(e){!1,t.setStart=function(t,n){try{this.nativeRange.setStart(t,n)}catch(e){this.nativeRange.setEnd(t,n),this.nativeRange.setStart(t,n)}r(this)},t.setEnd=function(t,n){try{this.nativeRange.setEnd(t,n)}catch(e){this.nativeRange.setStart(t,n),this.nativeRange.setEnd(t,n)}r(this)},n=function(n,o){return function(t){try{this.nativeRange[n](t)}catch(e){this.nativeRange[o](t),this.nativeRange[n](t)}r(this)}}}t.setStartBefore=n("setStartBefore","setEndBefore"),t.setStartAfter=n("setStartAfter","setEndAfter"),t.setEndBefore=n("setEndBefore","setStartBefore"),t.setEndAfter=n("setEndAfter","setStartAfter"),i.selectNodeContents(e),i.startContainer==e&&i.endContainer==e&&0==i.startOffset&&i.endOffset==e.length?t.selectNodeContents=function(e){this.nativeRange.selectNodeContents(e),r(this)}:t.selectNodeContents=function(e){this.setStart(e,0),this.setEnd(e,l.getEndOffset(e))},i.selectNodeContents(e),i.setEnd(e,3);var s=document.createRange();s.selectNodeContents(e),s.setEnd(e,4),s.setStart(e,2),-1==i.compareBoundaryPoints(i.START_TO_END,s)&1==i.compareBoundaryPoints(i.END_TO_START,s)?t.compareBoundaryPoints=function(e,t){return e==(t=t.nativeRange||t).START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:t.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)},a.util.isHostMethod(i,"createContextualFragment")&&(t.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),p.getBody(document).removeChild(e),i.detach(),s.detach()}(),a.createNativeRange=function(e){return(e=e||document).createRange()};a.features.implementsTextRange&&(c.rangeToTextRange=function(e){if(e.collapsed)return i(new v(e.startContainer,e.startOffset),!0);var t=i(new v(e.startContainer,e.startOffset),!0),n=i(new v(e.endContainer,e.endOffset),!1),o=p.getDocument(e.startContainer).body.createTextRange();return o.setEndPoint("StartToStart",t),o.setEndPoint("EndToEnd",n),o}),c.prototype.getName=function(){return"WrappedRange"},a.WrappedRange=c,a.createRange=function(e){return e=e||document,new c(a.createNativeRange(e))},a.createRangyRange=function(e){return e=e||document,new l(e)},a.createIframeRange=function(e){return a.createRange(p.getIframeDocument(e))},a.createIframeRangyRange=function(e){return a.createRangyRange(p.getIframeDocument(e))},a.addCreateMissingNativeApiListener(function(e){var t=e.document;void 0===t.createRange&&(t.createRange=function(){return a.createRange(this)}),t=e=null})}),rangy.createModule("WrappedSelection",function(i,e){i.requireModules(["DomUtil","DomRange","WrappedRange"]),i.config.checkSelectionRanges=!0;var r,s,t="boolean",a="_rangySelection",c=i.dom,n=i.util,l=i.DomRange,d=i.WrappedRange,o=i.DOMException,u=c.DomPosition,f="Control";function h(e){return(e||window).document.selection}var m=i.util.isHostMethod(window,"getSelection"),g=i.util.isHostObject(document,"selection"),p=g&&(!m||i.config.preferTextRange);p?(r=h,i.isSelectionValid=function(e){var t=(e||window).document,n=t.selection;return"None"!=n.type||c.getDocument(n.createRange().parentElement())==t}):m?(r=function(e){return(e||window).getSelection()},i.isSelectionValid=function(){return!0}):e.fail("Neither document.selection or window.getSelection() detected.");var v=(i.getNativeSelection=r)(),y=i.createNativeRange(document),C=c.getBody(document),w=n.areHostObjects(v,n.areHostProperties(v,["anchorOffset","focusOffset"]));i.features.selectionHasAnchorAndFocus=w;var N=n.isHostMethod(v,"extend");i.features.selectionHasExtend=N;var E="number"==typeof v.rangeCount;i.features.selectionHasRangeCount=E;var b=!1,S=!0;n.areHostMethods(v,["addRange","getRangeAt","removeAllRanges"])&&"number"==typeof v.rangeCount&&i.features.implementsDomRange&&function(){var e=document.createElement("iframe");C.appendChild(e);var t=c.getIframeDocument(e);t.open(),t.write("<html><head></head><body>12</body></html>"),t.close();var n=c.getIframeWindow(e).getSelection(),o=t.documentElement.lastChild.firstChild,r=t.createRange();r.setStart(o,1),r.collapse(!0),n.addRange(r),S=1==n.rangeCount,n.removeAllRanges();var i=r.cloneRange();r.setStart(o,0),i.setEnd(o,2),n.addRange(r),n.addRange(i),b=2==n.rangeCount,r.detach(),i.detach(),C.removeChild(e)}(),i.features.selectionSupportsMultipleRanges=b,i.features.collapsedNonEditableSelectionsSupported=S;var T,x,R=!1;function _(e,t,n){var o=n?"end":"start",r=n?"start":"end";e.anchorNode=t[o+"Container"],e.anchorOffset=t[o+"Offset"],e.focusNode=t[r+"Container"],e.focusOffset=t[r+"Offset"]}function A(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function D(e){var t;return e instanceof l?(t=e._selectionNativeRange)||((t=i.createNativeRange(c.getDocument(e.startContainer))).setEnd(e.endContainer,e.endOffset),t.setStart(e.startContainer,e.startOffset),e._selectionNativeRange=t,e.attachListener("detach",function(){this._selectionNativeRange=null})):e instanceof d?t=e.nativeRange:i.features.implementsDomRange&&e instanceof c.getWindow(e.startContainer).Range&&(t=e),t}function O(e){var t=e.getNodes();if(!function(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;t<n;++t)if(!c.isAncestorOf(e[0],e[t]))return!1;return!0}(t))throw new Error("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return t[0]}function L(e){return!!e&&void 0!==e.text}function I(e,t){var n=new d(t);e._ranges=[n],_(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed}function P(e){if(e._ranges.length=0,"None"==e.docSelection.type)A(e);else{var t=e.docSelection.createRange();if(L(t))I(e,t);else{e.rangeCount=t.length;for(var n,o=c.getDocument(t.item(0)),r=0;r<e.rangeCount;++r)(n=i.createRange(o)).selectNode(t.item(r)),e._ranges.push(n);e.isCollapsed=1==e.rangeCount&&e._ranges[0].collapsed,_(e,e._ranges[e.rangeCount-1],!1)}}}function M(e,t){for(var n=e.docSelection.createRange(),o=O(t),r=c.getDocument(n.item(0)),i=c.getBody(r).createControlRange(),s=0,a=n.length;s<a;++s)i.add(n.item(s));try{i.add(o)}catch(e){throw new Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}i.select(),P(e)}function k(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}C&&n.isHostMethod(C,"createControlRange")&&(T=C.createControlRange(),n.areHostProperties(T,["item","add"])&&(R=!0)),i.features.implementsControlRange=R,s=w?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return!!e.rangeCount&&e.getRangeAt(e.rangeCount-1).collapsed},n.isHostMethod(v,"getRangeAt")?x=function(e,t){try{return e.getRangeAt(t)}catch(e){return null}}:w&&(x=function(e){var t=c.getDocument(e.anchorNode),n=i.createRange(t);return n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.collapsed!==this.isCollapsed&&(n.setStart(e.focusNode,e.focusOffset),n.setEnd(e.anchorNode,e.anchorOffset)),n}),i.getSelection=function(e){var t=(e=e||window)[a],n=r(e),o=g?h(e):null;return t?(t.nativeSelection=n,t.docSelection=o,t.refresh(e)):(t=new k(n,o,e),e[a]=t),t},i.getIframeSelection=function(e){return i.getSelection(c.getIframeWindow(e))};var B,H=k.prototype;function V(e,t){for(var n,o=c.getDocument(t[0].startContainer),r=c.getBody(o).createControlRange(),i=0;i<rangeCount;++i){n=O(t[i]);try{r.add(n)}catch(e){throw new Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),P(e)}if(!p&&w&&n.areHostMethods(v,["removeAllRanges","addRange"])){H.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),A(this)};var W=function(e,t){var n=l.getRangeDocument(t),o=i.createRange(n);o.collapseToPoint(t.endContainer,t.endOffset),e.nativeSelection.addRange(D(o)),e.nativeSelection.extend(t.startContainer,t.startOffset),e.refresh()};H.addRange=E?function(e,t){var n;if(R&&g&&this.docSelection.type==f)M(this,e);else if(t&&N)W(this,e);else if(n=b?this.rangeCount:(this.removeAllRanges(),0),this.nativeSelection.addRange(D(e)),this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==n+1){if(i.config.checkSelectionRanges){var o=x(this.nativeSelection,this.rangeCount-1);o&&!l.rangesEqual(o,e)&&(e=new d(o))}this._ranges[this.rangeCount-1]=e,_(this,e,z(this.nativeSelection)),this.isCollapsed=s(this)}else this.refresh()}:function(e,t){t&&N?W(this,e):(this.nativeSelection.addRange(D(e)),this.refresh())},H.setRanges=function(e){if(R&&1<e.length)V(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t<n;++t)this.addRange(e[t])}}}else{if(!(n.isHostMethod(v,"empty")&&n.isHostMethod(y,"select")&&R&&p))return e.fail("No means of selecting a Range or TextRange was found"),!1;H.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=c.getDocument(this.anchorNode);else if(this.docSelection.type==f){var t=this.docSelection.createRange();t.length&&(e=c.getDocument(t.item(0)).body.createTextRange())}if(e)e.body.createTextRange().select(),this.docSelection.empty()}}catch(e){}A(this)},H.addRange=function(e){this.docSelection.type==f?M(this,e):(d.rangeToTextRange(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,_(this,e,!1))},H.setRanges=function(e){this.removeAllRanges();var t=e.length;1<t?V(this,e):t&&this.addRange(e[0])}}if(H.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new o("INDEX_SIZE_ERR");return this._ranges[e]},p)B=function(e){var t;i.isSelectionValid(e.win)?t=e.docSelection.createRange():(t=c.getBody(e.win.document).createTextRange()).collapse(!0),e.docSelection.type==f?P(e):L(t)?I(e,t):A(e)};else if(n.isHostMethod(v,"getRangeAt")&&"number"==typeof v.rangeCount)B=function(e){if(R&&g&&e.docSelection.type==f)P(e);else if(e._ranges.length=e.rangeCount=e.nativeSelection.rangeCount,e.rangeCount){for(var t=0,n=e.rangeCount;t<n;++t)e._ranges[t]=new i.WrappedRange(e.nativeSelection.getRangeAt(t));_(e,e._ranges[e.rangeCount-1],z(e.nativeSelection)),e.isCollapsed=s(e)}else A(e)};else{if(!w||typeof v.isCollapsed!=t||typeof y.collapsed!=t||!i.features.implementsDomRange)return e.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;B=function(e){var t,n,o,r=e.nativeSelection;r.anchorNode?(t=x(r,0),e._ranges=[t],e.rangeCount=1,o=(n=e).nativeSelection,n.anchorNode=o.anchorNode,n.anchorOffset=o.anchorOffset,n.focusNode=o.focusNode,n.focusOffset=o.focusOffset,e.isCollapsed=s(e)):A(e)}}H.refresh=function(e){var t=e?this._ranges.slice(0):null;if(B(this),e){var n=t.length;if(n!=this._ranges.length)return!1;for(;n--;)if(!l.rangesEqual(t[n],this._ranges[n]))return!1;return!0}};var z,q=function(e,t){var n=e.getAllRanges(),o=!1;e.removeAllRanges();for(var r=0,i=n.length;r<i;++r)o||t!==n[r]?e.addRange(n[r]):o=!0;e.rangeCount||A(e)};function U(e,t){if(e.anchorNode&&c.getDocument(e.anchorNode)!==c.getDocument(t))throw new o("WRONG_DOCUMENT_ERR")}function j(e){var t=[],n=new u(e.anchorNode,e.anchorOffset),o=new u(e.focusNode,e.focusOffset),r="function"==typeof e.getName?e.getName():"Selection";if(void 0!==e.rangeCount)for(var i=0,s=e.rangeCount;i<s;++i)t[i]=l.inspect(e.getRangeAt(i));return"["+r+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+o.inspect()+"]"}H.removeRange=R?function(e){if(this.docSelection.type==f){for(var t=this.docSelection.createRange(),n=O(e),o=c.getDocument(t.item(0)),r=c.getBody(o).createControlRange(),i=!1,s=0,a=t.length;s<a;++s)t.item(s)!==n||i?r.add(t.item(s)):i=!0;r.select(),P(this)}else q(this,e)}:function(e){q(this,e)},!p&&w&&i.features.implementsDomRange?(z=function(e){var t=!1;return e.anchorNode&&(t=1==c.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t},H.isBackwards=function(){return z(this)}):z=H.isBackwards=function(){return!1},H.toString=function(){for(var e=[],t=0,n=this.rangeCount;t<n;++t)e[t]=""+this._ranges[t];return e.join("")},H.collapse=function(e,t){U(this,e);var n=i.createRange(c.getDocument(e));n.collapseToPoint(e,t),this.removeAllRanges(),this.addRange(n),this.isCollapsed=!0},H.collapseToStart=function(){if(!this.rangeCount)throw new o("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},H.collapseToEnd=function(){if(!this.rangeCount)throw new o("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},H.selectAllChildren=function(e){U(this,e);var t=i.createRange(c.getDocument(e));t.selectNodeContents(e),this.removeAllRanges(),this.addRange(t)},H.deleteFromDocument=function(){if(R&&g&&this.docSelection.type==f){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),e.parentNode.removeChild(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();this.removeAllRanges();for(var o=0,r=n.length;o<r;++o)n[o].deleteContents();this.addRange(n[r-1])}},H.getAllRanges=function(){return this._ranges.slice(0)},H.setSingleRange=function(e){this.setRanges([e])},H.containsNode=function(e,t){for(var n=0,o=this._ranges.length;n<o;++n)if(this._ranges[n].containsNode(e,t))return!0;return!1},H.toHtml=function(){var e="";if(this.rangeCount){for(var t=l.getRangeDocument(this._ranges[0]).createElement("div"),n=0,o=this._ranges.length;n<o;++n)t.appendChild(this._ranges[n].cloneContents());e=t.innerHTML}return e},H.getName=function(){return"WrappedSelection"},H.inspect=function(){return j(this)},H.detach=function(){this.win[a]=null,this.win=this.anchorNode=this.focusNode=null},k.inspect=j,i.Selection=k,i.selectionPrototype=H,i.addCreateMissingNativeApiListener(function(e){void 0===e.getSelection&&(e.getSelection=function(){return i.getSelection(this)}),e=null})});var Base=function(){};Base.extend=function(e,t){var n=Base.prototype.extend;Base._prototyping=!0;var o=new this;n.call(o,e),o.base=function(){},delete Base._prototyping;var r=o.constructor,i=o.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==i)this._constructing=!0,r.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||n).call(arguments[0],o)};return i.ancestor=this,i.extend=this.extend,i.forEach=this.forEach,i.implement=this.implement,i.prototype=o,i.toString=this.toString,i.valueOf=function(e){return"object"==e?i:r.valueOf()},n.call(i,t),"function"==typeof i.init&&i.init(),i},Base.prototype={extend:function(e,t){if(1<arguments.length){var n=this[e];if(n&&"function"==typeof t&&(!n.valueOf||n.valueOf()!=t.valueOf())&&/\bbase\b/.test(t)){var o=t.valueOf();(t=function(){var e=this.base||Base.prototype.base;this.base=n;var t=o.apply(this,arguments);return this.base=e,t}).valueOf=function(e){return"object"==e?t:o},t.toString=Base.toString}this[e]=t}else if(e){var r=Base.prototype.extend;Base._prototyping||"function"==typeof this||(r=this.extend||r);for(var i={toSource:null},s=["constructor","toString","valueOf"],a=Base._prototyping?0:1;c=s[a++];)e[c]!=i[c]&&r.call(this,c,e[c]);for(var c in e)i[c]||r.call(this,c,e[c])}return this}},Base=Base.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(e,t,n){for(var o in e)void 0===this.prototype[o]&&t.call(n,e[o],o,e)},implement:function(){for(var e=0;e<arguments.length;e++)"function"==typeof arguments[e]?arguments[e](this.prototype):this.prototype.extend(arguments[e]);return this},toString:function(){return String(this.valueOf())}}),wysihtml5.browser=function(){var n,o,t=navigator.userAgent,s=document.createElement("div"),r=-1!==t.indexOf("MSIE")&&-1===t.indexOf("Opera"),e=-1!==t.indexOf("Gecko")&&-1===t.indexOf("KHTML"),i=-1!==t.indexOf("AppleWebKit/"),a=-1!==t.indexOf("Chrome/"),c=-1!==t.indexOf("Opera/");return{USER_AGENT:t,supported:function(){var e,t=this.USER_AGENT.toLowerCase(),n="contentEditable"in s,o=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,r=document.querySelector&&document.querySelectorAll,i=this.isIos()&&(/ipad|iphone|ipod/.test(e=t)&&e.match(/ os (\d+).+? like mac os x/)||[,0])[1]<5||-1!==t.indexOf("opera mobi")||-1!==t.indexOf("hpwos/");return n&&o&&r&&!i},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){var e=this.USER_AGENT.toLowerCase();return-1!==e.indexOf("webkit")&&-1!==e.indexOf("mobile")},supportsSandboxedIframes:function(){return r},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return!e},hasCurrentStyleProperty:function(){return"currentStyle"in s},insertsLineBreaksOnReturn:function(){return e},supportsPlaceholderAttributeOn:function(e){return"placeholder"in e},supportsEvent:function(e){return"on"+e in s||(s.setAttribute("on"+e,"return;"),"function"==typeof s["on"+e])},supportsEventsInIframeCorrectly:function(){return!c},firesOnDropOnlyWhenOnDragOverIsCancelled:function(){return i||e},supportsDataTransfer:function(){try{return i&&(window.Clipboard||window.DataTransfer).prototype.getData}catch(e){return!1}},supportsHTML5Tags:function(e){var t=e.createElement("div"),n="<article>foo</article>";return t.innerHTML=n,t.innerHTML.toLowerCase()===n},supportsCommand:(n={formatBlock:r,insertUnorderedList:r||c||i,insertOrderedList:r||c||i},o={insertHTML:e},function(e,t){if(!n[t]){try{return e.queryCommandSupported(t)}catch(e){}try{return e.queryCommandEnabled(t)}catch(e){return!!o[t]}}return!1}),doesAutoLinkingInContentEditable:function(){return r},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return e||c||i},supportsGetAttributeCorrectly:function(){return"1"!=document.createElement("td").getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return e||r||c},clearsListsInContentEditableCorrectly:function(){return e||r||i},autoScrollsToCaret:function(){return!i},autoClosesUnclosedTags:function(){var e,t,n=s.cloneNode(!1);return n.innerHTML="<p><div></div>",t=n.innerHTML.toLowerCase(),e="<p></p><div></div>"===t||"<p><div></div></p>"===t,this.autoClosesUnclosedTags=function(){return e},e},supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},supportsClassList:function(){return"classList"in s},needsSpaceAfterLineBreak:function(){return c},supportsSpeechApiOn:function(e){return 11<=(t.match(/Chrome\/(\d+)/)||[,0])[1]&&("onwebkitspeechchange"in e||"speech"in e)},crashesWhenDefineProperty:function(e){return r&&("XMLHttpRequest"===e||"XDomainRequest"===e)},doesAsyncFocus:function(){return r},hasProblemsSettingCaretAfterImg:function(){return r},hasUndoInContextMenu:function(){return e||a||c}}}(),wysihtml5.lang.array=function(r){return{contains:function(e){if(r.indexOf)return-1!==r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return!0;return!1},without:function(e){e=wysihtml5.lang.array(e);for(var t=[],n=0,o=r.length;n<o;n++)e.contains(r[n])||t.push(r[n]);return t},get:function(){for(var e=0,t=r.length,n=[];e<t;e++)n.push(r[e]);return n}}},wysihtml5.lang.Dispatcher=Base.extend({observe:function(e,t){return this.events=this.events||{},this.events[e]=this.events[e]||[],this.events[e].push(t),this},on:function(){return this.observe.apply(this,wysihtml5.lang.array(arguments).get())},fire:function(e,t){this.events=this.events||{};for(var n=this.events[e]||[],o=0;o<n.length;o++)n[o].call(this,t);return this},stopObserving:function(e,t){this.events=this.events||{};var n,o,r=0;if(e){for(n=this.events[e]||[],o=[];r<n.length;r++)n[r]!==t&&t&&o.push(n[r]);this.events[e]=o}else this.events={};return this}}),wysihtml5.lang.object=function(n){return{merge:function(e){for(var t in e)n[t]=e[t];return this},get:function(){return n},clone:function(){var e,t={};for(e in n)t[e]=n[e];return t},isArray:function(){return"[object Array]"===Object.prototype.toString.call(n)}}},function(){var e=/^\s+/,t=/\s+$/;wysihtml5.lang.string=function(n){return n=String(n),{trim:function(){return n.replace(e,"").replace(t,"")},interpolate:function(e){for(var t in e)n=this.replace("#{"+t+"}").by(e[t]);return n},replace:function(t){return{by:function(e){return n.split(t).join(e)}}}}}}(),function(i){var s=i.lang.array(["CODE","PRE","A","SCRIPT","HEAD","TITLE","STYLE"]),a=/((https?:\/\/|www\.)[^\s<]{3,})/gi,c=/([^\w\/\-](,?))$/i,l=100,d={")":"(","]":"[","}":"{"};function u(e){var t,n,o=e.parentNode,r=(t=o.ownerDocument,(n=t._wysihtml5_tempElement)||(n=t._wysihtml5_tempElement=t.createElement("div")),n);for(r.innerHTML="<span></span>"+e.data.replace(a,function(e,t){var n=(t.match(c)||[])[1]||"",o=d[n];(t=t.replace(c,"")).split(o).length>t.split(n).length&&(t+=n,n="");var r=t,i=t;return t.length>l&&(i=i.substr(0,l)+"..."),"www."===r.substr(0,4)&&(r="http://"+r),'<a href="'+r+'">'+i+"</a>"+n}),r.removeChild(r.firstChild);r.firstChild;)o.insertBefore(r.firstChild,e);o.removeChild(e)}i.dom.autoLink=function(e){return function(e){for(var t;e.parentNode;){if(e=e.parentNode,t=e.nodeName,s.contains(t))return!0;if("body"===t)return!1}return!1}(e)?e:(e===e.ownerDocument.documentElement&&(e=e.ownerDocument.body),function e(t){if(!s.contains(t.nodeName)){if(t.nodeType!==i.TEXT_NODE||!t.data.match(a)){for(var n=i.lang.array(t.childNodes).get(),o=n.length,r=0;r<o;r++)e(n[r]);return t}u(t)}}(e))},i.dom.autoLink.URL_REG_EXP=a}(wysihtml5),function(e){var o=e.browser.supportsClassList(),n=e.dom;n.addClass=function(e,t){if(o)return e.classList.add(t);n.hasClass(e,t)||(e.className+=" "+t)},n.removeClass=function(e,t){if(o)return e.classList.remove(t);e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ")},n.hasClass=function(e,t){if(o)return e.classList.contains(t);var n=e.className;return 0<n.length&&(n==t||new RegExp("(^|\\s)"+t+"(\\s|$)").test(n))}}(wysihtml5),wysihtml5.dom.contains=function(){var e=document.documentElement;return e.contains?function(e,t){return t.nodeType!==wysihtml5.ELEMENT_NODE&&(t=t.parentNode),e!==t&&e.contains(t)}:e.compareDocumentPosition?function(e,t){return!!(16&e.compareDocumentPosition(t))}:void 0}(),wysihtml5.dom.convertToList=function(){function p(e,t){var n=e.createElement("li");return t.appendChild(n),n}return function(e,t){if("UL"===e.nodeName||"OL"===e.nodeName||"MENU"===e.nodeName)return e;var n,o,r,i,s,a,c,l,d,u,f=e.ownerDocument,h=(u=t,f.createElement(u)),m=e.querySelectorAll("br"),g=m.length;for(d=0;d<g;d++)for(i=m[d];(s=i.parentNode)&&s!==e&&s.lastChild===i;){if("block"===wysihtml5.dom.getStyle("display").from(s)){s.removeChild(i);break}wysihtml5.dom.insert(i).after(i.parentNode)}for(o=(n=wysihtml5.lang.array(e.childNodes).get()).length,d=0;d<o;d++)l=l||p(f,h),r=n[d],a="block"===wysihtml5.dom.getStyle("display").from(r),c="BR"===r.nodeName,a?((l=l.firstChild?p(f,h):l).appendChild(r),l=null):c?l=l.firstChild?null:l:l.appendChild(r);return e.parentNode.replaceChild(h,e),h}}(),wysihtml5.dom.copyAttributes=function(i){return{from:function(r){return{to:function(e){for(var t,n=0,o=i.length;n<o;n++)t=i[n],void 0!==r[t]&&""!==r[t]&&(e[t]=r[t]);return{andTo:arguments.callee}}}}}},function(a){var c=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],l=function(e){for(var t=0,n=c.length;t<n;t++)if("border-box"===a.getStyle(c[t]).from(e))return c[t]};a.copyStyles=function(s){return{from:function(e){var t;l(t=e)&&parseInt(a.getStyle("width").from(t),10)<t.offsetWidth&&(s=wysihtml5.lang.array(s).without(c));for(var n,o="",r=s.length,i=0;i<r;i++)n=s[i],o+=n+":"+a.getStyle(n).from(e)+";";return{to:function(e){return a.setStyles(o).on(e),{andTo:arguments.callee}}}}}}}(wysihtml5.dom),function(s){s.dom.delegate=function(o,r,e,i){return s.dom.observe(o,e,function(e){for(var t=e.target,n=s.lang.array(o.querySelectorAll(r));t&&t!==o;){if(n.contains(t)){i.call(t,e);break}t=t.parentNode}})}}(wysihtml5),wysihtml5.dom.getAsDom=function(){var o=["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(e,t){var n;return t=t||document,"object"==typeof e&&e.nodeType?(n=t.createElement("div")).appendChild(e):wysihtml5.browser.supportsHTML5Tags(t)?(n=t.createElement("div")).innerHTML=e:(!function(e){if(!e._wysihtml5_supportsHTML5Tags){for(var t=0,n=o.length;t<n;t++)e.createElement(o[t]);e._wysihtml5_supportsHTML5Tags=!0}}(t),n=function(e,t){var n=t.createElement("div");n.style.display="none",t.body.appendChild(n);try{n.innerHTML=e}catch(e){}return t.body.removeChild(n),n}(e,t)),n}}(),wysihtml5.dom.getParentElement=function(){function c(e,t){return!t||!t.length||("string"==typeof t?e===t:wysihtml5.lang.array(t).contains(e))}return function(e,t,n){return n=n||50,t.className||t.classRegExp?function(e,t,n,o,r){for(;r--&&e&&"BODY"!==e.nodeName;){if(e.nodeType===wysihtml5.ELEMENT_NODE&&c(e.nodeName,t)&&(i=n,s=o,a=(e.className||"").match(s)||[],i?a[a.length-1]===i:a.length))return e;e=e.parentNode}var i,s,a;return null}(e,t.nodeName,t.className,t.classRegExp,n):function(e,t,n){for(;n--&&e&&"BODY"!==e.nodeName;){if(c(e.nodeName,t))return e;e=e.parentNode}return null}(e,t.nodeName,n)}}(),wysihtml5.dom.getStyle=function(){var u={float:"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},f=/\-[a-z]/g;return function(d){return{from:function(e){if(e.nodeType===wysihtml5.ELEMENT_NODE){var t=e.ownerDocument,n=u[d]||d.replace(f,function(e){return e.charAt(1).toUpperCase()}),o=e.style,r=e.currentStyle,i=o[n];if(i)return i;if(r)try{return r[n]}catch(e){}var s,a,c=t.defaultView||t.parentWindow,l=("height"===d||"width"===d)&&"TEXTAREA"===e.nodeName;return c.getComputedStyle?(l&&(s=o.overflow,o.overflow="hidden"),a=c.getComputedStyle(e,null).getPropertyValue(d),l&&(o.overflow=s||""),a):void 0}}}}}(),wysihtml5.dom.hasElementWithTagName=function(){var i={},s=1;return function(e,t){var n,o=((n=e)._wysihtml5_identifier||(n._wysihtml5_identifier=s++))+":"+t,r=i[o];return r||(r=i[o]=e.getElementsByTagName(t)),0<r.length}}(),function(i){var s={},a=1;i.dom.hasElementWithClassName=function(e,t){if(!i.browser.supportsNativeGetElementsByClassName())return!!e.querySelector("."+t);var n,o=((n=e)._wysihtml5_identifier||(n._wysihtml5_identifier=a++))+":"+t,r=s[o];return r||(r=s[o]=e.getElementsByClassName(t)),0<r.length}}(wysihtml5),wysihtml5.dom.insert=function(t){return{after:function(e){e.parentNode.insertBefore(t,e.nextSibling)},before:function(e){e.parentNode.insertBefore(t,e)},into:function(e){e.appendChild(t)}}},wysihtml5.dom.insertCSS=function(o){return o=o.join("\n"),{into:function(e){var t=e.head||e.getElementsByTagName("head")[0],n=e.createElement("style");n.type="text/css",n.styleSheet?n.styleSheet.cssText=o:n.appendChild(e.createTextNode(o)),t&&t.appendChild(n)}}},wysihtml5.dom.observe=function(o,r,i){for(var s,e,t=0,n=(r="string"==typeof r?[r]:r).length;t<n;t++)e=r[t],o.addEventListener?o.addEventListener(e,i,!1):(s=function(e){"target"in e||(e.target=e.srcElement),e.preventDefault=e.preventDefault||function(){this.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){this.cancelBubble=!0},i.call(o,e)},o.attachEvent("on"+e,s));return{stop:function(){for(var e,t=0,n=r.length;t<n;t++)e=r[t],o.removeEventListener?o.removeEventListener(e,i,!1):o.detachEvent("on"+e,s)}}},wysihtml5.dom.parse=function(){var c={1:function(e){var t,n,o=E.tags,r=e.nodeName.toLowerCase(),i=e.scopeName;if(e._wysihtml5)return null;if(e._wysihtml5=1,"wysihtml5-temp"===e.className)return null;i&&"HTML"!=i&&(r=i+":"+r);"outerHTML"in e&&(wysihtml5.browser.autoClosesUnclosedTags()||"P"!==e.nodeName||"</p>"===e.outerHTML.slice(-4).toLowerCase()||(r="div"));if(r in o){if(!(t=o[r])||t.remove)return null;t="string"==typeof t?{rename_tag:t}:t}else{if(!e.firstChild)return null;t={rename_tag:l}}return n=e.ownerDocument.createElement(t.rename_tag||r),function(e,t,n){var o,r,i,s,a,c,l,d={},u=n.set_class,f=n.add_class,h=n.set_attributes,m=n.check_attributes,g=E.classes,p=0,v=[],y=[],C=[],w=[];if(h&&(d=wysihtml5.lang.object(h).clone()),m)for(a in m)(l=S[m[a]])&&"string"==typeof(c=l(b(e,a)))&&(d[a]=c);if(u&&v.push(u),f)for(a in f)(l=T[f[a]])&&"string"==typeof(s=l(b(e,a)))&&v.push(s);for(g["_wysihtml5-temp-placeholder"]=1,(w=e.getAttribute("class"))&&(v=v.concat(w.split(N))),o=v.length;p<o;p++)i=v[p],g[i]&&y.push(i);for(r=y.length;r--;)i=y[r],wysihtml5.lang.array(C).contains(i)||C.unshift(i);for(a in C.length&&(d.class=C.join(" ")),d)try{t.setAttribute(a,d[a])}catch(e){}d.src&&(void 0!==d.width&&t.setAttribute("width",d.width),void 0!==d.height&&t.setAttribute("height",d.height))}(e,n,t),e=null,n},3:function(e){return e.ownerDocument.createTextNode(e.data)}},l="span",N=/\s+/,d={tags:{},classes:{}},E={};function u(e,t){var n,o=e.nodeType,r=e.childNodes,i=r.length,s=c[o],a=0;if(!(n=s&&s(e)))return null;for(a=0;a<i;a++)newChild=u(r[a],t),newChild&&n.appendChild(newChild);return t&&n.childNodes.length<=1&&n.nodeName.toLowerCase()===l&&!n.attributes.length?n.firstChild:n}var n=!wysihtml5.browser.supportsGetAttributeCorrectly();function b(e,t){return t=t.toLowerCase(),"IMG"==e.nodeName&&"src"==t&&!0===function(t){try{return t.complete&&!t.mozMatchesSelector(":-moz-broken")}catch(e){if(t.complete&&"complete"===t.readyState)return!0}}(e)?e.src:n&&"outerHTML"in e?-1!=e.outerHTML.toLowerCase().indexOf(" "+t+"=")?e.getAttribute(t):null:e.getAttribute(t)}var t,o,r,i,s,a,f,S={url:(r=/^https?:\/\//i,function(e){return e&&e.match(r)?e.replace(r,function(e){return e.toLowerCase()}):null}),alt:(o=/[^ a-z0-9_\-]/gi,function(e){return e?e.replace(o,""):""}),numbers:(t=/\D/g,function(e){return(e=(e||"").replace(t,""))||null})},T={align_img:(f={left:"wysiwyg-float-left",right:"wysiwyg-float-right"},function(e){return f[String(e).toLowerCase()]}),align_text:(a={left:"wysiwyg-text-align-left",right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"},function(e){return a[String(e).toLowerCase()]}),clear_br:(s={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"},function(e){return s[String(e).toLowerCase()]}),size_font:(i={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"},function(e){return i[String(e).charAt(0)]})};return function(e,t,n,o){wysihtml5.lang.object(E).merge(d).merge(t).get();var r,i,s,a=(n=n||e.ownerDocument||document).createDocumentFragment(),c="string"==typeof e;for(r=c?wysihtml5.dom.getAsDom(e,n):e;r.firstChild;)s=r.firstChild,r.removeChild(s),(i=u(s,o))&&a.appendChild(i);return r.innerHTML="",r.appendChild(a),c?wysihtml5.quirks.getCorrectInnerHTML(r):r}}(),wysihtml5.dom.removeEmptyTextNodes=function(e){for(var t,n=wysihtml5.lang.array(e.childNodes).get(),o=n.length,r=0;r<o;r++)(t=n[r]).nodeType===wysihtml5.TEXT_NODE&&""===t.data&&t.parentNode.removeChild(t)},wysihtml5.dom.renameElement=function(e,t){for(var n,o=e.ownerDocument.createElement(t);n=e.firstChild;)o.appendChild(n);return wysihtml5.dom.copyAttributes(["align","className"]).from(e).to(o),e.parentNode.replaceChild(o,e),o},wysihtml5.dom.replaceWithChildNodes=function(e){if(e.parentNode)if(e.firstChild){for(var t=e.ownerDocument.createDocumentFragment();e.firstChild;)t.appendChild(e.firstChild);e.parentNode.replaceChild(t,e),e=t=null}else e.parentNode.removeChild(e)},function(t){function a(e){return"block"===t.getStyle("display").from(e)}function c(e){var t=e.ownerDocument.createElement("br");e.appendChild(t)}t.resolveList=function(e){if("MENU"===e.nodeName||"UL"===e.nodeName||"OL"===e.nodeName){var t,n,o,r,i=e.ownerDocument.createDocumentFragment(),s=e.previousElementSibling||e.previousSibling;for(s&&!a(s)&&c(i);r=e.firstChild;){for(n=r.lastChild;t=r.firstChild;)o=!(t!==n||a(t)||"BR"===t.nodeName),i.appendChild(t),o&&c(i);r.parentNode.removeChild(r)}e.parentNode.replaceChild(i,e)}}}(wysihtml5.dom),function(c){var l=document,d=["parent","top","opener","frameElement","frames","localStorage","globalStorage","sessionStorage","indexedDB"],u=["open","close","openDialog","showModalDialog","alert","confirm","prompt","openDatabase","postMessage","XMLHttpRequest","XDomainRequest"],f=["referrer","write","open","close"];c.dom.Sandbox=Base.extend({constructor:function(e,t){this.callback=e||c.EMPTY_FUNCTION,this.config=c.lang.object({}).merge(t).get(),this.iframe=this._createIframe()},insertInto:function(e){"string"==typeof e&&(e=l.getElementById(e)),e.appendChild(this.iframe)},getIframe:function(){return this.iframe},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var e=this.getIframe();e.parentNode.removeChild(e)},_readyError:function(){throw new Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet")},_createIframe:function(){var e=this,t=l.createElement("iframe");return t.className="wysihtml5-sandbox",c.dom.setAttributes({security:"restricted",allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(t),c.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(t.src="javascript:'<html></html>'"),t.onload=function(){t.onreadystatechange=t.onload=null,e._onLoadIframe(t)},t.onreadystatechange=function(){/loaded|complete/.test(t.readyState)&&(t.onreadystatechange=t.onload=null,e._onLoadIframe(t))},t},_onLoadIframe:function(e){if(c.dom.contains(l.documentElement,e)){var t=this,n=e.contentWindow,o=e.contentWindow.document,r=l.characterSet||l.charset||"utf-8",i=this._getHtml({charset:r,stylesheets:this.config.stylesheets});if(o.open("text/html","replace"),o.write(i),o.close(),this.getWindow=function(){return e.contentWindow},this.getDocument=function(){return e.contentWindow.document},n.onerror=function(e,t,n){throw new Error("wysihtml5.Sandbox: "+e,t,n)},!c.browser.supportsSandboxedIframes()){var s,a;for(s=0,a=d.length;s<a;s++)this._unset(n,d[s]);for(s=0,a=u.length;s<a;s++)this._unset(n,u[s],c.EMPTY_FUNCTION);for(s=0,a=f.length;s<a;s++)this._unset(o,f[s]);this._unset(o,"cookie","",!0)}this.loaded=!0,setTimeout(function(){t.callback(t)},0)}},_getHtml:function(e){var t,n=e.stylesheets,o="",r=0;if(n="string"==typeof n?[n]:n)for(t=n.length;r<t;r++)o+='<link rel="stylesheet" href="'+n[r]+'">';return e.stylesheets=o,c.lang.string('<!DOCTYPE html><html><head><meta charset="#{charset}">#{stylesheets}</head><body></body></html>').interpolate(e)},_unset:function(e,t,n,o){try{e[t]=n}catch(e){}try{e.__defineGetter__(t,function(){return n})}catch(e){}if(o)try{e.__defineSetter__(t,function(){})}catch(e){}if(!c.browser.crashesWhenDefineProperty(t))try{var r={get:function(){return n}};o&&(r.set=function(){}),Object.defineProperty(e,t,r)}catch(e){}}})}(wysihtml5),function(){var o={className:"class"};wysihtml5.dom.setAttributes=function(n){return{on:function(e){for(var t in n)e.setAttribute(o[t]||t,n[t])}}}}(),wysihtml5.dom.setStyles=function(o){return{on:function(e){var t=e.style;if("string"!=typeof o)for(var n in o)"float"===n?(t.cssFloat=o[n],t.styleFloat=o[n]):t[n]=o[n];else t.cssText+=";"+o}}},function(s){s.simulatePlaceholder=function(e,t,n){var o="placeholder",r=function(){t.hasPlaceholderSet()&&t.clear(),s.removeClass(t.element,o)},i=function(){t.isEmpty()&&(t.setValue(n),s.addClass(t.element,o))};e.observe("set_placeholder",i).observe("unset_placeholder",r).observe("focus:composer",r).observe("paste:composer",r).observe("blur:composer",i),i()}}(wysihtml5.dom),function(e){var t=document.documentElement;e.getTextContent="textContent"in t?(e.setTextContent=function(e,t){e.textContent=t},function(e){return e.textContent}):"innerText"in t?(e.setTextContent=function(e,t){e.innerText=t},function(e){return e.innerText}):(e.setTextContent=function(e,t){e.nodeValue=t},function(e){return e.nodeValue})}(wysihtml5.dom),wysihtml5.quirks.cleanPastedHTML=function(){var d={"a u":wysihtml5.dom.replaceWithChildNodes};return function(e,t,n){t=t||d,n=n||e.ownerDocument||document;var o,r,i,s,a,c="string"==typeof e,l=0;for(a in o=c?wysihtml5.dom.getAsDom(e,n):e,t)for(i=o.querySelectorAll(a),r=t[a],s=i.length;l<s;l++)r(i[l]);return i=e=t=null,c?o.innerHTML:o}}(),function(o){var t,r,i=o.dom;o.quirks.ensureProperClearing=(t=function(e){var t=this;setTimeout(function(){var e=t.innerHTML.toLowerCase();"<p>&nbsp;</p>"!=e&&"<p>&nbsp;</p><p>&nbsp;</p>"!=e||(t.innerHTML="")},0)},function(e){i.observe(e.element,["cut","keydown"],t)}),o.quirks.ensureProperClearingOfLists=(r=["OL","UL","MENU"],function(t){i.observe(t.element,"keydown",function(e){e.keyCode===o.BACKSPACE_KEY&&function(e,t){if(t.firstChild&&o.lang.array(r).contains(t.firstChild.nodeName)){var n=i.getParentElement(e,{nodeName:r});n&&n==t.firstChild&&n.childNodes.length<=1&&(!n.firstChild||""===n.firstChild.innerHTML)&&n.parentNode.removeChild(n)}}(t.selection.getSelectedNode(),t.element)})})}(wysihtml5),function(a){a.quirks.getCorrectInnerHTML=function(e){var t=e.innerHTML;if(-1===t.indexOf("%7E"))return t;var n,o,r,i,s=e.querySelectorAll("[href*='~'], [src*='~']");for(i=0,r=s.length;i<r;i++)n=s[i].href||s[i].src,o=a.lang.string(n).replace("~").by("%7E"),t=a.lang.string(t).replace(o).by(n);return t}}(wysihtml5),function(s){var a=s.dom,c=["LI","P","H1","H2","H3","H4","H5","H6"],l=["UL","OL","MENU"];s.quirks.insertLineBreakOnReturn=function(r){function i(e){var t=a.getParentElement(e,{nodeName:["P","DIV"]},2);if(t){var n=document.createTextNode(s.INVISIBLE_SPACE);a.insert(n).before(t),a.replaceWithChildNodes(t),r.selection.selectNode(n)}}a.observe(r.element.ownerDocument,"keydown",function(e){var t=e.keyCode;if(!(e.shiftKey||t!==s.ENTER_KEY&&t!==s.BACKSPACE_KEY)){e.target;var n=r.selection.getSelectedNode(),o=a.getParentElement(n,{nodeName:c},4);o?"LI"!==o.nodeName||t!==s.ENTER_KEY&&t!==s.BACKSPACE_KEY?o.nodeName.match(/H[1-6]/)&&t===s.ENTER_KEY&&setTimeout(function(){i(r.selection.getSelectedNode())},0):setTimeout(function(){var e=r.selection.getSelectedNode();e&&(a.getParentElement(e,{nodeName:l},2)||i(e))},0):t!==s.ENTER_KEY||s.browser.insertsLineBreaksOnReturn()||(r.commands.exec("insertLineBreak"),e.preventDefault())}})}}(wysihtml5),function(n){var o="wysihtml5-quirks-redraw";n.quirks.redraw=function(e){n.dom.addClass(e,o),n.dom.removeClass(e,o);try{var t=e.ownerDocument;t.execCommand("italic",!1,null),t.execCommand("italic",!1,null)}catch(e){}}}(wysihtml5),function(d){var c=d.dom;d.Selection=Base.extend({constructor:function(e){window.rangy.init(),this.editor=e,this.composer=e.composer,this.doc=this.composer.doc},getBookmark:function(){var e=this.getRange();return e&&e.cloneRange()},setBookmark:function(e){e&&this.setSelection(e)},setBefore:function(e){var t=rangy.createRange(this.doc);return t.setStartBefore(e),t.setEndBefore(e),this.setSelection(t)},setAfter:function(e){var t=rangy.createRange(this.doc);return t.setStartAfter(e),t.setEndAfter(e),this.setSelection(t)},selectNode:function(e){var t=rangy.createRange(this.doc),n=e.nodeType===d.ELEMENT_NODE,o="canHaveHTML"in e?e.canHaveHTML:"IMG"!==e.nodeName,r=n?e.innerHTML:e.data,i=""===r||r===d.INVISIBLE_SPACE,s=c.getStyle("display").from(e),a="block"===s||"list-item"===s;if(i&&n&&o)try{e.innerHTML=d.INVISIBLE_SPACE}catch(e){}o?t.selectNodeContents(e):t.selectNode(e),o&&i&&n?t.collapse(a):o&&i&&(t.setStartAfter(e),t.setEndAfter(e)),this.setSelection(t)},getSelectedNode:function(e){var t,n;return e&&this.doc.selection&&"Control"===this.doc.selection.type&&(n=this.doc.selection.createRange())&&n.length?n.item(0):(t=this.getSelection(this.doc)).focusNode===t.anchorNode?t.focusNode:(n=this.getRange(this.doc))?n.commonAncestorContainer:this.doc.body},executeAndRestore:function(e,t){var n,o=this.doc.body,r=t&&o.scrollTop,i=t&&o.scrollLeft,s="_wysihtml5-temp-placeholder",a='<span class="'+s+'">'+d.INVISIBLE_SPACE+"</span>",c=this.getRange(this.doc);if(c){var l=c.createContextualFragment(a);c.insertNode(l);try{e(c.startContainer,c.endContainer)}catch(e){setTimeout(function(){throw e},0)}caretPlaceholder=this.doc.querySelector("."+s),caretPlaceholder?((n=rangy.createRange(this.doc)).selectNode(caretPlaceholder),n.deleteContents(),this.setSelection(n)):o.focus(),t&&(o.scrollTop=r,o.scrollLeft=i);try{caretPlaceholder.parentNode.removeChild(caretPlaceholder)}catch(e){}}else e(o,o)},executeAndRestoreSimple:function(e){var t,n,o,r,i,s=this.getRange(),a=this.doc.body;if(s){n=(r=s.getNodes([3]))[0]||s.startContainer,o=r[r.length-1]||s.endContainer,i={collapsed:s.collapsed,startContainer:n,startOffset:n===s.startContainer?s.startOffset:0,endContainer:o,endOffset:o===s.endContainer?s.endOffset:o.length};try{e(s.startContainer,s.endContainer)}catch(e){setTimeout(function(){throw e},0)}t=rangy.createRange(this.doc);try{t.setStart(i.startContainer,i.startOffset)}catch(e){}try{t.setEnd(i.endContainer,i.endOffset)}catch(e){}try{this.setSelection(t)}catch(e){}}else e(a,a)},insertHTML:function(e){var t=rangy.createRange(this.doc).createContextualFragment(e),n=t.lastChild;this.insertNode(t),n&&this.setAfter(n)},insertNode:function(e){var t=this.getRange();t&&t.insertNode(e)},surround:function(t){var n=this.getRange();if(n)try{n.surroundContents(t),this.selectNode(t)}catch(e){t.appendChild(n.extractContents()),n.insertNode(t)}},scrollIntoView:function(){var e,t,n=this.doc,o=n.documentElement.scrollHeight>n.documentElement.offsetHeight,r=n._wysihtml5ScrollIntoViewElement=n._wysihtml5ScrollIntoViewElement||((t=n.createElement("span")).innerHTML=d.INVISIBLE_SPACE,t);o&&(this.insertNode(r),e=function(e){var t=0;if(e.parentNode)for(;t+=e.offsetTop||0,e=e.offsetParent;);return t}(r),r.parentNode.removeChild(r),e>n.body.scrollTop&&(n.body.scrollTop=e))},selectLine:function(){d.browser.supportsSelectionModify()?this._selectLine_W3C():this.doc.selection&&this._selectLine_MSIE()},_selectLine_W3C:function(){var e=this.doc.defaultView.getSelection();e.modify("extend","left","lineboundary"),e.modify("extend","right","lineboundary")},_selectLine_MSIE:function(){var e,t,n,o,r,i=this.doc.selection.createRange(),s=i.boundingTop,a=(i.boundingHeight,this.doc.body.scrollWidth);if(i.moveToPoint){for(0===s&&(n=this.doc.createElement("span"),this.insertNode(n),s=n.offsetTop,n.parentNode.removeChild(n)),s+=1,o=-10;o<a;o+=2)try{i.moveToPoint(o,s);break}catch(e){}for(e=s,t=this.doc.selection.createRange(),r=a;0<=r;r--)try{t.moveToPoint(r,e);break}catch(e){}i.setEndPoint("EndToEnd",t),i.select()}},getText:function(){var e=this.getSelection();return e?e.toString():""},getNodes:function(e,t){var n=this.getRange();return n?n.getNodes([e],t):[]},getRange:function(){var e=this.getSelection();return e&&e.rangeCount&&e.getRangeAt(0)},getSelection:function(){return rangy.getSelection(this.doc.defaultView||this.doc.parentWindow)},setSelection:function(e){var t=this.doc.defaultView||this.doc.parentWindow;return rangy.getSelection(t).setSingleRange(e)}})}(wysihtml5),function(a,s){var o=/\s+/g;function n(e,t,n){if(!e.className)return!1;var o=e.className.match(n)||[];return o[o.length-1]===t}function c(e,t){e.className&&(e.className=e.className.replace(t,""))}function r(e,t){return s.dom.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:0<t&&t<e.childNodes.length}function i(e,t,n){var o;if(s.dom.isCharacterDataNode(t)&&(0==n?(n=s.dom.getNodeIndex(t),t=t.parentNode):n==t.length?(n=s.dom.getNodeIndex(t)+1,t=t.parentNode):o=s.dom.splitDataNode(t,n)),!o){var r;for((o=t.cloneNode(!1)).id&&o.removeAttribute("id");r=t.childNodes[n];)o.appendChild(r);s.dom.insertAfter(o,t)}return t==e?o:i(e,o.parentNode,s.dom.getNodeIndex(o))}function g(e){this.isElementMerge=e.nodeType==a.ELEMENT_NODE,this.firstTextNode=this.isElementMerge?e.lastChild:e,this.textNodes=[this.firstTextNode]}function e(e,t,n,o){this.tagNames=e||["span"],this.cssClass=t||"",this.similarClassRegExp=n,this.normalize=o,this.applyToAnyTagName=!1}g.prototype={doMerge:function(){for(var e,t,n,o=[],r=0,i=this.textNodes.length;r<i;++r)t=(e=this.textNodes[r]).parentNode,o[r]=e.data,r&&(t.removeChild(e),t.hasChildNodes()||t.parentNode.removeChild(t));return this.firstTextNode.data=n=o.join(""),n},getLength:function(){for(var e=this.textNodes.length,t=0;e--;)t+=this.textNodes[e].length;return t},toString:function(){for(var e=[],t=0,n=this.textNodes.length;t<n;++t)e[t]="'"+this.textNodes[t].data+"'";return"[Merge("+e.join(",")+")]"}},e.prototype={getAncestorWithClass:function(e){for(var t;e;){if(t=!this.cssClass||n(e,this.cssClass,this.similarClassRegExp),e.nodeType==a.ELEMENT_NODE&&s.dom.arrayContains(this.tagNames,e.tagName.toLowerCase())&&t)return e;e=e.parentNode}return!1},postApply:function(e,t){for(var n,o,r,i=e[0],s=e[e.length-1],a=[],c=i,l=s,d=0,u=s.length,f=0,h=e.length;f<h;++f)o=e[f],(r=this.getAdjacentMergeableTextNode(o.parentNode,!1))?(n||(n=new g(r),a.push(n)),n.textNodes.push(o),o===i&&(d=(c=n.firstTextNode).length),o===s&&(l=n.firstTextNode,u=n.getLength())):n=null;var m=this.getAdjacentMergeableTextNode(s.parentNode,!0);if(m&&(n||(n=new g(s),a.push(n)),n.textNodes.push(m)),a.length){for(f=0,h=a.length;f<h;++f)a[f].doMerge();t.setStart(c,d),t.setEnd(l,u)}},getAdjacentMergeableTextNode:function(e,t){var n,o=e.nodeType==a.TEXT_NODE,r=o?e.parentNode:e,i=t?"nextSibling":"previousSibling";if(o){if((n=e[i])&&n.nodeType==a.TEXT_NODE)return n}else if((n=r[i])&&this.areElementsMergeable(e,n))return n[t?"firstChild":"lastChild"];return null},areElementsMergeable:function(e,t){return s.dom.arrayContains(this.tagNames,(e.tagName||"").toLowerCase())&&s.dom.arrayContains(this.tagNames,(t.tagName||"").toLowerCase())&&(n=t,e.className.replace(o," ")==n.className.replace(o," "))&&function(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,o,r,i=0,s=e.attributes.length;i<s;++i)if("class"!=(r=(n=e.attributes[i]).name)){if(o=t.attributes.getNamedItem(r),n.specified!=o.specified)return!1;if(n.specified&&n.nodeValue!==o.nodeValue)return!1}return!0}(e,t);var n},createContainer:function(e){var t=e.createElement(this.tagNames[0]);return this.cssClass&&(t.className=this.cssClass),t},applyToTextNode:function(e){var t,n,o,r=e.parentNode;if(1==r.childNodes.length&&s.dom.arrayContains(this.tagNames,r.tagName.toLowerCase()))this.cssClass&&(t=r,n=this.cssClass,o=this.similarClassRegExp,t.className?(c(t,o),t.className+=" "+n):t.className=n);else{var i=this.createContainer(s.dom.getDocument(e));e.parentNode.insertBefore(i,e),i.appendChild(e)}},isRemovable:function(e){return s.dom.arrayContains(this.tagNames,e.tagName.toLowerCase())&&a.lang.string(e.className).trim()==this.cssClass},undoToTextNode:function(e,t,n){if(!t.containsNode(n)){var o=t.cloneRange();o.selectNode(n),o.isPointInRange(t.endContainer,t.endOffset)&&r(t.endContainer,t.endOffset)&&(i(n,t.endContainer,t.endOffset),t.setEndAfter(n)),o.isPointInRange(t.startContainer,t.startOffset)&&r(t.startContainer,t.startOffset)&&(n=i(n,t.startContainer,t.startOffset))}this.similarClassRegExp&&c(n,this.similarClassRegExp),this.isRemovable(n)&&function(e){for(var t=e.parentNode;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}(n)},applyToRange:function(e){var t=e.getNodes([a.TEXT_NODE]);if(!t.length)try{var n=this.createContainer(e.endContainer.ownerDocument);return e.surroundContents(n),void this.selectNode(e,n)}catch(e){}if(e.splitBoundaries(),(t=e.getNodes([a.TEXT_NODE])).length){for(var o,r=0,i=t.length;r<i;++r)o=t[r],this.getAncestorWithClass(o)||this.applyToTextNode(o);e.setStart(t[0],0),o=t[t.length-1],e.setEnd(o,o.length),this.normalize&&this.postApply(t,e)}},undoToRange:function(e){var t,n,o=e.getNodes([a.TEXT_NODE]);if(o.length)e.splitBoundaries(),o=e.getNodes([a.TEXT_NODE]);else{var r=e.endContainer.ownerDocument.createTextNode(a.INVISIBLE_SPACE);e.insertNode(r),e.selectNode(r),o=[r]}for(var i=0,s=o.length;i<s;++i)t=o[i],(n=this.getAncestorWithClass(t))&&this.undoToTextNode(t,e,n);1==s?this.selectNode(e,o[0]):(e.setStart(o[0],0),t=o[o.length-1],e.setEnd(t,t.length),this.normalize&&this.postApply(o,e))},selectNode:function(e,t){var n=t.nodeType===a.ELEMENT_NODE,o=!("canHaveHTML"in t)||t.canHaveHTML,r=n?t.innerHTML:t.data,i=""===r||r===a.INVISIBLE_SPACE;if(i&&n&&o)try{t.innerHTML=a.INVISIBLE_SPACE}catch(e){}e.selectNodeContents(t),i&&n?e.collapse(!1):i&&(e.setStartAfter(t),e.setEndAfter(t))},getTextSelectedByRange:function(e,t){var n=t.cloneRange();n.selectNodeContents(e);var o=n.intersection(t),r=o?o.toString():"";return n.detach(),r},isAppliedToRange:function(e){var t,n=[],o=e.getNodes([a.TEXT_NODE]);if(!o.length)return!!(t=this.getAncestorWithClass(e.startContainer))&&[t];for(var r,i=0,s=o.length;i<s;++i){if(r=this.getTextSelectedByRange(o[i],e),t=this.getAncestorWithClass(o[i]),""!=r&&!t)return!1;n.push(t)}return n},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)}},a.selection.HTMLApplier=e}(wysihtml5,rangy),wysihtml5.Commands=Base.extend({constructor:function(e){this.editor=e,this.composer=e.composer,this.doc=this.composer.doc},support:function(e){return wysihtml5.browser.supportsCommand(this.doc,e)},exec:function(e,t){var n=wysihtml5.commands[e],o=wysihtml5.lang.array(arguments).get(),r=n&&n.exec,i=null;if(this.editor.fire("beforecommand:composer"),r)o.unshift(this.composer),i=r.apply(n,o);else try{i=this.doc.execCommand(e,!1,t)}catch(e){}return this.editor.fire("aftercommand:composer"),i},state:function(e,t){var n=wysihtml5.commands[e],o=wysihtml5.lang.array(arguments).get(),r=n&&n.state;if(r)return o.unshift(this.composer),r.apply(n,o);try{return this.doc.queryCommandState(e)}catch(e){return!1}},value:function(e){var t=wysihtml5.commands[e],n=t&&t.value;if(n)return n.call(t,this.composer,e);try{return this.doc.queryCommandValue(e)}catch(e){return null}}}),function(o){o.commands.bold={exec:function(e,t){return o.commands.formatInline.exec(e,t,"b")},state:function(e,t,n){return o.commands.formatInline.state(e,t,"b")},value:function(){}}}(wysihtml5),function(m){var g=m.dom;m.commands.createLink={exec:function(e,t,n){var o=this.state(e,t);o?e.selection.executeAndRestore(function(){!function(e,t){for(var n,o,r=t.length,i=0;i<r;i++)n=t[i],o=g.getParentElement(n,{nodeName:"code"}),g.getTextContent(n).match(g.autoLink.URL_REG_EXP)&&!o?o=g.renameElement(n,"code"):g.replaceWithChildNodes(n)}(0,o)}):function(e,t){var n,o,r,i,s,a,c,l,d,u=e.doc,f="_wysihtml5-temp-"+ +new Date,h=0;for(m.commands.formatInline.exec(e,void 0,"A",f,/non-matching-class/g),n=(o=u.querySelectorAll("A."+f)).length;h<n;h++)for(d in(r=o[h]).removeAttribute("class"),t)r.setAttribute(d,t[d]);a=r,1===n&&(c=g.getTextContent(r),i=!!r.querySelector("*"),s=""===c||c===m.INVISIBLE_SPACE,!i&&s&&(g.setTextContent(r,t.text||r.href),l=u.createTextNode(" "),e.selection.setAfter(r),e.selection.insertNode(l),a=l)),e.selection.setAfter(a)}(e,n="object"==typeof n?n:{href:n})},state:function(e,t){return m.commands.formatInline.state(e,t,"A")},value:function(){}}}(wysihtml5),function(o){var r=/wysiwyg-font-size-[a-z\-]+/g;o.commands.fontSize={exec:function(e,t,n){return o.commands.formatInline.exec(e,t,"span","wysiwyg-font-size-"+n,r)},state:function(e,t,n){return o.commands.formatInline.state(e,t,"span","wysiwyg-font-size-"+n,r)},value:function(){}}}(wysihtml5),function(o){var r=/wysiwyg-color-[a-z]+/g;o.commands.foreColor={exec:function(e,t,n){return o.commands.formatInline.exec(e,t,"span","wysiwyg-color-"+n,r)},state:function(e,t,n){return o.commands.formatInline.state(e,t,"span","wysiwyg-color-"+n,r)},value:function(){}}}(wysihtml5),function(l){var d=l.dom,u="DIV",i=["H1","H2","H3","H4","H5","H6","P","BLOCKQUOTE",u];function f(e,t){e.className=e.className.replace(t,"")}function n(e){return e.nodeType===l.TEXT_NODE&&!l.lang.string(e.data).trim()}function h(e){for(var t=e.previousSibling;t&&n(t);)t=t.previousSibling;return t}function m(e){for(var t=e.nextSibling;t&&n(t);)t=t.nextSibling;return t}function s(e){return"BR"===e.nodeName}function g(e){return!!s(e)||"block"===d.getStyle("display").from(e)}function p(e,t){var n,o,r,i;e.selection.selectLine(),e.selection.surround(t),o=m(n=t),r=h(n),o&&s(o)&&o.parentNode.removeChild(o),r&&s(r)&&r.parentNode.removeChild(r),(i=t.lastChild)&&s(i)&&i.parentNode.removeChild(i),e.selection.selectNode(t)}l.commands.formatBlock={exec:function(e,t,s,o,a){var n,r=e.doc,c=this.state(e,t,s,o,a);s="string"==typeof s?s.toUpperCase():s,c?e.selection.executeAndRestoreSimple(function(){a&&f(c,a);var e,t,n,o,r,i=(e=c,!!l.lang.string(e.className).trim());i||c.nodeName!==(s||u)?i&&d.renameElement(c,u):(n=(t=c).ownerDocument,o=m(t),r=h(t),o&&!g(o)&&t.parentNode.insertBefore(n.createElement("br"),o),r&&!g(r)&&t.parentNode.insertBefore(n.createElement("br"),t),d.replaceWithChildNodes(c))}):(null===s||l.lang.array(i).contains(s))&&(n=e.selection.getSelectedNode(),c=d.getParentElement(n,{nodeName:i}))?e.selection.executeAndRestoreSimple(function(){var e,t,n;s&&(c=d.renameElement(c,s)),o&&(t=o,n=a,(e=c).className?(f(e,n),e.className+=" "+t):e.className=t)}):e.commands.support(t)?function(e,t,n,o){if(o)var r=d.observe(e,"DOMNodeInserted",function(e){var t=e.target;t.nodeType===l.ELEMENT_NODE&&"inline"!==d.getStyle("display").from(t).substr(0,6)&&(t.className+=" "+o)});e.execCommand(t,!1,n),r&&r.stop()}(r,t,s||u,o):(c=r.createElement(s||u),o&&(c.className=o),p(e,c))},state:function(e,t,n,o,r){n="string"==typeof n?n.toUpperCase():n;var i=e.selection.getSelectedNode();return d.getParentElement(i,{nodeName:n,className:o,classRegExp:r})},value:function(){}}}(wysihtml5),function(c){var l={strong:"b",em:"i",b:"strong",i:"em"},s={};function d(e,t,n){var o,r,i=e+":"+t;return s[i]||(s[i]=new c.selection.HTMLApplier((r=l[o=e])?[o.toLowerCase(),r.toLowerCase()]:[o.toLowerCase()],t,n,!0)),s[i]}c.commands.formatInline={exec:function(e,t,n,o,r){var i=e.selection.getRange();if(!i)return!1;d(n,o,r).toggleRange(i),e.selection.setSelection(i)},state:function(e,t,n,o,r){var i,s=e.doc,a=l[n]||n;return!(!c.dom.hasElementWithTagName(s,n)&&!c.dom.hasElementWithTagName(s,a))&&(!(o&&!c.dom.hasElementWithClassName(s,o))&&(!!(i=e.selection.getRange())&&d(n,o,r).isAppliedToRange(i)))},value:function(){}}}(wysihtml5),wysihtml5.commands.insertHTML={exec:function(e,t,n){e.commands.support(t)?e.doc.execCommand(t,!1,n):e.selection.insertHTML(n)},state:function(){return!1},value:function(){}},function(c){c.commands.insertImage={exec:function(e,t,n){n="object"==typeof n?n:{src:n};var o,r,i,s=e.doc,a=this.state(e);if(a)return e.selection.setBefore(a),(i=a.parentNode).removeChild(a),c.dom.removeEmptyTextNodes(i),"A"!==i.nodeName||i.firstChild||(e.selection.setAfter(i),i.parentNode.removeChild(i)),void c.quirks.redraw(e.element);for(r in a=s.createElement("IMG"),n)a[r]=n[r];e.selection.insertNode(a),c.browser.hasProblemsSettingCaretAfterImg()?(o=s.createTextNode(c.INVISIBLE_SPACE),e.selection.insertNode(o),e.selection.setAfter(o)):e.selection.setAfter(a)},state:function(e){var t,n,o,r=e.doc;return!!c.dom.hasElementWithTagName(r,"IMG")&&(!!(t=e.selection.getSelectedNode())&&("IMG"===t.nodeName?t:t.nodeType===c.ELEMENT_NODE&&(n=e.selection.getText(),!(n=c.lang.string(n).trim())&&(1===(o=e.selection.getNodes(c.ELEMENT_NODE,function(e){return"IMG"===e.nodeName})).length&&o[0]))))},value:function(e){var t=this.state(e);return t&&t.src}}}(wysihtml5),function(n){var o="<br>"+(n.browser.needsSpaceAfterLineBreak()?" ":"");n.commands.insertLineBreak={exec:function(e,t){e.commands.support(t)?(e.doc.execCommand(t,!1,null),n.browser.autoScrollsToCaret()||e.selection.scrollIntoView()):e.commands.exec("insertHTML",o)},state:function(){return!1},value:function(){}}}(wysihtml5),function(l){l.commands.insertOrderedList={exec:function(e,t){var n,o,r=e.doc,i=e.selection.getSelectedNode(),s=l.dom.getParentElement(i,{nodeName:"OL"}),a=l.dom.getParentElement(i,{nodeName:"UL"}),c="_wysihtml5-temp-"+(new Date).getTime();e.commands.support(t)?r.execCommand(t,!1,null):s?e.selection.executeAndRestoreSimple(function(){l.dom.resolveList(s)}):a?e.selection.executeAndRestoreSimple(function(){l.dom.renameElement(a,"ol")}):(e.commands.exec("formatBlock","div",c),n=""===(o=r.querySelector("."+c)).innerHTML||o.innerHTML===l.INVISIBLE_SPACE,e.selection.executeAndRestoreSimple(function(){s=l.dom.convertToList(o,"ol")}),n&&e.selection.selectNode(s.querySelector("li")))},state:function(e){var t=e.selection.getSelectedNode();return l.dom.getParentElement(t,{nodeName:"OL"})},value:function(){}}}(wysihtml5),function(l){l.commands.insertUnorderedList={exec:function(e,t){var n,o,r=e.doc,i=e.selection.getSelectedNode(),s=l.dom.getParentElement(i,{nodeName:"UL"}),a=l.dom.getParentElement(i,{nodeName:"OL"}),c="_wysihtml5-temp-"+(new Date).getTime();e.commands.support(t)?r.execCommand(t,!1,null):s?e.selection.executeAndRestoreSimple(function(){l.dom.resolveList(s)}):a?e.selection.executeAndRestoreSimple(function(){l.dom.renameElement(a,"ul")}):(e.commands.exec("formatBlock","div",c),n=""===(o=r.querySelector("."+c)).innerHTML||o.innerHTML===l.INVISIBLE_SPACE,e.selection.executeAndRestoreSimple(function(){s=l.dom.convertToList(o,"ul")}),n&&e.selection.selectNode(s.querySelector("li")))},state:function(e){var t=e.selection.getSelectedNode();return l.dom.getParentElement(t,{nodeName:"UL"})},value:function(){}}}(wysihtml5),function(o){o.commands.italic={exec:function(e,t){return o.commands.formatInline.exec(e,t,"i")},state:function(e,t,n){return o.commands.formatInline.state(e,t,"i")},value:function(){}}}(wysihtml5),function(n){var o="wysiwyg-text-align-center",r=/wysiwyg-text-align-[a-z]+/g;n.commands.justifyCenter={exec:function(e,t){return n.commands.formatBlock.exec(e,"formatBlock",null,o,r)},state:function(e,t){return n.commands.formatBlock.state(e,"formatBlock",null,o,r)},value:function(){}}}(wysihtml5),function(n){var o="wysiwyg-text-align-left",r=/wysiwyg-text-align-[a-z]+/g;n.commands.justifyLeft={exec:function(e,t){return n.commands.formatBlock.exec(e,"formatBlock",null,o,r)},state:function(e,t){return n.commands.formatBlock.state(e,"formatBlock",null,o,r)},value:function(){}}}(wysihtml5),function(n){var o="wysiwyg-text-align-right",r=/wysiwyg-text-align-[a-z]+/g;n.commands.justifyRight={exec:function(e,t){return n.commands.formatBlock.exec(e,"formatBlock",null,o,r)},state:function(e,t){return n.commands.formatBlock.state(e,"formatBlock",null,o,r)},value:function(){}}}(wysihtml5),function(n){n.commands.underline={exec:function(e,t){return n.commands.formatInline.exec(e,t,"u")},state:function(e,t){return n.commands.formatInline.state(e,t,"u")},value:function(){}}}(wysihtml5),function(s){var a='<span id="_wysihtml5-undo" class="_wysihtml5-temp">'+s.INVISIBLE_SPACE+"</span>",c='<span id="_wysihtml5-redo" class="_wysihtml5-temp">'+s.INVISIBLE_SPACE+"</span>",l=s.dom;s.UndoManager=s.lang.Dispatcher.extend({constructor:function(e){this.editor=e,this.composer=e.composer,this.element=this.composer.element,this.history=[this.composer.getValue()],this.position=1,this.composer.commands.support("insertHTML")&&this._observe()},_observe:function(){var n,r=this,e=this.composer.sandbox.getDocument();if(l.observe(this.element,"keydown",function(e){if(!e.altKey&&(e.ctrlKey||e.metaKey)){var t=e.keyCode,n=90===t&&!e.shiftKey,o=90===t&&e.shiftKey||89===t;n?(r.undo(),e.preventDefault()):o&&(r.redo(),e.preventDefault())}}),l.observe(this.element,"keydown",function(e){var t=e.keyCode;t!==n&&(8!==(n=t)&&46!==t||r.transact())}),s.browser.hasUndoInContextMenu()){var t,o,i=function(){!function(e){for(var t;t=e.querySelector("._wysihtml5-temp");)t.parentNode.removeChild(t)}(e),clearInterval(t)};l.observe(this.element,"contextmenu",function(){i(),r.composer.selection.executeAndRestoreSimple(function(){r.element.lastChild&&r.composer.selection.setAfter(r.element.lastChild),e.execCommand("insertHTML",!1,a),e.execCommand("insertHTML",!1,c),e.execCommand("undo",!1,null)}),t=setInterval(function(){e.getElementById("_wysihtml5-redo")?(i(),r.redo()):e.getElementById("_wysihtml5-undo")||(i(),r.undo())},400),o||(o=!0,l.observe(document,"mousedown",i),l.observe(e,["mousedown","paste","cut","copy"],i))})}this.editor.observe("newword:composer",function(){r.transact()}).observe("beforecommand:composer",function(){r.transact()})},transact:function(){var e=this.history[this.position-1],t=this.composer.getValue();t!=e&&(40<(this.history.length=this.position)&&(this.history.shift(),this.position--),this.position++,this.history.push(t))},undo:function(){this.transact(),this.position<=1||(this.set(this.history[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.position>=this.history.length||(this.set(this.history[++this.position-1]),this.editor.fire("redo:composer"))},set:function(e){this.composer.setValue(e),this.editor.focus(!0)}})}(wysihtml5),wysihtml5.views.View=Base.extend({constructor:function(e,t,n){this.parent=e,this.element=t,this.config=n,this._observeViewChange()},_observeViewChange:function(){var t=this;this.parent.observe("beforeload",function(){t.parent.observe("change_view",function(e){e===t.name?((t.parent.currentView=t).show(),setTimeout(function(){t.focus()},0)):t.hide()})})},focus:function(){if(this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element.focus()}catch(e){}},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(c){var l=c.dom,o=c.browser;c.views.Composer=c.views.View.extend({name:"composer",CARET_HACK:"<br>",constructor:function(e,t,n){this.base(e,t,n),this.textarea=this.parent.textarea,this._initSandbox()},clear:function(){this.element.innerHTML=o.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(e){var t=this.isEmpty()?"":c.quirks.getCorrectInnerHTML(this.element);return e&&(t=this.parent.parse(t)),t=c.lang.string(t).replace(c.INVISIBLE_SPACE).by("")},setValue:function(e,t){t&&(e=this.parent.parse(e)),this.element.innerHTML=e},show:function(){this.iframe.style.display=this._displayStyle||"",this.disable(),this.enable()},hide:function(){this._displayStyle=l.getStyle("display").from(this.iframe),"none"===this._displayStyle&&(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()},focus:function(e){c.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear(),this.base();var t=this.element.lastChild;e&&t&&("BR"===t.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getTextContent:function(){return l.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==this.textarea.element.getAttribute("placeholder")},isEmpty:function(){var e=this.element.innerHTML;return""===e||e===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 e=this;this.sandbox=new l.Sandbox(function(){e._create()},{stylesheets:this.config.stylesheets}),this.iframe=this.sandbox.getIframe();var t=document.createElement("input");t.type="hidden",t.name="_wysihtml5_mode",t.value=1;var n=this.textarea.element;l.insert(this.iframe).after(n),l.insert(t).after(n)},_create:function(){var e=this;this.doc=this.sandbox.getDocument(),this.element=this.doc.body,this.textarea=this.parent.textarea,this.element.innerHTML=this.textarea.getValue(!0),this.enable(),this.selection=new c.Selection(this.parent),this.commands=new c.Commands(this.parent),l.copyAttributes(["className","spellcheck","title","lang","dir","accessKey"]).from(this.textarea.element).to(this.element),l.addClass(this.element,this.config.composerClassName),this.config.style&&this.style(),this.observe();var t=this.config.name;t&&(l.addClass(this.element,t),l.addClass(this.iframe,t));var n="string"==typeof this.config.placeholder?this.config.placeholder:this.textarea.element.getAttribute("placeholder");n&&l.simulatePlaceholder(this.parent,this,n),this.commands.exec("styleWithCSS",!1),this._initAutoLinking(),this._initObjectResizing(),this._initUndoManager(),(this.textarea.element.hasAttribute("autofocus")||document.querySelector(":focus")==this.textarea.element)&&setTimeout(function(){e.focus()},100),c.quirks.insertLineBreakOnReturn(this),o.clearsContentEditableCorrectly()||c.quirks.ensureProperClearing(this),o.clearsListsInContentEditableCorrectly()||c.quirks.ensureProperClearingOfLists(this),this.initSync&&this.config.sync&&this.initSync(),this.textarea.hide(),this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var r=this,e=o.canDisableAutoLinking(),t=o.doesAutoLinkingInContentEditable();if(e&&this.commands.exec("autoUrlDetect",!1),this.config.autoLink){(!t||t&&e)&&this.parent.observe("newword:composer",function(){r.selection.executeAndRestore(function(e,t){l.autoLink(t.parentNode)})});var i=this.sandbox.getDocument().getElementsByTagName("a"),s=l.autoLink.URL_REG_EXP,a=function(e){var t=c.lang.string(l.getTextContent(e)).trim();return"www."===t.substr(0,4)&&(t="http://"+t),t};l.observe(this.element,"keydown",function(e){if(i.length){var t,n=r.selection.getSelectedNode(e.target.ownerDocument),o=l.getParentElement(n,{nodeName:"A"},4);o&&(t=a(o),setTimeout(function(){var e=a(o);e!==t&&e.match(s)&&o.setAttribute("href",e)},0))}})}},_initObjectResizing:function(){var i=["width","height"],s=i.length,a=this.element;this.commands.exec("enableObjectResizing",this.config.allowObjectResizing),this.config.allowObjectResizing?o.supportsEvent("resizeend")&&l.observe(a,"resizeend",function(e){for(var t,n=e.target||e.srcElement,o=n.style,r=0;r<s;r++)o[t=i[r]]&&(n.setAttribute(t,parseInt(o[t],10)),o[t]="");c.quirks.redraw(a)}):o.supportsEvent("resizestart")&&l.observe(a,"resizestart",function(e){e.preventDefault()})},_initUndoManager:function(){new c.UndoManager(this.parent)}})}(wysihtml5),function(a){var c=a.dom,l=document,d=window,u=l.createElement("div"),f=["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"],h=["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","-webkit-border-top-right-radius","-moz-border-radius-topright","border-top-right-radius","-webkit-border-bottom-right-radius","-moz-border-radius-bottomright","border-bottom-right-radius","-webkit-border-bottom-left-radius","-moz-border-radius-bottomleft","border-bottom-left-radius","-webkit-border-top-left-radius","-moz-border-radius-topleft","border-top-left-radius","width","height"],m=["width","height","top","left","right","bottom"],g=["html             { height: 100%; }","body             { min-height: 100%; padding: 0; margin: 0; margin-top: -1px; padding-top: 1px; }","._wysihtml5-temp { display: none; }",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; }"];a.views.Composer.prototype.style=function(){var n=this,e=l.querySelector(":focus"),o=this.textarea.element,t=o.hasAttribute("placeholder"),r=t&&o.getAttribute("placeholder");this.focusStylesHost=this.focusStylesHost||u.cloneNode(!1),this.blurStylesHost=this.blurStylesHost||u.cloneNode(!1),t&&o.removeAttribute("placeholder"),o===e&&o.blur(),c.copyStyles(h).from(o).to(this.iframe).andTo(this.blurStylesHost),c.copyStyles(f).from(o).to(this.element).andTo(this.blurStylesHost),c.insertCSS(g).into(this.element.ownerDocument),function(e){if(e.setActive)try{e.setActive()}catch(e){}else{var t=e.style,n=l.documentElement.scrollTop||l.body.scrollTop,o=l.documentElement.scrollLeft||l.body.scrollLeft,r={position:t.position,top:t.top,left:t.left,WebkitUserSelect:t.WebkitUserSelect};c.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(e),e.focus(),c.setStyles(r).on(e),d.scrollTo&&d.scrollTo(o,n)}}(o),c.copyStyles(h).from(o).to(this.focusStylesHost),c.copyStyles(f).from(o).to(this.focusStylesHost);var i=a.lang.array(h).without(["display"]);if(e?e.focus():o.blur(),t&&o.setAttribute("placeholder",r),!a.browser.hasCurrentStyleProperty())var s=c.observe(d,"resize",function(){if(c.contains(document.documentElement,n.iframe)){var e=c.getStyle("display").from(o),t=c.getStyle("display").from(n.iframe);o.style.display="",n.iframe.style.display="none",c.copyStyles(m).from(o).to(n.iframe).andTo(n.focusStylesHost).andTo(n.blurStylesHost),n.iframe.style.display=t,o.style.display=e}else s.stop()});return this.parent.observe("focus:composer",function(){c.copyStyles(i).from(n.focusStylesHost).to(n.iframe),c.copyStyles(f).from(n.focusStylesHost).to(n.element)}),this.parent.observe("blur:composer",function(){c.copyStyles(i).from(n.blurStylesHost).to(n.iframe),c.copyStyles(f).from(n.blurStylesHost).to(n.element)}),this}}(wysihtml5),function(c){var l=c.dom,d=c.browser,u={66:"bold",73:"italic",85:"underline"};c.views.Composer.prototype.observe=function(){var r=this,e=this.getValue(),t=this.sandbox.getIframe(),i=this.element,n=d.supportsEventsInIframeCorrectly()?i:this.sandbox.getWindow(),o=d.supportsEvent("drop")?["drop","paste"]:["dragdrop","paste"];l.observe(t,"DOMNodeRemoved",function(){clearInterval(s),r.parent.fire("destroy:composer")});var s=setInterval(function(){l.contains(document.documentElement,t)||(clearInterval(s),r.parent.fire("destroy:composer"))},250);l.observe(n,"focus",function(){r.parent.fire("focus").fire("focus:composer"),setTimeout(function(){e=r.getValue()},0)}),l.observe(n,"blur",function(){e!==r.getValue()&&r.parent.fire("change").fire("change:composer"),r.parent.fire("blur").fire("blur:composer")}),c.browser.isIos()&&l.observe(i,"blur",function(){var t=i.ownerDocument.createElement("input"),e=document.documentElement.scrollTop||document.body.scrollTop,n=document.documentElement.scrollLeft||document.body.scrollLeft;try{r.selection.insertNode(t)}catch(e){i.appendChild(t)}t.focus(),t.parentNode.removeChild(t),window.scrollTo(n,e)}),l.observe(i,"dragenter",function(){r.parent.fire("unset_placeholder")}),d.firesOnDropOnlyWhenOnDragOverIsCancelled()&&l.observe(i,["dragover","dragenter"],function(e){e.preventDefault()}),l.observe(i,o,function(e){var t,n=e.dataTransfer;n&&d.supportsDataTransfer()&&(t=n.getData("text/html")||n.getData("text/plain")),t?(i.focus(),r.commands.exec("insertHTML",t),r.parent.fire("paste").fire("paste:composer"),e.stopPropagation(),e.preventDefault()):setTimeout(function(){r.parent.fire("paste").fire("paste:composer")},0)}),l.observe(i,"keyup",function(e){var t=e.keyCode;t!==c.SPACE_KEY&&t!==c.ENTER_KEY||r.parent.fire("newword:composer")}),this.parent.observe("paste:composer",function(){setTimeout(function(){r.parent.fire("newword:composer")},0)}),d.canSelectImagesInContentEditable()||l.observe(i,"mousedown",function(e){var t=e.target;"IMG"===t.nodeName&&(r.selection.selectNode(t),e.preventDefault())}),l.observe(i,"keydown",function(e){var t=e.keyCode,n=u[t];(e.ctrlKey||e.metaKey)&&!e.altKey&&n&&(r.commands.exec(n),e.preventDefault())}),l.observe(i,"keydown",function(e){var t,n=r.selection.getSelectedNode(!0),o=e.keyCode;!n||"IMG"!==n.nodeName||o!==c.BACKSPACE_KEY&&o!==c.DELETE_KEY||((t=n.parentNode).removeChild(n),"A"!==t.nodeName||t.firstChild||t.parentNode.removeChild(t),setTimeout(function(){c.quirks.redraw(i)},0),e.preventDefault())});var a={IMG:"Image: ",A:"Link: "};l.observe(i,"mouseover",function(e){var t,n=e.target,o=n.nodeName;"A"!==o&&"IMG"!==o||(n.hasAttribute("title")||(t=a[o]+(n.getAttribute("href")||n.getAttribute("src")),n.setAttribute("title",t)))})}}(wysihtml5),function(i){i.views.Synchronizer=Base.extend({constructor:function(e,t,n){this.editor=e,this.textarea=t,this.composer=n,this._observe()},fromComposerToTextarea:function(e){this.textarea.setValue(i.lang.string(this.composer.getValue()).trim(),e)},fromTextareaToComposer:function(e){var t=this.textarea.getValue();t?this.composer.setValue(t,e):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(e){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(e):this.fromComposerToTextarea(e)},_observe:function(){var t,n=this,e=this.textarea.element.form,o=function(){t=setInterval(function(){n.fromComposerToTextarea()},400)},r=function(){clearInterval(t),t=null};o(),e&&(i.dom.observe(e,"submit",function(){n.sync(!0)}),i.dom.observe(e,"reset",function(){setTimeout(function(){n.fromTextareaToComposer()},0)})),this.editor.observe("change_view",function(e){"composer"!==e||t?"textarea"===e&&(n.fromComposerToTextarea(!0),r()):(n.fromTextareaToComposer(!0),o())}),this.editor.observe("destroy:composer",r)}})}(wysihtml5),wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(e,t,n){this.base(e,t,n),this._observe()},clear:function(){this.element.value=""},getValue:function(e){var t=this.isEmpty()?"":this.element.value;return e&&(t=this.parent.parse(t)),t},setValue:function(e,t){t&&(e=this.parent.parse(e)),this.element.value=e},hasPlaceholderSet:function(){var e=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),t=this.element.getAttribute("placeholder")||null,n=this.element.value;return e&&!n||n===t},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var e=this.element,n=this.parent,o={focusin:"focus",focusout:"blur"},t=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];n.observe("beforeload",function(){wysihtml5.dom.observe(e,t,function(e){var t=o[e.type]||e.type;n.fire(t).fire(t+":textarea")}),wysihtml5.dom.observe(e,["paste","drop"],function(){setTimeout(function(){n.fire("paste").fire("paste:textarea")},0)})})}}),function(s){var a=s.dom,c="wysihtml5-command-dialog-opened",l="input, select, textarea",d="[data-wysihtml5-dialog-field]",u="data-wysihtml5-dialog-field";s.toolbar.Dialog=s.lang.Dispatcher.extend({constructor:function(e,t){this.link=e,this.container=t},_observe:function(){if(!this._observed){var n=this,o=function(e){var t=n._serialize();t==n.elementToChange?n.fire("edit",t):n.fire("save",t),n.hide(),e.preventDefault(),e.stopPropagation()};a.observe(n.link,"click",function(e){a.hasClass(n.link,c)&&setTimeout(function(){n.hide()},0)}),a.observe(this.container,"keydown",function(e){var t=e.keyCode;t===s.ENTER_KEY&&o(e),t===s.ESCAPE_KEY&&n.hide()}),a.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",o),a.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(e){n.fire("cancel"),n.hide(),e.preventDefault(),e.stopPropagation()});for(var e=this.container.querySelectorAll(l),t=0,r=e.length,i=function(){clearInterval(n.interval)};t<r;t++)a.observe(e[t],"change",i);this._observed=!0}},_serialize:function(){for(var e=this.elementToChange||{},t=this.container.querySelectorAll(d),n=t.length,o=0;o<n;o++)e[t[o].getAttribute(u)]=t[o].value;return e},_interpolate:function(e){for(var t,n,o,r=document.querySelector(":focus"),i=this.container.querySelectorAll(d),s=i.length,a=0;a<s;a++)(t=i[a])!==r&&(e&&"hidden"===t.type||(n=t.getAttribute(u),o=this.elementToChange?this.elementToChange[n]||"":t.defaultValue,t.value=o))},show:function(e){var t=this,n=this.container.querySelector(l);if(this.elementToChange=e,this._observe(),this._interpolate(),e&&(this.interval=setInterval(function(){t._interpolate(!0)},500)),a.addClass(this.link,c),this.container.style.display="",this.fire("show"),n&&!e)try{n.focus()}catch(e){}},hide:function(){clearInterval(this.interval),this.elementToChange=null,a.removeClass(this.link,c),this.container.style.display="none",this.fire("hide")}})}(wysihtml5),function(i){var s=i.dom,a={position:"relative"},c={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},l={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-4px",top:"50%"},d={"x-webkit-speech":"",speech:""};i.toolbar.Speech=function(e,t){var n=document.createElement("input");if(i.browser.supportsSpeechApiOn(n)){var o=document.createElement("div");i.lang.object(c).merge({width:t.offsetWidth+"px",height:t.offsetHeight+"px"}),s.insert(n).into(o),s.insert(o).into(t),s.setStyles(l).on(n),s.setAttributes(d).on(n),s.setStyles(c).on(o),s.setStyles(a).on(t);var r="onwebkitspeechchange"in n?"webkitspeechchange":"speechchange";s.observe(n,r,function(){e.execCommand("insertText",n.value),n.value=""}),s.observe(n,"click",function(e){s.hasClass(t,"wysihtml5-command-disabled")&&e.preventDefault(),e.stopPropagation()})}else t.style.display="none"}}(wysihtml5),function(d){var s="wysihtml5-command-disabled",a="wysihtml5-commands-disabled",c="wysihtml5-command-active",l="wysihtml5-action-active",u=d.dom;d.toolbar.Toolbar=Base.extend({constructor:function(e,t){this.editor=e,this.container="string"==typeof t?document.getElementById(t):t,this.composer=e.composer,this._getLinks("command"),this._getLinks("action"),this._observe(),this.show();for(var n=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),o=n.length,r=0;r<o;r++)new d.toolbar.Speech(this,n[r])},_getLinks:function(e){for(var t,n,o,r,i,s=this[e+"Links"]=d.lang.array(this.container.querySelectorAll("[data-wysihtml5-"+e+"]")).get(),a=s.length,c=0,l=this[e+"Mapping"]={};c<a;c++)o=(t=s[c]).getAttribute("data-wysihtml5-"+e),r=t.getAttribute("data-wysihtml5-"+e+"-value"),n=this.container.querySelector("[data-wysihtml5-"+e+"-group='"+o+"']"),i=this._getDialog(t,o),l[o+":"+r]={link:t,group:n,name:o,value:r,dialog:i,state:!1}},_getDialog:function(t,n){var e,o,r=this,i=this.container.querySelector("[data-wysihtml5-dialog='"+n+"']");return i&&((e=new d.toolbar.Dialog(t,i)).observe("show",function(){o=r.composer.selection.getBookmark(),r.editor.fire("show:dialog",{command:n,dialogContainer:i,commandLink:t})}),e.observe("save",function(e){o&&r.composer.selection.setBookmark(o),r._execCommand(n,e),r.editor.fire("save:dialog",{command:n,dialogContainer:i,commandLink:t})}),e.observe("cancel",function(){r.editor.focus(!1),r.editor.fire("cancel:dialog",{command:n,dialogContainer:i,commandLink:t})})),e},execCommand:function(e,t){if(!this.commandsDisabled){var n=this.commandMapping[e+":"+t];n&&n.dialog&&!n.state?n.dialog.show():this._execCommand(e,t)}},_execCommand:function(e,t){this.editor.focus(!1),this.composer.commands.exec(e,t),this._updateLinkStates()},execAction:function(e){var t=this.editor;switch(e){case"change_view":t.currentView===t.textarea?t.fire("change_view","composer"):t.fire("change_view","textarea")}},_observe:function(){for(var o=this,e=this.editor,t=this.container,n=this.commandLinks.concat(this.actionLinks),r=n.length,i=0;i<r;i++)u.setAttributes({href:"javascript:;",unselectable:"on"}).on(n[i]);u.delegate(t,"[data-wysihtml5-command]","mousedown",function(e){e.preventDefault()}),u.delegate(t,"[data-wysihtml5-command]","click",function(e){var t=this.getAttribute("data-wysihtml5-command"),n=this.getAttribute("data-wysihtml5-command-value");o.execCommand(t,n),e.preventDefault()}),u.delegate(t,"[data-wysihtml5-action]","click",function(e){var t=this.getAttribute("data-wysihtml5-action");o.execAction(t),e.preventDefault()}),e.observe("focus:composer",function(){o.bookmark=null,clearInterval(o.interval),o.interval=setInterval(function(){o._updateLinkStates()},500)}),e.observe("blur:composer",function(){clearInterval(o.interval)}),e.observe("destroy:composer",function(){clearInterval(o.interval)}),e.observe("change_view",function(e){setTimeout(function(){o.commandsDisabled="composer"!==e,o._updateLinkStates(),o.commandsDisabled?u.addClass(t,a):u.removeClass(t,a)},0)})},_updateLinkStates:function(){this.composer.element;var e,t,n,o,r=this.commandMapping,i=this.actionMapping;for(e in r)o=r[e],this.commandsDisabled?(t=!1,u.removeClass(o.link,c),o.group&&u.removeClass(o.group,c),o.dialog&&o.dialog.hide()):(t=this.composer.commands.state(o.name,o.value),d.lang.object(t).isArray()&&(t=1!==t.length||t[0]),u.removeClass(o.link,s),o.group&&u.removeClass(o.group,s)),o.state!==t&&((o.state=t)?(u.addClass(o.link,c),o.group&&u.addClass(o.group,c),o.dialog&&("object"==typeof t?o.dialog.show(t):o.dialog.hide())):(u.removeClass(o.link,c),o.group&&u.removeClass(o.group,c),o.dialog&&o.dialog.hide()));for(e in i)"change_view"===(n=i[e]).name&&(n.state=this.editor.currentView===this.editor.textarea,n.state?u.addClass(n.link,l):u.removeClass(n.link,l))},show:function(){this.container.style.display=""},hide:function(){this.container.style.display="none"}})}(wysihtml5),function(o){var e,r={name:e,style:!0,toolbar:e,autoLink:!0,parserRules:{tags:{br:{},span:{},div:{},p:{}},classes:{}},parser:o.dom.parse,composerClassName:"wysihtml5-editor",bodyClassName:"wysihtml5-supported",stylesheets:[],placeholderText:e,allowObjectResizing:!0,supportTouchDevices:!0};o.Editor=o.lang.Dispatcher.extend({constructor:function(e,t){if(this.textareaElement="string"==typeof e?document.getElementById(e):e,this.config=o.lang.object({}).merge(r).merge(t).get(),this.textarea=new o.views.Textarea(this,this.textareaElement,this.config),this.currentView=this.textarea,this._isCompatible=o.browser.supported(),!this._isCompatible||!this.config.supportTouchDevices&&o.browser.isTouchDevice()){var n=this;setTimeout(function(){n.fire("beforeload").fire("load")},0)}else{o.dom.addClass(document.body,this.config.bodyClassName),this.composer=new o.views.Composer(this,this.textareaElement,this.config),this.currentView=this.composer,"function"==typeof this.config.parser&&this._initParser(),this.observe("beforeload",function(){this.synchronizer=new o.views.Synchronizer(this,this.textarea,this.composer),this.config.toolbar&&(this.toolbar=new o.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){}}},isCompatible:function(){return this._isCompatible},clear:function(){return this.currentView.clear(),this},getValue:function(e){return this.currentView.getValue(e)},setValue:function(e,t){return e?(this.currentView.setValue(e,t),this):this.clear()},focus:function(e){return this.currentView.focus(e),this},disable:function(){return this.currentView.disable(),this},enable:function(){return this.currentView.enable(),this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},parse:function(e){var t=this.config.parser(e,this.config.parserRules,this.composer.sandbox.getDocument(),!0);return"object"==typeof e&&o.quirks.redraw(e),t},_initParser:function(){this.observe("paste:composer",function(){var e=this;e.composer.selection.executeAndRestore(function(){o.quirks.cleanPastedHTML(e.composer.element),e.parse(e.composer.element)},!0)}),this.observe("paste:textarea",function(){var e,t=this.textarea.getValue();e=this.parse(t),this.textarea.setValue(e)})}})}(wysihtml5);

Zerion Mini Shell 1.0