1 line
116 KiB
JavaScript
1 line
116 KiB
JavaScript
window["%hammerhead%"].utils.removeInjectedScript(),function Cc(Ic){var Sc=Ic.document;!function(c,e,_,E,n){var l="default"in c?c.default:c;e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var u="default"in n?n.default:n,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,s,a,l){return new(a=a||e)(function(n,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(r,i)}o((l=l.apply(t,s||[])).next())})}function C(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},l={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function t(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;l&&e[l=0]&&(a=0),a;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=r.call(n,a)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var i,o,a=Math.floor(399);(o=i=i||{}).ready="ready",o.readyForBrowserManipulation="ready-for-browser-manipulation",o.waitForFileDownload="wait-for-file-download";var d=i,h={dispatchEvent:"dispatch-event",click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",scroll:"scroll",scrollBy:"scroll-by",scrollIntoView:"scroll-into-view",typeText:"type-text",selectText:"select-text",selectTextAreaContent:"select-text-area-content",selectEditableContent:"select-editable-content",pressKey:"press-key",wait:"wait",navigateTo:"navigate-to",setFilesToUpload:"set-files-to-upload",clearUpload:"clear-upload",executeClientFunction:"execute-client-function",executeSelector:"execute-selector",takeScreenshot:"take-screenshot",takeElementScreenshot:"take-element-screenshot",takeScreenshotOnFail:"take-screenshot-on-fail",prepareBrowserManipulation:"prepare-browser-manipulation",showAssertionRetriesStatus:"show-assertion-retries-status",hideAssertionRetriesStatus:"hide-assertion-retries-status",setBreakpoint:"set-breakpoint",resizeWindow:"resize-window",resizeWindowToFitDevice:"resize-window-to-fit-device",maximizeWindow:"maximize-window",switchToIframe:"switch-to-iframe",switchToMainWindow:"switch-to-main-window",openWindow:"open-window",closeWindow:"close-window",getCurrentWindow:"get-current-window",getCurrentWindows:"get-current-windows",switchToWindow:"switch-to-window",switchToWindowByPredicate:"switch-to-window-by-predicate",switchToParentWindow:"switch-to-parent-window",switchToPreviousWindow:"switch-to-previous-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",getActiveElement:"get-active-element",setTestSpeed:"set-test-speed",setPageLoadTimeout:"set-page-load-timeout",debug:"debug",disableDebug:"disable-debug",assertion:"assertion",useRole:"useRole",testDone:"test-done",backupStorages:"backup-storages",executeExpression:"execute-expression",executeAsyncExpression:"execute-async-expression",unlockPage:"unlock-page",closeChildWindowOnFileDownloading:"close-child-window-on-file-downloading",recorder:"recorder",prepareClientEnvironmentInDebugMode:"prepare-client-environment-in-debug-mode",getCookies:"get-cookies",setCookies:"set-cookies",deleteCookies:"delete-cookies",getProxyUrl:"get-proxy-url",request:"request",skipJsErrors:"skip-js-errors",addRequestHooks:"add-request-hooks",removeRequestHooks:"remove-request-hooks",runCustomAction:"run-custom-action"};function p(t){return!(f(r=t)||r.type===h.wait||r.type===h.assertion||r.type===h.executeExpression||g(t)||(n=t).type===h.testDone||n.type===h.showAssertionRetriesStatus||n.type===h.hideAssertionRetriesStatus||n.type===h.setBreakpoint||n.type===h.takeScreenshotOnFail||n.type===h.recorder||n.type===h.getProxyUrl)||m(t)&&!((e=t).type===h.switchToIframe||e.type===h.switchToMainWindow);var e,n,r}function f(t){return t.type===h.executeClientFunction||t.type===h.executeSelector}function m(t){return t.type===h.resizeWindow||t.type===h.resizeWindowToFitDevice||t.type===h.maximizeWindow}function g(t){return(e=t).type===h.takeScreenshot||e.type===h.takeElementScreenshot||e.type===h.takeScreenshotOnFail||m(t);var e}function v(t,e){this.code=t,this.isTestCafeError=!0,this.callsite=e||null}var w,y="step",I="E1",S="E4",b="E5",T="E9",W="E10",A="E11",x="E12",R="E24",N="E26",P="E27",D="E28",M="E29",F="E30",k="E31",O="E32",L="E33",U="E34",H="E35",B="E36",G="E37",V="E39",q="E40",z="E41",j="E42",X="E43",Y="E44",J="E45",K="E46",$="E49",Q="E50",Z="E51",tt="E52",et="E57",nt="E64",rt="E65",it="E68",ot="E69",st="E70",at="E71",lt="E72",ut="E73",ct="E74",dt="E76",ht="E77",pt="E78",ft="E82",mt="E83",gt="E90",vt="E91",wt="E92",yt="E93",_t="E94",Et="E95",Ct="E97",It="E99",St="E100",bt="E101",Tt=(t(Wt,w=v),Wt);function Wt(t,e,n){var r=w.call(this,t)||this;return r.optionName=e,r.actualValue=n,r}var At,xt=(t(Rt,At=v),Rt);function Rt(t,e){var n=At.call(this,$,e)||this;return n.instantiationCallsiteName=t,n}var Nt,Pt=(t(Dt,Nt=v),Dt);function Dt(t,e){var n=Nt.call(this,Q,e)||this;return n.instantiationCallsiteName=t,n}var Mt,Ft=(t(kt,Mt=v),kt);function kt(t,e,n){var r=void 0===e?{}:e,i=r.apiFnChain,o=r.apiFnIndex,s=r.reason,a=Mt.call(this,t,n)||this;return a.apiFnChain=i,a.apiFnIndex=o,a.reason=s,a}var Ot,Lt=(t(Ut,Ot=v),Ut);function Ut(t){return Ot.call(this,Z,t)||this}var Ht,Bt=(t(Gt,Ht=Ft),Gt);function Gt(t,e){return Ht.call(this,tt,e,t)||this}var Vt,qt=(t(zt,Vt=v),zt);function zt(t,e){var n=Vt.call(this,I)||this;return n.errStack=t,n.pageDestUrl=e,n}var jt,Xt=(t(Yt,jt=v),Yt);function Yt(t,e,n){var r=jt.call(this,S,n)||this;return r.errMsg=String(e),r.instantiationCallsiteName=t,r}var Jt,Kt=(t($t,Jt=v),$t);function $t(t,e,n,r){var i=Jt.call(this,b,r)||this;return i.errMsg=String(e),i.property=n,i.instantiationCallsiteName=t,i}var Qt,Zt=(t(te,Qt=v),te);function te(t){var e=Qt.call(this,nt)||this;return e.errMsg=String(t),e}var ee,ne=(t(re,ee=v),re);function re(t,e){var n=ee.call(this,rt)||this;return n.errMsg=String(t),n.moduleName=e,n}var ie,oe=(t(se,ie=Tt),se);function se(t,e){return ie.call(this,T,t,e)||this}var ae,le=(t(ue,ae=Tt),ue);function ue(t,e){return ae.call(this,W,t,e)||this}var ce,de=(t(he,ce=Tt),he);function he(t,e){return ce.call(this,A,t,e)||this}var pe,fe=(t(me,pe=Tt),me);function me(t,e){return pe.call(this,x,t,e)||this}var ge,ve=(t(we,ge=Tt),we);function we(t,e){return ge.call(this,gt,t,e)||this}var ye,_e=(t(Ee,ye=Tt),Ee);function Ee(t,e){return ye.call(this,Ct,t,e)||this}var Ce,Ie=(t(Se,Ce=Tt),Se);function Se(t,e){return Ce.call(this,vt,t,e)||this}var be,Te=(t(We,be=Tt),We);function We(t,e){return be.call(this,wt,t,e)||this}var Ae,xe=(t(Re,Ae=Tt),Re);function Re(t,e){return Ae.call(this,yt,t,e)||this}var Ne,Pe=(t(De,Ne=Tt),De);function De(t,e){return Ne.call(this,_t,t,e)||this}var Me,Fe=(t(ke,Me=Tt),ke);function ke(t,e){return Me.call(this,Et,t,e)||this}var Oe,Le=(t(Ue,Oe=Tt),Ue);function Ue(t,e){return Oe.call(this,It,t,e)||this}var He,Be=(t(Ge,He=v),Ge);function Ge(t,e,n){var r=He.call(this,St)||this;return r.objectName=t,r.propertyName=e,r.availableProperties=n,r}var Ve,qe=(t(ze,Ve=Ft),ze);function ze(t,e){return Ve.call(this,R,e,t)||this}var je,Xe=(t(Ye,je=Ft),Ye);function Ye(t,e){return je.call(this,N,e,t)||this}var Je,Ke=(t($e,Je=v),$e);function $e(t){var e=Je.call(this,P)||this;return e.nodeDescription=t,e}var Qe,Ze=(t(tn,Qe=Ft),tn);function tn(t,e){var n=Qe.call(this,D,e)||this;return n.argumentName=t,n}var en,nn=(t(rn,en=v),rn);function rn(t){return en.call(this,bt,t)||this}var on,sn=(t(an,on=Ft),an);function an(t,e){var n=on.call(this,M,e)||this;return n.argumentName=t,n}var ln,un=(t(cn,ln=v),cn);function cn(t,e){var n=ln.call(this,F)||this;return n.argumentName=t,n.nodeDescription=e,n}var dn,hn=(t(pn,dn=v),pn);function pn(){return dn.call(this,k)||this}var fn,mn=(t(gn,fn=v),gn);function gn(){return fn.call(this,O)||this}var vn,wn=(t(yn,vn=v),yn);function yn(t){var e=vn.call(this,L)||this;return e.argumentName=t,e}var _n,En=(t(Cn,_n=v),Cn);function Cn(){return _n.call(this,H)||this}var In,Sn=(t(bn,In=v),bn);function bn(t){var e=In.call(this,B)||this;return e.argumentName=t,e}var Tn,Wn=(t(An,Tn=v),An);function An(t,e){var n=Tn.call(this,G)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var xn,Rn=(t(Nn,xn=v),Nn);function Nn(){return xn.call(this,U)||this}var Pn,Dn=(t(Mn,Pn=v),Mn);function Mn(t,e){var n=Pn.call(this,z)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}var Fn,kn=(t(On,Fn=v),On);function On(t,e){var n=Fn.call(this,et)||this;return t<=0?e<=0?(n.verb="are",n.dimensions="width and height"):(n.verb="is",n.dimensions="width"):(n.verb="is",n.dimensions="height"),n}var Ln,Un=(t(Hn,Ln=v),Hn);function Hn(t){return Ln.call(this,q,t)||this}var Bn,Gn=(t(Vn,Bn=v),Vn);function Vn(){return Bn.call(this,V)||this}var qn,zn=(t(jn,qn=v),jn);function jn(){return qn.call(this,j)||this}var Xn,Yn=(t(Jn,Xn=v),Jn);function Jn(){return Xn.call(this,ot)||this}var Kn,$n=(t(Qn,Kn=v),Qn);function Qn(){return Kn.call(this,it)||this}var Zn,tr=(t(er,Zn=v),er);function er(){return Zn.call(this,st)||this}var nr,rr=(t(ir,nr=v),ir);function ir(){return nr.call(this,at)||this}var or,sr=(t(ar,or=v),ar);function ar(){return or.call(this,ut)||this}var lr,ur=(t(cr,lr=v),cr);function cr(){return lr.call(this,ft)||this}var dr,hr=(t(pr,dr=v),pr);function pr(t){var e=dr.call(this,pt)||this;return e.errMsg=t,e}var fr,mr=(t(gr,fr=v),gr);function gr(){return fr.call(this,ct)||this}var vr,wr=(t(yr,vr=v),yr);function yr(){return vr.call(this,dt)||this}var _r,Er=(t(Cr,_r=v),Cr);function Cr(){return _r.call(this,ht)||this}var Ir,Sr=(t(br,Ir=v),br);function br(){return Ir.call(this,lt)||this}var Tr,Wr=(t(Ar,Tr=v),Ar);function Ar(){return Tr.call(this,mt)||this}var xr,Rr=(t(Nr,xr=v),Nr);function Nr(){return xr.call(this,X)||this}var Pr,Dr=(t(Mr,Pr=v),Mr);function Mr(){return Pr.call(this,Y)||this}var Fr,kr=(t(Or,Fr=v),Or);function Or(t,e){var n=Fr.call(this,J)||this;return n.dialogType=t,n.pageUrl=e,n}var Lr,Ur=(t(Hr,Lr=v),Hr);function Hr(t,e,n){var r=Lr.call(this,K)||this;return r.dialogType=t,r.errMsg=e,r.pageUrl=n,r}var Br=Object.freeze({__proto__:null,TestRunErrorBase:v,ClientFunctionExecutionInterruptionError:xt,DomNodeClientFunctionResultError:Pt,SelectorErrorBase:Ft,InvalidSelectorResultError:Lt,CannotObtainInfoForElementSpecifiedBySelectorError:Bt,UncaughtErrorOnPage:qt,UncaughtErrorInClientFunctionCode:Xt,UncaughtErrorInCustomDOMPropertyCode:Kt,UncaughtErrorInCustomClientScriptCode:Zt,UncaughtErrorInCustomClientScriptLoadedFromModule:ne,ActionIntegerOptionError:oe,ActionPositiveIntegerOptionError:le,ActionBooleanOptionError:de,ActionSpeedOptionError:fe,ActionStringOptionError:ve,ActionStringOrRegexOptionError:_e,ActionDateOptionError:Ie,ActionNumberOptionError:Te,ActionUrlOptionError:xe,ActionUrlSearchParamsOptionError:Pe,ActionObjectOptionError:Fe,ActionFunctionOptionError:Le,ActionInvalidObjectPropertyError:Be,ActionElementNotFoundError:qe,ActionElementIsInvisibleError:Xe,ActionSelectorMatchesWrongNodeTypeError:Ke,ActionAdditionalElementNotFoundError:Ze,ActionElementIsNotTargetError:nn,ActionAdditionalElementIsInvisibleError:sn,ActionAdditionalSelectorMatchesWrongNodeTypeError:un,ActionElementNonEditableError:hn,ActionElementNotTextAreaError:mn,ActionElementNonContentEditableError:wn,ActionRootContainerNotFoundError:En,ActionIncorrectKeysError:Sn,ActionCannotFindFileToUploadError:Wn,ActionElementIsNotFileInputError:Rn,ActionInvalidScrollTargetError:Dn,InvalidElementScreenshotDimensionsError:kn,ActionElementNotIframeError:Un,ActionIframeIsNotLoadedError:Gn,CurrentIframeIsNotLoadedError:zn,ChildWindowNotFoundError:Yn,ChildWindowIsNotLoadedError:$n,CannotSwitchToWindowError:tr,CloseChildWindowError:rr,CannotCloseWindowWithChildrenError:sr,CannotCloseWindowWithoutParentError:ur,SwitchToWindowPredicateError:hr,WindowNotFoundError:mr,ParentWindowNotFoundError:wr,PreviousWindowNotFoundError:Er,ChildWindowClosedBeforeSwitchingError:Sr,CannotRestoreChildWindowError:Wr,CurrentIframeNotFoundError:Rr,CurrentIframeIsInvisibleError:Dr,NativeDialogNotHandledError:kr,UncaughtErrorInNativeDialogHandler:Ur}),Gr="_nativeMethods",Vr=(qr.prototype._ensureNativeMethods=function(t){return t||{objectKeys:Object.keys,arrayForEach:Array.prototype.forEach,arrayConcat:Array.prototype.concat,arraySlice:Array.prototype.slice,objectDefineProperty:Object.defineProperty}},qr.prototype._getWindowIds=function(t){return this[Gr].objectKeys(t)},qr.prototype._copyArray=function(t){return this[Gr].arraySlice.call(t)},qr.prototype._concatArrays=function(t,e){return this[Gr].arrayConcat.call(t,e)},qr.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},qr.prototype.concat=function(e){var n=this;if(!e)return this;var t=this._getWindowIds(e);return this[Gr].arrayForEach.call(t,function(t){n.ensureMessageContainer(t),n[t].log=n._concatArrays(n[t].log,e[t].log),n[t].info=n._concatArrays(n[t].info,e[t].info),n[t].warn=n._concatArrays(n[t].warn,e[t].warn),n[t].error=n._concatArrays(n[t].error,e[t].error)}),this},qr.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},qr.prototype.getCopy=function(){var e=this,n={},t=this._getWindowIds(this);return this[Gr].arrayForEach.call(t,function(t){n[t]={log:e._copyArray(e[t].log),info:e._copyArray(e[t].info),warn:e._copyArray(e[t].warn),error:e._copyArray(e[t].error)}}),n},qr);function qr(t,e){var n=this._ensureNativeMethods(e);n.objectDefineProperty(this,Gr,{value:n}),this.concat(t)}var zr,jr=(t(Xr,zr=Vr),Xr);function Xr(t){return zr.call(this,t,c.nativeMethods)||this}var Yr,Jr,Kr=(function(t){function n(t){return!!s[t]}function r(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,i=(0,eval)("this"),s={Int8Array:"function"==typeof Int8Array?Int8Array:void 0,Uint8Array:"function"==typeof Uint8Array?Uint8Array:void 0,Uint8ClampedArray:"function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,Int16Array:"function"==typeof Int16Array?Int16Array:void 0,Uint16Array:"function"==typeof Uint16Array?Uint16Array:void 0,Int32Array:"function"==typeof Int32Array?Int32Array:void 0,Uint32Array:"function"==typeof Uint32Array?Uint32Array:void 0,Float32Array:"function"==typeof Float32Array?Float32Array:void 0,Float64Array:"function"==typeof Float64Array?Float64Array:void 0},a="function"==typeof ArrayBuffer,l="function"==typeof Map,u="function"==typeof Set,c="function"==typeof Buffer,d=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function h(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}r._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},r.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},r.prototype._applyTransform=function(t,e,n,r){var i=Object.create(null),o=r.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),i["@t"]=r.type,i.data=this._handleValue(o,e,n),i},r.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},r.prototype._handlePlainObject=function(n){var r=this,i=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;i[e]=r._handleValue(n[t],i,e)}),i},r.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},r.prototype._ensureCircularReference=function(t){var e=this.circularCandidates.indexOf(t);if(-1<e){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),r._createRefMark(n.refIdx)}return null},r.prototype._handleValue=function(t,e,n){var r=typeof t,i="object"==r&&null!==t;if(i){var o=this._ensureCircularReference(t);if(o)return o}for(var s=0;s<this.transforms.length;s++){var a=this.transforms[s];if(a.shouldTransform(r,t))return this._applyTransform(t,e,n,a)}return i?this._handleObject(t,e,n):t},r.prototype.transform=function(){for(var t=[this._handleValue(this.references,null,null)],e=0;e<this.circularCandidatesDescrs.length;e++){var n=this.circularCandidatesDescrs[e];0<n.refIdx&&(t[n.refIdx]=n.parent[n.key],n.parent[n.key]=r._createRefMark(n.refIdx))}return t},h.prototype._handlePlainObject=function(e){var t,n=this,r=Object.create(null),i=Object.getOwnPropertyNames(e);for(t in i.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(r[t.substring(1)]=e[t],delete e[t])}),r)e[t]=r[t]},h.prototype._handleTransformedObject=function(t,e,n){var r=t["@t"],i=this.transformMap[r];if(!i)throw new Error("Can't find transform for \""+r+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=i.fromSerializable(t.data)},h.prototype._handleCircularSelfRefDuringTransform=function(t,e,n){var r=this.references,i=void 0;Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return void 0===i&&(i=r[t]),i},set:function(t){return i=t}})},h.prototype._handleCircularRef=function(t,e,n){-1<this.activeTransformsStack.indexOf(this.references[t])?this._handleCircularSelfRefDuringTransform(t,e,n):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),e[n]=this.references[t])},h.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var r=t["@r"];if(void 0!==r)this._handleCircularRef(r,e,n);else if(t["@t"])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var i=0;i<t.length;i++)this._handleValue(t[i],t,i);else this._handlePlainObject(t)}},h.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var p=[{type:"[[NaN]]",shouldTransform:function(t,e){return"number"===t&&isNaN(e)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",shouldTransform:function(t,e){return e instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var e=new Date;return e.setTime(t),e}},{type:"[[RegExp]]",shouldTransform:function(t,e){return e instanceof RegExp},toSerializable:function(t){var e={src:t.source,flags:""};return t.global&&(e.flags+="g"),t.ignoreCase&&(e.flags+="i"),t.multiline&&(e.flags+="m"),e},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",shouldTransform:function(t,e){return e instanceof Error},toSerializable:function(t){return{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var e=new(i[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return a&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return d.call(e)},fromSerializable:function(t){if(a){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[Buffer]]",shouldTransform:function(t,e){return c&&e instanceof Buffer},toSerializable:function(t){return d.call(t)},fromSerializable:function(t){return c?Buffer.from(t):t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){return Object.keys(s).some(function(t){return n(t)&&e instanceof s[t]})},toSerializable:function(t){return{ctorName:t.constructor.name,arr:d.call(t)}},fromSerializable:function(t){return n(t.ctorName)?new s[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return l&&e instanceof Map},toSerializable:function(t){var n=[];return t.forEach(function(t,e){n.push(e),n.push(t)}),n},fromSerializable:function(t){if(l){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var r=[],i=0;i<t.length;i+=2)r.push([t[n],t[n+1]]);return r}},{type:"[[Set]]",shouldTransform:function(t,e){return u&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(u){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],f=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(p)};f.prototype.addTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e];if(this.transformsMap[n.type])throw new Error('Transform with type "'+n.type+'" was already added.');this.transforms.push(n),this.transformsMap[n.type]=n}return this},f.prototype.removeTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e],r=this.transforms.indexOf(n);-1<r&&this.transforms.splice(r,1),delete this.transformsMap[n.type]}return this},f.prototype.encode=function(t){var e=new r(t,this.transforms).transform();return this.serializer.serialize(e)},f.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new h(e,this.transformsMap).transform()}}(Yr={exports:{}}),Yr.exports),$r=function(t){return t};function Qr(t){return new Kr({serialize:$r,deserialize:$r}).addTransforms(t)}var Zr=1,ti=2,ei=3,ni=((Jr={})[Zr]=/^\.filterVisible\(\)$/,Jr[ti]=/^\.filterHidden\(\)$/,Jr[ei]=/^\.nth\(\d+\)$/,Jr);function ri(){this._err=null}var ii=(Object.defineProperty(ri.prototype,"error",{get:function(){return this._err},set:function(t){null===this._err&&(this._err=t)},enumerable:!1,configurable:!0}),ri.prototype.filter=function(t,e,n){if(e.filterVisible&&(t=t.filter(_.positionUtils.isElementVisible),this._assertFilterError(t,n,Zr)),e.filterHidden&&(t=t.filter(function(t){return!_.positionUtils.isElementVisible(t)}),this._assertFilterError(t,n,ti)),e.counterMode)return null===e.index?t.length:ri._getNodeByIndex(t,e.index)?1:0;var r;if(e.collectionMode)return null!==e.index&&(t=(r=ri._getNodeByIndex(t,e.index))?[r]:[],this._assertFilterError(t,n,ei)),t;var i=ri._getNodeByIndex(t,e.index||0);return i||(this.error=ri._getErrorItem(n,ei)),i},ri.prototype.cast=function(t){if(null==t)return[];if(t instanceof c.nativeMethods.Node)return[t];if(function(t){if(c.nativeMethods.isArray(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof c.nativeMethods.Node))return;return 1}}(t))return t;if((e=t)instanceof c.nativeMethods.HTMLCollection||e instanceof c.nativeMethods.NodeList)return function(t){for(var e=t.length,n=[],r=0;r<e;r++)n.push(t[r]);return n}(t);var e;throw new Lt},ri.prototype._assertFilterError=function(t,e,n){0===t.length&&(this.error=ri._getErrorItem(e,n))},ri._getErrorItem=function(t,e){var n=t.apiFnChain,r=t.apiFnID;if(e)for(var i=r;i<n.length;i++)if(ni[e].test(n[i]))return i;return null},ri._getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},new ri);function oi(t,e){return new c.nativeMethods.Function("fnCode","__dependencies$","Promise","RegExp",'"use strict"; return eval(fnCode)')(t,e,c.Promise,RegExp)}var si=(ai.prototype.shouldTransform=function(t){return"function"===t},ai.prototype.toSerializable=function(){return""},ai.prototype.fromSerializable=function(t){var e=t.fnCode,n=t.dependencies;return"filterOptions"in n&&(n.selectorFilter=ii),oi(e,n)},ai);function ai(){this.type="Function"}var li=(ui.prototype.shouldTransform=function(t,e){if(e instanceof c.nativeMethods.Node)throw new Pt(this._instantiationCallsiteName);return!1},ui.prototype.toSerializable=function(){},ui.prototype.fromSerializable=function(){},ui);function ui(t){this.type="Node",this._instantiationCallsiteName=t}var ci=(di.prototype.getResult=function(){var e=this;return c.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new Xt(e.command.instantiationCallsiteName,t)),t})},di.prototype.encodeResult=function(t){return this.replicator.encode(t)},di.prototype._createReplicator=function(){return Qr([new li(this.command.instantiationCallsiteName),new si])},di.prototype._executeFn=function(t){return this.fn.apply(Ic,t)},di);function di(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(t.dependencies),this.fn=oi(t.fnCode,this.dependencies)}var hi="appeared-dialog",pi="unexpected-dialog",fi="handler-error",mi=l.eventSandbox.message,gi=l.processScript,vi=l.nativeMethods,wi="testcafe|native-dialog-tracker|appeared-dialogs",yi="testcafe|native-dialog-tracker|unexpected-dialog",_i="testcafe|native-dialog-tracker|error-in-handler",Ei=gi("window.location.href"),Ci=(Object.defineProperty(Ii.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(wi);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(wi,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Ii.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(yi)},set:function(t){this.contextStorage.setItem(yi,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Ii.prototype,"handlerError",{get:function(){return this.contextStorage.getItem(_i)},set:function(t){this.contextStorage.setItem(_i,t)},enumerable:!1,configurable:!0}),Ii._getPageUrl=function(){return vi.eval(Ei)},Ii.prototype._initListening=function(){var n=this;mi.on(mi.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===hi?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==pi||n.unexpectedDialog?e.type!==fi||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},Ii.prototype._init=function(){var e=this;l.on(l.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),Ic.alert=function(){return e._defaultDialogHandler("alert")},Ic.confirm=function(){return e._defaultDialogHandler("confirm")},Ic.prompt=function(){return e._defaultDialogHandler("prompt")}},Ii.prototype._createDialogHandler=function(i){var o=this;return function(t){var e=Ii._getPageUrl();o._addAppearedDialogs(i,t,e);var n=new ci(o.dialogHandler),r=null;try{r=n.fn.apply(Ic,[i,t,e])}catch(t){o._onHandlerError(i,t.message||String(t),e)}return r}},Ii.prototype._defaultDialogHandler=function(t){var e=Ii._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},Ii.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},Ii.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},Ii.prototype.setHandler=function(t){var e=this;this.dialogHandler=t,["alert","confirm","prompt"].forEach(function(t){Ic[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}})},Ii.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new kr(t.type,t.url):e?new Ur(e.type,e.message,e.url):null},Ii);function Ii(t,e){var n=(void 0===e?{}:e).dialogHandler;this.contextStorage=t,this.dialogHandler=n,this._init(),this._initListening(),this.dialogHandler&&this.setHandler(n)}function Si(){return c.nativeMethods.performanceNow().toString()}function bi(t){this.type=t,this.id=Si()}var Ti,Wi="driver|establish-connection",Ai="driver|switch-to-window",xi="driver|close-window",Ri="driver|close-window-validation",Ni="driver|switch-to-window-validation",Pi="driver|get-windows",Di="driver|command-executed",Mi="driver|execute-command",Fi="driver|confirmation",ki="driver|set-native-dialog-handler",Oi="driver|set-as-master",Li="driver|close-all-child-windows",Ui="driver|start-to-restore-child-link",Hi="driver|restore-child-link",Bi="driver|child-window-is-loaded-in-iframe",Gi="driver|child-window-is-opened-in-iframe",Vi="driver|stop-internal-from-iframe",qi="driver|has-pending-action-flags",zi=(t(ji,Ti=bi),ji);function ji(){return Ti.call(this,Wi)||this}var Xi,Yi=(t(Ji,Xi=bi),Ji);function Ji(t){var e=t.windowId,n=Xi.call(this,Ri)||this;return n.windowId=e,n}var Ki,$i=(t(Qi,Ki=bi),Qi);function Qi(t){var e=t.windowId,n=t.fn,r=Ki.call(this,Ni)||this;return r.windowId=e,r.fn=n,r}var Zi,to=(t(eo,Zi=bi),eo);function eo(){return Zi.call(this,Pi)||this}var no,ro=(t(io,no=bi),io);function io(t){var e=t.windowId,n=t.isCurrentWindow,r=no.call(this,xi)||this;return r.windowId=e,r.isCurrentWindow=n,r}var oo,so=(t(ao,oo=bi),ao);function ao(t){var e=t.windowId,n=t.fn,r=oo.call(this,Ai)||this;return r.windowId=e,r.fn=n,r}var lo,uo=(t(co,lo=bi),co);function co(t){var e=lo.call(this,Di)||this;return e.driverStatus=t,e}var ho,po=(t(fo,ho=bi),fo);function fo(t,e,n){var r=ho.call(this,Mi)||this;return r.command=t,r.testSpeed=e,r.leftTopPoint=n,r}var mo,go=(t(vo,mo=bi),vo);function vo(t,e){var n=mo.call(this,Fi)||this;return n.requestMessageId=t,n.result=e,n}var wo,yo=(t(_o,wo=bi),_o);function _o(t){var e=wo.call(this,ki)||this;return e.dialogHandler=t,e}var Eo,Co=(t(Io,Eo=bi),Io);function Io(t){var e=Eo.call(this,Oi)||this;return e.finalizePendingCommand=t,e}var So,bo=(t(To,So=bi),To);function To(){return So.call(this,Li)||this}var Wo,Ao=(t(xo,Wo=bi),xo);function xo(){return Wo.call(this,Ui)||this}var Ro,No=(t(Po,Ro=bi),Po);function Po(t){var e=Ro.call(this,Hi)||this;return e.windowId=t,e}var Do,Mo=(t(Fo,Do=bi),Fo);function Fo(t){var e=Do.call(this,Bi)||this;return e.windowId=t,e}var ko,Oo=(t(Lo,ko=bi),Lo);function Lo(){return ko.call(this,Gi)||this}var Uo,Ho=(t(Bo,Uo=bi),Bo);function Bo(){return Uo.call(this,Vi)||this}var Go,Vo=(t(qo,Go=bi),qo);function qo(){return Go.call(this,qi)||this}var zo=l.json,jo=l.nativeMethods,Xo="%proxylessContextStorage%",Yo=(Jo.prototype.loadFromStorage=function(){var t={},e=this._getData();return e&&(t=zo.parse(e),this._deleteData()),t},Jo.prototype._getData=function(){throw new Error("Not implemented")},Jo.prototype._deleteData=function(){throw new Error("Not implemented")},Jo.prototype.save=function(){throw new Error("Not implemented")},Jo.prototype.sync=function(){},Jo.prototype.dispose=function(){this._deleteData()},Jo);function Jo(){}var Ko,$o=(t(Qo,Ko=Yo),Qo.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},Qo.prototype._getData=function(){return jo.storageGetItem.call(this.storage,this.storageKey)},Qo.prototype._deleteData=function(){jo.storageRemoveItem.call(this.storage,this.storageKey)},Qo.prototype.save=function(t){jo.storageSetItem.call(this.storage,this.storageKey,zo.stringify(t))},Qo);function Qo(t,e,n){var r=Ko.call(this)||this;return r.storage=jo.winSessionStorageGetter.call(t),r.storageKey=r._createStorageKey(e,n),r}var Zo,ts=(t(es,Zo=Yo),es.prototype._getData=function(){var t;return null===(t=Ic[Xo])||void 0===t?void 0:t[this.frameId]},es.prototype._deleteData=function(){Ic[Xo]=null},es.prototype.save=function(t){Ic.PROXYLESS_STORAGE_BINDING&&Ic.PROXYLESS_STORAGE_BINDING(zo.stringify({testRunId:this.testRunId,frameDriverId:this.frameId,data:zo.stringify(t)}))},es);function es(t,e){var n=Zo.call(this)||this,r=e.split("-"),i=r[0],o=r[1];return n.testRunId=i,n.frameId=o||"main",n}var ns=(rs.prototype._createStorageStrategy=function(t,e,n,r){return new(t?ts:$o)(e,n,r)},rs.prototype.save=function(){this.strategy.save(this.data)},rs.prototype.setItem=function(t,e){this.data[t]=e,this.save(this.data)},rs.prototype.getItem=function(t){return this.data[t]},rs.prototype.dispose=function(){this.strategy.dispose()},rs);function rs(t,e){var n=e.testRunId,r=e.windowId,i=e.proxyless;this.strategy=this._createStorageStrategy(i,t,n,r),this.data=this.strategy.loadFromStorage(),this.testRunId=n}var is=Object.prototype.toString,os=String.prototype.indexOf,ss=String.prototype.endsWith||function(t,e){var n=is.call(this);(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var r=os.call(n,t,e);return-1!==r&&r===e},as=Array.prototype.indexOf,ls=Array.prototype.map,us=Array.prototype.sort,cs=Array.prototype.filter,ds=Array.prototype.concat,hs="Command",ps=(fs.prototype.getAssignableProperties=function(){return[]},fs.prototype.getAllAssignableProperties=function(){for(var t=Object.getPrototypeOf(this),e=[];t&&t.getAssignableProperties;)e=ds.call(e,t.getAssignableProperties()),t=Object.getPrototypeOf(t);return e},fs.prototype.getNonReportedProperties=function(){return[]},fs.prototype.getReportedProperties=function(){var t=ls.call(this.getAllAssignableProperties(),function(t){return t.name}),e=this.getNonReportedProperties();return cs.call(t,function(t){return!(-1<as.call(e,t))})},fs.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t){e&&function(t,e){var n,r=e.constructor.name,i=ls.call(e.getAllAssignableProperties(),function(t){return t.name}),o=us.call(e.getReportedProperties());for(n in t)if(!(-1<as.call(i,n)||n in e))throw new Be(r,n,o)}(t,this);for(var r,i,o=this.getAllAssignableProperties(),s=0;s<o.length;s++){var a=o[s],l=a.name,u=a.type,c=a.required,d=a.init,h=a.defaultValue;void 0!==h&&(this[l]=h);var p=t[l];void 0===p&&!c||(e&&u&&u((r=this.constructor.name,i=l,ss.call(r,hs)?i:"".concat(r,".").concat(i)),p),this[l]=d?d(l,p,n,e):p)}}},fs);function fs(){}var ms,gs=(t(vs,ms=ps),vs.prototype.getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isObservingFileDownloadingInNewWindow"},{name:"isFirstRequestAfterWindowSwitching"},{name:"warnings"}]},vs);function vs(t){var e=ms.call(this,t)||this;return e.id=Si(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isObservingFileDownloadingInNewWindow=!1,e.isFirstRequestAfterWindowSwitching=!1,e.debug="",e.warnings=null,e._assignFrom(t,!0),e}function ws(n,t,e,r){var i=null,o=null,s=null;return e=Math.max(e||0,2500),c.Promise.race([_.delay(e),new c.Promise(function(e){s=function(t){t.message.type===Fi&&t.message.requestMessageId===n.id&&e(t.message)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),i=c.nativeMethods.setInterval.call(Ic,function(){return c.eventSandbox.message.sendServiceMsg(n,t)},1e3),c.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(c.nativeMethods.clearInterval.call(Ic,i),c.nativeMethods.clearTimeout.call(Ic,o),c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new r;return t})}var ys=2e4;function _s(t){var e=t.requestMsgId,n=t.result,r=t.window,i=new go(e,n);c.eventSandbox.message.sendServiceMsg(i,r)}var Es=(Cs.create=function(t){return new Cs(t.top,t.right,t.bottom,t.left)},Cs.prototype.add=function(t){return this.top+=t.top,this.right+=t.right,this.bottom+=t.bottom,this.left+=t.left,this},Cs.prototype.sub=function(t){return"top"in t&&(this.top-=t.top,this.left-=t.left),this.bottom-=t.bottom,this.right-=t.right,this},Cs.prototype.round=function(t,e){return void 0===t&&(t=Math.round),void 0===e&&(e=t),this.top=t(this.top),this.right=e(this.right),this.bottom=e(this.bottom),this.left=t(this.left),this},Cs.prototype.contains=function(t){return t.x>=this.left&&t.x<=this.right&&t.y>=this.top&&t.y<=this.bottom},Cs);function Cs(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.top=t,this.right=e,this.bottom=n,this.left=r}function Is(t){var e="array"+t.charAt(0).toUpperCase()+t.slice(1),n=c.nativeMethods[e];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,t)}}Is("filter"),Is("map"),Is("slice"),Is("splice"),Is("unshift"),Is("forEach"),Is("indexOf"),Is("some"),Is("reverse"),Is("reduce"),Is("concat"),Is("join"),l.utils.browser,l.nativeMethods,l.utils.style.get,l.utils.dom.getActiveElement,l.utils.dom.findDocument,l.utils.dom.find,l.utils.dom.isElementInDocument;var Ss=l.utils.dom.isElementInIframe,bs=l.utils.dom.getIframeByElement,Ts=(l.utils.dom.isCrossDomainWindows,l.utils.dom.getSelectParent,l.utils.dom.getChildVisibleIndex,l.utils.dom.getSelectVisibleChildren,l.utils.dom.isElementNode,l.utils.dom.isTextNode,l.utils.dom.isRenderedNode,l.utils.dom.isIframeElement,l.utils.dom.isInputElement,l.utils.dom.isButtonElement,l.utils.dom.isFileInput,l.utils.dom.isTextAreaElement,l.utils.dom.isAnchorElement,l.utils.dom.isImgElement,l.utils.dom.isFormElement,l.utils.dom.isLabelElement,l.utils.dom.isSelectElement,l.utils.dom.isRadioButtonElement,l.utils.dom.isColorInputElement,l.utils.dom.isCheckboxElement,l.utils.dom.isOptionElement,l.utils.dom.isSVGElement,l.utils.dom.isMapElement,l.utils.dom.isBodyElement,l.utils.dom.isHtmlElement),Ws=(l.utils.dom.isDocument,l.utils.dom.isWindow,l.utils.dom.isTextEditableInput,l.utils.dom.isTextEditableElement,l.utils.dom.isTextEditableElementAndEditingAllowed,l.utils.dom.isContentEditableElement,l.utils.dom.isDomElement,l.utils.dom.isShadowUIElement,l.utils.dom.isShadowRoot,l.utils.dom.isElementFocusable,l.utils.dom.isHammerheadAttr,l.utils.dom.isElementReadOnly,l.utils.dom.getScrollbarSize),As=(l.utils.dom.getMapContainer,l.utils.dom.getTagName,l.utils.dom.closest,l.utils.dom.getParents,l.utils.dom.findParent,l.utils.dom.getTopSameDomainWindow,l.utils.dom.getParentExceptShadowRoot,l.utils.style,l.utils.style.getBordersWidth),xs=(l.utils.style.getComputedStyle,l.utils.style.getElementMargin,l.utils.style.getElementPadding,l.utils.style.getElementScroll),Rs=(l.utils.style.getOptionHeight,l.utils.style.getSelectElementSize,l.utils.style.isElementVisible,l.utils.style.isVisibleChild,l.utils.style.getWidth,l.utils.style.getHeight,l.utils.style.getInnerWidth),Ns=l.utils.style.getInnerHeight,Ps=(l.utils.style.getScrollLeft,l.utils.style.getScrollTop,l.utils.style.setScrollLeft,l.utils.style.setScrollTop,l.utils.style.get,l.utils.style.getBordersWidthFloat),Ds=l.utils.style.getElementPaddingFloat,Ms=(Object.defineProperty(Fs.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!1,configurable:!0}),Fs.prototype._ensureIframe=function(){var t=this;return _.domUtils.isElementInDocument(this.driverIframe)?_.waitFor(function(){return _.positionUtils.isIframeVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new Dr}):c.Promise.reject(new Rr)},Fs.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new c.Promise(function(t){e.checkIframeInterval=c.nativeMethods.setInterval.call(Ic,function(){e._ensureIframe().catch(function(){return _.delay(500).then(function(){return t(new gs({isCommandResult:!0}))})})},1e3)})},Fs.prototype._waitForCommandResult=function(){var e=this,n=null;return c.Promise.race([this._waitForIframeRemovedOrHidden(),new c.Promise(function(e){n=function(t){t.message.type===Di&&e(t.message.driverStatus)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),c.nativeMethods.clearInterval.call(Ic,e.checkIframeInterval),t})},Fs.prototype._getLeftTopPoint=function(t){if(!t)return null;var e=this.driverIframe.getBoundingClientRect(),n=Ps(this.driverIframe),r=Ds(this.driverIframe);return{x:e.left+n.left+r.left,y:e.top+n.top+r.top}},Fs.prototype.sendConfirmationMessage=function(t){_s({requestMsgId:t,result:{id:this.driverId,dispatchProxylessEventUrl:this.dispatchProxylessEventUrl},window:this.driverWindow})},Fs.prototype.executeCommand=function(n,r,i,o){var s=this;return this._ensureIframe().then(function(){var t=s._getLeftTopPoint(i);o&&(t.x+=o.x,t.y+=o.y);var e=new po(n,r,t);return c.Promise.all([ws(e,s.driverWindow,s.iframeAvailabilityTimeout,zn),s._waitForCommandResult()])}).then(function(t){return t[1]})},Fs);function Fs(t,e,n){this.driverWindow=t,this.driverIframe=_.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0,this.dispatchProxylessEventUrl=n}var ks=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],Os=["tagName","attributes"],Ls=["tagName","visible","focused","attributes","boundingClientRect","classNames","style","innerText","namespaceURI","id","value","checked","selected","selectedIndex","scrollWidth","scrollHeight","scrollLeft","scrollTop","offsetWidth","offsetHeight","offsetLeft","offsetTop","clientWidth","clientHeight","clientLeft","clientTop"],Us={childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!Us.childNodeCount(t)},childElementCount:function(t){var e=t.children;if(e)return e.length;for(var n=0,r=t.childNodes.length,i=0;i<r;i++)1===t.childNodes[i].nodeType&&n++;return n},hasChildElements:function(t){return!!Us.childElementCount(t)}},Hs=(Bs.prototype._initializeProperties=function(t,e,n){for(var r=0,i=e;r<i.length;r++){var o=i[r],s=n[o];this[o]=s?s(t):t[o]}},Bs);function Bs(){}var Gs,Vs=(t(qs,Gs=Hs),qs);function qs(t){var e=Gs.call(this)||this;return e._initializeProperties(t,ks,Us),e}var zs,js={tagName:function(t){return t.tagName.toLowerCase()},visible:function(t){return _.positionUtils.isElementVisible(t)},focused:function(t){return c.utils.dom.getActiveElement()===t},attributes:function(t){for(var e=t.attributes,n={},r=e.length-1;0<=r;r--)n[e[r].name]=e[r].value;return n},boundingClientRect:function(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width,height:e.height}},classNames:function(t){var e=t.className;return"string"==typeof e.animVal&&(e=e.animVal),e.replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=Ic.getComputedStyle(t),r=0;r<n.length;r++){var i=n[r];e[i]=n[i]}return e},innerText:function(t){return t.innerText}},Xs=(t(Ys,zs=Hs),Ys);function Ys(t){var e=zs.call(this)||this;return e._initializeProperties(t,Os,js),e}var Js,Ks=(t($s,Js=Vs),$s);function $s(t){var e=Js.call(this,t)||this;return e._initializeProperties(t,Ls,js),e}var Qs=(Zs.prototype._extend=function(t,e){for(var n=0,r=c.nativeMethods.objectKeys(this._customDOMProperties);n<r.length;n++){var i=r[n];try{t[i]=this._customDOMProperties[i](e)}catch(t){throw new Kt(this._instantiationCallsiteName,t,i)}}},Zs.prototype.shouldTransform=function(t,e){return e instanceof c.nativeMethods.Node},Zs.prototype.toSerializable=function(t){var e=new(1===t.nodeType?Ks:Vs)(t);return this._extend(e,t),e},Zs.prototype.fromSerializable=function(){},Zs);function Zs(t,e){void 0===t&&(t={}),this.type="Node",this._customDOMProperties=t,this._instantiationCallsiteName=e}var ta=(ea.prototype.on=function(t,e){this._eventsListeners[t]||(this._eventsListeners[t]=[]),this._eventsListeners[t].push(e)},ea.prototype.once=function(n,r){var i=this;this.on(n,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i.off(n,r),r.apply(void 0,t)})},ea.prototype.off=function(t,e){var n=this._eventsListeners[t];n&&(this._eventsListeners[t]=c.nativeMethods.arrayFilter.call(n,function(t){return t!==e}))},ea.prototype.offAll=function(t){t?this._eventsListeners[t]=[]:this._eventsListeners={}},ea.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._eventsListeners[e];if(r)for(var i=0;i<r.length;i++)try{r[i].apply(this,t)}catch(t){if(!(t.message&&-1<t.message.indexOf("freed script")))throw t;this.off(e,r[i])}},ea);function ea(){this._eventsListeners={}}var na=l.Promise,ra=l.nativeMethods;function ia(e){return new na(function(t){return ra.setTimeout.call(Ic,t,e)})}var oa={1:"element",2:"attribute",3:"text",4:"cdata section",5:"entity reference",6:"entity node",7:"processing instruction",8:"comment",9:"document",10:"document type",11:"document fragment",12:"notation"};function sa(t){return t?{name:"ActionAdditionalElementIsInvisibleError",firstArg:t}:"ActionElementIsInvisibleError"}function aa(t){return t?{name:"ActionAdditionalElementNotFoundError",firstArg:t}:"ActionElementNotFoundError"}function la(t){var e="string"==typeof t?Br[t]:Br[t.name],n="string"==typeof t?null:t.firstArg;return function(t){return new e(n,t)}}var ua=(ca.prototype.push=function(t,r){var i=this;this._ensureElementsPromise=this._ensureElementsPromise.then(function(){return i._executeSelectorFn(t,{invisible:sa(r),notFound:aa(r)},i._ensureElementsStartTime)}).then(function(t){if(!_.domUtils.isDomElement(t)){var e=t.nodeType,n=oa[e];throw r?new un(r,n):new Ke(n)}i._elements.push(t)})},ca.prototype.getElements=function(){var t=this;return this._ensureElementsPromise.then(function(){return t._elements})},ca);function ca(t,e){this._globalSelectorTimeout=t,this._ensureElementsStartTime=c.nativeMethods.dateNow(),this._ensureElementsPromise=c.Promise.resolve(),this._executeSelectorFn=e,this._elements=[]}l.shadowUI,l.nativeMethods;var da=(ha.create=function(t){return"left"in t?new ha(t.left,t.top):"right"in t?new ha(t.right,t.bottom):new ha(t.x,t.y)},ha.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},ha.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},ha.prototype.round=function(t){return void 0===t&&(t=Math.round),this.x=t(this.x),this.y=t(this.y),this},ha.prototype.eql=function(t){return this.x===t.x&&this.y===t.y},ha.prototype.mul=function(t){return this.x*=t,this.y*=t,this},ha.prototype.distance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},ha);function ha(t,e){this.x=t,this.y=e}var pa=function(t,e,n,r,i,o){this.width=t,this.height=e,this.left=n.x,this.top=n.y,this.right=n.x+t,this.bottom=n.y+e,this.border=r,this.scrollbar=o,this.scroll=i},fa=(l.utils.html,l.nativeMethods,l.utils.position.getElementRectangle),ma=l.utils.position.getOffsetPosition,ga=l.utils.position.offsetToClientCoords;function va(t){var e=t/2;return e<1?0:Math.round(e)}function wa(t,e,n){var r,i={offsetX:va((r=fa(t)).width),offsetY:va(r.height)};if(e="number"==typeof e?Math.round(e):i.offsetX,n="number"==typeof n?Math.round(n):i.offsetY,0<e&&0<n)return{offsetX:e,offsetY:n};var o=function(t){var e,n,r,i,o=Ts(t),s=o?t.getElementsByTagName("body")[0]:null,a=t.getBoundingClientRect(),l=Es.create(As(t)),u=xs(t),c=Ss(t),d="BackCompat"===t.ownerDocument.compatMode,h=o?new da(0,0):da.create(a),p=a.height,f=a.width;o&&(f=s&&d?(p=s.clientHeight,s.clientWidth):(p=t.clientHeight,t.clientWidth)),!c||(e=bs(t))&&(n=ma(e),r=ga(da.create(n)),i=As(e),h.add(r).add(da.create(i)),o&&l.add(i));var m=!o&&Rs(t)!==t.clientWidth,g=!o&&Ns(t)!==t.clientHeight,v={right:m?Ws():0,bottom:g?Ws():0};return new pa(f,p,h,l,u,v)}(t),s=Math.round(Math.max(t.scrollWidth,o.width)),a=Math.round(Math.max(t.scrollHeight,o.height)),l=o.scrollbar.right+o.border.left+o.border.right+s,u=o.scrollbar.bottom+o.border.top+o.border.bottom+a;return{offsetX:e<0?l+e:e,offsetY:n<0?u+n:n}}var ya,_a=(t(Ea,ya=ta),Ea.prototype._prepareCommand=function(t,e){t.options&&!t.options.speed&&(t.options.speed=e.testSpeed)},Ea.prototype._getCommandSelectorTimeout=function(t,e){var n;return"number"==typeof(null===(n=t.selector)||void 0===n?void 0:n.timeout)?t.selector.timeout:e.globalSelectorTimeout},Ea.prototype._delayAfterExecution=function(){return this._command.options&&1!==this._command.options.speed?ia(2e3*(1-this._command.options.speed)):c.Promise.resolve()},Ea.prototype._isExecutionTimeoutExpired=function(){return c.nativeMethods.dateNow()-this._executionStartTime>=this._commandSelectorTimeout},Ea.prototype._ensureCommandArguments=function(){var t=Ea.ACTIONS_HANDLERS[this._command.type];null!=t&&t.ensureCmdArgs&&t.ensureCmdArgs(this._command)},Ea.prototype._ensureCommandElements=function(){var t,e=this,n=new ua(this._options.globalSelectorTimeout,this._options.executeSelectorFn);this._command.selector&&n.push(this._command.selector);var r=null===(t=Ea.ACTIONS_HANDLERS[this._command.type])||void 0===t?void 0:t.additionalSelectorProps;if(r)for(var i=0,o=r;i<o.length;i++){var s=o[i];this._command[s]&&n.push(this._command[s],s)}return n.getElements().then(function(t){e._elements=t})},Ea.prototype._ensureCommandElementsProperties=function(){var t=Ea.ACTIONS_HANDLERS[this._command.type];null!=t&&t.ensureElsProps&&t.ensureElsProps(this._elements)},Ea.prototype._ensureCommandOptions=function(){return s(this,void 0,c.Promise,function(){var e,n,r,i;return C(this,function(t){return e=this._command.options,this._elements.length&&e&&"offsetX"in e&&"offsetY"in e&&(n=wa(this._elements[0],e.offsetX,e.offsetY),r=n.offsetX,i=n.offsetY,e.isDefaultOffset=!e.offsetX&&!e.offsetY,e.offsetX=r,e.offsetY=i),[2]})})},Ea.prototype._createAutomation=function(){var t=Ea.ACTIONS_HANDLERS[this._command.type];if(!t)throw new Error('There is no handler for the "'.concat(this._command.type,'" command.'));return t.create(this._command,this._elements,this._options.dispatchProxylessEventFn,this._options.leftTopPoint)},Ea.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){return n._ensureCommandOptions()}).then(function(){var t=n._createAutomation();return t.WARNING_EVENT&&t.on(t.WARNING_EVENT,function(t){n.emit(Ea.WARNING_EVENT,t)}),t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n._targetElement=t.element,n.emit(Ea.EXECUTION_STARTED_EVENT)}):n.emit(Ea.EXECUTION_STARTED_EVENT),t.run(e)})},Ea.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return function(e,n){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return e()?[4,n()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})})}(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(!e._isExecutionTimeoutExpired())return ia(250);if(t.code===bt)return n=!1,c.Promise.resolve();throw t})})},Ea.prototype.execute=function(t){var e=this;this._executionStartTime=c.nativeMethods.dateNow();try{this._ensureCommandArguments()}catch(t){return c.Promise.reject(t)}return this.emit(Ea.WAITING_FOR_ELEMENT_EVENT,this._commandSelectorTimeout),this._runRecursively().then(function(){return c.Promise.all([e._delayAfterExecution(),t.wait()])}).then(function(){var t=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||((r=r||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}([],e._elements,!0);return e._targetElement&&(t[0]=e._targetElement),t})},Ea.EXECUTION_STARTED_EVENT="execution-started",Ea.WAITING_FOR_ELEMENT_EVENT="waiting-for-elements",Ea.WARNING_EVENT="warning",Ea.ACTIONS_HANDLERS={},Ea);function Ea(t,e){var n=ya.call(this)||this;return n._command=t,n._targetElement=null,n._elements=[],n._options=e,n._executionStartTime=0,n._prepareCommand(t,e),n._commandSelectorTimeout=n._getCommandSelectorTimeout(t,e),n}function Ca(t,e,n){return Math.min(Math.max(e,t),n)}function Ia(t,e){var n="number"==typeof t.min,r="number"==typeof t.max,i="number"==typeof t.length;return i&&(t.length=Ca(t.length,0,e)),n&&t.min<0&&(t.min+=e),r&&t.max<0&&(t.max+=e),n||(t.min=r&&i?t.max-t.length:0),r||(t.max=i?t.min+t.length:e),t.min=Ca(t.min,0,e),t.max=Ca(t.max,0,e),t.length=t.max-t.min,t}function Sa(t,e,n){return Math.round(t+Ca(e-t,0,n)/2)}var ba,Ta=(t(Wa,ba=ci),Wa.prototype._createReplicator=function(){return Qr([new si])},Wa.prototype._getTimeoutErrorParams=function(t){return{apiFnIndex:ii.error,apiFnChain:this.command.apiFnChain,reason:_.positionUtils.getHiddenReason(t)}},Wa.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},Wa.prototype._validateElement=function(s,a){var l=this;return c.Promise.resolve().then(function(){return ba.prototype._executeFn.call(l,s)}).then(function(t){var e=t,n=!!e,r=!l.command.visibilityCheck||e&&_.positionUtils.isElementVisible(e),i=c.nativeMethods.dateNow()-a>=l.timeout;if(n&&(r||c.utils.dom.isShadowRoot(e)))return e;if(!i)return _.delay(200).then(function(){return l._validateElement(s,a)});var o=l.getVisibleValueMode?null:l._getTimeoutError(n);if(o)throw o(l._getTimeoutErrorParams(e));return null})},Wa.prototype._executeFn=function(t){return this.counterMode?ba.prototype._executeFn.call(this,t):this._validateElement(t,c.nativeMethods.dateNow())},Wa);function Wa(t,e,n,r,i){var o,s=ba.call(this,t)||this;s.createNotFoundError=r,s.createIsInvisibleError=i,s.timeout="number"==typeof t.timeout?t.timeout:e,s.counterMode=s.dependencies.filterOptions.counterMode,s.getVisibleValueMode=s.dependencies.filterOptions.getVisibleValueMode,s.dependencies.selectorFilter=ii,n&&(o=c.nativeMethods.dateNow()-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies.customDOMProperties;return s.replicator.addTransforms([new Qs(a,t.instantiationCallsiteName)]),s}var Aa=c.nativeMethods.date,xa=(Ra.prototype._ensureElement=function(t){var e=this,n=t.selector,r=t.createNotFoundError,i=t.createIsInvisibleError,o=t.createHasWrongNodeTypeError;this.ensureElementsPromise=this.ensureElementsPromise.then(function(){return new Ta(n,e.globalSelectorTimeout,e.ensureElementsStartTime,r,i).getResult()}).then(function(t){if(!_.domUtils.isDomElement(t))throw o(oa[t.nodeType]);e.elements.push(t)})},Ra.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},Ra);function Ra(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=c.Promise.resolve(),this.ensureElementsStartTime=new Aa,t.forEach(function(t){return n._ensureElement(t)})}function Na(r){return function(t,e){var n=typeof e;if("number"!=n)throw new r(t,n);if(isNaN(e)||!isFinite(e)||e!==Math.floor(e))throw new r(t,e)}}var Pa,Da,Ma,Fa,ka,Oa,La,Ua,Ha,Ba,Ga,Va,qa,za=Na(oe),ja=(Da=Na(Pa=le),function(t,e){if(Da(t,e),e<0)throw new Pa(t,e)}),Xa=(Ma=de,function(t,e){var n=typeof e;if("boolean"!=n)throw new Ma(t,n)}),Ya=(Fa=fe,function(t,e){var n=typeof e;if("number"!=n)throw new Fa(t,n);if(isNaN(e)||e<.01||1<e)throw new Fa(t,e)}),Ja=(ka=ve,function(t,e){var n=typeof e;if("string"!=n)throw new ka(t,n)}),Ka=(Oa=_e,function(t,e){var n=typeof e;if("string"!=n&&!(e instanceof RegExp))throw new Oa(t,n)}),$a=(La=Ie,function(t,e){if(!(e instanceof Date))throw new La(t,e)}),Qa=(Ua=Te,function(t,e){if(isNaN(Number(e)))throw new Ua(t,typeof e)}),Za=(Ha=xe,function(t,e){var n=typeof e;if("string"!=n&&!(e instanceof URL))throw new Ha(t,n)}),tl=(Ba=Pe,function(t,e){var n=typeof e;if("object"!=n&&!(e instanceof URLSearchParams))throw new Ba(t,n)}),el=(Ga=Fe,function(t,e){var n=typeof e;if("object"!=n)throw new Ga(t,n)}),nl=(Va=Le,function(t,e){var n=typeof e;if("function"!=n)throw new Va(t,n)}),rl=(t(il,qa=ps),il.prototype.getAssignableProperties=function(){return[{name:"speed",type:Ya}]},il);function il(t,e){var n=qa.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var ol,sl=(t(al,ol=rl),al.prototype.getAssignableProperties=function(){return[{name:"offsetX",type:za},{name:"offsetY",type:za},{name:"isDefaultOffset",type:Xa}]},al);function al(t,e){var n=ol.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var ll,ul=(t(cl,ll=sl),cl.prototype.getAssignableProperties=function(){return[{name:"scrollToCenter",type:Xa},{name:"skipParentFrames",type:Xa}]},cl);function cl(t,e){var n=ll.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var dl,hl=(t(pl,dl=ps),pl.prototype.getAssignableProperties=function(){return[{name:"left",type:za,defaultValue:null},{name:"right",type:za,defaultValue:null},{name:"top",type:za,defaultValue:null},{name:"bottom",type:za,defaultValue:null}]},pl);function pl(t,e){var n=dl.call(this)||this;return n._assignFrom(t,e),n}var fl,ml=(t(gl,fl=rl),gl.prototype.getAssignableProperties=function(){return[{name:"scrollTargetX",type:za},{name:"scrollTargetY",type:za},{name:"crop",type:el,init:nu},{name:"includeMargins",type:Xa},{name:"includeBorders",type:Xa},{name:"includePaddings",type:Xa}]},gl);function gl(t,e){var n=fl.call(this)||this;return n.scrollTargetX=null,n.scrollTargetY=null,n.includeMargins=!1,n.includeBorders=!0,n.includePaddings=!0,n.crop={left:null,right:null,top:null,bottom:null},n._assignFrom(t,e),n}var vl,wl=(t(yl,vl=ps),yl.prototype.getAssignableProperties=function(){return[{name:"ctrl",type:Xa,defaultValue:!1},{name:"alt",type:Xa,defaultValue:!1},{name:"shift",type:Xa,defaultValue:!1},{name:"meta",type:Xa,defaultValue:!1}]},yl);function yl(t,e){var n=vl.call(this)||this;return n._assignFrom(t,e),n}var _l,El=(t(Cl,_l=sl),Cl.prototype.getAssignableProperties=function(){return[{name:"modifiers",type:el,init:ru}]},Cl);function Cl(t,e){var n=_l.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var Il,Sl,bl,Tl,Wl,Al,xl,Rl,Nl=(t(Pl,Il=El),Pl.prototype.getAssignableProperties=function(){return[{name:"caretPos",type:ja}]},Pl);function Pl(t,e){var n=Il.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}function Dl(t,e){var n=Sl.call(this)||this;return n.speed=null,n.minMovingTime=null,n.holdLeftButton=!1,n.skipScrolling=!1,n.skipDefaultDragBehavior=!1,n._assignFrom(t,e),n}function Ml(t,e){var n=bl.call(this)||this;return n.replace=!1,n.paste=!1,n.confidential=void 0,n._assignFrom(t,e),n}function Fl(t,e){var n=Tl.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function kl(t,e){var n=Wl.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function Ol(t,e){var n=Al.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}function Ll(t,e){var n=xl.call(this)||this;return n.confidential=void 0,n._assignFrom(t,e),n}function Ul(t,e){var n=Rl.call(this)||this;return n._assignFrom(t,e),n}t(Dl,Sl=El),Dl.prototype.getAssignableProperties=function(){return[{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:Xa},{name:"skipDefaultDragBehavior",type:Xa}]},t(Ml,bl=Nl),Ml.prototype.getAssignableProperties=function(){return[{name:"replace",type:Xa},{name:"paste",type:Xa},{name:"confidential",type:Xa}]},t(Fl,Tl=El),Fl.prototype.getAssignableProperties=function(){return[{name:"destinationOffsetX",type:za},{name:"destinationOffsetY",type:za}]},t(kl,Wl=ps),kl.prototype.getAssignableProperties=function(){return[{name:"portraitOrientation",type:Xa}]},t(Ol,Al=ps),Ol.prototype.getAssignableProperties=function(){return[{name:"timeout",type:ja},{name:"allowUnawaitedPromise",type:Xa}]},t(Ll,xl=rl),Ll.prototype.getAssignableProperties=function(){return[{name:"confidential",type:Xa}]},t(Ul,Rl=ps),Ul.prototype.getAssignableProperties=function(){return[{name:"name",type:Ja},{name:"value",type:Ja},{name:"domain",type:Ja},{name:"path",type:Ja},{name:"expires",type:$a},{name:"maxAge",type:Qa},{name:"secure",type:Xa},{name:"httpOnly",type:Xa},{name:"sameSite",type:Ja}]};var Hl,Bl=(t(Gl,Hl=ps),Gl.prototype.getAssignableProperties=function(){return[{name:"username",type:Ja,required:!0},{name:"password",type:Ja}]},Gl);function Gl(t,e){var n=Hl.call(this)||this;return n._assignFrom(t,e),n}var Vl,ql,zl,jl,Xl,Yl=(t(Jl,Vl=ps),Jl.prototype.getAssignableProperties=function(){return[{name:"protocol",type:Ja},{name:"host",type:Ja,required:!0},{name:"port",type:Qa,required:!0},{name:"auth",type:el,init:tu}]},Jl);function Jl(t,e){var n=Vl.call(this)||this;return n._assignFrom(t,e),n}function Kl(t,e){var n=ql.call(this)||this;return n._assignFrom(t,e),n}function $l(t,e){var n=zl.call(this)||this;return n._assignFrom(t,e),n}function Ql(t,e){var n=jl.call(this)||this;return n._assignFrom(t,e),n}function Zl(t,e){var n=Xl.call(this)||this;return n._assignFrom(t,e),n}function tu(t,e,n,r){return void 0===r&&(r=!0),new Bl(e,r)}function eu(t,e,n,r){return void 0===r&&(r=!0),new Yl(e,r)}function nu(t,e,n,r){return void 0===r&&(r=!0),new hl(e,r)}function ru(t,e,n,r){return void 0===r&&(r=!0),new wl(e,r)}function iu(t){return t.top!==t}t(Kl,ql=ps),Kl.prototype.getAssignableProperties=function(){return[{name:"url",type:Za},{name:"method",type:Ja},{name:"headers",type:el},{name:"params",type:tl},{name:"body"},{name:"timeout",type:Qa},{name:"withCredentials",type:Xa},{name:"auth",type:el,init:tu},{name:"proxy",type:el,init:eu},{name:"rawResponse",type:Xa}]},t($l,zl=ps),$l.prototype.getAssignableProperties=function(){return[{name:"credentials",type:Qa}]},t(Ql,jl=ps),Ql.prototype.getAssignableProperties=function(){return[{name:"stack",type:Ka,required:!1},{name:"message",type:Ka,required:!1},{name:"pageUrl",type:Ka,required:!1}]},t(Zl,Xl=ps),Zl.prototype.getAssignableProperties=function(){return[{name:"fn",type:nl,required:!0},{name:"dependencies",type:el,required:!1}]};var ou=c.eventSandbox.message,su="driver|browser-manipulation|request",au="driver|browser-manipulation|response";ou.on(ou.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,r,i,o;e.message.cmd===su&&(t=_.domUtils.findIframeByWindow(e.source),r=(n=e.message).command,(i=n.cropDimensions)&&(r.options=new ml({crop:i,includePaddings:!1})),(o=new lu(r)).element=t,o.execute().then(function(t){return ou.sendServiceMsg({cmd:au,result:t},e.source)}))});var lu=(uu.prototype._getAbsoluteCropValues=function(){var t=this.element.getBoundingClientRect(),e=t.top,n=t.left;n+=this.command.options.originOffset.x,e+=this.command.options.originOffset.y;var r=n+this.command.options.crop.right,i=e+this.command.options.crop.bottom;return{top:e+=this.command.options.crop.top,left:n+=this.command.options.crop.left,bottom:i,right:r}},uu.prototype._createManipulationReadyMessage=function(){var t=Ic.devicePixelRatio||1,e={cmd:d.readyForBrowserManipulation,pageDimensions:{dpr:t,innerWidth:Ic.innerWidth,innerHeight:Ic.innerHeight,documentWidth:Sc.documentElement.clientWidth,documentHeight:Sc.documentElement.clientHeight,bodyWidth:Sc.body.clientWidth,bodyHeight:Sc.body.clientHeight},disableResending:!0};return this.command.type===h.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},uu.prototype._runScrollBeforeScreenshot=function(){var i=this;return c.Promise.resolve().then(function(){if(i.element||!i.command.selector)return c.Promise.resolve();var t,e,n=i.command.selector.timeout,r="number"==typeof n?n:i.globalSelectorTimeout;return i.statusBar.showWaitingElementStatus(r),t=[{selector:i.command.selector,createNotFoundError:function(t){return new qe(null,t)},createIsInvisibleError:function(t){return new Xe(null,t)},createHasWrongNodeTypeError:function(t){return new Ke(t)}}],e=i.globalSelectorTimeout,new xa(t,e).getElements().then(function(t){i.statusBar.hideWaitingElementStatus(),i.element=t[0]}).catch(function(t){throw i.statusBar.hideWaitingElementStatus(),t})}).then(function(){return function(w,y){return s(this,void 0,void 0,function(){var e,n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,v;return C(this,function(t){if(e=w.getBoundingClientRect(),n={left:e.left,right:e.right,top:e.top,bottom:e.bottom},r=_.styleUtils.getElementMargin(w),i=_.styleUtils.getElementPadding(w),o=_.styleUtils.getBordersWidth(w),y.originOffset={x:0,y:0},s=n.left+w.scrollWidth+o.left+o.right,a=n.top+w.scrollHeight+o.top+o.bottom,n.right=Math.max(n.right,s),n.bottom=Math.max(n.bottom,a),y.includeBorders&&y.includePaddings?y.includeMargins&&(y.originOffset.x-=r.left,y.originOffset.y-=r.top,n.left-=r.left,n.top-=r.top,n.right+=r.right,n.bottom+=r.bottom):(y.originOffset.x+=o.left,y.originOffset.y+=o.top,n.left+=o.left,n.top+=o.top,n.right-=o.right,n.bottom-=o.bottom,y.includePaddings||(y.originOffset.x+=i.left,y.originOffset.y+=i.top,n.left+=i.left,n.top+=i.top,n.right-=i.right,n.bottom-=i.bottom)),n.width=n.right-n.left,n.height=n.bottom-n.top,l=Ia({min:y.crop.left,max:y.crop.right,length:y.crop.width},n.width),u=Ia({min:y.crop.top,max:y.crop.bottom,length:y.crop.height},n.height),y.crop.left=l.min,y.crop.right=l.max,y.crop.width=l.length,y.crop.top=u.min,y.crop.bottom=u.max,y.crop.height=u.length,y.crop.width<=0||y.crop.height<=0)throw new kn(y.crop.width,y.crop.height);if(c=_.styleUtils.getViewportDimensions(),(n.width>c.width||n.height>c.height)&&(y.scrollToCenter=!0),d="number"==typeof y.scrollTargetX,h="number"==typeof y.scrollTargetY,d||(y.scrollTargetX=Sa(y.crop.left,y.crop.right,c.width)),h||(y.scrollTargetY=Sa(y.crop.top,y.crop.bottom,c.height)),p=E.getOffsetOptions(w,y.scrollTargetX,y.scrollTargetY),f=p.offsetX,m=p.offsetY,y.scrollTargetX=f,y.scrollTargetY=m,g=!d||y.scrollTargetX>=y.crop.left&&y.scrollTargetX<=y.crop.right,v=!h||y.scrollTargetY>=y.crop.top&&y.scrollTargetY<=y.crop.bottom,!g||!v)throw new Dn(g,v);return[2]})})}(i.element,i.command.options)}).then(function(){var t=i.command.options,e=t.scrollTargetX,n=t.scrollTargetY,r=t.scrollToCenter;return new _.ScrollAutomation(i.element,new ul({offsetX:e,offsetY:n,scrollToCenter:r,skipParentFrames:!0})).run()})},uu.prototype._hideUI=function(){return n.hide(),this.command.markData&&n.showScreenshotMark(this.command.markData),_.delay(500)},uu.prototype._showUI=function(){this.command.markData&&n.hideScreenshotMark(),n.show()},uu.prototype._requestManipulation=function(){if(!iu(Ic))return c.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var t=this._getAbsoluteCropValues();return _.sendRequestToFrame({cmd:su,command:this.command,cropDimensions:t},au,Ic.parent).then(function(t){if(!t.result)return{result:null};var e=t.result,n=e.result,r=e.executionError;if(r)throw r;return{result:n}})},uu.prototype._runManipulation=function(){var r=this,i=null;return c.Promise.resolve().then(function(){return r.command.type!==h.takeElementScreenshot?c.Promise.resolve():(_.scrollController.stopPropagation(),r._runScrollBeforeScreenshot())}).then(function(){return iu(Ic)?c.Promise.resolve():r._hideUI()}).then(function(){return r._requestManipulation()}).then(function(t){var e=t.result,n=t.error;if(n)throw n;return _.scrollController.enablePropagation(),i=e,iu(Ic)||r._showUI(),_.delay(200)}).then(function(){return new gs({isCommandResult:!0,result:i})}).catch(function(t){return _.scrollController.enablePropagation(),new gs({isCommandResult:!0,executionError:t})})},uu.prototype.execute=function(){var t=this;return function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=new _.ClientRequestEmitter,i=new _.RequestBarrier(r),o=new _.ScriptExecutionEmitter,s=new _.ScriptExecutionBarrier(o);_.pageUnloadBarrier.watchForPageNavigationTriggers();var a=null,l=t.apply(void 0,e),u=l.then(function(t){return a=t,c.Promise.all([i.wait().then(function(){return s.wait()}),_.pageUnloadBarrier.wait()])}).then(function(){return a});return{actionPromise:l,barriersPromise:u}}(function(){return t._runManipulation()}).barriersPromise},uu);function uu(t,e,n){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.element=null}function cu(e){return e.getResult().then(function(t){return new gs({isCommandResult:!0,result:e.encodeResult(t)})}).catch(function(t){return new gs({isCommandResult:!0,executionError:t})})}var du=l.Promise,hu=(pu.prototype.setAsMaster=function(t){var e=this;return ws(new Co(t),this.driverWindow,ys,tr).catch(function(t){if(!e._isNonPageWindow)throw t})},pu.prototype.closeAllChildWindows=function(){return ws(new bo,this.driverWindow,ys,rr)},pu.prototype.findChildWindows=function(t,e){return ws(new e(t),this.driverWindow,ys,tr)},pu.prototype.startToRestore=function(){return ws(new Ao,this.driverWindow,ys,tr)},pu.prototype.closeFileDownloadingWindow=function(){this._isNonPageWindow=!0,this.driverWindow.close()},pu);function pu(t,e){this._isNonPageWindow=!1,this.driverWindow=t,this.windowId=e}var fu=(mu.prototype._getTopOpenedWindow=function(t){for(var e=t;e.opener;)e=e.opener;return e.top},mu.prototype._setAsMaster=function(t,e){return ws(new Co(e),t,ys,tr)},mu.prototype.getTopOpenedWindow=function(){return this._getTopOpenedWindow(this.currentDriverWindow)},mu.prototype.setTopOpenedWindowAsMaster=function(){var t=this._getTopOpenedWindow(this.currentDriverWindow);return this._setAsMaster(t)},mu.prototype.setParentWindowAsMaster=function(t){void 0===t&&(t={});var e=this.currentDriverWindow.opener;return this._setAsMaster(e,t.finalizePendingCommand)},mu.prototype.restoreChild=function(r){return s(this,void 0,void 0,function(){var e,n;return C(this,function(t){return e=new No(r),n=this.currentDriverWindow.opener,ws(e,n,ys,tr),[2]})})},mu);function mu(t){this.currentDriverWindow=t}var gu="master",vu="replica",wu=(yu.prototype.shouldTransform=function(t,e){return e instanceof c.nativeMethods.Node},yu.prototype.toSerializable=function(t){return new Xs(t)},yu.prototype.fromSerializable=function(){},yu);function yu(){this.type="Node"}var _u=(Eu.prototype._startListening=function(){var e=this;this._emitter.onRequestSend(function(t){return e._onRequestSend(t)}),this._emitter.onRequestCompleted(function(t){return e._onRequestCompleted(t)}),this._emitter.onRequestError(function(t){return e._onRequestError(t)})},Eu.prototype._offListening=function(){this._emitter.offAll()},Eu.prototype._onRequestSend=function(t){this._collectingReqs&&this._requests.add(t)},Eu.prototype._onRequestCompleted=function(t){var e=this;ia(this._delays.additionalRequestsCollection).then(function(){return e._onRequestFinished(t)})},Eu.prototype._onRequestFinished=function(t){this._requests.has(t)&&(this._requests.delete(t),this._collectingReqs||this._requests.size||!this._watchdog||this._finishWaiting())},Eu.prototype._onRequestError=function(t){this._onRequestFinished(t)},Eu.prototype._finishWaiting=function(){this._watchdog&&((0,c.nativeMethods.clearTimeout)(this._watchdog),this._watchdog=null),this._requests.clear(),this._offListening(),this._waitResolve()},Eu.prototype.wait=function(t){var n=this;return ia(t?this._delays.pageInitialRequestsCollection:this._delays.requestsCollection).then(function(){return new c.Promise(function(t){var e;n._collectingReqs=!1,n._waitResolve=t,n._requests.size?(e=c.nativeMethods.setTimeout,n._watchdog=e(function(){return n._finishWaiting()},Eu.TIMEOUT)):n._finishWaiting()})})},Eu.TIMEOUT=3e3,Eu);function Eu(t,e){var n,r,i;void 0===e&&(e={}),this._delays={requestsCollection:null!==(n=e.requestsCollection)&&void 0!==n?n:50,additionalRequestsCollection:null!==(r=e.additionalRequestsCollection)&&void 0!==r?r:50,pageInitialRequestsCollection:null!==(i=e.pageInitialRequestsCollection)&&void 0!==i?i:50},this._emitter=t,this._waitResolve=null,this._watchdog=null,this._requests=new Set,this._collectingReqs=!0,this._startListening()}var Cu=(Iu.prototype._startListening=function(){var e=this;this._emitter.onScriptAdded(function(t){return e._onScriptElementAdded(t)}),this._emitter.onScriptLoadedOrFailed(function(t){return e._onScriptLoadedOrFailed(t)})},Iu.prototype._offListening=function(){this._emitter.offAll()},Iu.prototype._onScriptElementAdded=function(t){var e=this,n=(0,c.nativeMethods.setTimeout)(function(){return e._onScriptLoadedOrFailed(t,!0)},Iu.LOADING_TIMEOUT);this._scripts.set(t,n)},Iu.prototype._onScriptLoadedOrFailed=function(t,e){var n=this;void 0===e&&(e=!1),this._scripts.has(t)&&(e||(0,c.nativeMethods.clearTimeout)(this._scripts.get(t)),this._scripts.delete(t),this._scripts.size||ia(25).then(function(){n._waitResolve&&!n._scripts.size&&n._finishWaiting()}))},Iu.prototype._finishWaiting=function(){this._watchdog&&((0,c.nativeMethods.clearTimeout)(this._watchdog),this._watchdog=null),this._scripts.clear(),this._offListening(),this._waitResolve(),this._waitResolve=null},Iu.prototype.wait=function(){var n=this;return new c.Promise(function(t){var e;n._waitResolve=t,n._scripts.size?(e=c.nativeMethods.setTimeout,n._watchdog=e(function(){return n._finishWaiting()},Iu.TIMEOUT)):n._finishWaiting()})},Iu.TIMEOUT=3e3,Iu.LOADING_TIMEOUT=2e3,Iu);function Iu(t){this._emitter=t,this._watchdog=null,this._waitResolve=null,this._scripts=new Map,this._startListening()}var Su=(bu.prototype.wait=function(){var t=this;return c.Promise.all([this._requestBarrier.wait().then(function(){return t._scriptExecutionBarrier.wait()}),this._unloadBarrier.wait()]).then()},bu);function bu(t,e,n){this._requestBarrier=new _u(t),this._scriptExecutionBarrier=new Cu(e),(this._unloadBarrier=n).watchForPageNavigationTriggers&&n.watchForPageNavigationTriggers()}function Tu(t,e){var n=E.calculateSelectTextArguments(e[0],t);return new E.SelectText(e[0],n.startPos,n.endPos,t.options)}function Wu(t){if(!_.domUtils.isFileInput(t))throw new Rn}function Au(i,o){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return f(i)?[4,(e=i,r={stack:(n=o).stack,pageUrl:n.pageUrl,message:n.msg},e.args=[[r]],new ci(e).getResult())]:[3,2];case 1:return[2,t.sent()];case 2:return[2,i||!1]}var e,n,r})})}_a.ACTIONS_HANDLERS[h.dispatchEvent]={additionalSelectorProps:["relatedTarget"],create:function(t,e){return e[1]&&(t.options.relatedTarget=e[1]),new E.DispatchEvent(e[0],t.eventName,t.options)}},_a.ACTIONS_HANDLERS[h.pressKey]={create:function(t){return new E.Press(_.parseKeySequence(t.keys).combinations,t.options)},ensureCmdArgs:function(t){if(_.parseKeySequence(t.keys).error)throw new Sn("keys")}},_a.ACTIONS_HANDLERS[h.click]={create:function(t,e,n,r){return/option|optgroup/.test(_.domUtils.getTagName(e[0]))?new E.SelectChildClick(e[0],t.options):(E.cursor.shouldRender=!n,new E.Click(e[0],t.options,Ic,E.cursor,n,r))}},_a.ACTIONS_HANDLERS[h.rightClick]={create:function(t,e){return new E.RClick(e[0],t.options)}},_a.ACTIONS_HANDLERS[h.doubleClick]={create:function(t,e){return new E.DblClick(e[0],t.options)}},_a.ACTIONS_HANDLERS[h.hover]={create:function(t,e){return new E.Hover(e[0],t.options)}},_a.ACTIONS_HANDLERS[h.drag]={create:function(t,e){return new E.DragToOffset(e[0],t.dragOffsetX,t.dragOffsetY,t.options)}},_a.ACTIONS_HANDLERS[h.dragToElement]={additionalSelectorProps:["destinationSelector"],create:function(t,e){return new E.DragToElement(e[0],e[1],t.options)}},_a.ACTIONS_HANDLERS[h.scroll]={create:function(t,e){var n=t.x,r=t.y,i=t.position,o=t.options;return new E.SetScroll(e[0],{x:n,y:r,position:i},o)}},_a.ACTIONS_HANDLERS[h.scrollBy]={create:function(t,e){var n=t.byX,r=t.byY,i=t.options;return new E.SetScroll(e[0],{byX:n,byY:r},i)}},_a.ACTIONS_HANDLERS[h.scrollIntoView]={create:function(t,e){return new E.ScrollIntoView(e[0],t.options)}},_a.ACTIONS_HANDLERS[h.typeText]={create:function(t,e){return new E.Type(e[0],t.text,t.options)}},_a.ACTIONS_HANDLERS[h.selectText]={create:Tu,ensureElsProps:function(t){if(!_.domUtils.isEditableElement(t[0]))throw new hn}},_a.ACTIONS_HANDLERS[h.selectTextAreaContent]={create:Tu,ensureElsProps:function(t){if(!_.domUtils.isTextAreaElement(t[0]))throw new mn}},_a.ACTIONS_HANDLERS[h.selectEditableContent]={additionalSelectorProps:["startSelector","endSelector"],create:function(t,e){return t.endSelector=t.endSelector||t.startSelector,new E.SelectEditableContent(e[0],e[1],t.options)},ensureElsProps:function(t){if(!_.domUtils.isContentEditableElement(t[0]))throw new wn("startSelector");if(!_.domUtils.isContentEditableElement(t[1]))throw new wn("endSelector");if(!_.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new En}},_a.ACTIONS_HANDLERS[h.setFilesToUpload]={create:function(t,e){return new E.Upload(e[0],t.filePath,function(t,e){return new Wn(t,e)})},ensureElsProps:function(t){return Wu(t[0])}},_a.ACTIONS_HANDLERS[h.clearUpload]={create:function(t,e){return new E.Upload(e[0])},ensureElsProps:function(t){return Wu(t[0])}};var xu,Ru=l.settings,Nu=l.transport,Pu=l.Promise,Du=l.eventSandbox.message,Mu=l.storages,Fu=l.nativeMethods,ku=Fu.date,Ou=l.eventSandbox.listeners,Lu=l.utils.url,Uu="testcafe|driver|test-done-sent-flag",Hu="testcafe|driver|pending-status",Bu="testcafe|driver|executing-client-function-descriptor",Gu="testcafe|driver|executing-skip-js-errors-function-flag",Vu="testcafe|driver|selector-execution-start-time",qu="testcafe|driver|pending-page-error",zu="testcafe|driver|active-iframe-selector",ju="testcafe|driver|test-speed",Xu="testcafe|driver|assertion-retries-timeout",Yu="testcafe|driver|assertion-retries-start-time",Ju="testcafe|driver|console-messages",Ku="testcafe|driver|pending-child-window-count",$u={NotLoadedError:Gn,NotFoundError:qe,IsInvisibleError:Xe},Qu={NotLoadedError:zn,NotFoundError:Rr,IsInvisibleError:Dr},Zu=Math.pow(2,31)-1,tc="status-with-command-result-event",ec="empty-command-event",nc="child-window-closed",rc="skip-js-errors-function-execution-complete",ic=(t(oc,xu=_.serviceUtils.EventEmitter),oc.prototype._isOpenedInIframe=function(){var t=Ic.opener;return t&&t.top&&t.top!==t},Object.defineProperty(oc.prototype,"speed",{get:function(){return this.contextStorage.getItem(ju)},set:function(t){this.contextStorage.setItem(ju,t)},enumerable:!1,configurable:!0}),Object.defineProperty(oc.prototype,"consoleMessages",{get:function(){return new jr(this.contextStorage.getItem(Ju))},set:function(t){return this.contextStorage.setItem(Ju,t?t.getCopy():null)},enumerable:!1,configurable:!0}),oc.prototype._getReadyPromise=function(){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,_.eventUtils.documentReady(this.options.pageLoadTimeout)];case 1:return t.sent(),[4,this.pageInitialRequestBarrier.wait(!0)];case 2:return t.sent(),[2]}})})},oc.prototype._hasPendingActionFlags=function(t){return t.getItem(this.COMMAND_EXECUTING_FLAG)||t.getItem(this.EXECUTING_IN_IFRAME_FLAG)},oc.prototype._getCurrentWindowId=function(){if(this.options.proxyless)return this.runInfo.activeWindowId;var t=Ic.location.toString(),e=l.utils.url.parseProxyUrl(t);return e&&e.windowId||null},oc.prototype._onJsError=function(n){return s(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:if(this.contextStorage.getItem(Uu))return[2];if(!this.options.skipJsErrors)return[3,6];this.contextStorage.setItem(Gu,!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,Au(this.options.skipJsErrors,n)];case 2:return t.sent()||this._setUncaughtErrorOnPage(n),[3,5];case 3:return e=t.sent(),this.contextStorage.getItem(qu)||this.contextStorage.setItem(qu,e),[3,5];case 4:return this.contextStorage.setItem(Gu,!1),this.emit(rc),[7];case 5:return[2];case 6:return this._setUncaughtErrorOnPage(n),[2]}})})},oc.prototype._setUncaughtErrorOnPage=function(t){var e=new qt(t.stack,t.pageUrl);this.contextStorage.getItem(qu)||this.contextStorage.setItem(qu,e)},oc.prototype._unlockPageAfterTestIsDone=function(){return this.options.proxyless||_.disableRealEventsPreventing(),Pu.resolve()},oc.prototype._getActiveElement=function(){return s(this,void 0,void 0,function(){var e;return C(this,function(t){return e=_.domUtils.getActiveElement(),[2,this.replicator.encode(e)]})})},oc.prototype._failIfClientCodeExecutionIsInterrupted=function(){var t=this.contextStorage.getItem(Bu);return!!t&&(this._onReady(new gs({isCommandResult:!0,executionError:new xt(t.instantiationCallsiteName)})),!0)},oc.prototype.onCustomClientScriptError=function(t,e){var n=e?new ne(t,e):new Zt(t);this.contextStorage.getItem(qu)||this.contextStorage.setItem(qu,n)},oc.prototype._addChildWindowDriverLink=function(t){var e=new hu(t.window,t.windowId);this.childWindowDriverLinks.push(e),this._ensureClosedChildWindowWatcher()},oc.prototype._ensureClosedChildWindowWatcher=function(){var e=this;this.checkClosedChildWindowIntervalId||(this.checkClosedChildWindowIntervalId=Fu.setInterval.call(Ic,function(){var t=_.arrayUtils.find(e.childWindowDriverLinks,function(t){return t.driverWindow.closed});t&&(e.emit(nc),_.arrayUtils.remove(e.childWindowDriverLinks,t),t.ignoreMasterSwitching||e._setCurrentWindowAsMaster(),e.childWindowDriverLinks.length||(Fu.clearInterval.call(Ic,e.checkClosedChildWindowIntervalId),delete e.checkClosedChildWindowIntervalId))},200))},oc.prototype._setAsMasterInProgressOrCompleted=function(){return this.setAsMasterInProgress||this.role===gu},oc.prototype._setCurrentWindowAsMaster=function(){var t=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,this._clearActiveChildIframeInfo(),Pu.resolve().then(function(){return _.browser.setActiveWindowId(t.communicationUrls.activeWindowId,l.createNativeXHR,t.windowId)}).then(function(){t._startInternal({finalizePendingCommand:!0,isFirstRequestAfterWindowSwitching:!0}),t.setAsMasterInProgress=!1}).catch(function(){t._onReady(new gs({isCommandResult:!0,executionError:new tr}))}))},oc.prototype._onChildWindowOpened=function(t){this._addChildWindowDriverLink(t),this._switchToChildWindow(t.windowId)},oc.prototype._sendStartToRestoreCommand=function(){if(this.contextStorage){this._stopRespondToChildren=!0,this.contextStorage.setItem(Ku,this.childWindowDriverLinks.length);for(var t=0,e=this.childWindowDriverLinks;t<e.length;t++)e[t].startToRestore()}},oc.prototype._onFormSubmit=function(t){this.contextStorage&&this.contextStorage.getItem(Uu)&&(t.preventSubmit=!0)},oc.prototype._onConsoleMessage=function(t){var e=t.meth,n=t.line,r=this.consoleMessages;r.addMessage(e,n,this.windowId),this.consoleMessages=r},oc.prototype._addPendingErrorToStatus=function(t){var e=this.contextStorage.getItem(qu);e&&(this.contextStorage.setItem(qu,null),t.pageError=e)},oc.prototype._addUnexpectedDialogErrorToStatus=function(t){var e=this.nativeDialogsTracker.getUnexpectedDialogError();t.pageError=t.pageError||e},oc.prototype._addConsoleMessagesToStatus=function(t){t.consoleMessages=this.consoleMessages,this.consoleMessages=null},oc.prototype._addPendingWindowSwitchingStateToStatus=function(t){t.isPendingWindowSwitching=this._isPendingSwitchingWindow()},oc.prototype._sendStatusRequest=function(t){function e(){return _.getTimeLimitedPromise(Nu.asyncServiceMsg(r),5e3)}function n(){return _.delay(300).then(e)}for(var r={cmd:d.ready,status:t,disableResending:!0,allowRejecting:!0},i=e(),o=0;o<a;o++)i=i.catch(n);return i},oc.prototype._sendStatus=function(t){var e=this;t.resent||(this._addPendingErrorToStatus(t),this._addUnexpectedDialogErrorToStatus(t),this._addConsoleMessagesToStatus(t),this._addPendingWindowSwitchingStateToStatus(t)),this.contextStorage.setItem(Hu,t);var n=null;return _.pageUnloadBarrier.wait(0).then(function(){return e._sendStatusRequest(t)}).then(function(t){return n=t,_.pageUnloadBarrier.wait(0)}).then(function(){return e.contextStorage.setItem(Hu,null),n})},oc.prototype._addChildIframeDriverLink=function(t,e){var n,r=this._getChildIframeDriverLinkByWindow(e);r||(n="".concat(this.testRunId,"-").concat(Si()),r=new Ms(e,n,this.communicationUrls.dispatchProxylessEvent),this.childIframeDriverLinks.push(r)),r.sendConfirmationMessage(t)},oc.prototype._getTargetWindowNotFoundResult=function(t,e){return Pu.resolve({success:!1,errCode:t,errMsg:e})},oc.prototype._getChildWindowValidateResult=function(t){var e=t.find(function(t){return t.result.success});if(e)return e.result;var n=t.find(function(t){return t.result.errCode===_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError||t.result.errCode===_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent});return(n=n||t.find(function(t){return!!t.result.errCode}))?{errCode:n.result.errCode}:void 0},oc.prototype._handleWindowValidation=function(n,r,i,o){return s(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,this._validateWindow(n,r,i,o)];case 1:return e=t.sent(),_s({requestMsgId:n.id,window:r,result:e}),[2]}})})},oc.prototype._getWindowInfo=function(){var t=l.utils.url.parseProxyUrl(Ic.location.toString());return{id:this.windowId,title:Sc.title,url:t.destUrl}},oc.prototype._isTargetWindow=function(t){return t.windowId===this.windowId},oc.prototype._validateWindow=function(r,t,i,o){return s(this,void 0,void 0,function(){var e,n;return C(this,function(t){switch(t.label){case 0:return this._isTargetWindow(r)?[2,i()]:this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(r,o)}),[4,Pu.all(e)]):[2,this._getTargetWindowNotFoundResult(_.TEST_RUN_ERRORS.targetWindowNotFoundError)];case 1:return n=t.sent(),[2,this._getChildWindowValidateResult(n)]}})})},oc._createWindowValidationError=function(t){var e=t.errCode;return new(e===_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError?sr:e===_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent?ur:mr)},oc.prototype._getCloseWindowFoundResult=function(){return this.parentWindowDriverLink?this.childWindowDriverLinks.length?Pu.resolve({success:!1,errCode:_.TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError}):Pu.resolve({success:!0}):Pu.resolve({success:!1,errCode:_.TEST_RUN_ERRORS.cannotCloseWindowWithoutParent})},oc.prototype._handleCloseWindowValidation=function(t,e){var n=this;return this._handleWindowValidation(t,e,function(){return n._getCloseWindowFoundResult()},Yi)},oc.prototype._handleSwitchToWindowValidation=function(t,e){return this._handleWindowValidation(t,e,function(){return Pu.resolve({success:!0})},$i)},oc.prototype._handleCloseWindow=function(e,n){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,this._closeWindow(e,n)];case 1:return t.sent(),_s({requestMsgId:e.id,window:n}),[2]}})})},oc.prototype._closeWindowAndWait=function(n,r){return s(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return e=this._createWaitForEventPromise(nc,2e3),n.ignoreMasterSwitching=!r.isCurrentWindow,this.closing?[3,2]:(this.closing=!0,[4,_.browser.closeWindow(this.communicationUrls.closeWindow,l.createNativeXHR,this.windowId)]);case 1:t.sent(),t.label=2;case 2:return n.driverWindow.close(),[2,e]}})})},oc.prototype._closeWindow=function(e){if(!this.childWindowDriverLinks.length)return Pu.resolve();var t=this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId});if(t)return this._closeWindowAndWait(t,e);var n=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,ro)});return Pu.all(n)},oc.prototype._getWindows=function(){return s(this,void 0,void 0,function(){var e,n,r,i,o,s;return C(this,function(t){switch(t.label){case 0:return this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows({},to)}),[4,Pu.all(e)]):[2,[this._getWindowInfo()]];case 1:for(n=t.sent(),r=[this._getWindowInfo()],i=0,o=n;i<o.length;i++)s=o[i],Array.isArray(s.result)&&(r=r.concat(s.result));return[2,r]}})})},oc.prototype._handleGetWindows=function(n,r){return s(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,this._getWindows(n,r)];case 1:return e=t.sent(),_s({requestMsgId:n.id,window:r,result:e}),[2]}})})},oc.prototype._handleSwitchToWindow=function(e,n){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,this._switchToWindow(e)];case 1:return t.sent(),_s({requestMsgId:e.id,window:n}),[2]}})})},oc.prototype._switchToWindow=function(e){var t=this;return this._isTargetWindow(e)?Pu.resolve().then(function(){t._setCurrentWindowAsMaster()}):this.childWindowDriverLinks.length?Pu.all(this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,so)})):Pu.resolve()},oc.prototype._handleSetAsMasterMessage=function(t,e){var n=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,_s({requestMsgId:t.id,window:e}),Pu.resolve().then(function(){return _.browser.setActiveWindowId(n.communicationUrls.activeWindowId,l.createNativeXHR,n.windowId)}).then(function(){n._startInternal({finalizePendingCommand:t.finalizePendingCommand,result:{id:n.windowId}}),n.setAsMasterInProgress=!1}).catch(function(){n._onReady(new gs({isCommandResult:!0,executionError:new tr}))}))},oc.prototype._handleCloseAllWindowsMessage=function(t,e){var n=this;this._closeAllChildWindows().then(function(){_s({requestMsgId:t.id,window:e})}).catch(function(){n._onReady(new gs({isCommandResult:!0,executionError:new rr}))})},oc.prototype._handleStartToRestoreChildLinkMessage=function(){this.parentWindowDriverLink.restoreChild(this._getCurrentWindowId())},oc.prototype._handleHasPendingActionFlags=function(t,e){var n=this._hasPendingActionFlags(this.contextStorage);_s({requestMsgId:t.id,window:e,result:n})},oc.prototype._handleRestoreChildLink=function(t,e){this._stopRespondToChildren||(this._addChildWindowDriverLink({window:e,windowId:t.windowId}),this.childWindowDriverLinks.length===this.contextStorage.getItem(Ku)&&this._restoreChildWindowsPromiseResolver&&(this._restoreChildWindowsPromiseResolver(),delete this._restoreChildWindowsPromiseResolver,this.contextStorage.setItem(Ku,0)),_s({requestMsgId:t.id,window:e}))},oc.prototype._handleChildWindowIsOpenedInIFrame=function(){var e=this;this._pendingChildWindowInIFrame=new Pu(function(t){e._resolvePendingChildWindowInIframe=t})},oc.prototype._handleChildWindowIsLoadedInIFrame=function(e,t){_s({requestMsgId:e.id,window:t}),this._resolvePendingChildWindowInIframe(),this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId})||this._onChildWindowOpened({window:t,windowId:e.windowId})},oc.prototype._handleStopInternalFromFrame=function(t,e){_s({requestMsgId:t.id,window:e}),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this._stopInternal()},oc.prototype._initChildDriverListening=function(){var r=this;Du.on(Du.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message,n=t.source;switch(e.type){case Wi:r._addChildIframeDriverLink(e.id,n);break;case Gi:r._handleChildWindowIsOpenedInIFrame(e,n);break;case Bi:r._handleChildWindowIsLoadedInIFrame(e,n);break;case Vi:r._handleStopInternalFromFrame(e,n);break;case Oi:r._handleSetAsMasterMessage(e,n);break;case Ai:r._handleSwitchToWindow(e,n);break;case xi:r._handleCloseWindow(e,n);break;case Ni:r._handleSwitchToWindowValidation(e,n);break;case Ri:r._handleCloseWindowValidation(e,n);break;case Pi:r._handleGetWindows(e,n);break;case Li:r._handleCloseAllWindowsMessage(e,n);break;case Ui:r._handleStartToRestoreChildLinkMessage();break;case qi:r._handleHasPendingActionFlags(e,n);break;case Hi:r._handleRestoreChildLink(e,n)}})},oc.prototype._getChildIframeDriverLinkByWindow=function(e){return _.arrayUtils.find(this.childIframeDriverLinks,function(t){return t.driverWindow===e})},oc.prototype._getChildWindowDriverLinkByWindow=function(e){return _.arrayUtils.find(this.childWindowDriverLinks,function(t){return t.driverWindow===e})},oc.prototype._runInActiveIframe=function(t){var e=this,n=Pu.resolve(),r=this.contextStorage.getItem(zu);!this.activeChildIframeDriverLink&&r&&(n=this._switchToIframe(r,Qu)),n.then(function(){return e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!0),e.activeChildIframeDriverLink.executeCommand(t,e.speed,e.options.proxyless,e.leftTopPoint)}).then(function(t){return e._onCommandExecutedInIframe(t)}).catch(function(t){return e._onCommandExecutedInIframe(new gs({isCommandResult:!0,executionError:t}))})},oc.prototype._onCommandExecutedInIframe=function(t){var e=this;this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1);var n=Pu.resolve();this._pendingChildWindowInIFrame&&(n=this._pendingChildWindowInIFrame),n.then(function(){e._onReady(t)})},oc.prototype._ensureChildIframeDriverLink=function(t,e,n){var r=this;return _.waitFor(function(){return r._getChildIframeDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},oc.prototype._ensureChildWindowDriverLink=function(t,e,n){var r=this;return _.waitFor(function(){return r._getChildWindowDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},oc.prototype._switchToIframe=function(e,n){var t,r,i,o,s,a,l,u=this,c="number"==typeof e.timeout,d=c?e.timeout:this.options.selectorTimeout;return t=e,r=d,i=null,o=function(t){return new n.NotFoundError(null,t)},s=function(){return new n.IsInvisibleError},a=this.statusBar,l=new Ta(t,r,i,o,s),a.showWaitingElementStatus(l.timeout),l.getResult().then(function(t){return a.hideWaitingElementStatus(!!t).then(function(){return t})}).catch(function(t){return a.hideWaitingElementStatus(!1).then(function(){throw t})}).then(function(t){if(!_.domUtils.isIframeElement(t))throw new Un;var e=c?d:Math.max(d,5e3);return u._ensureChildIframeDriverLink(Fu.contentWindowGetter.call(t),n.NotLoadedError,e)}).then(function(t){t.availabilityTimeout=d,u.activeChildIframeDriverLink=t,u.contextStorage.setItem(zu,e)})},oc.prototype._createWaitForEventPromise=function(e,n){var r=this,i=null,t=new Pu(function(t){Fu.setTimeout.call(Ic,function(){r.off(e,i),t()},n)}),o=new Pu(function(t){i=function(){this.off(e,i),t()},r.on(e,i)});return Pu.race([t,o])},oc.prototype._waitForCurrentCommandCompletion=function(){return this.contextStorage.getItem(this.COMMAND_EXECUTING_FLAG)?this._createWaitForEventPromise(tc,Zu):Pu.resolve()},oc.prototype._waitForSkipJsErrorFunctionCompletion=function(n){var r=this;return this.contextStorage.getItem(Gu)?new Pu(function(t){var e=function(){r.off(rc,e),t(n)};r.on(rc,e)}):Pu.resolve(n)},oc.prototype._waitForEmptyCommand=function(){return this._createWaitForEventPromise(ec,3e4)},oc.prototype._abortSwitchingToChildWindowIfItClosed=function(){if(this.activeChildWindowDriverLink.driverWindow.closed)throw _.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),this.activeChildWindowDriverLink=null,new Sr},oc.prototype._switchToChildWindow=function(t){var e=this;this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0);var n=this.contextStorage.getItem(this.WINDOW_COMMAND_API_CALL_FLAG);return function(e,t){if("string"!=typeof e)return du.resolve(null);var n=_.arrayUtils.find(t,function(t){return t.windowId===e});if(n)return du.resolve(n);var r=new Yn;return du.reject(r)}(t,this.childWindowDriverLinks).then(function(t){return e._ensureChildWindowDriverLink(t.driverWindow,$n,e.options.childWindowReadyTimeout)}).then(function(t){return e.activeChildWindowDriverLink=t,e._waitForCurrentCommandCompletion()}).then(function(){return n?void 0:e._waitForEmptyCommand()}).then(function(){return e._observeFileDownloadingInNewWindow(),e._abortSwitchingToChildWindowIfItClosed(),e._stopInternal(),e.activeChildWindowDriverLink.setAsMaster(n)}).then(function(){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(t){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1),t instanceof Sr?e._onReady(new gs):e._onReady(new gs({isCommandResult:!0,executionError:new tr}))})},oc.prototype._switchToTopParentWindow=function(){var t=this.parentWindowDriverLink.setTopOpenedWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(t)},oc.prototype._switchToParentWindow=function(t){void 0===t&&(t={});var e=this.parentWindowDriverLink.setParentWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(e,t)},oc.prototype._switchToParentWindowInternal=function(t,e){var n=this;return void 0===e&&(e={}),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0),Pu.resolve().then(function(){return n._stopInternal(),t(e)}).then(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1),n._onReady(new gs({isCommandResult:!0,executionError:new tr}))})},oc.prototype._switchToMainWindow=function(t){this.activeChildIframeDriverLink&&this.activeChildIframeDriverLink.executeCommand(t),this._clearActiveChildIframeInfo()},oc.prototype._clearActiveChildIframeInfo=function(){this.contextStorage.setItem(zu,null),this.activeChildIframeDriverLink=null},oc.prototype._setNativeDialogHandlerInIframes=function(t){for(var e=new yo(t),n=0;n<this.childIframeDriverLinks.length;n++)Du.sendServiceMsg(e,this.childIframeDriverLinks[n].driverWindow)},oc.prototype._onActionCommand=function(t){var o=this,e=this.options.proxyless?Fu.functionBind.call(_.browser.dispatchProxylessEvent,_.browser.dispatchProxylessEvent,this.communicationUrls.dispatchProxylessEvent,u,l.createNativeXHR):null,n=new _a(t,{globalSelectorTimeout:this.options.selectorTimeout,testSpeed:this.speed,executeSelectorFn:function(t,e,n){var r=la(e.notFound),i=la(e.invisible);return new Ta(t,o.options.selectorTimeout,n,r,i).getResult()},leftTopPoint:this.leftTopPoint,dispatchProxylessEventFn:e}),r=[];n.on(_a.EXECUTION_STARTED_EVENT,function(){o.statusBar.hideWaitingElementStatus(!0),o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!0)}),n.on(_a.WAITING_FOR_ELEMENT_EVENT,function(t){o.statusBar.showWaitingElementStatus(t)}),n.on(_a.WARNING_EVENT,function(t){r.push(t)});var i=new _.ClientRequestEmitter,s=new _.ScriptExecutionEmitter,a=new Su(i,s,_.pageUnloadBarrier);n.execute(a).then(function(t){return new gs({isCommandResult:!0,result:Qr(new wu).encode(t),warnings:r})}).catch(function(t){return o.statusBar.hideWaitingElementStatus(!1).then(function(){return new gs({isCommandResult:!0,executionError:t})})}).then(function(t){return o._waitForSkipJsErrorFunctionCompletion(t)}).then(function(t){o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!1),o.contextStorage.setItem(Gu,!1),o._onReady(t)})},oc.prototype._onSetNativeDialogHandlerCommand=function(t){this.nativeDialogsTracker.setHandler(t.dialogHandler),this._setNativeDialogHandlerInIframes(t.dialogHandler),this._onReady(new gs({isCommandResult:!0}))},oc.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new gs({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},oc.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new gs({isCommandResult:!0}))},oc.prototype._onNavigateToCommand=function(t){var e=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),function(i){return s(this,void 0,void 0,function(){var e,n,r;return C(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new _.ClientRequestEmitter,n=new _.RequestBarrier(e),c.navigateTo(i.url,i.forceReload),[4,c.Promise.all([n.wait(),_.pageUnloadBarrier.wait()])];case 1:return t.sent(),[2,new gs({isCommandResult:!0})];case 2:return r=t.sent(),[2,new gs({isCommandResult:!0,executionError:r})];case 3:return[2]}})})}(t).then(function(t){return e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e._onReady(t)})},oc.prototype._onGetProxyUrlCommand=function(t){this._onReady(new gs({isCommandResult:!0,result:Lu.getProxyUrl(t.url,t.options)}))},oc.prototype._onSkipJsErrorsCommand=function(t){var e=t.options;this.options.skipJsErrors=e,this._onReady(new gs({isCommandResult:!0}))},oc.prototype._onExecuteClientFunctionCommand=function(t){var e=this;this.contextStorage.setItem(Bu,{instantiationCallsiteName:t.instantiationCallsiteName}),cu(new ci(t)).then(function(t){e.contextStorage.setItem(Bu,null),e._onReady(t)})},oc.prototype._onExecuteSelectorCommand=function(t){var e,n,r,i,o,s,a,l=this,u=this.contextStorage.getItem(Vu)||new ku,c=la("CannotObtainInfoForElementSpecifiedBySelectorError"),d=t.strictError?la(aa()):c,h=t.strictError?la(sa()):c;e=t,n=this.options.selectorTimeout,r=u,i=t.needError?d:null,o=t.needError?h:null,s=this.statusBar,a=new Ta(e,n,r,i,o),s.showWaitingElementStatus(a.timeout),cu(a).then(function(t){return s.hideWaitingElementStatus(!!t.result).then(function(){return t})}).then(function(t){l.contextStorage.setItem(Vu,null),l._onReady(t)})},oc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t),this._onReady(new gs({isCommandResult:!0}))},oc.prototype._onSwitchToIframeCommand=function(t){var e=this;this._switchToIframe(t.selector,$u).then(function(){return e._onReady(new gs({isCommandResult:!0}))}).catch(function(t){return e._onReady(new gs({isCommandResult:!0,executionError:t}))})},oc.prototype._onWindowOpenCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!0),Ic.open(t.url)},oc.prototype._onWindowCloseCommand=function(a){return s(this,void 0,void 0,function(){var e,n,r,i,o,s;return C(this,function(t){switch(t.label){case 0:e=this._getTopOpenedWindow(),n=a.windowId||this.windowId,r=n===this.windowId,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,this._validateChildWindowCloseCommandExists(n,e)];case 2:if(i=t.sent(),!(o=i.result).success)throw oc._createWindowValidationError(o);return[4,ws(new ro({windowId:n,isCurrentWindow:r}),e,ys,tr)];case 3:return t.sent(),r||this._onReady(new gs({isCommandResult:!0})),[3,5];case 4:return s=t.sent(),this._onReady(new gs({isCommandResult:!0,executionError:s})),[3,5];case 5:return[2]}})})},oc.prototype._onGetCurrentWindowCommand=function(){this._onReady(new gs({isCommandResult:!0,result:{id:this.windowId}}))},oc.prototype._onGetWindowsCommand=function(){return s(this,void 0,void 0,function(){var e,n;return C(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,ws(new to,e,ys,tr)];case 1:return n=t.sent(),this._onReady(new gs({isCommandResult:!0,result:n.result})),[2]}})})},oc.prototype._validateChildWindowCloseCommandExists=function(t,e){return ws(new Yi({windowId:t}),e,ys,tr)},oc.prototype._validateChildWindowSwitchToWindowCommandExists=function(t,e){var n=t.windowId,r=t.fn;return ws(new $i({windowId:n,fn:r}),e,ys,tr)},oc.prototype._getTopOpenedWindow=function(){var t;return((null===(t=this.parentWindowDriverLink)||void 0===t?void 0:t.getTopOpenedWindow())||Ic).top},oc.prototype._onSwitchToWindow=function(i,o){return s(this,void 0,void 0,function(){var e,n,r;return C(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,this._validateChildWindowSwitchToWindowCommandExists({windowId:i.windowId,fn:i.checkWindow},e)];case 1:return n=t.sent(),(r=n.result).success?(this._stopInternal(),ws(new so({windowId:i.windowId,fn:i.checkWindow}),e,ys,tr)):this._onReady(new gs({isCommandResult:!0,executionError:o||oc._createWindowValidationError(r)})),[2]}})})},oc.prototype._restoreChildWindowLinks=function(){return s(this,void 0,void 0,function(){var e,n=this;return C(this,function(t){switch(t.label){case 0:if(!this.contextStorage.getItem(Ku))return[2];e=new Pu(function(t){n._restoreChildWindowsPromiseResolver=t}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,_.getTimeLimitedPromise(e,3e4)];case 2:return t.sent(),[3,4];case 3:return t.sent(),this._onReady(new gs({isCommandResult:!0,executionError:new Wr})),[3,4];case 4:return[2]}})})},oc.prototype._onSwitchToPreviousWindow=function(t){this._onSwitchToWindow(t,new Er)},oc.prototype._onSwitchToParentWindow=function(){this.parentWindowDriverLink?this._switchToParentWindow({finalizePendingCommand:!0}):this._onReady(new gs({isCommandResult:!0,executionError:new wr}))},oc.prototype._onBrowserManipulationCommand=function(t){var e,n,r,i=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),e=t,n=this.options.selectorTimeout,r=this.statusBar,new lu(e,n,r).execute().then(function(t){return i.contextStorage.setItem(i.COMMAND_EXECUTING_FLAG,!1),i._onReady(t)})},oc.prototype._onSetBreakpointCommand=function(t){var n=this,e=t.isTestError,r=t.inCompilerService,i=this.statusBar.showDebuggingStatus(e);r?(i.then(function(t){n.debug=t}),this._onReady(new gs({isCommandResult:!0,result:!0}))):i.then(function(t){var e=t===y;n._onReady(new gs({isCommandResult:!0,result:e}))})},oc.prototype._onDisableDebugCommand=function(){this.statusBar._resetState(),this._onReady(new gs({isCommandResult:!0}))},oc.prototype._onSetTestSpeedCommand=function(t){this.speed=t.speed,this._onReady(new gs({isCommandResult:!0}))},oc.prototype._onShowAssertionRetriesStatusCommand=function(t){this.contextStorage.setItem(Xu,t.timeout),this.contextStorage.setItem(Yu,Fu.dateNow()),this.statusBar.showWaitingAssertionRetriesStatus(t.timeout),this._onReady(new gs({isCommandResult:!0}))},oc.prototype._onHideAssertionRetriesStatusCommand=function(t){var e=this;this.contextStorage.setItem(Xu,null),this.contextStorage.setItem(Yu,null),this.statusBar.hideWaitingAssertionRetriesStatus(t.success).then(function(){return e._onReady(new gs({isCommandResult:!0}))})},oc.prototype._checkStatus=function(){var n=this,t={statusUrl:this.communicationUrls.statusDone};return _.browser.checkStatus(t,l.createNativeXHR,{manualRedirect:!0,proxyless:this.options.proxyless}).then(function(t){var e=t.command;e.testRunId!==n.testRunId?(Mu.clear(),Mu.lock(),_.browser.redirect(e,l.createNativeXHR,n.communicationUrls.openFileProtocolUrl)):(n.contextStorage.setItem(Uu,!1),n._onReady({isCommandResult:!1}))}).catch(function(){return _.delay(1e3)})},oc.prototype._onCustomCommand=function(t){var e=this;(0,this.customCommandHandlers[t.type].handler)(t).then(function(t){e._onReady(new gs({isCommandResult:!0,result:t}))})},oc.prototype._closeAllChildWindows=function(){var t=this;return this.childWindowDriverLinks.length?Pu.all(this.childWindowDriverLinks.map(function(t){return t.closeAllChildWindows()})).then(function(){Fu.arrayForEach.call(t.childWindowDriverLinks,function(t){t.driverWindow.close()})}):Pu.resolve()},oc.prototype._onTestDone=function(t){var e=this;this.contextStorage.setItem(Uu,!0),this.parentWindowDriverLink?this._switchToTopParentWindow():this._closeAllChildWindows().then(function(){return e._sendStatus(t)}).then(function(){e._checkStatus()}).catch(function(){e._onReady(new gs({isCommandResult:!0,executionError:rr}))})},oc.prototype._onBackupStoragesCommand=function(){this._onReady(new gs({isCommandResult:!0,result:Mu.backup()}))},oc.prototype._isPendingSwitchingWindow=function(){return!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},oc.prototype._onPrepareClientEnvironmentInDebugMode=function(t){Fu.objectDefineProperty(Ic,t.esmRuntime,{value:{g:Ic,c:Ic.eval},configurable:!0}),this._onReady(new gs({isCommandResult:!0,result:!0}))},oc.prototype._isStatusWithCommandResultInPendingWindowSwitchingMode=function(t){return t.isCommandResult&&this._isPendingSwitchingWindow()},oc.prototype._isEmptyCommandInPendingWindowSwitchingMode=function(t){return!t&&this._isPendingSwitchingWindow()},oc.prototype._observeFileDownloadingInNewWindow=function(){var e=this,t=new gs({isObservingFileDownloadingInNewWindow:!0});this._isPendingSwitchingWindow()&&this._sendStatus(t).then(function(t){t?e._onCommand(t):e._observeFileDownloadingInNewWindow()})},oc.prototype._onReady=function(t){var e=this;this.debug&&(t.debug=this.debug,this.debug=null),this._isStatusWithCommandResultInPendingWindowSwitchingMode(t)&&this.emit(tc),this._sendStatus(t).then(function(t){if(t)e._onCommand(t);else{if(e._isEmptyCommandInPendingWindowSwitchingMode(t))return void e.emit(ec);e._onReady(new gs)}})},oc.prototype._executeCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!1),this.customCommandHandlers[t.type]?this._onCustomCommand(t):t.type===h.testDone?this._onTestDone(new gs({isCommandResult:!0})):t.type===h.setBreakpoint?this._onSetBreakpointCommand(t):t.type===h.disableDebug?this._onDisableDebugCommand():t.type===h.switchToMainWindow?this._onSwitchToMainWindowCommand(t):t.type===h.switchToIframe?this._onSwitchToIframeCommand(t):t.type===h.openWindow?this._onWindowOpenCommand(t):t.type===h.closeWindow?this._onWindowCloseCommand(t):t.type===h.getCurrentWindow?this._onGetCurrentWindowCommand(t):t.type===h.getCurrentWindows?this._onGetWindowsCommand():t.type===h.switchToWindow?this._onSwitchToWindow(t):t.type===h.switchToPreviousWindow?this._onSwitchToPreviousWindow(t):t.type===h.switchToParentWindow?this._onSwitchToParentWindow():g(t)?this._onBrowserManipulationCommand(t):t.type===h.executeClientFunction?this._onExecuteClientFunctionCommand(t):t.type===h.executeSelector?this._onExecuteSelectorCommand(t):t.type===h.navigateTo?this._onNavigateToCommand(t):t.type===h.setNativeDialogHandler?this._onSetNativeDialogHandlerCommand(t):t.type===h.getNativeDialogHistory?this._onGetNativeDialogHistoryCommand(t):t.type===h.getBrowserConsoleMessages?this._onGetBrowserConsoleMessagesCommand(t):t.type===h.setTestSpeed?this._onSetTestSpeedCommand(t):t.type===h.showAssertionRetriesStatus?this._onShowAssertionRetriesStatusCommand(t):t.type===h.hideAssertionRetriesStatus?this._onHideAssertionRetriesStatusCommand(t):t.type===h.backupStorages?this._onBackupStoragesCommand():t.type===h.closeChildWindowOnFileDownloading?this._closeChildWindowOnFileDownloading():t.type===h.prepareClientEnvironmentInDebugMode?this._onPrepareClientEnvironmentInDebugMode(t):t.type===h.getProxyUrl?this._onGetProxyUrlCommand(t):t.type===h.skipJsErrors?this._onSkipJsErrorsCommand(t):this._onActionCommand(t)},oc.prototype._closeChildWindowOnFileDownloading=function(){this.activeChildWindowDriverLink.closeFileDownloadingWindow(),_.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),E.cursor.show(),this._startInternal()},oc.prototype._isExecutableInTopWindowOnly=function(t){if((e=t).type===h.testDone||e.type===h.switchToMainWindow||e.type===h.setNativeDialogHandler||e.type===h.getNativeDialogHistory||e.type===h.setTestSpeed||e.type===h.showAssertionRetriesStatus||e.type===h.hideAssertionRetriesStatus||e.type===h.setBreakpoint||g(e)&&e.type!==h.takeElementScreenshot)return!0;var e,n=this.customCommandHandlers[t.type];return t.forceExecutionInTopWindowOnly||n&&n.isExecutableInTopWindowOnly},oc.prototype._onCommand=function(n){var r=this;this.readyPromise.then(function(){var t,e=p(n);r.contextStorage.getItem(qu)&&e?r._onReady(new gs({isCommandResult:!0})):(t=r.activeChildIframeDriverLink||r.contextStorage.getItem(zu),r._isExecutableInTopWindowOnly(n)||!t?r._executeCommand(n):r._runInActiveIframe(n))})},oc.prototype.setCustomCommandHandlers=function(t,e,n){this.customCommandHandlers[t]={isExecutableInTopWindowOnly:n,handler:e}},oc.prototype._startInternal=function(t){this.role=gu,_.browser.startHeartbeat(this.communicationUrls.heartbeat,l.createNativeXHR),this._setupAssertionRetryIndication(),this._startCommandsProcessing(t)},oc.prototype._stopInternal=function(){this.role=vu,_.browser.stopHeartbeat(),E.cursor.hide()},oc.prototype._setupAssertionRetryIndication=function(){var n=this;this.readyPromise.then(function(){n.statusBar.hidePageLoadingStatus();var t,e=n.contextStorage.getItem(Xu);e&&(t=n.contextStorage.getItem(Yu),0<e-(new ku-t)&&n.statusBar.showWaitingAssertionRetriesStatus(e,t))})},oc.prototype._startCommandsProcessing=function(t){void 0===t&&(t={finalizePendingCommand:!1,isFirstRequestAfterWindowSwitching:!1,result:void 0});var e,n,r=this.contextStorage.getItem(Hu);r&&(r.resent=!0),this.contextStorage.getItem(Uu)?r?this._onTestDone(r):this._checkStatus():this._failIfClientCodeExecutionIsInterrupted()||(e=t.finalizePendingCommand||this._hasPendingActionFlags(this.contextStorage),n=r||new gs({isCommandResult:e,isFirstRequestAfterWindowSwitching:t.isFirstRequestAfterWindowSwitching,result:t.result}),this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!1),this._onReady(n))},oc.prototype._initParentWindowLink=function(){Ic.opener&&Ic.opener!==Ic&&this.windowId&&(this.parentWindowDriverLink=new fu(Ic))},oc.prototype._initConsoleMessages=function(){var t=this.consoleMessages;t.ensureMessageContainer(this.windowId),this.consoleMessages=t},oc.prototype._getDriverRole=function(){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return this.windowId?[4,_.browser.getActiveWindowId(this.communicationUrls.activeWindowId,l.createNativeXHR)]:[2,gu];case 1:return[2,t.sent().activeWindowId===this.windowId?gu:vu]}})})},oc.prototype._init=function(){var t=this.options,e=t.proxyless,n=t.dialogHandler,r=t.speed;this.contextStorage=new ns(Ic,{testRunId:this.testRunId,windowId:this.windowId,proxyless:e}),this.nativeDialogsTracker=new Ci(this.contextStorage,{proxyless:e,dialogHandler:n}),this.statusBar=new u.StatusBar(this.runInfo.userAgent,this.runInfo.fixtureName,this.runInfo.testName,this.contextStorage);var i=this;this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK,function(){i.options.proxyless||_.disableRealEventsPreventing()}),this.speed=r,this._initConsoleMessages(),this._initParentWindowLink(),this._isOpenedInIframe()&&ws(new Mo(this.windowId),Ic.opener.top,ys,mr)},oc.prototype._doFirstPageLoadSetup=function(){return s(this,void 0,void 0,function(){return C(this,function(t){return this.isFirstPageLoad&&this.options.canUseDefaultWindowActions,[2]})})},oc.prototype.start=function(){return s(this,void 0,void 0,function(){var e;return C(this,function(t){switch(t.label){case 0:return this._init(),[4,this._doFirstPageLoadSetup()];case 1:return t.sent(),[4,this._restoreChildWindowLinks()];case 2:return t.sent(),[4,this._getDriverRole()];case 3:return e=t.sent(),this.role===gu||e===gu&&this._startInternal(),[2]}})})},oc);function oc(t,e,n,r){var i=xu.call(this)||this;i.COMMAND_EXECUTING_FLAG="testcafe|driver|command-executing-flag",i.EXECUTING_IN_IFRAME_FLAG="testcafe|driver|executing-in-iframe-flag",i.PENDING_WINDOW_SWITCHING_FLAG="testcafe|driver|pending-window-switching-flag",i.WINDOW_COMMAND_API_CALL_FLAG="testcafe|driver|window-command-api-flag",i.testRunId=t,i.communicationUrls=e,i.runInfo=n,i.options=r,i.isFirstPageLoad=Ru.get().isFirstPageLoad,i.customCommandHandlers={},i.contextStorage=null,i.nativeDialogsTracker=null,i.childIframeDriverLinks=[],i.activeChildIframeDriverLink=null,i.childWindowDriverLinks=[],i.parentWindowDriverLink=null,i.statusBar=null,i.windowId=i._getCurrentWindowId(),i.role=vu,i.setAsMasterInProgress=!1,i.checkClosedChildWindowIntervalId=null;var o=new _.ClientRequestEmitter;return i.pageInitialRequestBarrier=new _.RequestBarrier(o),i.readyPromise=i._getReadyPromise(),i._initChildDriverListening(),_.pageUnloadBarrier.init(),i.options.proxyless||_.preventRealEvents(),l.on(l.EVENTS.uncaughtJsError,function(t){return i._onJsError(t)}),l.on(l.EVENTS.unhandledRejection,function(t){return i._onJsError(t)}),l.on(l.EVENTS.consoleMethCalled,function(t){return i._onConsoleMessage(t)}),l.on(l.EVENTS.beforeFormSubmit,function(t){return i._onFormSubmit(t)}),l.on(l.EVENTS.windowOpened,function(t){return i._onChildWindowOpened(t)}),i.setCustomCommandHandlers(h.unlockPage,function(){return i._unlockPageAfterTestIsDone()}),i.setCustomCommandHandlers(h.getActiveElement,function(){return i._getActiveElement()}),Ou.addInternalEventBeforeListener(Ic,["beforeunload"],function(){i._sendStartToRestoreCommand()}),i.replicator=Qr([new Qs]),i}var sc=(ac.prototype.establishConnection=function(){return ws(new zi,this.driverWindow,5e3,zn).then(function(t){return t.result})},ac.prototype.sendConfirmationMessage=function(t){_s({requestMsgId:t,window:this.driverWindow})},ac.prototype.onCommandExecuted=function(t){var e=new uo(t);c.eventSandbox.message.sendServiceMsg(e,this.driverWindow)},ac.prototype.hasPendingActionFlags=function(){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,ws(new Vo,this.driverWindow,5e3,zn)];case 1:return[2,t.sent().result]}})})},ac);function ac(t){this.driverWindow=t}var lc,uc=l.eventSandbox.message,cc=(t(dc,lc=Ci),dc.prototype._defaultDialogHandler=function(t){uc.sendServiceMsg({type:pi,dialogType:t,url:Ci._getPageUrl()},Ic.top)},dc.prototype._addAppearedDialogs=function(t,e){uc.sendServiceMsg({type:hi,dialogType:t,text:e,url:Ci._getPageUrl()},Ic.top)},dc.prototype._onHandlerError=function(t,e){uc.sendServiceMsg({type:fi,dialogType:t,message:e,url:Ci._getPageUrl()},Ic.top)},dc);function dc(t){return lc.call(this,null,t)||this}var hc,pc=c.eventSandbox.message,fc=(t(mc,hc=ic),mc.prototype._onJsError=function(){},mc.prototype._onConsoleMessage=function(){},mc.prototype._onChildWindowOpened=function(){pc.sendServiceMsg(new Oo,Ic.top)},mc.prototype._stopInternal=function(){pc.sendServiceMsg(new Ho,Ic.top)},mc.prototype._initParentDriverListening=function(){var n=this;c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;_.pageUnloadBarrier.wait(0).then(function(){if(e.type===Mi){if(n.lastParentDriverMessageId===e.id)return;n.lastParentDriverMessageId=e.id,n.readyPromise.then(function(){n.speed=e.testSpeed,n.leftTopPoint=e.leftTopPoint,n.parentDriverLink.sendConfirmationMessage(e.id),n._onCommand(e.command)})}e.type===ki&&(n.nativeDialogsTracker.setHandler(e.dialogHandler),n._setNativeDialogHandlerInIframes(e.dialogHandler))})})},mc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t)},mc.prototype._onReady=function(t){this.parentDriverLink.onCommandExecuted(t)},mc.prototype._isInCommandExecution=function(){return s(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return c.utils.dom.isCrossDomainWindows(Ic,Ic.parent)?[4,this.parentDriverLink.hasPendingActionFlags()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,this._hasPendingActionFlags(this.contextStorage)]}})})},mc.prototype._init=function(){return s(this,void 0,void 0,function(){var e,n,r;return C(this,function(t){switch(t.label){case 0:return[4,this.parentDriverLink.establishConnection()];case 1:return e=t.sent(),n=e.id,r=e.dispatchProxylessEventUrl,this.contextStorage=new ns(Ic,{testRunId:n,windowId:this.windowId,proxyless:this.options.proxyless}),this.communicationUrls.dispatchProxylessEvent=r,this._failIfClientCodeExecutionIsInterrupted()?[2]:[4,this._isInCommandExecution()];case 2:return t.sent()&&(this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this._onReady(new gs({isCommandResult:!0}))),[2]}})})},mc.prototype.start=function(){this.nativeDialogsTracker=new cc({dialogHandler:this.options.dialogHandler,proxyless:this.options.proxyless}),this.statusBar=new n.IframeStatusBar;var t=this._init();this.readyPromise=c.Promise.all([this.readyPromise,t])},mc);function mc(t,e){var n=hc.call(this,t,{},{},e)||this;return n.lastParentDriverMessageId=null,n.parentDriverLink=new sc(Ic.parent),n._initParentDriverListening(),n.leftTopPoint=new da(0,0),n}var gc={NodeSnapshot:Vs,ElementSnapshot:Ks,SelectorExecutor:Ta},vc="%testCafeDriver%",wc="%testCafeIframeDriver%",yc="%testCafeEmbeddingUtils%",_c=l.nativeMethods,Ec=l.EVENTS.evalIframeScript;_c.objectDefineProperty(Ic,vc,{configurable:!0,value:ic}),_c.objectDefineProperty(Ic,wc,{configurable:!0,value:fc}),_c.objectDefineProperty(Ic,yc,{configurable:!0,value:gc}),l.on(Ec,function(t){return Cc(_c.contentWindowGetter.call(t.iframe))})}(Ic["%hammerhead%"],Ic["%hammerhead%"].Promise,Ic["%testCafeCore%"],Ic["%testCafeAutomation%"],Ic["%testCafeUI%"])}(window); |