text: var MutationObserverCtor,__extends=this.__extends||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r};try{MutationObserverCtor="undefined"!=typeof WebKitMutationObserver?WebKitMutationObserver:MutationObserver}catch(e){MutationObserverCtor=void 0}var Movement,NodeMap=function(){function e(){this.nodes=[],this.values=[]}return e.prototype.isIndex=function(e){return+e==e>>>0},e.prototype.nodeId=function(t){var i=t[e.ID_PROP];return i||(i=t[e.ID_PROP]=e.nextId_++),i},e.prototype.set=function(e,t){var i=this.nodeId(e);this.nodes[i]=e,this.values[i]=t},e.prototype.get=function(e){var t=this.nodeId(e);return this.values[t]},e.prototype.has=function(e){return this.nodeId(e)in this.nodes},e.prototype.delete=function(e){var t=this.nodeId(e);delete this.nodes[t],this.values[t]=void 0},e.prototype.keys=function(){var e=[];for(var t in this.nodes)this.isIndex(t)&&e.push(this.nodes[t]);return e},e.ID_PROP="__mutation_summary_node_map_id__",e.nextId_=1,e}();function enteredOrExited(e){return 1===e||5===e}!function(e){e[e.STAYED_OUT=0]="STAYED_OUT",e[e.ENTERED=1]="ENTERED",e[e.STAYED_IN=2]="STAYED_IN",e[e.REPARENTED=3]="REPARENTED",e[e.REORDERED=4]="REORDERED",e[e.EXITED=5]="EXITED"}(Movement||(Movement={}));var NodeChange=function(){function e(e,t,i,r,n,a,o,s){void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===r&&(r=!1),void 0===n&&(n=null),void 0===a&&(a=!1),void 0===o&&(o=null),void 0===s&&(s=null),this.node=e,this.childList=t,this.attributes=i,this.characterData=r,this.oldParentNode=n,this.added=a,this.attributeOldValues=o,this.characterDataOldValue=s,this.isCaseInsensitive=this.node.nodeType===Node.ELEMENT_NODE&&this.node instanceof HTMLElement&&this.node.ownerDocument instanceof HTMLDocument}return e.prototype.getAttributeOldValue=function(e){if(this.attributeOldValues)return this.isCaseInsensitive&&(e=e.toLowerCase()),this.attributeOldValues[e]},e.prototype.getAttributeNamesMutated=function(){var e=[];if(!this.attributeOldValues)return e;for(var t in this.attributeOldValues)e.push(t);return e},e.prototype.attributeMutated=function(e,t){this.attributes=!0,this.attributeOldValues=this.attributeOldValues||{},e in this.attributeOldValues||(this.attributeOldValues[e]=t)},e.prototype.characterDataMutated=function(e){this.characterData||(this.characterData=!0,this.characterDataOldValue=e)},e.prototype.removedFromParent=function(e){this.childList=!0,this.added||this.oldParentNode?this.added=!1:this.oldParentNode=e},e.prototype.insertedIntoParent=function(){this.childList=!0,this.added=!0},e.prototype.getOldParent=function(){if(this.childList){if(this.oldParentNode)return this.oldParentNode;if(this.added)return null}return this.node.parentNode},e}(),ChildListChange=function(){this.added=new NodeMap,this.removed=new NodeMap,this.maybeMoved=new NodeMap,this.oldPrevious=new NodeMap,this.moved=void 0},TreeChanges=function(e){function t(t,i){e.call(this),this.rootNode=t,this.reachableCache=void 0,this.wasReachableCache=void 0,this.anyParentsChanged=!1,this.anyAttributesChanged=!1,this.anyCharacterDataChanged=!1;for(var r=0;r<i.length;r++){var n=i[r];switch(n.type){case"childList":this.anyParentsChanged=!0;for(var a=0;a<n.removedNodes.length;a++){var o=n.removedNodes[a];this.getChange(o).removedFromParent(n.target)}for(a=0;a<n.addedNodes.length;a++)o=n.addedNodes[a],this.getChange(o).insertedIntoParent();break;case"attributes":this.anyAttributesChanged=!0,this.getChange(n.target).attributeMutated(n.attributeName,n.oldValue);break;case"characterData":this.anyCharacterDataChanged=!0,this.getChange(n.target).characterDataMutated(n.oldValue)}}}return __extends(t,e),t.prototype.getChange=function(e){var t=this.get(e);return t||(t=new NodeChange(e),this.set(e,t)),t},t.prototype.getOldParent=function(e){var t=this.get(e);return t?t.getOldParent():e.parentNode},t.prototype.getIsReachable=function(e){if(e===this.rootNode)return!0;if(!e)return!1;this.reachableCache=this.reachableCache||new NodeMap;var t=this.reachableCache.get(e);return void 0===t&&(t=this.getIsReachable(e.parentNode),this.reachableCache.set(e,t)),t},t.prototype.getWasReachable=function(e){if(e===this.rootNode)return!0;if(!e)return!1;this.wasReachableCache=this.wasReachableCache||new NodeMap;var t=this.wasReachableCache.get(e);return void 0===t&&(t=this.getWasReachable(this.getOldParent(e)),this.wasReachableCache.set(e,t)),t},t.prototype.reachabilityChange=function(e){return this.getIsReachable(e)?this.getWasReachable(e)?2:1:this.getWasReachable(e)?5:0},t}(NodeMap),MutationProjection=function(){function e(e,t,i,r,n){this.rootNode=e,this.mutations=t,this.selectors=i,this.calcReordered=r,this.calcOldPreviousSibling=n,this.treeChanges=new TreeChanges(e,t),this.entered=[],this.exited=[],this.stayedIn=new NodeMap,this.visited=new NodeMap,this.childListChangeMap=void 0,this.characterDataOnly=void 0,this.matchCache=void 0,this.processMutations()}return e.prototype.processMutations=function(){if(this.treeChanges.anyParentsChanged||this.treeChanges.anyAttributesChanged)for(var e=this.treeChanges.keys(),t=0;t<e.length;t++)this.visitNode(e[t],void 0)},e.prototype.visitNode=function(e,t){if(!this.visited.has(e)){this.visited.set(e,!0);var i=this.treeChanges.get(e),r=t;if((i&&i.childList||null==r)&&(r=this.treeChanges.reachabilityChange(e)),0!==r){if(this.matchabilityChange(e),1===r)this.entered.push(e);else if(5===r)this.exited.push(e),this.ensureHasOldPreviousSiblingIfNeeded(e);else if(2===r){var n=2;i&&i.childList&&(i.oldParentNode!==e.parentNode?(n=3,this.ensureHasOldPreviousSiblingIfNeeded(e)):this.calcReordered&&this.wasReordered(e)&&(n=4)),this.stayedIn.set(e,n)}if(2!==r)for(var a=e.firstChild;a;a=a.nextSibling)this.visitNode(a,r)}}},e.prototype.ensureHasOldPreviousSiblingIfNeeded=function(e){if(this.calcOldPreviousSibling){this.processChildlistChanges();var t=e.parentNode,i=this.treeChanges.get(e);i&&i.oldParentNode&&(t=i.oldParentNode);var r=this.childListChangeMap.get(t);r||(r=new ChildListChange,this.childListChangeMap.set(t,r)),r.oldPrevious.has(e)||r.oldPrevious.set(e,e.previousSibling)}},e.prototype.getChanged=function(e,t,i){this.selectors=t,this.characterDataOnly=i;for(var r=0;r<this.entered.length;r++){var n=this.entered[r];1!==(s=this.matchabilityChange(n))&&2!==s||e.added.push(n)}var a=this.stayedIn.keys();for(r=0;r<a.length;r++)if(n=a[r],1===(s=this.matchabilityChange(n)))e.added.push(n);else if(5===s)e.removed.push(n);else if(2===s&&(e.reparented||e.reordered)){var o=this.stayedIn.get(n);e.reparented&&3===o?e.reparented.push(n):e.reordered&&4===o&&e.reordered.push(n)}for(r=0;r<this.exited.length;r++){var s;n=this.exited[r],5!==(s=this.matchabilityChange(n))&&2!==s||e.removed.push(n)}},e.prototype.getOldParentNode=function(e){var t=this.treeChanges.get(e);if(t&&t.childList)return t.oldParentNode?t.oldParentNode:null;var i=this.treeChanges.reachabilityChange(e);if(0===i||1===i)throw Error("getOldParentNode requested on invalid node.");return e.parentNode},e.prototype.getOldPreviousSibling=function(e){var t=e.parentNode,i=this.treeChanges.get(e);i&&i.oldParentNode&&(t=i.oldParentNode);var r=this.childListChangeMap.get(t);if(!r)throw Error("getOldPreviousSibling requested on invalid node.");return r.oldPrevious.get(e)},e.prototype.getOldAttribute=function(e,t){var i=this.treeChanges.get(e);if(!i||!i.attributes)throw Error("getOldAttribute requested on invalid node.");var r=i.getAttributeOldValue(t);if(void 0===r)throw Error("getOldAttribute requested for unchanged attribute name.");return r},e.prototype.attributeChangedNodes=function(e){if(!this.treeChanges.anyAttributesChanged)return{};var t,i;if(e){t={},i={};for(var r=0;r<e.length;r++)t[d=e[r]]=!0,i[d.toLowerCase()]=d}var n={},a=this.treeChanges.keys();for(r=0;r<a.length;r++){var o=a[r],s=this.treeChanges.get(o);if(s.attributes&&2===this.treeChanges.reachabilityChange(o)&&2===this.matchabilityChange(o))for(var h=o,l=s.getAttributeNamesMutated(),c=0;c<l.length;c++){var d=l[c];(!t||t[d]||s.isCaseInsensitive&&i[d])&&s.getAttributeOldValue(d)!==h.getAttribute(d)&&(i&&s.isCaseInsensitive&&(d=i[d]),n[d]=n[d]||[],n[d].push(h))}}return n},e.prototype.getOldCharacterData=function(e){var t=this.treeChanges.get(e);if(!t||!t.characterData)throw Error("getOldCharacterData requested on invalid node.");return t.characterDataOldValue},e.prototype.getCharacterDataChanged=function(){if(!this.treeChanges.anyCharacterDataChanged)return[];for(var e=this.treeChanges.keys(),t=[],i=0;i<e.length;i++){var r=e[i];if(2===this.treeChanges.reachabilityChange(r)){var n=this.treeChanges.get(r);n.characterData&&r.textContent!=n.characterDataOldValue&&t.push(r)}}return t},e.prototype.computeMatchabilityChange=function(e,t){this.matchCache||(this.matchCache=[]),this.matchCache[e.uid]||(this.matchCache[e.uid]=new NodeMap);var i=this.matchCache[e.uid],r=i.get(t);return void 0===r&&(r=e.matchabilityChange(t,this.treeChanges.get(t)),i.set(t,r)),r},e.prototype.matchabilityChange=function(e){var t=this;if(this.characterDataOnly)switch(e.nodeType){case Node.COMMENT_NODE:case Node.TEXT_NODE:return 2;default:return 0}if(!this.selectors)return 2;if(e.nodeType!==Node.ELEMENT_NODE)return 0;for(var i=e,r=this.selectors.map((function(e){return t.computeMatchabilityChange(e,i)})),n=0,a=0;2!==n&&a<r.length;){switch(r[a]){case 2:n=2;break;case 1:n=5===n?2:1;break;case 5:n=1===n?2:5}a++}return n},e.prototype.getChildlistChange=function(e){var t=this.childListChangeMap.get(e);return t||(t=new ChildListChange,this.childListChangeMap.set(e,t)),t},e.prototype.processChildlistChanges=function(){if(!this.childListChangeMap){this.childListChangeMap=new NodeMap;for(var e=0;e<this.mutations.length;e++){var t=this.mutations[e];if("childList"==t.type&&(2===this.treeChanges.reachabilityChange(t.target)||this.calcOldPreviousSibling)){for(var i=this.getChildlistChange(t.target),r=t.previousSibling,n=0;n<t.removedNodes.length;n++)o(a=t.removedNodes[n],r),i.added.has(a)?i.added.delete(a):(i.removed.set(a,!0),i.maybeMoved.delete(a)),r=a;for(o(t.nextSibling,r),n=0;n<t.addedNodes.length;n++){var a=t.addedNodes[n];i.removed.has(a)?(i.removed.delete(a),i.maybeMoved.set(a,!0)):i.added.set(a,!0)}}function o(e,t){!e||i.oldPrevious.has(e)||i.added.has(e)||i.maybeMoved.has(e)||t&&(i.added.has(t)||i.maybeMoved.has(t))||i.oldPrevious.set(e,t)}}}},e.prototype.wasReordered=function(e){if(!this.treeChanges.anyParentsChanged)return!1;this.processChildlistChanges();var t=e.parentNode,i=this.treeChanges.get(e);i&&i.oldParentNode&&(t=i.oldParentNode);var r=this.childListChangeMap.get(t);if(!r)return!1;if(r.moved)return r.moved.get(e);r.moved=new NodeMap;var n=new NodeMap;var a=new NodeMap,o=new NodeMap;return r.maybeMoved.keys().forEach((function e(t){if(!t)return!1;if(!r.maybeMoved.has(t))return!1;var i=r.moved.get(t);return void 0!==i||(n.has(t)?i=!0:(n.set(t,!0),i=function(t){if(o.has(t))return o.get(t);for(var i=t.previousSibling;i&&(r.added.has(i)||e(i));)i=i.previousSibling;return o.set(t,i),i}(t)!==function t(i){var n=a.get(i);if(void 0!==n)return n;for(n=r.oldPrevious.get(i);n&&(r.removed.has(n)||e(n));)n=t(n);return void 0===n&&(n=i.previousSibling),a.set(i,n),n}(t)),n.has(t)?(n.delete(t),r.moved.set(t,i)):i=r.moved.get(t)),i})),r.moved.get(e)},e}(),Summary=function(){function e(e,t){var i=this;if(this.projection=e,this.added=[],this.removed=[],this.reparented=t.all||t.element?[]:void 0,this.reordered=t.all?[]:void 0,e.getChanged(this,t.elementFilter,t.characterData),t.all||t.attribute||t.attributeList){var r=t.attribute?[t.attribute]:t.attributeList,n=e.attributeChangedNodes(r);t.attribute?this.valueChanged=n[t.attribute]||[]:(this.attributeChanged=n,t.attributeList&&t.attributeList.forEach((function(e){i.attributeChanged.hasOwnProperty(e)||(i.attributeChanged[e]=[])})))}if(t.all||t.characterData){var a=e.getCharacterDataChanged();t.characterData?this.valueChanged=a:this.characterDataChanged=a}this.reordered&&(this.getOldPreviousSibling=e.getOldPreviousSibling.bind(e))}return e.prototype.getOldParentNode=function(e){return this.projection.getOldParentNode(e)},e.prototype.getOldAttribute=function(e,t){return this.projection.getOldAttribute(e,t)},e.prototype.getOldCharacterData=function(e){return this.projection.getOldCharacterData(e)},e.prototype.getOldPreviousSibling=function(e){return this.projection.getOldPreviousSibling(e)},e}(),validNameInitialChar=/[a-zA-Z_]+/,validNameNonInitialChar=/[a-zA-Z0-9_\-]+/;function escapeQuotes(e){return'"'+e.replace(/"/,'\\"')+'"'}var Qualifier=function(){function e(){}return e.prototype.matches=function(e){if(null===e)return!1;if(void 0===this.attrValue)return!0;if(!this.contains)return this.attrValue==e;for(var t=e.split(" "),i=0;i<t.length;i++)if(this.attrValue===t[i])return!0;return!1},e.prototype.toString=function(){return"class"===this.attrName&&this.contains?"."+this.attrValue:"id"!==this.attrName||this.contains?this.contains?"["+this.attrName+"~="+escapeQuotes(this.attrValue)+"]":"attrValue"in this?"["+this.attrName+"="+escapeQuotes(this.attrValue)+"]":"["+this.attrName+"]":"#"+this.attrValue},e}(),Selector=function(){function e(){this.uid=e.nextUid++,this.qualifiers=[]}var t;return Object.defineProperty(e.prototype,"caseInsensitiveTagName",{get:function(){return this.tagName.toUpperCase()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectorString",{get:function(){return this.tagName+this.qualifiers.join("")},enumerable:!0,configurable:!0}),e.prototype.isMatching=function(t){return t[e.matchesSelector](this.selectorString)},e.prototype.wasMatching=function(e,t,i){if(!t||!t.attributes)return i;var r=t.isCaseInsensitive?this.caseInsensitiveTagName:this.tagName;if("*"!==r&&r!==e.tagName)return!1;for(var n=[],a=!1,o=0;o<this.qualifiers.length;o++){var s=this.qualifiers[o],h=t.getAttributeOldValue(s.attrName);n.push(h),a=a||void 0!==h}if(!a)return i;for(o=0;o<this.qualifiers.length;o++)if(s=this.qualifiers[o],void 0===(h=n[o])&&(h=e.getAttribute(s.attrName)),!s.matches(h))return!1;return!0},e.prototype.matchabilityChange=function(e,t){var i=this.isMatching(e);return i?this.wasMatching(e,t,i)?2:1:this.wasMatching(e,t,i)?5:0},e.parseSelectors=function(t){var i,r,n=[];function a(){i&&(r&&(i.qualifiers.push(r),r=void 0),n.push(i)),i=new e}function o(){r&&i.qualifiers.push(r),r=new Qualifier}for(var s,h=/\s/,l="Invalid or unsupported selector syntax.",c=1,d=0;d<t.length;){var u=t[d++];switch(c){case 1:if(u.match(validNameInitialChar)){a(),i.tagName=u,c=2;break}if("*"==u){a(),i.tagName="*",c=3;break}if("."==u){a(),o(),i.tagName="*",r.attrName="class",r.contains=!0,c=4;break}if("#"==u){a(),o(),i.tagName="*",r.attrName="id",c=4;break}if("["==u){a(),o(),i.tagName="*",r.attrName="",c=6;break}if(u.match(h))break;throw Error(l);case 2:if(u.match(validNameNonInitialChar)){i.tagName+=u;break}if("."==u){o(),r.attrName="class",r.contains=!0,c=4;break}if("#"==u){o(),r.attrName="id",c=4;break}if("["==u){o(),r.attrName="",c=6;break}if(u.match(h)){c=14;break}if(","==u){c=1;break}throw Error(l);case 3:if("."==u){o(),r.attrName="class",r.contains=!0,c=4;break}if("#"==u){o(),r.attrName="id",c=4;break}if("["==u){o(),r.attrName="",c=6;break}if(u.match(h)){c=14;break}if(","==u){c=1;break}throw Error(l);case 4:if(u.match(validNameInitialChar)){r.attrValue=u,c=5;break}throw Error(l);case 5:if(u.match(validNameNonInitialChar)){r.attrValue+=u;break}if("."==u){o(),r.attrName="class",r.contains=!0,c=4;break}if("#"==u){o(),r.attrName="id",c=4;break}if("["==u){o(),c=6;break}if(u.match(h)){c=14;break}if(","==u){c=1;break}throw Error(l);case 6:if(u.match(validNameInitialChar)){r.attrName=u,c=7;break}if(u.match(h))break;throw Error(l);case 7:if(u.match(validNameNonInitialChar)){r.attrName+=u;break}if(u.match(h)){c=8;break}if("~"==u){r.contains=!0,c=9;break}if("="==u){r.attrValue="",c=11;break}if("]"==u){c=3;break}throw Error(l);case 8:if("~"==u){r.contains=!0,c=9;break}if("="==u){r.attrValue="",c=11;break}if("]"==u){c=3;break}if(u.match(h))break;throw Error(l);case 9:if("="==u){r.attrValue="",c=11;break}throw Error(l);case 10:if("]"==u){c=3;break}if(u.match(h))break;throw Error(l);case 11:if(u.match(h))break;if('"'==u||"'"==u){s=u,c=13;break}r.attrValue+=u,c=12;break;case 12:if(u.match(h)){c=10;break}if("]"==u){c=3;break}if("'"==u||'"'==u)throw Error(l);r.attrValue+=u;break;case 13:if(u==s){c=10;break}r.attrValue+=u;break;case 14:if(u.match(h))break;if(","==u){c=1;break}throw Error(l)}}switch(c){case 1:case 2:case 3:case 5:case 14:a();break;default:throw Error(l)}if(!n.length)throw Error(l);return n},e.nextUid=1,e.matchesSelector="function"==typeof(t=document.createElement("div")).webkitMatchesSelector?"webkitMatchesSelector":"function"==typeof t.mozMatchesSelector?"mozMatchesSelector":"function"==typeof t.msMatchesSelector?"msMatchesSelector":"matchesSelector",e}(),attributeFilterPattern=/^([a-zA-Z:_]+[a-zA-Z0-9_\-:\.]*)$/;function validateAttribute(e){if("string"!=typeof e)throw Error("Invalid request opion. attribute must be a non-zero length string.");if(!(e=e.trim()))throw Error("Invalid request opion. attribute must be a non-zero length string.");if(!e.match(attributeFilterPattern))throw Error("Invalid request option. invalid attribute name: "+e);return e}function validateElementAttributes(e){if(!e.trim().length)throw Error("Invalid request option: elementAttributes must contain at least one attribute.");for(var t={},i={},r=e.split(/\s+/),n=0;n<r.length;n++)if(a=r[n]){var a,o=(a=validateAttribute(a)).toLowerCase();if(t[o])throw Error("Invalid request option: observing multiple case variations of the same attribute is not supported.");i[a]=!0,t[o]=!0}return Object.keys(i)}function elementFilterAttributes(e){var t={};return e.forEach((function(e){e.qualifiers.forEach((function(e){t[e.attrName]=!0}))})),Object.keys(t)}var MutationSummary=function(){function e(t){var i=this;this.connected=!1,this.options=e.validateOptions(t),this.observerOptions=e.createObserverOptions(this.options.queries),this.root=this.options.rootNode,this.callback=this.options.callback,this.elementFilter=Array.prototype.concat.apply([],this.options.queries.map((function(e){return e.elementFilter?e.elementFilter:[]}))),this.elementFilter.length||(this.elementFilter=void 0),this.calcReordered=this.options.queries.some((function(e){return e.all})),this.queryValidators=[],e.createQueryValidator&&(this.queryValidators=this.options.queries.map((function(t){return e.createQueryValidator(i.root,t)}))),this.observer=new MutationObserverCtor((function(e){i.observerCallback(e)})),this.reconnect()}return e.createObserverOptions=function(e){var t,i={childList:!0,subtree:!0};function r(e){i.attributes&&!t||(i.attributes=!0,i.attributeOldValue=!0,e?(t=t||{},e.forEach((function(e){t[e]=!0,t[e.toLowerCase()]=!0}))):t=void 0)}return e.forEach((function(e){if(e.characterData)return i.characterData=!0,void(i.characterDataOldValue=!0);if(e.all)return r(),i.characterData=!0,void(i.characterDataOldValue=!0);if(e.attribute)r([e.attribute.trim()]);else{var t=elementFilterAttributes(e.elementFilter).concat(e.attributeList||[]);t.length&&r(t)}})),t&&(i.attributeFilter=Object.keys(t)),i},e.validateOptions=function(t){for(var i in t)if(!(i in e.optionKeys))throw Error("Invalid option: "+i);if("function"!=typeof t.callback)throw Error("Invalid options: callback is required and must be a function");if(!t.queries||!t.queries.length)throw Error("Invalid options: queries must contain at least one query request object.");for(var r={callback:t.callback,rootNode:t.rootNode||document,observeOwnChanges:!!t.observeOwnChanges,oldPreviousSibling:!!t.oldPreviousSibling,queries:[]},n=0;n<t.queries.length;n++){var a=t.queries[n];if(a.all){if(Object.keys(a).length>1)throw Error("Invalid request option. all has no options.");r.queries.push({all:!0})}else if("attribute"in a){if((s={attribute:validateAttribute(a.attribute)}).elementFilter=Selector.parseSelectors("*["+s.attribute+"]"),Object.keys(a).length>1)throw Error("Invalid request option. attribute has no options.");r.queries.push(s)}else if("element"in a){var o=Object.keys(a).length,s={element:a.element,elementFilter:Selector.parseSelectors(a.element)};if(a.hasOwnProperty("elementAttributes")&&(s.attributeList=validateElementAttributes(a.elementAttributes),o--),o>1)throw Error("Invalid request option. element only allows elementAttributes option.");r.queries.push(s)}else{if(!a.characterData)throw Error("Invalid request option. Unknown query request.");if(Object.keys(a).length>1)throw Error("Invalid request option. characterData has no options.");r.queries.push({characterData:!0})}}return r},e.prototype.createSummaries=function(e){if(!e||!e.length)return[];for(var t=new MutationProjection(this.root,e,this.elementFilter,this.calcReordered,this.options.oldPreviousSibling),i=[],r=0;r<this.options.queries.length;r++)i.push(new Summary(t,this.options.queries[r]));return i},e.prototype.checkpointQueryValidators=function(){this.queryValidators.forEach((function(e){e&&e.recordPreviousState()}))},e.prototype.runQueryValidators=function(e){this.queryValidators.forEach((function(t,i){t&&t.validate(e[i])}))},e.prototype.changesToReport=function(e){return e.some((function(e){return!!["added","removed","reordered","reparented","valueChanged","characterDataChanged"].some((function(t){return e[t]&&e[t].length}))||!(!e.attributeChanged||!Object.keys(e.attributeChanged).some((function(t){return!!e.attributeChanged[t].length})))}))},e.prototype.observerCallback=function(e){this.options.observeOwnChanges||this.observer.disconnect();var t=this.createSummaries(e);this.runQueryValidators(t),this.options.observeOwnChanges&&this.checkpointQueryValidators(),this.changesToReport(t)&&this.callback(t),!this.options.observeOwnChanges&&this.connected&&(this.checkpointQueryValidators(),this.observer.observe(this.root,this.observerOptions))},e.prototype.reconnect=function(){if(this.connected)throw Error("Already connected");this.observer.observe(this.root,this.observerOptions),this.connected=!0,this.checkpointQueryValidators()},e.prototype.takeSummaries=function(){if(!this.connected)throw Error("Not connected");var e=this.createSummaries(this.observer.takeRecords());return this.changesToReport(e)?e:void 0},e.prototype.disconnect=function(){var e=this.takeSummaries();return this.observer.disconnect(),this.connected=!1,e},e.NodeMap=NodeMap,e.parseElementFilter=Selector.parseSelectors,e.optionKeys={callback:!0,queries:!0,rootNode:!0,oldPreviousSibling:!0,observeOwnChanges:!0},e}(),TreeMirror=function(){function e(e,t){this.root=e,this.delegate=t,this.idMap={}}return e.prototype.initialize=function(e,t){this.idMap[e]=this.root;for(var i=0;i<t.length;i++)this.deserializeNode(t[i],this.root)},e.prototype.applyChanged=function(e,t,i,r){var n=this;t.forEach((function(e){var t=n.deserializeNode(e);n.deserializeNode(e.parentNode),n.deserializeNode(e.previousSibling),t.parentNode&&t.parentNode.removeChild(t)})),e.forEach((function(e){var t=n.deserializeNode(e);t.parentNode&&t.parentNode.removeChild(t)})),t.forEach((function(e){var t=n.deserializeNode(e),i=n.deserializeNode(e.parentNode),r=n.deserializeNode(e.previousSibling);i.insertBefore(t,r?r.nextSibling:i.firstChild)})),i.forEach((function(e){var t=n.deserializeNode(e);Object.keys(e.attributes).forEach((function(i){var r=e.attributes[i];null===r?t.removeAttribute(i):n.delegate&&n.delegate.setAttribute&&n.delegate.setAttribute(t,i,r)||t.setAttribute(i,r)}))})),r.forEach((function(e){n.deserializeNode(e).textContent=e.textContent})),e.forEach((function(e){delete n.idMap[e.id]}))},e.prototype.deserializeNode=function(e,t){var i=this;if(null===e)return null;var r=this.idMap[e.id];if(r)return r;var n=this.root.ownerDocument;switch(null===n&&(n=this.root),e.nodeType){case Node.COMMENT_NODE:r=n.createComment(e.textContent);break;case Node.TEXT_NODE:r=n.createTextNode(e.textContent);break;case Node.DOCUMENT_TYPE_NODE:r=n.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case Node.ELEMENT_NODE:this.delegate&&this.delegate.createElement&&(r=this.delegate.createElement(e.tagName)),r||(r=n.createElement(e.tagName)),Object.keys(e.attributes).forEach((function(t){try{i.delegate&&i.delegate.setAttribute&&i.delegate.setAttribute(r,t,e.attributes[t])||r.setAttribute(t,e.attributes[t])}catch(e){}}))}if(!r)throw"ouch";if(this.idMap[e.id]=r,t&&t.appendChild(r),e.childNodes)for(var a=0;a<e.childNodes.length;a++)this.deserializeNode(e.childNodes[a],r);return r},e}(),TreeMirrorClient=function(){function e(e,t,i){var r=this;this.target=e,this.mirror=t,this.nextId=1,this.knownNodes=new MutationSummary.NodeMap;for(var n=this.serializeNode(e).id,a=[],o=e.firstChild;o;o=o.nextSibling)a.push(this.serializeNode(o,!0));this.mirror.initialize(n,a);var s,h=[{all:!0}];i&&(h=h.concat(i));try{s="undefined"!=typeof WebKitMutationObserver?WebKitMutationObserver:MutationObserver}catch(e){s=void 0}void 0!==s&&(this.mutationSummary=new MutationSummary({rootNode:e,callback:function(e){r.applyChanged(e)},queries:h}))}return e.prototype.disconnect=function(){this.mutationSummary&&(this.mutationSummary.disconnect(),this.mutationSummary=void 0)},e.prototype.rememberNode=function(e){var t=this.nextId++;return this.knownNodes.set(e,t),t},e.prototype.forgetNode=function(e){this.knownNodes.delete(e)},e.prototype.serializeNode=function(e,t){if(null===e)return null;var i=this.knownNodes.get(e);if(void 0!==i)return{id:i};var r={nodeType:e.nodeType,id:this.rememberNode(e)};switch(r.nodeType){case Node.DOCUMENT_TYPE_NODE:var n=e;r.name=n.name,r.publicId=n.publicId,r.systemId=n.systemId;break;case Node.COMMENT_NODE:case Node.TEXT_NODE:r.textContent=e.textContent;break;case Node.ELEMENT_NODE:var a=e;r.tagName=a.tagName,r.attributes={};for(var o=0;o<a.attributes.length;o++){var s=a.attributes[o];r.attributes[s.name]=s.value}if(t&&a.childNodes.length){r.childNodes=[];for(var h=a.firstChild;h;h=h.nextSibling)r.childNodes.push(this.serializeNode(h,!0))}}return r},e.prototype.serializeAddedAndMoved=function(e,t,i){var r=this,n=e.concat(t).concat(i),a=new MutationSummary.NodeMap;n.forEach((function(e){var t=e.parentNode,i=a.get(t);i||(i=new MutationSummary.NodeMap,a.set(t,i)),i.set(e,!0)}));var o=[];return a.keys().forEach((function(e){for(var t=a.get(e),i=t.keys();i.length;){for(var n=i[0];n.previousSibling&&t.has(n.previousSibling);)n=n.previousSibling;for(;n&&t.has(n);){var s=r.serializeNode(n);s.previousSibling=r.serializeNode(n.previousSibling),s.parentNode=r.serializeNode(n.parentNode),o.push(s),t.delete(n),n=n.nextSibling}i=t.keys()}})),o},e.prototype.serializeAttributeChanges=function(e){var t=this,i=new MutationSummary.NodeMap;return Object.keys(e).forEach((function(r){e[r].forEach((function(e){var n=i.get(e);n||((n=t.serializeNode(e)).attributes={},i.set(e,n)),n.attributes[r]=e.getAttribute(r)}))})),i.keys().map((function(e){return i.get(e)}))},e.prototype.applyChanged=function(e){var t=this,i=e[0],r=i.removed.map((function(e){return t.serializeNode(e)})),n=this.serializeAddedAndMoved(i.added,i.reparented,i.reordered),a=this.serializeAttributeChanges(i.attributeChanged),o=i.characterDataChanged.map((function(e){var i=t.serializeNode(e);return i.textContent=e.textContent,i}));this.mirror.applyChanged(r,n,a,o),i.removed.forEach((function(e){t.forgetNode(e)}))},e}(),LHCCoBrowser=function(){function e(e){var t=this;this.sendCommands=[],this.updateTimeout=null,this.mirrorClient=null,this.socket=null,this.chat_hash=e.chat_hash,this.event_emitter=e.event_emitter||null,this.cssAdded=!1,this.operatorMouseVisible=!1,this.windowForceScroll=!1,this.NodeJsSupportEnabled=!1,this.initializeData=null,this.selectorInitialized=!1,this.initialiseBlock=!0,this.shareStyleStatus="border-radius:3px;cursor:pointer;position:fixed;top:5px;right:5px;padding:5px;z-index:9999;text-align:center;font-weight:bold;background-color:rgba(140, 227, 253, 0.53);font-family:arial;font-size:12px;",this.formsenabled=void 0===e.formsenabled||e.formsenabled,this.trans={},e.url&&(this.url=e.url),e.style_share&&(this.shareStyleStatus=e.style_share),e.trans&&(this.trans=e.trans),this.node_js_settings=e.nodejssettings,this.mouse={x:0,y:0,w:0,h:0,wh:0},this.mouseTimeout=null,this.mouseEventListenerCallback=function(e){t.mouseEventListener(e)},document.addEventListener("mousemove",this.mouseEventListenerCallback,!1),this.inputChangeKeyUpListener=function(e){t.changeEventListener(e)};for(var i=document.getElementsByTagName("INPUT"),r=0;r<i.length;r++)i[r].addEventListener("keyup",this.inputChangeKeyUpListener,!1),i[r].addEventListener("change",this.inputChangeKeyUpListener,!1);for(i=document.getElementsByTagName("TEXTAREA"),r=0;r<i.length;r++)i[r].addEventListener("keyup",this.inputChangeKeyUpListener,!1);for(i=document.getElementsByTagName("SELECT"),r=0;r<i.length;r++)i[r].addEventListener("change",this.inputChangeKeyUpListener,!1);this.hashchangeEventListenerCallback=function(e){t.hashchangeEventListener(e)},window.addEventListener("hashchange",this.hashchangeEventListenerCallback,!1),this.scrollTimeout=null,this.scrollTop=this.scrollTopGS(),this.scrollLeft=this.scrollLeftGS(),this.scrollEventListenerCallback=function(e){t.scrollEventListener(e)},document.addEventListener("scroll",this.scrollEventListenerCallback,!1),e.nodejsenabled&&(this.NodeJsSupportEnabled=!0,this.setupNodeJs())}return e.prototype.hashchangeEventListener=function(e){this.sendData({f:"uchash",pos:{hsh:window.location.hash,t:this.scrollTopGS(),l:this.scrollLeftGS()}})},e.prototype.sendInputsData=function(){if("undefined"!=typeof jQuery){this.initializeSelector();for(var e=document.getElementsByTagName("INPUT"),t=0;t<e.length;t++)(i=jQuery(e[t]).getSelector()).length>=1&&("checkbox"==e[t].type||"radio"==e[t].type?this.sendData({f:"chkval",selector:i[0],value:jQuery(e[t]).is(":checked")}):this.sendData({f:"textdata",selector:i[0],value:e[t].value}));for(e=document.getElementsByTagName("TEXTAREA"),t=0;t<e.length;t++)(i=jQuery(e[t]).getSelector()).length>=1&&this.sendData({f:"textdata",selector:i[0],value:e[t].value});for(e=document.getElementsByTagName("SELECT"),t=0;t<e.length;t++){var i;(i=jQuery(e[t]).getSelector()).length>=1&&this.sendData({f:"selectval",selector:i[0],value:e[t].selectedIndex})}}},e.prototype.scrollEventListener=function(){this.scrollTop=this.scrollTopGS(),this.scrollLeft=this.scrollLeftGS();var e=this;null===this.scrollTimeout&&(this.scrollTimeout=setTimeout((function(){e.sendData({f:"uscroll",pos:{t:e.scrollTop,l:e.scrollLeft}}),e.scrollTimeout=null}),!0===this.isNodeConnected?20:1e3))},e.prototype.initializeSelector=function(){"undefined"!=typeof jQuery&&0==this.selectorInitialized&&(this.selectorInitialized=!0,function(){var e,t,i,r,n,a,o,s,h;e=jQuery,s=e.map,a=e.extend,o=e.inArray,r=function(e,t){return-1!==o(e,t)},n=function(e){return e.replace(/([\!\"\#\$\%\&'\(\)\*\+\,\.\/\:\;<\=>\?\@\[\\\]\^\`\{\|\}\~])/g,"\\$1")},i=function(e,t){return s(e,(function(e){return e===t?null:e}))},h=function(e){return s(e,(function(t,i){return parseInt(i,10)===parseInt(e.indexOf(t),10)?t:null}))},t=function(){function t(t,i){this.element=t,this.options=a(a({},e.selectorator.options),i),this.cachedResults={}}return t.prototype.query=function(t){var i;return(i=this.cachedResults)[t]||(i[t]=e(t.replace(/#([^\s]+)/g,"[id='$1']")))},t.prototype.getProperTagName=function(){return this.element[0]?this.element[0].tagName.toLowerCase():null},t.prototype.hasParent=function(){return this.element&&0<this.element.parent().length},t.prototype.isElement=function(){var e;return(e=this.element[0])&&e.nodeType===e.ELEMENT_NODE},t.prototype.validate=function(e,t,i,n){var a;if(null==i&&(i=!0),null==n&&(n=!1),a=this.query(e),i&&1<a.length||!i&&0===a.length){if(!t||-1!==e.indexOf(":"))return null;if(e=t+(n?" > ":" ")+e,a=this.query(e),i&&1<a.length||!i&&0===a.length)return null}return r(this.element[0],a.get())?e:null},t.prototype.generate=function(){var e,t,r,n;if(!(this.element&&this.hasParent()&&this.isElement()))return[""];for(e=[],t=0,r=(n=[this.generateSimple,this.generateAncestor,this.generateRecursive]).length;t<r;t++)if((e=h(i(n[t].call(this))))&&e.length>0)return e;return h(e)},t.prototype.generateAncestor=function(){var i,r,n,a,o,s,h,l,c,d,u,p,f;for(o=[],h=0,d=(f=this.element.parents()).length;h<d;h++){for(r=f[h],i=!0,l=0,u=(s=this.generateSimple(null,!1)).length;l<u;l++)for(s[l],c=0,p=(a=new t(e(r),this.options).generateSimple(null,!1)).length;c<p;c++)n=a[c],e.merge(o,this.generateSimple(n,!0,i));i=!1}return o},t.prototype.generateSimple=function(e,t,r){var n,a,o,h,l,c,d;for((o=this).getProperTagName(),h=function(i){return o.validate(i,e,t,r)},l=0,c=(d=[[o.getIdSelector],[o.getClassSelector],[o.getIdSelector,!0],[o.getClassSelector,!0],[o.getNameSelector],[function(){return[o.getProperTagName()]}]]).length;l<c;l++)if(a=(n=d[l])[0].call(o,n[1])||[],(a=i(s(a,h))).length>0)return a;return[]},t.prototype.generateRecursive=function(){var e,i,r;return-1!==(r=this.getProperTagName()).indexOf(":")&&(r="*"),i=new t(e=this.element.parent()).generate()[0],r=r+":eq("+e.children(r).index(this.element)+")",""!==i&&(r=i+" > "+r),[r]},t.prototype.getIdSelector=function(e){var t;return null==e&&(e=!1),e=e?this.getProperTagName():"","string"!=typeof(t=this.element.attr("id"))||r(t,this.getIgnore("id"))?null:[e+"#"+n(t)]},t.prototype.getClassSelector=function(e){var t,i,a;return null==e&&(e=!1),a=this.getProperTagName(),/^(body|html)$/.test(a)?null:(e=e?a:"",i=this.getIgnore("class"),t=(this.element.attr("class")||"").replace(/\{.*\}/,"").split(/\s/),s(t,(function(t){return t&&!r(t,i)?e+"."+n(t):null})))},t.prototype.getNameSelector=function(){var e,t;return t=this.getProperTagName(),(e=this.element.attr("name"))&&!r(e,this.getIgnore("name"))?[t+"[name='"+e+"']"]:null},t.prototype.getIgnore=function(e){var t,i,r;return t="class"===e?"classes":e+"s","string"==typeof(r=(i=this.options.ignore||{})[e]||i[t])?[r]:r},t}(),e.selectorator={options:{},unique:h,clean:i,escapeSelector:n},e.fn.selectorator=function(i){return new t(e(this),i)},e.fn.getSelector=function(e){return this.selectorator(e).generate()}}.call(this))},e.prototype.changeEventListener=function(e){if("undefined"!=typeof jQuery){this.initializeSelector();var t=jQuery(e.target).getSelector();t.length>=1&&("SELECT"==e.target.tagName?this.sendData({f:"selectval",selector:t[0],value:e.target.selectedIndex}):"checkbox"==e.target.type||"radio"==e.target.type?this.sendData({f:"chkval",selector:t[0],value:jQuery(e.target).is(":checked")}):this.sendData({f:"textdata",selector:t[0],value:jQuery(e.target).val()}))}},e.prototype.handleMessage=function(e){if("hightlight"==e[1]){var t=null;""!=(f=(l=e[2].split("__SPLIT__"))[1].replace(new RegExp("_SEL_","g"),":"))&&"undefined"!=typeof jQuery&&null!==(p=jQuery(f))&&1==p.length&&(t=p[0]);var i=l[0].split(","),r={scrollLeft:this.scrollLeftGS(),scrollTop:this.scrollTopGS()};this.scrollLeftGS(i[2]),this.scrollTopGS(i[3]);var n="";null!==(c=document.getElementById("lhc-user-cursor"))&&(n=c.style.display,c.style.display="none"),null===t&&(t=document.elementFromPoint(i[0],i[1])),null!==c&&(c.style.display=n),0==this.windowForceScroll&&(this.scrollLeftGS(r.scrollLeft),this.scrollTopGS(r.scrollTop));var a=!0;null!==t&&this.hasClass(t,"lhc-higlighted")&&"INPUT"!=t.tagName&&"TEXTAREA"!=t.tagName&&"SELECT"!=t.tagName&&(a=!1);for(var o=document.getElementsByClassName("lhc-higlighted"),s=0;s<o.length;s++)this.removeClass(o[s],"lhc-higlighted"),o[s]==t&&(a=!1);1==a&&null!==t&&(this.addClass(t,"lhc-higlighted"),0==this.cssAdded&&(this.cssAdded=!0,this.addCss(".lhc-higlighted{-webkit-box-shadow: 0px 0px 20px 5px rgba(88,140,204,1)!important;-moz-box-shadow: 0px 0px 20px 5px rgba(88,140,204,1)!important;box-shadow: 0px 0px 20px 5px rgba(88,140,204,1)!important;}")))}else if("operatorcursor"==e[1]){if(1==this.operatorMouseVisible)if(i=e[2].split(","),null===(t=document.getElementById("lhc-user-cursor"))){var h=this.appendHTML('<div id="lhc-user-cursor" style="z-index:99999;top:'+i[1]+"px;left:"+parseInt(i[0]-12)+'px;position:absolute;"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAcCAQAAAAkETzVAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfeDBYQLhknKDAhAAAC4ElEQVQ4y32US2xVRRjHf/M457774KpNxRaBGjRq0igJxmriI9EaF2BoNCHgRiI748odxARXLNmpKzbEjTFqlI0sDLLSBcE0GNTW0sIl5bba9txzzzkzZ8bFubdeI/hNMqvf983/ew0AMCSa4dtjSOSjgv+zIYHeu3vxk2P7RAkd3BsuCzSVqaeiztUL78xWRwi1fPYuuAIr0VSaO2dPXNo993Q5WlzatMvg7oIiCak2Jw4f/Vre2fHK9GS8dH3NgvL+P6gmpN6cPPzWZW7LW/UDT+73N35vpd5XvB1A5RGBQBFS9hgyrsvPx+vvffT+zMOi3FXVAc0SEAgkgSMjIxML4tx9y8fPfPjytK7GOpR9VAMgkKgCNaTiFp/WX3rj1FjjzMUfNhNMkeK2D8JjeifmD87qjw+8e/L4qzsbBFoCqI74UxFSa04cPHgRgyGhTZuMX9TGA3OPPxH9utjOKs4iF7bD9rSSsEYOGPFtcPaxRz547YVyqav6AkSBGgwZMVnPOReStDUfpSWUEnIXgC+uImpn+51xf2j9wveXWj5A5ULODAgwvbi97vjZLLj6zbyRxav/VABHhsGQ9seI1zc/+2l5ixyH79fV473TfhhDzA4iOgI8SV5NSUixuCmvCxCXdNXC6dAplFDXGqfDdWG4Up9+8MuEFEP+m9fnPZ4cs3Lz+VOMMUrt/uGTz705dU4l4krlyEM12zHk+EKrIydli3VWaXF7beWLH59Z3e8kgZis7ykXSoshFEgEAkdGQtebdjyh5sZfVDN3vvvq8ny8QTJiE68h9Jmli8CyRZkaw1F0Pru5bPy1lRs/RzEOX/F/FRWriY5CowkIKTHEKKOq7oWLaLPKOtF41vJiYHIlEkVAlQYNqigSNtlgiy52pKhrSAYOh8CSk2NJKCGxxHTJtLNUCjSjVnTe4zF4HBm6l6jF6n/t2IA1BQpNSIkQHcp6T+Q9f5JdAmDJ9/fK8jfQNz5Ki5DVMQAAAABJRU5ErkJggg=="/></div>');null!==document.body&&document.body.appendChild(h)}else t.style.top=i[1]+"px",t.style.left=parseInt(i[0]-12)+"px"}else if("mouse"==e[1])"show"==e[2]?this.operatorMouseVisible=!0:(this.operatorMouseVisible=!1,this.removeById("lhc-user-cursor"));else if("scroll"==e[1])"true"==e[2]?this.windowForceScroll=!0:this.windowForceScroll=!1;else if("navigate"==e[1])document.location=e[2].replace(new RegExp("__SPLIT__","g"),":");else if("click"==e[1]){var l,c;t=null,""!=(f=(l=e[2].split("__SPLIT__"))[1].replace(new RegExp("_SEL_","g"),":"))&&"undefined"!=typeof jQuery&&null!==(p=jQuery(f))&&1==p.length&&(t=p[0]),i=l[0].split(","),r={scrollLeft:this.scrollLeftGS(),scrollTop:this.scrollTopGS()},this.scrollLeftGS(i[2]),this.scrollTopGS(i[3]),n="",null!==(c=document.getElementById("lhc-user-cursor"))&&(n=c.style.display,c.style.display="none"),null===t&&(t=document.elementFromPoint(i[0],i[1])),null!==c&&(c.style.display=n),0==this.windowForceScroll&&(this.scrollLeftGS(r.scrollLeft),this.scrollTopGS(r.scrollTop)),null!==t?(t.focus(),t.click()):console.log("not found")}else if("fillform"==e[1]&&this.formsenabled){var d=(u=e[2].split("__SPLIT__"))[0].replace(new RegExp("_SEL_","g"),":");for(o=[],""!=(f=u[1].replace(new RegExp("_SEL_","g"),":"))&&"undefined"!=typeof jQuery&&null!==(p=jQuery(f))&&1==p.length&&o.push(p[0]),0==o.length&&(o=document.getElementsByClassName("lhc-higlighted")),s=0;s<o.length;s++){o[s].removeEventListener("keyup",this.inputChangeKeyUpListener,!1),o[s].removeEventListener("change",this.inputChangeKeyUpListener,!1),o[s].value=d;try{o[s].dispatchEvent(new Event("change",{bubbles:!0})),o[s].dispatchEvent(new Event("keyup",{bubbles:!0}))}catch(e){}o[s].addEventListener("keyup",this.inputChangeKeyUpListener,!1),o[s].addEventListener("change",this.inputChangeKeyUpListener,!1)}}else if("changeselect"==e[1]&&this.formsenabled){var u,p,f=(u=e[2].split("__SPLIT__"))[1].replace(new RegExp("_SEL_","g"),":");for(d=u[0],o=[],""!=f&&"undefined"!=typeof jQuery&&null!==(p=jQuery(f))&&1==p.length&&o.push(p[0]),0==o.length&&(o=document.getElementsByClassName("lhc-higlighted")),s=0;s<o.length;s++)if("SELECT"==o[s].tagName){o[s].selectedIndex=d;try{o[s].dispatchEvent(new Event("change",{bubbles:!0}))}catch(e){}}}},e.prototype.mouseEventListener=function(e){var t=this,i=(e.clientX||e.pageX)+this.scrollLeftGS(),r=(e.clientY||e.pageY)+this.scrollTopGS();t.mouse.x==i&&t.mouse.y==r||(t.mouse.x=i,t.mouse.y=r,t.mouse.w=Math.max(document.documentElement.clientWidth,document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth),t.mouse.h=Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight),t.mouse.wh=window.innerHeight,null===t.mouseTimeout&&(t.mouseTimeout=setTimeout((function(){t.sendData({f:"cursor",pos:t.mouse}),t.mouseTimeout=null}),!0===t.isNodeConnected?20:1e3)))},e.prototype.setupNodeJs=function(){var e=this;if("undefined"==typeof io){var t=document.getElementsByTagName("head")[0],i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",this.node_js_settings.nodejssocket),t.appendChild(i),i.onreadystatechange=i.onload=function(){e.setupNodeJs()}}else try{this.socket=io.connect(this.node_js_settings.nodejshost,{secure:this.node_js_settings.secure,path:this.node_js_settings.path,forceNew:!0}),this.socket.on("connect",(function(){e.onConnected()})),this.socket.on("reconnect_error",(function(){e.isNodeConnected=!1})),this.socket.on("connect_timeout",(function(){e.isNodeConnected=!1})),this.socket.on("remotecommand",(function(t){e.handleMessage(t.split(":"))}))}catch(e){console.log(e)}},e.prototype.scrollTopGS=function(e){if(void 0===e)return document.documentElement.scrollTop||document.body.scrollTop;if(document.documentElement)try{document.documentElement.scrollTop=e}catch(e){}if(document.body)try{document.body.scrollTop=e}catch(e){}},e.prototype.scrollLeftGS=function(e){if(void 0===e)return document.documentElement.scrollLeft||document.body.scrollLeft;if(document.documentElement)try{document.documentElement.scrollLeft=e}catch(e){}if(document.body)try{document.body.scrollLeft=e}catch(e){}},e.prototype.onConnected=function(){this.isNodeConnected=!0,this.socket.emit("join",{chat_id:this.chat_hash}),null!==this.initializeData&&(this.sendData({base:location.href.match(/^(.*\/)[^\/]*$/)[1]}),this.sendData(this.initializeData),this.initializeData=null)},e.prototype.sendData=function(e){if(!0!==this.isNodeConnected||null===this.socket||(this.socket.emit("usermessage",{chat_id:this.chat_hash,msg:e}),e.f&&"initialize"==e.f)){1==this.NodeJsSupportEnabled&&e.f&&"initialize"==e.f&&null===this.initializeData&&(this.initializeData=e);var t=this;this.sendCommands.push(e),null===this.updateTimeout&&(this.updateTimeout=setTimeout((function(){window.XDomainRequest?xhr=new XDomainRequest:window.XMLHttpRequest?xhr=new XMLHttpRequest:xhr=new ActiveXObject("Microsoft.XMLHTTP"),xhr.open("POST",t.url,!0),void 0!==xhr.setRequestHeader&&xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"),xhr.send("data="+encodeURIComponent(JSON.stringify(t.sendCommands))),xhr.onload=function(){var e=JSON.parse(xhr.responseText);"undefined"!==e&&"true"==e.disableShare&&(alert(e.error_msg),t.stopMirroring())},t.sendCommands=[],t.updateTimeout=null}),!0===this.isNodeConnected?0:500))}},e.prototype.stopMirroring=function(){try{this.mirrorClient.disconnect(),this.mirrorClient=null,clearTimeout(this.updateTimeout),clearTimeout(this.mouseTimeout);for(var e=document.getElementsByClassName("lhc-higlighted"),t=0;t<e.length;t++)this.removeClass(e[t],"lhc-higlighted");this.removeById("lhc-user-cursor"),"undefined"!=typeof lh_inst?lh_inst.finishScreenSharing():this.event_emitter&&this.event_emitter.emitEvent("finishScreenSharing"),1==this.isNodeConnected&&(this.isNodeConnected=!1,this.socket.emit("userleft",{chat_id:this.chat_hash}),this.socket.disconnect(),this.socket=null),document.removeEventListener("mousemove",this.mouseEventListenerCallback,!1),document.removeEventListener("scroll",this.scrollEventListenerCallback,!1);var i=document.getElementsByTagName("INPUT");for(t=0;t<i.length;t++)i[t].removeEventListener("keyup",this.inputChangeKeyUpListener,!1),i[t].removeEventListener("change",this.inputChangeKeyUpListener,!1);for(i=document.getElementsByTagName("TEXTAREA"),t=0;t<i.length;t++)i[t].removeEventListener("keyup",this.inputChangeKeyUpListener,!1);for(i=document.getElementsByTagName("SELECT"),t=0;t<i.length;t++)i[t].removeEventListener("change",this.inputChangeKeyUpListener,!1)}catch(e){console.log(e)}},e.prototype.addCss=function(e){var t=document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",i.styleSheet?i.styleSheet.cssText=e:(rules=document.createTextNode(e),i.appendChild(rules)),t.appendChild(i)},e.prototype.appendHTML=function(e){var t=document.createDocumentFragment(),i=document.createElement("div");for(i.innerHTML=e;i.firstChild;)t.appendChild(i.firstChild);return t},e.prototype.removeById=function(e){return!!(EObj=document.getElementById(e))&&EObj.parentNode.removeChild(EObj)},e.prototype.hasClass=function(e,t){return new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className)},e.prototype.addClass=function(e,t){this.hasClass(e,t)||(e.className+=(e.className?" ":"")+t)},e.prototype.removeClass=function(e,t){this.hasClass(e,t)&&(e.className=e.className.replace(new RegExp("(\\s|^)"+t+"(\\s|$)")," ").replace(/^\s+|\s+$/g,""))},e.prototype.startMirroring=function(){var e=this;this.mirrorClient=new TreeMirrorClient(document,{initialize:function(t,i){setTimeout((function(){e.initialiseBlock=!1,e.scrollEventListener(),e.sendInputsData()}),3e3),e.sendData({f:"cursor",pos:{w:Math.max(document.documentElement.clientWidth,document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth),h:Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight),wh:window.innerHeight}}),e.sendData({f:"initialize",formsEnabled:e.formsenabled,args:[t,i]})},applyChanged:function(t,i,r,n){0==e.initialiseBlock?e.sendData({f:"applyChanged",args:[t,i,r,n]}):setTimeout((function(){e.sendData({f:"applyChanged",args:[t,i,r,n]})}),3100)}});var t='<div id="lhc_status_mirror" style="'+this.shareStyleStatus+'">'+this.trans.operator_watching+"</div>",i=this.appendHTML(t);document.body.appendChild(i),document.getElementById("lhc_status_mirror").onclick=function(){e.stopMirroring()}},e}();
  //# sourceMappingURL=055c35332741f6393f0b610d248db1b8.js.map
  