js.upscope.io
Open in
urlscan Pro
18.67.65.102
Public Scan
Submitted URL: http://js.upscope.io/
Effective URL: https://js.upscope.io/
Submission: On October 24 via manual from CA — Scanned from CA
Effective URL: https://js.upscope.io/
Submission: On October 24 via manual from CA — Scanned from CA
Form analysis
0 forms found in the DOMText Content
;(function() { "use strict";function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _instanceof(left,right){if(right!=null&&typeof Symbol!=="undefined"&&right[Symbol.hasInstance]){return!!right[Symbol.hasInstance](left)}else{return left instanceof right}}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _objectSpreadProps(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}var _typeof=function(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj};function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var __generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};var __values=this&&this.__values||function(o){var s=typeof Symbol==="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length==="number")return{next:function(){if(o&&i>=o.length)o=void 0;return{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};if(typeof Object.assign==="undefined"){Object.assign=function(target){"use strict";if(target===undefined||target===null){throw new TypeError("Cannot convert undefined or null to object")}var output=new Object(target);for(var index=1;index<arguments.length;index++){var source=arguments[index];if(source!==undefined&&source!==null){for(var nextKey in source){if(source.hasOwnProperty(nextKey)){output[nextKey]=source[nextKey]}}}}return output}}if(typeof Array.prototype.map==="undefined"){Array.prototype.map=function(callback,thisArg){var T,A,k;if(this===null){throw new TypeError(" this is null or not defined")}var O=new Object(this);var length_=O.length>>>0;if(typeof callback!=="function"){throw new TypeError(callback+" is not a function")}if(arguments.length>1){T=thisArg}A=new Array(length_);k=0;while(k<length_){var kValue,mappedValue;if(k in O){kValue=O[k];mappedValue=callback.call(T,kValue,k,O);A[k]=mappedValue}k++}return A}}if(typeof Array.prototype.flatMap==="undefined"){Array.prototype.flatMap=function(callback,thisArg){return this.map(callback,thisArg).flat()}}if(typeof String.prototype.startsWith==="undefined"){String.prototype.startsWith=function(searchString,position){position=position||0;return this.substring(position,position+searchString.length)===searchString}}if(typeof String.prototype.endsWith!=="function"){String.prototype.endsWith=function(suffix){return this.includes(suffix,this.length-suffix.length)}}if(typeof String.prototype.includes!=="function"){String.prototype.includes=function(search,start){if(typeof start!=="number"){start=0}if(start+search.length>this.length){return false}return this.indexOf(search,start)!==-1}}if(typeof Array.prototype.find==="undefined"){Array.prototype.find=function(predicate){if(this===null){throw new TypeError("Array.prototype.find called on null or undefined")}if(typeof predicate!=="function"){throw new TypeError("predicate must be a function")}var list=new Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list)){return value}}return undefined}}if(typeof Array.prototype.some==="undefined"){Array.prototype.some=function(predicate){if(this===null){throw new TypeError("Array.prototype.some called on null or undefined")}if(typeof predicate!=="function"){throw new TypeError("predicate must be a function")}var list=new Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list)){return true}}return false}}if(typeof Array.prototype.every==="undefined"){Array.prototype.every=function(predicate){if(this===null){throw new TypeError("Array.prototype.every called on null or undefined")}if(typeof predicate!=="function"){throw new TypeError("predicate must be a function")}var list=new Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(!predicate.call(thisArg,value,i,list)){return false}}return true}}if(typeof Array.prototype.includes==="undefined"){Array.prototype.includes=function(searchElement){var O=new Object(this);var length_=Number.parseInt(O.length)||0;if(length_===0){return false}var n=Number.parseInt(arguments[1])||0;var k;if(n>=0){k=n}else{k=length_+n;if(k<0){k=0}}var currentElement;while(k<length_){currentElement=O[k];if(searchElement===currentElement||searchElement!==searchElement&¤tElement!==currentElement){return true}k++}return false}}if(typeof Object.keys==="undefined"){Object.keys=function(object){var keys=[];for(var i in object){if(object.hasOwnProperty(i)){keys.push(i)}}return keys}}if(typeof Object.values==="undefined"){Object.values=function(object){var values=[];for(var i in object){if(object.hasOwnProperty(i)){values.push(object[i])}}return values}}if(typeof Array.prototype.filter==="undefined"){Array.prototype.filter=function(callback,thisArg){if(this===null){throw new TypeError(" this is null or not defined")}var O=new Object(this);var length_=O.length>>>0;if(typeof callback!=="function"){throw new TypeError(callback+" is not a function")}var T=thisArg;var A=[];var k=0;while(k<length_){var kValue,testResult;if(k in O){kValue=O[k];testResult=callback.call(T,kValue,k,O);if(testResult){A.push(kValue)}}k++}return A}}if(typeof Array.prototype.flat==="undefined"){Array.prototype.flat=function(){var depth=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this.reduce(function(acc,cur){if(Array.isArray(cur)){return acc.concat(cur.flat(depth-1))}return acc.concat(cur)},[])}}/** * ChildNode.append() polyfill * https://gomakethings.com/adding-an-element-to-the-end-of-a-set-of-elements-with-vanilla-javascript/ * @author Chris Ferdinandi * @license MIT */(function(elem){var isNode=function isNode(object){if(typeof Node==="function"){return _instanceof(object,Node)}return object&&typeof object==="object"&&object.nodeName&&object.nodeType>=1&&object.nodeType<=12};for(var i=0;i<elem.length;i++){if(!window[elem[i]]||"append"in window[elem[i]].prototype){continue}window[elem[i]].prototype.append=function(){var argArr=Array.prototype.slice.call(arguments);var docFrag=document.createDocumentFragment();for(var n=0;n<argArr.length;n++){docFrag.appendChild(isNode(argArr[n])?argArr[n]:document.createTextNode(String(argArr[n])))}this.appendChild(docFrag)}}})(["Element","CharacterData","DocumentType"]);/** * ChildNode.remove() polyfill * https://gomakethings.com/removing-an-element-from-the-dom-the-es6-way/ * @author Chris Ferdinandi * @license MIT */(function(elem){for(var i=0;i<elem.length;i++){if(!window[elem[i]]||"remove"in window[elem[i]].prototype){continue}window[elem[i]].prototype.remove=function(){this.parentNode.removeChild(this)}}})(["Element","CharacterData","DocumentType"]);if(typeof Date.now==="undefined"){Date.now=function(){return new Date().getTime()}}"use strict";function finallyConstructor(callback){var constructor=this.constructor;return this.then(function(value){return constructor.resolve(callback()).then(function(){return value})},function(reason){return constructor.resolve(callback()).then(function(){return constructor.reject(reason)})})}function allSettled(arr){var P=this;return new P(function(resolve,reject){if(!(arr&&typeof arr.length!=="undefined")){return reject(new TypeError((typeof arr==="undefined"?"undefined":_typeof(arr))+" "+arr+" is not iterable(cannot read property Symbol(Symbol.iterator))"))}var args=Array.prototype.slice.call(arr);if(args.length===0){return resolve([])}var remaining=args.length;function res(i,val){if(val&&(typeof val==="object"||typeof val==="function")){var then=val.then;if(typeof then==="function"){then.call(val,function(val){res(i,val)},function(e){args[i]={status:"rejected",reason:e};if(--remaining===0){resolve(args)}});return}}args[i]={status:"fulfilled",value:val};if(--remaining===0){resolve(args)}}for(var i=0;i<args.length;i++){res(i,args[i])}})}var setTimeoutFunc=setTimeout;function isArray(x){return Boolean(x&&typeof x.length!=="undefined")}function noop(){}function bind(fn,thisArg){return function(){fn.apply(thisArg,arguments)}}function Promise1(fn){if(!_instanceof(this,Promise1)){throw new TypeError("Promises must be constructed via new")}if(typeof fn!=="function"){throw new TypeError("not a function")}this._state=0;this._handled=false;this._value=undefined;this._deferreds=[];doResolve(fn,this)}function handle(self,deferred){while(self._state===3){self=self._value}if(self._state===0){self._deferreds.push(deferred);return}self._handled=true;Promise1._immediateFn(function(){var cb=self._state===1?deferred.onFulfilled:deferred.onRejected;if(cb===null){(self._state===1?resolve:reject)(deferred.promise,self._value);return}var ret;try{ret=cb(self._value)}catch(e){reject(deferred.promise,e);return}resolve(deferred.promise,ret)})}function resolve(self,newValue){try{if(newValue===self){throw new TypeError("A promise cannot be resolved with itself.")}if(newValue&&(typeof newValue==="object"||typeof newValue==="function")){var then=newValue.then;if(_instanceof(newValue,Promise1)){self._state=3;self._value=newValue;finale(self);return}else if(typeof then==="function"){doResolve(bind(then,newValue),self);return}}self._state=1;self._value=newValue;finale(self)}catch(e){reject(self,e)}}function reject(self,newValue){self._state=2;self._value=newValue;finale(self)}function finale(self){if(self._state===2&&self._deferreds.length===0){Promise1._immediateFn(function(){if(!self._handled){Promise1._unhandledRejectionFn(self._value)}})}for(var i=0,len=self._deferreds.length;i<len;i++){handle(self,self._deferreds[i])}self._deferreds=null}function Handler(onFulfilled,onRejected,promise){this.onFulfilled=typeof onFulfilled==="function"?onFulfilled:null;this.onRejected=typeof onRejected==="function"?onRejected:null;this.promise=promise}function doResolve(fn,self){var done=false;try{fn(function(value){if(done){return}done=true;resolve(self,value)},function(reason){if(done){return}done=true;reject(self,reason)})}catch(ex){if(done){return}done=true;reject(self,ex)}}Promise1.prototype["catch"]=function(onRejected){return this.then(null,onRejected)};Promise1.prototype.then=function(onFulfilled,onRejected){var prom=new this.constructor(noop);handle(this,new Handler(onFulfilled,onRejected,prom));return prom};Promise1.prototype["finally"]=finallyConstructor;Promise1.all=function(arr){return new Promise1(function(resolve,reject){if(!isArray(arr)){return reject(new TypeError("Promise.all accepts an array"))}var args=Array.prototype.slice.call(arr);if(args.length===0){return resolve([])}var remaining=args.length;function res(i,val){try{if(val&&(typeof val==="object"||typeof val==="function")){var then=val.then;if(typeof then==="function"){then.call(val,function(val){res(i,val)},reject);return}}args[i]=val;if(--remaining===0){resolve(args)}}catch(ex){reject(ex)}}for(var i=0;i<args.length;i++){res(i,args[i])}})};Promise1.allSettled=allSettled;Promise1.resolve=function(value){if(value&&typeof value==="object"&&value.constructor===Promise1){return value}return new Promise1(function(resolve){resolve(value)})};Promise1.reject=function(value){return new Promise1(function(resolve,reject){reject(value)})};Promise1.race=function(arr){return new Promise1(function(resolve,reject){if(!isArray(arr)){return reject(new TypeError("Promise.race accepts an array"))}for(var i=0,len=arr.length;i<len;i++){Promise1.resolve(arr[i]).then(resolve,reject)}})};Promise1._immediateFn=typeof setImmediate==="function"&&function(fn){setImmediate(fn)}||function(fn){setTimeoutFunc(fn,0)};Promise1._unhandledRejectionFn=function _unhandledRejectionFn(err){if(typeof console!=="undefined"&&console){console.warn("Possible Unhandled Promise Rejection:",err)}};if(typeof window.Promise!=="function"){window.Promise=Promise1}else{if(!window.Promise.prototype["finally"]){window.Promise.prototype["finally"]=finallyConstructor}if(!window.Promise.allSettled){window.Promise.allSettled=allSettled}}"use strict";var checkIfIteratorIsSupported=function checkIfIteratorIsSupported(){try{return!!Symbol.iterator}catch(error){return false}};var iteratorSupported=checkIfIteratorIsSupported();var createIterator=function createIterator(items){var iterator={next:function next(){var value=items.shift();return{done:value===void 0,value:value}}};if(iteratorSupported){iterator[Symbol.iterator]=function(){return iterator}}return iterator};var serializeParam=function serializeParam(value){return encodeURIComponent(value).replace(/%20/g,"+")};var deserializeParam=function deserializeParam(value){return decodeURIComponent(String(value).replace(/\+/g," "))};var polyfillURLSearchParams=function polyfillURLSearchParams(){var URLSearchParams=function URLSearchParams1(searchString){Object.defineProperty(this,"_entries",{writable:true,value:{}});var typeofSearchString=typeof searchString==="undefined"?"undefined":_typeof(searchString);if(typeofSearchString==="undefined"){}else if(typeofSearchString==="string"){if(searchString!==""){this._fromString(searchString)}}else if(_instanceof(searchString,URLSearchParams)){var _this=this;searchString.forEach(function(value,name){_this.append(name,value)})}else if(searchString!==null&&typeofSearchString==="object"){if(Object.prototype.toString.call(searchString)==="[object Array]"){for(var i=0;i<searchString.length;i++){var entry=searchString[i];if(Object.prototype.toString.call(entry)==="[object Array]"||entry.length!==2){this.append(entry[0],entry[1])}else{throw new TypeError("Expected [string, any] as entry at index "+i+" of URLSearchParams's input")}}}else{for(var key in searchString){if(searchString.hasOwnProperty(key)){this.append(key,searchString[key])}}}}else{throw new TypeError("Unsupported input's type for URLSearchParams")}};var proto=URLSearchParams.prototype;proto.append=function(name,value){if(name in this._entries){this._entries[name].push(String(value))}else{this._entries[name]=[String(value)]}};proto.delete=function(name){delete this._entries[name]};proto.get=function(name){return name in this._entries?this._entries[name][0]:null};proto.getAll=function(name){return name in this._entries?this._entries[name].slice(0):[]};proto.has=function(name){return name in this._entries};proto.set=function(name,value){this._entries[name]=[String(value)]};proto.forEach=function(callback,thisArg){var entries;for(var name in this._entries){if(this._entries.hasOwnProperty(name)){entries=this._entries[name];for(var i=0;i<entries.length;i++){callback.call(thisArg,entries[i],name,this)}}}};proto.keys=function(){var items=[];this.forEach(function(value,name){items.push(name)});return createIterator(items)};proto.values=function(){var items=[];this.forEach(function(value){items.push(value)});return createIterator(items)};proto.entries=function(){var items=[];this.forEach(function(value,name){items.push([name,value])});return createIterator(items)};if(iteratorSupported){proto[Symbol.iterator]=proto.entries}proto.toString=function(){var searchArray=[];this.forEach(function(value,name){searchArray.push(serializeParam(name)+"="+serializeParam(value))});return searchArray.join("&")};window.URLSearchParams=URLSearchParams};var checkIfURLSearchParamsSupported=function checkIfURLSearchParamsSupported(){try{var URLSearchParams=window.URLSearchParams;return new URLSearchParams("?a=1").toString()==="a=1"&&typeof URLSearchParams.prototype.set==="function"&&typeof URLSearchParams.prototype.entries==="function"}catch(e){return false}};if(!checkIfURLSearchParamsSupported()){polyfillURLSearchParams()}var proto=window.URLSearchParams.prototype;if(typeof proto.sort!=="function"){proto.sort=function(){var _this=this;var items=[];this.forEach(function(value,name){items.push([name,value]);if(!_this._entries){_this.delete(name)}});items.sort(function(a,b){if(a[0]<b[0]){return-1}else if(a[0]>b[0]){return+1}else{return 0}});if(_this._entries){_this._entries={}}for(var i=0;i<items.length;i++){this.append(items[i][0],items[i][1])}}}if(typeof proto._fromString!=="function"){Object.defineProperty(proto,"_fromString",{enumerable:false,configurable:false,writable:false,value:function value(searchString){if(this._entries){this._entries={}}else{var keys=[];this.forEach(function(value,name){keys.push(name)});for(var i=0;i<keys.length;i++){this.delete(keys[i])}}searchString=searchString.replace(/^\?/,"");var attributes=searchString.split("&");var attribute;for(var i=0;i<attributes.length;i++){attribute=attributes[i].split("=");this.append(deserializeParam(attribute[0]),attribute.length>1?deserializeParam(attribute[1]):"")}}})}var checkIfURLIsSupported=function checkIfURLIsSupported(){try{var u=new window.URL("b","http://a");u.pathname="c d";return u.href==="http://a/c%20d"&&u.searchParams}catch(e){return false}};var polyfillURL=function polyfillURL(){var _URL=window.URL;var URL1=function URL1(url,base){if(typeof url!=="string"){url=String(url)}if(base&&typeof base!=="string"){base=String(base)}var doc=document,baseElement;if(base&&(window.location===void 0||base!==window.location.href)){base=base.toLowerCase();doc=document.implementation.createHTMLDocument("");baseElement=doc.createElement("base");baseElement.href=base;doc.head.appendChild(baseElement);try{if(baseElement.href.indexOf(base)!==0){throw new Error(baseElement.href)}}catch(err){throw new Error("URL unable to set base "+base+" due to "+err)}}var anchorElement=doc.createElement("a");anchorElement.href=url;if(baseElement){doc.body.appendChild(anchorElement);anchorElement.href=anchorElement.href}var inputElement=doc.createElement("input");inputElement.type="url";inputElement.value=url;if(anchorElement.protocol===":"||!/:/.test(anchorElement.href)||!inputElement.checkValidity()&&!base){throw new TypeError("Invalid URL")}Object.defineProperty(this,"_anchorElement",{value:anchorElement});var searchParams=new window.URLSearchParams(this.search);var enableSearchUpdate=true;var enableSearchParamsUpdate=true;var _this=this;["append","delete","set"].forEach(function(methodName){var method=searchParams[methodName];searchParams[methodName]=function(){method.apply(searchParams,arguments);if(enableSearchUpdate){enableSearchParamsUpdate=false;_this.search=searchParams.toString();enableSearchParamsUpdate=true}}});Object.defineProperty(this,"searchParams",{value:searchParams,enumerable:true});var search=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:false,configurable:false,writable:false,value:function value(){if(this.search!==search){search=this.search;if(enableSearchParamsUpdate){enableSearchUpdate=false;this.searchParams._fromString(this.search);enableSearchUpdate=true}}}})};var proto=URL1.prototype;var linkURLWithAnchorAttribute=function linkURLWithAnchorAttribute(attributeName){Object.defineProperty(proto,attributeName,{get:function get(){return this._anchorElement[attributeName]},set:function set(value){this._anchorElement[attributeName]=value},enumerable:true})};["hash","host","hostname","port","protocol"].forEach(function(attributeName){linkURLWithAnchorAttribute(attributeName)});Object.defineProperty(proto,"search",{get:function get(){return this._anchorElement["search"]},set:function set(value){this._anchorElement["search"]=value;this._updateSearchParams()},enumerable:true});Object.defineProperties(proto,{toString:{get:function get(){var _this=this;return function(){return _this.href}}},href:{get:function get(){return this._anchorElement.href.replace(/\?$/,"")},set:function set(value){this._anchorElement.href=value;this._updateSearchParams()},enumerable:true},pathname:{get:function get(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function set(value){this._anchorElement.pathname=value},enumerable:true},origin:{get:function get(){var expectedPort={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol];var addPortToOrigin=this._anchorElement.port!=expectedPort&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(addPortToOrigin?":"+this._anchorElement.port:"")},enumerable:true},password:{get:function get(){return""},set:function set(value){},enumerable:true},username:{get:function get(){return""},set:function set(value){},enumerable:true}});URL1.createObjectURL=function(blob){return _URL.createObjectURL.apply(_URL,arguments)};URL1.revokeObjectURL=function(url){return _URL.revokeObjectURL.apply(_URL,arguments)};window.URL=URL1};if(!checkIfURLIsSupported()){polyfillURL()}if(window.location!==void 0&&!("origin"in window.location)){var getOrigin=function getOrigin(){return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")};try{Object.defineProperty(window.location,"origin",{get:getOrigin,enumerable:true})}catch(e){setInterval(function(){window.location.origin=getOrigin()},100)}}!function(){"use strict";var e=function e(e,t){if(!window.Upscope._config)throw new Error("Upscope is not initialized");if(2===arguments.length&&(window.Upscope._config[e]=t),1===arguments.length){var o=window.Upscope._config[e];return"function"==typeof o?o.bind(window.Upscope._config):o}return window.Upscope._config};var t=function t(e){if(!function(e){return null==e||"string"==typeof e&&0===e.trim().length||Array.isArray(e)&&0===e.length}(e))return e};var o=function o(e){return"string"==typeof e?[e]:e};var n=function n(){return window.upscope___currentLocation?window.upscope___currentLocation():location};var r=function r(){for(var _len=arguments.length,e=new Array(_len),_key=0;_key<_len;_key++){e[_key]=arguments[_key]}s&&(e.unshift("[upscope debug]"),("*"===s||e.map(function(e){return String(e).toLowerCase()}).join("").includes(s.toLowerCase()))&&(console.__original__debug||console.debug).apply(console,e))};var a=function a(e){for(var _len=arguments.length,t=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){t[_key-1]=arguments[_key]}var _window_Upscope__config;((_window_Upscope__config=window.Upscope._config)===null||_window_Upscope__config===void 0?void 0:_window_Upscope__config.consoleAllowed)?(t.unshift("[Upscope]"),(console["__original__"+e]||console[e]).apply(console,t)):r.apply(void 0,["console"].concat(_toConsumableArray(t)))};var c=function c(e,t){return e=(e=(e=e.replace(/[\\^$.+?()[\]{}|]/g,"\\$&")).startsWith("*")?e.replace(/^\*+/,""):"^".concat(e)).endsWith("*")?e.replace(/\*+$/,""):"".concat(e,"$"),new RegExp(e.replace(/\*/g,".*")).test(t)};var l=function l(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"http";return"".concat(t,"s://").concat(e,".upscope.io")};var u=function u(e,t){var o,n=!1;return function(){for(var _len=arguments.length,s=new Array(_len),_key=0;_key<_len;_key++){s[_key]=arguments[_key]}n?(clearTimeout(o),o=setTimeout(function(){e.apply(null,s)},t)):(clearTimeout(o),e.apply(null,s),n=!0,setTimeout(function(){n=!1},t))}};var d=function d(e,t,o){e["__original__"+t]=e[t],e[t]=o;for(var _$o in e["__original__"+t])e[t][_$o]=e["__original__"+t][_$o]};var p=function p(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})};var h=function h(e,t){return Promise1.race([e,new Promise1(function(e,o){setTimeout(function(){return o(new Error("Did not complete in ".concat(t,"ms")))},t)})])};var g=function g(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:50;return new Promise1(function(o,n){var s=function(){var _ref=_asyncToGenerator(function(){var e1;return __generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,2,,3]);return[4,e()];case 1:if(!_state.sent())return[2,setTimeout(s,t)];o();return[3,3];case 2:e1=_state.sent();return[2,n(e1)];case 3:return[2]}})});return function s(){return _ref.apply(this,arguments)}}();s()})};var m=function m(e){return new Promise1(function(t){setTimeout(t,e)})};var f=function f(e){return i=i||document.createElement("a"),i.href=e,{host:i.host,hostname:i.hostname,protocol:i.protocol,port:i.port,pathname:i.pathname,origin:i.origin,search:i.search}};var _=function _(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:50;return e.length<=t?e:e.slice(0,t)+"..."};var v=function v(e,t){var o=e;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=Object.entries(t)[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _step_value=_slicedToArray(_step.value,2),_$e=_step_value[0],n=_step_value[1];o.includes("{%".concat(_$e,"%}"))&&(o=o.replace("{%".concat(_$e,"%}"),n||"")),o.includes("{%".concat(_$e,"%|"))&&(o=n?o.split("{%".concat(_$e,"%|")).map(function(e,t){return 0===t?e:e.slice(Math.max(0,e.indexOf("}")+1))}).join(n):o.split("{%".concat(_$e,"%|")).map(function(e,t){return 0===t?e:e.slice(0,Math.max(0,e.indexOf("}")))+e.slice(Math.max(0,e.indexOf("}")+1))}).join(""))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return o};var w=function w(e,t){var _ref=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=_ref.id,n=_ref.className;var s=e.createElement("div");if(o&&(s.id=o),n&&(s.className=n),s.style.all="initial",s.style.display="block",s.attachShadow&&s.attachShadow.toString().includes("[native code]")){s.attachShadow({mode:"open"}),e.body.append(s);var o1=e.createElement("style");return o1.textContent=y(t),s.shadowRoot.append(o1),s.shadowRoot.remove=s.remove.bind(s),s.shadowRoot}s.id=s.id||"upscope--"+Math.random().toString(36).slice(2,10);var i=e.createElement("style"),r=[],a=e.defaultView.getComputedStyle(e.body);for(var _$e=0;_$e<a.length;_$e++)r.push(a[_$e]);return i.textContent="\n #".concat(s.id,", #").concat(s.id," * {\n ").concat(r.filter(function(e){return!["d","stroke"].includes(e)}).map(function(e){return"".concat(e,": initial")}).join(";\n"),"\n }\n\n ").concat(y(t,"#".concat(s.id," ")),"\n "),e.head.append(i),e.body.append(s),s};var S=function S(t,o){return x(),new Promise1(function(n){var s=new I(t,o,n);k=s,s.addButton(void 0,e("translationsOk"),"ok"),s.render()})};var E=function E(t,o){return x(),new Promise1(function(n){var s=new I(t,o,n);k=s,s.addButton(!1,e("translationsNo"),"no"),s.addButton(!0,e("translationsYes"),"yes"),s.render()})};var x=function x(e){k&&k.clear(),k=null};var R=function R(e){return 1===(e===null||e===void 0?void 0:e.nodeType)};var L=function L(e){return 3===e.nodeType};var D=function D(e,t){return 1===(t===null||t===void 0?void 0:t.nodeType)&&t.tagName.toLowerCase()===e};var q=function q(e){return 11===(e===null||e===void 0?void 0:e.nodeType)&&!!e.host};var N=function N(e){return 9===(e===null||e===void 0?void 0:e.nodeType)};var P=function P(e){return e&&void 0!==e.__upscopeID?e.__upscopeID:q(e)&&void 0!==e.__upscopeRootId?e.__upscopeRootId+"-sr":null};var O=function O(e){if(void 0!==e.__upscopeScrollable)return e.__upscopeScrollable;try{var _e_ownerDocument_defaultView;var _$t=e.scrollWidth>e.clientWidth,o=e.scrollHeight>e.clientHeight,n=(_e_ownerDocument_defaultView=e.ownerDocument.defaultView)===null||_e_ownerDocument_defaultView===void 0?void 0:_e_ownerDocument_defaultView.getComputedStyle(e),s=n===null||n===void 0?void 0:n["overflow-x"],i=n===null||n===void 0?void 0:n["overflow-y"];return e.__upscopeScrollable=_$t&&"hidden"!==s||o&&"hidden"!==i,e.__upscopeScrollable}catch(t){return r("Error detecting scrollability of %o (%o)",e,t),e.__upscopeScrollable=!1,!1}};var U=function U(e){var _e_effect,_e_effect1;var t=e.__upscopeAnimationId||p(),o=(_e_effect=e.effect)===null||_e_effect===void 0?void 0:_e_effect.getTiming(),n=o?{delay:o.delay,direction:o.direction,duration:o.duration,easing:o.easing,endDelay:o.endDelay,fill:o.fill,iterationStart:o.iterationStart,iterations:o.iterations===Number.POSITIVE_INFINITY?"::infinity::":o.iterations}:void 0,s=(_e_effect1=e.effect)===null||_e_effect1===void 0?void 0:_e_effect1.getKeyframes();return e.__upscopeAnimationId=t,{animationId:t,options:n,keyframes:s}};var F=function F(e){try{var _e_getBoundingClientRect=e.getBoundingClientRect(),_$t=_e_getBoundingClientRect.top,o=_e_getBoundingClientRect.bottom,n=_e_getBoundingClientRect.height,s=_e_getBoundingClientRect.width,_e_ownerDocument_defaultView_getComputedStyle=e.ownerDocument.defaultView.getComputedStyle(e),i=_e_ownerDocument_defaultView_getComputedStyle.display,r1=_e_ownerDocument_defaultView_getComputedStyle.visibility,a=_e_ownerDocument_defaultView_getComputedStyle.opacity,c=Math.max(e.ownerDocument.documentElement.clientHeight,e.ownerDocument.defaultView.innerHeight);return o>=0&&_$t-c<0&&n>5&&s>5&&"none"!==i&&"hidden"!==r1&&"0"!==a}catch(t){return r("Error detecting visibility of %o (%o)",e,t),!0}};var B=function B(e){var t={};var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e.attributes[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;t[o.name]=o.value}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return t};var W=function W(e){var t=e,o="TEXT_NODE"===T[e.nodeType]?e.textContent:"";for(;null!==(t=t.previousSibling);){if("TEXT_NODE"!==T[t.nodeType]){if("COMMENT_NODE"===T[t.nodeType])continue;break}o=t.textContent+o}for(t=e;null!==(t=t.nextSibling);){if("TEXT_NODE"!==T[t.nodeType]){if("COMMENT_NODE"===T[t.nodeType])continue;break}o+=t.textContent}return o};var z=function z(e){return void 0===e.pageXOffset?(e.document.documentElement||e.document.body.parentNode||e.document.body).scrollLeft:e.pageXOffset};var j=function j(e){return void 0===e.pageYOffset?(e.document.documentElement||e.document.body.parentNode||e.document.body).scrollTop:e.pageYOffset};var H=function H(t){var o="upscope__iframe__access";if("upscopeStorageFrame"===t.id)return!1;if(e("maskElementMiddleware")(t))return!1;if(void 0!==t.__upscopeFailingAccessAt&&Date.now()-t.__upscopeFailingAccessAt.getTime()<Math.min(500*t.__upscopeFailingCount,5e3))return!1;t.__upscopeFailingAccessAt=new Date,t.__upscopeFailingCount=t.__upscopeFailingCount||0,t.__upscopeFailingCount++;try{var _$e=t.contentWindow;if(_$e[o]="iframeAccessOn","iframeAccessOn"===_$e[o])return delete t.__upscopeFailingAccessAt,delete t.__upscopeFailingCount,!0}catch(e1){r("Error accessing iframe %o (%o)",t,e1)}return!1};var $=function $(e,t){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;var s=_toConsumableArray(e.querySelectorAll("iframe,frame"));K(e,function(e){var _$t=e.querySelectorAll("iframe,frame");var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=_$t[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;s.push(_$e)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}});var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=s[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;if(!n&&!F(_$e))continue;if(_$e.__upscopeChildFrameHandler){o&&o(_$e,_$e.__upscopeChildFrameHandler);continue}var s1=!1;try{void 0!==_$e.contentWindow&&H(_$e)&&(s1=!0)}catch(t1){r("Skipping iframe %o due to error %o",_$e,t1)}s1&&t(_$e)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}};var G=function G(e){var t=[];var _Q=_slicedToArray(Q(e),2),o=_Q[0],n=_Q[1];for(;void 0!==o&&void 0!==n;){var s=e.indexOf(o)+o.length,i=e.slice(s).indexOf(n),r=i+s;if(-1===s||-1===i)break;var a=e.slice(s,s+i),c=e.slice(r+n.length);var ref;t.includes(a)||t.push(a),e=c,ref=_slicedToArray(Q(e),2),o=ref[0],n=ref[1],ref}return t};var Q=function Q(e){var t=[["url('","')",!1],['url("','")',!1],["url(",")",!1],["'","'",!0],['"','"',!0]];var o,n=[void 0,void 0];var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=t[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _step_value=_slicedToArray(_step.value,3),s=_step_value[0],i=_step_value[1],r=_step_value[2];(!r||e.slice(0,1)===e.slice(-1,0)&&e.slice(-1,0)===s)&&(!r||"/"===e.slice(1,2)||".."===e.slice(1,3)||"http"===e.slice(1,5)||e.includes("/")&&e.includes(".")&&"."!==e.slice(-1,0)&&"/"!==e.slice(-1,0))&&e.includes(s)&&(void 0===o||o>e.indexOf(s))&&(o=e.indexOf(s),n=[s,i])}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return n};var V=function V(e){return"getElementsByTagName"in e?_toConsumableArray(e.getElementsByTagName("*")):_toConsumableArray(e.querySelectorAll("*"))};var X=function X(e){try{var t=document.cookie.match("(^|;) ?"+e+"=([^;]*)(;|$)");return t?atob(t[2]):null}catch(e1){return null}};var Z=function Z(e,t,o,n){try{t&&(t=btoa(t)),n!==null&&n!==void 0?n:n=new Date,n.setMonth(n.getMonth()+1),document.cookie="".concat(e,"=").concat(t,";domain=.").concat(o,";path=/;expires=").concat(n.toUTCString())}catch(e1){}};var ee=function ee(e){return{detect:function detect(t,o){if(!e.getAnimations)return;var n=function(e){e.__upscopeEventSent||"[object Animation]"===Object.prototype.toString.apply(e)&&(e.__upscopeEventSent=!0,o(e))},s=setInterval(function(){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e.getAnimations()[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$t=_step.value;n(_$t)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}},1e3);var i=e.defaultView.Element.prototype.animate;var r;e.defaultView.Element.prototype.animate=function(){for(var _len=arguments.length,_$e=new Array(_len),_key=0;_key<_len;_key++){_$e[_key]=arguments[_key]}var _i;var _$t=(_i=i).call.apply(_i,[this].concat(_toConsumableArray(_$e)));return n(_$t),_$t},t((r=s,function(){e.defaultView&&(e.defaultView.Element.prototype.animate=i),clearInterval(r)}))},encode:function encode(e){var _e_effect;if(!((_e_effect=e.effect)===null||_e_effect===void 0?void 0:_e_effect.target))return;var t=M(e.effect.target),_U=U(e),o=_U.keyframes,n=_U.options,s=_U.animationId;return t?{animationStart:{elementId:t,keyframes:o,options:n,animationId:s}}:void 0}}};var te=function te(e){return{detect:function detect(t,o){var n=e.defaultView.Animation.prototype.cancel;e.defaultView.Animation.prototype.cancel=function(){for(var _len=arguments.length,_$e=new Array(_len),_key=0;_key<_len;_key++){_$e[_key]=arguments[_key]}var _n;var _$t=(_n=n).call.apply(_n,[this].concat(_toConsumableArray(_$e)));return o(this),_$t},t(function(){e.defaultView&&(e.defaultView.Animation.prototype.cancel=n)})},encode:function encode(e){var _e_effect;if(!((_e_effect=e.effect)===null||_e_effect===void 0?void 0:_e_effect.target))return;var t=M(e.effect.target),_U=U(e),o=_U.animationId;return t?{animationCancel:{elementId:t,animationId:o}}:void 0}}};var oe=function oe(e){return{detect:function detect(t,o){var n;e.addEventListener("focusout",o),t((n=o,function(){e.removeEventListener("focusout",n)}));var s=function(e){D("select",e.target)&&!e.target.multiple&&e.target.blur()};e.addEventListener("change",s),t(function(t){return function(){e.removeEventListener("change",t)}}(s))},encode:function encode(e){if(!R(e.target)||e.target.__upscopeMasked)return;var t=M(e.target);return t?{blur:{elementId:t}}:void 0}}};var ne=function ne(e){return{detect:function detect(t,o){e.addEventListener("play",o,!0),e.addEventListener("pause",o,!0),e.addEventListener("seeked",o,!0),e.addEventListener("ratechange",o,!0),e.addEventListener("volumechange",o,!0);var n=setInterval(function(){try{var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e.querySelectorAll("video")[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$t=_step.value;o({target:_$t})}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}catch(e1){r("Error collecting videos (%o)",e1),clearInterval(n)}},5e3);try{var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e.querySelectorAll("video")[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$t=_step.value;o({target:_$t})}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}catch(e1){r("Error collecting videos (%o)",e1)}var s;t((s=o,function(){e.removeEventListener("play",s,!0),e.removeEventListener("pause",s,!0),e.removeEventListener("seeked",s,!0),e.removeEventListener("ratechange",s,!0),e.removeEventListener("volumechange",s,!0),clearInterval(n)}))},encode:function encode(e){var t=e.target;if(!D("video",t)||t.__upscopeMasked)return;if(t.dataset&&"yes"===t.dataset.upscopeProxyStream)return;var o=M(t);return o?{videoStatusChange:{elementId:o,time:t.currentTime,playing:!t.paused,playbackRate:t.playbackRate,muted:t.muted}}:void 0}}};var se=function se(e){return{detect:function detect(t,o){var n=function(e){e.isUpscopeBrowserInstruction||o(e)};var s;e.addEventListener("click",n),t((s=n,function(){e.removeEventListener("click",s)}))},encode:function encode(e){var o;R(e.target)&&!e.target.__upscopeMasked&&(o=M(e.target));return{click:{x:e.clientX,y:e.clientY,elementId:t(o)}}}}};var ie=function ie(t,o){var n=o.document;var s,i=0;return{detect:function detect(t,o){var _a;var i=e("domChangesDelay")||0;var r,a=[];i>0&&(r=setInterval(function(){a.length>0&&(o(a),a=[])},i)),s=new MutationObserver(0===i?o:function(e){return(_a=a).push.apply(_a,_toConsumableArray(e))}),s.observe(n,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeOldValue:!0});var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=V(n)[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var e1=_step.value;e1.shadowRoot&&s.observe(e1.shadowRoot,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeOldValue:!0})}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}var c;t((c=s,function(){r&&clearInterval(r),c.disconnect()}))},encode:function encode(e){return _asyncToGenerator(function(){var r,a,c,l,u,d,p,h,g,m,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_loop,_iterator,_step,_ret,err,_iteratorNormalCompletion1,_didIteratorError1,_iteratorError1,_iterator1,_step1,_$e,f,_;return __generator(this,function(_state){switch(_state.label){case 0:i++;r=String(i),a=[],c=[],l=[],u=[],d=[],p=[],h=[],g=[],m=[];_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;_state.label=1;case 1:_state.trys.push([1,6,7,8]);_loop=function(){var s,_$e,_tmp,_tmp1,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step1,_$e1,_$e2,_$e3;return __generator(this,function(_state){switch(_state.label){case 0:s=_step.value;_$e=s.target;if(!(_$e===n))return[3,2];_tmp={};_tmp1={};return[4,t.getSnapshot(o)];case 1:return[2,(_tmp.v=(_tmp1.pageLoad=_state.sent(),_tmp1),_tmp)];case 2:for(;_$e;)delete _$e.__upscopeScrollable,m.push(_$e),_$e=_$e.parentNode||_$e.host;switch(s.type){case"childList":_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=s.addedNodes[Symbol.iterator]();!(_iteratorNormalCompletion=(_step1=_iterator.next()).done);_iteratorNormalCompletion=true){_$e1=_step1.value;c.push(_$e1)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}if(s.previousSibling){_$e2=s.previousSibling;for(;_$e2;){if(R(_$e2)||L(_$e2)){l.push(_$e2);break}_$e2=_$e2.previousSibling}}if(s.nextSibling){_$e3=s.nextSibling;for(;_$e3;){if(R(_$e3)||L(_$e3)){u.push(_$e3);break}_$e3=_$e3.nextSibling}}s.removedNodes.length>0&&0===_toConsumableArray(s.target.childNodes).filter(function(e){return R(e)||L(e)}).length&&d.push(s.target);break;case"attributes":p.push(s.target);break;default:h.push(s.target)}return[2]}})};_iterator=e[Symbol.iterator]();_state.label=2;case 2:if(!!(_iteratorNormalCompletion=(_step=_iterator.next()).done))return[3,5];return[5,__values(_loop())];case 3:_ret=_state.sent();if(_typeof(_ret)==="object")return[2,_ret.v];_state.label=4;case 4:_iteratorNormalCompletion=true;return[3,2];case 5:return[3,8];case 6:err=_state.sent();_didIteratorError=true;_iteratorError=err;return[3,8];case 7:try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}return[7];case 8:if(h.length+d.length+c.length+l.length+u.length>0){_iteratorNormalCompletion1=true,_didIteratorError1=false,_iteratorError1=undefined;try{for(_iterator1=c[Symbol.iterator]();!(_iteratorNormalCompletion1=(_step1=_iterator1.next()).done);_iteratorNormalCompletion1=true){_$e=_step1.value;R(_$e)&&t.removeIdsFromElement(_$e,!0)}}catch(err){_didIteratorError1=true;_iteratorError1=err}finally{try{if(!_iteratorNormalCompletion1&&_iterator1.return!=null){_iterator1.return()}}finally{if(_didIteratorError1){throw _iteratorError1}}}t.ensureHasIds(r,n,n.__upscopeRootId,function(e){var _$t=e.shadowRoot;_$t&&s.observe(_$t,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeOldValue:!0})})}f=function(){var _ref=_asyncToGenerator(function(e){var _i_parentNode,_$o,n,s,i,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,i1,_$e,s1,_,_tmp,_tmp1,_tmp2,_tmp3,_tmp4,_tmp5,_tmp6,_1,_tmp7,_tmp8,_tmp9,_2,err;return __generator(this,function(_state){switch(_state.label){case 0:s=[];i=e.shadowRoot;i&&f(i);_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;_state.label=1;case 1:_state.trys.push([1,29,30,31]);_iterator=e.childNodes[Symbol.iterator]();_state.label=2;case 2:if(!!(_iteratorNormalCompletion=(_step=_iterator.next()).done))return[3,28];i1=_step.value;if(!((R(i1)||L(i1)||q(i1))&&!((_i_parentNode=i1.parentNode)===null||_i_parentNode===void 0?void 0:_i_parentNode.__upscopeMasked)))return[3,27];if(!n)return[3,5];if(!(c.includes(i1)||!R(i1)))return[3,4];return[4,t.encodeNode(i1)];case 3:_$e=_state.sent();_$e&&n.newNodes.push(_$e);return[3,27];case 4:n.after=M(i1),a.push(n),n=void 0;return[3,21];case 5:if(!c.includes(i1))return[3,7];return[4,t.encodeNode(i1)];case 6:s1=_state.sent();n={batch:r,elementId:M(e),type:"children",newNodes:s1?[s1]:[],before:_$o?M(_$o):void 0};return[3,27];case 7:if(!(l.includes(i1)&&u.includes(i1)))return[3,9];_=a.push;_tmp={batch:r,elementId:M(e),type:"children"};return[4,t.encodeNode(e).then(function(e){return e.c})];case 8:return[2,void _.apply(a,[(_tmp.newNodes=_state.sent(),_tmp)])];case 9:if(!l.includes(i1))return[3,13];if(!R(i1))return[3,10];_tmp2={batch:r,elementId:M(e),type:"children",newNodes:[],before:M(i1)};return[3,12];case 10:_tmp3={batch:r,elementId:M(e),type:"children"};return[4,t.encodeNode(i1)];case 11:_tmp2=(_tmp3.newNodes=[_state.sent()],_tmp3.before=_$o?M(_$o):void 0,_tmp3);_state.label=12;case 12:_tmp1=n=_tmp2;return[3,20];case 13:if(!u.includes(i1))return[3,14];_tmp4=R(i1)?a.push({batch:r,elementId:M(e),type:"children",newNodes:s,before:_$o?M(_$o):void 0,after:M(i1)}):n={batch:r,elementId:M(e),type:"children",newNodes:s,before:_$o?M(_$o):void 0};return[3,19];case 14:_tmp5=h.includes(i1);if(!_tmp5)return[3,18];if(!R(i1))return[3,16];_1=a.push;_tmp7={batch:r,elementId:M(i1),type:"html"};return[4,t.encodeNode(i1)];case 15:_tmp6=_1.apply(a,[(_tmp7.html=_state.sent(),_tmp7)]);return[3,17];case 16:_tmp6=g.includes(M(i1))||(g.push(M(i1)),a.push({batch:r,elementId:M(i1),type:"text",text:W(i1)}));_state.label=17;case 17:_tmp5=_tmp6;_state.label=18;case 18:_tmp4=_tmp5;_state.label=19;case 19:_tmp1=_tmp4;_state.label=20;case 20:_tmp1;_state.label=21;case 21:d.includes(i1)&&a.push({batch:r,elementId:M(i1),type:"children",newNodes:[]}),p.includes(i1)&&a.push({batch:r,elementId:M(i1),type:"attributes",attributes:B(i1)});if(!(R(i1)||q(i1)))return[3,24];_$o=i1,s=[];_tmp9=!D("script",i1)&&m.includes(i1);if(!_tmp9)return[3,23];return[4,f(i1)];case 22:_tmp9=_state.sent();_state.label=23;case 23:_tmp8=_tmp9;return[3,26];case 24:_2=s.push;return[4,t.encodeNode(i1)];case 25:_tmp8=_2.apply(s,[_state.sent()]);_state.label=26;case 26:_tmp8;_state.label=27;case 27:_iteratorNormalCompletion=true;return[3,2];case 28:return[3,31];case 29:err=_state.sent();_didIteratorError=true;_iteratorError=err;return[3,31];case 30:try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}return[7];case 31:n&&a.push(n);return[2]}})});return function f(e){return _ref.apply(this,arguments)}}();return[4,f(n)];case 9:_state.sent();return[4,t.collectNewAssets(n)];case 10:_=_state.sent();return[2,(t.activateForWindow(),{domChange:{changes:a,assets:_}})]}})})()}}};var re=function re(e){return{detect:function detect(t,o){var n;e.addEventListener("focusin",o),t((n=o,function(){e.removeEventListener("focusin",n)}))},encode:function encode(e){if(!R(e.target)||e.target.__upscopeMasked)return;var t=M(e.target);return t?{focus:{elementId:t}}:void 0}}};var ae=function ae(e){return{detect:function detect(t,o){var n=u(function(e){e.isUpscopeBrowserInstruction||o(e)},100);var s;e.addEventListener("mousemove",n),e.addEventListener("mouseleave",n),t((s=n,function(){e.removeEventListener("mousemove",s),e.removeEventListener("mouseleave",s)}))},encode:function encode(o){if("mouseleave"===o.type&&!o.toElement&&!o.relatedTarget)return{mouseMove:{x:-1,y:-1}};var n,s=e.elementFromPoint(o.clientX,o.clientY);return s&&!s.__upscopeMasked&&(n=t(M(s))),{mouseMove:{x:o.clientX,y:o.clientY,hoverElementId:n}}}}};var ce=function ce(e){return{detect:function detect(t,o){var n=function(e){e.isUpscopeBrowserInstruction||o(e)};var s;e.addEventListener("mouseover",n),t((s=n,function(){e.removeEventListener("mouseover",s)}))},encode:function encode(e){if(!R(e.target)||e.target.__upscopeMasked)return;var t=M(e.target);return t?{mouseEnter:{elementId:t}}:void 0}}};var le=function le(e){return{detect:function detect(t,o){var n=function(e){e.isUpscopeBrowserInstruction||o(e)};var s;e.addEventListener("mouseout",n),t((s=n,function(){e.removeEventListener("mouseout",s)}))},encode:function encode(e){if(!R(e.target)||e.target.__upscopeMasked)return;var t=M(e.target);return t?{mouseLeave:{elementId:t}}:void 0}}};var ue=function ue(e){return{detect:function detect(t,o){var n={},s=function s(t){var s=t.target;if(!R(s)&&!N(s))return;var i=s===e.document?"document":M(s);i&&(void 0===n[i]&&(n[i]=u(function(e){delete n[i],o(e)},100)),n[i](t))};var i;e.document.addEventListener("scroll",s,!0),t((i=s,function(){e.document.removeEventListener("scroll",i,!0)}))},encode:function encode(t){var o=t.target;if(N(o))return{scroll:{x:z(e),y:j(e)}};if(R(o)&&!o.__upscopeMasked){var _$e=M(o);if(!_$e)return;return{scroll:{elementId:_$e,x:o.scrollLeft,y:o.scrollTop}}}}}};var de=function de(e,t){var o={},n=!0;function s(s){var i=e.getFormValues(t);if(!n)for(var _$e in i){if(!i.hasOwnProperty(_$e))continue;var _$t=i[_$e];o[_$e]!==_$t&&s({elementId:_$e,value:_$t})}n=!1,o=i}return{detect:function detect(e,t){var o=setInterval(function(){try{s(t)}catch(e){r("Error collecting value changes (%o)",e),clearInterval(o)}},500);try{s(t)}catch(e1){r("Error collecting value changes (%o)",e1)}var n;e((n=o,function(){clearInterval(n)}))},encode:function(e){return{valueChange:e}}}};var pe=function pe(e){var t;return{detect:function detect(o,n){var s=setInterval(function(){return function(o){var _$n=void 0===t,s=function(){var t=location.hash.length>0?e.getElementById(location.hash.slice(1)):void 0;if(t&&!t.__upscopeMasked)return t.__upscopeID}();s&&s!==t&&!_$n&&o(s),t=s}(n)},500);var i;o((i=s,function(){clearInterval(i)}))},encode:function(e){return{targetChange:{elementId:e}}}}};var he=function he(e,t){var o,n={},s=!0;function i(i){var r=e.getCanvasUrls(t,2),a=[];if(!s)for(var _$e in r){if(!r.hasOwnProperty(_$e))continue;var _$t=r[_$e];void 0!==n[_$e]&&n[_$e].length===_$t.length&&n[_$e]===_$t||a.push(_$e)}if(s=!1,n=r,a.length>0){var n1=e.getCanvasUrls(t,1);var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=a[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e1=_step.value;i({elementId:_$e1,url:n1[_$e1]})}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}clearTimeout(o),o=setTimeout(function(){var o=e.getCanvasUrls(t,0);var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=a[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;i({elementId:_$e,url:o[_$e]})}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}},1e3)}}return{detect:function detect(e,t){var o=setInterval(function(){try{i(t)}catch(e){r("Error collecting canvas changes (%o)",e),clearInterval(o)}},200);try{i(t)}catch(e1){r("Error collecting canvas changes (%o)",e1)}var n;e((n=o,function(){clearInterval(n)}))},encode:function(e){return{canvasChange:e}}}};var ge=function ge(e,t){var o={},n=!0;function s(s){var i=e.getMaskedElementsSizes(t);if(!n)for(var _$e in i){if(!i.hasOwnProperty(_$e))continue;var _$t=i[_$e];o[_$e]!==_$t&&s({elementId:_$e,size:_$t})}n=!1,o=i}return{detect:function detect(e,t){var o=setInterval(function(){try{s(t)}catch(e){r("Error collecting masked elements changes (%o)",e),clearInterval(o)}},500);try{s(t)}catch(e1){r("Error collecting masked elements changes (%o)",e1)}var n;e((n=o,function(){clearInterval(n)}))},encode:function(e){return{maskedElementSizeChange:e}}}};var me=function me(e,t){var o={},n=!0;function s(s){var i=e.getStyleSheetContents(t);if(!n)for(var _$e in i){if(!i.hasOwnProperty(_$e))continue;var _$t=i[_$e];o[_$e]!==_$t&&s({elementId:_$e,content:_$t})}n=!1,o=i}return{detect:function detect(e,t){var o=setInterval(function(){try{s(t)}catch(e){r("Error collecting style sheet changes (%o)",e),clearInterval(o)}},500);try{s(t)}catch(e1){r("Error collecting style sheet changes (%o)",e1)}var n;e((n=o,function(){clearInterval(n)}))},encode:function(e){return{styleSheetChange:e}}}};var fe=function fe(e){return{detect:function detect(t,o){if(e)return;var n=u(o,1e3);var s;window.addEventListener("resize",n),t((s=n,function(){window.removeEventListener("resize",s)}))},encode:function(e){return{windowResize:{w:window.innerWidth,h:window.innerHeight}}}}};var ve=function ve(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;var o=e.ownerDocument,n=o.upscopePseudoCanvas||o.createElement("canvas");o.upscopePseudoCanvas=n,n.getContext("2d").clearRect(0,0,n.width,n.height);var s={0:1200,.5:900,1:600,2:100}[t],i={0:.8,.5:.6,1:.6,2:.2}[t];if(D("canvas",e)&&(n.width=Math.min(e.width,s),n.height=e.height/e.width*n.width,n.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height)),D("img",e)){if(0===e.naturalWidth)throw new Error("Image is not loaded");if(e.currentSrc&&e.currentSrc!==e.src)throw new Error("Image is using srcset entry");n.width=Math.min(e.naturalWidth,s),n.height=e.naturalHeight/e.naturalWidth*n.width,n.getContext("2d").drawImage(e,0,0,e.naturalWidth,e.naturalHeight,0,0,n.width,n.height)}return D("video",e)&&(n.width=Math.min(e.videoWidth,s),n.height=e.videoHeight/e.videoWidth*n.width,n.getContext("2d").drawImage(e,0,0,e.videoWidth,e.videoHeight,0,0,n.width,n.height)),n.toDataURL("image/webp",i)};var we=function we(e){var t="";var o=e.cssRules||e.rules;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=o[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;_$e.cssText&&(t+=_$e.cssText)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return t};var qe=function qe(){try{return De.FrontChat("user_id")}catch(e){return}};var Ue=function Ue(){try{var _Oe_LiveChatWidget_get=Oe.LiveChatWidget.get("customer_data"),e=_Oe_LiveChatWidget_get.id;return e}catch(e1){return}};var nt=function nt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"all";return!!e("ignoreBrowserSupport")||"function"==typeof window.MutationObserver&&"function"==typeof document.querySelectorAll&&("audio"!==t||"function"==typeof window.RTCDataChannel)};var it=function it(){var e=document.createElement("canvas"),t=e.getContext("2d"),o="upscope.io";return t.textBaseline="top",t.font='14px "Arial"',t.textBaseline="alphabetic",t.rotate(.05),t.fillStyle="#f60",t.fillRect(125,1,62,20),t.fillStyle="#069",t.fillText(o,2,15),t.fillStyle="rgba(102, 204, 0, 0.7)",t.fillText(o,4,17),e.toDataURL()};var s,i;try{var _localStorage_getItem;s=(_localStorage_getItem=localStorage.getItem("debug"))===null||_localStorage_getItem===void 0?void 0:_localStorage_getItem.replace(/^upscope:/,"")}catch(e1){}function y(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Object.values(e).some(function(e){return"object"==typeof e})?Object.entries(e).map(function(param){var _param=_slicedToArray(param,2),_$e=_param[0],o=_param[1];return"".concat(t).concat(_$e," {\n").concat(y(o),"\n}")}).join("\n"):Object.entries(e).map(function(param){var _param=_slicedToArray(param,2),_$e=_param[0],t=_param[1];return"".concat(_$e,": ").concat(t,";\n")}).join("")}var b={".upscope___dialog-overlay":{position:"fixed",top:"0",left:"0",bottom:"0",right:"0",background:"#000000","z-index":"2147483645",opacity:"0.7"},".upscope___dialog":{display:"block","z-index":"2147483646",background:"white",position:"fixed",top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)",width:"80%","max-width":"600px",padding:"15px 15px 0","border-radius":"5px",overflow:"hidden"},".upscope___dialog__title":{cursor:"default",display:"block","font-size":"20px",margin:"3px 0 15px","font-weight":"600",color:"#4c4c4c","font-family":"'Avenir Next', Avenir, 'Lucida Grande', Helvetica, sans-serif"},".upscope___dialog__text":{cursor:"default",display:"block","font-size":"17px","line-height":"22px",color:"#656565","font-weight":"500","margin-bottom":"30px","font-family":"'Avenir Next', Avenir, 'Lucida Grande', Helvetica, sans-serif"},".upscope___dialog__buttons-container":{background:"#f1f1f1",margin:"0 -15px",padding:"15px","text-align":"right",display:"block",overflow:"hidden"},".upscope___dialog__button, .upscope___dialog__button:hover, .upscope___dialog__button:active":{cursor:"pointer",background:"#0090ff",color:"white",padding:"0 10px",height:"36px","line-height":"36px",display:"inline-block","font-size":"17px","font-weight":"600","font-family":"'Avenir Next', Avenir, 'Lucida Grande', Helvetica, sans-serif","text-decoration":"none","border-radius":"3px","margin-left":"15px",opacity:"0.8"},'@media "only screen and (max-width": 800px)':{".upscope___dialog__buttons-container":{"padding-bottom":"0"},".upscope___dialog__button, .upscope___dialog__button:hover, .upscope___dialog__button:active":{display:"block",margin:"0 0 15px","text-align":"center"}},".upscope___dialog__button:hover":{opacity:"1"},".upscope___dialog__button.upscope___dialog__button--no":{background:"#dddddd",color:"#464646"},".upscope___dialog__button.upscope___dialog__button--ok":{background:"#00d015"}};var k=null;var C=function(){function C(e,t,o){_classCallCheck(this,C);_defineProperty(this,"text",void 0);_defineProperty(this,"className",void 0);_defineProperty(this,"onClick",void 0);this.text=e,this.className=t,this.onClick=o}_createClass(C,[{key:"render",value:function render(e){var _this=this;var t=document.createElement("a");t.href="#",t.textContent=this.text,t.className="upscope___dialog__button"+(this.className?" upscope___dialog__button--"+this.className:""),t.setAttribute("role","button"),e.append(t),t.addEventListener("click",function(e){e.isUpscopeBrowserInstruction||(e.preventDefault(),e.stopPropagation(),_this.onClick())})}}]);return C}();var I=function(){function I(e,t,o){_classCallCheck(this,I);_defineProperty(this,"title",void 0);_defineProperty(this,"text",void 0);_defineProperty(this,"callback",void 0);_defineProperty(this,"buttons",[]);_defineProperty(this,"rendered",!1);_defineProperty(this,"container",void 0);_defineProperty(this,"keyboardListener",void 0);this.title=e,this.text=t,this.callback=o}_createClass(I,[{key:"addButton",value:function addButton(e,t,o){var _this=this;this.buttons.push(new C(t,o,function(){_this.clear(),_this.callback&&_this.callback(e),delete _this.callback}))}},{key:"clear",value:function clear(){var _this_container,_this_container_remove;this.rendered&&(this.keyboardListener&&document.removeEventListener("keydown",this.keyboardListener),(_this_container_remove=(_this_container=this.container).remove)===null||_this_container_remove===void 0?void 0:_this_container_remove.call(_this_container))}},{key:"render",value:function render(){var _this=this;this.rendered=!0,this.container=w(document,b);var e=document.createElement("div");e.className="upscope___dialog-overlay",1===this.buttons.length&&(e.addEventListener("click",function(e){_this.buttons[0].onClick()}),this.keyboardListener=function(e){27!==e.keyCode&&13!==e.keyCode&&8!==e.keyCode||_this.buttons[0].onClick()},document.addEventListener("keydown",this.keyboardListener));var t=document.createElement("div");t.className="upscope___dialog",t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby","upscope___dialog__title"),t.setAttribute("aria-describedby","upscope___dialog__text");var o=document.createElement("div");o.className="upscope___dialog__title",o.id="upscope___dialog__title",o.textContent=this.title||n().hostname,t.append(o);var s=document.createElement("div");s.className="upscope___dialog__text",s.id="upscope___dialog__text",s.textContent=this.text,t.append(s);var i=document.createElement("div");i.className="upscope___dialog__buttons-container";var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=this.buttons[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var e1=_step.value;e1.render(i)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}t.append(i),this.container.append(t),this.container.append(e),document.activeElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()}}]);return I}();var A={beta:!1,region:null,dataEndpoint:"".concat(l("data","ws"),"/session"),pageviewsEndpoint:"".concat(l("data-support"),"/pageviews"),phoneEndpoint:l("phone"),javascriptEndpoint:l("js"),storageImplementation:null,proxyRedirectEndpoint:"".concat(l("app"),"/session?token=TOKEN&url=URL"),requireAuthorizationForSession:!1,integrateWithLivechat:!0,liveChatRewrite:!0,grabIdentityFromLivechat:!0,showUpscopeLink:!0,cursorColor:"black",enlargeCursor:!1,showTerminateButton:!0,useFingerprinting:!0,autoconnect:!0,trackConsole:!1,allowRemoteConsole:!1,allowRemoteClick:!0,allowRemoteScroll:!0,allowRemoteType:!0,allowAgentRedirect:!0,requireControlRequest:!1,rewriteExternalLinks:!1,screenWakeLock:!0,collectHistory:!1,consoleAllowed:!0,drawingsTtlMs:6e3,enableLookupCodeOnKey:!1,lookupCodeKey:17,lookupCodeKeyRepetitions:5,lookupCodeKeyTitle:"Co-browsing access code",lookupCodeKeyMessage:"Please give the agent this code: {%lookupCode%}",lookupCodeElement:null,injectLookupCodeButton:!1,lookupCodeButtonPages:["*"],lookupCodeButtonStyle:"left: 0;bottom: 100px;",disconnectAfterSeconds:900,proxyAssets:["*://localhost/*","*://localhost:*/*","*://127.0.0.1/*","*://127.0.0.1:*/*","*://*.dev/*","*://*.dev:*/*","*://*.local/*"],maskedElements:[],domChangesDelay:100,ignoreBrowserSupport:"extension"!==window.__upscopeContext__&&"off"===localStorage.getItem("upscope:browserDetect"),enableCanvases:!0,customCallController:null,customControlRequestController:null,callPromptText:"Would you like to join the voice call?",callPopupFailedMessage:"The audio popup failed to open. Please enable popups and try again.",controlRequestTitle:"Remote control request",controlRequestMessage:"Would you like to let {%agentName%|our agent} control your screen?",callPopupFailedTitle:"Failed to open popup",callPopupNoInputTitle:"No microphone detected",callPopupNoInputMessage:"The audio call might fail because no microphone was detected.",callPopupNoOutputTitle:"No speakers detected",callPopupNoOutputMessage:"The audio call might fail because no speakers were detected.",callAudioAuthorizationFailedTitle:"Microphone access not granted",callAudioAuthorizationFailedMessage:"The call had to be disconnected because access to the microphone was not granted. Please try again.",callRingtone:"".concat(l("js"),"/assets/ringtone.mp3?v=2.3.0"),authorizationPromptTitle:"Co-browsing request",authorizationPromptMessage:"Would you like to let {%agentName%|our agent} help you navigate {%currentDomain%}?",endOfScreenshareMessage:null,callWaitMessage:"Please stay on this page. Our agent will call you here shortly.",translationsYes:"Yes",translationsNo:"No",translationsOk:"Okay",translationsStopSession:"End session",agentRequestButtonStyle:"left: 10px;bottom: 10px;",agentRequestButtonTitle:"Request agent help",agentRequestButtonSubtitle:"An agent can screen share with you now",agentRequestButtonRequestingTitle:"Looking for an available agent...",agentRequestButtonRequestingSubtitle:"Click to cancel request",agentRequestResultTitle:"Agent request",agentRequestNotAvailableText:"An agent is not currently available. Please try again later.",agentRequestAcceptedText:"An agent will screen share with you shortly. Please stay on this page.",showAgentRequestButton:"never",agentRequestButtonPages:["*"],unavailableAgentRequestRedirectImmediately:!1,unavailableAgentRequestRedirectTo:null,fromProxy:!1,sfdcFieldLabel:"Screen_Share",sfdcFieldId:"Screen_Share__c",baseProxyUrl:"https://APIKEY.upscopeproxy.com",proxyDomain:".upscopeproxy.com",regionWhitelist:["us-east","ap-southeast","eu-central","eu-west","sa-east"],needsProxy:function needsProxy(e){if(this.fromProxy)return!0;var t=new URL(e,location.href);return"pdf"===t.pathname.split(".").pop()||!t.hostname.endsWith(location.hostname)&&!location.hostname.endsWith(t.hostname)},onSessionRequest:function onSessionRequest(e,t){a("info","Screen sharing request received");var o=v(this.authorizationPromptMessage,{agentName:t,currentDomain:n().host});E(this.authorizationPromptTitle,o).then(e)},onSessionStart:function onSessionStart(){a("info","Screen sharing started")},onSessionEnd:function onSessionEnd(){a("info","Screen sharing ended"),this.endOfScreenshareMessage&&S(void 0,this.endOfScreenshareMessage)},onWaitingForCall:function onWaitingForCall(){a("info","Found call name"),this.callWaitMessage&&S(void 0,this.callWaitMessage)},onSessionContinue:function onSessionContinue(){a("info","Screen sharing continued")},onConnection:null,maskElementMiddleware:function maskElementMiddleware(e){if("type"in e&&"password"===e.type||"function"==typeof e.getAttribute&&"cc-number"===e.getAttribute("autocompletetype")||"function"==typeof e.getAttribute&&"true"===e.getAttribute("data-upscope-masked"))return!0;var t=e;for(;t;){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=this.maskedElements[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;if("function"==typeof t.matches&&t.matches(_$e))return!0;if("function"==typeof t.msMatchesSelector&&t.msMatchesSelector(_$e))return!0}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}if(t.className&&/\bno-upscope\b/.test(t.className))return!0;t=t.parentElement}return!1},noRemoteElements:[],allowRemoteMiddleware:function allowRemoteMiddleware(e){if(this.maskElementMiddleware(e))return!1;if("function"==typeof e.getAttribute&&"true"===e.getAttribute("data-upscope-no-remote-control"))return!1;var t=e;for(;t;){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=this.noRemoteElements[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;if("function"==typeof t.matches&&t.matches(_$e))return!1;if("function"==typeof t.msMatchesSelector&&t.msMatchesSelector(_$e))return!1}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}t=t.parentElement}return!0},styleSheetContentFromRules:function(e){var _e_textContent;return"STYLE"===e.tagName&&0===((_e_textContent=e.textContent)===null||_e_textContent===void 0?void 0:_e_textContent.trim().length)}},T={1:"ELEMENT_NODE",2:"ATTRIBUTE_NODE",3:"TEXT_NODE",4:"CDATA_SECTION_NODE",7:"PROCESSING_INSTRUCTION_NODE",8:"COMMENT_NODE",9:"DOCUMENT_NODE",10:"DOCUMENT_TYPE_NODE",11:"DOCUMENT_FRAGMENT_NODE"};function M(e,t){if(R(e)||q(e))return P(e);var o=e;var n=t||o.parentNode;for(;o;){if(R(o))return M(o)?"".concat(M(o),"+"):null;o=o.previousSibling}return null===P(n)?null:P(n)+"^"}function K(e,t){var o=V(e);var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=o[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;if(_$e.shadowRoot)try{t(_$e.shadowRoot),K(_$e.shadowRoot,t)}catch(t1){r("Error accessing shadow root %o (%o)",_$e.shadowRoot,t1)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}var Y=["region","shortId","lastConnectedAt","waitingForCallAt","lookupCodeSetAt","lookupCode"],J={get:function get(t){return _asyncToGenerator(function(){var o;return __generator(this,function(_state){if(e("storageImplementation"))return[2,e("storageImplementation").getItem(t)];o=localStorage.getItem("__upscope:".concat(t))||X("_upscope__".concat(t))||null;if(null===o)return[2,null];try{o=JSON.parse(o)}catch(e1){}return[2,(this.set(t,o),o)]})}).apply(this)},set:function set(t,o){return _asyncToGenerator(function(){var n,e1;return __generator(this,function(_state){if(e("storageImplementation"))return[2,e("storageImplementation").setItem(t,o)];o=JSON.stringify(o),localStorage.setItem("__upscope:".concat(t),o);n=location.hostname.split(".");for(e1=n.length-2;e1>=0&&(Z("_upscope__".concat(t),o,n.slice(e1).join(".")),X("_upscope__".concat(t))!==o);e1--);return[2]})})()},del:function del(t){return _asyncToGenerator(function(){var o,e1,n,s;return __generator(this,function(_state){if(e("storageImplementation"))return[2,e("storageImplementation").removeItem(t)];localStorage.removeItem("__upscope:".concat(t));o=location.hostname.split(".");for(e1=o.length-2;e1>=0&&(n="_upscope__".concat(t),s=o.slice(e1).join("."),Z(n,"",s,new Date(0)),null!==X("_upscope__".concat(t)));e1--);return[2]})})()},clear:function clear(){return _asyncToGenerator(function(){var _this;return __generator(this,function(_state){switch(_state.label){case 0:_this=this;return[4,Promise1.all(Y.map(function(e){return _this.del(e)}))];case 1:_state.sent();return[2]}})}).apply(this)}};function _e(e,t){return __e.apply(this,arguments)}function __e(){__e=_asyncToGenerator(function(e,t){var o,t1;return __generator(this,function(_state){switch(_state.label){case 0:r("Collecting asset %s (element: %o)",e,t);try{if(t&&(o=t)&&"[object CSSStyleSheet]"===Object.prototype.toString.apply(o))return[2,"text/css:".concat(window.btoa(we(t)))];if(D("img",t))return[2,ve(t).replace(/^data:/,"").replace(",",":")]}catch(e1){r("Unable to collect image / css for %o (%o), using fetch",t,e1)}_state.label=1;case 1:_state.trys.push([1,3,,4]);return[4,h(new Promise1(function(t,o){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.addEventListener("load",function(e){if(200!==this.status)return o([this.status,String(this.response)]);var n=new Uint8Array(this.response);var s=n.length;var i=new Array(s);for(;s--;)i[s]=String.fromCharCode(n[s]);var r=i.join(""),a=this.getResponseHeader("content-type");if(!a)return o("No content type");t(a+":"+window.btoa(r))}),n.send()}),5e3)];case 2:return[2,_state.sent()];case 3:t1=_state.sent();r("Could not collect asset %s (%o)",e,t1);return[3,4];case 4:return[2]}})});return __e.apply(this,arguments)}var ye=function(){function ye(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;_classCallCheck(this,ye);_defineProperty(this,"connection",void 0);_defineProperty(this,"isChildFrame",void 0);_defineProperty(this,"active",!1);_defineProperty(this,"killers",[]);_defineProperty(this,"assetsCache",{});_defineProperty(this,"styleSheetContents",{});_defineProperty(this,"sentAssets",[]);_defineProperty(this,"upscopeId",0);_defineProperty(this,"activateInterval",void 0);_defineProperty(this,"canvasCompressionOn",!1);_defineProperty(this,"canvasContents",{});_defineProperty(this,"canvasErrors",[]);_defineProperty(this,"canvasCompressionOffTimeout",void 0);this.connection=e,this.isChildFrame=t}_createClass(ye,[{key:"sendEvent",value:function sendEvent(e,t){this.connection.sendBrowserEvent(e,t)}},{key:"activate",value:function activate(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:r("Activating browser watcher"),_this.active=!0;return[4,_this.awaitDocumentLoaded(window.document)];case 1:_state.sent(),_this.ensureHasIds(void 0,document,e),_this.activateInterval=_this.activateInterval||setInterval(function(){return _this.activateForWindow(window,Boolean(e),e)},2e3),_this.activateForWindow(window,Boolean(e),e);return[2]}})})()}},{key:"activateForWindow",value:function activateForWindow(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;var _this=this;return _asyncToGenerator(function(){var n,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_loop,_iterator,_step,_tmp,_,_tmp1,_tmp2;return __generator(this,function(_state){switch(_state.label){case 0:return[4,_this.awaitDocumentLoaded(e.document)];case 1:if(_state.sent(),!_this.active)return[2];n=t?o:"root";if(!(null!==n))return[3,5];if(!e.document.__upscopeTrackingActive){r("Activating events watchers for window %O",n);_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{_loop=function(){var o=_step.value;o.detect(function(e){_this.killers.push(e)},function(){var _ref=_asyncToGenerator(function(e){var t;return __generator(this,function(_state){switch(_state.label){case 0:return[4,o.encode(e)];case 1:t=_state.sent();t&&_this.sendEvent(n,t);return[2]}})});return function(e){return _ref.apply(this,arguments)}}())};for(_iterator=(function(e,t,o,n){return[te(o),ee(o),oe(o),he(e,o),se(o),ie(e,t),re(o),ge(e,o),ce(o),le(o),ae(o),ue(t),me(e,o),pe(o),de(e,o),ne(o),fe(n)]})(_this,e,e.document,t)[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true)_loop()}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}K(e.document,function(e){return _this.activateForShadowRoot(n,e)}),$(e.document,function(e){e.__upscopeID&&(e.__upscopeFrameActive=!0,e.contentWindow&&_this.activateForWindow(e.contentWindow,!0,e.__upscopeID))},function(e,t){e.__upscopeID&&(e.__upscopeFrameActive=!0,t.activate(_this.sendEvent.bind(_this),e.__upscopeID))});if(!(e.document.__upscopeTrackingActive||e!==window&&!e.parent.document.__upscopeTrackingActive))return[3,2];_tmp=e.document.__upscopeTrackingActive=!0;return[3,4];case 2:e.document.__upscopeTrackingActive=!0;_=_this.sendEvent;_tmp1=[n];_tmp2={};return[4,_this.getSnapshot(e)];case 3:_tmp=_.apply(_this,_tmp1.concat([(_tmp2.pageLoad=_state.sent(),_tmp2)]));_state.label=4;case 4:_tmp;_state.label=5;case 5:return[2]}})})()}},{key:"deactivateForWindow",value:function deactivateForWindow(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;var _this=this;e.document.__upscopeTrackingActive=!1,$(e.document,function(e){e.__upscopeFrameActive=!1,e.contentWindow&&_this.deactivateForWindow(e.contentWindow)},function(e,t){e.__upscopeFrameActive=!1,t.deactivate()},!0),K(e.document,function(e){e.__upscopeTrackingActive=!1})}},{key:"deactivate",value:function deactivate(){r("Deactivating events watchers"),this.activateInterval&&clearInterval(this.activateInterval),delete this.activateInterval,this.active=!1,this.removeIds();var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=this.killers[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;try{_$e()}catch(e){r("Failed to kill listener (%o)",e)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}this.killers=[],this.deactivateForWindow()}},{key:"awaitDocumentLoaded",value:function awaitDocumentLoaded(e){return _asyncToGenerator(function(){var t,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:t=function(){return"complete"===e.readyState||"interactive"===e.readyState};_tmp=t();if(_tmp)return[3,2];return[4,new Promise1(function(e){var o=setInterval(function(){t()&&(clearInterval(o),e())},100)})];case 1:_tmp=_state.sent();_state.label=2;case 2:_tmp;return[2]}})})()}},{key:"getSnapshot",value:function getSnapshot(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var _this=this;return _asyncToGenerator(function(){var _this_connection_consoleHandler,n,s,_t_document,i,a,c,_tmp,e1;return __generator(this,function(_state){switch(_state.label){case 0:return[4,g(function(){return Boolean(t.document.documentElement)})];case 1:_state.sent(),_this.ensureHasIds();n={version:e("version")};t===window&&(_this.sentAssets=[],s=_this.collectNewAssets(t.document,o));_t_document=t.document,i=_t_document.doctype;n.doctype=i?"<!DOCTYPE "+i.name+(i.publicId?' PUBLIC "'+i.publicId+'"':"")+(!i.publicId&&i.systemId?" SYSTEM":"")+(i.systemId?' "'+i.systemId+'"':"")+">":void 0,n.url=t.location.href;a=t.document.querySelectorAll("base");n.baseUrl=0===a.length?t.location.href:a[0].href,n.styleSheetsCount=t.document.styleSheets.length,n.windowSize={w:t.innerWidth,h:t.innerHeight},n.formValues=_this.getFormValues(t.document);c=_this.encodeNode(t.document.documentElement).then(function(e){n.html=e});n.scrollPositions=_this.getScrollPositions(t),n.scrollbarWidth=_this.getScrollbarWidth(t.document),n.targetElementId=function(){var _$e=location.hash.length>0?t.document.getElementById(location.hash.slice(1)):null;if(_$e)return _$e.__upscopeID}(),n.focusElementId=!t.document.activeElement||D("body",t.document.activeElement)?void 0:t.document.activeElement.__upscopeID,n.console=(_this_connection_consoleHandler=_this.connection.consoleHandler)===null||_this_connection_consoleHandler===void 0?void 0:_this_connection_consoleHandler.console,n.canvases=_this.getCanvasUrls(t.document,o?1:0),n.maskedElementsSizes=_this.getMaskedElementsSizes(t.document),n.styleSheetContents=_this.getStyleSheetContents(t.document),n.animations=function(){if(!t.document.getAnimations)return[];var _$e=[];var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=t.document.getAnimations()[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;if("[object Animation]"!==Object.prototype.toString.apply(o))continue;o.__upscopeEventSent=!0;var t1=o.effect.target;if(!t1)continue;var n=M(t1);n&&_$e.push(_objectSpread({elementId:n},U(o)))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return _$e}(),_this.active||t!==window||_this.removeIds();_state.label=2;case 2:_state.trys.push([2,5,,6]);_tmp=s;if(!_tmp)return[3,4];return[4,s];case 3:_tmp=n.assets=_state.sent();_state.label=4;case 4:_tmp;return[3,6];case 5:e1=_state.sent();r("Could not collect assets %o",e1),n.assets={};return[3,6];case 6:return[4,c];case 7:return[2,(_state.sent(),n)]}})})()}},{key:"collectNewAssets",value:function collectNewAssets(e){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var _this=this;return _asyncToGenerator(function(){var _loop,_s,_s1,n,s,i,a,c,_ret;return __generator(this,function(_state){switch(_state.label){case 0:_loop=function(){var _$e,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_loop,_iterator,_step,_iteratorNormalCompletion1,_didIteratorError1,_iteratorError1,_loop1,_iterator1,_step1;return __generator(this,function(_state){switch(_state.label){case 0:if(Date.now()-a.getTime()>(o?1e3:6e3)){r("Stopped collecting assets as it's been longer than 6 seconds");return[2,"break"]}_$e=[];_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{_loop=function(){var _step_value=_slicedToArray(_step.value,3),o=_step_value[0],r=_step_value[1],a=_step_value[2];if(o&&(i.href=o,o=i.href.split("#")[0],o!==location.href.split("#")[0]&&!_this.sentAssets.includes(o))){if(!a&&!_this.shouldProxyAsset(o))return"continue";if(o.startsWith("data:"))return"continue";var s="function"==typeof window.upscope___proxyToUrl?window.upscope___proxyToUrl(o):o;_this.assetsCache[s]?n[s]=_this.assetsCache[s]:_$e.push(_e(o,t(r)).then(function(e){return[o,e]})),_this.sentAssets.push(o)}};for(_iterator=s[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true)_loop()}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return[4,Promise1.all(_$e)];case 1:c=_state.sent(),s.length=0;_iteratorNormalCompletion1=true,_didIteratorError1=false,_iteratorError1=undefined;try{_loop1=function(){var _step_value=_slicedToArray(_step1.value,2),_$e=_step_value[0],t=_step_value[1];var _s;if(void 0!==t){var o="function"==typeof window.upscope___proxyToUrl?window.upscope___proxyToUrl(_$e):_$e;n[o]=t,_this.assetsCache[o]=t}t&&t.startsWith("text/css")&&(_s=s).push.apply(_s,_toConsumableArray(G(window.atob(t.slice(t.indexOf(":")+1))).map(function(t){return[new URL(t,_$e).href,null,!1]})))};for(_iterator1=c[Symbol.iterator]();!(_iteratorNormalCompletion1=(_step1=_iterator1.next()).done);_iteratorNormalCompletion1=true)_loop1()}catch(err){_didIteratorError1=true;_iteratorError1=err}finally{try{if(!_iteratorNormalCompletion1&&_iterator1.return!=null){_iterator1.return()}}finally{if(_didIteratorError1){throw _iteratorError1}}}return[2]}})};n={},s=[],i=document.createElement("a"),a=new Date;(_s=s).push.apply(_s,_toConsumableArray(_this.findAssetsInRoot(e))),K(e,function(e){var _s;(_s=s).push.apply(_s,_toConsumableArray(_this.findAssetsInRoot(e)))}),$(e,function(e){return e.contentDocument&&(_s1=s).push.apply(_s1,_toConsumableArray(_this.findAssetsInRoot(e.contentDocument)))});_state.label=1;case 1:return[5,__values(_loop())];case 2:_ret=_state.sent();if(_ret==="break")return[3,4];_state.label=3;case 3:if(c.length>0)return[3,1];_state.label=4;case 4:return[2,n]}})})()}},{key:"findAssetsInRoot",value:function findAssetsInRoot(e){var _t,_t1,_t2,_t3,_t4,_t5;var t=[];return(_t=t).push.apply(_t,_toConsumableArray(_toConsumableArray(e.styleSheets).map(function(e){return[e.href,e,!1]}))),q(e)?(_t1=t).push.apply(_t1,_toConsumableArray(_toConsumableArray(e.querySelectorAll("img")).map(function(e){return[e.src,e,!1]}))):(_t2=t).push.apply(_t2,_toConsumableArray(_toConsumableArray(e.images).map(function(e){return[e.src,e,!1]}))),(_t3=t).push.apply(_t3,_toConsumableArray(_toConsumableArray(e.querySelectorAll("use")).map(function(e){return[e.getAttribute("xlink:href")||("string"==typeof e.href?e.href:null),null,!0]}))),N(e)&&(_t4=t).push.apply(_t4,_toConsumableArray(Object.values(this.getStyleSheetContents(e)).flatMap(function(e){return G(e)}).map(function(e){return[e,null,!1]}))),(_t5=t).push.apply(_t5,_toConsumableArray(_toConsumableArray(e.querySelectorAll("[style]")).flatMap(function(e){return G(e.getAttribute("style"))}).map(function(e){return[e,null,!1]}))),t}},{key:"shouldProxyAsset",value:function shouldProxyAsset(t){if(t.length>2e3)return!1;if(t.startsWith("blob:"))return!0;if(t.startsWith("chrome-extension:"))return!0;if(!t.startsWith("http://")&&!t.startsWith("https://"))return!1;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e("proxyAssets")[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;if(c(o,t))return!0}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return!1}},{key:"encodeNode",value:function encodeNode(e){var _this=this;return _asyncToGenerator(function(){var t,_tmp,_tmp1,_tmp2,_tmp3,_tmp4,_tmp5,_tmp6;return __generator(this,function(_state){switch(_state.label){case 0:if(!R(e))return[3,9];t={tag:"".concat(e.tagName,"#").concat(e.__upscopeID),c:[]};e.__upscopeMasked&&(t.masked=!0),e.__upscopeNoRemoteControl&&(t.rc=!1),"http://www.w3.org/2000/svg"===e.namespaceURI&&(t.svg=1),e.attributes.length>0&&(t.a=function(){var t={};var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e.attributes[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;t[o.name]=o.value,e.__upscopeMasked&&"value"===o.name&&(t[o.name]=o.value.replace(/./g,"*"))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return t}());_tmp=(e.childNodes.length>0||e.shadowRoot)&&!e.__upscopeMasked;if(!_tmp)return[3,2];return[4,_asyncToGenerator(function(){var t,o,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,t1,_iteratorNormalCompletion1,_didIteratorError1,_iteratorError1,_iterator1,_step1,n,err,_tmp,_;return __generator(this,function(_state){switch(_state.label){case 0:t=[],o=[];_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=e.childNodes[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){t1=_step.value;o.push(_this.encodeNode(t1))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}_iteratorNormalCompletion1=true,_didIteratorError1=false,_iteratorError1=undefined;_state.label=1;case 1:_state.trys.push([1,6,7,8]);return[4,Promise1.all(o)];case 2:_iterator1=_state.sent()[Symbol.iterator]();_state.label=3;case 3:if(!!(_iteratorNormalCompletion1=(_step1=_iterator1.next()).done))return[3,5];n=_step1.value;n&&!D("script",e)&&t.push(n);_state.label=4;case 4:_iteratorNormalCompletion1=true;return[3,3];case 5:return[3,8];case 6:err=_state.sent();_didIteratorError1=true;_iteratorError1=err;return[3,8];case 7:try{if(!_iteratorNormalCompletion1&&_iterator1.return!=null){_iterator1.return()}}finally{if(_didIteratorError1){throw _iteratorError1}}return[7];case 8:_tmp=e.shadowRoot;if(!_tmp)return[3,10];_=t.push;return[4,_this.encodeNode(e.shadowRoot)];case 9:_tmp=_.apply(t,[_state.sent()]);_state.label=10;case 10:return[2,(_tmp,t)]}})})()];case 1:_tmp=t.c=_state.sent();_state.label=2;case 2:_tmp;_tmp1=(D("iframe",e)||D("frame",e))&&(F(e)||e.__upscopeFrameActive);if(!_tmp1)return[3,8];if(!e.__upscopeChildFrameHandler)return[3,4];return[4,e.__upscopeChildFrameHandler.getSnapshot(e.__upscopeID)];case 3:_tmp2=t.iframe=_state.sent();return[3,7];case 4:_tmp3=e.contentWindow&&H(e);if(!_tmp3)return[3,6];return[4,_this.getSnapshot(e.contentWindow)];case 5:_tmp3=t.iframe=_state.sent();_state.label=6;case 6:_tmp2=_tmp3;_state.label=7;case 7:_tmp1=_tmp2;_state.label=8;case 8:return[2,(_tmp1,D("img",e)&&(t.isLoaded=Boolean(e.complete)),t)];case 9:if(!L(e))return[3,10];_tmp4={text:e.textContent};return[3,14];case 10:if(!q(e))return[3,12];_tmp6={shadowRoot:!0};return[4,_asyncToGenerator(function(){var t,o,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,t1,_iteratorNormalCompletion1,_didIteratorError1,_iteratorError1,_iterator1,_step1,n,err;return __generator(this,function(_state){switch(_state.label){case 0:t=[],o=[];_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=e.childNodes[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){t1=_step.value;o.push(_this.encodeNode(t1))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}_iteratorNormalCompletion1=true,_didIteratorError1=false,_iteratorError1=undefined;_state.label=1;case 1:_state.trys.push([1,6,7,8]);return[4,Promise1.all(o)];case 2:_iterator1=_state.sent()[Symbol.iterator]();_state.label=3;case 3:if(!!(_iteratorNormalCompletion1=(_step1=_iterator1.next()).done))return[3,5];n=_step1.value;n&&!D("script",e)&&t.push(n);_state.label=4;case 4:_iteratorNormalCompletion1=true;return[3,3];case 5:return[3,8];case 6:err=_state.sent();_didIteratorError1=true;_iteratorError1=err;return[3,8];case 7:try{if(!_iteratorNormalCompletion1&&_iterator1.return!=null){_iterator1.return()}}finally{if(_didIteratorError1){throw _iteratorError1}}return[7];case 8:return[2,t]}})})()];case 11:_tmp5=(_tmp6.c=_state.sent(),_tmp6.ss=function(e){if(!e)return;var t="";var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;t+=we(o)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return t}(e.adoptedStyleSheets),_tmp6);return[3,13];case 12:_tmp5=void 0;_state.label=13;case 13:_tmp4=_tmp5;_state.label=14;case 14:return[2,_tmp4]}})})()}},{key:"getScrollPositions",value:function getScrollPositions(e){return{window:{x:z(e),y:j(e)},elements:this.getRootScrollPositions(e.document)}}},{key:"getRootScrollPositions",value:function getRootScrollPositions(e){var t=V(e),o={};var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=t[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;_$e.parentNode&&_$e.parentNode.__upscopeMasked||D("html",_$e)||(_$e.shadowRoot&&Object.assign(o,this.getRootScrollPositions(_$e.shadowRoot)),0===_$e.scrollLeft&&0===_$e.scrollTop||_$e.__upscopeID&&(o[_$e.__upscopeID]={x:_$e.scrollLeft,y:_$e.scrollTop}))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return o}},{key:"activateForShadowRoot",value:function activateForShadowRoot(e,t){var _this=this;if(t.__upscopeTrackingActive)return;t.__upscopeTrackingActive=!0;var o=(n=t,{detect:function detect(e,t){var o={},s=function s(e){var _e_path;var n=(_e_path=e.path)===null||_e_path===void 0?void 0:_e_path[0];if(!n||!R(n))return;var s=M(n);s&&(void 0===o[s]&&(o[s]=u(function(e){delete o[s],t(e)},100)),o[s](e))};var i;n.addEventListener("scroll",s,!0),e((i=s,function(){n.removeEventListener("scroll",i,!0)}))},encode:function encode(e){var _$t=e.path[0],o=M(_$t);if(o&&!_$t.__upscopeMasked)return{scroll:{elementId:o,x:_$t.scrollLeft,y:_$t.scrollTop}}}});var n;var _this1=this;o.detect(function(e){_this.killers.push(e)},function(){var _ref=_asyncToGenerator(function(t){var n;return __generator(this,function(_state){switch(_state.label){case 0:return[4,o.encode(t)];case 1:n=_state.sent();"object"==typeof n&&_this1.sendEvent(e,n);return[2]}})});return function(t){return _ref.apply(this,arguments)}}())}},{key:"getFormValues",value:function getFormValues(e){var t={},o=e.querySelectorAll("input,textarea,select");var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=o[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;var _e_parentNode;if(!_$e.__upscopeID)continue;if((_e_parentNode=_$e.parentNode)===null||_e_parentNode===void 0?void 0:_e_parentNode.__upscopeMasked)continue;if(D("input",_$e)&&"file"===_$e.type)continue;if(D("select",_$e)){t[_$e.__upscopeID]="selectedIndex:".concat(_$e.selectedIndex);continue}if(D("input",_$e)&&("checkbox"===_$e.type||"radio"===_$e.type)){t[_$e.__upscopeID]="checked:"+(_$e.checked?1:0);continue}var o1=_$e.__upscopeMasked?_$e.value.replace(/./g,"*"):_$e.value;t[_$e.__upscopeID]="value:".concat(o1)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return t}},{key:"getStyleSheetContents",value:function getStyleSheetContents(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var _this=this;var n={},s=t.styleSheets;if(this.styleSheetContents[t.__upscopeRootId||"root"]=this.styleSheetContents[t.__upscopeRootId||"root"]||{},this.styleSheetContents[t.__upscopeRootId||"root"][o?1:0])return this.styleSheetContents[t.__upscopeRootId||"root"][o?1:0];var i=Date.now();var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=s[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$t=_step.value;var s1=_$t.ownerNode;try{if(!D("link",s1)&&!D("style",s1)||!s1.__upscopeID||s1.__upscopeError)continue;if(!o&&!e("styleSheetContentFromRules")(s1))continue;n[s1.__upscopeID]=we(_$t)}catch(e1){s1.__upscopeError=!0,r("Could not retrieve content from stylesheet (%o)",e1)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}var a=Date.now()-i;return a>100&&(this.styleSheetContents[t.__upscopeRootId||"root"][o?1:0]=n,setTimeout(function(){return delete _this.styleSheetContents[t.__upscopeRootId||"root"][o?1:0]},7*a)),n}},{key:"getScrollbarWidth",value:function getScrollbarWidth(e){var t=e.createElement("div");if(t.style.width="100px",t.style.height="100px",t.style.overflow="scroll",t.style.position="absolute",t.style.top="-9999px",!e.body)return 0;e.body.append(t);var o=t.offsetWidth-t.clientWidth;return t.remove(),o}},{key:"getCanvasUrls",value:function getCanvasUrls(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;var _this=this;if(!e("enableCanvases"))return{};0===o&&this.canvasCompressionOn&&(o=.5),this.canvasContents[t.__upscopeRootId||"root"]=this.canvasContents[t.__upscopeRootId||"root"]||{},this.canvasContents[t.__upscopeRootId||"root"][o]=this.canvasContents[t.__upscopeRootId||"root"][o]||{};var n=Date.now(),s={},i=[],a=t.querySelectorAll("canvas,video");var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=a[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var e1=_step.value;if(e1.__upscopeID&&F(e1)&&(D("canvas",e1)||"yes"===e1.dataset.upscopeProxyStream)&&!this.canvasErrors.includes(e1.__upscopeID)&&F(e1))try{this.canvasContents[t.__upscopeRootId||"root"][o][e1.__upscopeID]||(i.push(e1.__upscopeID),this.canvasContents[t.__upscopeRootId||"root"][o][e1.__upscopeID]=ve(e1,o)),s[e1.__upscopeID]=this.canvasContents[t.__upscopeRootId||"root"][o][e1.__upscopeID]}catch(t1){this.canvasErrors.push(e1.__upscopeID),r("Ignoring canvas %o due to error %o",e1,t1)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}var c=Date.now()-n;return setTimeout(function(){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=i[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var e=_step.value;delete _this.canvasContents[t.__upscopeRootId||"root"][o][e]}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}},7*Math.min(c,1e3)),c>800&&(this.canvasCompressionOn||r("Turning canvas compression on"),this.canvasCompressionOn=!0,this.canvasCompressionOffTimeout&&clearTimeout(this.canvasCompressionOffTimeout),this.canvasCompressionOffTimeout=setTimeout(function(){_this.canvasCompressionOn=!1},1e4)),s}},{key:"getMaskedElementsSizes",value:function getMaskedElementsSizes(e){var _e_parentNode;var t={},o=V(e);var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=o[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$e=_step.value;R(_$e)&&_$e.__upscopeID&&(((_e_parentNode=_$e.parentNode)===null||_e_parentNode===void 0?void 0:_e_parentNode.__upscopeMasked)||_$e.__upscopeMasked&&(t[_$e.__upscopeID]="".concat(_$e.offsetWidth,"x").concat(_$e.offsetHeight)))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return t}},{key:"ensureHasIds",value:function ensureHasIds(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,s=arguments.length>3?arguments[3]:void 0;var _this=this;n&&(o.__upscopeRootId=n);var i=V(o);var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=i[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o1=_step.value;void 0===o1.__upscopeID&&(s&&s(o1),o1.__upscopeID=(n?n+">":"")+(t?t+"-":"")+String(this.upscopeId++),o1.__upscopeMutationBatch=t,e("maskElementMiddleware")(o1)&&(o1.__upscopeMasked=!0),(this.isChildFrame||o1.__upscopeMasked||o1.__upscopeDialogButton||!e("allowRemoteMiddleware")(o1))&&(o1.__upscopeNoRemoteControl=!0)),"upscope___overlay"!==o1.id&&void 0!==o1.style&&"string"==typeof o1.style.zIndex&&o1.style.zIndex.length>0&&Number.parseInt(o1.style.zIndex,10)>2147483645&&(o1.style.zIndex="2147483645"),o1.shadowRoot&&this.ensureHasIds(t,o1.shadowRoot,o1.__upscopeID,s)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}$(o,function(e){return e.contentDocument&&_this.ensureHasIds(t,e.contentDocument,e.__upscopeID,s)})}},{key:"removeIdsFromElement",value:function removeIdsFromElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;if(void 0!==e.__upscopeID&&(delete e.__upscopeID,void 0!==e.__upscopeMasked&&delete e.__upscopeMasked,void 0!==e.__upscopeMutationBatch&&delete e.__upscopeMutationBatch,void 0!==e.__upscopeNoRemoteControl&&delete e.__upscopeNoRemoteControl,void 0!==e.__upscopeScrollable&&delete e.__upscopeScrollable,e.shadowRoot&&this.removeIds(e.shadowRoot),t))try{for(var _iterator=V(e)[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var t1=_step.value;this.removeIdsFromElement(t1,!1)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}},{key:"removeIds",value:function removeIds(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;var _this=this;r("Removing all elements IDs for document (%o)",e),void 0!==e.__upscopeRootId&&delete e.__upscopeRootId;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=V(e)[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var t=_step.value;this.removeIdsFromElement(t)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}$(e,function(e){return e.contentDocument&&_this.removeIds(e.contentDocument)},null,!0),this.upscopeId=0}}]);return ye}();var be={"#upscope___overlay":{display:"none",position:"fixed","z-index":"2147483646",width:"10000px",height:"10000px",top:"-5000px",left:"-5000px",opacity:"0","pointer-events":"none",transition:"opacity 0.3s","-webkit-transition":"opacity 0.3s",background:'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwMDBweCIgaGVpZ2h0PSIxMDAwMHB4IiB2aWV3Qm94PSIwIDAgMTAwMDAgMTAwMDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+DQogIDxnIGlkPSJvdmVybGF5IiBmaWxsPSIjMDAwMDAwIj4NCiAgICAgIDxwYXRoIGQ9Ik0wLDAgTDEwMDAwLDAgTDEwMDAwLDEwMDAwIEwwLDEwMDAwIEwwLDAgTDAsMCBaIE01MDAwLDUwNTQgQzUwMjkuODIzMzgsNTA1NCA1MDU0LDUwMjkuODIzMzggNTA1NCw1MDAwIEM1MDU0LDQ5NzAuMTc2NjIgNTAyOS44MjMzOCw0OTQ2IDUwMDAsNDk0NiBDNDk3MC4xNzY2Miw0OTQ2IDQ5NDYsNDk3MC4xNzY2MiA0OTQ2LDUwMDAgQzQ5NDYsNTAyOS44MjMzOCA0OTcwLjE3NjYyLDUwNTQgNTAwMCw1MDU0IEw1MDAwLDUwNTQgWiIgaWQ9ImlubmVyLWNpcmNsZSI+PC9wYXRoPg0KICA8L2c+DQo8L3N2Zz4=")',"background-size":"50000px 50000px","background-position":"center center"},"#upscope___overlay.upscope___overlay--show":{opacity:"0.4",transition:"background-size 0.3s linear, opacity 0.3s, top 0.1s, left 0.1s","-webkit-transition":"background-size 0.3s linear, opacity 0.3s, top 0.1s, left 0.1s","background-size":"10000px 10000px"},"#upscope___overlay.upscope___overlay--white":{background:'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwMDAiIGhlaWdodD0iMTAwMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMCAwaDEwMDAwdjEwMDAwSDBWMHptNTAwMCA1MDU0YzI5LjggMCA1NC0yNC4yIDU0LTU0cy0yNC4yLTU0LTU0LTU0LTU0IDI0LjItNTQgNTQgMjQuMiA1NCA1NCA1NHoiIGZpbGw9IiNGRkYiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik01MDAwIDUwNTRjMjkuOCAwIDU0LTI0LjIgNTQtNTRzLTI0LjItNTQtNTQtNTQtNTQgMjQuMi01NCA1NCAyNC4yIDU0IDU0IDU0eiIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utd2lkdGg9IjYiLz48L2c+PC9zdmc+")'},"#upscope___overlay.upscope___overlay--white.upscope___overlay--show":{opacity:"0.4"},".upscope___svg":{"pointer-events":"none",position:"fixed",top:"0",left:"0",width:"100%",height:"100%","z-index":"2147483645"},"#upscope___drag-protection":{position:"fixed",top:"0",left:"0",width:"100%",height:"100%","z-index":"2147483645",display:"none"},"@keyframes upscope___svg____line__animation":{from:{"stroke-dashoffset":"10000"},to:{"stroke-dashoffset":"0"}},".upscope___svg___line":{fill:"none","stroke-width":"14px","stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.6","stroke-dasharray":"10000","stroke-dashoffset":"0",transition:"opacity 1s",animation:"upscope___svg____line__animation 5s forwards"},".upscope___svg___line.upscope___svg___line--disappear":{opacity:"0","stroke-dashoffset":"0","stroke-dasharray":"0"},".upscope___svg___line.upscope___svg___line--gone":{display:"none",opacity:"0"}};var ke=function(){function ke(e){_classCallCheck(this,ke);_defineProperty(this,"connection",void 0);_defineProperty(this,"hidePointerTimeout",void 0);_defineProperty(this,"clearPathsTimeout",void 0);_defineProperty(this,"currentPointerObserverId",void 0);_defineProperty(this,"pointerPosition",{x:0,y:0});_defineProperty(this,"cursors",{});_defineProperty(this,"blurTimeouts",{});_defineProperty(this,"dragProtectionElement",void 0);_defineProperty(this,"doubleClickTracker",{});_defineProperty(this,"container",void 0);_defineProperty(this,"overlayElement",void 0);_defineProperty(this,"enlargeCursorStylesheet",void 0);this.connection=e,r("Initiating browser instructions receiver"),this.injectElements()}_createClass(ke,[{key:"observerGone",value:function observerGone(e){this.currentPointerObserverId===e&&(delete this.currentPointerObserverId,this.hidePointer()),this.cursors[e]&&this.hideCursor(e)}},{key:"receiveInstruction",value:function receiveInstruction(t){switch(this.injectElements(),t.action){case"dataBounce":"data"in t&&"string"==typeof t.data&&this.connection.performDataBounce(t.data);break;case"scroll":"elementId"in t&&"string"==typeof t.elementId&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y&&this.scroll(t.elementId,t.x,t.y);break;case"click":"elementId"in t&&"string"==typeof t.elementId&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y&&this.click(t.elementId,t.observerId,t.x,t.y);break;case"dragStart":"elementId"in t&&"string"==typeof t.elementId&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y&&this.dragStart(t.elementId,t.observerId,t.x,t.y);break;case"dragEnd":"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y&&this.dragEnd(t.observerId,t.x,t.y);break;case"type":"elementId"in t&&"string"==typeof t.elementId&&"newValue"in t&&"string"==typeof t.newValue&&this.type(t.elementId,t.observerId,t.newValue);break;case"drawLine":if("lineData"in t&&"object"==typeof t.lineData&&null!==t.lineData){var e1=t.lineData;"path"in e1&&"string"==typeof e1.path&&"color"in e1&&"string"==typeof e1.color&&this.drawLine({path:e1.path,color:e1.color})}break;case"sendSnapshot":"forceAssets"in t&&t.forceAssets&&e("proxyAssets",["*"]),this.connection.sendSnapshot();break;case"showPointer":this.currentPointerObserverId=t.observerId,this.showPointer();break;case"hidePointer":delete this.currentPointerObserverId,this.hidePointer();break;case"movePointer":"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y&&this.movePointer(t.x,t.y);break;case"hideCursor":this.hideCursor(t.observerId);break;case"moveCursor":"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y&&"color"in t&&"string"==typeof t.color&&this.moveCursor(t.x,t.y,t.color,t.agentName,t.observerId);break;case"reload":this.reload();break;case"redirect":"url"in t&&"string"==typeof t.url&&this.redirect(t.url);break;case"console":var _this_connection_consoleHandler;e("allowRemoteConsole")&&"command"in t&&"string"==typeof t.command?(_this_connection_consoleHandler=this.connection.consoleHandler)===null||_this_connection_consoleHandler===void 0?void 0:_this_connection_consoleHandler.execute(t.command):a("error","Remote console not enabled");break;default:a("error","Browser instruction not recognized",t)}}},{key:"scroll",value:function scroll(t,o,n){if(!e("allowRemoteScroll"))return a("error","Remote scroll disabled");var s=window.scrollX,i=window.scrollY,c=document.querySelectorAll("html")[0];var l=this.selectElement(t);var u=l;if(!l)return r("Element not found during scroll (%s)",t);for(;l&&l!==c;){if(O(l)&&(0!==n&&l.scrollTop+n>0&&l.scrollTop+n+l.clientHeight<l.scrollHeight||0!==o&&l.scrollLeft+o>0&&l.scrollLeft+o+l.clientWidth<l.scrollWidth)){var e1=l.scrollTop,_$t=l.scrollLeft;if(l.scrollTop+=n,l.scrollLeft+=o,o-=l.scrollLeft-_$t,0===(n-=l.scrollTop-e1)&&0===o)return}if(l.parentNode===l.ownerDocument){var _l_ownerDocument_defaultView;var e2=l.ownerDocument.__upscopeRootId,_$t1=(_l_ownerDocument_defaultView=l.ownerDocument.defaultView)===null||_l_ownerDocument_defaultView===void 0?void 0:_l_ownerDocument_defaultView.parent.document,_$o=_$t1===null||_$t1===void 0?void 0:_$t1.querySelectorAll("iframe,frame");var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=(_$o||[])[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$t2=_step.value;if(_$t2.__upscopeID===e2){l=_$t2;break}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}else l=l.parentNode}window.scrollTo(s+o,i+n),o-=window.scrollX-s,n-=window.scrollY-i,0===o&&0===n||!u||this.dispatchEvent(u,WheelEvent,"wheel",{deltaX:o,deltaY:n})}},{key:"dragStart",value:function dragStart(t,o,n,s){if(!e("allowRemoteClick"))return a("error","Remote click disabled");var i=this.selectElement(t);if(!i)return r("Element not found during click (%s)",t);if(i.__upscopeNoRemoteControl)return r("Remote clicking not allowed on this element");if(!this.cursors[o])return r("Cursor not active, ignored dragStart");if(this.cursors[o].dragging)return r("Already dragging, ignored dragStart");this.cursors[o].dragging=i,this.dragProtectionElement&&(this.dragProtectionElement.style.display="block");for(var _i=0,_iter=["mouseover","mouseenter","mousedown"];_i<_iter.length;_i++){var e1=_iter[_i];this.dispatchEvent(i,MouseEvent,e1,{x:n,y:s})}var c=this.findDraggable(i);if(c){this.cursors[o].dragging=c,this.cursors[o].dataTransfer="function"==typeof DataTransfer?new DataTransfer:void 0;for(var _i1=0,_iter1=["drag","dragstart"];_i1<_iter1.length;_i1++){var e2=_iter1[_i1];this.dispatchEvent(c,DragEvent,e2,{dataTransfer:this.cursors[o].dataTransfer,x:n,y:s})}}}},{key:"findDraggable",value:function findDraggable(e){do{if(e.draggable)return e;e=e.parentNode}while(e)}},{key:"dragEnd",value:function dragEnd(e,t,o){var _this_cursors_e_dragging;if(!this.cursors[e]||!this.cursors[e].dragging)return r("Ignoring dragEnd (not dragging)");if((_this_cursors_e_dragging=this.cursors[e].dragging)===null||_this_cursors_e_dragging===void 0?void 0:_this_cursors_e_dragging.draggable){for(var _i=0,_iter=["mousemove","mouseup"];_i<_iter.length;_i++){var n=_iter[_i];this.dispatchEvent(this.cursors[e].dragging,MouseEvent,n,{x:t,y:o})}this.dispatchEvent(this.cursors[e].dragging,DragEvent,"dragend",{dataTransfer:this.cursors[e].dataTransfer,x:t,y:o}),this.cursors[e].previousHover&&this.dispatchEvent(this.cursors[e].previousHover,DragEvent,"drop",{dataTransfer:this.cursors[e].dataTransfer,x:t,y:o})}else if(this.cursors[e].previousHover)for(var _i1=0,_iter1=["mousemove","mouseup","click"];_i1<_iter1.length;_i1++){var n1=_iter1[_i1];this.dispatchEvent(this.cursors[e].previousHover,MouseEvent,n1,{x:t,y:o})}this.dragProtectionElement&&(this.dragProtectionElement.style.display="none"),delete this.cursors[e].dragging,delete this.cursors[e].dataTransfer}},{key:"click",value:function click(t,o,n,s){var _this=this;if(!e("allowRemoteClick"))return a("error","Remote click disabled");var i=this.selectElement(t);if(!i)return r("Element not found during click (%s)",t);if(i.__upscopeNoRemoteControl)return r("Remote clicking not allowed on this element");if(this.cursors[o]&&this.cursors[o].element&&this.cursors[o].element.clickAnimation(),Boolean(window.MSInputMethodContext)&&Boolean(document.documentMode))return i.click();i.ownerDocument.activeElement!==i&&R(i.ownerDocument.activeElement)&&!D("body",i.ownerDocument.activeElement)&&this.dispatchEvent(i.ownerDocument.activeElement,FocusEvent,"blur");for(var _i=0,_iter=["mouseover","mouseenter","mousedown","mouseup","click"];_i<_iter.length;_i++){var e1=_iter[_i];this.dispatchEvent(i,MouseEvent,e1,{x:n,y:s})}this.doubleClickTracker[o]?(this.dispatchEvent(i,MouseEvent,"dblclick",{x:n,y:s}),delete this.doubleClickTracker[o]):(this.doubleClickTracker[o]=!0,setTimeout(function(){return delete _this.doubleClickTracker[o]},200))}},{key:"type",value:function type(t,o,n){var _this=this;if(!e("allowRemoteType"))return a("error","Remote typing disabled");var s=this.selectElement(t);if(!D("input",s)&&!D("textarea",s)&&!D("select",s))return r("Element not found during click (%s)",t);if(s.__upscopeNoRemoteControl)return r("Remote typing not allowed on this element");this.blurTimeouts[t]||(this.dispatchEvent(s,FocusEvent,"focus"),this.dispatchEvent(s,FocusEvent,"focusin"));var i=s.value;s.value=n;var c=s._valueTracker;if(c&&c.setValue&&c.setValue(i),D("input",s)||D("textarea",s)){var e1=n.slice(-1),_$t=e1.charCodeAt(0);this.dispatchEvent(s,KeyboardEvent,"keydown",{which:_$t,key:e1}),this.dispatchEvent(s,KeyboardEvent,"keypress",{which:_$t,key:e1}),this.dispatchEvent(s,KeyboardEvent,"keyup",{which:_$t,key:e1}),this.dispatchEvent(s,KeyboardEvent,"input")}else this.dispatchEvent(s,Event,"change");clearTimeout(this.blurTimeouts[t]),this.blurTimeouts[t]=setTimeout(function(){_this.dispatchEvent(s,FocusEvent,"blur"),_this.dispatchEvent(s,FocusEvent,"focusout"),delete _this.blurTimeouts[t]},800)}},{key:"showPointer",value:function showPointer(){var _this=this;r("Showing pointer"),this.hidePointerTimeout&&clearTimeout(this.hidePointerTimeout),this.overlayElement.style.display="block",this.overlayElement.style.top=this.pointerPosition.y-5e3+"px",this.overlayElement.style.left=this.pointerPosition.x-5e3+"px;",this.hidePointerTimeout=setTimeout(function(){_this.overlayElement.className="upscope___overlay--show"},20)}},{key:"hidePointer",value:function hidePointer(){var _this=this;r("Hiding pointer"),this.overlayElement.className="",this.hidePointerTimeout=setTimeout(function(){_this.overlayElement.style.display="none"},300)}},{key:"movePointer",value:function movePointer(e,t){this.pointerPosition={x:e,y:t},this.overlayElement.style.left=this.pointerPosition.x-5e3+"px",this.overlayElement.style.top=" ".concat(this.pointerPosition.y-5e3,"px"),this.overlayElement.style.display="block"}},{key:"hideCursor",value:function hideCursor(e){r("Hiding pointer"),this.cursors[e]&&(this.cursors[e].dragging&&this.dragEnd(e,0,0),this.cursors[e].disableTimeout&&clearTimeout(this.cursors[e].disableTimeout),this.cursors[e].previousHover&&(this.dispatchEvent(this.cursors[e].previousHover,MouseEvent,"mouseleave"),this.dispatchEvent(this.cursors[e].previousHover,MouseEvent,"mouseout")),this.cursors[e].element&&this.cursors[e].element.remove(),delete this.cursors[e])}},{key:"hideAll",value:function hideAll(){this.hidePointer();for(var e in this.cursors)this.cursors.hasOwnProperty(e)&&this.hideCursor(e)}},{key:"moveCursor",value:function moveCursor(t,o,n,s,i){var _this=this;if(this.cursors[i]=this.cursors[i]||{},this.cursors[i].position={x:t,y:o},this.cursors[i].element||(r("Showing pointer"),this.cursors[i].element=this.injectCursor(n,s||"Agent",i)),this.cursors[i].element.style.zIndex="2147483646",this.cursors[i].element.style.pointerEvents="none",this.cursors[i].element.style.position="fixed",this.cursors[i].element.style.top="".concat(this.cursors[i].position.y,"px"),this.cursors[i].element.style.left="".concat(this.cursors[i].position.x,"px"),this.cursors[i].disableTimeout&&clearTimeout(this.cursors[i].disableTimeout),this.cursors[i].disableTimeout=setTimeout(function(){_this.hideCursor(i)},2e4),!e("allowRemoteClick")&&!e("allowRemoteScroll"))return;this.cursors[i].dragging&&this.dispatchEvent(this.cursors[i].dragging,MouseEvent,"mousemove",{x:t,y:o});var a=function(e,t){var _$o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];var _$n=document;for(;_$n===document||_$n&&("contentDocument"in _$n)&&_$n.contentDocument;){if(_$n!==document){var _n_getBoundingClientRect=_$n.getBoundingClientRect(),_$o1=_n_getBoundingClientRect.top,_$s=_n_getBoundingClientRect.left;e-=_$s,t-=_$o1}var _$s1=_$n===document?document:_$n.contentDocument;if(_$n=_$s1.elementFromPoint(e,t),_$n&&_$o.includes(_$n)&&"elementsFromPoint"in document){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=_$s1.elementsFromPoint(e,t)[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$i=_step.value;if(_$n=null,!_$o.includes(_$i)){_$n=_$i;break}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}else _$n&&_$o.includes(_$n)&&(_$n=null)}return _$n}(t,o,[this.cursors[i].dragging,this.dragProtectionElement].filter(Boolean));if(this.cursors[i].previousHover&&a!==this.cursors[i].previousHover){var _this_cursors_i_dragging;((_this_cursors_i_dragging=this.cursors[i].dragging)===null||_this_cursors_i_dragging===void 0?void 0:_this_cursors_i_dragging.draggable)&&this.dispatchEvent(this.cursors[i].previousHover,DragEvent,"dragleave",{dataTransfer:this.cursors[i].dataTransfer,x:t,y:o}),this.dispatchEvent(this.cursors[i].previousHover,MouseEvent,"mouseout",{relatedTarget:a||null,x:t,y:o});var e1=this.cursors[i].previousHover;for(;e1;)a&&e1.contains&&e1.contains(a)||this.dispatchEvent(e1,MouseEvent,"mouseleave",{relatedTarget:a||null,x:t,y:o}),e1=e1.parentElement}if(R(a)){if(a!==this.cursors[i].previousHover){var _this_cursors_i_dragging1;((_this_cursors_i_dragging1=this.cursors[i].dragging)===null||_this_cursors_i_dragging1===void 0?void 0:_this_cursors_i_dragging1.draggable)&&(this.dispatchEvent(a,DragEvent,"dragover",{dataTransfer:this.cursors[i].dataTransfer,x:t,y:o}),this.dispatchEvent(a,DragEvent,"dragenter",{dataTransfer:this.cursors[i].dataTransfer,x:t,y:o})),this.dispatchEvent(a,MouseEvent,"mouseover",{relatedTarget:this.cursors[i].previousHover||null,x:t,y:o});var e2=a;for(;e2;)this.cursors[i].previousHover&&e2.contains&&e2.contains(this.cursors[i].previousHover)||this.dispatchEvent(e2,MouseEvent,"mouseenter",{relatedTarget:this.cursors[i].previousHover||null,x:t,y:o}),e2=e2.parentElement}this.dispatchEvent(a,MouseEvent,"mousemove",{x:t,y:o})}this.cursors[i].previousHover=a}},{key:"drawLine",value:function drawLine(t){var _this=this;var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"class","upscope___svg"),this.container.append(o);var n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttributeNS(null,"class","upscope___svg___line"),n.setAttributeNS(null,"d",t.path),n.setAttributeNS(null,"stroke",t.color),o.append(n),clearTimeout(this.clearPathsTimeout),this.clearPathsTimeout=setTimeout(function(){var _t_querySelector;var e=_this.container.querySelectorAll(".upscope___svg");var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{var _loop=function(){var _$t=_step.value;_$t.__removed||(_$t.__removed=!0,(_t_querySelector=_$t.querySelector(".upscope___svg___line"))===null||_t_querySelector===void 0?void 0:_t_querySelector.setAttributeNS(null,"class","upscope___svg___line upscope___svg___line--disappear"),setTimeout(function(){_$t.remove()},2e3))};for(var _iterator=e[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true)_loop()}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}},e("drawingsTtlMs"))}},{key:"redirect",value:function redirect(t){if(!e("allowAgentRedirect"))return a("error","Agent URL changes are not allowed");if(!/^http(s)?:\/\//.test(t))return a("warn","Invalid redirect URL");if(t.includes("?")){var e1=t.slice(t.indexOf("?")+1);e1=e1.replace(/[&?]__upscope_[A-z_]+=[\w.\d]+/g,""),t="".concat(t.slice(0,Math.max(0,t.indexOf("?"))),"?").concat(e1)}t+=(t.includes("?")?"&":"?")+"__upscope_short_id="+this.connection.shortId,e("needsProxy")(t)&&(t=e("fromProxy")?"".concat(location.origin,"/").concat(t):e("proxyRedirectEndpoint").replace("URL",encodeURIComponent(t)).replace("TOKEN",encodeURIComponent(this.connection.proxyToken))),location.href=t}},{key:"reload",value:function reload(){if(!e("allowAgentRedirect"))return a("error","Agent URL changes are not allowed");location.reload()}},{key:"selectElement",value:function selectElement(e){try{var _$t=e.split(">"),o=[];var n,s=document,i=_$t.shift();for(;i;){if(!s)return;o.push(i);var _$e=V(s);var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=_$e[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _$t1=_step.value;if(_$t1.__upscopeID===o.join(">")){n=_$t1;break}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}i=_$t.shift(),i&&(s=n.contentDocument||n.shadowRoot||void 0)}return n}catch(t){return void r("Error selecting element "+e+" (%o)",t)}}},{key:"dispatchEvent",value:function dispatchEvent(e,t,o){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};try{var _e_ownerDocument_defaultView,_e_ownerDocument_defaultView1;void 0!==n.x&&void 0!==n.y&&(delete(n=_objectSpread({clientX:n.x,clientY:n.y,layerX:n.x,layerY:n.y,offsetX:n.x,offsetY:n.y,pageX:n.x+(((_e_ownerDocument_defaultView=e.ownerDocument.defaultView)===null||_e_ownerDocument_defaultView===void 0?void 0:_e_ownerDocument_defaultView.scrollX)||0),pageY:n.y+(((_e_ownerDocument_defaultView1=e.ownerDocument.defaultView)===null||_e_ownerDocument_defaultView1===void 0?void 0:_e_ownerDocument_defaultView1.scrollY)||0)},n)).x,delete n.y);var s=new t(o,_objectSpread({view:e.ownerDocument.defaultView,bubbles:!0,cancelable:!0},n));s.isUpscopeBrowserInstruction=!0,e.dispatchEvent(s)}catch(e1){r("Error dispatching event %o",e1)}}},{key:"injectElements",value:function injectElements(){if(!this.container||!document.getElementById("upscope___remote-control-container")){this.container=w(document,be,{id:"upscope___remote-control-container"}),r("Injecting overlay element");var e1=document.createElement("div");e1.id="upscope___overlay",this.container.append(e1),this.overlayElement=e1,r("Injecting drag protection overlay");var t=document.createElement("div");t.id="upscope___drag-protection",this.container.append(t),this.dragProtectionElement=t}e("enlargeCursor")&&!this.enlargeCursorStylesheet&&(this.enlargeCursorStylesheet=document.createElement("style"),this.enlargeCursorStylesheet.id="upscope___enlarge-cursor-stylesheet",this.enlargeCursorStylesheet.textContent=y({"*":{cursor:"url('data:image/svg+xml;upscope_enlarged_cursor=true;base64,".concat(btoa('<svg width="29px" height="39px" viewBox="0 0 29 39" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path d="M22.0377359,21.3349459 L16.4085968,21.3349459 L19.3824816,28.4981468 C19.4886918,28.7439431 19.4886918,28.9897387 19.3824816,29.2355351 C19.2762715,29.4813315 19.0992548,29.6568998 18.8514308,29.762241 L16.2492816,30.9209941 C16.0368612,31.0263353 15.8067394,31.0263353 15.5589154,30.9209941 C15.3110914,30.8156529 15.1340748,30.6400845 15.0278646,30.3942882 L12.213295,23.5997815 L7.59315257,28.2874644 C7.30992572,28.603488 6.97359297,28.6737151 6.58415594,28.4981468 C6.19471892,28.3225784 6,28.0241114 6,27.6027467 L6,4.9543911 C6,4.53302635 6.19471892,4.24333808 6.58415594,4.0853263 C6.97359297,3.92731451 7.30992572,3.98876381 7.59315257,4.26967338 L22.728102,19.7021575 C23.0113289,19.9830671 23.0732851,20.3254259 22.9139698,20.7292341 C22.7546546,21.1330423 22.4625766,21.3349459 22.0377359,21.3349459 Z" id="path-1"></path><filter x="-52.9%" y="-25.9%" width="205.9%" height="166.7%" filterUnits="objectBoundingBox" id="filter-2"><feMorphology radius="2" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology><feOffset dx="0" dy="2" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset><feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur><feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix></filter></defs><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="m" fill-rule="nonzero"><use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use><path stroke="#FFFFFF" stroke-width="2" d="M17.9064919,22.3349459 L20.3004477,28.1014878 C20.5160364,28.6004131 20.5160364,29.1332688 20.3004477,29.632194 C20.0922256,30.114071 19.7263822,30.4769212 19.2582265,30.6757602 L16.6935608,31.8168825 C16.2094267,32.056969 15.6750953,32.056969 15.1677245,31.8413037 C14.683964,31.6356742 14.3181206,31.272824 14.1039943,30.776994 L11.8665846,25.3757789 L8.33784454,28.9548727 C7.76310634,29.5961637 6.95900423,29.764063 6.17316507,29.4097862 C5.42678447,29.0732984 5,28.4191189 5,27.6027467 L5,4.9543911 C5,4.1262685 5.44118974,3.46989866 6.20818129,3.15869635 C6.96247518,2.85264604 7.72495058,2.99195295 8.30710831,3.56948254 L23.4322983,18.9921522 C24.0074862,19.5626341 24.1463989,20.3302428 23.8441901,21.0962358 C23.5352294,21.8793426 22.8761449,22.3349459 22.0377359,22.3349459 L17.9064919,22.3349459 Z" fill="'.concat(e("cursorColor"),'" fill-rule="evenodd"></path></g></g></svg>')),"') 2 2, default")}}),document.head.append(this.enlargeCursorStylesheet))}},{key:"injectCursor",value:function injectCursor(e,t,o){var n=y({"background-image":"url('data:image/svg+xml;base64,".concat(btoa('<svg width="29px" height="39px" viewBox="0 0 29 39" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path d="M22.0377359,21.3349459 L16.4085968,21.3349459 L19.3824816,28.4981468 C19.4886918,28.7439431 19.4886918,28.9897387 19.3824816,29.2355351 C19.2762715,29.4813315 19.0992548,29.6568998 18.8514308,29.762241 L16.2492816,30.9209941 C16.0368612,31.0263353 15.8067394,31.0263353 15.5589154,30.9209941 C15.3110914,30.8156529 15.1340748,30.6400845 15.0278646,30.3942882 L12.213295,23.5997815 L7.59315257,28.2874644 C7.30992572,28.603488 6.97359297,28.6737151 6.58415594,28.4981468 C6.19471892,28.3225784 6,28.0241114 6,27.6027467 L6,4.9543911 C6,4.53302635 6.19471892,4.24333808 6.58415594,4.0853263 C6.97359297,3.92731451 7.30992572,3.98876381 7.59315257,4.26967338 L22.728102,19.7021575 C23.0113289,19.9830671 23.0732851,20.3254259 22.9139698,20.7292341 C22.7546546,21.1330423 22.4625766,21.3349459 22.0377359,21.3349459 Z" id="path-1"></path><filter x="-52.9%" y="-25.9%" width="205.9%" height="166.7%" filterUnits="objectBoundingBox" id="filter-2"><feMorphology radius="2" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology><feOffset dx="0" dy="2" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset><feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur><feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix></filter></defs><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="m" fill-rule="nonzero"><use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use><path stroke="#FFFFFF" stroke-width="2" d="M17.9064919,22.3349459 L20.3004477,28.1014878 C20.5160364,28.6004131 20.5160364,29.1332688 20.3004477,29.632194 C20.0922256,30.114071 19.7263822,30.4769212 19.2582265,30.6757602 L16.6935608,31.8168825 C16.2094267,32.056969 15.6750953,32.056969 15.1677245,31.8413037 C14.683964,31.6356742 14.3181206,31.272824 14.1039943,30.776994 L11.8665846,25.3757789 L8.33784454,28.9548727 C7.76310634,29.5961637 6.95900423,29.764063 6.17316507,29.4097862 C5.42678447,29.0732984 5,28.4191189 5,27.6027467 L5,4.9543911 C5,4.1262685 5.44118974,3.46989866 6.20818129,3.15869635 C6.96247518,2.85264604 7.72495058,2.99195295 8.30710831,3.56948254 L23.4322983,18.9921522 C24.0074862,19.5626341 24.1463989,20.3302428 23.8441901,21.0962358 C23.5352294,21.8793426 22.8761449,22.3349459 22.0377359,22.3349459 L17.9064919,22.3349459 Z" fill="'.concat(e,'" fill-rule="evenodd"></path></g></g></svg>')),"')"),width:"29px",height:"39px",position:"absolute",top:"-4px",left:"-7px","z-index":"2","pointer-events":"none"}),s=y({background:e,"box-shadow":"0 2px 4px 0 rgba(0,0,0,0.1)","border-radius":"0 4px 4px 4px",color:"white","font-family":"Arial, sans-serif","letter-spacing":"0.4px",position:"absolute",top:"25px",left:"22px",padding:"0 4px","z-index":"3","font-weight":"700","font-size":"14px","pointer-events":"none","white-space":"nowrap"}),i=y({background:e,content:"''",position:"absolute",top:"50%",left:"50%",margin:"-35px 0 0 -35px",width:"70px",height:"70px","border-radius":"50%","pointer-events":"none","z-index":"1",opacity:"0",display:"none"}),r=document.createElement("div"),a=document.createElement("div"),c=document.createElement("div"),l=document.createElement("div");a.style.cssText=n,c.style.cssText=s,l.style.cssText=i,c.textContent=t,r.append(l),r.append(c),r.append(a),r.id="upscope___cursor__"+o,this.container.append(r);var u=[];return r.clickAnimation=function(){for(;u.length>0;)clearTimeout(u.pop());l.style.display="none",l.style.transition="none",u.push(setTimeout(function(){l.style.opacity="0",l.style.transform="scale3d(0, 0, 1)",l.style.transition="all 0.15s"},5),setTimeout(function(){l.style.display="block",l.style.opacity="0.5"},10),setTimeout(function(){l.style.opacity="0",l.style.transform="scale3d(1.2, 1.2, 1)"},160))},r}}]);return ke}();var Ce={"#upscope___promo-link, #upscope___promo-link *":{"text-decoration":"none","font-size":"12px","font-family":"'Avenir Next', Avenir, 'Lucida Grande', Helvetica, sans-serif","text-transform":"uppercase","letter-spacing":"0.4px","-webkit-font-smoothing":"subpixel-antialiased","font-weight":"600","user-select":"none"},"#upscope___promo-link":{"z-index":"2147483647",display:"none","border-radius":"0 3px 0 0",padding:"2px 2px 2px 5px",position:"fixed",bottom:"0",left:"0",background:"rgba(255, 255, 255, 0.8)",color:"#515151",border:"1px solid rgba(0, 0, 0, 0.5)","border-left":"none","border-bottom":"none"},"#upscope___promo-link.upscope___promo-link--active, #upscope___promo-link.upscope___promo-link--deactivating":{display:"block"},"#upscope___promo-link__upscope-link":{position:"relative",cursor:"pointer",color:"black"},"#upscope___promo-link__icon":{"font-weight":"700"},"#upscope___promo-link__stop-button":{background:"#d90000",color:"white","border-radius":"2px",padding:"0 3px",cursor:"pointer","text-shadow":"0.3px 0 0 white"},"#upscope___promo-link__upscope-link + #upscope___promo-link__stop-button":{"margin-left":"10px"},"#upscope___promo-link__stop-button:hover":{background:"#a30000"},"#upscope___promo-link__stop-button:active":{background:"#770000"},"#upscope___promo-link.upscope___promo-link--deactivating #upscope___promo-link__stop-button":{display:"none"},"#upscope___promo-link.upscope___promo-link--deactivating #upscope___promo-link__screensharing-by":{display:"none"},"#upscope___promo-link__thank-you, #upscope___promo-link__learn-more":{display:"none"},"#upscope___promo-link.upscope___promo-link--deactivating #upscope___promo-link__thank-you, #upscope___promo-link.upscope___promo-link--deactivating #upscope___promo-link__learn-more":{display:"inline"}};var Ie=function(){function Ie(e){_classCallCheck(this,Ie);_defineProperty(this,"connection",void 0);_defineProperty(this,"active",!1);_defineProperty(this,"innerContainer",void 0);_defineProperty(this,"deactivationTimeout",void 0);this.connection=e,this._injectElements(),setInterval(this._injectElements.bind(this),1e3),this.connection=e,this.active=!1,e.listen(["sessionStart","sessionContinue"],this.activate.bind(this)).listen(["sessionEnd"],this.deactivate.bind(this))}_createClass(Ie,[{key:"activate",value:function activate(){r("Activating info button"),this._injectElements(),this.active=!0,this.innerContainer.className="upscope___promo-link--active",clearTimeout(this.deactivationTimeout)}},{key:"deactivate",value:function deactivate(){var _this=this;r("Deactivating info button"),this._injectElements(),this.active=!1,e("showUpscopeLink")?(this.innerContainer.className="upscope___promo-link--deactivating",this.deactivationTimeout=setTimeout(function(){_this.innerContainer.className=""},3e4)):this.innerContainer.className=""}},{key:"_injectElements",value:function _injectElements(){var _this=this;if(!this.innerContainer||!document.querySelector("#upscope___promo-link-container")){r("Adding info button element");var t=w(document,Ce,{id:"upscope___promo-link-container"}),o=document.createElement("div");if(o.id="upscope___promo-link",e("showUpscopeLink")){var e1=document.createElement("a");e1.id="upscope___promo-link__upscope-link",e1.href="https://upscope.com/?utm_source=upscope&utm_campaign=promo-link&utm_audience=".concat(n().hostname),e1.target="_blank",e1.rel="noopener";var t1=document.createElement("span");t1.id="upscope___promo-link__screensharing-by",t1.textContent="Screensharing by ";var s=document.createElement("span");s.id="upscope___promo-link__thank-you",s.textContent="Thank you for using ";var i=document.createElement("span");i.id="upscope___promo-link__icon",i.textContent="Upscope";var r1=document.createElement("span");r1.id="upscope___promo-link__learn-more",r1.textContent=". Click to learn more.",e1.append(t1),e1.append(s),e1.append(i),e1.append(r1),o.append(e1)}if(e("showTerminateButton")){var t2=document.createElement("a");t2.id="upscope___promo-link__stop-button",t2.href="#",t2.__upscopeDialogButton=!0,t2.textContent=e("translationsStopSession"),t2.addEventListener("click",function(e){e.preventDefault(),_this.connection.stopSession()}),o.append(t2)}this.innerContainer=o,this.active&&(this.innerContainer.className="upscope___promo-link--active"),t.append(o)}}}]);return Ie}();var Se={"#upscope___request-agent-button":{"background-image":"url(\"data:image/svg+xml,%3Csvg width='19' height='25' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.856 24.393a.825.825 0 0 1-.477.514c-.23.096-.46.118-.686.065-3.568-.82-6.675-2.472-9.321-4.954a20.246 20.246 0 0 1-5.456-8.701C-.16 7.858-.288 4.35.536.795A1.1 1.1 0 0 1 .894.21a.829.829 0 0 1 .673-.202H6.22c.24-.004.46.077.66.242.2.165.317.37.35.615l.94 5.21a.938.938 0 0 1-.1.624 1.296 1.296 0 0 1-.472.493L4.57 8.68a15.243 15.243 0 0 0 2.076 5.138 15.98 15.98 0 0 0 3.707 4.085l2.67-2.061c.208-.13.426-.2.651-.207a.946.946 0 0 1 .606.184l4.286 3.127c.207.137.341.331.402.583a.978.978 0 0 1-.072.697l-2.039 4.168z' fill='%2362BB00' fill-rule='evenodd' fill-opacity='.95'/%3E%3C/svg%3E\"), linear-gradient(0deg, #F8F8F8 0%, #FFFFFF 98%)","background-size":"19px 25px, cover","background-position":"left 15px center, 0 0","background-repeat":"no-repeat","box-shadow":"0 1px 5px 0 rgba(0,0,0,0.20)","z-index":"2147483645",display:"none",position:"fixed",padding:"10px 10px 10px 44px","font-family":"'Avenir Next', 'Avenir', 'Helvetica', sans-serif","border-radius":"3px",cursor:"pointer",transition:"opacity 0.3s, box-shadow 0.3s","user-select":"none",opacity:"0.95"},"#upscope___request-agent-button span":{display:"block"},"#upscope___request-agent-button__title, #upscope___request-agent-button__requesting-title":{"font-size":"16px","font-weight":"500","padding-right":"10px"},"#upscope___request-agent-button__subtitle,#upscope___request-agent-button__requesting-subtitle":{"font-size":"14px"},"#upscope___request-agent-button__requesting-title,#upscope___request-agent-button__requesting-subtitle":{visibility:"hidden",height:"0"},".upscope___request-agent-button--pending #upscope___request-agent-button__requesting-title,.upscope___request-agent-button--pending #upscope___request-agent-button__requesting-subtitle":{visibility:"visible",height:"auto"},".upscope___request-agent-button--pending #upscope___request-agent-button__title,.upscope___request-agent-button--pending #upscope___request-agent-button__subtitle":{visibility:"hidden",height:"0"},"#upscope___request-agent-button.upscope___request-agent-button--visible":{display:"block"},"#upscope___request-agent-button:hover":{opacity:"1","box-shadow":"0 3px 15px 0 rgba(0,0,0,0.50)"},"#upscope___request-agent-button.upscope___request-agent-button--pending":{"background-image":"url(\"data:image/svg+xml,%3Csvg width='19' height='25' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.856 24.393a.825.825 0 0 1-.477.514c-.23.096-.46.118-.686.065-3.568-.82-6.675-2.472-9.321-4.954a20.246 20.246 0 0 1-5.456-8.701C-.16 7.858-.288 4.35.536.795A1.1 1.1 0 0 1 .894.21a.829.829 0 0 1 .673-.202H6.22c.24-.004.46.077.66.242.2.165.317.37.35.615l.94 5.21a.938.938 0 0 1-.1.624 1.296 1.296 0 0 1-.472.493L4.57 8.68a15.243 15.243 0 0 0 2.076 5.138 15.98 15.98 0 0 0 3.707 4.085l2.67-2.061c.208-.13.426-.2.651-.207a.946.946 0 0 1 .606.184l4.286 3.127c.207.137.341.331.402.583a.978.978 0 0 1-.072.697l-2.039 4.168z' fill='%23d0d0d0' fill-rule='evenodd' fill-opacity='.95'/%3E%3C/svg%3E\"), linear-gradient(0deg, #F8F8F8 0%, #FFFFFF 98%)",opacity:"0.85",cursor:"default"},"#upscope___request-agent-button__close":{position:"absolute",top:"8px",right:"8px",height:"14px",width:"14px",opacity:"0.6"},"#upscope___request-agent-button__close::before,#upscope___request-agent-button__close::after":{content:"''",width:"2px",background:"#535353",position:"absolute",left:"6px",height:"10px",top:"2px","-webkit-transform":"rotate(45deg)",transform:"rotate(45deg)"},"#upscope___request-agent-button__close::after":{"-webkit-transform":"rotate(-45deg)",transform:"rotate(-45deg)"},"#upscope___request-agent-button__close:hover":{opacity:"1"},".upscope___request-agent-button--pending #upscope___request-agent-button__close":{display:"none"}};var Ee=function(){function Ee(t){_classCallCheck(this,Ee);_defineProperty(this,"connection",void 0);_defineProperty(this,"visible",!1);_defineProperty(this,"requesting",!1);_defineProperty(this,"buttonElement",void 0);this.connection=t,this._pageMatches()?(this._injectElements(),setInterval(this._injectElements.bind(this),1e3),"always"===e("showAgentRequestButton")?this.activate():t.listen(["agentsAvailable"],this.activate.bind(this)),t.listen(["sessionStart","sessionContinue"],this.deactivate.bind(this)).listen(["sessionEnd"],this.activate.bind(this)).listen(["agentRequestUpdate"],this.onStatusChange.bind(this))):r("Not showing agent request button as the page does not match")}_createClass(Ee,[{key:"activate",value:function activate(){r("Activating agent request button"),this._injectElements(),this.visible=!0,this.requesting=!1,this._toggleClass()}},{key:"deactivate",value:function deactivate(){r("Deactivating agent request button"),this._injectElements(),this.visible=!1,this.requesting&&this.connection.cancelRequestAgent(),this._toggleClass()}},{key:"onCloseButtonClick",value:function onCloseButtonClick(e){e.stopPropagation(),this.deactivate()}},{key:"_toggleClass",value:function _toggleClass(){var e=(this.requesting?"upscope___request-agent-button--pending":"")+(this.visible?" upscope___request-agent-button--visible":"");this.buttonElement.className!==e&&(this.buttonElement.className=e)}},{key:"_pageMatches",value:function _pageMatches(){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e("agentRequestButtonPages")[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var t=_step.value;if(c(t,n().href))return!0}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return!1}},{key:"onStatusChange",value:function onStatusChange(t){switch(this.requesting="pending"===t,this._toggleClass(),t){case"accepted":S(e("agentRequestResultTitle"),e("agentRequestAcceptedText")),this.deactivate();break;case"unavailable":null===e("unavailableAgentRequestRedirectTo")?S(e("agentRequestResultTitle"),e("agentRequestNotAvailableText")):e("unavailableAgentRequestRedirectImmediately")&&e("unavailableAgentRequestRedirectTo")?location.href=e("unavailableAgentRequestRedirectTo"):e("unavailableAgentRequestRedirectTo")&&S(e("agentRequestResultTitle"),e("agentRequestNotAvailableText")).then(function(){location.href=e("unavailableAgentRequestRedirectTo")})}}},{key:"onButtonClick",value:function onButtonClick(){this.requesting?this.connection.cancelRequestAgent():this.connection.requestAgent()}},{key:"_injectElements",value:function _injectElements(){if(!this.buttonElement||!document.querySelector("#upscope___request-agent-button-container")){r("Adding agent request button element");var t=document.createElement("div"),o=document.createElement("span"),n=document.createElement("span"),s=document.createElement("span"),i=document.createElement("span"),a=document.createElement("span"),c=w(document,Se,{id:"upscope___request-agent-button-container"});t.id="upscope___request-agent-button",t.style.cssText=e("agentRequestButtonStyle"),t.addEventListener("click",this.onButtonClick.bind(this)),o.id="upscope___request-agent-button__close",o.addEventListener("click",this.onCloseButtonClick.bind(this)),n.textContent=e("agentRequestButtonTitle"),n.id="upscope___request-agent-button__title",s.textContent=e("agentRequestButtonSubtitle"),s.id="upscope___request-agent-button__subtitle",i.textContent=e("agentRequestButtonRequestingTitle"),i.id="upscope___request-agent-button__requesting-title",a.textContent=e("agentRequestButtonRequestingSubtitle"),a.id="upscope___request-agent-button__requesting-subtitle",t.append(o),t.append(n),t.append(s),t.append(i),t.append(a),c.append(t),this.buttonElement=t}this._toggleClass()}}]);return Ee}();var xe={"#upscope___lookup-code-button":{background:"#464646","background-image":"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAcCAYAAAAJKR1YAAAABGdBTUEAALGPC/xhBQAAAYZJREFUSA3tVjFugzAUjUlPUKZIyVSpa2+A2BAXqThBD9ETcIMeAbEhbtC1UqcgZSI3KPQ9ioekGNvUrhhiySHA83uPxxf+m77vU8wjpq9B7nRjOATAR2D3hvilsEYIcTBaLGMxAi8A2fIHCzS8LrkZ0sXLou4JQtGJa3Capvuu615xPQZsd33fxTlkT+CpgiB4KYqiURoazbzDyL0LYR0HjJ1h6ulOBWQyNBNF0UeWZQ9hGG5V2L9cb9v2K8/zz7quH6k5V9QxhXyaIT8flBr8jxErE5I1I5NJkuRniePfsiwHU6Sl5lxCjqXN6G6GdDkxoYYgvL+LoVvo6z4NPWMOpnyJ2PAG+CAVmAfMi2FD4hK7/qKWheTyqW241p+QLCSbp3KJXV1Cyr0MSZ1QTzvuxtzPuOf4GtQA95aacwlVNMDWYFzAU+dDth8jcfWrS5SKpg2aaXK6bgHpDA2aMiG2k+zgAHxjlNKo6yO5qUGtoYW1FeB3ynbNFB4mJt+OMqEpkv+49g2gcw5a2MSfIAAAAABJRU5ErkJggg==')","background-size":"18px 14px","background-position":"right 5px center","background-repeat":"no-repeat","box-shadow":"1px 1px 2px 0 rgba(0, 0, 0, 0.3)",width:"60px",height:"40px",position:"fixed",cursor:"help",display:"block",color:"white","font-family":"Courier New","font-weight":"bold","text-align":"right","line-height":"40px","padding-right":"30px","font-size":"18px",transition:"transform 0.5s","z-index":"2147483645",transform:"translateX(-75px)"},"#upscope___lookup-code-button:hover":{transform:"translateX(-68px)"},"#upscope___lookup-code-button.upscope___lookup-code-button--active":{transform:"translateX(-5px)"},'#upscope___lookup-code-button[data-align="right"]':{"background-position":"left 5px center","padding-left":"30px","padding-right":"0",transform:"translateX(75px)","text-align":"left"},'#upscope___lookup-code-button[data-align="right"]:hover':{transform:"translateX(68px)"},'#upscope___lookup-code-button[data-align="right"].upscope___lookup-code-button--active':{transform:"translateX(5px)"}};var Ae=function(){function Ae(t){_classCallCheck(this,Ae);_defineProperty(this,"connection",void 0);_defineProperty(this,"linkElement",void 0);_defineProperty(this,"resetTimeout",void 0);_defineProperty(this,"sequence",0);_defineProperty(this,"sequenceStartedAt",void 0);if(this.connection=t,e("injectLookupCodeButton")){if(!this.pageMatchesForButton())return void r("Not showing lookup code button as the page does not match");this.injectButtonElements()}e("lookupCodeElement")&&this.populateElement(),e("enableLookupCodeOnKey")&&this.listenForKeySequence(),this.listenForTargetChange()}_createClass(Ae,[{key:"handleButtonClick",value:function handleButtonClick(e){var _this=this;return _asyncToGenerator(function(){var _;return __generator(this,function(_state){switch(_state.label){case 0:e.preventDefault(),sessionStorage.setItem("__upscope:lookupCodeClick","true");_=_this.linkElement;return[4,_this.connection.getLookupCode()];case 1:_.textContent=_state.sent(),_this.linkElement.className="upscope___lookup-code-button--active",_this.resetTimeout&&clearTimeout(_this.resetTimeout),_this.resetTimeout=setTimeout(function(){_this.linkElement.className=""},5e3);return[2]}})})()}},{key:"pageMatchesForButton",value:function pageMatchesForButton(){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e("lookupCodeButtonPages")[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var t=_step.value;if(c(t,n().href))return!0}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return!1}},{key:"populateElement",value:function populateElement(){var t=0,o=!1;var _this=this;setInterval(_asyncToGenerator(function(){var n,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:if(o&&t%10!=0)return[2];n="string"==typeof e("lookupCodeElement")?document.querySelector(e("lookupCodeElement")):e("lookupCodeElement");if(!n)return[3,2];return[4,_this.connection.getLookupCode()];case 1:_tmp=(n.textContent=_state.sent(),o=!0,t++);return[3,3];case 2:_tmp=o=!1;_state.label=3;case 3:_tmp;return[2]}})}),100)}},{key:"listenForKeySequence",value:function listenForKeySequence(){var _this=this;var e=function(t){t&&(t.__upscopeLookupSequenceListenerActive||t.addEventListener("keyup",_this.handleKeyUp.bind(_this)),t.__upscopeLookupSequenceListenerActive=!0,$(t,function(t){return t.contentDocument&&e(t.contentDocument)},null,!0))};e(document),setInterval(function(){return e(document)},1e3)}},{key:"handleKeyUp",value:function handleKeyUp(t){this.sequence>0&&t.keyCode!==e("lookupCodeKey")?(this.sequence=0,delete this.sequenceStartedAt):t.keyCode===e("lookupCodeKey")?((!this.sequenceStartedAt||Date.now()-this.sequenceStartedAt.getTime()>1e4)&&(this.sequenceStartedAt=new Date,this.sequence=0),this.sequence++):(this.sequence=0,delete this.sequenceStartedAt),this.sequence===e("lookupCodeKeyRepetitions")&&(this.showAlert(),sessionStorage.setItem("__upscope:lookupCodeClick","true"),this.sequence=0,delete this.sequenceStartedAt)}},{key:"showAlert",value:function showAlert(){var _this=this;return _asyncToGenerator(function(){var t;return __generator(this,function(_state){switch(_state.label){case 0:return[4,_this.connection.getLookupCode()];case 1:t=_state.sent();S(e("lookupCodeKeyTitle").split("{%lookupCode%}").join(t),e("lookupCodeKeyMessage").split("{%lookupCode%}").join(t));return[2]}})})()}},{key:"listenForTargetChange",value:function listenForTargetChange(){var _this=this;"#upscope-lookup-code"===location.hash&&(r("Page had #upscope-lookup-code target at pageload"),this.showAlert(),sessionStorage.setItem("__upscope:lookupCodeClick","true"),history.replaceState("",document.title,window.location.pathname+window.location.search)),window.addEventListener("hashchange",function(){"#upscope-lookup-code"===location.hash&&(r("User clicked on #upscope-lookup-code link"),_this.showAlert(),sessionStorage.setItem("__upscope:lookupCodeClick","true"),history.back())})}},{key:"injectButtonElements",value:function injectButtonElements(){if(!this.linkElement||!document.querySelector("#upscope___lookup-code-button-container")){r("Adding promo link element");var t=document.createElement("div"),o=w(document,xe,{id:"upscope___lookup-code-button-container"});t.id="upscope___lookup-code-button",t.title="Screenshare code (by upscope.com)",t.style.cssText=e("lookupCodeButtonStyle").split(";").join(";"),e("lookupCodeButtonStyle").includes("right")&&(t.dataset.align="right"),t.addEventListener("click",this.handleButtonClick.bind(this)),o.append(t),this.linkElement=t}}}]);return Ae}();var Te=window,Re=window,Le=window,De=window;var Ne=window,Me=window,Pe=window,Oe=window;var Fe=window,Be=window,We=window,ze=window,je=window,He=window,$e=window,Ke=window,Ge=[{id:"chatra",isLive:!1,detect:function(){return void 0!==Te.Chatra},live:function live(e){(0,Te.Chatra)("updateIntegrationData",{"Screen share":e})}},{id:"drift",isLive:!1,detect:function(){return void 0!==Re.drift},live:function live(e){Re.drift.on("ready",function(){Re.drift.api.setUserAttributes({screenShare:e})})}},{id:"freshchat",isLive:!1,detect:function(){return void 0!==Le.fcWidget},live:function(e){return Le.fcWidget.user.update({meta:{cf_upscope_screenshare:e}})},getIntegrationIdentifier:_asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:return[4,Le.fcWidget.user.get()];case 1:return[2,_state.sent().data.alias]}})})},{id:"front",isLive:!1,detect:function(){return"function"==typeof De.FrontChat&&Boolean(qe())},getIntegrationIdentifier:_asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:return[4,h(g(function(){return Boolean(qe)}),1e4)];case 1:return[2,(_state.sent(),qe())]}})}),onOpen:function onOpen(e){var t=setInterval(function(){var o=document.querySelector("#front-chat-container");o&&o.clientHeight>100&&(clearInterval(t),e())},1e3)}},{id:"happyfox",isLive:!1,detect:function(){return void 0!==Ne.HFCHAT_CONFIG},rewrite:function rewrite(){var e=0;var t=setInterval(function(){e>3e3&&(a("info","To integrate with HappyFoxChat, you need to add the following to the installation code.","\n\n window.HFCHAT_CONFIG.onload = function (data) {\n window.__upscopeHappyFoxChat = this;\n };\n\n","To turn off this warning (and not integrate with Happy Fox Chat), add \"integrateWithLivechat: false\" to the Upscope('init') configuration."),clearInterval(t)),void 0!==Ne.__upscopeHappyFoxChat?clearInterval(t):e+=100},100)},live:function live(e){var t=setInterval(function(){void 0!==Ne.__upscopeHappyFoxChat&&(clearInterval(t),Ne.__upscopeHappyFoxChat.setCustomFields({ScreenShare:e},function(e,t){e&&(a("error","HappyFox Chat error",e),a("info",'To integrate with HappyFoxChat, you need to create a custom field of type "text" named "ScreenShare"'))}))},100)}},{id:"helpscout",isLive:!1,detect:function(){return"function"==typeof Me.Beacon},live:function live(e){Me.Beacon("identify",{Screenshare:e})}},{id:"intercom",isLive:!1,detect:function(){return void 0!==Pe.Intercom},live:function live(e){Pe.Intercom("update",{screenshare:e}),"object"==typeof Pe.intercomSettings&&(Pe.intercomSettings.screenshare=e)},onOpen:function onOpen(e){return _asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:return[4,g(function(){return Boolean(Pe.Intercom.booted)})];case 1:_state.sent(),Pe.Intercom("onShow",e);return[2]}})})()},getUserId:function getUserId(){if(Pe.intercomSettings&&Pe.intercomSettings.user_id)return Pe.intercomSettings.user_id},getIdentities:function getIdentities(){if(Pe.intercomSettings&&Pe.intercomSettings.name)return[Pe.intercomSettings.name]},getIntegrationIdentifier:_asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:return[4,h(g(function(){return Boolean(Pe.Intercom("getVisitorId"))}),1e4)];case 1:return[2,(_state.sent(),Pe.Intercom("getVisitorId"))]}})})},{id:"livechat",isLive:!1,detect:function(){return void 0!==Oe.__lc||void 0!==Oe.LiveChatWidget&&Boolean(Ue())},live:function live(e){return _asyncToGenerator(function(){var _tmp;return __generator(this,function(_state){switch(_state.label){case 0:this.watchLink=e;if(!(void 0!==Oe.LiveChatWidget))return[3,1];_tmp=Oe.LiveChatWidget.call("update_session_variables",{Screenshare:this.watchLink});return[3,3];case 1:return[4,g(function(){return Oe.LC_API.is_loaded()})];case 2:_tmp=(_state.sent(),Oe.LC_API.update_custom_variables([{name:"Screenshare",value:this.watchLink}]));_state.label=3;case 3:return[2,_tmp]}})}).apply(this)},onOpen:function onOpen(e){if(Oe.LiveChatWidget&&Oe.LiveChatWidget.on("ready",e),Oe.__lc){var t=Oe.LC_API.on_chat_started;Oe.LC_API.on_chat_started=function(o){"function"==typeof t&&t(),e()}}},getCustomerData:function(){return Oe.LiveChatWidget.get("customer_data")},getUserId:function getUserId(){if(Oe.LiveChatWidget){var _this_getCustomerData=this.getCustomerData(),e=_this_getCustomerData.email;return e||void 0}if(Oe.__lc){if(!Oe.__lc.visitor)return;if(!Oe.__lc.visitor.email)return;return Oe.__lc.visitor.email}},getIdentities:function getIdentities(){if(Oe.LiveChatWidget){var _this_getCustomerData=this.getCustomerData(),e=_this_getCustomerData.name;return e?[e]:void 0}if(Oe.__lc){if(!Oe.__lc.visitor)return;if(!Oe.__lc.visitor.name)return;return[Oe.__lc.visitor.name]}},getIntegrationIdentifier:function getIntegrationIdentifier(){return _asyncToGenerator(function(){var e;return __generator(this,function(_state){switch(_state.label){case 0:return[4,h(g(function(){e=Oe.LiveChatWidget?Ue():Oe.LC_API.get_visitor_id();try{return/^(?:[\dA-z]+-){4}[\dA-z]+$/.test(e)}catch(e1){return!1}}),1e4)];case 1:return[2,(_state.sent(),e||void 0)]}})})()}},{id:"olark",isLive:!1,detect:function(){return void 0!==Fe.olark},rewrite:function rewrite(){var _this=this;this.lastSentSnippet=[];var e=this;d(window,"olark",function(){for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key]}var _Fe;if("api.chat.updateVisitorStatus"===t[0]){var _t_=t[1],o=_t_.snippet;e.lastSentSnippet="object"==typeof o?o:[o],o=e.lastSentSnippet.slice(),o.push("Screenshare: "+_this.watchLink),t[1].snippet=o}(_Fe=Fe).__original__olark.apply(_Fe,_toConsumableArray(t))})},live:function live(e){this.watchLink=e,Fe.olark("api.chat.updateVisitorStatus",{snippet:this.lastSentSnippet})}},{id:"reamaze",isLive:!1,detect:function(){return void 0!==Be._support&&document.documentElement.innerHTML.includes("reamaze")},live:function live(e){var t=setInterval(function(){if(void 0!==Be.Reamaze){clearInterval(t);try{Be._support.custom_fields=Be._support.custom_fields||{},Be._support.custom_fields["Screen share"]={type:"hidden",value:e},Be.Reamaze.reload()}catch(e1){a("error","Error with reamaze api",e1)}}},100)}},{id:"sendinblue",isLive:!1,detect:function(){return void 0!==We.SibConversations},live:function live(e){(0,We.SibConversations)("updateIntegrationData",{"Screen share":e})}},{id:"sfdc",isLive:!1,detect:function(){return void 0!==ze.embedded_svc},live:function live(t){return _asyncToGenerator(function(){var o;return __generator(this,function(_state){switch(_state.label){case 0:return[4,g(function(){return ze.embedded_svc.settings})];case 1:_state.sent();o={label:e("sfdcFieldLabel"),value:t,transcriptFields:[e("sfdcFieldId")],displayToAgent:!0};ze.embedded_svc.settings.extraPrechatFormDetails?"function"==typeof ze.embedded_svc.settings.extraPrechatFormDetails.push?ze.embedded_svc.settings.extraPrechatFormDetails.push(o):a("error","Error integrating with SFDC chat"):ze.embedded_svc.settings.extraPrechatFormDetails=[o];return[2]}})})()}},{id:"tawk",isLive:!1,detect:function(){return void 0!==je.Tawk_API},live:function live(e){if(sessionStorage.getItem("upscope:added-tawk-event"))return;var t=setInterval(function(){if("function"==typeof je.Tawk_API.addEvent&&"function"==typeof je.Tawk_API.getStatus&&"online"===je.Tawk_API.getStatus()){clearInterval(t);try{je.Tawk_API.addEvent("upscope",{Screenshare:e}),sessionStorage.setItem("upscope:added-tawk-event","true")}catch(e1){a("info","Error with tawk api",e1)}}},100)}},{id:"twilio_flex",isLive:!1,detect:function(){return void 0!==He.Twilio},getIntegrationIdentifier:function getIntegrationIdentifier(){return _asyncToGenerator(function(){var _JSON_parse,e;return __generator(this,function(_state){switch(_state.label){case 0:return[4,h(g(function(){return Boolean(localStorage.getItem("TWILIO_WEBCHAT_WIDGET"))}),1e4)];case 1:_state.sent();_JSON_parse=JSON.parse(localStorage.getItem("TWILIO_WEBCHAT_WIDGET")),e=_JSON_parse.conversationSid;return[2,e]}})})()}},{id:"zendesk",isLive:!1,detect:function(){return void 0!==$e.$zopim&&void 0!==$e.$zopim.livechat||void 0!==$e.zE},getUserId:function getUserId(){if($e.$zopim){var e=$e.$zopim.livechat.getEmail()||null;if(!e)return;return e}},getIdentities:function getIdentities(){if($e.$zopim){var e=$e.$zopim.livechat.getName()||null;if(!e)return;return[e]}},onOpen:function onOpen(e){if($e.$zopim&&$e.$zopim.livechat.setOnChatStart(e),void 0!==$e.zE)switch($e.zE.widget){case"classic":$e.zE("webWidget:on","open",e);break;case"messenger":$e.zE("messenger:on","open",e)}},getIntegrationIdentifier:_asyncToGenerator(function(){var _document_cookie_split_pop_split_shift,_document_cookie_split_pop;return __generator(this,function(_state){switch(_state.label){case 0:return[4,h(g(function(){return document.cookie.includes("__zlcmid=")}),1e4)];case 1:return[2,(_state.sent(),(_document_cookie_split_pop_split_shift=(_document_cookie_split_pop=document.cookie.split("__zlcmid=").pop())===null||_document_cookie_split_pop===void 0?void 0:_document_cookie_split_pop.split(";").shift())===null||_document_cookie_split_pop_split_shift===void 0?void 0:_document_cookie_split_pop_split_shift.trim())]}})})},{id:"zoho",isLive:!1,detect:function(){return"object"==typeof Ke.$zoho&&void 0!==Ke.$zoho.salesiq},live:function live(e){var t=setInterval(function(){if(Ke.$zoho.salesiq.visitor&&"function"==typeof Ke.$zoho.salesiq.visitor.info){clearInterval(t);try{Ke.$zoho.salesiq.visitor.info({"Screen share":e})}catch(e1){a("info","Error with zoho api",e1)}}},100)}}];var Qe=function(){function Qe(e){_classCallCheck(this,Qe);_defineProperty(this,"connection",void 0);_defineProperty(this,"integrations",[]);_defineProperty(this,"integrationIds",[]);_defineProperty(this,"integrationUserUniqueId",void 0);_defineProperty(this,"integrationUserIdentities",void 0);_defineProperty(this,"watchLink",void 0);this.connection=e,this.connection=e,this.init()}_createClass(Qe,[{key:"init",value:function init(){var _this=this;if(r("Initiating live chat integration system"),this.trySetup(),this.integrations.length>0)return;var e=0;var t=setInterval(function(){e++,e>20&&e<40&&e%4!=0||e>40&&e%15!=0||(_this.trySetup(),_this.integrations.length>0&&clearInterval(t))},500)}},{key:"trySetup",value:function trySetup(){if(this._detect(),0!==this.integrations.length){window.Upscope._integrations=this.integrationIds;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=this.integrations[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var t=_step.value;if(e("grabIdentityFromLivechat"))try{var _t_getUserId,_t_getIdentities;var _$e=(_t_getUserId=t.getUserId)===null||_t_getUserId===void 0?void 0:_t_getUserId.call(t),o=(_t_getIdentities=t.getIdentities)===null||_t_getIdentities===void 0?void 0:_t_getIdentities.call(t);this.integrationUserUniqueId=_$e!==null&&_$e!==void 0?_$e:this.integrationUserUniqueId,this.integrationUserIdentities=o!==null&&o!==void 0?o:this.integrationUserIdentities,r("Retrieved identities from live chat %s (%o)",t.id,[_$e,o])}catch(e1){r("Error while retrieving identities from live chat %s. (%o)",t.id,e1)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}this.rewrite(),this.trackOpens(),this.getIntegrationIdentifier(),this.watchLink&&this.live(this.watchLink)}}},{key:"live",value:function live(e){var _this=this;return _asyncToGenerator(function(){var _iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,t,e1,err;return __generator(this,function(_state){switch(_state.label){case 0:_this.watchLink=e;_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;_state.label=1;case 1:_state.trys.push([1,8,9,10]);_iterator=_this.integrations[Symbol.iterator]();_state.label=2;case 2:if(!!(_iteratorNormalCompletion=(_step=_iterator.next()).done))return[3,7];t=_step.value;if(!(t.live&&!t.isLive))return[3,6];_state.label=3;case 3:_state.trys.push([3,5,,6]);return[4,t.live(e)];case 4:_state.sent(),t.isLive=!0,r("Watch link added to live chat %s",t.id);return[3,6];case 5:e1=_state.sent();r("Error adding watch link to live chat %s. (%o)",t.id,e1);return[3,6];case 6:_iteratorNormalCompletion=true;return[3,2];case 7:return[3,10];case 8:err=_state.sent();_didIteratorError=true;_iteratorError=err;return[3,10];case 9:try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}return[7];case 10:return[2]}})})()}},{key:"rewrite",value:function rewrite(){if(e("liveChatRewrite")){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=this.integrations[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var e1=_step.value;if(e1.rewrite)try{e1.rewrite(),r("Patched live chat object %s",e1.id)}catch(t){r("Error while patching live chat object %s. (%o)",e1.id,t)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}}},{key:"trackOpens",value:function trackOpens(){var _this=this;return _asyncToGenerator(function(){var _iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,_$e;return __generator(this,function(_state){_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=_this.integrations[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){_$e=_step.value;if(_$e.onOpen)try{_$e.onOpen(function(){_this.connection.connectToSocket(),sessionStorage.setItem("__upscope:integrationOpened","true"),setTimeout(function(){var _this_connection_historyCollector,_this_connection_historyCollector1;(_this_connection_historyCollector=_this.connection.historyCollector)===null||_this_connection_historyCollector===void 0?void 0:_this_connection_historyCollector.log("contact","Started chat conversation"),(_this_connection_historyCollector1=_this.connection.historyCollector)===null||_this_connection_historyCollector1===void 0?void 0:_this_connection_historyCollector1.save()},100)}),r("Tracked live chat (%s) opens",_$e.id)}catch(e){r("Error while tracking live chat opens. (%o)",e)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return[2]})})()}},{key:"getIntegrationIdentifier",value:function getIntegrationIdentifier(){var _this=this;return _asyncToGenerator(function(){var _$e,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,t,o,e,err;return __generator(this,function(_state){switch(_state.label){case 0:if(0===_this.integrations.length)return[2];_$e=[];_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;_state.label=1;case 1:_state.trys.push([1,8,9,10]);_iterator=_this.integrations[Symbol.iterator]();_state.label=2;case 2:if(!!(_iteratorNormalCompletion=(_step=_iterator.next()).done))return[3,7];t=_step.value;if(!t.getIntegrationIdentifier)return[3,6];_state.label=3;case 3:_state.trys.push([3,5,,6]);return[4,t.getIntegrationIdentifier()];case 4:o=_state.sent();o&&_$e.push("".concat(t.id,":").concat(o)),r("Got unique identifier from %s: %s",t.id,o);return[3,6];case 5:e=_state.sent();r("Could not get identifier from %s. (%o)",t.id,e);return[3,6];case 6:_iteratorNormalCompletion=true;return[3,2];case 7:return[3,10];case 8:err=_state.sent();_didIteratorError=true;_iteratorError=err;return[3,10];case 9:try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}return[7];case 10:_$e.length>0&&_this.connection.updateConnection({integrationIds:_$e});return[2]}})})()}},{key:"_detect",value:function _detect(){this.integrations=Ge.filter(function(e){return e.detect()}),this.integrations?(this.integrationIds=this.integrations.map(function(e){return e.id}),r("Live chat integrations found: %O",this.integrationIds)):r("No live chat integration found")}}]);return Qe}();var Ve=["error","warn","info","log","debug"],Ye=navigator.userAgent&&navigator.userAgent.includes("MSIE")||navigator.appVersion&&navigator.appVersion.indexOf("Trident/")>0;var Je=function(){function Je(e){_classCallCheck(this,Je);_defineProperty(this,"connection",void 0);_defineProperty(this,"console",[]);_defineProperty(this,"consoleItemId",0);_defineProperty(this,"watchInitiated",!1);this.connection=e,this.rewrite(),this.trackErrors()}_createClass(Je,[{key:"add",value:function add(e,t,o){if(this.console.length>500)return;var n=JSON.stringify(t);(!n||n.length>1e5)&&void 0!==t&&(n=JSON.stringify(t.toString().slice(0,1e5)));var s={id:this.consoleItemId++,timestamp:Date.now(),level:e,message:n,stack:o===null||o===void 0?void 0:o.slice(0,1e5)};this.console.push(s),"active"===this.connection.sessionStatus&&this.connection.sendBrowserEvent("root",{console:s}),500===this.console.length&&a("warn","Stopped logging console errors after 500 items.")}},{key:"execute",value:function execute(e){var _this=this;r("Received remote command %s",e),this.add("input",e),a("info","Remote console \xbb",e);var t=function(e,t){if(t)return _this.add("error",t.message);_this.add("output",e),a("info","Remote console \xab",e)};!function(o,n,s,i){try{t(eval.call(window,e))}catch(e1){t(null,_instanceof(e1,Error)?e1:void 0)}}()}},{key:"rewrite",value:function rewrite(){var _this=this;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{var _loop=function(){var e=_step.value;d(window.console,e,function(){for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key]}var _console;if(_this.console.length<=500)try{var _stack;var o=Ye?null:(_stack=(new Error).stack)===null||_stack===void 0?void 0:_stack.toString().split("\n").splice(2);var n=t.join(" ");n&&_this.add(e,n,o===null||o===void 0?void 0:o.map(function(e){return e.trim()}).join("\n"))}catch(e1){a("error","Error logging console item",e1)}(_console=console)["__original__".concat(e)].apply(_console,_toConsumableArray(t))})};for(var _iterator=Ve[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true)_loop()}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}},{key:"trackErrors",value:function trackErrors(){var _this=this;window.addEventListener("error",function(e){try{_this.add("error",e.message,Ye||null===e.error||void 0===e.error.stack?null:e.error.stack.toString().split("\n").map(function(e){return e.trim()}).join("\n"))}catch(t){a("error","Error logging console error",e,t)}})}}]);return Je}();var Xe=function(){function Xe(e){_classCallCheck(this,Xe);_defineProperty(this,"connection",void 0);_defineProperty(this,"callback",void 0);_defineProperty(this,"audio",void 0);_defineProperty(this,"ringing",!1);this.connection=e}_createClass(Xe,[{key:"handleResponse",value:function handleResponse(e){this.callback&&(this.callback(e),this.hide())}},{key:"show",value:function show(t){var _this_audio;this.callback=t,this.ringing=!0,E(void 0,e("callPromptText")).then(this.handleResponse.bind(this)),e("callRingtone")&&((_this_audio=this.audio)!==null&&_this_audio!==void 0?_this_audio:this.audio=new Audio(e("callRingtone")),this.audio.loop=!0,this.audio.play())}},{key:"hide",value:function hide(){var _this_audio;this.ringing&&(delete this.callback,this.ringing=!1,x(),(_this_audio=this.audio)===null||_this_audio===void 0?void 0:_this_audio.pause())}}]);return Xe}();var Ze=["success","error","info","warn","contact"];var et=function(){function et(e){_classCallCheck(this,et);_defineProperty(this,"connection",void 0);_defineProperty(this,"storage",new tt);_defineProperty(this,"autoSaveIsOn",!1);_defineProperty(this,"pendingSave",!1);_defineProperty(this,"pendingEvent",!1);_defineProperty(this,"slowScreenshotWait",void 0);_defineProperty(this,"currentPageview",void 0);this.connection=e,this.pageview(),this.addEventsTracking()}_createClass(et,[{key:"pageview",value:function pageview(){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:_this.currentPageview&&_this.storage.add(_this.currentPageview),_this.currentPageview={version:e("version"),pageviewId:p(),screenshot:void 0,ts:String(new Date),tse:String(new Date),url:n().href,events:[]};return[4,g(function(){return"complete"===document.readyState})];case 1:_state.sent(),_this.updateScreenshot(),sessionStorage.getItem("__upscope:historyAutoSaveOn")&&_this.turnAutoSaveOn();return[2]}})})()}},{key:"log",value:function log(e,t){if(!Ze.includes(e))throw new Error("Event log type ".concat(e," not supported"));if(!t||t.trim().length<1)throw new Error("Event log text required");this.addEvent("log",{type:e,text:t})}},{key:"enterFrom",value:function enterFrom(){var e=document.referrer,t=e&&f(e).hostname;!t||n().hostname.includes(t)||t.includes(n().hostname)||this.addEvent("enter_from",{url:e})}},{key:"leaveTo",value:function leaveTo(){var _document_activeElement;var e=(_document_activeElement=document.activeElement)===null||_document_activeElement===void 0?void 0:_document_activeElement.href,t=e&&window.URL&&f(e).hostname;!t||n().hostname.includes(t)||t.includes(n().hostname)||this.addEvent("leave_to",{url:e})}},{key:"click",value:function click(e){if(!(D("a",e)||D("input",e)&&["button","submit","reset"].includes(e.type)))return;var o=t(e.id),n=t(e.innerText.trim())||t(e.value);o=o?_(o):void 0,n=n?_(n):void 0,(o||n)&&(r("Detected click %o",{label:n,id:o}),this.addEvent("click",{label:n,id:o}))}},{key:"form",value:function form(o){var _o_labels,_o_labels_;var n=t(o.id)||t(o.name),s=t((_o_labels=o.labels)===null||_o_labels===void 0?void 0:(_o_labels_=_o_labels[0])===null||_o_labels_===void 0?void 0:_o_labels_.innerText.trim());if(n=n?_(n):void 0,s=s?_(s):void 0,!n&&!s)return;var i,a,c=!1;if(D("input",o)&&["text","tel","number","search","url","email"].includes(o.type))a="text",i=_(o.value);else if(D("input",o)&&"password"===o.type)a="password",i=void 0,c=!0;else if(D("input",o)&&"checkbox"===o.type)a="bool",i=o.checked;else if(D("input",o)&&"file"===o.type&&o.value)a="file";else{var _o_options_o_selectedIndex;if(!D("select",o))return;a="multiple",i=_(((_o_options_o_selectedIndex=o.options[o.selectedIndex])===null||_o_options_o_selectedIndex===void 0?void 0:_o_options_o_selectedIndex.innerText.trim())||o.value)}e("maskElementMiddleware")(o)&&(i=void 0,c=!0),r("Detected form input %o",{label:s,id:n,value:i,redacted:c,formType:a}),this.addEvent("form",{label:s,id:n,value:i,redacted:c,formType:a})}},{key:"save",value:function save(){var _this=this;return _asyncToGenerator(function(){var e,_tmp,e1;return __generator(this,function(_state){switch(_state.label){case 0:if(!!_this.pendingSave)return[3,9];_this.pendingSave=!0;_state.label=1;case 1:_state.trys.push([1,7,,8]);return[4,g(function(){return!_this.pendingEvent})];case 2:_state.sent();return[4,g(function(){return Boolean(_this.connection.shortId)})];case 3:_state.sent();return[4,_this.storage.get()];case 4:e=_state.sent();_tmp=e.length>0;if(!_tmp)return[3,6];return[4,_this.connection.sendPageviews(e)];case 5:_tmp=(_state.sent(),r("Saved pageviews"));_state.label=6;case 6:_tmp,_this.storage.clear(),_this.currentPageview.events=[],_this.currentPageview.screenshot=void 0;return[3,8];case 7:e1=_state.sent();r("Could not save pageviews");return[3,8];case 8:_this.turnAutoSaveOn(),_this.pendingSave=!1;_state.label=9;case 9:return[2]}})})()}},{key:"turnAutoSaveOn",value:function turnAutoSaveOn(){this.autoSaveIsOn||(this.autoSaveIsOn=!0,this.storage.noStorage(),sessionStorage.setItem("__upscope:historyAutoSaveOn","true"),setInterval(this.save.bind(this),1e3))}},{key:"addEventsTracking",value:function addEventsTracking(){var _this=this;this.enterFrom(),document.addEventListener("click",function(e){return e.target&&_this.click(e.target)}),document.addEventListener("input",function(e){return e.target&&_this.form(e.target)}),window.addEventListener("beforeunload",function(){return _this.leaveTo()})}},{key:"addEvent",value:function addEvent(e,t){this.pendingEvent=!0,("label"in t||"id"in t)&&(this.currentPageview.events=this.currentPageview.events.filter(function(o){return o.type!==e||(o.details.id||o.details.label)!==(t.id||t.label)})),this.currentPageview.events.push({eventId:p(),ts:new Date,type:e,details:t}),this.currentPageview.tse=String(new Date),this.storage.add(this.currentPageview),this.updateScreenshot()}},{key:"updateScreenshot",value:function updateScreenshot(){var _this=this;return _asyncToGenerator(function(){var e,t,_,o,n;return __generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,,3,4]);if(_this.slowScreenshotWait)return[2];_this.slowScreenshotWait=!0;e=new Date;r("Taking screenshot for events");_=JSON.stringify;return[4,_this.connection.browserWatcher.getSnapshot(window,!0)];case 1:t=_.apply(JSON,[_state.sent()]);t.length<8e5||_this.autoSaveIsOn?_this.currentPageview.screenshot=t:r("Screenshot is too big: discarding");return[4,_this.storage.add(_this.currentPageview)];case 2:_state.sent();o=Date.now()-e.getTime(),n=Math.max(5e3,19*o);r("Screenshot took %sms, will wait %sms before next",o,n),setTimeout(function(){return delete _this.slowScreenshotWait},n);return[3,4];case 3:_this.pendingEvent=!1;return[7];case 4:return[2]}})})()}}]);return et}();var tt=function(){function tt(){_classCallCheck(this,tt);_defineProperty(this,"useMemory",!1);_defineProperty(this,"pendingChanges",!1);_defineProperty(this,"pageviews",[])}_createClass(tt,[{key:"noStorage",value:function noStorage(){this.useMemory=!0}},{key:"add",value:function add(e){var _this=this;return _asyncToGenerator(function(){var t,e1;return __generator(this,function(_state){switch(_state.label){case 0:return[4,g(function(){return!_this.pendingChanges})];case 1:_state.sent();_state.label=2;case 2:_state.trys.push([2,4,5,6]);return[4,_this.get()];case 3:t=_state.sent();_this.pendingChanges=!0,t.some(function(t){return t.pageviewId===e.pageviewId})?t=t.map(function(t){return t.pageviewId===e.pageviewId?e:t}):t.unshift(e),_this.useMemory||sessionStorage.setItem("__upscope:pageviews",JSON.stringify(t)),_this.pageviews=t;return[3,6];case 4:e1=_state.sent();try{sessionStorage.removeItem("__upscope:pageviews")}catch(e2){}return[3,6];case 5:_this.pendingChanges=!1;return[7];case 6:return[2]}})})()}},{key:"clear",value:function clear(){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:return[4,g(function(){return!_this.pendingChanges})];case 1:_state.sent();try{_this.pendingChanges=!0,sessionStorage.removeItem("__upscope:pageviews"),delete _this.pageviews}finally{_this.pendingChanges=!1}return[2]}})})()}},{key:"get",value:function get(){var _this=this;return _asyncToGenerator(function(){var e,t,o,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,e1;return __generator(this,function(_state){switch(_state.label){case 0:return[4,g(function(){return!_this.pendingChanges})];case 1:_state.sent();try{if(_this.useMemory)return[2,_this.pageviews||[]];_this.pendingChanges=!0;e=sessionStorage.getItem("__upscope:pageviews"),t=e?JSON.parse(e):[],o=[];_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=t[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){e1=_step.value;if(o.length>5&&delete e1.screenshot,Date.now()-new Date(e1.tse).getTime()<864e3&&o.push(e1),30===o.length)break}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return[2,o]}finally{_this.pendingChanges=!1}return[2]}})})()}}]);return tt}();var ot=function(){function ot(e){_classCallCheck(this,ot);_defineProperty(this,"connection",void 0);_defineProperty(this,"killers",[]);_defineProperty(this,"active",!1);this.connection=e,e.listen(["sessionStart","sessionContinue"],this.activate.bind(this)).listen(["sessionEnd"],this.deactivate.bind(this))}_createClass(ot,[{key:"activate",value:function activate(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;var _this=this;this.active=!0;var t=this._handleEvent.bind(this);e.addEventListener("click",t),e.addEventListener("submit",t),this.killers.push(function(){e.removeEventListener("click",t),e.removeEventListener("submit",t)}),$(e,function(e){return e.contentDocument&&_this.activate(e.contentDocument)})}},{key:"deactivate",value:function deactivate(){this.active=!1;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=this.killers[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var e=_step.value;e()}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}this.killers.length=0}},{key:"redirect",value:function redirect(e){this.active&&(e=this._rewriteLink(e)),location.href=e}},{key:"_handleEvent",value:function _handleEvent(t){if(t.__upscopeIsProxyRewritten)return;var o=t.target;var n;if((s1=t)&&"[object MouseEvent]"===Object.prototype.toString.apply(s1)&&D("a",o)&&e("needsProxy")(o.href)){t.preventDefault();var e1=o.href,s=o.target;o.href=this._rewriteLink(o.href),t.isUpscopeBrowserInstruction&&(o.target="_self"),n=function(){o.href=e1,o.target=s}}else{if(!(function(e){return!!e&&"[object SubmitEvent]"===Object.prototype.toString.apply(e)}(t)&&D("form",o)&&e("needsProxy")(o.action)))return;{t.preventDefault();var e2=o.action;o.action=this._rewriteLink(o.action),n=function(){o.action=e2}}}var s1;var i=new t.constructor(t.type,t);i.__upscopeIsProxyRewritten=!0,o.dispatchEvent(i),n()}},{key:"_rewriteLink",value:function _rewriteLink(t){return t+=(t.includes("?")?"&":"?")+"__upscope_short_id="+this.connection.shortId,e("proxyRedirectEndpoint").replace("URL",encodeURIComponent(t)).replace("TOKEN",encodeURIComponent(this.connection.proxyToken))}}]);return ot}();function st(){return _st.apply(this,arguments)}function _st(){_st=_asyncToGenerator(function(){var e,t,e1,t1;return __generator(this,function(_state){switch(_state.label){case 0:t=0;for(var e1 in navigator)t++;_state.label=1;case 1:_state.trys.push([1,3,,4]);return[4,navigator.getBattery()];case 2:e=_state.sent();return[3,4];case 3:t1=_state.sent();e=null;return[3,4];case 4:return[2,function(e){var t=0;for(var o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o),t=Math.trunc(t);return String(Math.abs(t))}([navigator.userAgent,navigator.platform,navigator.cookieEnabled,navigator.languages,navigator.deviceMemory,navigator.hardwareConcurrency,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,screen.availTop,screen.availHeight,screen.availWidth,t,e?e.charging:null,window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:null,it()].flat().map(String).join(":"))]}})});return _st.apply(this,arguments)}var rt=function(){function rt(e){_classCallCheck(this,rt);_defineProperty(this,"connection",void 0);_defineProperty(this,"screenWakeLock",void 0);_defineProperty(this,"screenWakeListener",void 0);this.connection=e,e.listen(["sessionStart","sessionContinue"],this.keepScreenAwake.bind(this)),e.listen(["sessionEnd"],this.releaseScreenAwake.bind(this))}_createClass(rt,[{key:"keepScreenAwake",value:function keepScreenAwake(){var _this=this;"wakeLock"in navigator&&(navigator.wakeLock.request("screen").then(function(e){r("Screen wake lock acquired"),_this.screenWakeLock=e}).catch(function(e){r("Wake lock error: ",e.name,e.message)}),this.screenWakeListener||(this.screenWakeListener=function(){_this.screenWakeLock&&"visible"===document.visibilityState&&_this.keepScreenAwake()},document.addEventListener("visibilitychange",this.screenWakeListener)))}},{key:"releaseScreenAwake",value:function releaseScreenAwake(){var _this_screenWakeLock;(_this_screenWakeLock=this.screenWakeLock)===null||_this_screenWakeLock===void 0?void 0:_this_screenWakeLock.release().then(function(){r("Screen wake lock released")}).catch(function(e){r("Wake lock error: ",e.name,e.message)}),delete this.screenWakeLock,this.screenWakeListener&&(document.removeEventListener("visibilitychange",this.screenWakeListener),delete this.screenWakeListener)}}]);return rt}();var at=["connect","getWatchLink","getLookupCode","getUserId","getShortId","requestAgent"],ct=["identities","uniqueId","tags","integrationIds","callName","agentPrompt","allowRemoteConsole","allowRemoteClick","allowRemoteScroll","allowRemoteType","allowAgentRedirect"];var lt=function(){function lt(){_classCallCheck(this,lt);_defineProperty(this,"agentsAvailable",!1);_defineProperty(this,"brokenConnectionTimeout",void 0);_defineProperty(this,"connectionActiveSince",void 0);_defineProperty(this,"connectionHasJustBeenReset",!1);_defineProperty(this,"currentUrl",n().href);_defineProperty(this,"doNotReconnect",!1);_defineProperty(this,"socketIdleDisconnected",!1);_defineProperty(this,"eventId",0);_defineProperty(this,"listeners",{});_defineProperty(this,"lookupCode",void 0);_defineProperty(this,"pageLoadId",p());_defineProperty(this,"sessionStatus",void 0);_defineProperty(this,"shortId",void 0);_defineProperty(this,"controlRequestGranted",!e("requireControlRequest")&&null);_defineProperty(this,"shortIdFromQueryString",void 0);_defineProperty(this,"socketShouldBeOpen",!1);_defineProperty(this,"socketStatus",void 0);_defineProperty(this,"uniqueConnectionId",void 0);_defineProperty(this,"waitBeforeReconnect",0);_defineProperty(this,"ws",void 0);_defineProperty(this,"connected",!1);_defineProperty(this,"instrumentedQueuePush",!1);_defineProperty(this,"sessionActiveAfterDisconnect",!1);_defineProperty(this,"idlenessReporterActive",!1);_defineProperty(this,"urlChangesInterval",void 0);_defineProperty(this,"reconnectTimeout",void 0);_defineProperty(this,"lastActivityAt",new Date);_defineProperty(this,"callToken",void 0);_defineProperty(this,"sessionRatingInfo",void 0);_defineProperty(this,"proxyToken",void 0);_defineProperty(this,"idleDisconnectManagerActive",!1);_defineProperty(this,"phoneController",new Xe(this));_defineProperty(this,"consoleHandler",e("trackConsole")&&!e("fromProxy")?new Je(this):void 0);_defineProperty(this,"browserWatcher",new ye(this));_defineProperty(this,"browserInstructionsReceiver",new ke(this));_defineProperty(this,"integration",e("integrateWithLivechat")&&!e("fromProxy")?new Qe(this):void 0);_defineProperty(this,"linkProxyRewrite",e("rewriteExternalLinks")&&!e("fromProxy")?new ot(this):void 0);_defineProperty(this,"lookupCodeController",new Ae(this));_defineProperty(this,"historyCollector",e("collectHistory")?new et(this):void 0);_defineProperty(this,"requestAgentButtonController","never"!==e("showAgentRequestButton")?new Ee(this):void 0);_defineProperty(this,"terminateButtonController",e("showUpscopeLink")||e("showTerminateButton")?new Ie(this):void 0);_defineProperty(this,"screenWakeLock",e("screenWakeLock")&&e("beta")?new rt(this):void 0);r("Setting up Upscope connection manager"),this.checkQueryString(),this.lookForNamedCall(),this.startConnectionManager()}_createClass(lt,[{key:"startConnectionManager",value:function startConnectionManager(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;var _this=this;return _asyncToGenerator(function(){var _tmp,_tmp1,e1;return __generator(this,function(_state){switch(_state.label){case 0:return[4,_this.setRegion()];case 1:_state.sent();_tmp=t;if(!_tmp)return[3,4];_tmp1=e("autoconnect");if(_tmp1)return[3,3];return[4,_this.hasRecentlyBeenConnected()];case 2:_tmp1=_state.sent();_state.label=3;case 3:_tmp=_tmp1||_this.isPriorityConnection();_state.label=4;case 4:if(_tmp)_this.connectToSocket(_this.isPriorityConnection());else{e1=setInterval(_asyncToGenerator(function(){var o,n,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:if(_this.socketStatus||_this.doNotReconnect)return[2,void clearInterval(e1)];_tmp=t;if(!_tmp)return[3,2];return[4,_this.hasRecentlyBeenConnected()];case 1:_tmp=_state.sent()||_this.isPriorityConnection();_state.label=2;case 2:o=_tmp,n=window.Upscope.q.some(function(e){return at.includes(e[0])});(o||n)&&(_this.connectToSocket(!0),clearInterval(e1));return[2]}})}),1e3)}return[2]}})})()}},{key:"connectToSocket",value:function connectToSocket(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;var _this=this;return _asyncToGenerator(function(){var _tmp,e1,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,t1;return __generator(this,function(_state){switch(_state.label){case 0:if(!(!_this.doNotReconnect&&!_this.socketConnected()&&"connecting"!==_this.socketStatus))return[3,5];_this.socketStatus="connecting";if(!window.Upscope.q.some(function(e){return"reset"===e[0]}))return[3,2];r('A "reset" command is waiting in the Queue during connection. Resetting ids'),window.Upscope.q=window.Upscope.q.filter(function(e){return"reset"!==e[0]});return[4,_this.resetIdentities()];case 1:_tmp=_state.sent();return[3,4];case 2:return[4,_this.getIdsFromStorage()];case 3:_tmp=_state.sent();_state.label=4;case 4:if(_tmp,window.Upscope.q.some(function(e){return"updateConnection"===e[0]})){r('Some "updateConnection" command is waiting in the Queue during connection. Updating connection details before we connect.');e1=window.Upscope.q.filter(function(e){return"updateConnection"===e[0]}).map(function(e){return e[1]});window.Upscope.q=window.Upscope.q.filter(function(e){return"updateConnection"!==e[0]});_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=e1[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){t1=_step.value;_this.updateConnection(t1)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}if(t&&J.set("lastConnectedAt",new Date),!nt("all"))return[2,(_this.socketStatus=void 0,_this.reportUnsupportedBrowser())];r("Setting up websocket connection"),_this.socketShouldBeOpen=!0,_this.socketIdleDisconnected=!1,_this.ws=new WebSocket(e("dataEndpoint")+"?apiKey="+e("apiKey")+"&version="+e("version")+(_this.isPriorityConnection()?"&priority=1":"")),_this.ws.addEventListener("open",_asyncToGenerator(function(){var _,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:r("Websocket connection opened"),_this.waitBeforeReconnect=0,_this.socketStatus="connected";_=_this.emit;_tmp=["hello"];return[4,_this.encodeConnectionInfo()];case 1:_.apply(_this,_tmp.concat([_state.sent()])),_this.onServerPing();return[2]}})})),_this.ws.addEventListener("close",function(){r("Websocket connection closed"),_this.socketConnected&&(r("Will end session in 10 seconds after web socket connection closed"),_this.sessionActiveAfterDisconnect=!1,setTimeout(function(){if(_this.socketConnected()&&_this.sessionActiveAfterDisconnect)return r("Socket connected again, will not be ending session");_this.handleEndSession()},2e4)),_this.socketStatus=void 0,_this.socketShouldBeOpen&&!_this.socketIdleDisconnected&&_this.attemptReconnect()}),_this.ws.addEventListener("error",function(){r("Websocket connection error")}),_this.ws.addEventListener("message",_this.handleSocketMessage.bind(_this)),_this.startIdleDisconnectManager();_state.label=5;case 5:return[2]}})})()}},{key:"onHandshakeComplete",value:function onHandshakeComplete(){var _this_integration;this.socketStatus="ready",this.connectionHasJustBeenReset=!1,this.processQueue(),this.instrumentQueuePush(),this.startUrlChangesInterval(),this.reportPageFocus(),(_this_integration=this.integration)===null||_this_integration===void 0?void 0:_this_integration.live(this.getWatchLink()),this.fireEvent("connection")}},{key:"instrumentQueuePush",value:function instrumentQueuePush(){var _this=this;var _e;if(this.instrumentedQueuePush)return;this.instrumentedQueuePush=!0;var e=window.Upscope.q.push;window.Upscope.q.push=function(){for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key]}return(_e=e).call.apply(_e,[window.Upscope.q].concat(_toConsumableArray(t))),"ready"!==_this.socketStatus||_this.connectionHasJustBeenReset||_this.processQueue(),window.Upscope.q.length}}},{key:"socketConnected",value:function socketConnected(){return"connected"===this.socketStatus||"ready"===this.socketStatus}},{key:"emit",value:function emit(e,t){var _this=this;return _asyncToGenerator(function(){var _tmp,o;return __generator(this,function(_state){switch(_state.label){case 0:return[4,_this.waitForSocketWritable()];case 1:_state.sent(),"pong"!==e&&_this.touchLastActivityAt();_tmp="hello"!==e;if(!_tmp)return[3,3];return[4,_this.waitForConnectionReady()];case 2:_tmp=_state.sent();_state.label=3;case 3:_tmp;o=JSON.stringify({c:e,d:t});_this.ws.send(o);return[2]}})})()}},{key:"waitForSocketWritable",value:function waitForSocketWritable(){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){if(_this.socketConnected()||_this.connectToSocket(!1),!_this.ws||1!==_this.ws.readyState)return[2,g(function(){var _this_ws;return 1===((_this_ws=_this.ws)===null||_this_ws===void 0?void 0:_this_ws.readyState)})];return[2]})})()}},{key:"waitForConnectionReady",value:function waitForConnectionReady(){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){if(_this.socketConnected()||_this.connectToSocket(!1),"ready"!==_this.socketStatus)return[2,g(function(){return"ready"===_this.socketStatus})];return[2]})})()}},{key:"attemptReconnect",value:function attemptReconnect(){var _this=this;if(this.reconnectTimeout||this.doNotReconnect)return;this.waitBeforeReconnect+=1e3,this.socketStatus="reconnecting";var e=Math.floor(15*Math.random())-10,t=this.isPriorityConnection()?500:this.waitBeforeReconnect*(e>0?e:1);r("Waiting %d seconds before reconnecting",Math.ceil(t/1e3)),this.reconnectTimeout=setTimeout(function(){_this.connectToSocket(!1),delete _this.reconnectTimeout},t)}},{key:"startIdleDisconnectManager",value:function startIdleDisconnectManager(){var _this=this;if(!e("disconnectAfterSeconds")||e("disconnectAfterSeconds")<1)return;if(this.idleDisconnectManagerActive)return;this.idleDisconnectManagerActive=!0,this.touchLastActivityAt();var t=function(e){e.__upscopeIdleManagerActive||(r("Adding event listeners to check for page activeness"),e.document.addEventListener("mousemove",_this.touchLastActivityAt.bind(_this),!0),e.document.addEventListener("scroll",_this.touchLastActivityAt.bind(_this),!0),e.document.addEventListener("keydown",_this.touchLastActivityAt.bind(_this),!0),e.__upscopeIdleManagerActive=!0),$(e.document,function(e){return e.contentWindow?t(e.contentWindow):null})};var o=new Date;t(window),setInterval(function(){var e=(Date.now()-_this.lastActivityAt.getTime())/1e3<20?10:60;(Date.now()-o.getTime())/1e3<e||(t(window),o=new Date)},1e3),setInterval(function(){var _this_ws;if(!_this.socketShouldBeOpen)return;var t=(Date.now()-_this.lastActivityAt.getTime())/1e3<e("disconnectAfterSeconds");t&&!1===_this.doNotReconnect&&!_this.socketStatus?(_this.connectToSocket(!1),r("Reconnecting to server after activity")):t||!_this.socketConnected()||_this.sessionStatus||(_this.socketIdleDisconnected=!0,(_this_ws=_this.ws)===null||_this_ws===void 0?void 0:_this_ws.close(),_this.startConnectionManager(!1),r("Disconnecting from server due to inactivity"))},1e3)}},{key:"resetConnection",value:function resetConnection(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;var _this=this;return _asyncToGenerator(function(){var _this_ws;return __generator(this,function(_state){switch(_state.label){case 0:_this.fireEvent("connectionReset"),_this.connectionHasJustBeenReset=!0;return[4,_this.stopSession()];case 1:_state.sent();return[4,_this.resetIdentities()];case 2:_state.sent(),(_this_ws=_this.ws)===null||_this_ws===void 0?void 0:_this_ws.close(),e?_this.connectToSocket():(_this.socketShouldBeOpen=!1,_this.startConnectionManager(!1));return[2]}})})()}},{key:"setRegion",value:function setRegion(){return _asyncToGenerator(function(){var t,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:_tmp=e("region");if(_tmp)return[3,2];return[4,J.get("region")];case 1:_tmp=_state.sent();_state.label=2;case 2:t=_tmp||window.Upscope.__defaultRegion;t&&function(t){var o=e("regionWhitelist");return null===o||o.includes(t)}(t)&&(e("dataEndpoint","".concat(l("data--".concat(t),"ws"),"/session")),e("pageviewsEndpoint","".concat(l("data-support--".concat(t)),"/pageviews")),e("region",t),J.set("region",t));return[2]}})})()}},{key:"getIdsFromStorage",value:function getIdsFromStorage(){var _this=this;return _asyncToGenerator(function(){var e;return __generator(this,function(_state){switch(_state.label){case 0:r("Finding saved IDs"),_this.uniqueConnectionId=t(sessionStorage.getItem("__upscope:uniqueConnectionId")),_this.connectionActiveSince=sessionStorage.getItem("__upscope:connectionActiveSince")?new Date(sessionStorage.getItem("__upscope:connectionActiveSince")):void 0,_this.connectionActiveSince||(_this.connectionActiveSince=new Date,sessionStorage.setItem("__upscope:connectionActiveSince",String(_this.connectionActiveSince)));return[4,J.get("shortId")];case 1:_this.shortId=t.apply(void 0,[_state.sent()]);return[4,J.get("lookupCode")];case 2:if(!(_this.lookupCode=t.apply(void 0,[_state.sent()]),!_this.shortId&&_this.shortIdFromQueryString&&(_this.shortId=_this.shortIdFromQueryString,J.set("shortId",_this.shortId)),_this.lookupCode))return[3,4];return[4,J.get("lookupCodeSetAt")];case 3:e=_state.sent();(!e||Date.now()-new Date(e).getTime()>36e5)&&delete _this.lookupCode;_state.label=4;case 4:r("Found IDs: shortID (%s), uniqueConnectionId (%s), lookupCode (%s)",_this.shortId,_this.uniqueConnectionId,_this.lookupCode);return[2]}})})()}},{key:"encodeConnectionInfo",value:function encodeConnectionInfo(){var _this=this;return _asyncToGenerator(function(){var _this_integration,_this_integration1,_this_integration2,_this_integration_integrationIds,t,s,i,_tmp,e1,_this_integration_integrationIds_join;return __generator(this,function(_state){switch(_state.label){case 0:t=(_this_integration=_this.integration)===null||_this_integration===void 0?void 0:_this_integration.integrationUserIdentities,s=(_this_integration1=_this.integration)===null||_this_integration1===void 0?void 0:_this_integration1.integrationUserUniqueId;_state.label=1;case 1:_state.trys.push([1,4,,5]);_tmp=e("useFingerprinting");if(!_tmp)return[3,3];return[4,h(st(),1e3)];case 2:_tmp=i=_state.sent();_state.label=3;case 3:_tmp;return[3,5];case 4:e1=_state.sent();r("Error with fingerprinting browser %o",e1);return[3,5];case 5:return[2,{activeSince:String(_this.connectionActiveSince),agentPrompt:e("agentPrompt"),requireControlRequest:e("requireControlRequest"),allowAgentRedirect:e("allowAgentRedirect"),allowRemoteClick:e("allowRemoteClick"),allowRemoteConsole:e("allowRemoteConsole"),allowRemoteScroll:e("allowRemoteScroll"),allowRemoteType:e("allowRemoteType"),apiKey:e("apiKey"),audioSupported:nt("audio"),callName:e("callName"),currentUrl:n().href,fingerprint:i,hasFocus:"visible"===document.visibilityState,identities:void 0===e("identities")?t:e("identities"),integration:(_this_integration_integrationIds_join=(_this_integration2=_this.integration)===null||_this_integration2===void 0?void 0:(_this_integration_integrationIds=_this_integration2.integrationIds)===null||_this_integration_integrationIds===void 0?void 0:_this_integration_integrationIds.join(","))!==null&&_this_integration_integrationIds_join!==void 0?_this_integration_integrationIds_join:null,integrationIds:o(e("integrationIds")),jsConfiguration:e("jsConfiguration"),lookupCode:_this.lookupCode,proxied:!0===e("fromProxy"),requireAuthorizationForSession:e("requireAuthorizationForSession"),reset:_this.connectionHasJustBeenReset,shortId:_this.shortId,tags:o(e("tags")),timestamp:Date.now(),uniqueConnectionId:_this.uniqueConnectionId,uniqueId:void 0===e("uniqueId")?s:e("uniqueId"),version:e("version")}]}})})()}},{key:"handleSocketMessage",value:function handleSocketMessage(e){var _JSON_parse=JSON.parse(e.data),t=_JSON_parse.c,o=_JSON_parse.d;switch("ping"!==t&&r("Received instruction %s with data %O",t,o),t){case"ping":return this.onServerPing(),void this.emit("pong");case"youAre":var _this=this;return(function(){var _ref=_asyncToGenerator(function(e){var _e,t,o;return __generator(this,function(_state){_e=_slicedToArray(e,2),t=_e[0],o=_e[1];_this.shortId!==t&&J.set("shortId",t),_this.uniqueConnectionId!==o&&sessionStorage.setItem("__upscope:uniqueConnectionId",o),_this.uniqueConnectionId=o,_this.shortId=t,_this.onHandshakeComplete();return[2]})});return function(e){return _ref.apply(this,arguments)}})()(o);case"apiKeyError":case"dataError":return function(e){var _e=_slicedToArray(e,2),t=_e[0],o=_e[1];a(t,o)}(o);case"welcomeBack":this.onHandshakeComplete();break;case"doNotReconnect":this.doNotReconnect=!0;break;case"beginSession":return this.onServerBeginSession(o);case"continueSession":return this.onServerContinueSession();case"sessionStatusUpdate":return this.onServerSessionStatusUpdate(o);case"endSession":return this.handleEndSession();case"browserInstruction":return this.onServerBrowserInstruction(o);case"newObserver":return this.fireEvent("newObserver",[o]);case"observerGone":return this.fireEvent("observerGone",[o]),this.browserInstructionsReceiver.observerGone(o);case"callStart":return this.onCallStart(o);case"controlRequest":return this.onControlRequest(o);case"controlGranted":return this.onControlGranted();case"callEnd":return this.onServerCallEnd();case"callAccepted":return this.onServerCallAccepted();case"audioCallProblem":return this.onServerAudioCallProblem(o);case"agentsAvailable":return this.agentsAvailable=!0,this.fireEvent("agentsAvailable"),void r("Agents are available");case"requestStatus":return this.onServerRequestStatus(o);case"sessionRatingToken":this.sessionRatingInfo=o;break;case"proxyToken":this.proxyToken=o.token;break;case"closeRatingScreen":a("info","Closing rating screen");break;default:return a("error","Unrecognized connection message",t)}}},{key:"reportUnsupportedBrowser",value:function reportUnsupportedBrowser(){var _this=this;return _asyncToGenerator(function(){var e,_,_1,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:e=new XMLHttpRequest;e.open("POST","".concat(l("data"),"/unsupported-user/")),e.setRequestHeader("Content-Type","application/json;charset=UTF-8");_=e.send;_1=JSON.stringify;_tmp={};return[4,_this.encodeConnectionInfo()];case 1:_.apply(e,[_1.apply(JSON,[(_tmp.user=_state.sent(),_tmp)])]),e.addEventListener("load",function(){var _this_integration;if(e.status>299)return a("error","Problem reporting unsupported browser",e.status,e.response);var _JSON_parse=JSON.parse(e.response),t=_JSON_parse.shortId;_this.shortId=t,J.set("shortId",t),(_this_integration=_this.integration)===null||_this_integration===void 0?void 0:_this_integration.live(_this.getWatchLink())});return[2]}})})()}},{key:"sendPageviews",value:function sendPageviews(t){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){return[2,new Promise1(function(o,n){var s={user:{apiKey:e("apiKey"),shortId:_this.shortId},pageviews:t},i=new XMLHttpRequest;i.open("POST",e("pageviewsEndpoint")),i.setRequestHeader("Content-Type","application/json;charset=UTF-8"),i.send(JSON.stringify(s)),i.addEventListener("load",function(){i.status>299&&(r("Pageview reporting returned code %d (%o)",i.status,i.response),n(new Error("Problem reporting pageviews"))),200===i.status&&o()})})]})})()}},{key:"onServerPing",value:function onServerPing(){var _this=this;this.connected&&(this.brokenConnectionTimeout&&(clearInterval(this.brokenConnectionTimeout),delete this.brokenConnectionTimeout),this.brokenConnectionTimeout=setTimeout(function(){var _this_ws;r("Disconnecting because the server has not sent a ping for too long"),(_this_ws=_this.ws)===null||_this_ws===void 0?void 0:_this_ws.close()},6e4))}},{key:"isPriorityConnection",value:function isPriorityConnection(){return Boolean(sessionStorage.getItem("__upscope:everActive")||sessionStorage.getItem("__upscope:integrationOpened")||sessionStorage.getItem("__upscope:lookupCodeClick")||sessionStorage.getItem("__upscope:namedCall")||e("fromProxy"))}},{key:"hasRecentlyBeenConnected",value:function hasRecentlyBeenConnected(){return _asyncToGenerator(function(){var e;return __generator(this,function(_state){switch(_state.label){case 0:return[4,J.get("lastConnectedAt")];case 1:e=_state.sent();return[2,!!e&&Date.now()-new Date(e).getTime()<864e5]}})})()}},{key:"checkQueryString",value:function checkQueryString(){if(!location.search.includes("__upscope_"))return;var t=location.search.includes("__upscope_call_for=")&&location.search.split(/[?|&]__upscope_call_for=/).pop().split("&").shift()||void 0;t&&e("callName",t);var o=location.search.includes("__upscope_unique_id=")&&location.search.split(/[?|&]__upscope_unique_id=/).pop().split("&").shift()||void 0;o&&e("uniqueId",o);var n=location.search.includes("__upscope_short_id=")&&location.search.split(/[?|&]__upscope_short_id=/).pop().split("&").shift()||void 0;n&&(this.shortIdFromQueryString=n);var s=location.search.replace(/[&?]__upscope_[A-z_]+=[^&]+/g,"");s.startsWith("&")&&(s="?"+s.slice(1)),window.history&&window.history.replaceState(null,"",location.origin+location.pathname+s)}},{key:"lookForNamedCall",value:function lookForNamedCall(){var _this=this;return _asyncToGenerator(function(){var t;return __generator(this,function(_state){switch(_state.label){case 0:if(!e("callName"))return[2];return[4,J.get("waitingForCallAt")];case 1:t=_state.sent();t&&Date.now()-new Date(t).getTime()<864e5||(J.set("waitingForCallAt",new Date),_this.fireEvent("waitingForCall"),sessionStorage.setItem("__upscope:namedCall","true"));return[2]}})})()}},{key:"startUrlChangesInterval",value:function startUrlChangesInterval(){var _this=this;this.urlChangesInterval=this.urlChangesInterval||setInterval(function(){_this.currentUrl!==n().href&&(_this.currentUrl=n().href,r("Detected url changed to %s",_this.currentUrl),_this.emit("connectionUpdate",{currentUrl:_this.currentUrl}))},1e3)}},{key:"onServerBeginSession",value:function onServerBeginSession(t){var _this=this;return _asyncToGenerator(function(){var o,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:_this.sessionActiveAfterDisconnect=!0;o=!0;sessionStorage.setItem("__upscope:everActive","true"),r("Starting screen share");_tmp=e("requireAuthorizationForSession");if(!_tmp)return[3,2];r("Will request authorization from user for screen share"),_this.emit("sessionStatusUpdate","pendingRequest"),_this.sessionStatus="pendingRequest";return[4,new Promise1(function(o){e("onSessionRequest")(o,t.requestingAgent),_this.fireEvent("sessionRequest")})];case 1:_tmp=o=_state.sent();_state.label=2;case 2:_tmp,setTimeout(function(){if("active"===_this.sessionStatus)return _this.emit("sessionStatusUpdate","active");o?(r("User approved request or no approval was needed. Screen share begins now"),_this.emit("sessionStatusUpdate","active"),_this.sessionStatus="active",_this.browserWatcher.activate(),_this.fireEvent("sessionStart")):(r("User did not approve screen share. Terminating session now."),_this.emit("stopSession"))},50);return[2]}})})()}},{key:"onCallStart",value:function onCallStart(t){var _this=this;return _asyncToGenerator(function(){var o;return __generator(this,function(_state){switch(_state.label){case 0:r("Received phone call request"),_this.callToken=t,_this.fireEvent("callStart");return[4,new Promise1(function(t){"function"==typeof e("customCallController")?e("customCallController")(t):_this.phoneController.show(t)})];case 1:o=_state.sent();r("Phone call "+(o?"authorized":"refused")),o?_this.acceptCall():_this.endCall();return[2]}})})()}},{key:"onControlRequest",value:function onControlRequest(t){var _this=this;return _asyncToGenerator(function(){var o;return __generator(this,function(_state){switch(_state.label){case 0:r("Received remote control request");return[4,new Promise1(function(o){"function"==typeof e("customControlRequestController")?e("customControlRequestController")(o):E(e("controlRequestTitle"),v(e("controlRequestMessage"),{agentName:t})).then(o)})];case 1:o=_state.sent();r("Remote control "+(o?"authorized":"refused")),o&&_this.emit("grantControl");return[2]}})})()}},{key:"onControlGranted",value:function onControlGranted(){return _asyncToGenerator(function(){return __generator(this,function(_state){x();return[2]})})()}},{key:"acceptCall",value:function acceptCall(){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){_this.emit("acceptCall"),window.open("".concat(e("phoneEndpoint"),"?region=").concat(e("region"),"&token=").concat(_this.callToken),"upscope-phone","toolbar=no,top=0,left=0,width=600,height=400");return[2]})})()}},{key:"onServerAudioCallProblem",value:function onServerAudioCallProblem(t){switch(t){case"not_authorized":S(e("callAudioAuthorizationFailedTitle"),e("callAudioAuthorizationFailedMessage"));break;case"not_connected":S(e("callPopupFailedTitle"),e("callPopupFailedMessage"));break;case"no_input":S(e("callPopupNoInputTitle"),e("callPopupNoInputMessage"));break;case"no_output":S(e("callPopupNoOutputTitle"),e("callPopupNoOutputMessage"))}}},{key:"endCall",value:function endCall(){this.emit("endCall")}},{key:"onServerCallAccepted",value:function onServerCallAccepted(){this.phoneController.hide(),this.fireEvent("callAccepted")}},{key:"onServerRequestStatus",value:function onServerRequestStatus(e){r("Agent request is now %s",e),this.fireEvent("agentRequestUpdate",[e])}},{key:"requestAgent",value:function requestAgent(){r("Requesting agent"),this.emit("requestAgent")}},{key:"cancelRequestAgent",value:function cancelRequestAgent(){r("Canceling agent request"),this.emit("cancelRequestAgent")}},{key:"onServerCallEnd",value:function onServerCallEnd(){this.phoneController.hide(),this.fireEvent("callEnd")}},{key:"getLookupCode",value:function getLookupCode(){var _this=this;return _asyncToGenerator(function(){var e,t;return __generator(this,function(_state){switch(_state.label){case 0:return[4,_this.connectToSocket(!0)];case 1:if(_state.sent(),!_this.lookupCode){e="";for(t=0;t<4;t++)e+=String(Math.floor(10*Math.random()));_this.lookupCode=e,_this.socketConnected()&&_this.emit("connectionUpdate",{lookupCode:_this.lookupCode})}return[2,(J.set("lookupCodeSetAt",new Date),J.set("lookupCode",_this.lookupCode),_this.lookupCode)]}})})()}},{key:"onServerContinueSession",value:function onServerContinueSession(){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){if(sessionStorage.setItem("__upscope:everActive","true"),_this.sessionActiveAfterDisconnect=!0,"active"===_this.sessionStatus)return[2,_this.sendSnapshot()];_this.sessionStatus="active",_this.browserWatcher.activate(),_this.fireEvent("sessionContinue");return[2]})})()}},{key:"onServerSessionStatusUpdate",value:function onServerSessionStatusUpdate(e){"active"!==this.sessionStatus&&(this.sessionStatus=e,"active"===e&&(x(),this.sessionStatus="active",this.browserWatcher.activate(),this.fireEvent("sessionStart")))}},{key:"handleEndSession",value:function handleEndSession(){this.sessionStatus&&x(),"active"===this.sessionStatus&&(r("Ending session"),this.browserWatcher.deactivate(),this.browserInstructionsReceiver.hideAll(),this.fireEvent("sessionEnd")),this.phoneController.hide(),delete this.sessionStatus,J.del("waitingForCallAt")}},{key:"stopSession",value:function stopSession(){var _this=this;return _asyncToGenerator(function(){return __generator(this,function(_state){switch(_state.label){case 0:r("Stopping session");return[4,_this.emit("stopSession")];case 1:_state.sent(),_this.handleEndSession();return[2]}})})()}},{key:"onServerBrowserInstruction",value:function onServerBrowserInstruction(e){"active"===this.sessionStatus&&this.browserInstructionsReceiver.receiveInstruction(e)}},{key:"sendSnapshot",value:function sendSnapshot(){var _this=this;return _asyncToGenerator(function(){var e;return __generator(this,function(_state){switch(_state.label){case 0:return[4,_this.browserWatcher.getSnapshot()];case 1:e=_state.sent();_this.sendBrowserEvent("root",{snapShot:e});return[2]}})})()}},{key:"performDataBounce",value:function performDataBounce(e){this.sendBrowserEvent("root",{dataBounce:e})}},{key:"sendBrowserEvent",value:function sendBrowserEvent(e,t){"console"in t&&this.eventId<100&&r("Sending browser event for iframe %s: %s (%o)",e,Object.keys(t)[0],t);var o=_objectSpreadProps(_objectSpread({},t),{ts:Date.now()});this.emit("browserEvent",["".concat(this.pageLoadId,":").concat(this.eventId++),e,o])}},{key:"updateConnection",value:function updateConnection(t){t.identities&&["list of identities here","undefined","null"].includes("string"==typeof t.identities?t.identities:t.identities.join(" "))&&delete t.identities,t.uniqueId&&["USER UNIQUE ID","undefined","null"].includes(t.uniqueId)&&delete t.uniqueId,t.tags&&"#list #of #tags #here"===("string"==typeof t.tags?t.tags:t.tags.join(" "))&&delete t.tags;var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=ct[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;void 0!==t[o]&&e(o,t[o])}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}this.socketConnected()&&(nt("all")?this.emit("connectionUpdate",t):this.reportUnsupportedBrowser(),this.lookForNamedCall())}},{key:"getWatchLink",value:function getWatchLink(){return"https://upscope.io/w/"+this.shortId}},{key:"reportPageFocus",value:function reportPageFocus(){var _this=this;this.idlenessReporterActive||(window.addEventListener("focus",function(){"ready"===_this.socketStatus&&(r("Detected focus on page"),_this.emit("focus"))}),this.idlenessReporterActive=!0)}},{key:"touchLastActivityAt",value:function touchLastActivityAt(){this.lastActivityAt=new Date}},{key:"fireEvent",value:function fireEvent(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];var _this=this;return _asyncToGenerator(function(){var _iteratorNormalCompletion,_didIteratorError,_iteratorError,_loop,_iterator,_step,n;return __generator(this,function(_state){_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;if(void 0!==_this.listeners[t])try{_loop=function(){var e=_step.value;setTimeout(function(){return e.apply(void 0,_toConsumableArray(o))},0)};for(_iterator=_this.listeners[t][Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true)_loop()}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}if("sessionRequest"===t)return[2];n="on"+t.charAt(0).toUpperCase()+t.slice(1);"function"==typeof e(n)&&e(n).apply(e(),o);return[2]})})()}},{key:"listen",value:function listen(e,t){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;this.listeners[o]=this.listeners[o]||[],this.listeners[o].push(t)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return this}},{key:"unlisten",value:function unlisten(e,t){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(var _iterator=e[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var o=_step.value;void 0!==this.listeners[o]&&(this.listeners[o]=this.listeners[o].filter(function(e){return e!==t}))}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}return this}},{key:"resetIdentities",value:function resetIdentities(){var _this=this;return _asyncToGenerator(function(){var e1;return __generator(this,function(_state){J.clear(),delete _this.shortId,delete _this.lookupCode,e("identities",void 0),e("uniqueId",void 0),e("tags",void 0),e("integrationIds",void 0),sessionStorage.removeItem("__upscope:uniqueConnectionId");for(var e1 in sessionStorage)sessionStorage.hasOwnProperty(e1)&&e1.startsWith("__upscope:")&&sessionStorage.removeItem(e1);return[2]})})()}},{key:"processQueue",value:function processQueue(){var _iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{var _this=this,_loop=function(){var e=_step.value;e=_toConsumableArray(e),r("Received js command %s with args %o",e[0],e.slice(1));try{switch(e[0]){case"updateConnection":if(void 0===e[1])throw new Error("An argument is required");_this.updateConnection(e[1]);break;case"reset":_this.resetConnection(e[1]);break;case"stopSession":_this.stopSession();break;case"requestAgent":_this.requestAgent();break;case"cancelRequestAgent":_this.cancelRequestAgent();break;case"newPageview":if(!_this.historyCollector)throw new Error("History collection not enabled");_this.historyCollector.pageview();break;case"logEvent":if(!_this.historyCollector)throw new Error("History collection not enabled");_this.historyCollector.log(e[1],e[2]);break;case"saveHistory":if(!_this.historyCollector)throw new Error("History collection not enabled");_this.historyCollector.save();break;case"submitRating":_this.sessionRatingInfo&&_this.emit("submitRating",_objectSpread({token:_this.sessionRatingInfo.token},e[1]));break;case"getUserId":case"getShortId":if(void 0===e[1])throw new Error("A callback is required");e[1](_this.shortId);break;case"getWatchLink":if(void 0===e[1])throw new Error("A callback is required");e[1](_this.getWatchLink());break;case"getLookupCode":if(void 0===e[1])throw new Error("A callback is required");_this.getLookupCode().then(function(t){return e[1](t)});break;case"redirect":if("string"!=typeof e[1])throw new Error("A URL is required");if(!_this.linkProxyRewrite)throw new Error("Proxy not enabled");_this.linkProxyRewrite.redirect(e[1]);break;case"on":if(void 0===e[1]||"function"==typeof e[1])throw new Error("An event type is required");if("function"!=typeof e[e.length-1])throw new Error("An function is required");_this.listen(e.slice(1,-1),e[e.length-1]);break;case"init":a("warn","It looks like you're trying to load Upscope more than once!");break;case"connect":break;default:a("error","Command "+String(e[0])+" is not recognized")}}catch(t){a("error","Error processing command "+e[0],t,"(learn more here: https://docs.upscope.com/javascript-sdk/sdk-functions/#:~:text="+e[0]+")")}};for(var _iterator=window.Upscope.q[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true)_loop()}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}window.Upscope.q.length=0}}]);return lt}();var ut=function(){function ut(){_classCallCheck(this,ut);_defineProperty(this,"parentFrameHandler",void 0);_defineProperty(this,"childFrameHandler",void 0);this.listenToParent(),this.listenToChildren()}_createClass(ut,[{key:"isChild",value:function isChild(){var _this=this;return _asyncToGenerator(function(){var t;return __generator(this,function(_state){switch(_state.label){case 0:if(_this.parentFrameHandler)return[2,!0];if(!window.parent||window.parent===window)return[2,r("Parent is self, not a child")];r("Will contact parent window");t="extension"===window.__upscopeContext__&&window.top!==window;window.parent.postMessage({__upscopeApiKey:e("apiKey"),c:"register"},"*");return[4,Promise1.race([m(500),g(function(){return Boolean(_this.parentFrameHandler)})])];case 1:return[2,(_state.sent(),void 0!==_this.parentFrameHandler||t)]}})})()}},{key:"listenToParent",value:function listenToParent(){var _this=this;window.addEventListener("message",function(t){var _this_parentFrameHandler;t.source===window.parent&&t.data.__upscopeApiKey===e("apiKey")&&((_this_parentFrameHandler=_this.parentFrameHandler)!==null&&_this_parentFrameHandler!==void 0?_this_parentFrameHandler:_this.parentFrameHandler=new dt,_this.parentFrameHandler.handle(t.data))})}},{key:"listenToChildren",value:function listenToChildren(){window.addEventListener("message",function(t){var o=_toConsumableArray(document.querySelectorAll("iframe,frame")).find(function(e){return e.contentWindow===t.source});o&&t.data.__upscopeApiKey===e("apiKey")&&(o.__upscopeChildFrameHandler=o.__upscopeChildFrameHandler||new pt(o),o.__upscopeChildFrameHandler.handle(t.data))})}}]);return ut}();var dt=function(){function dt(){_classCallCheck(this,dt);_defineProperty(this,"consoleHandler",null);_defineProperty(this,"watcher",new ye(this))}_createClass(dt,[{key:"sendBrowserEvent",value:function sendBrowserEvent(t,o){window.parent.postMessage({__upscopeApiKey:e("apiKey"),c:"event",iframe:t,event:o},"*")}},{key:"handle",value:function handle(e){var t=e.c;switch(t){case"registered":return r("Parent frame recognized child frame");case"activate":if(this.watcher.active)return;return r("Parent frame asked to activate, rootId is %s",e.rootId),this.activate(e.rootId);case"deactivate":return r("Parent frame asked to deactivate"),this.deactivate();case"getSnapshot":return r("Parent frame asked for snapshot"),this.getSnapshot(e.rootId)}}},{key:"activate",value:function activate(e){this.watcher.activate(e)}},{key:"deactivate",value:function deactivate(){this.watcher.deactivate()}},{key:"getSnapshot",value:function getSnapshot(t){var _this=this;return _asyncToGenerator(function(){var o;return __generator(this,function(_state){switch(_state.label){case 0:_this.watcher.ensureHasIds(void 0,document,t);return[4,_this.watcher.getSnapshot()];case 1:o=_state.sent();window.parent.postMessage({__upscopeApiKey:e("apiKey"),c:"snapshot",snapshot:o},"*");return[2]}})})()}}]);return dt}();var pt=function(){function pt(e){_classCallCheck(this,pt);_defineProperty(this,"iframe",void 0);_defineProperty(this,"eventListener",void 0);_defineProperty(this,"snapshotListener",void 0);this.iframe=e}_createClass(pt,[{key:"handle",value:function handle(t){r("Received message %o from iframe %o",t,this.iframe);var o=t.c;switch(o){case"register":var _this_iframe_contentWindow;return r("Child iframe %o asked to register",this.iframe),(_this_iframe_contentWindow=this.iframe.contentWindow)===null||_this_iframe_contentWindow===void 0?void 0:_this_iframe_contentWindow.postMessage({__upscopeApiKey:e("apiKey"),c:"registered"},"*");case"event":return r("Child iframe %o sent event %o",this.iframe,t.event),void(this.eventListener&&this.eventListener(t.iframe,t.event));case"snapshot":r("Child iframe %o sent snapshot %o",this.iframe,t.snapshot),this.snapshotListener&&this.snapshotListener(t.snapshot)}}},{key:"activate",value:function activate(t,o){var _this_iframe_contentWindow;this.eventListener=t,(_this_iframe_contentWindow=this.iframe.contentWindow)===null||_this_iframe_contentWindow===void 0?void 0:_this_iframe_contentWindow.postMessage({__upscopeApiKey:e("apiKey"),c:"activate",rootId:o},"*")}},{key:"deactivate",value:function deactivate(){var _this_iframe_contentWindow;delete this.eventListener,(_this_iframe_contentWindow=this.iframe.contentWindow)===null||_this_iframe_contentWindow===void 0?void 0:_this_iframe_contentWindow.postMessage({__upscopeApiKey:e("apiKey"),c:"deactivate"},"*")}},{key:"getSnapshot",value:function getSnapshot(t){var _this=this;return Promise1.race([new Promise1(function(o){var _this_iframe_contentWindow;(_this_iframe_contentWindow=_this.iframe.contentWindow)===null||_this_iframe_contentWindow===void 0?void 0:_this_iframe_contentWindow.postMessage({__upscopeApiKey:e("apiKey"),c:"getSnapshot",rootId:t},"*"),_this.snapshotListener=function(e){o(e),delete _this.snapshotListener}}),m(5e3)])}}]);return pt}();var ht="2.3.0";!function(e,t){if(void 0===t)return console.error("The Upscope javascript snippet was not installed correctly.");if(void 0!==e.Upscope._config)return console.warn("The Upscope javascript code was loaded twice.");if("extension"!==e.__upscopeContext__&&"string"==typeof localStorage.getItem("upscopeTestingKey")){var _localStorage_getItem_split=_slicedToArray(localStorage.getItem("upscopeTestingKey").split(":"),2),_$t=_localStorage_getItem_split[0],o=_localStorage_getItem_split[1];if(o!==e.Upscope.__defaultConfiguration.apiKey){delete e.Upscope.__defaultConfiguration,delete e.Upscope.__defaultRegion;var _$n=document.createElement("script");_$n.type="text/javascript",_$n.async=!0,"development"===_$t?_$n.src="http://data.upscope.local/code/"+o+".js":"staging"===_$t&&(_$n.src="https://code.upscope.xyz/"+o+".js");var s=document.querySelectorAll("script")[0];return s.parentNode.insertBefore(_$n,s),void console.warn("The Upscope code is now in testing replacement mode")}}if(void 0!==e.Prototype&&e.Array&&e.Array.prototype&&void 0!==e.Array.prototype.toJSON)return console.error("This page uses a version of Prototype.js that will break JSON (and Upscope). See here: https://docs.upscope.com/javascript-sdk/installation/#prototypejs");var o1=!1;try{e.parent!==e&&void 0!==e.parent.Upscope&&(o1=!0)}catch(e1){r("No access to parent window.")}if(o1)return void("extension"!==e.__upscopeContext__&&console.warn("Upscope is already loaded in the parent window, terminating."));function n(){return _n.apply(this,arguments)}function _n(){_n=_asyncToGenerator(function(){var o,_o,_$n,s,i,_$t,o1,_tmp;return __generator(this,function(_state){switch(_state.label){case 0:o=t.q.shift();_o=_slicedToArray(o,2),_$n=_o[0],s=_o[1];if(s=s||{},"init"!==_$n)return[2,console.error('The first command must be "init"')];i=_objectSpread({},A);if(e.Upscope.__defaultConfiguration){Object.assign(i,e.Upscope.__defaultConfiguration);_$t=Object.keys(e.Upscope.__defaultConfiguration),o1=Object.keys(s);_$t.some(function(e){return o1.includes(e)})&&(i.jsConfiguration=!0)}else i.jsConfiguration=!0;Object.assign(i,s),r("PAGELOAD - Initiating Upscope version %s",ht),location.href&&r("Current page is: %s",location.href),document.referrer&&r("Previous page was: %s",document.referrer);if(!i.apiKey)return[3,3];null!==i.uniqueId&&void 0!==i.uniqueId&&["USER UNIQUE ID","undefined","null"].includes(i.uniqueId)&&delete i.uniqueId,null!==i.identities&&void 0!==i.identities&&["list of identities here","undefined","null"].includes(Array.isArray(i.identities)?i.identities.join(" "):i.identities)&&delete i.identities,null!==i.tags&&void 0!==i.tags&&"#list #of #tags #here"===(Array.isArray(i.tags)?i.tags.join(" "):i.tags)&&delete i.tags,null!==i.integrationIds&&void 0!==i.integrationIds&&"integration_name:resource_id"===(Array.isArray(i.integrationIds)?i.integrationIds.join(" "):i.integrationIds)&&delete i.integrationIds,i.version=ht,e.Upscope._config=i;return[4,g(function(){return Boolean(document.body)})];case 1:_state.sent();return[4,(new ut).isChild()];case 2:_tmp=_state.sent()?a("info","attached to parent iframe"):void new lt;return[3,4];case 3:_tmp=console.error("API key required");_state.label=4;case 4:return[2,_tmp]}})});return _n.apply(this,arguments)}e.Upscope._version=ht;var s1=t.q.push;t.q.length>0?n():t.q.push=function(){for(var _len=arguments.length,_$e=new Array(_len),_key=0;_key<_len;_key++){_$e[_key]=arguments[_key]}return t.q.push=s1,s1.apply(t.q,_$e),n(),t.q.length},setTimeout(function(){void 0===e.Upscope._config&&"extension"!==e.__upscopeContext__&&console.warn('Please remember to call Upscope("init"); for Upscope to work!')},1e4)}(window,window.Upscope)}(); //# sourceMappingURL=upscope.js.map })();