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