(function(f){f.ice={}})(this||window);
(function(f){function g(a,b){var d=typeof a[b];return"function"==d||!("object"!=d||!a[b])||"unknown"==d}function A(a,b){return!("object"!=typeof a[b]||!a[b])}function B(a,b){return"undefined"!=typeof a[b]}function t(a){return function(b,d){for(var c=d.length;c--;)if(!a(b,d[c]))return!1;return!0}}function c(a){return a&&q(a,m)&&D(a,k)}function r(a){return A(a,"body")?a.body:a.getElementsByTagName("body")[0]}function y(a){A(window,"console")&&g(window.console,"log")&&window.console.log(a)}function u(a){n.initialized=
!0;n.supported=!1;a="Rangy is not supported on this page in your browser. Reason: "+a;n.config.alertOnFail?window.alert(a):y(a)}function E(){if(!n.initialized){var k,m=!1,e=!1;g(document,"createRange")&&(k=document.createRange(),q(k,d)&&D(k,a)&&(m=!0));if((k=r(document))&&"body"==k.nodeName.toLowerCase())if(k&&g(k,"createTextRange")&&(k=k.createTextRange(),c(k)&&(e=!0)),m||e){n.initialized=!0;n.features={implementsDomRange:m,implementsTextRange:e};var l,f;for(f in x)(l=x[f])instanceof b&&l.init(l,
n);e=0;for(l=F.length;e<l;++e)try{F[e](n)}catch(h){m="Rangy init listener threw an exception. Continuing. Detail: "+(h.message||h.description||String(h)),y(m)}}else u("Neither Range nor TextRange are available");else u("No body element found")}}function b(a,b,d){this.name=a;this.dependencies=b;this.supported=this.initialized=!1;this.initializer=d}function e(a,d,c,k){a=new b(d,c,function(a){if(!a.initialized){a.initialized=!0;try{k(n,a),a.supported=!0}catch(b){y("Module '"+d+"' failed to load: "+(b.message||
b.description||String(b)))}}});x[d]=a}function h(){}var p="function"==typeof f.define&&f.define.amd,a="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),d="setStart setStartBefore setStartAfter setEnd setEndBefore setEndAfter collapse selectNode selectNodeContents compareBoundaryPoints deleteContents extractContents cloneContents insertNode surroundContents cloneRange toString detach".split(" "),k="boundingHeight boundingLeft boundingTop boundingWidth htmlText text".split(" "),
m="collapse compareEndPoints duplicate moveToElementText parentElement select setEndPoint getBoundingClientRect".split(" "),q=t(g),l=t(A),D=t(B),x={},n={version:"1.3alpha.20140716",initialized:!1,supported:!0,util:{isHostMethod:g,isHostObject:A,isHostProperty:B,areHostMethods:q,areHostObjects:l,areHostProperties:D,isTextRange:c,getBody:r},features:{},modules:x,config:{alertOnFail:!0,alertOnWarn:!1,preferTextRange:!1}};n.fail=u;n.warn=function(a){a="Rangy warning: "+a;n.config.alertOnWarn?window.alert(a):
y(a)};({}).hasOwnProperty?n.util.extend=function(a,b,d){var c,k,m;for(m in b)b.hasOwnProperty(m)&&(c=a[m],k=b[m],d&&null!==c&&"object"==typeof c&&null!==k&&"object"==typeof k&&n.util.extend(c,k,!0),a[m]=k);b.hasOwnProperty("toString")&&(a.toString=b.toString);return a}:u("hasOwnProperty not supported");(function(){var a=document.createElement("div");a.appendChild(document.createElement("span"));var b=[].slice,d;try{1==b.call(a.childNodes,0)[0].nodeType&&(d=function(a){return b.call(a,0)})}catch(c){}d||
(d=function(a){for(var b=[],d=0,c=a.length;d<c;++d)b[d]=a[d];return b});n.util.toArray=d})();var H;g(document,"addEventListener")?H=function(a,b,d){a.addEventListener(b,d,!1)}:g(document,"attachEvent")?H=function(a,b,d){a.attachEvent("on"+b,d)}:u("Document does not have required addEventListener or attachEvent method");n.util.addListener=H;var F=[];n.init=E;n.addInitListener=function(a){n.initialized?a(n):F.push(a)};var N=[];n.addCreateMissingNativeApiListener=function(a){N.push(a)};n.createMissingNativeApi=
function(a){a=a||window;E();for(var b=0,d=N.length;b<d;++b)N[b](a)};b.prototype={init:function(a){a=this.dependencies||[];for(var d=0,c=a.length,k,m;d<c;++d){m=a[d];k=x[m];if(!(k&&k instanceof b))throw Error("required module '"+m+"' not found");k.init();if(!k.supported)throw Error("required module '"+m+"' not supported");}this.initializer(this)},fail:function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);},warn:function(a){n.warn("Module "+this.name+
": "+a)},deprecationNotice:function(a,b){n.warn("DEPRECATED: "+a+" in module "+this.name+"is deprecated. Please use "+b+" instead")},createError:function(a){return Error("Error in Rangy "+this.name+" module: "+a)}};n.createModule=function(a){var b,d;2==arguments.length?(b=arguments[1],d=[]):(b=arguments[2],d=arguments[1]);e(!1,a,d,b)};n.createCoreModule=function(a,b,d){e(!0,a,b,d)};n.RangePrototype=h;n.rangePrototype=new h;n.selectionPrototype=new function(){};var T=!1,l=function(a){T||(T=!0,n.initialized||
E())};"undefined"==typeof window?u("No window found"):"undefined"==typeof document?u("No document found"):(g(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",l,!1),H(window,"load",l),p&&function(a){a(function(){n.amd=!0;return n})}(f.define),f.rangy=n,f.rangy.createCoreModule("DomUtil",[],function(a,b){function d(a){for(var b=0;a=a.previousSibling;)++b;return b}function c(a,b){var d=[],k;for(k=a;k;k=k.parentNode)d.push(k);for(k=b;k;k=k.parentNode)if(y(d,k))return k;return null}
function k(a,b,d){for(b=d?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1}function m(a,b,d){for(d=d?a:a.parentNode;d;){a=d.parentNode;if(a===b)return d;d=a}return null}function e(a){a=a.nodeType;return 3==a||4==a||8==a}function l(a,b){var d=b.nextSibling,c=b.parentNode;d?c.insertBefore(a,d):c.appendChild(a);return a}function q(a){if(9==a.nodeType)return a;if("undefined"!=typeof a.ownerDocument)return a.ownerDocument;if("undefined"!=typeof a.document)return a.document;if(a.parentNode)return q(a.parentNode);
throw b.createError("getDocument: no document found for node");}function f(a){a=q(a);if("undefined"!=typeof a.defaultView)return a.defaultView;if("undefined"!=typeof a.parentWindow)return a.parentWindow;throw b.createError("Cannot get a window object for node");}function h(a){if("undefined"!=typeof a.contentDocument)return a.contentDocument;if("undefined"!=typeof a.contentWindow)return a.contentWindow.document;throw b.createError("getIframeDocument: No Document object found for iframe element");}
function n(a){return a&&r.isHostMethod(a,"setTimeout")&&r.isHostObject(a,"document")}function g(a){return a?e(a)?'"'+a.data+'"':1==a.nodeType?"\x3c"+a.nodeName+(a.id?' id\x3d"'+a.id+'"':"")+"\x3e[index:"+d(a)+",length:"+a.childNodes.length+"]["+(a.innerHTML||"[innerHTML not supported]").slice(0,25)+"]":a.nodeName:"[No node]"}function x(a){this._next=this.root=a}function p(a,b){this.node=a;this.offset=b}function D(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName}var r=
a.util;r.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method");r.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var H=document.createElement("div");r.areHostMethods(H,["insertBefore","appendChild","cloneNode"])||b.fail("Incomplete Element implementation");r.isHostProperty(H,"innerHTML")||b.fail("Element is missing innerHTML property");H=document.createTextNode("test");
r.areHostMethods(H,["splitText","deleteData","insertData","appendData","cloneNode"])||b.fail("Incomplete Text Node implementation");var y=function(a,b){for(var d=a.length;d--;)if(a[d]===b)return!0;return!1},u=!1;(function(){var b=document.createElement("b");b.innerHTML="1";b.innerHTML="\x3cbr\x3e";u=!1;a.features.crashyTextNodes=u})();var t;"undefined"!=typeof window.getComputedStyle?t=function(a,b){return f(a).getComputedStyle(a,null)[b]}:"undefined"!=typeof document.documentElement.currentStyle?
t=function(a,b){return a.currentStyle[b]}:b.fail("No means of obtaining computed style properties found");x.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}};p.prototype={equals:function(a){return!!a&&this.node===a.node&&this.offset==a.offset},
inspect:function(){return"[DomPosition("+g(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}};D.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,INVALID_NODE_TYPE_ERR:24};D.prototype.toString=function(){return this.message};a.dom={arrayContains:y,isHtmlNamespace:function(a){var b;return"undefined"==typeof a.namespaceURI||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==
b},parentElement:function(a){a=a.parentNode;return 1==a.nodeType?a:null},getNodeIndex:d,getNodeLength:function(a){switch(a.nodeType){case 7:case 10:return 0;case 3:case 8:return a.length;default:return a.childNodes.length}},getCommonAncestor:c,isAncestorOf:k,isOrIsAncestorOf:function(a,b){return k(a,b,!0)},getClosestAncestorIn:m,isCharacterDataNode:e,isTextOrCommentNode:function(a){if(!a)return!1;a=a.nodeType;return 3==a||8==a},insertAfter:l,splitDataNode:function(a,b,c){var k=a.cloneNode(!1);k.deleteData(0,
b);a.deleteData(b,a.length-b);l(k,a);if(c)for(var m=0,e;e=c[m++];)e.node==a&&e.offset>b?(e.node=k,e.offset-=b):e.node==a.parentNode&&e.offset>d(a)&&++e.offset;return k},getDocument:q,getWindow:f,getIframeWindow:function(a){if("undefined"!=typeof a.contentWindow)return a.contentWindow;if("undefined"!=typeof a.contentDocument)return a.contentDocument.defaultView;throw b.createError("getIframeWindow: No Window object found for iframe element");},getIframeDocument:h,getBody:r.getBody,isWindow:n,getContentDocument:function(a,
b,d){var c;a?r.isHostProperty(a,"nodeType")?c=1==a.nodeType&&"iframe"==a.tagName.toLowerCase()?h(a):q(a):n(a)&&(c=a.document):c=document;if(!c)throw b.createError(d+"(): Parameter must be a Window object or DOM node");return c},getRootContainer:function(a){for(var b;b=a.parentNode;)a=b;return a},comparePoints:function(a,k,e,l){var q;if(a==e)return k===l?0:k<l?-1:1;if(q=m(e,a,!0))return k<=d(q)?-1:1;if(q=m(a,e,!0))return d(q)<l?-1:1;k=c(a,e);if(!k)throw Error("comparePoints error: nodes have no common ancestor");
a=a===k?k:m(a,k,!0);e=e===k?k:m(e,k,!0);if(a===e)throw b.createError("comparePoints got to case 4 and childA and childB are the same!");for(k=k.firstChild;k;){if(k===a)return-1;if(k===e)return 1;k=k.nextSibling}},isBrokenNode:function(a){return!1},inspectNode:g,getComputedStyleProperty:t,fragmentFromNodeChildren:function(a){for(var b=q(a).createDocumentFragment(),d;d=a.firstChild;)b.appendChild(d);return b},createIterator:function(a){return new x(a)},DomPosition:p};a.DOMException=D}),f.rangy.createCoreModule("DomRange",
["DomUtil"],function(a,b){function d(a,b){return 3!=a.nodeType&&(P(a,b.startContainer)||P(a,b.endContainer))}function c(a){return a.document||X(a.startContainer)}function k(a){return new U(a.parentNode,K(a))}function m(a){return new U(a.parentNode,K(a)+1)}function e(a,b,d){var c=11==a.nodeType?a.firstChild:a;w(b)?d==b.length?z.insertAfter(a,b):b.parentNode.insertBefore(a,0==d?b:aa(b,d)):d>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[d]);return c}function l(a,b,d){C(a);C(b);
if(c(b)!=c(a))throw new I("WRONG_DOCUMENT_ERR");var k=G(a.startContainer,a.startOffset,b.endContainer,b.endOffset);a=G(a.endContainer,a.endOffset,b.startContainer,b.startOffset);return d?0>=k&&0<=a:0>k&&0<a}function q(a){for(var b,d,k=c(a.range).createDocumentFragment();d=a.next();){b=a.isPartiallySelectedSubtree();d=d.cloneNode(!b);b&&(b=a.getSubtreeIterator(),d.appendChild(q(b)),b.detach());if(10==d.nodeType)throw new I("HIERARCHY_REQUEST_ERR");k.appendChild(d)}return k}function f(a,b,d){var c,
k;for(d=d||{stop:!1};c=a.next();)if(a.isPartiallySelectedSubtree())if(!1===b(c)){d.stop=!0;break}else{if(c=a.getSubtreeIterator(),f(c,b,d),c.detach(),d.stop)break}else for(c=z.createIterator(c);k=c.next();)if(!1===b(k)){d.stop=!0;return}}function h(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),h(b),b.detach()):a.remove()}function n(a){for(var b,d=c(a.range).createDocumentFragment(),k;b=a.next();){a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),k=a.getSubtreeIterator(),
b.appendChild(n(k)),k.detach()):a.remove();if(10==b.nodeType)throw new I("HIERARCHY_REQUEST_ERR");d.appendChild(b)}return d}function g(a,b,d){var c=!(!b||!b.length),k,v=!!d;c&&(k=new RegExp("^("+b.join("|")+")$"));var m=[];f(new p(a,!1),function(b){if(!c||k.test(b.nodeType))if(!v||d(b)){var e=a.startContainer;b==e&&w(e)&&a.startOffset==e.length||(e=a.endContainer,b==e&&w(e)&&0==a.endOffset||m.push(b))}});return m}function x(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+z.inspectNode(a.startContainer)+
":"+a.startOffset+", "+z.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function p(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var d=a.commonAncestorContainer;this.sc===this.ec&&w(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==d||w(this.sc)?V(this.sc,d,!0):this.sc.childNodes[this.so],this._last=this.ec!==
d||w(this.ec)?V(this.ec,d,!0):this.ec.childNodes[this.eo-1])}}function D(a){return function(b,d){for(var c,k=d?b:b.parentNode;k;){c=k.nodeType;if(W(a,c))return k;k=k.parentNode}return null}}function r(a,b){if(na(a,b))throw new I("INVALID_NODE_TYPE_ERR");}function H(a,b){if(!W(b,a.nodeType))throw new I("INVALID_NODE_TYPE_ERR");}function y(a,b){if(0>b||b>(w(a)?a.length:a.childNodes.length))throw new I("INDEX_SIZE_ERR");}function u(a,b){if(fa(a,!0)!==fa(b,!0))throw new I("WRONG_DOCUMENT_ERR");}function t(a){if(oa(a,
!0))throw new I("NO_MODIFICATION_ALLOWED_ERR");}function F(a,b){if(!a)throw new I(b);}function B(a){return ba&&z.isBrokenNode(a)||!W(ca,a.nodeType)&&!fa(a,!0)}function ja(a,b){return b<=(w(a)?a.length:a.childNodes.length)}function ka(a){return!!a.startContainer&&!!a.endContainer&&!B(a.startContainer)&&!B(a.endContainer)&&ja(a.startContainer,a.startOffset)&&ja(a.endContainer,a.endOffset)}function C(a){if(!ka(a))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");
}function A(a,b){C(a);var d=a.startContainer,c=a.startOffset,k=a.endContainer,v=a.endOffset,m=d===k;w(k)&&0<v&&v<k.length&&aa(k,v,b);w(d)&&0<c&&c<d.length&&(d=aa(d,c,b),m?(v-=c,k=d):k==d.parentNode&&v>=K(d)&&v++,c=0);a.setStartAndEnd(d,c,k,v)}function E(a){a.START_TO_START=0;a.START_TO_END=1;a.END_TO_END=2;a.END_TO_START=3;a.NODE_BEFORE=0;a.NODE_AFTER=1;a.NODE_BEFORE_AND_AFTER=2;a.NODE_INSIDE=3}function N(a){E(a);E(a.prototype)}function T(a,b){return function(){C(this);var d=this.startContainer,c=
this.startOffset,k=this.commonAncestorContainer,v=new p(this,!0);d!==k&&(d=V(d,k,!0),c=m(d),d=c.node,c=c.offset);f(v,t);v.reset();k=a(v);v.detach();b(this,d,c,d,c);return k}}function J(b,c){function v(a,b){return function(d){H(d,Y);H(O(d),ca);d=(a?k:m)(d);(b?e:l)(this,d.node,d.offset)}}function e(a,b,d){var k=a.endContainer,v=a.endOffset;if(b!==a.startContainer||d!==a.startOffset){if(O(b)!=O(k)||1==G(b,d,k,v))k=b,v=d;c(a,b,d,k,v)}}function l(a,b,d){var k=a.startContainer,v=a.startOffset;if(b!==a.endContainer||
d!==a.endOffset){if(O(b)!=O(k)||-1==G(b,d,k,v))k=b,v=d;c(a,k,v,b,d)}}var q=function(){};q.prototype=a.rangePrototype;b.prototype=new q;S.extend(b.prototype,{setStart:function(a,b){r(a,!0);y(a,b);e(this,a,b)},setEnd:function(a,b){r(a,!0);y(a,b);l(this,a,b)},setStartAndEnd:function(){var a=arguments,b=a[0],d=a[1],k=b,v=d;switch(a.length){case 3:v=a[2];break;case 4:k=a[2],v=a[3]}c(this,b,d,k,v)},setBoundary:function(a,b,d){this["set"+(d?"Start":"End")](a,b)},setStartBefore:v(!0,!0),setStartAfter:v(!1,
!0),setEndBefore:v(!0,!1),setEndAfter:v(!1,!1),collapse:function(a){C(this);a?c(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):c(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){r(a,!0);c(this,a,0,a,L(a))},selectNode:function(a){r(a,!1);H(a,Y);var b=k(a);a=m(a);c(this,b.node,b.offset,a.node,a.offset)},extractContents:T(n,c),deleteContents:T(h,c),canSurroundContents:function(){C(this);t(this.startContainer);t(this.endContainer);
var a=new p(this,!0),b=a._first&&d(a._first,this)||a._last&&d(a._last,this);a.detach();return!b},splitBoundaries:function(){A(this)},splitBoundariesPreservingPositions:function(a){A(this,a)},normalizeBoundaries:function(){C(this);var a=this.startContainer,b=this.startOffset,d=this.endContainer,k=this.endOffset,v=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(d=a,k=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},m=function(c){var v=c.previousSibling;if(v&&v.nodeType==c.nodeType){a=
c;var m=c.length;b=v.length;c.insertData(0,v.data);v.parentNode.removeChild(v);a==d?(k+=b,d=a):d==c.parentNode&&(v=K(c),k==v?(d=c,k=m):k>v&&k--)}},e=!0;w(d)?d.length==k&&v(d):(0<k&&(e=d.childNodes[k-1])&&w(e)&&v(e),e=!this.collapsed);e?w(a)?0==b&&m(a):b<a.childNodes.length&&(v=a.childNodes[b])&&w(v)&&m(v):(a=d,b=k);c(this,a,b,d,k)},collapseToPoint:function(a,b){r(a,!0);y(a,b);this.setStartAndEnd(a,b)}});N(b)}function M(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;
a.commonAncestorContainer=a.collapsed?a.startContainer:z.getCommonAncestor(a.startContainer,a.endContainer)}function Q(a,b,d,c,k){a.startContainer=b;a.startOffset=d;a.endContainer=c;a.endOffset=k;a.document=z.getDocument(b);M(a)}function R(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this.document=a;M(this)}var z=a.dom,S=a.util,U=z.DomPosition,I=a.DOMException,w=z.isCharacterDataNode,K=z.getNodeIndex,P=z.isOrIsAncestorOf,X=z.getDocument,G=z.comparePoints,aa=z.splitDataNode,
V=z.getClosestAncestorIn,L=z.getNodeLength,W=z.arrayContains,O=z.getRootContainer,ba=a.features.crashyTextNodes;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 a=this._current=this._next;a&&(this._next=a!==this._last?a.nextSibling:null,w(a)&&this.clonePartiallySelectedTextNodes&&(a===this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-
this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so)));return a},remove:function(){var a=this._current,b,d;!w(a)||a!==this.sc&&a!==this.ec?a.parentNode&&a.parentNode.removeChild(a):(b=a===this.sc?this.so:0,d=a===this.ec?this.eo:a.length,b!=d&&a.deleteData(b,d-b))},isPartiallySelectedSubtree:function(){return d(this._current,this.range)},getSubtreeIterator:function(){var a;if(this.isSingleCharacterDataNode)a=this.range.cloneRange(),a.collapse(!1);else{a=new R(c(this.range));
var b=this._current,d=b,k=0,v=b,m=L(b);P(b,this.sc)&&(d=this.sc,k=this.so);P(b,this.ec)&&(v=this.ec,m=this.eo);Q(a,d,k,v,m)}return new p(a,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var Y=[1,3,4,5,7,8,10],ca=[2,9,11],Z=[1,3,4,5,7,8,10,11],v=[1,3,4,5,7,8],fa=D([9,11]),oa=D([5,6,10,12]),na=D([6,10,12]),la=document.createElement("style"),ga=!1;try{la.innerHTML="\x3cb\x3ex\x3c/b\x3e",ga=3==
la.firstChild.nodeType}catch(pa){}a.features.htmlParsingConforms=ga;var ha="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" ");S.extend(a.rangePrototype,{compareBoundaryPoints:function(a,b){C(this);u(this.startContainer,b.startContainer);var d=3==a||0==a?"start":"end",c=1==a||0==a?"start":"end";return G(this[d+"Container"],this[d+"Offset"],b[c+"Container"],b[c+"Offset"])},insertNode:function(a){C(this);H(a,Z);t(this.startContainer);if(P(a,this.startContainer))throw new I("HIERARCHY_REQUEST_ERR");
a=e(a,this.startContainer,this.startOffset);this.setStartBefore(a)},cloneContents:function(){C(this);var a,b;if(this.collapsed)return c(this).createDocumentFragment();if(this.startContainer===this.endContainer&&w(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=c(this).createDocumentFragment(),b.appendChild(a),b;b=new p(this,!0);a=q(b);b.detach();return a},canSurroundContents:function(){C(this);t(this.startContainer);t(this.endContainer);
var a=new p(this,!0),b=a._first&&d(a._first,this)||a._last&&d(a._last,this);a.detach();return!b},surroundContents:function(a){H(a,v);if(!this.canSurroundContents())throw new I("INVALID_STATE_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);e(a,this.startContainer,this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){C(this);for(var a=new R(c(this)),b=ha.length,d;b--;)d=ha[b],a[d]=this[d];return a},toString:function(){C(this);
var a=this.startContainer;if(a===this.endContainer&&w(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new p(this,!0);f(a,function(a){3!=a.nodeType&&4!=a.nodeType||b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){C(this);var b=a.parentNode,d=K(a);if(!b)throw new I("NOT_FOUND_ERR");a=this.comparePoint(b,d);b=this.comparePoint(b,d+1);return 0>a?0<b?2:0:0<b?1:3},comparePoint:function(a,b){C(this);F(a,"HIERARCHY_REQUEST_ERR");u(a,
this.startContainer);return 0>G(a,b,this.startContainer,this.startOffset)?-1:0<G(a,b,this.endContainer,this.endOffset)?1:0},createContextualFragment:ga?function(a){var b=this.startContainer,d=X(b);if(!b)throw new I("INVALID_STATE_ERR");var c=null;1==b.nodeType?c=b:w(b)&&(c=z.parentElement(b));c=null===c||"HTML"==c.nodeName&&z.isHtmlNamespace(X(c).documentElement)&&z.isHtmlNamespace(c)?d.createElement("body"):c.cloneNode(!1);c.innerHTML=a;return z.fragmentFromNodeChildren(c)}:function(a){var b=c(this).createElement("body");
b.innerHTML=a;return z.fragmentFromNodeChildren(b)},toHtml:function(){C(this);var a=this.commonAncestorContainer.parentNode.cloneNode(!1);a.appendChild(this.cloneContents());return a.innerHTML},intersectsNode:function(a,b){C(this);F(a,"NOT_FOUND_ERR");if(X(a)!==c(this))return!1;var d=a.parentNode,k=K(a);F(d,"NOT_FOUND_ERR");var v=G(d,k,this.endContainer,this.endOffset),d=G(d,k+1,this.startContainer,this.startOffset);return b?0>=v&&0<=d:0>v&&0<d},isPointInRange:function(a,b){C(this);F(a,"HIERARCHY_REQUEST_ERR");
u(a,this.startContainer);return 0<=G(a,b,this.startContainer,this.startOffset)&&0>=G(a,b,this.endContainer,this.endOffset)},intersectsRange:function(a){return l(this,a,!1)},intersectsOrTouchesRange:function(a){return l(this,a,!0)},intersection:function(a){if(this.intersectsRange(a)){var b=G(this.startContainer,this.startOffset,a.startContainer,a.startOffset),d=G(this.endContainer,this.endOffset,a.endContainer,a.endOffset),c=this.cloneRange();-1==b&&c.setStart(a.startContainer,a.startOffset);1==d&&
c.setEnd(a.endContainer,a.endOffset);return c}return null},union:function(a){if(this.intersectsOrTouchesRange(a)){var b=this.cloneRange();-1==G(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset);1==G(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset);return b}throw new I("Ranges do not intersect");},containsNode:function(a,b){return b?this.intersectsNode(a,!1):3==this.compareNode(a)},containsNodeContents:function(a){return 0<=
this.comparePoint(a,0)&&0>=this.comparePoint(a,L(a))},containsRange:function(a){var b=this.intersection(a);return null!==b&&a.equals(b)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var d=b.getNodes([3]);return 0<d.length?(b.setStart(d[0],0),a=d.pop(),b.setEnd(a,a.length),this.containsRange(b)):this.containsNodeContents(a)},getNodes:function(a,b){C(this);return g(this,a,b)},getDocument:function(){return c(this)},collapseBefore:function(a){this.setEndBefore(a);this.collapse(!1)},
collapseAfter:function(a){this.setStartAfter(a);this.collapse(!0)},getBookmark:function(b){var d=c(this),k=a.createRange(d);b=b||z.getBody(d);k.selectNodeContents(b);var d=this.intersection(k),v=0,m=0;d&&(k.setEnd(d.startContainer,d.startOffset),v=k.toString().length,m=v+d.toString().length);return{start:v,end:m,containerNode:b}},moveToBookmark:function(a){var b=a.containerNode,d=0;this.setStart(b,0);this.collapse(!0);for(var b=[b],c,k=!1,v=!1,m,e;!v&&(c=b.pop());)if(3==c.nodeType)m=d+c.length,!k&&
a.start>=d&&a.start<=m&&(this.setStart(c,a.start-d),k=!0),k&&a.end>=d&&a.end<=m&&(this.setEnd(c,a.end-d),v=!0),d=m;else for(e=c.childNodes,m=e.length;m--;)b.push(e[m])},getName:function(){return"DomRange"},equals:function(a){return R.rangesEqual(this,a)},isValid:function(){return ka(this)},inspect:function(){return x(this)},detach:function(){}});J(R,Q);S.extend(R,{rangeProperties:ha,RangeIterator:p,copyComparisonConstants:N,createPrototypeRange:J,inspect:x,getRangeDocument:c,rangesEqual:function(a,
b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset}});a.DomRange=R}),f.rangy.createCoreModule("WrappedRange",["DomRange"],function(a,b){var d,c,k=a.dom,m=a.util,e=k.DomPosition,l=a.DomRange,q=k.getBody,f=k.getContentDocument,h=k.isCharacterDataNode;a.features.implementsDomRange&&function(){function c(a){for(var b=h.length,d;b--;)d=h[b],a[d]=a.nativeRange[d];a.collapsed=a.startContainer===a.endContainer&&a.startOffset===
a.endOffset}var e,h=l.rangeProperties,n;d=function(a){if(!a)throw b.createError("WrappedRange: Range must be specified");this.nativeRange=a;c(this)};l.createPrototypeRange(d,function(a,b,d,c,k){var m=a.startContainer!==b||a.startOffset!=d,e=a.endContainer!==c||a.endOffset!=k,l=!a.equals(a.nativeRange);if(m||e||l)a.setEnd(c,k),a.setStart(b,d)});e=d.prototype;e.selectNode=function(a){this.nativeRange.selectNode(a);c(this)};e.cloneContents=function(){return this.nativeRange.cloneContents()};e.surroundContents=
function(a){this.nativeRange.surroundContents(a);c(this)};e.collapse=function(a){this.nativeRange.collapse(a);c(this)};e.cloneRange=function(){return new d(this.nativeRange.cloneRange())};e.refresh=function(){c(this)};e.toString=function(){return this.nativeRange.toString()};var g=document.createTextNode("test");q(document).appendChild(g);var x=document.createRange();x.setStart(g,0);x.setEnd(g,0);try{x.setStart(g,1),e.setStart=function(a,b){this.nativeRange.setStart(a,b);c(this)},e.setEnd=function(a,
b){this.nativeRange.setEnd(a,b);c(this)},n=function(a){return function(b){this.nativeRange[a](b);c(this)}}}catch(p){e.setStart=function(a,b){try{this.nativeRange.setStart(a,b)}catch(d){this.nativeRange.setEnd(a,b),this.nativeRange.setStart(a,b)}c(this)},e.setEnd=function(a,b){try{this.nativeRange.setEnd(a,b)}catch(d){this.nativeRange.setStart(a,b),this.nativeRange.setEnd(a,b)}c(this)},n=function(a,b){return function(d){try{this.nativeRange[a](d)}catch(k){this.nativeRange[b](d),this.nativeRange[a](d)}c(this)}}}e.setStartBefore=
n("setStartBefore","setEndBefore");e.setStartAfter=n("setStartAfter","setEndAfter");e.setEndBefore=n("setEndBefore","setStartBefore");e.setEndAfter=n("setEndAfter","setStartAfter");e.selectNodeContents=function(a){this.setStartAndEnd(a,0,k.getNodeLength(a))};x.selectNodeContents(g);x.setEnd(g,3);n=document.createRange();n.selectNodeContents(g);n.setEnd(g,4);n.setStart(g,2);-1==x.compareBoundaryPoints(x.START_TO_END,n)&&1==x.compareBoundaryPoints(x.END_TO_START,n)?e.compareBoundaryPoints=function(a,
b){b=b.nativeRange||b;a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END);return this.nativeRange.compareBoundaryPoints(a,b)}:e.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};n=document.createElement("div");n.innerHTML="123";var D=n.firstChild,r=q(document);r.appendChild(n);x.setStart(D,1);x.setEnd(D,2);x.deleteContents();"13"==D.data&&(e.deleteContents=function(){this.nativeRange.deleteContents();c(this)},e.extractContents=
function(){var a=this.nativeRange.extractContents();c(this);return a});r.removeChild(n);r=null;m.isHostMethod(x,"createContextualFragment")&&(e.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)});q(document).removeChild(g);e.getName=function(){return"WrappedRange"};a.WrappedRange=d;a.createNativeRange=function(a){a=f(a,b,"createNativeRange");return a.createRange()}}();if(a.features.implementsTextRange){var n=function(a,b,d,c,m){var l=a.duplicate();l.collapse(d);
var q=l.parentElement();k.isOrIsAncestorOf(b,q)||(q=b);if(!q.canHaveHTML)return q=new e(q.parentNode,k.getNodeIndex(q)),{boundaryPosition:q,nodeInfo:{nodeIndex:q.offset,containerElement:q.node}};b=k.getDocument(q).createElement("span");b.parentNode&&b.parentNode.removeChild(b);var f,n=d?"StartToStart":"StartToEnd",g=m&&m.containerElement==q?m.nodeIndex:0,x=q.childNodes.length,p=x;for(m=p;;){m==x?q.appendChild(b):q.insertBefore(b,q.childNodes[m]);l.moveToElementText(b);f=l.compareEndPoints(n,a);if(0==
f||g==p)break;else if(-1==f)if(p==g+1)break;else g=m;else p=p==g+1?g:m;m=Math.floor((g+p)/2);q.removeChild(b)}n=b.nextSibling;if(-1==f&&n&&h(n)){l.setEndPoint(d?"EndToStart":"EndToEnd",a);if(/[\r\n]/.test(n.data))for(d=l.duplicate(),c=d.text.replace(/\r\n/g,"\r").length,c=d.moveStart("character",c);-1==d.compareEndPoints("StartToEnd",d);)c++,d.moveStart("character",1);else c=l.text.length;d=new e(n,c)}else a=(c||!d)&&b.previousSibling,d=(d=(c||d)&&b.nextSibling)&&h(d)?new e(d,0):a&&h(a)?new e(a,a.data.length):
new e(q,k.getNodeIndex(b));b.parentNode.removeChild(b);return{boundaryPosition:d,nodeInfo:{nodeIndex:m,containerElement:q}}},g=function(a,b){var d,c,m=a.offset,e=k.getDocument(a.node),l=q(e).createTextRange(),f=h(a.node);f?(d=a.node,c=d.parentNode):(d=a.node.childNodes,d=m<d.length?d[m]:null,c=a.node);e=e.createElement("span");e.innerHTML="\x26#feff;";d?c.insertBefore(e,d):c.appendChild(e);l.moveToElementText(e);l.collapse(!b);c.removeChild(e);if(f)l[b?"moveStart":"moveEnd"]("character",m);return l};
c=function(a){this.textRange=a;this.refresh()};c.prototype=new l(document);c.prototype.refresh=function(){var a,b,d;d=this.textRange;a=d.parentElement();var c=d.duplicate();c.collapse(!0);b=c.parentElement();c=d.duplicate();c.collapse(!1);d=c.parentElement();b=b==d?b:k.getCommonAncestor(b,d);b=b==a?b:k.getCommonAncestor(a,b);a=this.textRange;0==a.compareEndPoints("StartToEnd",a)?b=a=n(this.textRange,b,!0,!0).boundaryPosition:(d=n(this.textRange,b,!0,!1),a=d.boundaryPosition,b=n(this.textRange,b,!1,
!1,d.nodeInfo).boundaryPosition);this.setStart(a.node,a.offset);this.setEnd(b.node,b.offset)};c.prototype.getName=function(){return"WrappedTextRange"};l.copyComparisonConstants(c);c.rangeToTextRange=function(a){if(a.collapsed)return g(new e(a.startContainer,a.startOffset),!0);var b=g(new e(a.startContainer,a.startOffset),!0),d=g(new e(a.endContainer,a.endOffset),!1);a=q(l.getRangeDocument(a)).createTextRange();a.setEndPoint("StartToStart",b);a.setEndPoint("EndToEnd",d);return a};a.WrappedTextRange=
c;if(!a.features.implementsDomRange||a.config.preferTextRange){var x=function(){return this}();"undefined"==typeof x.Range&&(x.Range=c);a.createNativeRange=function(a){a=f(a,b,"createNativeRange");return q(a).createTextRange()};a.WrappedRange=c}}a.createRange=function(d){d=f(d,b,"createRange");return new a.WrappedRange(a.createNativeRange(d))};a.createRangyRange=function(a){a=f(a,b,"createRangyRange");return new l(a)};a.createIframeRange=function(d){b.deprecationNotice("createIframeRange()","createRange(iframeEl)");
return a.createRange(d)};a.createIframeRangyRange=function(d){b.deprecationNotice("createIframeRangyRange()","createRangyRange(iframeEl)");return a.createRangyRange(d)};a.addCreateMissingNativeApiListener(function(b){var d=b.document;"undefined"==typeof d.createRange&&(d.createRange=function(){return a.createRange(d)});d=b=null})}),f.rangy.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],function(a,b){function d(a){return"string"==typeof a?/^backward(s)?$/i.test(a):!!a}function c(a,
d){if(a){if(F.isWindow(a))return a;if(a instanceof p)return a.win;var k=F.getContentDocument(a,b,d);return F.getWindow(k)}return window}function k(a){return c(a,"getWinSelection").getSelection()}function m(a){return c(a,"getDocSelection").document.selection}function e(a){var b=!1;a.anchorNode&&(b=1==F.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset));return b}function l(a,b,d){var c=d?"end":"start";d=d?"start":"end";a.anchorNode=b[c+"Container"];a.anchorOffset=b[c+"Offset"];a.focusNode=
b[d+"Container"];a.focusOffset=b[d+"Offset"]}function q(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function f(b){var d;b instanceof E?(d=a.createNativeRange(b.getDocument()),d.setEnd(b.endContainer,b.endOffset),d.setStart(b.startContainer,b.startOffset)):b instanceof C?d=b.nativeRange:J.implementsDomRange&&b instanceof F.getWindow(b.startContainer).Range&&(d=b);return d}function n(a){var d=a.getNodes(),c;a:if(d.length&&1==d[0].nodeType){c=
1;for(var k=d.length;c<k;++c)if(!F.isAncestorOf(d[0],d[c])){c=!1;break a}c=!0}else c=!1;if(!c)throw b.createError("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return d[0]}function g(a,b){var d=new C(b);a._ranges=[d];l(a,d,!1);a.rangeCount=1;a.isCollapsed=d.collapsed}function h(b){b._ranges.length=0;if("None"==b.docSelection.type)q(b);else{var d=b.docSelection.createRange();if(d&&"undefined"!=typeof d.text)g(b,d);else{b.rangeCount=d.length;for(var c,k=M(d.item(0)),
m=0;m<b.rangeCount;++m)c=a.createRange(k),c.selectNode(d.item(m)),b._ranges.push(c);b.isCollapsed=1==b.rangeCount&&b._ranges[0].collapsed;l(b,b._ranges[b.rangeCount-1],!1)}}}function x(a,d){for(var c=a.docSelection.createRange(),k=n(d),m=M(c.item(0)),m=Q(m).createControlRange(),e=0,l=c.length;e<l;++e)m.add(c.item(e));try{m.add(k)}catch(q){throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}m.select();h(a)}function p(a,
b,d){this.nativeSelection=a;this.docSelection=b;this._ranges=[];this.win=d;this.refresh()}function D(a){a.win=a.anchorNode=a.focusNode=a._ranges=null;a.rangeCount=a.anchorOffset=a.focusOffset=0;a.detached=!0}function r(a,b){for(var d=O.length,c,k;d--;)if(c=O[d],k=c.selection,"deleteAll"==b)D(k);else if(c.win==a)return"delete"==b?(O.splice(d,1),!0):k;"deleteAll"==b&&(O.length=0);return null}function H(a,d){for(var c=M(d[0].startContainer),c=Q(c).createControlRange(),k=0,m,e=d.length;k<e;++k){m=n(d[k]);
try{c.add(m)}catch(l){throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)");}}c.select();h(a)}function y(a,b){if(a.win.document!=M(b))throw new N("WRONG_DOCUMENT_ERR");}function u(b){return function(d,c){var k;this.rangeCount?(k=this.getRangeAt(0),k["set"+(b?"Start":"End")](d,c)):(k=a.createRange(this.win.document),k.setStartAndEnd(d,c));this.setSingleRange(k,this.isBackward())}}function t(a){var b=[],d=new T(a.anchorNode,
a.anchorOffset),c=new T(a.focusNode,a.focusOffset),k="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var m=0,e=a.rangeCount;m<e;++m)b[m]=E.inspect(a.getRangeAt(m));return"["+k+"(Ranges: "+b.join(", ")+")(anchor: "+d.inspect()+", focus: "+c.inspect()+"]"}a.config.checkSelectionRanges=!0;var F=a.dom,B=a.util,A=B.isHostMethod,E=a.DomRange,C=a.WrappedRange,N=a.DOMException,T=F.DomPosition,da,ea,J=a.features,M=F.getDocument,Q=F.getBody,R=E.rangesEqual,z=A(window,
"getSelection"),S=B.isHostObject(document,"selection");J.implementsWinGetSelection=z;var U=(J.implementsDocSelection=S)&&(!z||a.config.preferTextRange);U?(da=m,a.isSelectionValid=function(a){a=c(a,"isSelectionValid").document;var b=a.selection;return"None"!=b.type||M(b.createRange().parentElement())==a}):z?(da=k,a.isSelectionValid=function(){return!0}):b.fail("Neither document.selection or window.getSelection() detected.");a.getNativeSelection=da;var z=da(),I=a.createNativeRange(document),w=Q(document),
K=B.areHostProperties(z,["anchorNode","focusNode","anchorOffset","focusOffset"]);J.selectionHasAnchorAndFocus=K;var P=A(z,"extend");J.selectionHasExtend=P;var X="number"==typeof z.rangeCount;J.selectionHasRangeCount=X;var G=!1,aa=!0,V=P?function(b,d){var c=E.getRangeDocument(d),c=a.createRange(c);c.collapseToPoint(d.endContainer,d.endOffset);b.addRange(f(c));b.extend(d.startContainer,d.startOffset)}:null;B.areHostMethods(z,["addRange","getRangeAt","removeAllRanges"])&&"number"==typeof z.rangeCount&&
J.implementsDomRange&&function(){var b=window.getSelection();if(b){for(var d=b.rangeCount,c=1<d,k=[],m=e(b),l=0;l<d;++l)k[l]=b.getRangeAt(l);var l=Q(document),q=l.appendChild(document.createElement("div"));q.contentEditable="false";var f=q.appendChild(document.createTextNode("   ")),n=document.createRange();n.setStart(f,1);n.collapse(!0);b.addRange(n);aa=1==b.rangeCount;b.removeAllRanges();c||(c=n.cloneRange(),n.setStart(f,0),c.setEnd(f,3),c.setStart(f,2),b.addRange(n),b.addRange(c),G=2==b.rangeCount,
c.detach());l.removeChild(q);b.removeAllRanges();for(l=0;l<d;++l)0==l&&m?V?V(b,k[l]):(a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),b.addRange(k[l])):b.addRange(k[l])}}();J.selectionSupportsMultipleRanges=G;J.collapsedNonEditableSelectionsSupported=aa;var L=!1;w&&A(w,"createControlRange")&&(w=w.createControlRange(),B.areHostProperties(w,["item","add"])&&(L=!0));J.implementsControlRange=
L;ea=K?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var W;A(z,"getRangeAt")?W=function(a,b){try{return a.getRangeAt(b)}catch(d){return null}}:K&&(W=function(b){var d=M(b.anchorNode),d=a.createRange(d);d.setStartAndEnd(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset);d.collapsed!==this.isCollapsed&&d.setStartAndEnd(b.focusNode,b.focusOffset,b.anchorNode,b.anchorOffset);return d});p.prototype=
a.selectionPrototype;var O=[],ba=function(a){if(a&&a instanceof p)return a.refresh(),a;a=c(a,"getNativeSelection");var b=r(a),d=da(a),k=S?m(a):null;b?(b.nativeSelection=d,b.docSelection=k,b.refresh()):(b=new p(d,k,a),O.push({win:a,selection:b}));return b};a.getSelection=ba;a.getIframeSelection=function(d){b.deprecationNotice("getIframeSelection()","getSelection(iframeEl)");return a.getSelection(F.getIframeWindow(d))};w=p.prototype;if(!U&&K&&B.areHostMethods(z,["removeAllRanges","addRange"]))w.removeAllRanges=
function(){this.nativeSelection.removeAllRanges();q(this)},w.addRange=X?function(b,c){if(L&&S&&"Control"==this.docSelection.type)x(this,b);else if(d(c)&&P)V(this.nativeSelection,b),this.refresh();else{var k;G?k=this.rangeCount:(this.removeAllRanges(),k=0);this.nativeSelection.addRange(f(b).cloneRange());this.rangeCount=this.nativeSelection.rangeCount;this.rangeCount==k+1?(a.config.checkSelectionRanges&&(k=W(this.nativeSelection,this.rangeCount-1))&&!R(k,b)&&(b=new C(k)),this._ranges[this.rangeCount-
1]=b,l(this,b,Z(this.nativeSelection)),this.isCollapsed=ea(this)):this.refresh()}}:function(a,b){d(b)&&P?V(this.nativeSelection,a):this.nativeSelection.addRange(f(a));this.refresh()},w.setRanges=function(a){if(L&&1<a.length)H(this,a);else{this.removeAllRanges();for(var b=0,d=a.length;b<d;++b)this.addRange(a[b])}};else if(A(z,"empty")&&A(I,"select")&&L&&U)w.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var a;if(this.anchorNode)a=M(this.anchorNode);else if("Control"==
this.docSelection.type){var b=this.docSelection.createRange();b.length&&(a=M(b.item(0)))}a&&(Q(a).createTextRange().select(),this.docSelection.empty())}}catch(d){}q(this)},w.addRange=function(b){"Control"==this.docSelection.type?x(this,b):(a.WrappedTextRange.rangeToTextRange(b).select(),this._ranges[0]=b,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,l(this,b,!1))},w.setRanges=function(a){this.removeAllRanges();var b=a.length;1<b?H(this,a):b&&this.addRange(a[0])};else return b.fail("No means of selecting a Range or TextRange was found"),
!1;w.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new N("INDEX_SIZE_ERR");return this._ranges[a].cloneRange()};var Y;if(U)Y=function(b){var d;a.isSelectionValid(b.win)?d=b.docSelection.createRange():(d=Q(b.win.document).createTextRange(),d.collapse(!0));"Control"==b.docSelection.type?h(b):d&&"undefined"!=typeof d.text?g(b,d):q(b)};else if(A(z,"getRangeAt")&&"number"==typeof z.rangeCount)Y=function(b){if(L&&S&&"Control"==b.docSelection.type)h(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,
b.rangeCount){for(var d=0,c=b.rangeCount;d<c;++d)b._ranges[d]=new a.WrappedRange(b.nativeSelection.getRangeAt(d));l(b,b._ranges[b.rangeCount-1],Z(b.nativeSelection));b.isCollapsed=ea(b)}else q(b)};else if(K&&"boolean"==typeof z.isCollapsed&&"boolean"==typeof I.collapsed&&J.implementsDomRange)Y=function(a){var b;b=a.nativeSelection;b.anchorNode?(b=W(b,0),a._ranges=[b],a.rangeCount=1,b=a.nativeSelection,a.anchorNode=b.anchorNode,a.anchorOffset=b.anchorOffset,a.focusNode=b.focusNode,a.focusOffset=b.focusOffset,
a.isCollapsed=ea(a)):q(a)};else return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;w.refresh=function(a){var b=a?this._ranges.slice(0):null,d=this.anchorNode,c=this.anchorOffset;Y(this);if(a){a=b.length;if(a!=this._ranges.length||this.anchorNode!=d||this.anchorOffset!=c)return!0;for(;a--;)if(!R(b[a],this._ranges[a]))return!0;return!1}};var ca=function(a,b){var d=a.getAllRanges();a.removeAllRanges();for(var c=0,k=d.length;c<k;++c)R(b,d[c])||a.addRange(d[c]);
a.rangeCount||q(a)};w.removeRange=L?function(a){if("Control"==this.docSelection.type){var b=this.docSelection.createRange();a=n(a);for(var d=M(b.item(0)),d=Q(d).createControlRange(),c,k=!1,m=0,e=b.length;m<e;++m)c=b.item(m),c!==a||k?d.add(b.item(m)):k=!0;d.select();h(this)}else ca(this,a)}:function(a){ca(this,a)};var Z;!U&&K&&J.implementsDomRange?(Z=e,w.isBackward=function(){return Z(this)}):Z=w.isBackward=function(){return!1};w.isBackwards=w.isBackward;w.toString=function(){for(var a=[],b=0,d=this.rangeCount;b<
d;++b)a[b]=""+this._ranges[b];return a.join("")};w.collapse=function(b,d){y(this,b);var c=a.createRange(b);c.collapseToPoint(b,d);this.setSingleRange(c);this.isCollapsed=!0};w.collapseToStart=function(){if(this.rangeCount){var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new N("INVALID_STATE_ERR");};w.collapseToEnd=function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new N("INVALID_STATE_ERR");};w.selectAllChildren=
function(b){y(this,b);var d=a.createRange(b);d.selectNodeContents(b);this.setSingleRange(d)};w.deleteFromDocument=function(){if(L&&S&&"Control"==this.docSelection.type){for(var a=this.docSelection.createRange(),b;a.length;)b=a.item(0),a.remove(b),b.parentNode.removeChild(b);this.refresh()}else if(this.rangeCount&&(a=this.getAllRanges(),a.length)){this.removeAllRanges();b=0;for(var d=a.length;b<d;++b)a[b].deleteContents();this.addRange(a[d-1])}};w.eachRange=function(a,b){for(var d=0,c=this._ranges.length;d<
c;++d)if(a(this.getRangeAt(d)))return b};w.getAllRanges=function(){var a=[];this.eachRange(function(b){a.push(b)});return a};w.setSingleRange=function(a,b){this.removeAllRanges();this.addRange(a,b)};w.callMethodOnEachRange=function(a,b){var d=[];this.eachRange(function(c){d.push(c[a].apply(c,b))});return d};w.setStart=u(!0);w.setEnd=u(!1);a.rangePrototype.select=function(a){ba(this.getDocument()).setSingleRange(this,a)};w.changeEachRange=function(a){var b=[],d=this.isBackward();this.eachRange(function(d){a(d);
b.push(d)});this.removeAllRanges();d&&1==b.length?this.addRange(b[0],"backward"):this.setRanges(b)};w.containsNode=function(a,b){return this.eachRange(function(d){return d.containsNode(a,b)},!0)};w.getBookmark=function(a){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[a])}};w.moveToBookmark=function(b){for(var d=[],c=0,k,m;k=b.rangeBookmarks[c++];)m=a.createRange(this.win),m.moveToBookmark(k),d.push(m);b.backward?this.setSingleRange(d[0],"backward"):this.setRanges(d)};
w.toHtml=function(){return this.callMethodOnEachRange("toHtml").join("")};w.getName=function(){return"WrappedSelection"};w.inspect=function(){return t(this)};w.detach=function(){r(this.win,"delete");D(this)};p.detachAll=function(){r(null,"deleteAll")};p.inspect=t;p.isDirectionBackward=d;a.Selection=p;a.selectionPrototype=w;a.addCreateMissingNativeApiListener(function(a){"undefined"==typeof a.getSelection&&(a.getSelection=function(){return ba(a)});a=null})}))})(this.ice||window.ice);
(function(f,g){function A(a){return a}function B(a){var b=g.map(a.attributes,function(a){return a.name});g(a).removeClass();g.each(b,function(b,d){a.removeAttribute(d)})}function t(a){return"br"==f.dom.getTagName(a)}function c(a){a=f.dom.getTagName(a);return"br"===a||"p"===a}function r(a,b,c){var m=a.length;if(0>b||b>=m)return a;b+c>=m&&(c=m-b);if(c===m)return a;a=0<b?a.splitText(b):a;a.length>c&&a.splitText(c);return a}function y(a,b,c,m){m?b.collapsed&&b.startContainer&&b.startContainer.nodeType===
f.dom.TEXT_NODE&&b.startContainer.length||(c=c.createTextNode("﻿"),a?a.appendChild(c):b.insertNode(c),b.selectNode(c)):a&&b.selectNodeContents(a)}var u=f.rangy,E,b,e=[{start:0,end:31},{start:33,end:40},{start:45,end:45},{start:91,end:93},{start:112,end:123},{start:144,end:145}];E={attributes:{changeId:"data-cid",userId:"data-userid",userName:"data-username",sessionId:"data-session-id",time:"data-time",lastTime:"data-last-change-time",changeData:"data-changedata"},attrValuePrefix:"",blockEl:"p",blockEls:"div p ol ul li h1 h2 h3 h4 h5 h6 blockquote".split(" "),
stylePrefix:"cts",currentUser:{id:null,name:null},changeTypes:{insertType:{tag:"ins",alias:"ins",action:"Inserted"},deleteType:{tag:"del",alias:"del",action:"Deleted"}},contentEditable:void 0,_isTracking:!0,tooltips:!1,tooltipsDelay:1,_isVisible:!0,_changeData:null,_handleSelectAll:!1,_sessionId:null};b=function(a){a||(a={});if(!a.element)throw Error("options.element must be defined for ice construction.");this._changes={};this._userStyles={};this.currentUser={name:"",id:""};this._styles={};this._savedNodesMap=
{};this.$this=g(this);this._browser=f.dom.browser();this._tooltipMouseOver=this._tooltipMouseOver.bind(this);this._tooltipMouseOut=this._tooltipMouseOut.bind(this);g.extend(!0,this,E,a);if(a.tooltips&&(!g.isFunction(a.hostMethods.showTooltip)||!g.isFunction(a.hostMethods.hideTooltip)))throw Error("hostMethods.showTooltip and hostMethods.hideTooltip must be defined if tooltips is true");var b=a.userStyles||{},c;for(c in b)if(b.hasOwnProperty(c)){var m=b[c];isNaN(m)||(this._userStyles[c]=this.stylePrefix+
"-"+m,this._uniqueStyleIndex=Math.max(m,this._uniqueStyleIndex),this._styles[m]=!0)}p=a.hostMethods.logError||function(){};this._insertSelector="."+this._getIceNodeClass("insertType");this._deleteSelector="."+this._getIceNodeClass("deleteType");this._iceSelector=this._insertSelector+","+this._deleteSelector};b.prototype={_uniqueStyleIndex:0,_browserType:null,_batchChangeId:null,_uniqueIDIndex:1,_delBookmark:"tempdel",isPlaceHoldingDeletes:!1,startTracking:function(a){"boolean"==typeof this.contentEditable&&
this.element.setAttribute("contentEditable",this.contentEditable);this.initializeEnvironment();this.initializeEditor();this.initializeRange();this._updateTooltipsState();return this},stopTracking:function(a){this._isTracking=!1;try{this.element&&this.unlistenToEvents(),a||"undefined"===typeof this.contentEditable||this.element.setAttribute("contentEditable",!this.contentEditable)}catch(b){p(b,"While trying to stop tracking")}this._updateTooltipsState();return this},listenToEvents:function(){this.element&&
!this._boundEventHandler&&(this.unlistenToEvents(),this._boundEventHandler=this.handleEvent.bind(this),this.element.addEventListener("keydown",this._boundEventHandler,!0))},unlistenToEvents:function(){this.element&&this._boundEventHandler&&this.element.removeEventListener("keydown",this._boundEventHandler,!0);this._boundEventHandler=null},initializeEnvironment:function(){this.env||(this.env={});this.env.element=this.element;this.env.document=this.element.ownerDocument;this.env.window=this.env.document.defaultView||
this.env.document.parentWindow||window;this.env.frame=this.env.window.frameElement;this.env.selection=this.selection=new f.Selection(this.env)},initializeRange:function(){},initializeEditor:function(){this._loadFromDom();this._updateTooltipsState()},isTracking:function(){return this._isTracking},enableChangeTracking:function(){this._isTracking=!0},disableChangeTracking:function(){this._isTracking=!1},toggleChangeTracking:function(a){this._isTracking=a=void 0===a?!this._isTracking:Boolean(a)},getCurrentUser:function(){var a=
this.currentUser||{};return{name:a.name||"",id:null===a.id||void 0===a.id?"":String(a.id)}},setCurrentUser:function(a){var b={};a=a||{};b.name=a.name?String(a.name):"";b.id=void 0!==a.id&&null!==a.id?String(a.id):"";this.currentUser=b;for(var c in this._changes)a=this._changes[c],a.userid==b.id&&(a.username=b.name);c=this.getIceNodes();var m,e=this.attributes.userId;c.each(function(a,c){m=c.getAttribute(e);null!==m&&m!==b.id||c.setAttribute(this.attributes.userName,b.name)}.bind(this))},setSessionId:function(a){this._sessionId=
a},toggleTooltips:function(a){this.tooltips=a=void 0===a?!this.tooltips:Boolean(a);this._updateTooltipsState()},visible:function(a){a.nodeType===f.dom.TEXT_NODE&&(a=a.parentNode);a=a.getBoundingClientRect();return 0<a.top&&0<a.left},_createIceNode:function(a,b,c){var m=this.env.document.createElement(this.changeTypes[a].tag);m.setAttribute("class",this._getIceNodeClass(a));b&&m.appendChild(b);this._addChange(a,[m],c);return m},insert:function(a){this.hostMethods.beforeInsert&&this.hostMethods.beforeInsert();
var b=this.getCurrentRange(),c=(b=this._isRangeInElement(b,this.element))?null:this.hostMethods.getHostRange(),m=this._startBatchChange(),e=Boolean(b&&!b.collapsed),l=!1;a=a||{};try{if(e&&(this._deleteContents(!1,b),b=this.getCurrentRange()),b||c){var f=a.nodes;f&&!g.isArray(f)&&(f=[f]);this._moveRangeToValidTrackingPos(b,c);l=this._insertNodes(b,c,{nodes:f,text:a.text,insertStubText:!1!==a.insertStubText})}}catch(h){p(h,"while trying to insert nodes")}finally{this._endBatchChange(m,f||a.text||l)}return l},
_deleteContents:function(a,b){var c=!0,m,e=this._browser;this.hostMethods.beforeDelete&&this.hostMethods.beforeDelete();b?this.selection.addRange(b):b=this.getCurrentRange();m=this._startBatchChange();try{if(!1===b.collapsed)(b=this._deleteSelection(b))&&!this.visible(b.endContainer)&&(b.setEnd(b.endContainer,Math.max(0,b.endOffset-1)),b.collapse(!1));else{this._cleanupSelection(b,!1,!0);if(this._isCurrentUserIceNode(this._getIceNode(b.startContainer,"insertType")))return!1;if(a)if("mozilla"===e.type)c=
this._deleteRight(b),this.visible(b.endContainer)||(b.endContainer.parentNode.nextSibling?b.setEndBefore(b.endContainer.parentNode.nextSibling):b.setEndAfter(b.endContainer),b.collapse(!1));else{if(b.endOffset===f.dom.getNodeCharacterLength(b.endContainer)){var l=b.startContainer.nextSibling;if(g(l).is(this._deleteSelector))for(;l;)if(g(l).is(this._deleteSelector))l=l.nextSibling;else{b.setStart(l,0);b.collapse(!0);break}}c=this._deleteRight(b);!this.visible(b.endContainer)&&g(b.endContainer.parentNode).is(this._iceSelector)&&
(b.setStartAfter(b.endContainer.parentNode),b.collapse(!0))}else if(e.mozilla)c=this._deleteLeft(b),this.visible(b.startContainer)||(b.startContainer.parentNode.previousSibling?b.setEnd(b.startContainer.parentNode.previousSibling,0):b.setEnd(b.startContainer.parentNode,0),b.moveEnd(f.dom.CHARACTER_UNIT,f.dom.getNodeCharacterLength(b.endContainer)),b.collapse(!1));else{if(!this.visible(b.startContainer)&&b.endOffset===f.dom.getNodeCharacterLength(b.endContainer)){var h=b.startContainer.previousSibling;
if(g(h).is(this._deleteSelector))for(;h;)if(g(h).is(this._deleteSelector))h=h.prevSibling;else{b.setEndBefore(h.nextSibling,0);b.collapse(!1);break}}c=this._deleteLeft(b)}}b&&this.selection.addRange(b)}finally{this._endBatchChange(m,c)}return c},getChanges:function(a){a=a?this._filterChanges(a):this._changes;return g.extend({},a)},getChangeUserids:function(){var a=this,b=Object.keys(this._changes);return b.map(function(c){return a._changes[b[c]].userid}).sort().filter(function(a,b,d){return b===d.indexOf(a)?
1:0})},getElementContent:function(){return this.element.innerHTML},getCleanContent:function(a,b,c){return(a=this.getCleanDOM(a,{callback:b,prepare:c,clone:!0}))&&a.innerHTML||""},getCleanDOM:function(a,b){var c="",m=this;b=b||{};g.each(this.changeTypes,function(a,b){"deleteType"!==a&&(0<b&&(c+=","),c+="."+m._getIceNodeClass(a))});a?"string"===typeof a?a=g("\x3cdiv\x3e"+a+"\x3c/div\x3e"):b.clone&&(a=g(a).clone()[0]):a=b.clone?g(this.element).clone()[0]:this.element;return this._cleanBody(a,c,b)},_cleanBody:function(a,
b,c){a=c.prepare?c.prepare.call(this,a):a;var m=g(a);b=m.find(b);g.each(b,function(a,b){for(;b.firstChild;)b.parentNode.insertBefore(b.firstChild,b);b.parentNode.removeChild(b)});m.find(this._deleteSelector).remove();return a=c.callback?c.callback.call(this,a):a},acceptAll:function(a){if(a)return this._acceptRejectSome(a,!0);this.getCleanDOM(this.element,{clone:!1});this._changes={};this._triggerChange({isText:!0})},rejectAll:function(a){if(a)return this._acceptRejectSome(a,!1);a=this._insertSelector;
var b=this._deleteSelector,c,m=this,e=g(this.element);e.find(a).each(function(a,b){m._removeNode(b)});e.find(b).each(function(a,b){c=f.dom.contents(b);f.dom.replaceWith(b,c);g.each(c,function(a,b){m._normalizeNode(b&&b.parentNode)})});this._changes={};this._triggerChange({isText:!0})},acceptChange:function(a){this.acceptRejectChange(a,{isAccept:!0})},rejectChange:function(a){this.acceptRejectChange(a,{isAccept:!1})},acceptRejectChange:function(a,b){var k,m,e,l,h=f.dom,x=this,n,p,r,y=g(this.element),
u=this._userStyles,t,A=this.attributes.userId,E=this._getIceNodeClass("deleteType"),ia=this._getIceNodeClass("insertType");n=b&&b.isAccept;var ma=b&&!1===b.notify;if(!a){l=this.getCurrentRange();if(!l||!l.collapsed)return;a=l.startContainer}k=e="."+E;m=l="."+ia;n||(e=m,l=k);n=h.getNode(a,k+","+m).getAttribute(this.attributes.changeId);e=y.find(e+"["+this.attributes.changeId+"\x3d"+n+"]");k=e.length;e.each(function(a,b){x._removeNode(b)});e=y.find(l+"["+this.attributes.changeId+"\x3d"+n+"]");k+=e.length;
g.each(e,function(a,b){if(c(b))return B(b);t=b.getAttribute(A);r=null!==t?u[t]||"":"";p=f.dom.contents(b);g(b).removeClass(ia+" "+E+" "+r);h.replaceWith(b,p);g.each(p,function(a,b){var d=f.dom.TEXT_NODE==b.nodeType&&b.nodeValue;if(d){for(var c=!1;0<=d.indexOf("  ");)c=!0,d=d.replace("  ","  ");c&&(b.nodeValue=d)}x._normalizeNode(b&&b.parentNode)})});delete this._changes[n];0<k&&!ma&&this._triggerChange({isText:!0})},isInsideChange:function(a,b,c){try{return Boolean(this.currentChangeNode(a,b,c))}catch(m){return p(m,
"While testing if isInsideChange"),!1}},getIceNodes:function(){var a=[],b=this;g.each(this.changeTypes,function(c){a.push("."+b._getIceNodeClass(c))});a=a.join(",");return g(this.element).find(a)},_getIceNode:function(a,b){var c=this.changeTypes[b].tag+"."+this._getIceNodeClass(b);return f.dom.getNode(a&&a.$||a,c)},_isNodeOfChangeType:function(a,b){if(!a)return!1;var c="."+this._getIceNodeClass(b);return g(a.$||a).is(c)},_isInsertNode:function(a){return this._isNodeOfChangeType(a,"insertType")},_isDeleteNode:function(a){return this._isNodeOfChangeType(a,
"deleteType")},_normalizeNode:function(a){return f.dom.normalizeNode(a,this._browser.msie)},_moveRangeToValidTrackingPos:function(a,b){if(a=b||a)for(var c,m,e=-1,l,h=[],g=b?this.hostMethods.getHostNode:A,n=!1;!n;){m=a.startContainer;if(!m||0<=h.indexOf(m))break;l=g(m);h.push(m);if(c=this._getVoidElement({node:l,checkEmpty:!1})){if(c!==m&&0<=h.indexOf(c))break;h.push(c)}else n=f.dom.isTextContainer(l);if(!n){if(-1==e){e=g(a.startContainer);m=a.startOffset;if(e)var r=e.nodeType,e=f.dom.TEXT_NODE==r?
m&&e.nodeValue&&m>=e.nodeValue.length-1:f.dom.ELEMENT_NODE==r?e.childNodes&&e.childNodes.length&&m>=e.childNodes.length:!1;else e=!1;e=!e}c=e?f.dom.findPrevTextContainer(c||l,this.element):f.dom.findNextTextContainer(c||l,this.element);l=c.node;b&&(l=this.hostMethods.makeHostElement(l));try{e?a.setStart(l,c.offset):a.setEnd(l,c.offset),a.collapse(e)}catch(y){p(y,"While trying to move range to valid tracking position");break}}}},_isRangeInElement:function(a,b){for(var c=a&&a.startContainer;c;){if(c==
b)return a;c=c.parentNode}return null},_getVoidElement:function(a){if(!a)return null;var b=a.node;a=!1!==a.checkEmpty;try{var c=this._getIceNode(b,"deleteType");return!c&&3==b.nodeType&&a&&"​"==b.nodeValue?b:c}catch(e){return p(e,"While trying to get void element of",b),null}},_cleanupSelection:function(a,b,c){var e;if(a&&a.collapsed&&(e=a.startContainer))return b&&(e=this.hostMethods.getHostNode(e)),f.dom.TEXT_NODE==e.nodeType?this._cleanupTextSelection(a,e,b,c):this._cleanupElementSelection(a,b)},
_cleanupTextSelection:function(a,b,c,e){this._cleanupAroundNode(b);if(e&&f.dom.isEmptyTextNode(b)){e=b.parentNode;var q=f.dom.getNodeIndex(b);c=c?this.hostMethods.makeHostElement:A;e.removeChild(b);q=Math.max(0,q);a.setStart(c(e),q);a.setEnd(c(e),q)}},_cleanupElementSelection:function(a,b){var c,e=!1,q=b?this.hostMethods.getHostNode(a.startContainer):a.startContainer,l=q.childNodes.length;if(!(1>l)){try{if(0<a.startOffset?c=q.childNodes[a.startOffset-1]:(c=q.firstChild,e=!0),!c)return}catch(h){return}this._cleanupAroundNode(c,
e);0!==a.startOffset&&(e=f.dom.getNodeIndex(c)+1,f.dom.isEmptyTextNode(c)&&(e=Math.max(0,e-1),q.removeChild(c)),q.childNodes.length!==l&&(c=b?this.hostMethods.makeHostElement:A,a.setStart(c(q),e),a.setEnd(c(q),e)))}},_cleanupAroundNode:function(a,b){for(var c=a.parentNode,e=a.nextSibling,q;e;)(q=g(e).is(this._iceSelector)&&f.dom.hasNoTextOrStubContent(e)||f.dom.isEmptyTextNode(e))?(q=e,e=e.nextSibling,c.removeChild(q)):e=e.nextSibling;for(e=a.previousSibling;e;)(q=g(e).is(this._iceSelector)&&f.dom.hasNoTextOrStubContent(e)||
f.dom.isEmptyTextNode(e))?(q=e,e=e.previousSibling,c.removeChild(q)):e=e.previousSibling;b&&f.dom.isEmptyTextNode(a)&&c.removeChild(a)},_isCurrentUserIceNode:function(a){var b=Boolean(a&&g(a).attr(this.attributes.userId)===this.currentUser.id);b&&this._sessionId&&(b=a.getAttribute(this.attributes.sessionId)===this._sessionId);return b},_getChangeTypeFromAlias:function(a){var b,c=null;for(b in this.changeTypes)this.changeTypes.hasOwnProperty(b)&&this.changeTypes[b].alias==a&&(c=b);return c},_getIceNodeClass:function(a){return this.attrValuePrefix+
this.changeTypes[a].alias},_getUserStyle:function(a){if(null===a||""===a||"undefined"==typeof a)return this.stylePrefix;var b=null;return b=this._userStyles[a]?this._userStyles[a]:this._setUserStyle(a,this._getNewStyleId())},_setUserStyle:function(a,b){var c=this.stylePrefix+"-"+b;this._styles[b]||(this._styles[b]=!0);return this._userStyles[a]=c},_getNewStyleId:function(){var a=++this._uniqueStyleIndex;if(this._styles[a])return this._getNewStyleId();this._styles[a]=!0;return a},_addChange:function(a,
b,c){var e=c||this._batchChangeId||this.getNewChangeId(),f=this;this._changes[e]||(c=(new Date).getTime(),this._changes[e]={type:a,time:c,lastTime:c,sessionId:this._sessionId,userid:String(this.currentUser.id),username:this.currentUser.name,data:this._changeData||""},this._triggerChange({text:!1}));g.each(b,function(a){f._addNodeToChange(e,b[a])});return e},_addNodeToChange:function(a,b){var c=this.getChange(a),e={};b.getAttribute(this.attributes.changeId)||(e[this.attributes.changeId]=a);var f=b.getAttribute(this.attributes.userId);
f||(f=c.userid,e[this.attributes.userId]=f);f==c.userid&&(e[this.attributes.userName]=c.username);null===b.getAttribute(this.attributes.changeData)&&(e[this.attributes.changeData]=this._changeData||"");b.getAttribute(this.attributes.time)||(e[this.attributes.time]=c.time);b.getAttribute(this.attributes.lastTime)||(e[this.attributes.lastTime]=c.lastTime);c.sessionId&&!b.getAttribute(this.attributes.sessionId)&&(e[this.attributes.sessionId]=c.sessionId);c.style||(c.style=this._getUserStyle(c.userid));
g(b).attr(e).addClass(c.style);this._updateNodeTooltip(b)},getChange:function(a){return this._changes[a]||null},getNewChangeId:function(){var a=++this._uniqueIDIndex;this._changes[a]&&(a=this.getNewChangeId());return a},_startBatchChange:function(){return this._batchChangeId?null:this._batchChangeId=this.getNewChangeId()},getContentElement:function(){return this.element},_endBatchChange:function(a,b){a&&a===this._batchChangeId&&(this._batchChangeId=null,b&&this._triggerChange({isText:!0}))},getCurrentRange:function(){try{return this.selection.getRangeAt(0)}catch(a){return p(a,
"While trying to get current range"),null}},_insertNodes:function(a,b,c){a=b||a;c=c||{};var e=a.startContainer,q=b?this.hostMethods.makeHostElement:A,l=c.nodes,h=!1!==c.insertStubText,g=c.text,n,p;n=this.env.document;c=!1;p=this._getIceNode(e&&e.$||e,"insertType");e=this._isCurrentUserIceNode(p);this._cleanupSelection(a,Boolean(b),!0);if(e){g=l&&l[0];h=p.getAttribute(this.attributes.changeId);if(g){c=!0;a.insertNode(q(g));q=g.parentNode;g=g.nextSibling;p=l.length;for(n=1;n<p;++n)g?q.insertBefore(l[n],
g):q.appendChild(l[n]);l=l[p-1];f.dom.TEXT_NODE==l.nodeType?a.setEnd(l,l.nodeValue&&l.nodeValue.length||0):a.setEndAfter(l);a.collapse();b?this.hostMethods.setHostRange(b):this.selection.addRange(a)}else y(null,a,n,!0);this._updateChangeTime(h)}else{e=this._createIceNode("insertType");if(p){var r=p.childNodes.length;this._normalizeNode(p);r!==p.childNodes.length&&(b?b=a=this.hostMethods.getHostRange():a.refresh());p&&(r=b&&this.hostMethods.getHostNode(b.endContainer)||a.endContainer,3==r.nodeType&&
a.endOffset<a.endContainer.length||r!==p.lastChild)&&(p=this._splitNode(p,a.endContainer,a.endOffset))}p&&(a.setStartAfter(q(p)),a.collapse(!0));a.insertNode(q(e));if(p=l&&l.length||0){c=!0;for(n=0;n<p;++n)e.appendChild(l[n]);a.setEndAfter(q(e.lastChild));a.collapse()}else g?(c=!0,l=n.createTextNode(g),e.appendChild(l),a.setEnd(l,1),a.collapse()):y(e,a,n,h);b?this.hostMethods.setHostRange(b):this.selection.addRange(a)}return c},_updateChangeTime:function(a){var b=this._changes[a];if(b){var c=(new Date).getTime();
a=g(this.element).find("["+this.attributes.changeId+"\x3d"+a+"]");var e=this.attributes.lastTime;b.lastTime=c;a.each(function(a,b){b.setAttribute(e,c)})}},_handleVoidEl:function(a,b){var c=a&&this._getVoidElement({node:a});return c&&!this._getIceNode(c,"deleteType")?(b.collapse(!0),!0):!1},_deleteSelection:function(a){for(var b=new f.Bookmark(this.env,a),c=f.dom.getElementsBetween(b.start,b.end),e=[],q=[],l={deleteNodesCollection:q,moveLeft:!0,range:null},h=0;h<c.length;h++){var g=c[h];if(g&&g.parentNode){if(f.dom.isBlockElement(g)&&
(e.push(g),!f.dom.canContainTextElement(g))){for(var n=0;n<g.childNodes.length;n++)c.push(g.childNodes[n]);continue}if(f.dom.isEmptyTextNode(g))this._removeNode(g);else if(!this._getVoidElement({node:g}))if(g.nodeType!==f.dom.TEXT_NODE)if(t(g))this._addDeleteTrackingToBreak(g,l);else if(f.dom.isStubElement(g))this._addDeleteTracking(g,l);else if(f.dom.hasNoTextOrStubContent(g))this._removeNode(g);else for(n=0;n<g.childNodes.length;n++)c.push(g.childNodes[n]);else n=f.dom.getBlockParent(g),this._addDeleteTracking(g,
l),f.dom.hasNoTextOrStubContent(n)&&f.dom.remove(n)}}if(q.length)b.remove(),this._cleanupAroundNode(q[0]),a.setStartBefore(q[0]),a.collapse(!0),this.selection.addRange(a);else if(b.selectStartAndCollapse(),a=this.getCurrentRange())this._cleanupSelection(a,!1,!1),a=this.getCurrentRange();return a},_deleteRight:function(a){var b=f.dom.isBlockElement(a.startContainer)&&a.startContainer||f.dom.getBlockParent(a.startContainer,this.element)||null,c=b?f.dom.hasNoTextOrStubContent(b):!1,e=b&&f.dom.getNextContentNode(b,
this.element),q=e?f.dom.hasNoTextOrStubContent(e):!1,l=a.endContainer,h=a.endOffset,p=a.commonAncestorContainer,n,y=!1;if(c)return!1;if(t(p))return this._addDeleteTrackingToBreak(p,{range:a}),!0;if(p.nodeType!==f.dom.TEXT_NODE){if(0===h&&f.dom.isBlockElement(p)&&!f.dom.canContainTextElement(p)&&(b=p.firstElementChild))return a.setStart(b,0),a.collapse(),this._deleteRight(a);if(p.childNodes.length>h){b=p.childNodes[h];if(t(b))return this._addDeleteTrackingToBreak(b,{range:a}),!0;a.setStart(p.childNodes[h],
0);a.collapse(!0);y=this._deleteRight(a);a.refresh();return y}if(n=f.dom.getNextContentNode(p,this.element)){if(t(n))return this._addDeleteTrackingToBreak(n,{range:a}),!0;a.setEnd(n,0)}a.collapse();return this._deleteRight(a)}try{a.moveEnd(f.dom.CHARACTER_UNIT,1),a.moveEnd(f.dom.CHARACTER_UNIT,-1)}catch(u){}if(h===l.data.length&&!f.dom.hasNoTextOrStubContent(l)){n=f.dom.getNextNode(l,this.element);if(!n)return a.selectNodeContents(l),a.collapse(),!1;if(t(n))return this._addDeleteTrackingToBreak(n,
{range:a}),!0;n.nodeType===f.dom.TEXT_NODE&&(n=n.parentNode);if(!n.isContentEditable)return y=this._addDeleteTracking(n,{range:null,moveLeft:!1,merge:!0}),b=this.env.document.createTextNode(""),n.parentNode.insertBefore(b,n.nextSibling),a.selectNode(b),a.collapse(!0),y;if(this._handleVoidEl(n,a))return!0;if(f.dom.isChildOf(n,b)&&f.dom.isStubElement(n))return this._addDeleteTracking(n,{range:a,moveLeft:!1,merge:!0})}if(this._handleVoidEl(n,a))return!0;if(f.dom.isOnBlockBoundary(a.startContainer,a.endContainer,
this.element)){if(this.mergeBlocks&&g(f.dom.getBlockParent(n,this.element)).is(this.blockEl)){e!==f.dom.getBlockParent(a.endContainer,this.element)&&a.setEnd(e,0);p=f.dom.getElementsBetween(a.startContainer,a.endContainer);for(h=0;h<p.length;h++)f.dom.remove(p[h]);return f.dom.mergeBlockWithSibling(a,f.dom.getBlockParent(a.endContainer,this.element)||b)}if(q)return f.dom.remove(e),a.collapse(!0),!0;a.setStart(e,0);a.collapse(!0);return!0}b=r(a.endContainer,a.endOffset,1);return this._addDeleteTracking(b,
{range:a,moveLeft:!1,merge:!0})},_deleteLeft:function(a){var b=f.dom.isBlockElement(a.startContainer)&&a.startContainer||f.dom.getBlockParent(a.startContainer,this.element)||null,c=b?f.dom.hasNoTextOrStubContent(b):!1,e=b&&f.dom.getPrevContentNode(b,this.element),h=e?f.dom.hasNoTextOrStubContent(e):!1,l=a.startContainer,p=a.startOffset,x=a.commonAncestorContainer;if(c)return!1;if(t(x))return this._addDeleteTrackingToBreak(x,{range:a,moveLeft:!0}),!0;if(0===p||x.nodeType!==f.dom.TEXT_NODE){if(f.dom.isBlockElement(x)&&
!f.dom.canContainTextElement(x))if(0===p){if(c=x.firstElementChild)return a.setStart(c,0),a.collapse(),this._deleteLeft(a)}else if(c=x.lastElementChild)if(c=a.getLastSelectableChild(c))return a.setStart(c,c.data.length),a.collapse(),this._deleteLeft(a);l=0===p?f.dom.getPrevContentNode(l,this.element):x.childNodes[p-1];if(!l)return!1;g(l).is(this._iceSelector)&&0<l.childNodes.length&&l.lastChild&&(l=l.lastChild);if(t(l))return this._addDeleteTrackingToBreak(l,{range:a,moveLeft:!0}),!0;l.nodeType===
f.dom.TEXT_NODE&&(l=l.parentNode);if(!l.isContentEditable)return b=this._addDeleteTracking(l,{range:null,moveLeft:!0,merge:!0}),e=document.createTextNode(""),l.parentNode.insertBefore(e,l),a.selectNode(e),a.collapse(!0),b;if(this._handleVoidEl(l,a))return!0;if(f.dom.isStubElement(l)&&f.dom.isChildOf(l,b)||!l.isContentEditable)return this._addDeleteTracking(l,{range:a,moveLeft:!0,merge:!0}),!0;if(f.dom.isStubElement(l))return f.dom.remove(l),a.collapse(!0),!1;if(l!==b&&!f.dom.isChildOf(l,b)){f.dom.canContainTextElement(l)||
(l=l.lastElementChild);if(l.lastChild&&l.lastChild.nodeType!==f.dom.TEXT_NODE&&f.dom.isStubElement(l.lastChild)&&"BR"!==l.lastChild.tagName)return a.setStartAfter(l.lastChild),a.collapse(!0),!0;if((c=a.getLastSelectableChild(l))&&!f.dom.isOnBlockBoundary(a.startContainer,c,this.element))return a.selectNodeContents(c),a.collapse(),!0}}if(1===p&&!f.dom.isBlockElement(x)&&1<a.startContainer.childNodes.length&&a.startContainer.childNodes[0].nodeType===f.dom.TEXT_NODE&&0===a.startContainer.childNodes[0].data.length)return a.setStart(a.startContainer,
0),this._deleteLeft(a);try{a.moveStart(f.dom.CHARACTER_UNIT,-1),a.moveStart(f.dom.CHARACTER_UNIT,1)}catch(n){}if(f.dom.isOnBlockBoundary(a.startContainer,a.endContainer,this.element)){if(h)return f.dom.remove(e),a.collapse(),!0;if(e&&e.lastChild&&f.dom.isStubElement(e.lastChild))return a.setStartAfter(e.lastChild),a.collapse(!0),!0;(c=a.getLastSelectableChild(e))?(a.setStart(c,c.data.length),a.collapse(!0)):e&&(a.setStart(e,e.childNodes.length),a.collapse(!0));return!0}return(b=a.startContainer)&&
b.nodeType===f.dom.TEXT_NODE?(b=r(b,a.startOffset-1,1),this._addDeleteTracking(b,{range:a,moveLeft:!0,merge:!0}),!0):!1},_removeNode:function(a){var b=a&&a.parentNode;b&&(b.removeChild(a),b!==this.element&&f.dom.hasNoTextOrStubContent(b)&&this._removeNode(b))},_addDeleteTracking:function(a,b){var c=b&&b.moveLeft,e=this._getIceNode(a,"insertType"),h;b=b||{};if(e)return this._addDeletionInInsertNode(a,e,b);if((e=b.range)&&this._getIceNode(a,"deleteType"))return this._deleteInDeleted(a,b);a.previousSibling&&
f.dom.isEmptyTextNode(a.previousSibling)&&a.parentNode.removeChild(a.previousSibling);a.nextSibling&&f.dom.isEmptyTextNode(a.nextSibling)&&a.parentNode.removeChild(a.nextSibling);h=this._getIceNode(a.previousSibling,"deleteType");var l=this._getIceNode(a.nextSibling,"deleteType");if(h&&this._isCurrentUserIceNode(h)){if(h.appendChild(a),l&&this._isCurrentUserIceNode(l)){var g=f.dom.extractContent(l);h.appendChild(g);l.parentNode.removeChild(l)}}else l&&this._isCurrentUserIceNode(l)?(h=l,h.insertBefore(a,
h.firstChild)):(l=this.getAdjacentChangeId(a,c),h=this._createIceNode("deleteType",null,l),b.deleteNodesCollection&&b.deleteNodesCollection.push(h),a.parentNode.insertBefore(h,a),h.appendChild(a));e&&(f.dom.isStubElement(a)?e.selectNode(a):e.selectNodeContents(a),c?e.collapse(!0):e.collapse());h&&(this._normalizeNode(h),e&&e.refresh());return!0},_addDeleteTrackingToBreak:function(a,b){function c(){var k=b&&b.range;k&&(t(a)||f.dom.hasNoTextOrStubContent(a)||e?e?(k.setStartBefore(a),k.setEndBefore(a)):
(k.setStartAfter(a),k.setEndAfter(a)):a.firstChild&&(k.setStartBefore(a.firstChild),k.setEndBefore(a.firstChild)),k.collapse())}var e=Boolean(b&&b.moveLeft);if(t(a)){if(this._isDeleteNode(a))return c();B(a);f.dom.addClass(a,this._getIceNodeClass("deleteType"));var h=this.getAdjacentChangeId(a,e);this._addChange("deleteType",[a],h);c()}else p("addDeleteTracking to BR: not a break element")},_deleteInDeleted:function(a,b){var c=b.range,e=b.moveLeft;this._normalizeNode(a);var h=!1;if(e){for(var l=f.dom.getPrevContentNode(a,
this.element);!h;)(e=this._getIceNode(l,"deleteType"))?l=f.dom.getPrevContentNode(l,this.element):h=!0;l&&((h=c.getLastSelectableChild(l))&&(l=h),c.setStart(l,f.dom.getNodeCharacterLength(l)),c.collapse(!0))}else{for(l=f.dom.getNextContentNode(a,this.element);!h;)(e=this._getIceNode(l,"deleteType"))?l=f.dom.getNextContentNode(l,this.element):h=!0;l&&(c.selectNodeContents(l),c.collapse(!0))}return!0},_addDeletionInInsertNode:function(a,b,c){var e=c&&c.range,h=c&&c.moveLeft;c=c||{};if(this._isCurrentUserIceNode(b))e&&
(h?e.setStartBefore(a):e.setStartAfter(a),e.collapse(h)),a.parentNode.removeChild(a),this._browser.msie||this._normalizeNode(b),c=g(b),0<c.find(".iceBookmark").length?(c=c.clone(),c.find(".iceBookmark").remove(),c=c[0]):c=b,f.dom.hasNoTextOrStubContent(c)&&(e&&(e.setStartBefore(b),e.collapse(!0)),f.dom.replaceWith(b,f.dom.contents(b)));else{var l=u.dom.getNodeIndex(a),p=a.parentNode,r=p.childNodes.length,n;p.removeChild(a);n=this._createIceNode("deleteType");c.deleteNodesCollection&&c.deleteNodesCollection.push(n);
n.appendChild(a);0<l&&l>=r-1?f.dom.insertAfter(b,n):(0<l&&(a=this._splitNode(b,p,l),this._deleteEmptyNode(a)),b.parentNode.insertBefore(n,b));this._deleteEmptyNode(b);e&&h&&(e.setStartBefore(n),e.collapse(!0),this.selection.addRange(e));c&&c.merge&&this._mergeDeleteNode(n);e&&e.refresh()}return!0},_deleteEmptyNode:function(a){var b=a&&a.parentNode;b&&f.dom.hasNoTextOrStubContent(a)&&b.removeChild(a)},_mergeDeleteNode:function(a){var b,c;this._isCurrentUserIceNode(b=this._getIceNode(a.previousSibling,
"deleteType"))?(c=f.dom.extractContent(a),a.parentNode.removeChild(a),b.appendChild(c),this._mergeDeleteNode(b)):this._isCurrentUserIceNode(b=this._getIceNode(a.nextSibling,"deleteType"))&&(c=f.dom.extractContent(b),a.parentNode.removeChild(b),a.appendChild(c),this._mergeDeleteNode(a))},handleEvent:function(a){if(!this._isTracking)return!0;var b=!1;"keypress"==a.type?b=this.keyPress(a):"keydown"==a.type&&(b=!this.handleKeyDown(a));b&&(a.stopImmediatePropagation(),a.preventDefault());return!b},_handleAncillaryKey:function(a){var b=
this._browser,c=!1,e=this.getCurrentRange();switch(a){case f.dom.DOM_VK_DELETE:c=this._deleteContents();break;case 46:c=this._deleteContents(!0);break;case f.dom.DOM_VK_DOWN:case f.dom.DOM_VK_UP:case f.dom.DOM_VK_LEFT:"mozilla"!==b.type||this.visible(e.startContainer)||(e.startContainer.parentNode.previousSibling?(e.setEnd(e.startContainer.parentNode.previousSibling,0),e.moveEnd(f.dom.CHARACTER_UNIT,f.dom.getNodeCharacterLength(e.endContainer))):e.setEnd(e.startContainer.parentNode.nextSibling,0),
e.collapse(!1));c=!1;break;case f.dom.DOM_VK_RIGHT:"mozilla"===b.type&&!this.visible(e.startContainer)&&e.startContainer.parentNode.nextSibling&&(e.setStart(e.startContainer.parentNode.nextSibling,0),e.collapse(!0))}return c},handleKeyDown:function(a){return this._handleSpecialKey(a)?!0:!this.keyPress(a)},onKeyDown:function(a){return this._handleSpecialKey(a)?!1:this._handleAncillaryKey(a)},keyPress:function(a){var b=null;if(a.ctrlKey||a.metaKey)return!1;var c=(b=this.getCurrentRange())&&f.dom.parents(b.startContainer,
"br")[0]||null;c&&b.moveToNextEl(c);b=a.keyCode?a.keyCode:a.which;switch(b){case 32:return this.insert({text:" "});case f.dom.DOM_VK_DELETE:case 46:case f.dom.DOM_VK_DOWN:case f.dom.DOM_VK_UP:case f.dom.DOM_VK_LEFT:case f.dom.DOM_VK_RIGHT:return this._handleAncillaryKey(b);case f.dom.DOM_VK_ENTER:return this._handleEnter(),!1;default:a:if(b){for(var h=e.length,g,c=0;c<h;++c)if(g=e[c],b>=g.start&&b<=g.end){c=!0;break a}c=!1}else c=!0;return c?!1:(b=a["char"]||String.fromCharCode(b))?(a=this._browser.msie?
{text:b}:null,this.insert(a)):!1}},_handleEnter:function(){var a=this.getCurrentRange();a&&!a.collapsed&&this._deleteContents()},_handleSpecialKey:function(a){var b=a.which;null===b&&(b=a.keyCode);switch(b){case 120:case 88:if(!0===a.ctrlKey||!0===a.metaKey)return this.prepareToCut(),!0;break;case 67:case 99:if(!0===a.ctrlKey||!0===a.metaKey)return this.prepareToCopy(),!0}return!1},currentChangeNode:function(a,b,c){var e=this._iceSelector,h=null;if(!a){h=this.getCurrentRange();if(!h)return!1;!1!==
c&&h.collapsed?(this._cleanupSelection(h,!1,!1),a=h.startContainer):a=h.commonAncestorContainer}a=b?g(a).is(e)&&a:f.dom.getNode(a,e);if(!a&&h&&h.collapsed){b=h.endContainer;h=h.endOffset;c=null;if(b.nodeType===f.dom.TEXT_NODE)h===b.length?c=f.dom.getNextNode(b):0===h&&(c=f.dom.getPrevNode(b,this.element));else if(b.nodeType===f.dom.ELEMENT_NODE)if(0===h)c=f.dom.getPrevNode(b,this.element);else if(b.childNodes.length>h){b=b.childNodes[h-1];if(g(b).is(e))return b;c=f.dom.getNextNode(b)}c&&(a=g(c).is(e))}return a},
setShowChanges:function(a){var b=g(this.element);this._isVisible=a=Boolean(a);b.toggleClass("ICE-Tracking",a);this._showTitles(a);this._updateTooltipsState()},reload:function(){this._loadFromDom()},hasChanges:function(){for(var a in this._changes){var b=this._changes[a];if(b&&b.type)return!0}return!1},countChanges:function(a){return this._filterChanges(a).count},setChangeData:function(a){if(null==a||"undefined"==typeof a)a="";this._changeData=String(a)},getDeleteClass:function(){return this._getIceNodeClass("deleteType")},
prepareToCopy:function(){var a=this.getCurrentRange();a&&!a.collapsed&&this._removeTrackingInRange(a)},prepareToCut:function(){var a=this.getCurrentRange(),b=this.hostMethods.getHostRange();if(a&&b&&a.collapsed&&!b.collapsed)try{var c=this.hostMethods.getHostRangeData(b);a.setStart(c.startContainer,c.startOffset);a.setEnd(c.endContainer,c.endOffset)}catch(e){return}if(!a||a.collapsed)return!1;b=this.element;if(a&&b&&!a.collapsed){var h;try{for(;(h=a.endContainer)&&h!==b&&0==a.endOffset&&!a.collapsed&&
(h.previousSibling?a.setEndBefore(h):h.parentNode&&h.parentNode!==b&&a.setEndBefore(h.parentNode),a.endContainer!=h););}catch(l){p(l,"fixSelection, while trying to set end")}try{for(;(h=a.startContainer)&&h!==b&&!a.collapsed&&(h=a.startContainer,h.nodeType==f.dom.TEXT_NODE?a.startOffset>=h.nodeValue.length&&a.setStartAfter(h):a.startOffset>=h.childNodes.length&&a.setStartAfter(h),a.startContainer!=h););}catch(g){p(g,"fixSelection, while trying to set start")}}b=a.cloneContents();h=a.cloneRange();
var c=b.firstChild,r=b.lastChild;this.hostMethods.beforeEdit();a.collapse(!1);a.insertNode(b);a.setStartBefore(c);a.setEndAfter(r);b=this._startBatchChange();try{this._deleteSelection(a)}catch(n){p(n,"While trying to delete selection")}finally{this._endBatchChange(b),this.selection.addRange(h),this._removeTrackingInRange(h,!1)}return!0},toString:function(){return"ICE "+(this.element&&this.element.id||"(no element id)")},_splitNode:function(a,b,c){var e=a.parentNode,h=u.dom.getNodeIndex(a),l=b.ownerDocument.createRange();
l.setStart(e,h);l.setEnd(b,c);b=l.extractContents();e.insertBefore(b,a);this.isInsideChange(a,!0)&&this._updateNodeTooltip(a.previousSibling);return a.previousSibling},_triggerChange:function(a){this._isTracking&&(this.$this.trigger("change"),a&&a.isText&&this.$this.trigger("textChange"))},_updateNodeTooltip:function(a){this.tooltips&&this._isVisible&&this._addTooltip(a)},_acceptRejectSome:function(a,b){var c=function(a,c){this.acceptRejectChange(c,{isAccept:b,notify:!1})}.bind(this),e=this._filterChanges(a),
h;for(h in e.changes)g(this.element).find("["+this.attributes.changeId+"\x3d"+h+"]").each(c);e.count&&this._triggerChange({isText:!0})},_filterChanges:function(a){var b=0,c={},e;e=a||{};a=e.filter;var h=e.exclude?g.map(e.exclude,function(a){return String(a)}):null,l=e.include?g.map(e.include,function(a){return String(a)}):null,f=e.verify,p=null,n;for(n in this._changes)(e=this._changes[n])&&e.type&&(p=a&&!a({userid:e.userid,time:e.time,data:e.data})||h&&0<=h.indexOf(e.userid)||l&&0>l.indexOf(e.userid),
p||(f&&(p=g(this.element).find("["+this.attributes.changeId+"]"),p=!p.length),p||(++b,c[n]=e)));return{count:b,changes:c}},_loadFromDom:function(){this._changes={};this._uniqueStyleIndex=0;var a=this.currentUser&&this.currentUser.id,b=this.currentUser&&this.currentUser.name||"",c=(new Date).getTime(),e,h=new RegExp(this.stylePrefix+"-(\\d+)"),l=[],f;for(f in this.changeTypes)l.push(this._getIceNodeClass(f));f=this.getIceNodes();var g=function(f,g){var p=0,r,x="",y=g.className.split(" ");for(f=0;f<
y.length;f++){if(e=h.exec(y[f]))r=e[0],p=e[1];var u=(new RegExp("("+l.join("|")+")")).exec(y[f]);u&&(x=this._getChangeTypeFromAlias(u[1]))}y=g.getAttribute(this.attributes.userId);a&&y==a?(u=b,g.setAttribute(this.attributes.userName,b)):u=g.getAttribute(this.attributes.userName);this._setUserStyle(y,Number(p));p=parseInt(g.getAttribute(this.attributes.changeId)||"");isNaN(p)&&(p=this.getNewChangeId(),g.setAttribute(this.attributes.changeId,p));var t=parseInt(g.getAttribute(this.attributes.time)||
"");isNaN(t)&&(t=c);var B=parseInt(g.getAttribute(this.attributes.lastTime)||"");isNaN(B)&&(B=t);var D=g.getAttribute(this.attributes.sessionId),A=g.getAttribute(this.attributes.changeData)||"";this._changes[p]={type:x,style:r,userid:String(y),username:u,time:t,lastTime:B,sessionId:D,data:A};this._updateNodeTooltip(g)}.bind(this);f.each(g);this._triggerChange()},_showTitles:function(a){var b=this.getIceNodes();a?g(b).each(function(a,b){this._updateNodeTooltip(b)}.bind(this)):g(b).removeAttr("title")},
_updateTooltipsState:function(){var a,b=this;this.tooltips&&this._isVisible?this._showingTips||(this._showingTips=!0,a=this.getIceNodes(),a.each(function(a,c){b._addTooltip(c)})):this._showingTips&&(this._showingTips=!1,a=this.getIceNodes(),a.each(function(a,b){g(b).unbind("mouseover").unbind("mouseout")}))},_addTooltip:function(a){g(a).unbind("mouseover").unbind("mouseout").mouseover(this._tooltipMouseOver).mouseout(this._tooltipMouseOut)},_tooltipMouseOver:function(a){var b=a.currentTarget,c=g(b),
e=this;a.buttons||c.data("_tooltip_t")||(a=setTimeout(function(){var a=e.currentChangeNode(b),h=a&&a.getAttribute(e.attributes.changeId),g=h&&e.getChange(h);g&&(a=f.dom.hasClass(a,e._getIceNodeClass("insertType"))?"insert":"delete",c.removeData("_tooltip_t"),e.hostMethods.showTooltip(b,{userName:g.username,changeId:h,userId:g.userid,time:g.time,lastTime:g.lastTime,type:a}))},this.tooltipsDelay),c.data("_tooltip_t",a))},_tooltipMouseOut:function(a){a=a.currentTarget;var b=g(a),c=b.data("_tooltip_t");
b.removeData("_tooltip_t");c?clearTimeout(c):this.hostMethods.hideTooltip(a)},_removeTrackingInRangeOld:function(a){var b=this._getIceNodeClass("insertType"),c=this._getIceNodeClass("deleteType"),e="."+b+",."+c;a.getNodes(null,function(a){var b=null;a.nodeType==f.dom.TEXT_NODE?b=g(a).parents(e):(a=g(a),b=a.is(e)?a:a.parents(e));return(a=b&&b[0])?(a.setAttribute("data-ice-class",a.className),a.setAttribute("class","ice-no-decoration"),!0):!1});var h=this.element;setTimeout(function(){g(h).find("[data-ice-class]").each(function(a,
b){var c=b.getAttribute("data-ice-class");c&&(b.setAttribute("class",c),b.removeAttribute("data-ice-class"))})},10)},_removeTrackingInRange:function(a){var b=this._getIceNodeClass("insertType"),c=this._getIceNodeClass("deleteType"),e="."+b+",."+c,h=this._savedNodesMap,l=Date.now()%1E6;a.getNodes(null,function(a){var b=null;a.nodeType==f.dom.TEXT_NODE?b=g(a).parents(e):(a=g(a),b=a.is(e)?a:a.parents(e));if(a=b&&b[0]){for(var c=a.attributes,d,k=c&&c.length,b={},p=0;p<k;++p)d=c[p],b[d.name]=d.value;d=
a.className;c=String(l++);h[c]={attributes:b,className:d};a:{var b=null,r;try{for(;0<a.attributes.length;){r=a.attributes[0];if(r===b)break a;b=r;a.removeAttribute(r.name)}}catch(y){}}a.setAttribute("data-ice-class",c);a.setAttribute("class","ice-no-decoration");return!0}return!1});var r=this.element;setTimeout(function(){g(r).find("[data-ice-class]").each(function(a,b){var c=b.getAttribute("data-ice-class"),e=h[c];c?(delete h[c],Object.keys(e.attributes).forEach(function(a){b.setAttribute(a,e.attributes[a])}),
b.setAttribute("class",e.className),b.removeAttribute("data-ice-class")):p("missing save data for node")})},10)},_onDomMutation:function(a){var b,c=a.length,e,f,g;for(b=0;b<c;++b)switch(e=a[b],e.type){case "childList":for(f=e.addedNodes,e=f.length-1;0<=e;--e)g=f[e],h.log("mutation: added node",g.tagName)}},_setDomObserverTimeout:function(){var a=this;this._domObserverTimeout&&window.clearTimeout(this._domObserverTimeout);this._domObserverTimeout=window.setTimeout(function(){a._domObserverTimeout=
null;a._domObserver.disconnect()},1)},getAdjacentChangeId:function(a,b){var c=b?f.dom.getNextNode(a):f.dom.getPrevNode(a),e,h=null;(e=this._getIceNode(c,"insertType")||this._getIceNode(c,"deleteType"))||!this._isInsertNode(c)&&!this._isDeleteNode(c)||(e=c);e&&this._isCurrentUserIceNode(e)&&(h=e.getAttribute(this.attributes.changeId));return h}};var h=window&&window.console||{log:function(){},error:function(){},info:function(){},assert:function(){},count:function(){}},p=null;f.printRange=function(a,
b){function c(a){if(!a)return"";a=a.replace("/\n/g","\\n").replace("/\r/g","").replace("​","{filler}").replace("﻿","{filler}");return 15>=a.length?a:a.substring(0,5)+"..."+a.substring(a.length-5)}function e(a){if(3===a.nodeType)a="Text:"+c(a.nodeValue);else{var b=a.innerText;a=a.nodeName+(b?"("+c(b)+")":"")}g.push("\x3c"+a+" /\x3e")}function f(a,b,d){"number"!==typeof d&&(d=-1);if(3==a.nodeType)a=a.nodeValue,g.push(c(a.substring(0,b))),g.push("|"),d>b?(g.push(c(a.substring(b,d))),g.push("|"),g.push(c(a.substring(d)))):
g.push(c(a.substring(b)));else if(1==a.nodeType){var h=0,p=a.childNodes;e(a);for(h=0;h<b;++h)e(p[h]);g.push("|");if(d>b){for(h=b;h<d;++h)e(p[h]);g.push("|")}if(0<d&&d<p.length)for(b=p[d];b;)e(b),b=b.nextSibling}}if(a&&a.startContainer&&a.endContainer){var g=[];a.startContainer===a.endContainer?f(a.startContainer,a.startOffset,a.endOffset):(f(a.startContainer,a.startOffset),f(a.endContainer,a.endOffset));var p=g.join(" ");b&&h.log(b+":"+p);return p}};f.InlineChangeEditor=b})(this.ice||window.ice,window.jQuery);
(function(f,g){function A(b,e){for(;b;){if(c.TEXT_NODE==b.nodeType)return b;for(var h=b.firstChild;h;h=h.nextSibling){var f=A(h,e);if(f)return f}if(c.isTextContainer(b))return b;b=b.nextSibling}return null}function B(b,e){for(;b;){if(c.TEXT_NODE==b.nodeType)return b;for(var h=b.lastChild;h;h=h.previousSibling){var f=B(h,e);if(f)return f}if(c.isTextContainer(b))return b;b=b.previousSibling}return null}function t(b){if(b)for(var c=b.firstChild;c;){if(1==c.nodeType)t(c);else if(3==c.nodeType)for(var h;(h=
c.nextSibling)&&3==h.nodeType;){var f=h.nodeValue;null!=f&&f.length&&(c.nodeValue+=f);b.removeChild(h)}c=c.nextSibling}}var c={},r=null,y=/^\s*$/,u=/^\d+$/;c.DOM_VK_DELETE=8;c.DOM_VK_LEFT=37;c.DOM_VK_UP=38;c.DOM_VK_RIGHT=39;c.DOM_VK_DOWN=40;c.DOM_VK_ENTER=13;c.ELEMENT_NODE=1;c.ATTRIBUTE_NODE=2;c.TEXT_NODE=3;c.CDATA_SECTION_NODE=4;c.ENTITY_REFERENCE_NODE=5;c.ENTITY_NODE=6;c.PROCESSING_INSTRUCTION_NODE=7;c.COMMENT_NODE=8;c.DOCUMENT_NODE=9;c.DOCUMENT_TYPE_NODE=10;c.DOCUMENT_FRAGMENT_NODE=11;c.NOTATION_NODE=
12;c.CHARACTER_UNIT="character";c.WORD_UNIT="word";c.BREAK_ELEMENT="br";c.PARAGRAPH_ELEMENT="p";c.CONTENT_STUB_ELEMENTS="img hr iframe param link meta input frame col base area".split(" ");c.BLOCK_ELEMENTS="body p div pre ul ol li table tbody td th fieldset form blockquote dl dt dd dir center address h1 h2 h3 h4 h5 h6".split(" ");c.TEXT_CONTAINER_ELEMENTS="body p div pre span b strong i li td th blockquote dt dd center address h1 h2 h3 h4 h5 h6 ins del".split(" ");c.STUB_ELEMENTS=c.CONTENT_STUB_ELEMENTS.slice();
c.STUB_ELEMENTS.push(c.BREAK_ELEMENT);var E=c.CONTENT_STUB_ELEMENTS.join(", ");c.isEmptyString=function(b){if(!b)return!0;for(var c=b.length-1,h;0<=c;)if(h=b[c--],"​"!==h&&"﻿"!==h)return!1;return!0};c.getKeyChar=function(b){return String.fromCharCode(b.which)};c.getClass=function(b,c,h){c||(c=document.body);b="."+b.split(" ").join(".");h&&(b=h+b);return g.makeArray(g(c).find(b))};c.getId=function(b,c){c||(c=document);return element=c.getElementById(b)};c.getTag=function(b,c){c||(c=document);return g.makeArray(g(c).find(b))};
c.getElementWidth=function(b){return b.offsetWidth};c.getElementHeight=function(b){return b.offsetHeight};c.getElementDimensions=function(b){return{width:c.getElementWidth(b),height:c.getElementHeight(b)}};c.insertBefore=function(b,c){g(b).before(c)};c.insertAfter=function(b,c){if(b&&c){var h=b.nextSibling,f=b.parentNode;return h?f.insertBefore(c,h):f.appendChild(c)}};c.removeWhitespace=function(b){g(b).contents().filter(function(){return this.nodeType!=f.dom.TEXT_NODE&&"UL"==this.nodeName||"OL"==
this.nodeName?(c.removeWhitespace(this),!1):this.nodeType!=f.dom.TEXT_NODE?!1:!/\S/.test(this.nodeValue)}).remove()};c.contents=function(b){return g.makeArray(g(b).contents())};c.extractContent=function(b){for(var c=document.createDocumentFragment(),h;h=b.firstChild;)c.appendChild(h);return c};c.getNode=function(b,e){if(!b)return null;b=b.$||b;return b.nodeType!=c.TEXT_NODE&&g(b).is(e)?b:c.parents(b,e)[0]||null};c.getParents=function(b,c,h){b=g(b).parents(c);c=b.length;for(var f=[],a=0;a<c&&b[a]!==
h;a++)f.push(b[a]);return f};c.hasBlockChildren=function(b){for(var e=b.childNodes.length,h=0;h<e;h++)if(b.childNodes[h].nodeType===c.ELEMENT_NODE&&!0===c.isBlockElement(b.childNodes[h]))return!0;return!1};c.removeTag=function(b,c){g(b).find(c).replaceWith(function(){return g(this).contents()});return b};c.stripEnclosingTags=function(b,c){var h=g(b);h.find("*").not(c).replaceWith(function(){var b=g(),a;try{a=g(this),b=a.contents()}catch(c){}0===b.length&&a.remove();return b});return h[0]};c.getSiblings=
function(b,c,h,f){if(!0===h)return"prev"===c?g(b).prevAll():g(b).nextAll();h=[];if("prev"===c)for(;b.previousSibling;){b=b.previousSibling;if(b===f)break;h.push(b)}else for(;b.nextSibling;){b=b.nextSibling;if(b===f)break;h.push(b)}return h};c.getNodeTextContent=function(b){return g(b).text()};c.getNodeStubContent=function(b){return g(b).find(E)};c.hasNoTextOrStubContent=function(b){var e=c.getNodeTextContent(b);return c.isEmptyString(e)?b.firstChild?0===g(b).find(E).length:!0:!1};c.isEmptyTextNode=
function(b){return b&&c.TEXT_NODE===b.nodeType?0===b.length?!0:c.isEmptyString(b.nodeValue):!1};c.getNodeCharacterLength=function(b){return c.getNodeTextContent(b).length+g(b).find(c.STUB_ELEMENTS.join(", ")).length};c.setNodeTextContent=function(b,c){return g(b).text(c)};c.getTagName=function(b){return b&&b.tagName&&b.tagName.toLowerCase()||null};c.getIframeDocument=function(b){var c=null;b.contentDocument?c=b.contentDocument:b.contentWindow?c=b.contentWindow.document:b.document&&(c=b.document);
return c};c.isBlockElement=function(b){return-1!=c.BLOCK_ELEMENTS.indexOf(b.nodeName.toLowerCase())};c.isStubElement=function(b){return-1!=c.STUB_ELEMENTS.indexOf(b.nodeName.toLowerCase())};c.removeBRFromChild=function(b){if(b&&b.hasChildNodes())for(var c=0;c<b.childNodes.length;c++){var h=b.childNodes[c];h&&f.dom.BREAK_ELEMENT==f.dom.getTagName(h)&&h.parentNode.removeChild(h)}};c.isChildOf=function(b,c){try{for(;b&&b.parentNode;){if(b.parentNode===c)return!0;b=b.parentNode}}catch(h){}return!1};c.isChildOfTagName=
function(b,c){try{for(;b&&b.parentNode;){if(b.parentNode&&b.parentNode.tagName&&b.parentNode.tagName.toLowerCase()===c)return b.parentNode;b=b.parentNode}}catch(h){}return!1};c.isChildOfTagNames=function(b,c){try{for(;b&&b.parentNode;){if(b.parentNode&&b.parentNode.tagName){tagName=b.parentNode.tagName.toLowerCase();for(var h=0;h<c.length;h++)if(tagName===c[h])return b.parentNode}b=b.parentNode}}catch(f){}return null};c.isChildOfClassName=function(b,c){try{for(;b&&b.parentNode;){if(g(b.parentNode).hasClass(c))return b.parentNode;
b=b.parentNode}}catch(h){}return null};c.replaceWith=function(b,c){return g(b).replaceWith(c)};c.getElementsBetween=function(b,e){var h=[];if(b===e)return h;if(!0===c.isChildOf(e,b)){for(var f=b.childNodes.length,a=0;a<f&&b.childNodes[a]!==e;a++){if(!0===c.isChildOf(e,b.childNodes[a]))return c.arrayMerge(h,c.getElementsBetween(b.childNodes[a],e));h.push(b.childNodes[a])}return h}for(f=b.nextSibling;f;){if(!0===c.isChildOf(e,f))return h=c.arrayMerge(h,c.getElementsBetween(f,e));if(f===e)return h;h.push(f);
f=f.nextSibling}for(var f=c.getParents(b),a=c.getParents(e),f=c.arrayDiff(f,a,!0),a=f.length,d=0;d<a-1;d++)h=c.arrayMerge(h,c.getSiblings(f[d],"next"));return h=c.arrayMerge(h,c.getElementsBetween(f[f.length-1],e))};c.getCommonAncestor=function(b,e){for(var h=b;h;){if(!0===c.isChildOf(e,h))return h;h=h.parentNode}return null};c.getNextNode=function(b,e){if(b)for(;b.parentNode&&b!==e;){if(b.nextSibling){if(b.nextSibling.nodeType===c.TEXT_NODE&&0===b.nextSibling.length){b=b.nextSibling;continue}return c.getFirstChild(b.nextSibling)}b=
b.parentNode}return null};c.getNextContentNode=function(b,e){if(b)for(;b.parentNode&&b!==e;){if(b.nextSibling&&c.canContainTextElement(c.getBlockParent(b))){if(b.nextSibling.nodeType===c.TEXT_NODE&&0===b.nextSibling.length){b=b.nextSibling;continue}return b.nextSibling}if(b.nextElementSibling)return b.nextElementSibling;b=b.parentNode}return null};c.getPrevNode=function(b,e){if(b)for(;b.parentNode&&b!==e;){if(b.previousSibling){if(b.previousSibling.nodeType===c.TEXT_NODE&&0===b.previousSibling.length){b=
b.previousSibling;continue}return c.getLastChild(b.previousSibling)}b=b.parentNode}return null};c.getPrevContentNode=function(b,e){if(b)for(;b.parentNode&&b!==e;){if(b.previousSibling&&c.canContainTextElement(c.getBlockParent(b))){if(b.previousSibling.nodeType===c.TEXT_NODE&&0===b.previousSibling.length){b=b.previousSibling;continue}return b.previousSibling}if(b.previousElementSibling)return b.previousElementSibling;b=b.parentNode}return null};c.findPrevTextContainer=function(b,e){if(!b||b==e)return{node:e,
offset:0};if(b.parentNode&&c.isTextContainer(b.parentNode))return{node:b.parentNode,offset:c.getNodeIndex(b)};for(;b.previousSibling;){var h=B(b.previousSibling);if(h)return{node:h,offset:c.getNodeLength(h)};b=b.previousSibling}return c.findPrevTextContainer(b.parentNode&&b.parentNode.previousSibling,e)};c.findNextTextContainer=function(b,e){if(!b||b==e)return{node:e,offset:c.getNodeLength(e)};if(b.parentNode&&c.isTextContainer(b.parentNode))return{node:b.parentNode,offset:c.getNodeIndex(b)+1};for(;b.nextSibling;){var h=
A(b.nextSibling);if(h)return{node:h,offset:0};b=b.previousSibling}return c.findNextTextContainer(b.parentNode&&b.parentNode.nextSibling,e)};c.getNodeLength=function(b){return b?c.TEXT_NODE==b.nodeType?b.length:b.childNodes&&b.childNodes.length||0:0};c.isTextContainer=function(b){return b&&c.TEXT_NODE==b.nodeType||0<=c.TEXT_CONTAINER_ELEMENTS.indexOf((b.nodeName||"").toLowerCase())};c.getNodeIndex=function(b){for(var c=0;b=b.previousSibling;)++c;return c};c.canContainTextElement=function(b){return b&&
b.nodeName?-1!=c.TEXT_CONTAINER_ELEMENTS.lastIndexOf(b.nodeName.toLowerCase()):!1};c.getFirstChild=function(b){return b.firstChild?b.firstChild.nodeType===c.ELEMENT_NODE?c.getFirstChild(b.firstChild):b.firstChild:b};c.getLastChild=function(b){return b.lastChild?b.lastChild.nodeType===c.ELEMENT_NODE?c.getLastChild(b.lastChild):b.lastChild:b};c.removeEmptyNodes=function(b,e){for(var h=g(b).find(":empty"),f=h.length;0<f;)f--,!1===c.isStubElement(h[f])&&(e&&!1===e.call(this,h[f])||c.remove(h[f]))};c.create=
function(b){return g(b)[0]};c.children=function(b,c){return g(b).children(c)};c.parent=function(b,c){return g(b).parent(c)[0]};c.parents=function(b,c){return g(b).parents(c)};c.walk=function(b,e,h){b&&(h||(h=0),!1!==e.call(this,b,h)&&(b.childNodes&&0<b.childNodes.length?c.walk(b.firstChild,e,h+1):b.nextSibling?c.walk(b.nextSibling,e,h):b.parentNode&&b.parentNode.nextSibling&&c.walk(b.parentNode.nextSibling,e,h-1)))};c.revWalk=function(b,e){b&&!1!==e.call(this,b)&&(b.childNodes&&0<b.childNodes.length?
c.walk(b.lastChild,e):b.previousSibling?c.walk(b.previousSibling,e):b.parentNode&&b.parentNode.previousSibling&&c.walk(b.parentNode.previousSibling,e))};c.setStyle=function(b,c,h){b&&g(b).css(c,h)};c.getStyle=function(b,c){return g(b).css(c)};c.hasClass=function(b,c){return g(b).hasClass(c)};c.addClass=function(b,c){g(b).addClass(c)};c.removeClass=function(b,c){g(b).removeClass(c)};c.preventDefault=function(b){b.preventDefault();c.stopPropagation(b)};c.stopPropagation=function(b){b.stopPropagation()};
c.isBlank=function(b){return!b||y.test(b)};c.isFn=function(b){return"function"===typeof b};c.isObj=function(b){return null!==b&&"object"===typeof b};c.isset=function(b){return"undefined"!==typeof b&&null!==b};c.isArray=function(b){return g.isArray(b)};c.isNumeric=function(b){return null!==b.match(u)};c.getUniqueId=function(){var b=(new Date).getTime(),c=Math.ceil(1E6*Math.random());return(b+""+c).substr(5,18).replace(/,/,"")};c.inArray=function(b,c){for(var h=c.length,f=0;f<h;f++)if(b===c[f])return!0;
return!1};c.arrayDiff=function(b,e,h){var f=b.length,a,d=[];for(a=0;a<f;a++)!1===c.inArray(b[a],e)&&d.push(b[a]);if(!0!==h)for(f=e.length,a=0;a<f;a++)!1===c.inArray(e[a],b)&&d.push(e[a]);return d};c.arrayMerge=function(b,c){var h=c.length,f;for(f=0;f<h;f++)b.push(c[f]);return b};c.stripTags=function(b,e){if("string"===typeof e){var h=g("\x3cdiv\x3e"+b+"\x3c/div\x3e");h.find("*").not(e).remove();return h.html()}for(var f=new RegExp(/<\/?(\w+)((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim),
a=b;null!=(h=f.exec(b));)if(!1===c.isset(e)||!0!==c.inArray(h[1],e))a=a.replace(h[0],"");return a};c.browser=function(){if(r)return g.extend({},r);var b,c,f=navigator.userAgent.toLowerCase();b=f.toLowerCase();c=/(chrome)[ \/]([\w.]+)/.exec(b)||/(webkit)[ \/]([\w.]+)/.exec(b)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(b)||/(msie) ([\w.]+)/.exec(b)||0>b.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(b)||[];b=c[1]||"";c=c[2]||"0";var p={type:"unknown",version:0,msie:!1};b&&(p[b]=!0,p.version=
c||0,p.type=b);p.chrome?p.webkit=!0:p.webkit&&(p.safari=!0);p.webkit&&(p.type="webkit");p.firefox=1==/firefox/.test(f);p.msie||(p.msie=Boolean(/trident/.test(f)));r=p;return g.extend({},r)};c.getBrowserType=function(){if(null===this._browserType){for(var b=["msie","firefox","chrome","safari"],c=b.length,f=0;f<c;f++)if(!0===(new RegExp(b[f],"i")).test(navigator.userAgent))return this._browserType=b[f];this._browserType="other"}return this._browserType};c.getWebkitType=function(){return"webkit"!==c.browser().type?
(console.log("Not a webkit!"),!1):0<Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")?"safari":"chrome"};c.isBrowser=function(b){return c.browser().type===b};c.getBlockParent=function(b,e){if(!0===c.isBlockElement(b))return b;if(b)for(;b.parentNode;){b=b.parentNode;if(!0===c.isBlockElement(b))return b;if(b===e)break}return null};c.findNodeParent=function(b,c,f){if(b)for(;b.parentNode&&b!==f;){if(!0===g(b).is(c))return b;b=b.parentNode}return null};c.onBlockBoundary=function(b,
e,f){if(!b||!e)return!1;var p=f.join(", ");b=c.isChildOfTagNames(b,f)||g(b).is(p)&&b||null;e=c.isChildOfTagNames(e,f)||g(e).is(p)&&e||null;return b!==e};c.isOnBlockBoundary=function(b,e,f){if(!b||!e)return!1;b=c.getBlockParent(b,f)||c.isBlockElement(b,f)&&b||null;e=c.getBlockParent(e,f)||c.isBlockElement(e,f)&&e||null;return b!==e};c.mergeContainers=function(b,e){if(!b||!e)return!1;if(b.nodeType===c.TEXT_NODE||c.isStubElement(b))e.appendChild(b);else if(b.nodeType===c.ELEMENT_NODE){for(;b.firstChild;)e.appendChild(b.firstChild);
g(b).remove()}return!0};c.mergeBlockWithSibling=function(b,e,f){var p=f?g(e).next().get(0):g(e).prev().get(0);f?c.mergeContainers(p,e):c.mergeContainers(e,p);b.collapse(!0);return!0};c.date=function(b,e,f){if(null===e&&f&&(e=c.tsIso8601ToTimestamp(f),!e))return;e=new Date(e);b=b.split("");f=b.length;for(var g="",a=0;a<f;a++){var d="",k=b[a];switch(k){case "D":case "l":d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")[e.getDay()];"D"===k&&(d=d.substring(0,3));break;case "F":case "m":d=
e.getMonth()+1;10>d&&(d="0"+d);break;case "M":months="January February March April May June July August September October November December".split(" ");d=months[e.getMonth()];"M"===k&&(d=d.substring(0,3));break;case "d":d=e.getDate();break;case "S":d=c.getOrdinalSuffix(e.getDate());break;case "Y":d=e.getFullYear();break;case "y":d=e.getFullYear();d=d.toString().substring(2);break;case "H":d=e.getHours();break;case "h":d=e.getHours();0===d?d=12:12<d&&(d-=12);break;case "i":d=c.addNumberPadding(e.getMinutes());
break;case "a":d="am";12<=e.getHours()&&(d="pm");break;default:d=k}g+=d}return g};c.getOrdinalSuffix=function(b){var c="",c=b%100;if(4<=c&&20>=c)c="th";else switch(b%10){case 1:c="st";break;case 2:c="nd";break;case 3:c="rd";break;default:c="th"}return c};c.addNumberPadding=function(b){10>b&&(b="0"+b);return b};c.tsIso8601ToTimestamp=function(b){if(b=b.match(new RegExp(/(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d)(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(?:Z|(?:([-+])(\d\d)(?::?(\d\d))?)?)?)?)?)?/))){var c=
new Date;c.setDate(b[3]);c.setFullYear(b[1]);c.setMonth(b[2]-1);c.setHours(b[4]);c.setMinutes(b[5]);c.setSeconds(b[6]);var f=60*b[9];"+"===b[8]&&(f*=-1);f-=c.getTimezoneOffset();return c.getTime()+6E4*f}return null};c.normalizeNode=function(b,e){if(b)return c.browser().msie||!0===e||"function"!=typeof b.normalize?t(b):b.normalize()};f.dom=c})(this.ice||window.ice,window.jQuery);
(function(f){var g=f.rangy,A;A=function(f){this._selection=null;this.env=f;this._initializeRangeLibrary();this._getSelection()};A.prototype={_getSelection:function(){this._selection?this._selection.refresh():this._selection=this.env.frame?g.getSelection(this.env.frame):g.getSelection();return this._selection},createRange:function(){return g.createRange(this.env.document)},getRangeAt:function(f){try{return this._selection.refresh(),this._selection.getRangeAt(f)}catch(g){this._selection=null;try{return this._getSelection().getRangeAt(0)}catch(c){}}return null},
addRange:function(f){this._selection||(this._selection=this._getSelection());this._selection.setSingleRange(f);this._selection.ranges=[f]},_initializeRangeLibrary:function(){var f=this;g.init();g.config.checkSelectionRanges=!1;var t=function(c,f,g,u){if(0!==g){var t=c.collapsed;switch(f){case ice.dom.CHARACTER_UNIT:0<g?c.moveCharRight(u,g):c.moveCharLeft(u,-1*g)}t&&c.collapse(u)}};g.rangePrototype.moveStart=function(c,f){t(this,c,f,!0)};g.rangePrototype.moveEnd=function(c,f){t(this,c,f,!1)};g.rangePrototype.setRange=
function(c,f,g){c?this.setStart(f,g):this.setEnd(f,g)};g.rangePrototype.moveCharLeft=function(c,f){var g,u;c?(g=this.startContainer,u=this.startOffset):(g=this.endContainer,u=this.endOffset);if(g.nodeType===ice.dom.ELEMENT_NODE)if(g.hasChildNodes()&&0<u){g=g.childNodes[u-1];g=(u=this.getLastSelectableChild(g))?u:this.getPreviousTextNode(g);if(!g)return;u=g.data.length-f}else u=-1*f;else u-=f;if(0>u)for(;0>u;){g=this.getPreviousTextNode(g);if(!g)return;g.nodeType!==ice.dom.ELEMENT_NODE&&(u+=g.data.length)}this.setRange(c,
g,u)};g.rangePrototype.moveCharRight=function(c,f){var g,u;c?(g=this.startContainer,u=this.startOffset):(g=this.endContainer,u=this.endOffset);g.nodeType===ice.dom.ELEMENT_NODE?(g=(u=this.getNextTextNode(g.childNodes[Math.min(u,g.childNodes.length-1)]))?u:this.getNextTextNode(g),u=f):u+=f;if(g){var t=u-g.data.length;if(0<t){for(;0<t;){g=this.getNextContainer(g);if(!g)return;if(g.nodeType!==ice.dom.ELEMENT_NODE)if(g.data.length>=t)break;else 0<g.data.length&&(t-=g.data.length)}u=t}this.setRange(c,
g,u)}};g.rangePrototype.getNextContainer=function(c,f){if(!c)return null;for(f=f||[];c.nextSibling;)if(c=c.nextSibling,c.nodeType!==ice.dom.TEXT_NODE){var g=this.getFirstSelectableChild(c);if(null!==g)return g}else if(!0===this.isSelectable(c))return c;for(;c&&!c.nextSibling;)c=c.parentNode;if(!c)return null;c=c.nextSibling;if(!0===this.isSelectable(c))return c;!0===ice.dom.isBlockElement(c)&&f.push(c);g=this.getFirstSelectableChild(c);return null!==g?g:this.getNextContainer(c,f)};g.rangePrototype.getPreviousContainer=
function(c,f){if(!c)return null;for(f=f||[];c.previousSibling;)if(c=c.previousSibling,c.nodeType!==ice.dom.TEXT_NODE){if(!0===ice.dom.isStubElement(c))return c;var g=this.getLastSelectableChild(c);if(null!==g)return g}else if(!0===this.isSelectable(c))return c;for(;c&&!c.previousSibling;)c=c.parentNode;if(!c)return null;c=c.previousSibling;if(!0===this.isSelectable(c))return c;!0===ice.dom.isBlockElement(c)&&f.push(c);g=this.getLastSelectableChild(c);return null!==g?g:this.getPreviousContainer(c,
f)};g.rangePrototype.getNextTextNode=function(c){if(c.nodeType===ice.dom.ELEMENT_NODE&&c.firstChild){var f=this.getFirstSelectableChild(c);if(f)return f}return(c=this.getNextContainer(c))?c.nodeType===ice.dom.TEXT_NODE?c:this.getNextTextNode(c):null};g.rangePrototype.getPreviousTextNode=function(c,f){return(c=this.getPreviousContainer(c,f))?c.nodeType===ice.dom.TEXT_NODE?c:this.getPreviousTextNode(c,f):null};g.rangePrototype.getFirstSelectableChild=function(c){if(!c)return null;if(c.nodeType===ice.dom.TEXT_NODE)return c;
for(c=c.firstChild;c;){if(!0===this.isSelectable(c))return c;if(c.firstChild){var f=this.getFirstSelectableChild(c);if(null!==f)return f}c=c.nextSibling}return null};g.rangePrototype.getLastSelectableChild=function(c){if(!c)return null;if(c.nodeType==ice.dom.TEXT_NODE)return c;for(c=c.lastChild;c;){if(!0===this.isSelectable(c))return c;if(c.lastChild){var f=this.getLastSelectableChild(c);if(null!==f)return f}c=c.previousSibling}return null};g.rangePrototype.isSelectable=function(c){return Boolean(c&&
c.nodeType===ice.dom.TEXT_NODE&&0!==c.data.length)};g.rangePrototype.getHTMLContents=function(c){c||(c=this.cloneContents());var g=f.env.document.createElement("div");g.appendChild(c.cloneNode(!0));return g.innerHTML};g.rangePrototype.getHTMLContentsObj=function(){return this.cloneContents()}}};f.Selection=A})(this.ice||window.ice);
(function(f,g){var A;A=function(B,t,c){this.env=B;this.element=B.element;this.selection=this.env.selection;c||this.removeBookmarks(this.element);B=t||this.selection.getRangeAt(0);t=B.cloneRange();var r=t.startContainer,y=t.startOffset,u;t.collapse(!1);c=this.env.document.createElement("span");c.style.display="none";g(c).html("\x26nbsp;").addClass("iceBookmark iceBookmark_end").attr("iceBookmark","end");t.insertNode(c);f.dom.isChildOf(c,this.element)||this.element.appendChild(c);t.setStart(r,y);t.collapse(!0);
r=this.env.document.createElement("span");r.style.display="none";g(r).addClass("iceBookmark iceBookmark_start").html("\x26nbsp;").attr("iceBookmark","start");try{t.insertNode(r),r.previousSibling===c&&(u=r,r=c,c=u)}catch(A){f.dom.insertBefore(c,r)}!1===f.dom.isChildOf(r,this.element)&&(this.element.firstChild?f.dom.insertBefore(this.element.firstChild,r):this.element.appendChild(r));c.previousSibling||(u=this.env.document.createTextNode(""),f.dom.insertBefore(c,u));r.nextSibling||(u=this.env.document.createTextNode(""),
f.dom.insertAfter(r,u));B.setStart(r.nextSibling,0);B.setEnd(c.previousSibling,c.previousSibling.length||0);this.start=r;this.end=c};A.prototype={selectStartAndCollapse:function(){if(this.start){var f=this.selection.getRangeAt(0);f.setStartBefore(this.start);f.collapse(!0);g([this.start,this.end]).remove();try{this.selection.addRange(f)}catch(t){}}},remove:function(){this.start&&(g([this.start,this.end]).remove(),this.start=this.end=null)},selectBookmark:function(){var B=this.selection.getRangeAt(0),
t=null,c=null,r=0,y=null,u=this.start&&this.start.parentNode;this.start.nextSibling===this.end||0===f.dom.getElementsBetween(this.start,this.end).length?this.end.nextSibling?t=f.dom.getFirstChild(this.end.nextSibling):this.start.previousSibling?(t=f.dom.getFirstChild(this.start.previousSibling),t.nodeType===f.dom.TEXT_NODE&&(r=t.length)):(this.end.parentNode.appendChild(this.env.document.createTextNode("")),t=f.dom.getFirstChild(this.end.nextSibling)):(this.start.nextSibling?t=f.dom.getFirstChild(this.start.nextSibling):
(this.start.previousSibling||(t=this.env.document.createTextNode(""),f.dom.insertBefore(this.start,t)),t=f.dom.getLastChild(this.start.previousSibling),r=t.length),this.end.previousSibling?c=f.dom.getLastChild(this.end.previousSibling):(c=f.dom.getFirstChild(this.end.nextSibling||this.end),y=0));g([this.start,this.end]).remove();try{f.dom.normalize(u)}catch(A){}null===c?B&&(B.setEnd(t,r),B.collapse(!1)):(B.setStart(t,r),null===y&&(y=c.length||0),B.setEnd(c,y));try{this.selection.addRange(B)}catch(b){}},
getBookmark:function(g,t){return f.dom.getClass("iceBookmark_"+t,g)[0]},removeBookmarks:function(f){g(f).find("span.iceBookmark").remove()}};f.Bookmark=A})(this.ice||window.ice,window.jQuery);
var LITE={Events:{INIT:"lite:init",ACCEPT:"lite:accept",REJECT:"lite:reject",SHOW_HIDE:"lite:showHide",TRACKING:"lite:tracking",CHANGE:"lite:change",HOVER_IN:"lite:hover-in",HOVER_OUT:"lite:hover-out"},Commands:{TOGGLE_TRACKING:"lite-toggletracking",TOGGLE_SHOW:"lite-toggleshow",ACCEPT_ALL:"lite-acceptall",REJECT_ALL:"lite-rejectall",ACCEPT_ONE:"lite-acceptone",REJECT_ONE:"lite-rejectone",TOGGLE_TOOLTIPS:"lite-toggletooltips"}};