testcafe 1.14.1 → 1.14.2
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/CHANGELOG.md +6 -0
- package/LICENSE +21 -21
- package/bin/testcafe-with-v8-flag-filter.js +0 -0
- package/lib/api/exportable-lib/index.js +49 -49
- package/lib/api/request-hooks/assert-type.js +7 -7
- package/lib/api/request-hooks/hook-method-names.js +9 -9
- package/lib/api/request-hooks/hook.js +32 -32
- package/lib/api/request-hooks/interfaces.js +2 -2
- package/lib/api/request-hooks/request-logger.js +112 -112
- package/lib/api/request-hooks/request-mock/create-request-mock.js +10 -10
- package/lib/api/request-hooks/request-mock/index.js +44 -44
- package/lib/api/request-hooks/request-mock.js +46 -46
- package/lib/api/structure/base-unit.js +11 -11
- package/lib/api/structure/fixture.js +75 -75
- package/lib/api/structure/interfaces.js +2 -2
- package/lib/api/structure/test-file.js +31 -31
- package/lib/api/structure/test-timeout.js +9 -9
- package/lib/api/structure/test.js +85 -85
- package/lib/api/structure/testing-unit.js +89 -89
- package/lib/api/structure/unit-type.js +9 -9
- package/lib/api/test-controller/assertion.js +88 -88
- package/lib/api/test-controller/execution-context.js +82 -82
- package/lib/api/test-controller/index.js +358 -358
- package/lib/api/test-controller/proxy.js +28 -28
- package/lib/api/test-page-url.js +60 -60
- package/lib/api/test-run-tracker.js +68 -68
- package/lib/api/wrap-test-function.js +49 -49
- package/lib/assertions/executor.js +74 -74
- package/lib/assertions/get-fn.js +46 -46
- package/lib/assertions/type.js +20 -20
- package/lib/assets/content-types.js +9 -9
- package/lib/assets/injectables.js +18 -18
- package/lib/browser/connection/command.js +10 -10
- package/lib/browser/connection/error-hints.js +9 -9
- package/lib/browser/connection/gateway.js +159 -159
- package/lib/browser/connection/get-hints.js +33 -33
- package/lib/browser/connection/heartbeat-status.js +8 -8
- package/lib/browser/connection/index.js +328 -328
- package/lib/browser/connection/remotes-queue.js +46 -46
- package/lib/browser/connection/service-routes.js +12 -12
- package/lib/browser/connection/status.js +12 -12
- package/lib/browser/interfaces.js +2 -2
- package/lib/browser/provider/built-in/dedicated/base.js +80 -80
- package/lib/browser/provider/built-in/dedicated/chrome/browser-client.js +204 -204
- package/lib/browser/provider/built-in/dedicated/chrome/build-chrome-args.js +17 -17
- package/lib/browser/provider/built-in/dedicated/chrome/config.js +110 -110
- package/lib/browser/provider/built-in/dedicated/chrome/create-temp-profile.js +45 -45
- package/lib/browser/provider/built-in/dedicated/chrome/elapsed-upperbounds.js +15 -15
- package/lib/browser/provider/built-in/dedicated/chrome/index.js +102 -102
- package/lib/browser/provider/built-in/dedicated/chrome/interfaces.js +2 -2
- package/lib/browser/provider/built-in/dedicated/chrome/local-chrome.js +24 -24
- package/lib/browser/provider/built-in/dedicated/chrome/runtime-info.js +29 -29
- package/lib/browser/provider/built-in/dedicated/edge/index.js +10 -10
- package/lib/browser/provider/built-in/dedicated/edge/runtime-info.js +29 -29
- package/lib/browser/provider/built-in/dedicated/firefox/config.js +33 -33
- package/lib/browser/provider/built-in/dedicated/firefox/create-temp-profile.js +78 -78
- package/lib/browser/provider/built-in/dedicated/firefox/index.js +73 -73
- package/lib/browser/provider/built-in/dedicated/firefox/local-firefox.js +36 -36
- package/lib/browser/provider/built-in/dedicated/firefox/marionette-client/commands.js +13 -13
- package/lib/browser/provider/built-in/dedicated/firefox/marionette-client/index.js +200 -200
- package/lib/browser/provider/built-in/dedicated/firefox/runtime-info.js +17 -17
- package/lib/browser/provider/built-in/index.js +21 -21
- package/lib/browser/provider/built-in/locally-installed.js +30 -30
- package/lib/browser/provider/built-in/path.js +47 -47
- package/lib/browser/provider/built-in/remote.js +58 -58
- package/lib/browser/provider/index.js +303 -303
- package/lib/browser/provider/parse-provider-name.js +16 -16
- package/lib/browser/provider/plugin-host.js +121 -121
- package/lib/browser/provider/pool.js +115 -115
- package/lib/browser/provider/utils/argument-parsing.js +74 -74
- package/lib/browser/provider/utils/browser-starter.js +34 -34
- package/lib/browser/provider/utils/client-functions.js +24 -24
- package/lib/browser/provider/utils/get-maximized-headless-window-size.js +9 -9
- package/lib/cli/argument-parser.js +284 -284
- package/lib/cli/authentication-helper.js +35 -35
- package/lib/cli/cli.js +134 -134
- package/lib/cli/correct-browsers-and-sources.js +40 -40
- package/lib/cli/index.js +19 -19
- package/lib/cli/log.js +43 -43
- package/lib/cli/remotes-wizard.js +36 -36
- package/lib/cli/termination-handler.js +38 -38
- package/lib/client/automation/index.js +34 -16
- package/lib/client/automation/index.min.js +1 -1
- package/lib/client/browser/idle-page/index.html.mustache +35 -35
- package/lib/client/browser/idle-page/logo.svg +86 -86
- package/lib/client/core/index.js +14 -14
- package/lib/client/driver/index.js +46 -16
- package/lib/client/driver/index.min.js +1 -1
- package/lib/client/driver/internal-properties.js +9 -9
- package/lib/client/test-run/iframe.js.mustache +17 -17
- package/lib/client/test-run/index.js.mustache +51 -51
- package/lib/client/ui/index.js +14 -14
- package/lib/client/ui/sprite.svg +42 -42
- package/lib/client-functions/builder-symbol.js +4 -4
- package/lib/client-functions/client-function-builder.js +155 -155
- package/lib/client-functions/replicator.js +61 -61
- package/lib/client-functions/return-single-prop-mode.js +8 -8
- package/lib/client-functions/selector-api-execution-mode.js +20 -20
- package/lib/client-functions/selectors/add-api.js +645 -645
- package/lib/client-functions/selectors/create-snapshot-methods.js +13 -13
- package/lib/client-functions/selectors/prepare-api-args.js +20 -20
- package/lib/client-functions/selectors/selector-attribute-filter.js +22 -22
- package/lib/client-functions/selectors/selector-builder.js +153 -153
- package/lib/client-functions/selectors/selector-text-filter.js +43 -43
- package/lib/client-functions/selectors/snapshot-properties.js +48 -48
- package/lib/client-functions/types.js +18 -18
- package/lib/compiler/babel/format-babel-produced-code.js +10 -10
- package/lib/compiler/babel/get-base-babel-options.js +11 -11
- package/lib/compiler/babel/load-libs.js +63 -63
- package/lib/compiler/babel/preset-stage-2.js +19 -19
- package/lib/compiler/compile-client-function.js +73 -73
- package/lib/compiler/compilers.js +33 -33
- package/lib/compiler/index.js +92 -92
- package/lib/compiler/interfaces.js +2 -2
- package/lib/compiler/test-file/api-based.js +146 -146
- package/lib/compiler/test-file/base.js +36 -36
- package/lib/compiler/test-file/exportble-lib-path.js +5 -5
- package/lib/compiler/test-file/formats/coffeescript/compiler.js +38 -38
- package/lib/compiler/test-file/formats/coffeescript/get-test-list.js +29 -29
- package/lib/compiler/test-file/formats/es-next/compiler.js +42 -42
- package/lib/compiler/test-file/formats/es-next/get-test-list.js +166 -166
- package/lib/compiler/test-file/formats/es-next/is-flow-code.js +7 -7
- package/lib/compiler/test-file/formats/raw.js +85 -85
- package/lib/compiler/test-file/formats/typescript/compiler.js +135 -135
- package/lib/compiler/test-file/formats/typescript/get-test-list.js +185 -185
- package/lib/compiler/test-file/test-file-parser-base.js +214 -214
- package/lib/configuration/configuration-base.js +165 -165
- package/lib/configuration/constants.js +9 -9
- package/lib/configuration/customizable-compilers.js +7 -7
- package/lib/configuration/default-values.js +51 -51
- package/lib/configuration/interfaces.js +2 -2
- package/lib/configuration/option-names.js +53 -53
- package/lib/configuration/option-source.js +9 -9
- package/lib/configuration/option.js +14 -14
- package/lib/configuration/quarantine-option-names.js +8 -8
- package/lib/configuration/run-option-names.js +26 -26
- package/lib/configuration/screenshot-option-names.js +10 -10
- package/lib/configuration/testcafe-configuration.js +163 -163
- package/lib/configuration/types.js +2 -2
- package/lib/configuration/typescript-configuration.js +62 -62
- package/lib/custom-client-scripts/assert-type.js +7 -7
- package/lib/custom-client-scripts/client-script-init.js +2 -2
- package/lib/custom-client-scripts/client-script.js +106 -106
- package/lib/custom-client-scripts/get-code.js +11 -11
- package/lib/custom-client-scripts/get-url.js +6 -6
- package/lib/custom-client-scripts/load.js +15 -15
- package/lib/custom-client-scripts/problematic-scripts.js +2 -2
- package/lib/custom-client-scripts/routing.js +36 -36
- package/lib/custom-client-scripts/utils.js +60 -60
- package/lib/embedding-utils.js +83 -83
- package/lib/errors/create-stack-filter.js +18 -18
- package/lib/errors/error-list.js +26 -26
- package/lib/errors/get-callsite.js +31 -31
- package/lib/errors/internal-modules-prefix.js +8 -8
- package/lib/errors/is-internal-stack-frame.js +45 -45
- package/lib/errors/process-test-fn-error.js +37 -37
- package/lib/errors/runtime/index.js +123 -123
- package/lib/errors/runtime/templates.js +115 -115
- package/lib/errors/runtime/type-assertions.js +112 -112
- package/lib/errors/stack-cleaning-hook.js +64 -64
- package/lib/errors/test-run/formattable-adapter.js +59 -59
- package/lib/errors/test-run/index.js +301 -301
- package/lib/errors/test-run/render-error-template.js +31 -31
- package/lib/errors/test-run/templates.js +91 -91
- package/lib/errors/test-run/utils.js +89 -89
- package/lib/errors/types.js +156 -156
- package/lib/index.js +81 -81
- package/lib/live/bootstrapper.js +43 -43
- package/lib/live/controller.js +107 -107
- package/lib/live/file-watcher/index.js +67 -67
- package/lib/live/file-watcher/modules-graph.js +58 -58
- package/lib/live/keyboard-observer.js +76 -76
- package/lib/live/logger/index.js +64 -64
- package/lib/live/test-run-controller.js +96 -96
- package/lib/live/test-run-state.js +6 -6
- package/lib/live/test-run.js +56 -56
- package/lib/live/test-runner.js +167 -167
- package/lib/load-assets.js +29 -29
- package/lib/notifications/add-rendered-warning.js +16 -16
- package/lib/notifications/debug-logger.js +78 -78
- package/lib/notifications/deprecated.js +24 -24
- package/lib/notifications/information-message.js +9 -9
- package/lib/notifications/warning-log.js +31 -31
- package/lib/notifications/warning-message.js +47 -47
- package/lib/reporter/command/command-formatter.js +120 -109
- package/lib/reporter/command/format-command.js +8 -8
- package/lib/reporter/command/interfaces.js +2 -2
- package/lib/reporter/index.js +319 -314
- package/lib/reporter/interfaces.js +2 -2
- package/lib/reporter/plugin-host.js +135 -135
- package/lib/reporter/plugin-methods.js +12 -12
- package/lib/role/index.js +74 -74
- package/lib/role/marker-symbol.js +7 -7
- package/lib/role/phase.js +9 -9
- package/lib/runner/bootstrapper.js +271 -271
- package/lib/runner/browser-job-result.js +9 -9
- package/lib/runner/browser-job.js +152 -152
- package/lib/runner/browser-set.js +114 -114
- package/lib/runner/fixture-hook-controller.js +85 -85
- package/lib/runner/index.js +449 -449
- package/lib/runner/interfaces.js +2 -2
- package/lib/runner/reporter-stream-controller.js +27 -27
- package/lib/runner/task/index.js +151 -151
- package/lib/runner/task/phase.js +9 -9
- package/lib/runner/test-run-controller.js +165 -165
- package/lib/runner/tested-app.js +72 -72
- package/lib/screenshots/capturer.js +141 -141
- package/lib/screenshots/constants.js +11 -11
- package/lib/screenshots/crop.js +111 -111
- package/lib/screenshots/default-extension.js +4 -4
- package/lib/screenshots/index.js +67 -67
- package/lib/screenshots/utils.js +39 -39
- package/lib/services/compiler/host.js +190 -190
- package/lib/services/compiler/io.js +9 -9
- package/lib/services/compiler/protocol.js +17 -16
- package/lib/services/compiler/service.js +225 -212
- package/lib/services/compiler/test-run-proxy.js +111 -111
- package/lib/services/interfaces.js +2 -2
- package/lib/services/process-title.js +8 -8
- package/lib/services/serialization/prepare-options.js +17 -17
- package/lib/services/serialization/replicator/create-replicator.js +25 -25
- package/lib/services/serialization/replicator/custom-error-transform.js +26 -26
- package/lib/services/serialization/test-structure.js +92 -92
- package/lib/services/utils/ipc/interfaces.js +30 -30
- package/lib/services/utils/ipc/io.js +108 -108
- package/lib/services/utils/ipc/message.js +75 -75
- package/lib/services/utils/ipc/packet.js +55 -55
- package/lib/services/utils/ipc/proxy.js +109 -109
- package/lib/services/utils/ipc/transport.js +64 -64
- package/lib/shared/errors/index.js +382 -382
- package/lib/shared/node-modules-folder-name.js +4 -4
- package/lib/test-run/bookmark.js +90 -90
- package/lib/test-run/browser-console-messages.js +73 -73
- package/lib/test-run/browser-manipulation-queue.js +92 -92
- package/lib/test-run/client-messages.js +9 -9
- package/lib/test-run/commands/actions.js +486 -483
- package/lib/test-run/commands/assertion.js +45 -45
- package/lib/test-run/commands/base.js +14 -14
- package/lib/test-run/commands/browser-manipulation.js +95 -95
- package/lib/test-run/commands/from-object.js +82 -82
- package/lib/test-run/commands/observation.js +61 -61
- package/lib/test-run/commands/options.js +231 -215
- package/lib/test-run/commands/service.js +54 -48
- package/lib/test-run/commands/type.js +65 -64
- package/lib/test-run/commands/utils.js +87 -87
- package/lib/test-run/commands/validations/argument.js +90 -90
- package/lib/test-run/commands/validations/factories.js +47 -47
- package/lib/test-run/commands/validations/initializers.js +44 -44
- package/lib/test-run/debug-log.js +32 -32
- package/lib/test-run/execute-js-expression.js +74 -74
- package/lib/test-run/index.js +823 -799
- package/lib/test-run/marker-symbol.js +7 -7
- package/lib/test-run/observed-callsites-storage.js +17 -17
- package/lib/test-run/phase.js +16 -16
- package/lib/test-run/session-controller.js +104 -104
- package/lib/testcafe.js +118 -118
- package/lib/utils/assignable.js +39 -39
- package/lib/utils/async-event-emitter.js +28 -28
- package/lib/utils/async-queue.js +14 -14
- package/lib/utils/browser-connection-timeouts.js +19 -19
- package/lib/utils/callsite.js +17 -17
- package/lib/utils/check-file-path.js +31 -31
- package/lib/utils/check-url.js +51 -51
- package/lib/utils/convert-to-best-fit-type.js +16 -16
- package/lib/utils/correct-file-path.js +21 -21
- package/lib/utils/define-lazy-property.js +13 -13
- package/lib/utils/delay.js +6 -6
- package/lib/utils/delegated-api.js +44 -44
- package/lib/utils/detect-display.js +6 -6
- package/lib/utils/detect-ffmpeg.js +44 -44
- package/lib/utils/diff/colors.js +29 -29
- package/lib/utils/diff/index.js +52 -52
- package/lib/utils/diff/util.js +23 -23
- package/lib/utils/diff.js +29 -29
- package/lib/utils/escape-user-agent.js +10 -10
- package/lib/utils/flag-list.js +17 -17
- package/lib/utils/get-any-key.js +8 -8
- package/lib/utils/get-browser.js +8 -8
- package/lib/utils/get-common-path.js +34 -34
- package/lib/utils/get-filter-fn.js +40 -40
- package/lib/utils/get-options/base.js +36 -36
- package/lib/utils/get-options/compiler.js +33 -33
- package/lib/utils/get-options/grep.js +15 -15
- package/lib/utils/get-options/index.js +20 -20
- package/lib/utils/get-options/meta.js +22 -22
- package/lib/utils/get-options/quarantine.js +91 -91
- package/lib/utils/get-options/screenshot.js +17 -17
- package/lib/utils/get-options/ssl.js +45 -45
- package/lib/utils/get-options/video.js +10 -10
- package/lib/utils/get-viewport-width.js +17 -17
- package/lib/utils/guard-time-execution.js +10 -10
- package/lib/utils/handle-errors.js +74 -74
- package/lib/utils/handle-tag-args.js +8 -8
- package/lib/utils/http.js +30 -30
- package/lib/utils/is-localhost.js +11 -11
- package/lib/utils/is-password-input.js +11 -0
- package/lib/utils/is-repl.js +10 -10
- package/lib/utils/is-window-in-iframe.js +6 -6
- package/lib/utils/limit-number.js +10 -10
- package/lib/utils/make-reg-exp.js +7 -7
- package/lib/utils/moment-loader.js +20 -20
- package/lib/utils/parse-file-list.js +71 -71
- package/lib/utils/parse-user-agent.js +55 -55
- package/lib/utils/path-pattern.js +114 -114
- package/lib/utils/prepare-reporters.js +30 -30
- package/lib/utils/prerender-callsite.js +18 -18
- package/lib/utils/process.js +119 -119
- package/lib/utils/promisified-functions.js +46 -46
- package/lib/utils/re-executable-promise.js +39 -39
- package/lib/utils/render-callsite-sync.js +29 -29
- package/lib/utils/render-template.js +9 -9
- package/lib/utils/reporter.js +30 -30
- package/lib/utils/resolve-path-relatively-cwd.js +7 -7
- package/lib/utils/string.js +105 -105
- package/lib/utils/temp-directory/cleanup-process/commands.js +7 -7
- package/lib/utils/temp-directory/cleanup-process/index.js +143 -143
- package/lib/utils/temp-directory/cleanup-process/worker.js +58 -58
- package/lib/utils/temp-directory/index.js +87 -87
- package/lib/utils/temp-directory/lockfile.js +56 -56
- package/lib/utils/thennable.js +7 -7
- package/lib/utils/timer.js +15 -15
- package/lib/utils/to-posix-path.js +8 -8
- package/lib/utils/types.js +2 -2
- package/lib/video-recorder/interfaces.js +2 -2
- package/lib/video-recorder/process.js +126 -126
- package/lib/video-recorder/recorder.js +136 -136
- package/lib/video-recorder/test-run-video-recorder.js +69 -69
- package/lib/video-recorder/videos.js +37 -37
- package/package.json +2 -2
- package/ts-defs/index.d.ts +25 -14
- package/ts-defs/selectors.d.ts +16 -5
- package/ts-defs/testcafe-scripts.d.ts +17 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
window["%hammerhead%"].utils.removeInjectedScript(),function Pc(Ac){var Dc=Ac.document;!function(l,e,y,_,n){var o="default"in l?l.default:l;e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t="default"in y?y.default:y,i="default"in n?n.default:n,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function c(t,s,a,l){return new(a=a||e)(function(n,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(r,i)}o((l=l.apply(t,s||[])).next())})}function u(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;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 a,d,h=Math.floor(399);(d=a=a||{}).ready="ready",d.readyForBrowserManipulation="ready-for-browser-manipulation",d.waitForFileDownload="wait-for-file-download";var f=a,m={dispatchEvent:"dispatch-event",click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",scroll:"scroll",scrollBy:"scroll-by",scrollIntoView:"scroll-into-view",typeText:"type-text",selectText:"select-text",selectTextAreaContent:"select-text-area-content",selectEditableContent:"select-editable-content",pressKey:"press-key",wait:"wait",navigateTo:"navigate-to",setFilesToUpload:"set-files-to-upload",clearUpload:"clear-upload",executeClientFunction:"execute-client-function",executeSelector:"execute-selector",takeScreenshot:"take-screenshot",takeElementScreenshot:"take-element-screenshot",takeScreenshotOnFail:"take-screenshot-on-fail",prepareBrowserManipulation:"prepare-browser-manipulation",showAssertionRetriesStatus:"show-assertion-retries-status",hideAssertionRetriesStatus:"hide-assertion-retries-status",setBreakpoint:"set-breakpoint",resizeWindow:"resize-window",resizeWindowToFitDevice:"resize-window-to-fit-device",maximizeWindow:"maximize-window",switchToIframe:"switch-to-iframe",switchToMainWindow:"switch-to-main-window",openWindow:"open-window",closeWindow:"close-window",getCurrentWindow:"get-current-window",getCurrentWindows:"get-current-windows",switchToWindow:"switch-to-window",switchToWindowByPredicate:"switch-to-window-by-predicate",switchToParentWindow:"switch-to-parent-window",switchToPreviousWindow:"switch-to-previous-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",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",recorder:"recorder"},p="E1",g="E4",v="E5",w="E9",E="E10",C="E11",S="E12",I="E24",T="E26",x="E27",b="E28",W="E29",M="E30",P="E31",A="E32",D="E33",R="E34",N="E35",k="E36",F="E37",L="E39",U="E40",O="E41",B="E42",H="E43",G="E44",V="E45",X="E46",Y="E49",z="E50",j="E51",q="E52",K="E57",J="E64",$="E65",Q="E68",Z="E69",tt="E70",et="E71",nt="E72",rt="E73",it="E74",ot="E76",st="E77",at="E78",lt="E82",ct="E83";function ut(t){return!(function(t){return t.type===m.executeClientFunction||t.type===m.executeSelector}(r=t)||r.type===m.wait||r.type===m.assertion||r.type===m.executeExpression||ht(t)||(n=t).type===m.testDone||n.type===m.showAssertionRetriesStatus||n.type===m.hideAssertionRetriesStatus||n.type===m.setBreakpoint||n.type===m.takeScreenshotOnFail||n.type===m.recorder)||dt(t)&&!((e=t).type===m.switchToIframe||e.type===m.switchToMainWindow);var e,n,r}function dt(t){return t.type===m.resizeWindow||t.type===m.resizeWindowToFitDevice||t.type===m.maximizeWindow}function ht(t){return(e=t).type===m.takeScreenshot||e.type===m.takeElementScreenshot||e.type===m.takeScreenshotOnFail||dt(t);var e}function ft(t){this.code=t,this.isTestCafeError=!0,this.callsite=null}var mt,pt=(s(gt,mt=ft),gt);function gt(t,e,n){var r=mt.call(this,t)||this;return r.optionName=e,r.actualValue=n,r}var vt,wt=(s(yt,vt=ft),yt);function yt(t){var e=vt.call(this,Y)||this;return e.instantiationCallsiteName=t,e}var _t,Et=(s(Ct,_t=ft),Ct);function Ct(t){var e=_t.call(this,z)||this;return e.instantiationCallsiteName=t,e}var St,It=(s(Tt,St=ft),Tt);function Tt(t,e){var n=e.apiFnChain,r=e.apiFnIndex,i=St.call(this,t)||this;return i.apiFnChain=n,i.apiFnIndex=r,i}var xt,bt=(s(Wt,xt=ft),Wt);function Wt(){return xt.call(this,j)||this}var Mt,Pt=(s(At,Mt=It),At);function At(t,e){var n=Mt.call(this,q,e)||this;return n.callsite=t,n}var Dt,Rt=(s(Nt,Dt=ft),Nt);function Nt(t,e){var n=Dt.call(this,p)||this;return n.errStack=t,n.pageDestUrl=e,n}var kt,Ft=(s(Lt,kt=ft),Lt);function Lt(t,e){var n=kt.call(this,g)||this;return n.errMsg=String(e),n.instantiationCallsiteName=t,n}var Ut,Ot=(s(Bt,Ut=ft),Bt);function Bt(t,e,n){var r=Ut.call(this,v,e,n)||this;return r.errMsg=String(e),r.property=n,r.instantiationCallsiteName=t,r}var Ht,Gt=(s(Vt,Ht=ft),Vt);function Vt(t){var e=Ht.call(this,J)||this;return e.errMsg=String(t),e}var Xt,Yt=(s(zt,Xt=ft),zt);function zt(t,e){var n=Xt.call(this,$)||this;return n.errMsg=String(t),n.moduleName=e,n}var jt,qt=(s(Kt,jt=pt),Kt);function Kt(t,e){return jt.call(this,w,t,e)||this}var Jt,$t=(s(Qt,Jt=pt),Qt);function Qt(t,e){return Jt.call(this,E,t,e)||this}var Zt,te=(s(ee,Zt=pt),ee);function ee(t,e){return Zt.call(this,C,t,e)||this}var ne,re=(s(ie,ne=pt),ie);function ie(t,e){return ne.call(this,S,t,e)||this}var oe,se=(s(ae,oe=It),ae);function ae(t){return oe.call(this,I,t)||this}var le,ce=(s(ue,le=ft),ue);function ue(){return le.call(this,T)||this}var de,he=(s(fe,de=ft),fe);function fe(t){var e=de.call(this,x)||this;return e.nodeDescription=t,e}var me,pe=(s(ge,me=It),ge);function ge(t,e){var n=me.call(this,b,e)||this;return n.argumentName=t,n}var ve,we=(s(ye,ve=ft),ye);function ye(t){var e=ve.call(this,W)||this;return e.argumentName=t,e}var _e,Ee=(s(Ce,_e=ft),Ce);function Ce(t,e){var n=_e.call(this,M)||this;return n.argumentName=t,n.nodeDescription=e,n}var Se,Ie=(s(Te,Se=ft),Te);function Te(){return Se.call(this,P)||this}var xe,be=(s(We,xe=ft),We);function We(){return xe.call(this,A)||this}var Me,Pe=(s(Ae,Me=ft),Ae);function Ae(t){var e=Me.call(this,D)||this;return e.argumentName=t,e}var De,Re=(s(Ne,De=ft),Ne);function Ne(){return De.call(this,N)||this}var ke,Fe=(s(Le,ke=ft),Le);function Le(t){var e=ke.call(this,k)||this;return e.argumentName=t,e}var Ue,Oe=(s(Be,Ue=ft),Be);function Be(t,e){var n=Ue.call(this,F)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var He,Ge=(s(Ve,He=ft),Ve);function Ve(){return He.call(this,R)||this}var Xe,Ye=(s(ze,Xe=ft),ze);function ze(t,e){var n=Xe.call(this,O)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}var je,qe=(s(Ke,je=ft),Ke);function Ke(t,e){var n=je.call(this,K)||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 Je,$e=(s(Qe,Je=ft),Qe);function Qe(){return Je.call(this,U)||this}var Ze,tn=(s(en,Ze=ft),en);function en(){return Ze.call(this,L)||this}var nn,rn=(s(on,nn=ft),on);function on(){return nn.call(this,B)||this}var sn,an=(s(ln,sn=ft),ln);function ln(){return sn.call(this,Z)||this}var cn,un=(s(dn,cn=ft),dn);function dn(){return cn.call(this,Q)||this}var hn,fn=(s(mn,hn=ft),mn);function mn(){return hn.call(this,tt)||this}var pn,gn=(s(vn,pn=ft),vn);function vn(){return pn.call(this,et)||this}var wn,yn=(s(_n,wn=ft),_n);function _n(){return wn.call(this,rt)||this}var En,Cn,Sn=(s(In,En=ft),In);function In(){return En.call(this,lt)||this}function Tn(t){var e=Cn.call(this,at)||this;return e.errMsg=t,e}s(Tn,Cn=ft);var xn,bn=(s(Wn,xn=ft),Wn);function Wn(){return xn.call(this,it)||this}var Mn,Pn=(s(An,Mn=ft),An);function An(){return Mn.call(this,ot)||this}var Dn,Rn=(s(Nn,Dn=ft),Nn);function Nn(){return Dn.call(this,st)||this}var kn,Fn=(s(Ln,kn=ft),Ln);function Ln(){return kn.call(this,nt)||this}var Un,On=(s(Bn,Un=ft),Bn);function Bn(){return Un.call(this,ct)||this}var Hn,Gn=(s(Vn,Hn=ft),Vn);function Vn(){return Hn.call(this,H)||this}var Xn,Yn=(s(zn,Xn=ft),zn);function zn(){return Xn.call(this,G)||this}var jn,qn=(s(Kn,jn=ft),Kn);function Kn(t,e){var n=jn.call(this,V)||this;return n.dialogType=t,n.pageUrl=e,n}var Jn,$n=(s(Qn,Jn=ft),Qn);function Qn(t,e,n){var r=Jn.call(this,X)||this;return r.dialogType=t,r.errMsg=e,r.pageUrl=n,r}var Zn="_nativeMethods",tr=(er.prototype._ensureNativeMethods=function(t){return t||{objectKeys:Object.keys,arrayForEach:Array.prototype.forEach,arrayConcat:Array.prototype.concat,arraySlice:Array.prototype.slice,objectDefineProperty:Object.defineProperty}},er.prototype._getWindowIds=function(t){return this[Zn].objectKeys(t)},er.prototype._copyArray=function(t){return this[Zn].arraySlice.call(t)},er.prototype._concatArrays=function(t,e){return this[Zn].arrayConcat.call(t,e)},er.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},er.prototype.concat=function(e){var n=this;if(!e)return this;var t=this._getWindowIds(e);return this[Zn].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},er.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},er.prototype.getCopy=function(){var e=this,n={},t=this._getWindowIds(this);return this[Zn].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},er);function er(t,e){var n=this._ensureNativeMethods(e);n.objectDefineProperty(this,Zn,{value:n}),this.concat(t)}var nr,rr=(s(ir,nr=tr),ir);function ir(t){return nr.call(this,t,l.nativeMethods)||this}var or=(sr.prototype._getAssignableProperties=function(){throw new Error("Not implemented")},sr.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t)for(var r=this._getAssignableProperties(),i=0;i<r.length;i++){for(var o,s=r[i],a=s.name,l=s.type,c=s.required,u=s.init,d=s.defaultValue,h=a.split("."),f=h.length-1,m=h[f],p=t,g=this,v=0;v<f&&p&&g;v++)p=p[h[v]],g=g[h[v]];g&&"defaultValue"in r[i]&&(g[a]=d),p&&g&&(void 0===(o=p[m])&&!c||(e&&l&&l(a,o),g[m]=u?u(a,o,n):o))}},sr);function sr(){}function ar(){return l.nativeMethods.performanceNow().toString()}var lr,cr=(s(ur,lr=or),ur.prototype._getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isFirstRequestAfterWindowSwitching"}]},ur);function ur(t){var e=lr.call(this,t)||this;return e.id=ar(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isFirstRequestAfterWindowSwitching=!1,e._assignFrom(t,!0),e}var dr,hr=(function(t){function r(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,i=(0,eval)("this"),n="function"==typeof ArrayBuffer,s="function"==typeof Map,a="function"==typeof Set,l=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],c=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function u(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}r._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},r.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},r.prototype._applyTransform=function(t,e,n,r){var i=Object.create(null),o=r.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),i["@t"]=r.type,i.data=this._handleValue(o,e,n),i},r.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},r.prototype._handlePlainObject=function(n){var r=this,i=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;i[e]=r._handleValue(n[t],i,e)}),i},r.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},r.prototype._ensureCircularReference=function(t){var e=this.circularCandidates.indexOf(t);if(-1<e){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),r._createRefMark(n.refIdx)}return null},r.prototype._handleValue=function(t,e,n){var r=typeof t,i="object"==r&&null!==t;if(i){var o=this._ensureCircularReference(t);if(o)return o}for(var s=0;s<this.transforms.length;s++){var a=this.transforms[s];if(a.shouldTransform(r,t))return this._applyTransform(t,e,n,a)}return i?this._handleObject(t,e,n):t},r.prototype.transform=function(){for(var t=[this._handleValue(this.references,null,null)],e=0;e<this.circularCandidatesDescrs.length;e++){var n=this.circularCandidatesDescrs[e];0<n.refIdx&&(t[n.refIdx]=n.parent[n.key],n.parent[n.key]=r._createRefMark(n.refIdx))}return t},u.prototype._handlePlainObject=function(e){var t,n=this,r=Object.create(null),i=Object.getOwnPropertyNames(e);for(t in i.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(r[t.substring(1)]=e[t],delete e[t])}),r)e[t]=r[t]},u.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)},u.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}})},u.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])},u.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)}},u.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var d=[{type:"[[NaN]]",shouldTransform:function(t,e){return"number"===t&&isNaN(e)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",shouldTransform:function(t,e){return e instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var e=new Date;return e.setTime(t),e}},{type:"[[RegExp]]",shouldTransform:function(t,e){return e instanceof RegExp},toSerializable:function(t){var e={src:t.source,flags:""};return t.global&&(e.flags+="g"),t.ignoreCase&&(e.flags+="i"),t.multiline&&(e.flags+="m"),e},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",shouldTransform:function(t,e){return e instanceof Error},toSerializable:function(t){return{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var e=new(i[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return n&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return c.call(e)},fromSerializable:function(t){if(n){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){for(var n=0;n<l.length;n++){var r=l[n];if("function"==typeof i[r]&&e instanceof i[r])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:c.call(t)}},fromSerializable:function(t){return"function"==typeof i[t.ctorName]?new i[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return s&&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(s){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var r=[],i=0;i<t.length;i+=2)r.push([t[n],t[n+1]]);return r}},{type:"[[Set]]",shouldTransform:function(t,e){return a&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(a){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],h=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(d)};h.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},h.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},h.prototype.encode=function(t){var e=new r(t,this.transforms).transform();return this.serializer.serialize(e)},h.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new u(e,this.transformsMap).transform()}}(dr={exports:{}}),dr.exports);function fr(t,e){return new l.nativeMethods.Function("fnCode","__dependencies$","Promise","RegExp",'"use strict"; return eval(fnCode)')(t,e,l.Promise,RegExp)}var mr=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],pr=["tagName","attributes"],gr=["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"],vr={textContent:function(t){return t.textContent},childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!vr.childNodeCount(t)},childElementCount:function(t){var e=t.children;if(e)return e.length;for(var n=0,r=t.childNodes.length,i=0;i<r;i++)1===t.childNodes[i].nodeType&&n++;return n},hasChildElements:function(t){return!!vr.childElementCount(t)}},wr=(yr.prototype._initializeProperties=function(t,e,n){for(var r=0;r<e.length;r++){var i=e[r],o=n[i];this[i]=o?o(t):t[i]}},yr);function yr(){}var _r,Er=(s(Cr,_r=wr),Cr);function Cr(t){var e=_r.call(this)||this;return e._initializeProperties(t,mr,vr),e}var Sr,Ir={tagName:function(t){return t.tagName.toLowerCase()},visible:y.positionUtils.isElementVisible,focused:function(t){return y.domUtils.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(e="string"==typeof e.animVal?e.animVal:e).replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=Ac.getComputedStyle(t),r=0;r<n.length;r++){var i=n[r];e[i]=n[i]}return e},innerText:function(t){return t.innerText}},Tr=(s(xr,Sr=wr),xr);function xr(t){var e=Sr.call(this,t)||this;return e._initializeProperties(t,pr,Ir),e}var br,Wr=(s(Mr,br=Er),Mr);function Mr(t){var e=br.call(this,t)||this;return e._initializeProperties(t,gr,Ir),e}function Pr(t){return t}var Ar=Ac.Node;function Dr(t){return new hr({serialize:Pr,deserialize:Pr}).addTransforms(t)}var Rr=(Nr.prototype.shouldTransform=function(t){return"function"===t},Nr.prototype.toSerializable=function(){return""},Nr.prototype.fromSerializable=function(t){return fr(t.fnCode,t.dependencies)},Nr);function Nr(){this.type="Function"}var kr=(Fr.prototype.shouldTransform=function(t,e){return e instanceof Ar},Fr.prototype.toSerializable=function(t){return new Tr(t)},Fr);function Fr(){this.type="Node"}var Lr=(Ur.prototype._extend=function(t,n){var r=this;o.nativeMethods.objectKeys.call(Ac.Object,this.customDOMProperties).forEach(function(e){try{t[e]=r.customDOMProperties[e](n)}catch(t){throw new Ot(r.instantiationCallsiteName,t,e)}})},Ur.prototype.shouldTransform=function(t,e){return e instanceof Ar},Ur.prototype.toSerializable=function(t){var e=new(1===t.nodeType?Wr:Er)(t);return this._extend(e,t),e},Ur);function Ur(t){this.type="Node",this.customDOMProperties=t||{}}var Or=(Br.prototype.shouldTransform=function(t,e){if(e instanceof Ar)throw new Et(this.instantiationCallsiteName)},Br);function Br(t){this.type="Node",this.instantiationCallsiteName=t}var Hr=(Gr.prototype.getResult=function(){var e=this;return l.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new Ft(e.command.instantiationCallsiteName,t)),t})},Gr.prototype.getResultDriverStatus=function(){var e=this;return this.getResult().then(function(t){return new cr({isCommandResult:!0,result:e.replicator.encode(t)})}).catch(function(t){return new cr({isCommandResult:!0,executionError:t})})},Gr.prototype._createReplicator=function(){return Dr([new Or(this.command.instantiationCallsiteName),new Rr])},Gr.prototype._executeFn=function(t){return this.fn.apply(Ac,t)},Gr);function Gr(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(this.command.dependencies),this.fn=fr(this.command.fnCode,this.dependencies)}var Vr="appeared-dialog",Xr="unexpected-dialog",Yr="handler-error",zr=o.eventSandbox.message,jr=o.processScript,qr=o.nativeMethods,Kr="testcafe|native-dialog-tracker|appeared-dialogs",Jr="testcafe|native-dialog-tracker|unexpected-dialog",$r="testcafe|native-dialog-tracker|error-in-handler",Qr=jr("window.location.href"),Zr=(Object.defineProperty(ti.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(Kr);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(Kr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(ti.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(Jr)},set:function(t){this.contextStorage.setItem(Jr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(ti.prototype,"handlerError",{get:function(){return this.contextStorage.getItem($r)},set:function(t){this.contextStorage.setItem($r,t)},enumerable:!1,configurable:!0}),ti._getPageUrl=function(){return qr.eval(Qr)},ti.prototype._initListening=function(){var n=this;zr.on(zr.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===Vr?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==Xr||n.unexpectedDialog?e.type!==Yr||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},ti.prototype._init=function(){var e=this;o.on(o.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),Ac.alert=function(){return e._defaultDialogHandler("alert")},Ac.confirm=function(){return e._defaultDialogHandler("confirm")},Ac.prompt=function(){return e._defaultDialogHandler("prompt")}},ti.prototype._createDialogHandler=function(i){var o=this;return function(t){var e=ti._getPageUrl();o._addAppearedDialogs(i,t,e);var n=new Hr(o.dialogHandler),r=null;try{r=n.fn.apply(Ac,[i,t,e])}catch(t){o._onHandlerError(i,t.message||String(t),e)}return r}},ti.prototype._defaultDialogHandler=function(t){var e=ti._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},ti.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},ti.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},ti.prototype.setHandler=function(t){var e=this;this.dialogHandler=t,["alert","confirm","prompt"].forEach(function(t){Ac[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}})},ti.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new qn(t.type,t.url):e?new $n(e.type,e.message,e.url):null},ti);function ti(t,e){this.contextStorage=t,this.dialogHandler=e,this._init(),this._initListening(),this.dialogHandler&&this.setHandler(e)}function ei(t){this.type=t,this.id=ar()}var ni,ri="driver|establish-connection",ii="driver|switch-to-window",oi="driver|close-window",si="driver|close-window-validation",ai="driver|switch-to-window-validation",li="driver|get-windows",ci="driver|command-executed",ui="driver|execute-command",di="driver|confirmation",hi="driver|set-native-dialog-handler",fi="driver|set-as-master",mi="driver|close-all-child-windows",pi="driver|start-to-restore-child-link",gi="driver|restore-child-link",vi="driver|child-window-is-loaded-in-iframe",wi="driver|child-window-is-opened-in-iframe",yi=(s(_i,ni=ei),_i);function _i(){return ni.call(this,ri)||this}var Ei,Ci=(s(Si,Ei=ei),Si);function Si(t){var e=t.windowId,n=Ei.call(this,si)||this;return n.windowId=e,n}var Ii,Ti=(s(xi,Ii=ei),xi);function xi(t){var e=t.windowId,n=t.fn,r=Ii.call(this,ai)||this;return r.windowId=e,r.fn=n,r}var bi,Wi=(s(Mi,bi=ei),Mi);function Mi(){return bi.call(this,li)||this}var Pi,Ai=(s(Di,Pi=ei),Di);function Di(t){var e=t.windowId,n=t.isCurrentWindow,r=Pi.call(this,oi)||this;return r.windowId=e,r.isCurrentWindow=n,r}var Ri,Ni=(s(ki,Ri=ei),ki);function ki(t){var e=t.windowId,n=t.fn,r=Ri.call(this,ii)||this;return r.windowId=e,r.fn=n,r}var Fi,Li=(s(Ui,Fi=ei),Ui);function Ui(t){var e=Fi.call(this,ci)||this;return e.driverStatus=t,e}var Oi,Bi=(s(Hi,Oi=ei),Hi);function Hi(t,e){var n=Oi.call(this,ui)||this;return n.command=t,n.testSpeed=e,n}var Gi,Vi=(s(Xi,Gi=ei),Xi);function Xi(t,e){var n=Gi.call(this,di)||this;return n.requestMessageId=t,n.result=e,n}var Yi,zi=(s(ji,Yi=ei),ji);function ji(t){var e=Yi.call(this,hi)||this;return e.dialogHandler=t,e}var qi,Ki=(s(Ji,qi=ei),Ji);function Ji(t){var e=qi.call(this,fi)||this;return e.finalizePendingCommand=t,e}var $i,Qi=(s(Zi,$i=ei),Zi);function Zi(){return $i.call(this,mi)||this}var to,eo=(s(no,to=ei),no);function no(){return to.call(this,pi)||this}var ro,io=(s(oo,ro=ei),oo);function oo(t){var e=ro.call(this,gi)||this;return e.windowId=t,e}var so,ao=(s(lo,so=ei),lo);function lo(t){var e=so.call(this,vi)||this;return e.windowId=t,e}var co,uo=(s(ho,co=ei),ho);function ho(){return co.call(this,wi)||this}var fo=o.json,mo=o.nativeMethods,po=(go.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},go.prototype._loadFromStorage=function(){var t=mo.storageGetItem.call(this.storage,this.storageKey);t&&(this.data=fo.parse(t),mo.storageRemoveItem.call(this.storage,this.storageKey))},go.prototype.save=function(){mo.storageSetItem.call(this.storage,this.storageKey,fo.stringify(this.data))},go.prototype.setItem=function(t,e){this.data[t]=e,this.save()},go.prototype.getItem=function(t){return this.data[t]},go.prototype.dispose=function(){mo.storageRemoveItem.call(this.storage,this.storageKey)},go);function go(t,e,n){this.storage=mo.winSessionStorageGetter.call(t),this.storageKey=this._createStorageKey(e,n),this.data={},this._loadFromStorage()}function vo(n,t,e,r){var i=null,o=null,s=null;return e=Math.max(e||0,2500),l.Promise.race([y.delay(e),new l.Promise(function(e){s=function(t){t.message.type===di&&t.message.requestMessageId===n.id&&e(t.message)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),i=l.nativeMethods.setInterval.call(Ac,function(){return l.eventSandbox.message.sendServiceMsg(n,t)},1e3),l.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(l.nativeMethods.clearInterval.call(Ac,i),l.nativeMethods.clearTimeout.call(Ac,o),l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new r;return t})}var wo=2e4;function yo(t){var e=t.requestMsgId,n=t.result,r=t.window,i=new Vi(e,n);l.eventSandbox.message.sendServiceMsg(i,r)}var _o=(Object.defineProperty(Eo.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!1,configurable:!0}),Eo.prototype._ensureIframe=function(){var t=this;return y.domUtils.isElementInDocument(this.driverIframe)?y.waitFor(function(){return y.positionUtils.isElementVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new Yn}):l.Promise.reject(new Gn)},Eo.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new l.Promise(function(t){e.checkIframeInterval=l.nativeMethods.setInterval.call(Ac,function(){e._ensureIframe().catch(function(){return y.delay(500).then(function(){return t(new cr({isCommandResult:!0}))})})},1e3)})},Eo.prototype._waitForCommandResult=function(){var e=this,n=null;return l.Promise.race([this._waitForIframeRemovedOrHidden(),new l.Promise(function(e){n=function(t){t.message.type===ci&&e(t.message.driverStatus)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),l.nativeMethods.clearInterval.call(Ac,e.checkIframeInterval),t})},Eo.prototype.sendConfirmationMessage=function(t){yo({requestMsgId:t,result:{id:this.driverId},window:this.driverWindow})},Eo.prototype.executeCommand=function(e,n){var r=this;return this._ensureIframe().then(function(){var t=new Bi(e,n);return l.Promise.all([vo(t,r.driverWindow,r.iframeAvailabilityTimeout,rn),r._waitForCommandResult()])}).then(function(t){return t[1]})},Eo);function Eo(t,e){this.driverWindow=t,this.driverIframe=y.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0}var Co=o.Promise,So=o.nativeMethods,Io=(To.prototype._onScriptElementAdded=function(t){var e,n,r=this,i=So.scriptSrcGetter.call(t);void 0!==i&&""!==i&&(this.scriptsCount++,e=null,n=function(){So.removeEventListener.call(t,"load",n),So.removeEventListener.call(t,"error",n),So.clearTimeout.call(Ac,e),r._onScriptLoadedOrFailed()},So.addEventListener.call(t,"load",n),So.addEventListener.call(t,"error",n),e=So.setTimeout.call(Ac,n,this.SCRIPT_LOADING_TIMEOUT))},To.prototype._onScriptLoadedOrFailed=function(){var t=this;this.scriptsCount--,this.scriptsCount||y.delay(25).then(function(){t.resolveWaitingPromise&&(t.scriptsCount||t.resolveWaitingPromise())})},To.prototype.wait=function(){var n=this;return new Co(function(t){function e(){So.clearTimeout.call(Ac,n.watchdog),o.off(o.EVENTS.scriptElementAdded,n.scriptElementAddedHandler),n.watchdog=null,n.resolveWaitingPromise=null,t()}n.scriptsCount?(n.watchdog=So.setTimeout.call(Ac,e,n.BARRIER_TIMEOUT),n.resolveWaitingPromise=e):e()})},To);function To(){var e=this;this.watchdog=null,this.SCRIPT_LOADING_TIMEOUT=2e3,this.BARRIER_TIMEOUT=3e3,this.scriptsCount=0,this.resolveWaitingPromise=null,this.scriptElementAddedHandler=function(t){return e._onScriptElementAdded(t.el)},o.on(o.EVENTS.scriptElementAdded,this.scriptElementAddedHandler)}function xo(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=new y.RequestBarrier,i=new Io;y.pageUnloadBarrier.watchForPageNavigationTriggers();var o=null,s=t.apply(void 0,e),a=s.then(function(t){return o=t,l.Promise.all([r.wait().then(function(){return i.wait()}),y.pageUnloadBarrier.wait()])}).then(function(){return o});return{actionPromise:s,barriersPromise:a}}var bo,Wo=Array.isArray,Mo=Ac.Node,Po=Ac.HTMLCollection,Ao=Ac.NodeList;function Do(t){return!!t}function Ro(t){return!(!y.domUtils.isDomElement(t)&&!y.domUtils.isTextNode(t))&&(y.domUtils.isOptionElement(t)||"optgroup"===y.domUtils.getTagName(t)?n.selectElement.isOptionElementVisible(t):y.positionUtils.isElementVisible(t))}function No(t){return t instanceof Po||t instanceof Ao||function(t){if(Wo(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof Mo))return;return 1}}(t)}var ko=t.arrayUtils,Fo=o.utils.types,Lo=o.nativeMethods,Uo=1,Oo=2,Bo=3,Ho=((bo={})[Uo]=/^\.filterVisible\(\)$/,bo[Oo]=/^\.filterHidden\(\)$/,bo[Bo]=/^\.nth\(\d+\)$/,bo),Go=(Object.defineProperty(Vo.prototype,"error",{get:function(){return this.err},set:function(t){null===this.err&&(this.err=t)},enumerable:!1,configurable:!0}),Vo.prototype.filter=function(t,e,n){var r,i=ko.filter(t,Do);return e.filterVisible&&(i=i.filter(Ro),this.assertFilterError(i,n,Uo)),e.filterHidden&&(i=i.filter(function(t){return!Ro(t)}),this.assertFilterError(i,n,Oo)),e.counterMode?i=null!==e.index?this.getNodeByIndex(i,e.index)?1:0:i.length:(e.collectionMode?null!==e.index&&(i=(r=this.getNodeByIndex(i,e.index))?[r]:[]):i=this.getNodeByIndex(i,e.index||0),"number"==typeof e.index&&this.assertFilterError(i,n,Bo)),i},Vo.prototype.cast=function(t){var e=null;if(Fo.isNullOrUndefined(t))e=[];else if(t instanceof Node)e=[t];else{if(!No(t))throw new bt;e=t}return e},Vo.prototype.assertFilterError=function(t,e,n){t&&0!==t.length||(this.error=this.getErrorItem(e,n))},Vo.prototype.getErrorItem=function(t,e){var n=t.apiFnChain,r=t.apiFnID;if(e)for(var i=r;i<n.length;i++)if(Ho[e].test(n[i]))return i;return null},Vo.prototype.getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},Vo);function Vo(){this.err=null}Lo.objectDefineProperty.call(Ac,Ac,"%testCafeSelectorFilter%",{value:new Go,configurable:!0});var Xo,Yo=l.nativeMethods.date,zo=(s(jo,Xo=Hr),jo.prototype._createReplicator=function(){return Dr([new Rr])},jo.prototype._getTimeoutErrorParams=function(){var t=Ac["%testCafeSelectorFilter%"].error,e=this.command.apiFnChain;return void 0!==t?{apiFnIndex:t,apiFnChain:e}:null},jo.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},jo.prototype._validateElement=function(o,s){var a=this;return l.Promise.resolve().then(function(){return a.fn.apply(Ac,o)}).then(function(t){var e=!!t,n=!a.command.visibilityCheck||Ro(t),r=new Yo-s>=a.timeout;if(e&&(n||y.domUtils.isShadowRoot(t)))return t;if(!r)return y.delay(200).then(function(){return a._validateElement(o,s)});var i=a.getVisibleValueMode?null:a._getTimeoutError(e);if(i)throw i(a._getTimeoutErrorParams());return null})},jo.prototype._executeFn=function(t){if(this.counterMode)return Xo.prototype._executeFn.call(this,t);var e=new Yo,n=null,r=null;return this._validateElement(t,e).catch(function(t){n=t}).then(function(t){if(n)throw n;r=t}).then(function(){return r})},jo);function jo(t,e,n,r,i){var o,s=Xo.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,n&&(o=new Yo-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies&&s.dependencies.customDOMProperties;return s.replicator.addTransforms([new Lr(a)]),s}var qo=l.nativeMethods.date,Ko=(Jo.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 zo(n,e.globalSelectorTimeout,e.ensureElementsStartTime,r,i).getResult()}).then(function(t){if(!y.domUtils.isDomElement(t))throw o(y.NODE_TYPE_DESCRIPTIONS[t.nodeType]);e.elements.push(t)})},Jo.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},Jo);function Jo(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=l.Promise.resolve(),this.ensureElementsStartTime=new qo,t.forEach(function(t){return n._ensureElement(t)})}function $o(t,e){return new Ko(t,e).getElements()}function Qo(t){return{selector:t,createNotFoundError:function(t){return new se(t)},createIsInvisibleError:function(){return new ce},createHasWrongNodeTypeError:function(t){return new he(t)}}}function Zo(t,e){return{selector:t,createNotFoundError:function(t){return new pe(e,t)},createIsInvisibleError:function(){return new we(e)},createHasWrongNodeTypeError:function(t){return new Ee(e,t)}}}var ts=o.utils.browser;function es(t,e,n){var r=ts.isFirefox?Math.ceil:Math.round,i=y.positionUtils.getOffsetPosition(t,r);return{x:(t===Dc.documentElement?0:i.left)+e,y:(t===Dc.documentElement?0:i.top)+n}}function ns(t){if(!t)return null;var e=Ac.screenLeft||Ac.screenX,n=Ac.screenTop||Ac.screenY;return{x:e+t.x,y:n+t.y}}function rs(t){var e=t/2;return e<1?0:Math.round(e)}function is(t,e,n){var r,i,o=(r=t,{offsetX:rs((i=y.positionUtils.getElementRectangle(r)).width),offsetY:rs(i.height)});if(e="number"==typeof e?Math.round(e):o.offsetX,n="number"==typeof n?Math.round(n):o.offsetY,0<e&&0<n)return{offsetX:e,offsetY:n};var s=y.positionUtils.getClientDimensions(t),a=Math.round(Math.max(t.scrollWidth,s.width)),l=Math.round(Math.max(t.scrollHeight,s.height)),c=s.scrollbar.right+s.border.left+s.border.right+a,u=s.scrollbar.bottom+s.border.top+s.border.bottom+l;return{offsetX:e<0?c+e:e,offsetY:n<0?u+n:n}}function os(t){return t.top!==t}var ss=t.domUtils,as=os(Ac)?i.iframeCursorUI:i.cursorUI,ls={x:-1,y:-1,currentActiveWindow:Ac.top,_ensureActiveWindow:function(){var t;this.currentActiveWindow!==Ac&&this.currentActiveWindow!==Ac.parent&&((t=ss.findIframeByWindow(this.currentActiveWindow))&&ss.isElementInDocument(t)||(this.currentActiveWindow=Ac))},get active(){return this._ensureActiveWindow(),this.currentActiveWindow===Ac},set activeWindow(t){this.currentActiveWindow=t},get activeWindow(){return this._ensureActiveWindow(),this.currentActiveWindow},get position(){return{x:this.x,y:this.y}},get visible(){return!os(Ac)&&as.isVisible()},move:function(t,e){return this.x=t,this.y=e,as.move(this.x,this.y)},hide:function(){this.visible&&as.hide()},show:function(){os(Ac)||as.show()},leftButtonDown:function(){return as.leftButtonDown()},rightButtonDown:function(){return as.rightButtonDown()},buttonUp:function(){return as.buttonUp()}},cs=o.utils.browser,us=o.Promise,ds=o.nativeMethods,hs=t.positionUtils,fs=t.domUtils;function ms(t,e,n){var r=null;return i.hide(n).then(function(){return r=hs.getElementFromPoint(t,e),i.show(n)}).then(function(){return r})}function ps(t,e,n){var r=hs.getElementFromPoint(t,e),i=fs.containsElement(n,r)&&ds.nodeTextContentGetter.call(r).length;return r&&r===n||i?r:null}function gs(t,e){if(!e||!fs.isDomElement(e)||!t||t===e)return t;if("tref"===fs.getTagName(e))return e;var n,r,i,o="area"===fs.getTagName(e)&&fs.isImgElement(t);if(cs.isFirefox&&o)return n=t,r=e,(i=fs.closest(r,"map"))&&i.name===n.useMap.substring(1)?r:n;var s=fs.isAnchorElement(e)||fs.getParents(e,"a").length,a=s&&fs.containsElement(e,t)&&ds.nodeTextContentGetter.call(t).length;if(!s||a||!ds.nodeTextContentGetter.call(e).length)return t;var l=e.getBoundingClientRect();return ps(l.right-1,l.top+1,e)||ps(l.left+1,l.bottom-1,e)||t}function vs(n,r,i){var o=null;return ms(n,r).then(function(t){o=t;var e=us.resolve(t);return!o&&os(Ac)&&0<n&&0<r&&(e=e.then(function(){return ms(n,r,!0)}).then(function(t){return o=t})),e.then(function(t){return gs(t,i)}).then(function(t){return{element:t,corrected:t!==o}})})}function ws(){var t=ls.position;return vs(t.x,t.y).then(function(t){return t.element})}var ys="elementIsInvisibleError",_s="foundElementIsNotTarget",Es=(Object.defineProperty(Cs.prototype,"mouseActionStepDelay",{get:function(){return 1===this.speedFactor?10:400*(1-this.speedFactor)},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"keyActionStepDelay",{get:function(){return 1===this.speedFactor?10:200*(1-this.speedFactor)},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"cursorSpeed",{get:function(){return Math.pow(400,this.speedFactor)/4},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"draggingSpeed",{get:function(){return Math.pow(16,this.speedFactor)/4},enumerable:!1,configurable:!0}),Cs);function Cs(t){this.speedFactor=t||1}var Ss=o.Promise,Is=o.eventSandbox.message,Ts="automation|scroll|request",xs="automation|scroll|response";Is.on(Is.SERVICE_MSG_RECEIVED_EVENT,function(t){var e,n,r,i,o,s;t.message.cmd===Ts&&(n=(e=t.message).offsetX,r=e.offsetY,i=e.maxScrollMargin,o=y.domUtils.findIframeByWindow(t.source),(s=new bs(o,{offsetX:n,offsetY:r})).maxScrollMargin=i,s.run().then(function(){return Is.sendServiceMsg({cmd:xs},t.source)}))});var bs=(Ws.prototype._isScrollValuesChanged=function(t,e){return y.styleUtils.getScrollLeft(t)!==e.left||y.styleUtils.getScrollTop(t)!==e.top},Ws.prototype._setScroll=function(t,e){var n=this,r=e.left,i=e.top,o=y.domUtils.isHtmlElement(t)?y.domUtils.findDocument(t):t,s={left:y.styleUtils.getScrollLeft(o),top:y.styleUtils.getScrollTop(o)},r=Math.max(r,0),i=Math.max(i,0),a=y.scrollController.waitForScroll(o);return y.styleUtils.setScrollLeft(o,r),y.styleUtils.setScrollTop(o,i),this._isScrollValuesChanged(o,s)?a=a.then(function(){n.scrollWasPerformed=n.scrollWasPerformed||n._isScrollValuesChanged(o,s)}):(a.cancel(),Ss.resolve())},Ws.prototype._getScrollToPoint=function(t,e,n){var r=e.x,i=e.y,o=Math.floor(t.width/2),s=Math.floor(Math.floor(t.height/2)),a=this.scrollToCenter?o:Math.min(n.left,o),l=this.scrollToCenter?s:Math.min(n.top,s),c=r>=t.scroll.left+t.width-a,u=r<=t.scroll.left+a,d=i>=t.scroll.top+t.height-l,h=i<=t.scroll.top+l,f=t.scroll.left,m=t.scroll.top;return c?f=r-t.width+a:u&&(f=r-a),d?m=i-t.height+l:h&&(m=i-l),{left:f,top:m}},Ws.prototype._getScrollToFullChildView=function(t,e,n){var r,i,o,s,a=null,l=null,c=t.width>=e.width,u=t.height>=e.height,d=y.positionUtils.calcRelativePosition(e,t);return c&&(r=t.width-e.width,i=Math.min(n.left,r),this.scrollToCenter&&(i=r/2),d.left<i?a=Math.round(t.scroll.left+d.left-i):d.right<i&&(a=Math.round(t.scroll.left+Math.min(d.left,-d.right)+i))),u&&(o=t.height-e.height,s=Math.min(n.top,o),this.scrollToCenter&&(s=o/2),d.top<s?l=Math.round(t.scroll.top+d.top-s):d.bottom<s&&(l=Math.round(t.scroll.top+Math.min(d.top,-d.bottom)+s))),{left:a,top:l}},Ws._getChildPoint=function(t,e,n){return{x:e.left-t.left+t.scroll.left+e.border.left+n.x,y:e.top-t.top+t.scroll.top+e.border.top+n.y}},Ws.prototype._getScrollPosition=function(t,e,n,r){var i=Ws._getChildPoint(t,e,n),o=this._getScrollToPoint(t,i,r),s=this._getScrollToFullChildView(t,e,r);return{left:Math.max(null===s.left?o.left:s.left,0),top:Math.max(null===s.top?o.top:s.top,0)}},Ws._getChildPointAfterScroll=function(t,e,n,r){return{x:Math.round(e.left+t.scroll.left-n.left+r.x),y:Math.round(e.top+t.scroll.top-n.top+r.y)}},Ws.prototype._isChildFullyVisible=function(t,e,n){var r=Ws._getChildPointAfterScroll(t,e,t.scroll,n),i=r.x,o=r.y,s=this._getScrollPosition(t,e,n,{left:0,top:0}),a=s.left,l=s.top;return!this._isTargetElementObscuredInPoint(i,o)&&a===t.scroll.left&&l===t.scroll.top},Ws.prototype._scrollToChild=function(t,e,n){for(var r=y.positionUtils.getClientDimensions(t),i=y.positionUtils.getClientDimensions(e),o=y.styleUtils.getInnerWidth(Ac),s=y.styleUtils.getInnerHeight(Ac),a=r.scroll,l=!this._isChildFullyVisible(r,i,n);l;){a=this._getScrollPosition(r,i,n,this.maxScrollMargin);var c=Ws._getChildPointAfterScroll(r,i,a,n),u=c.x,d=c.y,h=this._isTargetElementObscuredInPoint(u,d);this.maxScrollMargin.left+=20,this.maxScrollMargin.left>=o&&(this.maxScrollMargin.left=50,this.maxScrollMargin.top+=20),l=h&&this.maxScrollMargin.top<s}return this.maxScrollMargin={left:50,top:50},this._setScroll(t,a)},Ws.prototype._scrollElement=function(){if(!y.styleUtils.hasScroll(this.element))return Ss.resolve();var t=y.positionUtils.getClientDimensions(this.element),e=this._getScrollToPoint(t,{x:this.offsetX,y:this.offsetY},this.maxScrollMargin);return this._setScroll(this.element,e)},Ws.prototype._scrollParents=function(){var e,n,r=this,i=y.styleUtils.getScrollableParents(this.element),o=this.element,s=this.offsetX-Math.round(y.styleUtils.getScrollLeft(o)),a=this.offsetY-Math.round(y.styleUtils.getScrollTop(o));return y.promiseUtils.times(i.length,function(t){return r._scrollToChild(i[t],o,{x:s,y:a}).then(function(){e=y.positionUtils.getClientDimensions(o),n=y.positionUtils.getClientDimensions(i[t]),s+=e.left-n.left+n.border.left,a+=e.top-n.top+n.border.top,o=i[t]})}).then(function(){return os(Ac)&&!r.skipParentFrames?y.sendRequestToFrame({cmd:Ts,offsetX:s,offsetY:a,maxScrollMargin:r.maxScrollMargin},xs,Ac.parent):Ss.resolve()})},Ws._getFixedAncestorOrSelf=function(t){return y.domUtils.findParent(t,!0,y.styleUtils.isFixedElement)},Ws.prototype._isTargetElementObscuredInPoint=function(t,e){var n=y.positionUtils.getElementFromPoint(t,e);if(!n)return!1;var r=Ws._getFixedAncestorOrSelf(n);return r&&!r.contains(this.element)},Ws.prototype.run=function(){var t=this;return this._scrollElement().then(function(){return t._scrollParents()}).then(function(){return t.scrollWasPerformed})},Ws);function Ws(t,e){this.element=t,this.offsetX=e.offsetX,this.offsetY=e.offsetY,this.scrollToCenter=e.scrollToCenter,this.skipParentFrames=e.skipParentFrames,this.raiseEvents=e.raiseEvents,this.maxScrollMargin={left:50,top:50},this.scrollWasPerformed=!1}function Ms(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 Ps,As,Ds,Rs,Ns,ks=Ms(qt),Fs=(As=Ms(Ps=$t),function(t,e){if(As(t,e),e<0)throw new Ps(t,e)}),Ls=(Ds=te,function(t,e){var n=typeof e;if("boolean"!=n)throw new Ds(t,n)}),Us=(Rs=re,function(t,e){var n=typeof e;if("number"!=n)throw new Rs(t,n);if(isNaN(e)||e<.01||1<e)throw new Rs(t,e)}),Os=(s(Bs,Ns=or),Bs.prototype._getAssignableProperties=function(){return[{name:"speed",type:Us}]},Bs);function Bs(t,e){var n=Ns.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var Hs,Gs=(s(Vs,Hs=Os),Vs.prototype._getAssignableProperties=function(){return Hs.prototype._getAssignableProperties.call(this).concat([{name:"offsetX",type:ks},{name:"offsetY",type:ks}])},Vs);function Vs(t,e){var n=Hs.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var Xs,Ys=(s(zs,Xs=Gs),zs.prototype._getAssignableProperties=function(){return Xs.prototype._getAssignableProperties.call(this).concat([{name:"scrollToCenter",type:Ls},{name:"skipParentFrames",type:Ls}])},zs);function zs(t,e){var n=Xs.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var js,qs=(s(Ks,js=Os),Ks.prototype._getAssignableProperties=function(){return js.prototype._getAssignableProperties.call(this).concat([{name:"scrollTargetX",type:ks},{name:"scrollTargetY",type:ks},{name:"crop.left",type:ks},{name:"crop.right",type:ks},{name:"crop.top",type:ks},{name:"crop.bottom",type:ks},{name:"includeMargins",type:Ls},{name:"includeBorders",type:Ls},{name:"includePaddings",type:Ls}])},Ks);function Ks(t,e){var n=js.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 Js,$s=(s(Qs,Js=Gs),Qs.prototype._getAssignableProperties=function(){return Js.prototype._getAssignableProperties.call(this).concat([{name:"modifiers.ctrl",type:Ls},{name:"modifiers.alt",type:Ls},{name:"modifiers.shift",type:Ls},{name:"modifiers.meta",type:Ls}])},Qs);function Qs(t,e){var n=Js.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var Zs,ta=(s(ea,Zs=$s),ea.prototype._getAssignableProperties=function(){return Zs.prototype._getAssignableProperties.call(this).concat([{name:"caretPos",type:Fs}])},ea);function ea(t,e){var n=Zs.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}var na,ra,ia,oa,sa,aa=(s(la,na=$s),la.prototype._getAssignableProperties=function(){return na.prototype._getAssignableProperties.call(this).concat([{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:Ls},{name:"skipDefaultDragBehavior",type:Ls}])},la);function la(t,e){var n=na.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 ca(t,e){var n=ra.call(this)||this;return n.replace=!1,n.paste=!1,n._assignFrom(t,e),n}function ua(t,e){var n=ia.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function da(t,e){var n=oa.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function ha(t,e){var n=sa.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}function fa(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ma(t,e,n){for(var r,i=[],o=[{x1:n.left,y1:n.top,x2:n.left,y2:n.bottom,isHorizontal:!1},{x1:n.right,y1:n.top,x2:n.right,y2:n.bottom,isHorizontal:!1},{x1:n.left,y1:n.top,x2:n.right,y2:n.top,isHorizontal:!0},{x1:n.left,y1:n.bottom,x2:n.right,y2:n.bottom,isHorizontal:!0}],s=0;s<o.length;s++)(r=function(t,e,n){var r;if(n.isHorizontal)return(r=y.positionUtils.getLineXByYCoord(t,e,n.y1))&&r>=n.x1&&r<=n.x2?{x:r,y:n.y1}:null;var i=y.positionUtils.getLineYByXCoord(t,e,n.x1);return i&&i>=n.y1&&i<=n.y2?{x:n.x1,y:i}:null}(t,e,o[s]))&&i.push(r);return i.length?1===i.length||fa(t,i[0])<fa(t,i[1])?i[0]:i[1]:null}s(ca,ra=ta),ca.prototype._getAssignableProperties=function(){return ra.prototype._getAssignableProperties.call(this).concat([{name:"replace",type:Ls},{name:"paste",type:Ls}])},s(ua,ia=$s),ua.prototype._getAssignableProperties=function(){return ia.prototype._getAssignableProperties.call(this).concat([{name:"destinationOffsetX",type:ks},{name:"destinationOffsetY",type:ks}])},s(da,oa=or),da.prototype._getAssignableProperties=function(){return[{name:"portraitOrientation",type:Ls}]},s(ha,sa=or),ha.prototype._getAssignableProperties=function(){return[{name:"timeout",type:Fs},{name:"allowUnawaitedPromise",type:Ls}]};var pa=o.Promise,ga=o.nativeMethods;function va(){return new pa(function(t){return ga.setTimeout.call(Ac,t,0)})}var wa=function(){this.enabled=!1,this.dropAllowed=!1,this.element=null,this.dataTransfer=null,this.dataStore=null},ya=o.utils.browser,_a=(Ea.prototype.setup=function(){this.dragAndDropMode=!1,this.dropAllowed=!1},Ea.prototype.leaveElement=function(){},Ea.prototype.move=function(){},Ea.prototype.enterElement=function(){},Ea.prototype.dragAndDrop=function(){},Ea.prototype.teardown=function(){},Ea.prototype.run=function(t,e,n,r,i){var o=e&&y.domUtils.isElementInDocument(e),s=e&&y.domUtils.isElementInIframe(e)&&!y.domUtils.getIframeByElement(e);o&&!s||(e=null);var a=t!==e,l=a?y.domUtils.getCommonAncestor(t,e):null;this.setup(),a&&e&&this.leaveElement(t,e,l,n),ya.isIE&&this.move(t,n),a&&y.domUtils.isElementInDocument(t)&&this.enterElement(t,e,l,n),ya.isIE||this.move(t,n),this.dragAndDrop(r,t,e,n,i),this.teardown(t,n,e);var c=this.dragAndDropMode,u=this.dropAllowed;return this.dragAndDropMode=!1,this.dropAllowed=!1,{dragAndDropMode:c,dropAllowed:u}},Ea);function Ea(t){var e=t.moveEvent;this.dragAndDropMode=!1,this.dropAllowed=!1,this.moveEvent=e}var Ca=o.eventSandbox.eventSimulator,Sa=o.utils.extend,Ia=o.nativeMethods,Ta=(xa.leaveElement=function(t,e,n,r){Ca.mouseout(e,Sa({relatedTarget:t},r));for(var i=e;i&&i!==n;)Ca.mouseleave(i,Sa({relatedTarget:t},r)),i=Ia.nodeParentNodeGetter.call(i)},xa.enterElement=function(t,e,n,r){Ca.mouseover(t,Sa({relatedTarget:e},r));for(var i=t,o=[];i&&i!==n;)o.push(i),i=y.domUtils.getParentExceptShadowRoot(i);for(var s=o.length-1;-1<s;s--)Ca.mouseenter(o[s],Sa({relatedTarget:e},r))},xa.move=function(t,e,n){Ca[t](e,n)},xa);function xa(){}var ba=(Wa.dragAndDrop=function(t,e,n,r){return Ca.drag(t,r),e!==n&&(y.domUtils.isElementInDocument(e)&&(r.relatedTarget=n,Ca.dragenter(e,r)),n&&(r.relatedTarget=e,Ca.dragleave(n,r))),!Ca.dragover(e,r)},Wa);function Wa(){}var Ma,Pa=o.eventSandbox.eventSimulator,Aa=(s(Da,Ma=_a),Da.prototype.leaveElement=function(t,e,n,r){Ta.leaveElement(t,e,n,r)},Da.prototype.enterElement=function(t,e,n,r){Ta.enterElement(t,e,n,r)},Da.prototype.move=function(t,e){this._needEmulateMoveEvent()&&Ta.move(this.moveEvent,t,e)},Da.prototype.teardown=function(t,e,n){this._needEmulateMoveEvent()&&y.domUtils.isElementInDocument(t)&&t!==n&&Pa[this.moveEvent](t,e)},Da.prototype._needEmulateMoveEvent=function(){return"touchmove"!==this.moveEvent||this.holdLeftButton},Da);function Da(t){var e=Ma.call(this,t)||this;return e.holdLeftButton=t.holdLeftButton,e}var Ra,Na=(s(ka,Ra=_a),ka.prototype.setup=function(){Ra.prototype.setup.call(this),this.dragAndDropMode=!0},ka.prototype.dragAndDrop=function(t,e,n,r){this.dropAllowed=ba.dragAndDrop(t,e,n,r)},ka);function ka(){return null!==Ra&&Ra.apply(this,arguments)||this}var Fa,La=o.eventSandbox.eventSimulator,Ua=(s(Oa,Fa=_a),Oa.prototype.setup=function(){Fa.prototype.setup.call(this),this.dragAndDropMode=!0},Oa.prototype.leaveElement=function(t,e,n,r){Ta.leaveElement(t,e,n,r)},Oa.prototype.move=function(t,e){Ta.move(this.moveEvent,t,e)},Oa.prototype.enterElement=function(t,e,n,r){Ta.enterElement(t,e,n,r)},Oa.prototype.dragAndDrop=function(t,e,n,r,i){var o=La.dragstart(t,r);i.setReadOnlyMode(),o?this.dropAllowed=ba.dragAndDrop(t,e,n,r):this.dragAndDropMode=!1},Oa.prototype.run=function(t,e,n,r,i){return Fa.prototype.run.call(this,t,null,n,r,i)},Oa);function Oa(){return null!==Fa&&Fa.apply(this,arguments)||this}var Ba=null,Ha=function(){return Ba},Ga=function(t){Ba=t},Va=o.Promise,Xa=o.nativeMethods,Ya=o.utils.featureDetection,za=o.utils.html,ja=o.utils.url,qa=o.eventSandbox.eventSimulator,Ka=o.eventSandbox.message,Ja=o.eventSandbox.DataTransfer,$a=o.eventSandbox.DragDataStore,Qa=t.positionUtils,Za=t.domUtils,tl=t.styleUtils,el=t.eventUtils,nl=t.promiseUtils,rl=t.sendRequestToFrame,il="automation|move|request",ol="automation|move|response";Ka.on(Ka.SERVICE_MSG_RECEIVED_EVENT,function(t){t.message.cmd===il&&(t.source.parent===Ac?sl.onMoveToIframeRequest(t):(o.on(o.EVENTS.beforeUnload,function(){return Ka.sendServiceMsg({cmd:ol},t.source)}),sl.onMoveOutRequest(t)))});var sl=(al.getTarget=function(t,e,n){var r=!Qa.containsOffset(t,e,n),i=r?es(t,e,n):{x:e,y:n};return{element:r?Dc.documentElement:t,offsetX:i.x,offsetY:i.y}},al.onMoveToIframeRequest=function(t){var e={x:t.message.endX,y:t.message.endY},n=t.source,r=Za.findIframeByWindow(n),i=tl.getBordersWidth(r),o=tl.getElementPadding(r),s=Qa.getIframeClientCoordinates(r),a=Qa.getIframePointRelativeToParentFrame(e,n),l=ls.position,c=Qa.isInRectangle(l,s)?l:ma(l,a,s),u={x:c.x-s.left,y:c.y-s.top},d=new al(r,new aa({modifiers:t.message.modifiers,offsetX:u.x+i.left+o.left,offsetY:u.y+i.top+o.top,speed:t.message.speed,skipScrolling:!0},!1)),h={cmd:ol,x:u.x,y:u.y};ls.activeWindow!==n?d.run().then(function(){ls.activeWindow=n,Ka.sendServiceMsg(h,n)}):Ka.sendServiceMsg(h,n)},al.onMoveOutRequest=function(t){var e=t.source,n={left:t.message.left,right:t.message.right,top:t.message.top,bottom:t.message.bottom};if(!t.message.iframeUnderCursor){var r=t.message,i=r.startX,o=r.startY,s=i-n.left,a=o-n.top,l=Ha();return l&&(qa.mouseout(l,{clientX:s,clientY:a,relatedTarget:null}),qa.mouseleave(l,{clientX:s,clientY:a,relatedTarget:null})),void Ka.sendServiceMsg({cmd:ol},e)}var c,u=ls.position,d=ma({x:n.left+u.x,y:n.top+u.y},{x:t.message.endX,y:t.message.endY},n);d?(c=new aa({modifiers:t.message.modifiers,offsetX:d.x-n.left,offsetY:d.y-n.top,speed:t.message.speed,skipScrolling:!0},!1),new al(Dc.documentElement,c).run().then(function(){var t={cmd:ol,x:d.x,y:d.y};ls.activeWindow=e,Ka.sendServiceMsg(t,e)})):Ka.sendServiceMsg({cmd:ol,x:n.left,y:n.top},e)},al.prototype._getTargetClientPoint=function(){var t=tl.getElementScroll(this.element);if(Za.isHtmlElement(this.element))return{x:Math.floor(this.offsetX-t.left),y:Math.floor(this.offsetY-t.top)};var e=Qa.getClientPosition(this.element),n=this.element.tagName&&Za.isBodyElement(this.element);return{x:Math.floor(n?e.x+this.offsetX:e.x+this.offsetX-t.left),y:Math.floor(n?e.y+this.offsetY:e.y+this.offsetY-t.top)}},al.prototype._emulateEvents=function(t){var e,n,r=this.holdLeftButton?el.BUTTONS_PARAMETER.leftButton:el.BUTTONS_PARAMETER.noButton,i=ns({x:this.x,y:this.y}),o={clientX:this.x,clientY:this.y,screenX:i.x,screenY:i.y,buttons:r,ctrl:this.modifiers.ctrl,alt:this.modifiers.alt,shift:this.modifiers.shift,meta:this.modifiers.meta,dataTransfer:this.dragAndDropState.dataTransfer},s={moveEvent:this.moveEvent,holdLeftButton:this.holdLeftButton},a=(e=this.dragAndDropState.enabled,n=this.firstMovingStepOccured,new(e?n?Na:Ua:Aa)(s).run(t,Ha(),o,this.dragElement,this.dragAndDropState.dataStore)),l=a.dragAndDropMode,c=a.dropAllowed;this.firstMovingStepOccured=!0,this.dragAndDropState.enabled=l,this.dragAndDropState.dropAllowed=c,Ga(t)},al.prototype._movingStep=function(){var t,n=this;return this.touchMode&&!this.holdLeftButton?(this.x=this.endPoint.x,this.y=this.endPoint.y):this.startTime?(t=(Math.min(Xa.dateNow(),this.endTime)-this.startTime)/(this.endTime-this.startTime),this.x=Math.floor(this.startPoint.x+this.distanceX*t),this.y=Math.floor(this.startPoint.y+this.distanceY*t)):(this.startTime=Xa.dateNow(),this.endTime=this.startTime+this.movingTime,this.x+=0<this.distanceX?1:-1,this.y+=0<this.distanceY?1:-1),ls.move(this.x,this.y).then(ws).then(function(t){var e=n.holdLeftButton&&n.touchMode?n.dragElement:t;return e?n._emulateEvents(e):null}).then(va)},al.prototype._isMovingFinished=function(){return this.x===this.endPoint.x&&this.y===this.endPoint.y},al.prototype._move=function(){var t=this;return this.startPoint=ls.position,this.x=this.startPoint.x,this.y=this.startPoint.y,this.distanceX=this.endPoint.x-this.startPoint.x,this.distanceY=this.endPoint.y-this.startPoint.y,this.movingTime=Math.max(Math.abs(this.distanceX),Math.abs(this.distanceY))/this.cursorSpeed,this.minMovingTime&&(this.movingTime=Math.max(this.movingTime,this.minMovingTime)),nl.whilst(function(){return!t._isMovingFinished()},function(){return t._movingStep()})},al.prototype._scroll=function(){if(this.skipScrolling)return Va.resolve();var t=new Ys({offsetX:this.offsetX,offsetY:this.offsetY},!1);return new bs(this.element,t).run()},al.prototype._moveToCurrentFrame=function(){if(ls.active)return Va.resolve();var t,e=ls.position,n=e.x,r=e.y,i=ls.activeWindow,o=null,s=null,a={cmd:il,startX:n,startY:r,endX:this.endPoint.x,endY:this.endPoint.y,modifiers:this.modifiers,speed:this.speed};return i.parent===Ac&&(o=Za.findIframeByWindow(i),t=Qa.getIframeClientCoordinates(o),a.left=t.left,a.top=t.top,a.right=t.right,a.bottom=t.bottom),ws().then(function(t){return s=t===o,i.parent===Ac&&(a.iframeUnderCursor=s),rl(a,ol,i)}).then(function(t){return ls.activeWindow=Ac,s||os(Ac)?ls.move(t.x,t.y):null})},al.prototype.run=function(){var a=this;return ws().then(function(t){a.dragElement=a.holdLeftButton?t:null;var e,n,r,i,o,s=function(t){for(var e=t;e;){if(e.draggable)return e;e=Xa.nodeParentNodeGetter.call(e)}return null}(a.dragElement);return s&&Ya.hasDataTransfer&&!a.skipDefaultDragBehavior&&(a.dragAndDropState.enabled=!0,a.dragElement=s,a.dragAndDropState.element=a.dragElement,a.dragAndDropState.dataStore=new $a,a.dragAndDropState.dataTransfer=new Ja(a.dragAndDropState.dataStore),((e=Za.isAnchorElement(a.dragElement))||Za.isImgElement(a.dragElement))&&(n=e?"href":"src",i=(r=ja.parseProxyUrl(a.dragElement[n]))?r.destUrl:a.dragElement[n],o=za.cleanUpHtml(Xa.elementOuterHTMLGetter.call(a.dragElement)),a.dragAndDropState.dataTransfer.setData("text/plain",i),a.dragAndDropState.dataTransfer.setData("text/uri-list",i),a.dragAndDropState.dataTransfer.setData("text/html",o))),a._scroll()}).then(function(){var t=a._getTargetClientPoint(),e=t.x,n=t.y,r=tl.getWidth(Ac),i=tl.getHeight(Ac);return 0<=e&&e<=r&&0<=n&&n<=i?(a.endPoint={x:e,y:n},a._moveToCurrentFrame().then(function(){return a._move()})):null}).then(function(){return a.dragAndDropState})},al);function al(t,e){this.touchMode=Ya.isTouchDevice,this.moveEvent=this.touchMode?"touchmove":"mousemove",this.holdLeftButton=e.holdLeftButton,this.dragElement=null,this.dragAndDropState=new wa,this.automationSettings=new Es(e.speed);var n=al.getTarget(t,e.offsetX,e.offsetY);this.element=n.element,this.offsetX=n.offsetX,this.offsetY=n.offsetY,this.speed=e.speed,this.cursorSpeed=this.holdLeftButton?this.automationSettings.draggingSpeed:this.automationSettings.cursorSpeed,this.minMovingTime=e.minMovingTime||null,this.modifiers=e.modifiers||{},this.skipScrolling=e.skipScrolling,this.skipDefaultDragBehavior=e.skipDefaultDragBehavior,this.endPoint=null,this.movingTime=null,this.x=null,this.y=null,this.startTime=null,this.endTime=null,this.distanceX=null,this.distanceY=null,this.firstMovingStepOccured=!1}var ll,cl=o.utils.extend,ul=function(t){var e=t.element,n=void 0===e?null:e,r=t.clientPoint,i=void 0===r?null:r,o=t.screenPoint,s=void 0===o?null:o,a=t.isTarget,l=void 0!==a&&a,c=t.inMoving,u=void 0!==c&&c;this.element=n,this.clientPoint=i,this.screenPoint=s,this.isTarget=l,this.inMoving=u,this.devicePoint=ns(i)},dl=(s(hl,ll=y.serviceUtils.EventEmitter),hl.prototype._getElementForEvent=function(t){var e=t.point;return vs(e.x,e.y,y.positionUtils.containsOffset(this.element,this.options.offsetX,this.options.offsetY)?this.element:null).then(function(t){return t.element})},hl.prototype._moveToElement=function(){var t=this,e=new aa(cl({skipScrolling:!0},this.options),!1);return new sl(this.element,e).run().then(function(){return y.delay(t.automationSettings.mouseActionStepDelay)})},hl.prototype._scrollToElement=function(){var s=this,t=new Ys(this.options),e=new bs(this.element,t),a=!1;return e.run().then(function(t){return a=t,y.delay(s.automationSettings.mouseActionStepDelay)}).then(ws).then(function(t){if(!t||!y.domUtils.contains(s.element,t)||!a)return null;var e=Ha(),n=y.domUtils.getCommonAncestor(t,e),r=y.positionUtils.getClientPosition(t),i=ns({x:r.x,y:r.y}),o={clientX:r.x,clientY:r.y,screenX:i.x,screenY:i.y,ctrl:!1,alt:!1,shift:!1,meta:!1,buttons:y.eventUtils.BUTTONS_PARAMETER.leftButton};return Ta.leaveElement(t,e,n,o),Ta.enterElement(t,e,n,o),Ga(t),a})},hl.prototype._getElementOffset=function(){var t=is(this.element),e=this.options,n=e.offsetX,r=e.offsetY;return{offsetX:n=n||0===n?n:t.offsetX,offsetY:r=r||0===r?r:t.offsetY}},hl.prototype._wrapAction=function(t){var d=this,e=this._getElementOffset(),r=e.offsetX,i=e.offsetY,h=es(this.element,r,i),f=y.positionUtils.getClientPosition(this.element);return t().then(function(){var t,e,n,a=es(d.element,r,i),l=y.positionUtils.getClientPosition(d.element),c=(t=d.element,e=a,n=y.styleUtils.getElementScroll(t),!/html/i.test(t.tagName)&&y.styleUtils.hasScroll(t)&&(e.x-=n.left,e.y-=n.top),y.positionUtils.offsetToClientCoords(e)),u=y.positionUtils.containsOffset(d.element,r,i)?d.element:null;return vs(c.x,c.y,u).then(function(t){var e=t.element,n=t.corrected,r=e;if(!r)return new ul({});var i=(i=!u||n||r===d.element)||-1<y.arrayUtils.indexOf(y.domUtils.getParents(r),d.element),o=h.x!==a.x||h.y!==a.y,s=f.x!==l.x||f.y!==l.y;return new ul({element:e,clientPoint:c,screenPoint:a,isTarget:i,inMoving:o&&s})})})},hl._checkElementState=function(t,e){if(!t.element)throw new Error(ys);if(e&&(!t.isTarget||t.inMoving))throw new Error(_s);return t},hl.prototype._ensureElement=function(e,n,r){var i=this;return this._wrapAction(function(){return i._scrollToElement()}).then(function(t){return hl._checkElementState(t,e)}).then(function(t){return r?t:i._wrapAction(function(){return i._moveToElement()})}).then(function(t){return n||hl._checkElementState(t,e),t}).then(function(t){return i.emit(i.TARGET_ELEMENT_FOUND_EVENT,{element:t.element}),{element:t.element,clientPoint:t.clientPoint,screenPoint:t.screenPoint,devicePoint:t.devicePoint}})},hl);function hl(t,e){var n=ll.call(this)||this;return n.TARGET_ELEMENT_FOUND_EVENT="automation|target-element-found-event",n.element=t,n.options=e,n.automationSettings=new Es(e.speed),n}var fl,ml=o.Promise,pl=(s(gl,fl=dl),gl.prototype.run=function(t){var e=this,n=ml.resolve();return this.element!==Dc.scrollingElement&&this.element!==Dc.documentElement&&(n=this._ensureElement(t,!0,!0)),n.then(function(){e.element.scrollLeft=e.scrollLeft,e.element.scrollTop=e.scrollTop})},gl);function gl(t,e,n){var r,i,o,s,a,l=e.x,c=e.y,u=e.position,d=e.byX,h=e.byY,f=fl.call(this,t,n)||this;return u&&(i=t,o=u,s=Math.floor(i.scrollWidth/2-i.clientWidth/2),a=Math.floor(i.scrollHeight/2-i.clientHeight/2),l=(r={top:[s,0],right:[i.scrollWidth,a],bottom:[s,i.scrollHeight],left:[0,a],topRight:[i.scrollWidth,0],topLeft:[0,0],bottomRight:[i.scrollWidth,i.scrollHeight],bottomLeft:[0,i.scrollHeight],center:[s,a]}[o])[0],c=r[1]),f.scrollLeft="number"==typeof l?l:t.scrollLeft,f.scrollTop="number"==typeof c?c:t.scrollTop,d&&(f.scrollLeft+=d),h&&(f.scrollTop+=h),f}var vl,wl=(s(yl,vl=dl),yl.prototype.run=function(t){return this._ensureElement(t,!0,!0)},yl);function yl(t,e){return vl.call(this,t,e)||this}function _l(t,e){if(!y.domUtils.isContentEditableElement(t))throw new Pe(e)}var El=l.nativeMethods.date,Cl=(Sl.prototype._getSpecificTimeout=function(){return this.command.selector&&"number"==typeof this.command.selector.timeout?this.command.selector.timeout:this.globalSelectorTimeout},Sl.prototype._delayAfterExecution=function(){return this.command.options&&1!==this.command.options.speed?y.delay(2e3*(1-this.command.options.speed)):l.Promise.resolve()},Sl.prototype._isExecutionTimeoutExpired=function(){return l.nativeMethods.dateNow()-this.executionStartTime>=this.commandSelectorTimeout},Sl.prototype._ensureCommandArguments=function(){if(this.command.type===m.pressKey&&y.parseKeySequence(this.command.keys).error)throw new Fe("keys")},Sl.prototype._ensureCommandElements=function(){var e=this,t=[];return this.command.selector&&t.push(Qo(this.command.selector)),this.command.type===m.dragToElement?t.push(Zo(this.command.destinationSelector,"destinationSelector")):this.command.type===m.selectEditableContent?(t.push(Zo(this.command.startSelector,"startSelector")),t.push(Zo(this.command.endSelector||this.command.startSelector,"endSelector"))):this.command.type===m.dispatchEvent&&this.command.relatedTarget&&t.push(Zo(this.command.relatedTarget,"relatedTarget")),$o(t,this.globalSelectorTimeout).then(function(t){e.elements=t})},Sl.prototype._ensureCommandElementsProperties=function(){this.command.type===m.selectText?function(t){if(!y.domUtils.isEditableElement(t))throw new Ie}(this.elements[0]):this.command.type===m.selectTextAreaContent?function(t){if(!y.domUtils.isTextAreaElement(t))throw new be}(this.elements[0]):this.command.type===m.selectEditableContent?(_l(this.elements[0],"startSelector"),_l(this.elements[1],"endSelector"),function(t){if(!y.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new Re}(this.elements)):this.command.type!==m.setFilesToUpload&&this.command.type!==m.clearUpload||function(t){if(!y.domUtils.isFileInput(t))throw new Ge}(this.elements[0])},Sl.prototype._ensureCommandOptions=function(){var t,e,n,r,i;this.elements.length&&this.command.options&&"offsetX"in this.command.options&&"offsetY"in this.command.options&&(t=this.elements[0],e=this.command.options,n=_.getOffsetOptions(t,e.offsetX,e.offsetY),r=n.offsetX,i=n.offsetY,e.offsetX=r,e.offsetY=i)},Sl.prototype._createAutomation=function(){var t;switch(this.command.type){case m.dispatchEvent:return this.elements[1]&&(this.command.options.relatedTarget=this.elements[1]),new _.DispatchEvent(this.elements[0],this.command.eventName,this.command.options);case m.click:return/option|optgroup/.test(y.domUtils.getTagName(this.elements[0]))?new _.SelectChildClick(this.elements[0],this.command.options):new _.Click(this.elements[0],this.command.options);case m.rightClick:return new _.RClick(this.elements[0],this.command.options);case m.doubleClick:return new _.DblClick(this.elements[0],this.command.options);case m.hover:return new _.Hover(this.elements[0],this.command.options);case m.drag:return new _.DragToOffset(this.elements[0],this.command.dragOffsetX,this.command.dragOffsetY,this.command.options);case m.dragToElement:return new _.DragToElement(this.elements[0],this.elements[1],this.command.options);case m.scroll:var e=this.command,n=e.x,r=e.y,i=e.position,o=e.options;return new pl(this.elements[0],{x:n,y:r,position:i},o);case m.scrollBy:var s=this.command,a=s.byX,l=s.byY,o=s.options;return new pl(this.elements[0],{byX:a,byY:l},o);case m.scrollIntoView:return new wl(this.elements[0],this.command.options);case m.typeText:return new _.Type(this.elements[0],this.command.text,this.command.options);case m.selectText:case m.selectTextAreaContent:return t=_.calculateSelectTextArguments(this.elements[0],this.command),new _.SelectText(this.elements[0],t.startPos,t.endPos,this.command.options);case m.selectEditableContent:return new _.SelectEditableContent(this.elements[0],this.elements[1],this.command.options);case m.pressKey:return new _.Press(y.parseKeySequence(this.command.keys).combinations,this.command.options);case m.setFilesToUpload:return new _.Upload(this.elements[0],this.command.filePath,function(t,e){return new Oe(t,e)});case m.clearUpload:return new _.Upload(this.elements[0])}return null},Sl.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){n._ensureCommandOptions();var t=n._createAutomation();return t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n.targetElement=t.element,n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()}):(n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()),t.run(e)})},Sl.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return y.promiseUtils.whilst(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(e._isExecutionTimeoutExpired()){if(t.message===_.ERROR_TYPES.foundElementIsNotTarget)return n=!1,l.Promise.resolve();throw t.message===_.ERROR_TYPES.elementIsInvisibleError?new ce:t}return y.delay(250)})})},Sl.prototype.execute=function(){var i=this;return this.command.options&&!this.command.options.speed&&(this.command.options.speed=this.testSpeed),{startPromise:new l.Promise(function(t){i.executionStartedHandler=t}),completionPromise:new l.Promise(function(n){i.executionStartTime=new El;try{i._ensureCommandArguments()}catch(t){return void n(new cr({isCommandResult:!0,executionError:t}))}i.commandSelectorTimeout=i._getSpecificTimeout(),i.statusBar.showWaitingElementStatus(i.commandSelectorTimeout);var t=xo(function(){return i._runRecursively()}),e=t.actionPromise,r=t.barriersPromise;e.then(function(){return l.Promise.all([i._delayAfterExecution(),r])}).then(function(){var t={isCommandResult:!0},e=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(i.elements);i.targetElement&&(e[0]=i.targetElement),t.result=Dr(new kr).encode(e),n(new cr(t))}).catch(function(t){return i.statusBar.hideWaitingElementStatus(!1).then(function(){return n(new cr({isCommandResult:!0,executionError:t}))})})})}},Sl);function Sl(t,e,n,r){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.testSpeed=r,this.targetElement=null,this.elements=[],this.ensureElementsPromise=null,this.ensureElementsStartTime=null,this.executionStartTime=null,this.executionStartedHandler=null,this.commandSelectorTimeout=null}function Il(t,e,n){return Math.min(Math.max(e,t),n)}function Tl(t,e){var n="number"==typeof t.min,r="number"==typeof t.max,i="number"==typeof t.length;return i&&(t.length=Il(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=Il(t.min,0,e),t.max=Il(t.max,0,e),t.length=t.max-t.min,t}function xl(t,e,n){return Math.round(t+Il(e-t,0,n)/2)}var bl=l.eventSandbox.message,Wl="driver|browser-manipulation|request",Ml="driver|browser-manipulation|response";bl.on(bl.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,r,i,o;e.message.cmd===Wl&&(t=y.domUtils.findIframeByWindow(e.source),r=(n=e.message).command,(i=n.cropDimensions)&&(r.options=new qs({crop:i,includePaddings:!1})),(o=new Pl(r)).element=t,o.execute().then(function(t){return bl.sendServiceMsg({cmd:Ml,result:t},e.source)}))});var Pl=(Al.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}},Al.prototype._createManipulationReadyMessage=function(){var t=Ac.devicePixelRatio||1,e={cmd:f.readyForBrowserManipulation,pageDimensions:{dpr:t,innerWidth:Ac.innerWidth,innerHeight:Ac.innerHeight,documentWidth:Dc.documentElement.clientWidth,documentHeight:Dc.documentElement.clientHeight,bodyWidth:Dc.body.clientWidth,bodyHeight:Dc.body.clientHeight},disableResending:!0};return this.command.type===m.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},Al.prototype._runScrollBeforeScreenshot=function(){var i=this;return l.Promise.resolve().then(function(){if(i.element||!i.command.selector)return l.Promise.resolve();var t=i.command.selector.timeout,e="number"==typeof t?t:i.globalSelectorTimeout;return i.statusBar.showWaitingElementStatus(e),$o([Qo(i.command.selector)],i.globalSelectorTimeout).then(function(t){i.statusBar.hideWaitingElementStatus(),i.element=t[0]}).catch(function(t){throw i.statusBar.hideWaitingElementStatus(),t})}).then(function(){!function(t,e){var n=t.getBoundingClientRect(),r={left:n.left,right:n.right,top:n.top,bottom:n.bottom},i=y.styleUtils.getElementMargin(t),o=y.styleUtils.getElementPadding(t),s=y.styleUtils.getBordersWidth(t);e.originOffset={x:0,y:0};var a=r.left+t.scrollWidth+s.left+s.right,l=r.top+t.scrollHeight+s.top+s.bottom;r.right=Math.max(r.right,a),r.bottom=Math.max(r.bottom,l),e.includeBorders&&e.includePaddings?e.includeMargins&&(e.originOffset.x-=i.left,e.originOffset.y-=i.top,r.left-=i.left,r.top-=i.top,r.right+=i.right,r.bottom+=i.bottom):(e.originOffset.x+=s.left,e.originOffset.y+=s.top,r.left+=s.left,r.top+=s.top,r.right-=s.right,r.bottom-=s.bottom,e.includePaddings||(e.originOffset.x+=o.left,e.originOffset.y+=o.top,r.left+=o.left,r.top+=o.top,r.right-=o.right,r.bottom-=o.bottom)),r.width=r.right-r.left,r.height=r.bottom-r.top;var c=Tl({min:e.crop.left,max:e.crop.right,length:e.crop.width},r.width),u=Tl({min:e.crop.top,max:e.crop.bottom,length:e.crop.height},r.height);if(e.crop.left=c.min,e.crop.right=c.max,e.crop.width=c.length,e.crop.top=u.min,e.crop.bottom=u.max,e.crop.height=u.length,e.crop.width<=0||e.crop.height<=0)throw new qe(e.crop.width,e.crop.height);var d=y.styleUtils.getViewportDimensions();(r.width>d.width||r.height>d.height)&&(e.scrollToCenter=!0);var h="number"==typeof e.scrollTargetX,f="number"==typeof e.scrollTargetY;h||(e.scrollTargetX=xl(e.crop.left,e.crop.right,d.width)),f||(e.scrollTargetY=xl(e.crop.top,e.crop.bottom,d.height));var m=_.getOffsetOptions(t,e.scrollTargetX,e.scrollTargetY),p=m.offsetX,g=m.offsetY;e.scrollTargetX=p,e.scrollTargetY=g;var v=!h||e.scrollTargetX>=e.crop.left&&e.scrollTargetX<=e.crop.right,w=!f||e.scrollTargetY>=e.crop.top&&e.scrollTargetY<=e.crop.bottom;if(!v||!w)throw new Ye(v,w)}(i.element,i.command.options);var t=i.command.options,e=t.scrollTargetX,n=t.scrollTargetY,r=t.scrollToCenter;return new _.Scroll(i.element,new Ys({offsetX:e,offsetY:n,scrollToCenter:r,skipParentFrames:!0})).run()})},Al.prototype._hideUI=function(){return n.hide(),this.command.markData&&n.showScreenshotMark(this.command.markData),y.delay(500)},Al.prototype._showUI=function(){this.command.markData&&n.hideScreenshotMark(),n.show()},Al.prototype._requestManipulation=function(){if(!os(Ac))return l.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var t=this._getAbsoluteCropValues();return y.sendRequestToFrame({cmd:Wl,command:this.command,cropDimensions:t},Ml,Ac.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}})},Al.prototype._runManipulation=function(){var r=this,i=null;return l.Promise.resolve().then(function(){return r.command.type!==m.takeElementScreenshot?l.Promise.resolve():(y.scrollController.stopPropagation(),r._runScrollBeforeScreenshot())}).then(function(){return os(Ac)?l.Promise.resolve():r._hideUI()}).then(function(){return r._requestManipulation()}).then(function(t){var e=t.result,n=t.error;if(n)throw n;return y.scrollController.enablePropagation(),i=e,os(Ac)||r._showUI(),y.delay(200)}).then(function(){return new cr({isCommandResult:!0,result:i})}).catch(function(t){return y.scrollController.enablePropagation(),new cr({isCommandResult:!0,executionError:t})})},Al.prototype.execute=function(){var t=this;return xo(function(){return t._runManipulation()}).barriersPromise},Al);function Al(t,e,n){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.element=null}var Dl=o.Promise,Rl=(Nl.prototype.setAsMaster=function(t){return vo(new Ki(t),this.driverWindow,wo,fn)},Nl.prototype.closeAllChildWindows=function(){return vo(new Qi,this.driverWindow,wo,gn)},Nl.prototype.findChildWindows=function(t,e){return vo(new e(t),this.driverWindow,wo,fn)},Nl.prototype.startToRestore=function(){return vo(new eo,this.driverWindow,wo,fn)},Nl);function Nl(t,e){this.driverWindow=t,this.windowId=e}var kl=(Fl.prototype._getTopOpenedWindow=function(t){for(var e=t;e.opener;)e=e.opener;return e.top},Fl.prototype._setAsMaster=function(t,e){return vo(new Ki(e),t,wo,fn)},Fl.prototype.getTopOpenedWindow=function(){return this._getTopOpenedWindow(this.currentDriverWindow)},Fl.prototype.setTopOpenedWindowAsMaster=function(){var t=this._getTopOpenedWindow(this.currentDriverWindow);return this._setAsMaster(t)},Fl.prototype.setParentWindowAsMaster=function(t){void 0===t&&(t={});var e=this.currentDriverWindow.opener;return this._setAsMaster(e,t.finalizePendingCommand)},Fl.prototype.restoreChild=function(r){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){return e=new io(r),n=this.currentDriverWindow.opener,vo(e,n,wo,fn),[2]})})},Fl);function Fl(t){this.currentDriverWindow=t}var Ll,Ul="master",Ol="replica",Bl=o.settings,Hl=o.transport,Gl=o.Promise,Vl=o.eventSandbox.message,Xl=o.storages,Yl=o.nativeMethods,zl=Yl.date,jl=o.eventSandbox.listeners,ql="testcafe|driver|test-done-sent-flag",Kl="testcafe|driver|pending-status",Jl="testcafe|driver|executing-client-function-descriptor",$l="testcafe|driver|selector-execution-start-time",Ql="testcafe|driver|pending-page-error",Zl="testcafe|driver|active-iframe-selector",tc="testcafe|driver|test-speed",ec="testcafe|driver|assertion-retries-timeout",nc="testcafe|driver|assertion-retries-start-time",rc="testcafe|driver|console-messages",ic="testcafe|driver|pending-child-window-count",oc={NotLoadedError:tn,NotFoundError:se,IsInvisibleError:ce},sc={NotLoadedError:rn,NotFoundError:Gn,IsInvisibleError:Yn},ac=Math.pow(2,31)-1,lc="status-with-command-result-event",cc="empty-command-event",uc="child-window-closed",dc=(s(hc,Ll=y.serviceUtils.EventEmitter),hc.prototype._isOpenedInIframe=function(){var t=Ac.opener;return t&&t.top&&t.top!==t},Object.defineProperty(hc.prototype,"speed",{get:function(){return this.contextStorage.getItem(tc)},set:function(t){this.contextStorage.setItem(tc,t)},enumerable:!1,configurable:!0}),Object.defineProperty(hc.prototype,"consoleMessages",{get:function(){return new rr(this.contextStorage.getItem(rc))},set:function(t){return this.contextStorage.setItem(rc,t?t.getCopy():null)},enumerable:!1,configurable:!0}),hc.prototype._getReadyPromise=function(){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,y.eventUtils.documentReady(this.pageLoadTimeout)];case 1:return t.sent(),[4,this.pageInitialRequestBarrier.wait(!0)];case 2:return t.sent(),[2]}})})},hc.prototype._hasPendingActionFlags=function(t){return t.getItem(this.COMMAND_EXECUTING_FLAG)||t.getItem(this.EXECUTING_IN_IFRAME_FLAG)},hc.prototype._getCurrentWindowId=function(){var t=Ac.location.toString(),e=o.utils.url.parseProxyUrl(t);return e&&e.windowId||null},hc.prototype._onJsError=function(t){if(this.skipJsErrors||this.contextStorage.getItem(ql))return Gl.resolve();var e=new Rt(t.stack,t.pageUrl);return this.contextStorage.getItem(Ql)||this.contextStorage.setItem(Ql,e),null},hc.prototype._unlockPageAfterTestIsDone=function(){return y.disableRealEventsPreventing(),Gl.resolve()},hc.prototype._failIfClientCodeExecutionIsInterrupted=function(){var t=this.contextStorage.getItem(Jl);return!!t&&(this._onReady(new cr({isCommandResult:!0,executionError:new wt(t.instantiationCallsiteName)})),!0)},hc.prototype.onCustomClientScriptError=function(t,e){var n=e?new Yt(t,e):new Gt(t);this.contextStorage.getItem(Ql)||this.contextStorage.setItem(Ql,n)},hc.prototype._addChildWindowDriverLink=function(t){var e=new Rl(t.window,t.windowId);this.childWindowDriverLinks.push(e),this._ensureClosedChildWindowWatcher()},hc.prototype._ensureClosedChildWindowWatcher=function(){var e=this;this.checkClosedChildWindowIntervalId||(this.checkClosedChildWindowIntervalId=Yl.setInterval.call(Ac,function(){var t=y.arrayUtils.find(e.childWindowDriverLinks,function(t){return t.driverWindow.closed});t&&(e.emit(uc),y.arrayUtils.remove(e.childWindowDriverLinks,t),t.ignoreMasterSwitching||e._setCurrentWindowAsMaster(),e.childWindowDriverLinks.length||(Yl.clearInterval.call(Ac,e.checkClosedChildWindowIntervalId),delete e.checkClosedChildWindowIntervalId))},200))},hc.prototype._setAsMasterInProgressOrCompleted=function(){return this.setAsMasterInProgress||this.role===Ul},hc.prototype._setCurrentWindowAsMaster=function(){var t=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,this._clearActiveChildIframeInfo(),Gl.resolve().then(function(){return y.browser.setActiveWindowId(t.browserActiveWindowId,o.createNativeXHR,t.windowId)}).then(function(){t._startInternal({finalizePendingCommand:!0,isFirstRequestAfterWindowSwitching:!0}),t.setAsMasterInProgress=!1}).catch(function(){t._onReady(new cr({isCommandResult:!0,executionError:new fn}))}))},hc.prototype._onChildWindowOpened=function(t){this._addChildWindowDriverLink(t),this._switchToChildWindow(t.windowId)},hc.prototype._sendStartToRestoreCommand=function(){if(this.contextStorage){this._stopRespondToChildren=!0,this.contextStorage.setItem(ic,this.childWindowDriverLinks.length);for(var t=0,e=this.childWindowDriverLinks;t<e.length;t++)e[t].startToRestore()}},hc.prototype._onFormSubmit=function(t){this.contextStorage&&this.contextStorage.getItem(ql)&&(t.preventSubmit=!0)},hc.prototype._onConsoleMessage=function(t){var e=t.meth,n=t.line,r=this.consoleMessages;r.addMessage(e,n,this.windowId),this.consoleMessages=r},hc.prototype._addPendingErrorToStatus=function(t){var e=this.contextStorage.getItem(Ql);e&&(this.contextStorage.setItem(Ql,null),t.pageError=e)},hc.prototype._addUnexpectedDialogErrorToStatus=function(t){var e=this.nativeDialogsTracker.getUnexpectedDialogError();t.pageError=t.pageError||e},hc.prototype._addConsoleMessagesToStatus=function(t){t.consoleMessages=this.consoleMessages,this.consoleMessages=null},hc.prototype._addPendingWindowSwitchingStateToStatus=function(t){t.isPendingWindowSwitching=!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},hc.prototype._sendStatusRequest=function(t){function e(){return y.getTimeLimitedPromise(Hl.asyncServiceMsg(r),5e3)}function n(){return y.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},hc.prototype._sendStatus=function(t){var e=this;t.resent||(this._addPendingErrorToStatus(t),this._addUnexpectedDialogErrorToStatus(t),this._addConsoleMessagesToStatus(t),this._addPendingWindowSwitchingStateToStatus(t)),this.contextStorage.setItem(Kl,t);var n=null;return y.pageUnloadBarrier.wait(0).then(function(){return e._sendStatusRequest(t)}).then(function(t){return n=t,y.pageUnloadBarrier.wait(0)}).then(function(){return e.contextStorage.setItem(Kl,null),n})},hc.prototype._addChildIframeDriverLink=function(t,e){var n,r=this._getChildIframeDriverLinkByWindow(e);r||(n=this.testRunId+"-"+ar(),r=new _o(e,n),this.childIframeDriverLinks.push(r)),r.sendConfirmationMessage(t)},hc.prototype._getTargetWindowNotFoundResult=function(t,e){return Gl.resolve({success:!1,errCode:t,errMsg:e})},hc.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===rt||t.result.errCode===lt});return(n=n||t.find(function(t){return!!t.result.errCode}))?{errCode:n.result.errCode}:void 0},hc.prototype._handleWindowValidation=function(n,r,i,o){return c(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this._validateWindow(n,r,i,o)];case 1:return e=t.sent(),yo({requestMsgId:n.id,window:r,result:e}),[2]}})})},hc.prototype._getWindowInfo=function(){var t=o.utils.url.parseProxyUrl(Ac.location.toString());return{id:this.windowId,title:Dc.title,url:t.destUrl}},hc.prototype._isTargetWindow=function(t){return t.windowId===this.windowId},hc.prototype._validateWindow=function(r,t,i,o){return c(this,void 0,void 0,function(){var e,n;return u(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,Gl.all(e)]):[2,this._getTargetWindowNotFoundResult(it)];case 1:return n=t.sent(),[2,this._getChildWindowValidateResult(n)]}})})},hc._createWindowValidationError=function(t){var e=t.errCode;return new(e===rt?yn:e===lt?Sn:bn)},hc.prototype._getCloseWindowFoundResult=function(){return this.parentWindowDriverLink?this.childWindowDriverLinks.length?Gl.resolve({success:!1,errCode:rt}):Gl.resolve({success:!0}):Gl.resolve({success:!1,errCode:lt})},hc.prototype._handleCloseWindowValidation=function(t,e){var n=this;return this._handleWindowValidation(t,e,function(){return n._getCloseWindowFoundResult()},Ci)},hc.prototype._handleSwitchToWindowValidation=function(t,e){return this._handleWindowValidation(t,e,function(){return Gl.resolve({success:!0})},Ti)},hc.prototype._handleCloseWindow=function(e,n){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this._closeWindow(e,n)];case 1:return t.sent(),yo({requestMsgId:e.id,window:n}),[2]}})})},hc.prototype._closeWindowAndWait=function(t,e){var n=this._createWaitForEventPromise(uc,2e3);return t.ignoreMasterSwitching=!e.isCurrentWindow,t.driverWindow.close(),n},hc.prototype._closeWindow=function(e){if(!this.childWindowDriverLinks.length)return Gl.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,Ai)});return Gl.all(n)},hc.prototype._getWindows=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return u(this,function(t){switch(t.label){case 0:return this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows({},Wi)}),[4,Gl.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]}})})},hc.prototype._handleGetWindows=function(n,r){return c(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this._getWindows(n,r)];case 1:return e=t.sent(),yo({requestMsgId:n.id,window:r,result:e}),[2]}})})},hc.prototype._handleSwitchToWindow=function(e,n){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this._switchToWindow(e)];case 1:return t.sent(),yo({requestMsgId:e.id,window:n}),[2]}})})},hc.prototype._switchToWindow=function(e){var t=this;return this._isTargetWindow(e)?Gl.resolve().then(function(){t._setCurrentWindowAsMaster()}):this.childWindowDriverLinks.length?Gl.all(this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,Ni)})):Gl.resolve()},hc.prototype._handleSetAsMasterMessage=function(t,e){var n=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,yo({requestMsgId:t.id,window:e}),Gl.resolve().then(function(){return y.browser.setActiveWindowId(n.browserActiveWindowId,o.createNativeXHR,n.windowId)}).then(function(){n._startInternal({finalizePendingCommand:t.finalizePendingCommand,result:{id:n.windowId}}),n.setAsMasterInProgress=!1}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new fn}))}))},hc.prototype._handleCloseAllWindowsMessage=function(t,e){var n=this;this._closeAllChildWindows().then(function(){yo({requestMsgId:t.id,window:e})}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new gn}))})},hc.prototype._handleStartToRestoreChildLinkMessage=function(){this.parentWindowDriverLink.restoreChild(this._getCurrentWindowId())},hc.prototype._handleRestoreChildLink=function(t,e){this._stopRespondToChildren||(this._addChildWindowDriverLink({window:e,windowId:t.windowId}),this.childWindowDriverLinks.length===this.contextStorage.getItem(ic)&&this._restoreChildWindowsPromiseResolver&&(this._restoreChildWindowsPromiseResolver(),delete this._restoreChildWindowsPromiseResolver,this.contextStorage.setItem(ic,0)),yo({requestMsgId:t.id,window:e}))},hc.prototype._handleChildWindowIsOpenedInIFrame=function(){var e=this;this._pendingChildWindowInIFrame=new Gl(function(t){e._resolvePendingChildWindowInIframe=t})},hc.prototype._handleChildWindowIsLoadedInIFrame=function(e,t){yo({requestMsgId:e.id,window:t}),this._resolvePendingChildWindowInIframe(),this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId})||this._onChildWindowOpened({window:t,windowId:e.windowId})},hc.prototype._initChildDriverListening=function(){var r=this;Vl.on(Vl.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message,n=t.source;switch(e.type){case ri:r._addChildIframeDriverLink(e.id,n);break;case wi:r._handleChildWindowIsOpenedInIFrame(e,n);break;case vi:r._handleChildWindowIsLoadedInIFrame(e,n);break;case fi:r._handleSetAsMasterMessage(e,n);break;case ii:r._handleSwitchToWindow(e,n);break;case oi:r._handleCloseWindow(e,n);break;case ai:r._handleSwitchToWindowValidation(e,n);break;case si:r._handleCloseWindowValidation(e,n);break;case li:r._handleGetWindows(e,n);break;case mi:r._handleCloseAllWindowsMessage(e,n);break;case pi:r._handleStartToRestoreChildLinkMessage();break;case gi:r._handleRestoreChildLink(e,n)}})},hc.prototype._getChildIframeDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childIframeDriverLinks,function(t){return t.driverWindow===e})},hc.prototype._getChildWindowDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childWindowDriverLinks,function(t){return t.driverWindow===e})},hc.prototype._runInActiveIframe=function(t){var e=this,n=Gl.resolve(),r=this.contextStorage.getItem(Zl);!this.activeChildIframeDriverLink&&r&&(n=this._switchToIframe(r,sc)),n.then(function(){return e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!0),e.activeChildIframeDriverLink.executeCommand(t,e.speed)}).then(function(t){return e._onCommandExecutedInIframe(t)}).catch(function(t){return e._onCommandExecutedInIframe(new cr({isCommandResult:!0,executionError:t}))})},hc.prototype._onCommandExecutedInIframe=function(t){var e=this;this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1);var n=Gl.resolve();this._pendingChildWindowInIFrame&&(n=this._pendingChildWindowInIFrame),n.then(function(){e._onReady(t)})},hc.prototype._ensureChildIframeDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildIframeDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},hc.prototype._ensureChildWindowDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildWindowDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},hc.prototype._switchToIframe=function(e,n){var t,r,i,o,s,a,l,c=this,u="number"==typeof e.timeout?e.timeout:this.selectorTimeout;return t=e,r=u,i=null,o=function(t){return new n.NotFoundError(t)},s=function(){return new n.IsInvisibleError},a=this.statusBar,l=new zo(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(!y.domUtils.isIframeElement(t))throw new $e;return c._ensureChildIframeDriverLink(Yl.contentWindowGetter.call(t),n.NotLoadedError,u)}).then(function(t){t.availabilityTimeout=u,c.activeChildIframeDriverLink=t,c.contextStorage.setItem(Zl,e)})},hc.prototype._createWaitForEventPromise=function(e,n){var r=this,i=null,t=new Gl(function(t){Yl.setTimeout.call(Ac,function(){r.off(e,i),t()},n)}),o=new Gl(function(t){i=function(){this.off(e,i),t()},r.on(e,i)});return Gl.race([t,o])},hc.prototype._waitForCurrentCommandCompletion=function(){return this.contextStorage.getItem(this.COMMAND_EXECUTING_FLAG)?this._createWaitForEventPromise(lc,ac):Gl.resolve()},hc.prototype._waitForEmptyCommand=function(){return this._createWaitForEventPromise(cc,3e4)},hc.prototype._abortSwitchingToChildWindowIfItClosed=function(){if(this.activeChildWindowDriverLink.driverWindow.closed)throw y.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),this.activeChildWindowDriverLink=null,new Fn},hc.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 Dl.resolve(null);var n=y.arrayUtils.find(t,function(t){return t.windowId===e});if(n)return Dl.resolve(n);var r=new an;return Dl.reject(r)}(t,this.childWindowDriverLinks).then(function(t){return e._ensureChildWindowDriverLink(t.driverWindow,un,e.childWindowReadyTimeout)}).then(function(t){return e.activeChildWindowDriverLink=t,e._waitForCurrentCommandCompletion()}).then(function(){return n?void 0:e._waitForEmptyCommand()}).then(function(){return 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 Fn?e._onReady(new cr):e._onReady(new cr({isCommandResult:!0,executionError:new fn}))})},hc.prototype._switchToTopParentWindow=function(){var t=this.parentWindowDriverLink.setTopOpenedWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(t)},hc.prototype._switchToParentWindow=function(t){void 0===t&&(t={});var e=this.parentWindowDriverLink.setParentWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(e,t)},hc.prototype._switchToParentWindowInternal=function(t,e){var n=this;return void 0===e&&(e={}),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0),Gl.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 cr({isCommandResult:!0,executionError:new fn}))})},hc.prototype._switchToMainWindow=function(t){this.activeChildIframeDriverLink&&this.activeChildIframeDriverLink.executeCommand(t),this._clearActiveChildIframeInfo()},hc.prototype._clearActiveChildIframeInfo=function(){this.contextStorage.setItem(Zl,null),this.activeChildIframeDriverLink=null},hc.prototype._setNativeDialogHandlerInIframes=function(t){for(var e=new zi(t),n=0;n<this.childIframeDriverLinks.length;n++)Vl.sendServiceMsg(e,this.childIframeDriverLinks[n].driverWindow)},hc.prototype._onActionCommand=function(t){var e,n,r,i,o=this,s=(e=t,n=this.selectorTimeout,r=this.statusBar,i=this.speed,new Cl(e,n,r,i).execute()),a=s.startPromise,l=s.completionPromise;a.then(function(){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!0)}),l.then(function(t){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!1),o._onReady(t)})},hc.prototype._onSetNativeDialogHandlerCommand=function(t){this.nativeDialogsTracker.setHandler(t.dialogHandler),this._setNativeDialogHandlerInIframes(t.dialogHandler),this._onReady(new cr({isCommandResult:!0}))},hc.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new cr({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},hc.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new cr({isCommandResult:!0}))},hc.prototype._onNavigateToCommand=function(t){var e=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),function(r){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new y.RequestBarrier,l.navigateTo(r.url,r.forceReload),[4,l.Promise.all([e.wait(),y.pageUnloadBarrier.wait()])];case 1:return t.sent(),[2,new cr({isCommandResult:!0})];case 2:return n=t.sent(),[2,new cr({isCommandResult:!0,executionError:n})];case 3:return[2]}})})}(t).then(function(t){return e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e._onReady(t)})},hc.prototype._onExecuteClientFunctionCommand=function(t){var e=this;this.contextStorage.setItem(Jl,{instantiationCallsiteName:t.instantiationCallsiteName}),new Hr(t).getResultDriverStatus().then(function(t){e.contextStorage.setItem(Jl,null),e._onReady(t)})},hc.prototype._onExecuteSelectorCommand=function(t){var e,n,r,i,o,s,a,l=this,c=this.contextStorage.getItem($l)||new zl,u=t.needError?function(t){return new Pt(null,t)}:null;e=t,n=this.selectorTimeout,r=c,o=i=u,s=this.statusBar,a=new zo(e,n,r,i,o),s.showWaitingElementStatus(a.timeout),a.getResultDriverStatus().then(function(t){return s.hideWaitingElementStatus(!!t.result).then(function(){return t})}).then(function(t){l.contextStorage.setItem($l,null),l._onReady(t)})},hc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t),this._onReady(new cr({isCommandResult:!0}))},hc.prototype._onSwitchToIframeCommand=function(t){var e=this;this._switchToIframe(t.selector,oc).then(function(){return e._onReady(new cr({isCommandResult:!0}))}).catch(function(t){return e._onReady(new cr({isCommandResult:!0,executionError:t}))})},hc.prototype._onWindowOpenCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!0),Ac.open(t.url)},hc.prototype._onWindowCloseCommand=function(a){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return u(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 hc._createWindowValidationError(o);return[4,vo(new Ai({windowId:n,isCurrentWindow:r}),e,wo,fn)];case 3:return t.sent(),r||this._onReady(new cr({isCommandResult:!0})),[3,5];case 4:return s=t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:s})),[3,5];case 5:return[2]}})})},hc.prototype._onGetCurrentWindowCommand=function(){this._onReady(new cr({isCommandResult:!0,result:{id:this.windowId}}))},hc.prototype._onGetWindowsCommand=function(){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,vo(new Wi,e,wo,fn)];case 1:return n=t.sent(),this._onReady(new cr({isCommandResult:!0,result:n.result})),[2]}})})},hc.prototype._validateChildWindowCloseCommandExists=function(t,e){return vo(new Ci({windowId:t}),e,wo,fn)},hc.prototype._validateChildWindowSwitchToWindowCommandExists=function(t,e){var n=t.windowId,r=t.fn;return vo(new Ti({windowId:n,fn:r}),e,wo,fn)},hc.prototype._getTopOpenedWindow=function(){var t;return((null===(t=this.parentWindowDriverLink)||void 0===t?void 0:t.getTopOpenedWindow())||Ac).top},hc.prototype._onSwitchToWindow=function(i,o){return c(this,void 0,void 0,function(){var e,n,r;return u(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,this._validateChildWindowSwitchToWindowCommandExists({windowId:i.windowId,fn:i.findWindow},e)];case 1:return n=t.sent(),(r=n.result).success?(this._stopInternal(),vo(new Ni({windowId:i.windowId,fn:i.findWindow}),e,wo,fn)):this._onReady(new cr({isCommandResult:!0,executionError:o||hc._createWindowValidationError(r)})),[2]}})})},hc.prototype._restoreChildWindowLinks=function(){return c(this,void 0,void 0,function(){var e,n=this;return u(this,function(t){switch(t.label){case 0:if(!this.contextStorage.getItem(ic))return[2];e=new Gl(function(t){n._restoreChildWindowsPromiseResolver=t}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,y.getTimeLimitedPromise(e,3e4)];case 2:return t.sent(),[3,4];case 3:return t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:new On})),[3,4];case 4:return[2]}})})},hc.prototype._onSwitchToPreviousWindow=function(t){this._onSwitchToWindow(t,new Rn)},hc.prototype._onSwitchToParentWindow=function(){this.parentWindowDriverLink?this._switchToParentWindow({finalizePendingCommand:!0}):this._onReady(new cr({isCommandResult:!0,executionError:new Pn}))},hc.prototype._onBrowserManipulationCommand=function(t){var e,n,r,i=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),e=t,n=this.selectorTimeout,r=this.statusBar,new Pl(e,n,r).execute().then(function(t){return i.contextStorage.setItem(i.COMMAND_EXECUTING_FLAG,!1),i._onReady(t)})},hc.prototype._onSetBreakpointCommand=function(t){var e=this;this.statusBar.showDebuggingStatus(t).then(function(t){return e._onReady(new cr({isCommandResult:!0,result:t}))})},hc.prototype._onSetTestSpeedCommand=function(t){this.speed=t.speed,this._onReady(new cr({isCommandResult:!0}))},hc.prototype._onShowAssertionRetriesStatusCommand=function(t){this.contextStorage.setItem(ec,t.timeout),this.contextStorage.setItem(nc,Yl.dateNow()),this.statusBar.showWaitingAssertionRetriesStatus(t.timeout),this._onReady(new cr({isCommandResult:!0}))},hc.prototype._onHideAssertionRetriesStatusCommand=function(t){var e=this;this.contextStorage.setItem(ec,null),this.contextStorage.setItem(nc,null),this.statusBar.hideWaitingAssertionRetriesStatus(t.success).then(function(){return e._onReady(new cr({isCommandResult:!0}))})},hc.prototype._checkStatus=function(){var r=this;return y.browser.checkStatus(this.browserStatusDoneUrl,o.createNativeXHR,{manualRedirect:!0}).then(function(t){var e=t.command,n=t.redirecting;n&&e.url.indexOf(r.testRunId)<0?(Xl.clear(),Xl.lock()):r.contextStorage.setItem(ql,!1),n?y.browser.redirect(e):r._onReady({isCommandResult:!1})}).catch(function(){return y.delay(1e3)})},hc.prototype._onCustomCommand=function(t){var e=this;(0,this.customCommandHandlers[t.type].handler)(t).then(function(t){e._onReady(new cr({isCommandResult:!0,result:t}))})},hc.prototype._closeAllChildWindows=function(){var t=this;return this.childWindowDriverLinks.length?Gl.all(this.childWindowDriverLinks.map(function(t){return t.closeAllChildWindows()})).then(function(){Yl.arrayForEach.call(t.childWindowDriverLinks,function(t){t.driverWindow.close()})}):Gl.resolve()},hc.prototype._onTestDone=function(t){var e=this;this.contextStorage.setItem(ql,!0),this.parentWindowDriverLink?this._switchToTopParentWindow():this._closeAllChildWindows().then(function(){return e._sendStatus(t)}).then(function(){e._checkStatus()}).catch(function(){e._onReady(new cr({isCommandResult:!0,executionError:gn}))})},hc.prototype._onBackupStoragesCommand=function(){this._onReady(new cr({isCommandResult:!0,result:Xl.backup()}))},hc.prototype._isStatusWithCommandResultInPendingWindowSwitchingMode=function(t){return t.isCommandResult&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},hc.prototype._isEmptyCommandInPendingWindowSwitchingMode=function(t){return!t&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},hc.prototype._onReady=function(t){var e=this;this._isStatusWithCommandResultInPendingWindowSwitchingMode(t)&&this.emit(lc),this._sendStatus(t).then(function(t){if(t)e._onCommand(t);else{if(e._isEmptyCommandInPendingWindowSwitchingMode(t))return void e.emit(cc);e._onReady(new cr)}})},hc.prototype._executeCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!1),this.customCommandHandlers[t.type]?this._onCustomCommand(t):t.type===m.testDone?this._onTestDone(new cr({isCommandResult:!0})):t.type===m.setBreakpoint?this._onSetBreakpointCommand(t.isTestError):t.type===m.switchToMainWindow?this._onSwitchToMainWindowCommand(t):t.type===m.switchToIframe?this._onSwitchToIframeCommand(t):t.type===m.openWindow?this._onWindowOpenCommand(t):t.type===m.closeWindow?this._onWindowCloseCommand(t):t.type===m.getCurrentWindow?this._onGetCurrentWindowCommand(t):t.type===m.getCurrentWindows?this._onGetWindowsCommand():t.type===m.switchToWindow?this._onSwitchToWindow(t):t.type===m.switchToPreviousWindow?this._onSwitchToPreviousWindow(t):t.type===m.switchToParentWindow?this._onSwitchToParentWindow():ht(t)?this._onBrowserManipulationCommand(t):t.type===m.executeClientFunction?this._onExecuteClientFunctionCommand(t):t.type===m.executeSelector?this._onExecuteSelectorCommand(t):t.type===m.navigateTo?this._onNavigateToCommand(t):t.type===m.setNativeDialogHandler?this._onSetNativeDialogHandlerCommand(t):t.type===m.getNativeDialogHistory?this._onGetNativeDialogHistoryCommand(t):t.type===m.getBrowserConsoleMessages?this._onGetBrowserConsoleMessagesCommand(t):t.type===m.setTestSpeed?this._onSetTestSpeedCommand(t):t.type===m.showAssertionRetriesStatus?this._onShowAssertionRetriesStatusCommand(t):t.type===m.hideAssertionRetriesStatus?this._onHideAssertionRetriesStatusCommand(t):t.type===m.backupStorages?this._onBackupStoragesCommand():this._onActionCommand(t)},hc.prototype._isExecutableInTopWindowOnly=function(t){if((e=t).type===m.testDone||e.type===m.switchToMainWindow||e.type===m.setNativeDialogHandler||e.type===m.getNativeDialogHistory||e.type===m.setTestSpeed||e.type===m.showAssertionRetriesStatus||e.type===m.hideAssertionRetriesStatus||e.type===m.setBreakpoint||ht(e)&&e.type!==m.takeElementScreenshot)return!0;var e,n=this.customCommandHandlers[t.type];return t.forceExecutionInTopWindowOnly||n&&n.isExecutableInTopWindowOnly},hc.prototype._onCommand=function(n){var r=this;this.readyPromise.then(function(){var t,e=ut(n);r.contextStorage.getItem(Ql)&&e?r._onReady(new cr({isCommandResult:!0})):(t=r.activeChildIframeDriverLink||r.contextStorage.getItem(Zl),r._isExecutableInTopWindowOnly(n)||!t?r._executeCommand(n):r._runInActiveIframe(n))})},hc.prototype.setCustomCommandHandlers=function(t,e,n){this.customCommandHandlers[t]={isExecutableInTopWindowOnly:n,handler:e}},hc.prototype._startInternal=function(t){this.role=Ul,y.browser.startHeartbeat(this.heartbeatUrl,o.createNativeXHR),this._setupAssertionRetryIndication(),this._startCommandsProcessing(t)},hc.prototype._stopInternal=function(){this.role=Ol,y.browser.stopHeartbeat(),_.cursor.hide()},hc.prototype._setupAssertionRetryIndication=function(){var n=this;this.readyPromise.then(function(){n.statusBar.hidePageLoadingStatus();var t,e=n.contextStorage.getItem(ec);e&&(t=n.contextStorage.getItem(nc),0<e-(new zl-t)&&n.statusBar.showWaitingAssertionRetriesStatus(e,t))})},hc.prototype._startCommandsProcessing=function(t){void 0===t&&(t={finalizePendingCommand:!1,isFirstRequestAfterWindowSwitching:!1,result:void 0});var e,n,r=this.contextStorage.getItem(Kl);r&&(r.resent=!0),this.contextStorage.getItem(ql)?r?this._onTestDone(r):this._checkStatus():this._failIfClientCodeExecutionIsInterrupted()||(e=t.finalizePendingCommand||this._hasPendingActionFlags(this.contextStorage),n=r||new cr({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))},hc.prototype._initParentWindowLink=function(){Ac.opener&&Ac.opener!==Ac&&this.windowId&&(this.parentWindowDriverLink=new kl(Ac))},hc.prototype._initConsoleMessages=function(){var t=this.consoleMessages;t.ensureMessageContainer(this.windowId),this.consoleMessages=t},hc.prototype._getDriverRole=function(){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return this.windowId?[4,y.browser.getActiveWindowId(this.browserActiveWindowId,o.createNativeXHR)]:[2,Ul];case 1:return[2,t.sent().activeWindowId===this.windowId?Ul:Ol]}})})},hc.prototype._init=function(){this.contextStorage=new po(Ac,this.testRunId,this.windowId),this.nativeDialogsTracker=new Zr(this.contextStorage,this.dialogHandler),this.statusBar=new n.StatusBar(this.userAgent,this.fixtureName,this.testName,this.contextStorage),this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK,y.disableRealEventsPreventing),this.speed=this.initialSpeed,this._initConsoleMessages(),this._initParentWindowLink(),this._isOpenedInIframe()&&vo(new ao(this.windowId),Ac.opener.top,wo,bn)},hc.prototype._doFirstPageLoadSetup=function(){return c(this,void 0,void 0,function(){return u(this,function(t){return this.isFirstPageLoad&&this.canUseDefaultWindowActions,[2]})})},hc.prototype.start=function(){return c(this,void 0,void 0,function(){var e;return u(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===Ul||e===Ul&&this._startInternal(),[2]}})})},hc);function hc(t,e,n,r){var i=Ll.call(this)||this;return 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.heartbeatUrl=e.heartbeat,i.browserStatusUrl=e.status,i.browserStatusDoneUrl=e.statusDone,i.browserActiveWindowId=e.activeWindowId,i.userAgent=n.userAgent,i.fixtureName=n.fixtureName,i.testName=n.testName,i.selectorTimeout=r.selectorTimeout,i.pageLoadTimeout=r.pageLoadTimeout,i.childWindowReadyTimeout=r.childWindowReadyTimeout,i.initialSpeed=r.speed,i.skipJsErrors=r.skipJsErrors,i.dialogHandler=r.dialogHandler,i.canUseDefaultWindowActions=r.canUseDefaultWindowActions,i.isFirstPageLoad=Bl.get().isFirstPageLoad,i.customCommandHandlers={},i.contextStorage=null,i.nativeDialogsTracker=null,i.childIframeDriverLinks=[],i.activeChildIframeDriverLink=null,i.childWindowDriverLinks=[],i.parentWindowDriverLink=null,i.statusBar=null,i.windowId=i._getCurrentWindowId(),i.role=Ol,i.setAsMasterInProgress=!1,i.checkClosedChildWindowIntervalId=null,i.pageInitialRequestBarrier=new y.RequestBarrier,i.readyPromise=i._getReadyPromise(),i._initChildDriverListening(),y.pageUnloadBarrier.init(),y.preventRealEvents(),o.on(o.EVENTS.uncaughtJsError,function(t){return i._onJsError(t)}),o.on(o.EVENTS.unhandledRejection,function(t){return i._onJsError(t)}),o.on(o.EVENTS.consoleMethCalled,function(t){return i._onConsoleMessage(t)}),o.on(o.EVENTS.beforeFormSubmit,function(t){return i._onFormSubmit(t)}),o.on(o.EVENTS.windowOpened,function(t){return i._onChildWindowOpened(t)}),i.setCustomCommandHandlers(m.unlockPage,function(){return i._unlockPageAfterTestIsDone()}),jl.addInternalEventBeforeListener(Ac,["beforeunload"],function(){i._sendStartToRestoreCommand()}),i}var fc=(mc.prototype.establishConnection=function(){return vo(new yi,this.driverWindow,5e3,rn).then(function(t){return t.result.id})},mc.prototype.sendConfirmationMessage=function(t){yo({requestMsgId:t,window:this.driverWindow})},mc.prototype.onCommandExecuted=function(t){var e=new Li(t);l.eventSandbox.message.sendServiceMsg(e,this.driverWindow)},mc);function mc(t){this.driverWindow=t}var pc,gc=o.eventSandbox.message,vc=(s(wc,pc=Zr),wc.prototype._defaultDialogHandler=function(t){gc.sendServiceMsg({type:Xr,dialogType:t,url:Zr._getPageUrl()},Ac.top)},wc.prototype._addAppearedDialogs=function(t,e){gc.sendServiceMsg({type:Vr,dialogType:t,text:e,url:Zr._getPageUrl()},Ac.top)},wc.prototype._onHandlerError=function(t,e){gc.sendServiceMsg({type:Yr,dialogType:t,message:e,url:Zr._getPageUrl()},Ac.top)},wc);function wc(t){return pc.call(this,null,t)||this}var yc,_c=l.eventSandbox.message,Ec=(s(Cc,yc=dc),Cc.prototype._onJsError=function(){},Cc.prototype._onConsoleMessage=function(){},Cc.prototype._onChildWindowOpened=function(){_c.sendServiceMsg(new uo,Ac.top)},Cc.prototype._initParentDriverListening=function(){var n=this;l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;y.pageUnloadBarrier.wait(0).then(function(){if(e.type===ui){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===hi&&(n.nativeDialogsTracker.setHandler(e.dialogHandler),n._setNativeDialogHandlerInIframes(e.dialogHandler))})})},Cc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t)},Cc.prototype._onReady=function(t){this.parentDriverLink.onCommandExecuted(t)},Cc.prototype.start=function(){var e=this;this.nativeDialogsTracker=new vc(this.dialogHandler),this.statusBar=new n.IframeStatusBar;var t=this.parentDriverLink.establishConnection().then(function(t){e.contextStorage=new po(Ac,t,e.windowId),e._failIfClientCodeExecutionIsInterrupted()||(e.contextStorage.getItem(e.COMMAND_EXECUTING_FLAG)||e.contextStorage.getItem(e.EXECUTING_IN_IFRAME_FLAG))&&(e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!1),e._onReady(new cr({isCommandResult:!0})))});this.readyPromise=l.Promise.all([this.readyPromise,t])},Cc);function Cc(t,e){var n=yc.call(this,t,{},{},e)||this;return n.lastParentDriverMessageId=null,n.parentDriverLink=new fc(Ac.parent),n._initParentDriverListening(),n}var Sc={NodeSnapshot:Er,ElementSnapshot:Wr,SelectorExecutor:zo},Ic="%testCafeDriver%",Tc="%testCafeIframeDriver%",xc="%ScriptExecutionBarrier%",bc="%testCafeEmbeddingUtils%",Wc=o.nativeMethods,Mc=o.EVENTS.evalIframeScript;Wc.objectDefineProperty(Ac,Ic,{configurable:!0,value:dc}),Wc.objectDefineProperty(Ac,Tc,{configurable:!0,value:Ec}),Wc.objectDefineProperty(Ac,xc,{configurable:!0,value:Io}),Wc.objectDefineProperty(Ac,bc,{configurable:!0,value:Sc}),o.on(Mc,function(t){return Pc(Wc.contentWindowGetter.call(t.iframe))})}(Ac["%hammerhead%"],Ac["%hammerhead%"].Promise,Ac["%testCafeCore%"],Ac["%testCafeAutomation%"],Ac["%testCafeUI%"])}(window);
|
|
1
|
+
window["%hammerhead%"].utils.removeInjectedScript(),function Dc(Rc){var Nc=Rc.document;!function(l,e,y,_,n){var o="default"in l?l.default:l;e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t="default"in y?y.default:y,i="default"in n?n.default:n,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function c(t,s,a,l){return new(a=a||e)(function(n,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(r,i)}o((l=l.apply(t,s||[])).next())})}function u(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;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 a,d,h=Math.floor(399);(d=a=a||{}).ready="ready",d.readyForBrowserManipulation="ready-for-browser-manipulation",d.waitForFileDownload="wait-for-file-download";var f=a,m={dispatchEvent:"dispatch-event",click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",scroll:"scroll",scrollBy:"scroll-by",scrollIntoView:"scroll-into-view",typeText:"type-text",selectText:"select-text",selectTextAreaContent:"select-text-area-content",selectEditableContent:"select-editable-content",pressKey:"press-key",wait:"wait",navigateTo:"navigate-to",setFilesToUpload:"set-files-to-upload",clearUpload:"clear-upload",executeClientFunction:"execute-client-function",executeSelector:"execute-selector",takeScreenshot:"take-screenshot",takeElementScreenshot:"take-element-screenshot",takeScreenshotOnFail:"take-screenshot-on-fail",prepareBrowserManipulation:"prepare-browser-manipulation",showAssertionRetriesStatus:"show-assertion-retries-status",hideAssertionRetriesStatus:"hide-assertion-retries-status",setBreakpoint:"set-breakpoint",resizeWindow:"resize-window",resizeWindowToFitDevice:"resize-window-to-fit-device",maximizeWindow:"maximize-window",switchToIframe:"switch-to-iframe",switchToMainWindow:"switch-to-main-window",openWindow:"open-window",closeWindow:"close-window",getCurrentWindow:"get-current-window",getCurrentWindows:"get-current-windows",switchToWindow:"switch-to-window",switchToWindowByPredicate:"switch-to-window-by-predicate",switchToParentWindow:"switch-to-parent-window",switchToPreviousWindow:"switch-to-previous-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",getActiveElement:"get-active-element",setTestSpeed:"set-test-speed",setPageLoadTimeout:"set-page-load-timeout",debug:"debug",assertion:"assertion",useRole:"useRole",testDone:"test-done",backupStorages:"backup-storages",executeExpression:"execute-expression",executeAsyncExpression:"execute-async-expression",unlockPage:"unlock-page",recorder:"recorder"},p="E1",g="E4",v="E5",w="E9",E="E10",C="E11",S="E12",I="E24",T="E26",x="E27",b="E28",W="E29",M="E30",P="E31",A="E32",D="E33",R="E34",N="E35",k="E36",F="E37",L="E39",U="E40",O="E41",B="E42",H="E43",G="E44",V="E45",X="E46",Y="E49",z="E50",j="E51",q="E52",K="E57",J="E64",$="E65",Q="E68",Z="E69",tt="E70",et="E71",nt="E72",rt="E73",it="E74",ot="E76",st="E77",at="E78",lt="E82",ct="E83";function ut(t){return!(function(t){return t.type===m.executeClientFunction||t.type===m.executeSelector}(r=t)||r.type===m.wait||r.type===m.assertion||r.type===m.executeExpression||ht(t)||(n=t).type===m.testDone||n.type===m.showAssertionRetriesStatus||n.type===m.hideAssertionRetriesStatus||n.type===m.setBreakpoint||n.type===m.takeScreenshotOnFail||n.type===m.recorder)||dt(t)&&!((e=t).type===m.switchToIframe||e.type===m.switchToMainWindow);var e,n,r}function dt(t){return t.type===m.resizeWindow||t.type===m.resizeWindowToFitDevice||t.type===m.maximizeWindow}function ht(t){return(e=t).type===m.takeScreenshot||e.type===m.takeElementScreenshot||e.type===m.takeScreenshotOnFail||dt(t);var e}function ft(t){this.code=t,this.isTestCafeError=!0,this.callsite=null}var mt,pt=(s(gt,mt=ft),gt);function gt(t,e,n){var r=mt.call(this,t)||this;return r.optionName=e,r.actualValue=n,r}var vt,wt=(s(yt,vt=ft),yt);function yt(t){var e=vt.call(this,Y)||this;return e.instantiationCallsiteName=t,e}var _t,Et=(s(Ct,_t=ft),Ct);function Ct(t){var e=_t.call(this,z)||this;return e.instantiationCallsiteName=t,e}var St,It=(s(Tt,St=ft),Tt);function Tt(t,e){var n=e.apiFnChain,r=e.apiFnIndex,i=St.call(this,t)||this;return i.apiFnChain=n,i.apiFnIndex=r,i}var xt,bt=(s(Wt,xt=ft),Wt);function Wt(){return xt.call(this,j)||this}var Mt,Pt=(s(At,Mt=It),At);function At(t,e){var n=Mt.call(this,q,e)||this;return n.callsite=t,n}var Dt,Rt=(s(Nt,Dt=ft),Nt);function Nt(t,e){var n=Dt.call(this,p)||this;return n.errStack=t,n.pageDestUrl=e,n}var kt,Ft=(s(Lt,kt=ft),Lt);function Lt(t,e){var n=kt.call(this,g)||this;return n.errMsg=String(e),n.instantiationCallsiteName=t,n}var Ut,Ot=(s(Bt,Ut=ft),Bt);function Bt(t,e,n){var r=Ut.call(this,v,e,n)||this;return r.errMsg=String(e),r.property=n,r.instantiationCallsiteName=t,r}var Ht,Gt=(s(Vt,Ht=ft),Vt);function Vt(t){var e=Ht.call(this,J)||this;return e.errMsg=String(t),e}var Xt,Yt=(s(zt,Xt=ft),zt);function zt(t,e){var n=Xt.call(this,$)||this;return n.errMsg=String(t),n.moduleName=e,n}var jt,qt=(s(Kt,jt=pt),Kt);function Kt(t,e){return jt.call(this,w,t,e)||this}var Jt,$t=(s(Qt,Jt=pt),Qt);function Qt(t,e){return Jt.call(this,E,t,e)||this}var Zt,te=(s(ee,Zt=pt),ee);function ee(t,e){return Zt.call(this,C,t,e)||this}var ne,re=(s(ie,ne=pt),ie);function ie(t,e){return ne.call(this,S,t,e)||this}var oe,se=(s(ae,oe=It),ae);function ae(t){return oe.call(this,I,t)||this}var le,ce=(s(ue,le=ft),ue);function ue(){return le.call(this,T)||this}var de,he=(s(fe,de=ft),fe);function fe(t){var e=de.call(this,x)||this;return e.nodeDescription=t,e}var me,pe=(s(ge,me=It),ge);function ge(t,e){var n=me.call(this,b,e)||this;return n.argumentName=t,n}var ve,we=(s(ye,ve=ft),ye);function ye(t){var e=ve.call(this,W)||this;return e.argumentName=t,e}var _e,Ee=(s(Ce,_e=ft),Ce);function Ce(t,e){var n=_e.call(this,M)||this;return n.argumentName=t,n.nodeDescription=e,n}var Se,Ie=(s(Te,Se=ft),Te);function Te(){return Se.call(this,P)||this}var xe,be=(s(We,xe=ft),We);function We(){return xe.call(this,A)||this}var Me,Pe=(s(Ae,Me=ft),Ae);function Ae(t){var e=Me.call(this,D)||this;return e.argumentName=t,e}var De,Re=(s(Ne,De=ft),Ne);function Ne(){return De.call(this,N)||this}var ke,Fe=(s(Le,ke=ft),Le);function Le(t){var e=ke.call(this,k)||this;return e.argumentName=t,e}var Ue,Oe=(s(Be,Ue=ft),Be);function Be(t,e){var n=Ue.call(this,F)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var He,Ge=(s(Ve,He=ft),Ve);function Ve(){return He.call(this,R)||this}var Xe,Ye=(s(ze,Xe=ft),ze);function ze(t,e){var n=Xe.call(this,O)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}var je,qe=(s(Ke,je=ft),Ke);function Ke(t,e){var n=je.call(this,K)||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 Je,$e=(s(Qe,Je=ft),Qe);function Qe(){return Je.call(this,U)||this}var Ze,tn=(s(en,Ze=ft),en);function en(){return Ze.call(this,L)||this}var nn,rn=(s(on,nn=ft),on);function on(){return nn.call(this,B)||this}var sn,an=(s(ln,sn=ft),ln);function ln(){return sn.call(this,Z)||this}var cn,un=(s(dn,cn=ft),dn);function dn(){return cn.call(this,Q)||this}var hn,fn=(s(mn,hn=ft),mn);function mn(){return hn.call(this,tt)||this}var pn,gn=(s(vn,pn=ft),vn);function vn(){return pn.call(this,et)||this}var wn,yn=(s(_n,wn=ft),_n);function _n(){return wn.call(this,rt)||this}var En,Cn,Sn=(s(In,En=ft),In);function In(){return En.call(this,lt)||this}function Tn(t){var e=Cn.call(this,at)||this;return e.errMsg=t,e}s(Tn,Cn=ft);var xn,bn=(s(Wn,xn=ft),Wn);function Wn(){return xn.call(this,it)||this}var Mn,Pn=(s(An,Mn=ft),An);function An(){return Mn.call(this,ot)||this}var Dn,Rn=(s(Nn,Dn=ft),Nn);function Nn(){return Dn.call(this,st)||this}var kn,Fn=(s(Ln,kn=ft),Ln);function Ln(){return kn.call(this,nt)||this}var Un,On=(s(Bn,Un=ft),Bn);function Bn(){return Un.call(this,ct)||this}var Hn,Gn=(s(Vn,Hn=ft),Vn);function Vn(){return Hn.call(this,H)||this}var Xn,Yn=(s(zn,Xn=ft),zn);function zn(){return Xn.call(this,G)||this}var jn,qn=(s(Kn,jn=ft),Kn);function Kn(t,e){var n=jn.call(this,V)||this;return n.dialogType=t,n.pageUrl=e,n}var Jn,$n=(s(Qn,Jn=ft),Qn);function Qn(t,e,n){var r=Jn.call(this,X)||this;return r.dialogType=t,r.errMsg=e,r.pageUrl=n,r}var Zn="_nativeMethods",tr=(er.prototype._ensureNativeMethods=function(t){return t||{objectKeys:Object.keys,arrayForEach:Array.prototype.forEach,arrayConcat:Array.prototype.concat,arraySlice:Array.prototype.slice,objectDefineProperty:Object.defineProperty}},er.prototype._getWindowIds=function(t){return this[Zn].objectKeys(t)},er.prototype._copyArray=function(t){return this[Zn].arraySlice.call(t)},er.prototype._concatArrays=function(t,e){return this[Zn].arrayConcat.call(t,e)},er.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},er.prototype.concat=function(e){var n=this;if(!e)return this;var t=this._getWindowIds(e);return this[Zn].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},er.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},er.prototype.getCopy=function(){var e=this,n={},t=this._getWindowIds(this);return this[Zn].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},er);function er(t,e){var n=this._ensureNativeMethods(e);n.objectDefineProperty(this,Zn,{value:n}),this.concat(t)}var nr,rr=(s(ir,nr=tr),ir);function ir(t){return nr.call(this,t,l.nativeMethods)||this}var or=(sr.prototype._getAssignableProperties=function(){throw new Error("Not implemented")},sr.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t)for(var r=this._getAssignableProperties(),i=0;i<r.length;i++){for(var o,s=r[i],a=s.name,l=s.type,c=s.required,u=s.init,d=s.defaultValue,h=a.split("."),f=h.length-1,m=h[f],p=t,g=this,v=0;v<f&&p&&g;v++)p=p[h[v]],g=g[h[v]];g&&"defaultValue"in r[i]&&(g[a]=d),p&&g&&(void 0===(o=p[m])&&!c||(e&&l&&l(a,o),g[m]=u?u(a,o,n):o))}},sr);function sr(){}function ar(){return l.nativeMethods.performanceNow().toString()}var lr,cr=(s(ur,lr=or),ur.prototype._getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isFirstRequestAfterWindowSwitching"}]},ur);function ur(t){var e=lr.call(this,t)||this;return e.id=ar(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isFirstRequestAfterWindowSwitching=!1,e._assignFrom(t,!0),e}var dr,hr=(function(t){function r(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,i=(0,eval)("this"),n="function"==typeof ArrayBuffer,s="function"==typeof Map,a="function"==typeof Set,l=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],c=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function u(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}r._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},r.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},r.prototype._applyTransform=function(t,e,n,r){var i=Object.create(null),o=r.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),i["@t"]=r.type,i.data=this._handleValue(o,e,n),i},r.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},r.prototype._handlePlainObject=function(n){var r=this,i=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;i[e]=r._handleValue(n[t],i,e)}),i},r.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},r.prototype._ensureCircularReference=function(t){var e=this.circularCandidates.indexOf(t);if(-1<e){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),r._createRefMark(n.refIdx)}return null},r.prototype._handleValue=function(t,e,n){var r=typeof t,i="object"==r&&null!==t;if(i){var o=this._ensureCircularReference(t);if(o)return o}for(var s=0;s<this.transforms.length;s++){var a=this.transforms[s];if(a.shouldTransform(r,t))return this._applyTransform(t,e,n,a)}return i?this._handleObject(t,e,n):t},r.prototype.transform=function(){for(var t=[this._handleValue(this.references,null,null)],e=0;e<this.circularCandidatesDescrs.length;e++){var n=this.circularCandidatesDescrs[e];0<n.refIdx&&(t[n.refIdx]=n.parent[n.key],n.parent[n.key]=r._createRefMark(n.refIdx))}return t},u.prototype._handlePlainObject=function(e){var t,n=this,r=Object.create(null),i=Object.getOwnPropertyNames(e);for(t in i.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(r[t.substring(1)]=e[t],delete e[t])}),r)e[t]=r[t]},u.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)},u.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}})},u.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])},u.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)}},u.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var d=[{type:"[[NaN]]",shouldTransform:function(t,e){return"number"===t&&isNaN(e)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",shouldTransform:function(t,e){return e instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var e=new Date;return e.setTime(t),e}},{type:"[[RegExp]]",shouldTransform:function(t,e){return e instanceof RegExp},toSerializable:function(t){var e={src:t.source,flags:""};return t.global&&(e.flags+="g"),t.ignoreCase&&(e.flags+="i"),t.multiline&&(e.flags+="m"),e},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",shouldTransform:function(t,e){return e instanceof Error},toSerializable:function(t){return{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var e=new(i[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return n&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return c.call(e)},fromSerializable:function(t){if(n){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){for(var n=0;n<l.length;n++){var r=l[n];if("function"==typeof i[r]&&e instanceof i[r])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:c.call(t)}},fromSerializable:function(t){return"function"==typeof i[t.ctorName]?new i[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return s&&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(s){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var r=[],i=0;i<t.length;i+=2)r.push([t[n],t[n+1]]);return r}},{type:"[[Set]]",shouldTransform:function(t,e){return a&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(a){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],h=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(d)};h.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},h.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},h.prototype.encode=function(t){var e=new r(t,this.transforms).transform();return this.serializer.serialize(e)},h.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new u(e,this.transformsMap).transform()}}(dr={exports:{}}),dr.exports);function fr(t,e){return new l.nativeMethods.Function("fnCode","__dependencies$","Promise","RegExp",'"use strict"; return eval(fnCode)')(t,e,l.Promise,RegExp)}var mr=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],pr=["tagName","attributes"],gr=["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"],vr={textContent:function(t){return t.textContent},childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!vr.childNodeCount(t)},childElementCount:function(t){var e=t.children;if(e)return e.length;for(var n=0,r=t.childNodes.length,i=0;i<r;i++)1===t.childNodes[i].nodeType&&n++;return n},hasChildElements:function(t){return!!vr.childElementCount(t)}},wr=(yr.prototype._initializeProperties=function(t,e,n){for(var r=0;r<e.length;r++){var i=e[r],o=n[i];this[i]=o?o(t):t[i]}},yr);function yr(){}var _r,Er=(s(Cr,_r=wr),Cr);function Cr(t){var e=_r.call(this)||this;return e._initializeProperties(t,mr,vr),e}var Sr,Ir={tagName:function(t){return t.tagName.toLowerCase()},visible:y.positionUtils.isElementVisible,focused:function(t){return y.domUtils.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(e="string"==typeof e.animVal?e.animVal:e).replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=Rc.getComputedStyle(t),r=0;r<n.length;r++){var i=n[r];e[i]=n[i]}return e},innerText:function(t){return t.innerText}},Tr=(s(xr,Sr=wr),xr);function xr(t){var e=Sr.call(this,t)||this;return e._initializeProperties(t,pr,Ir),e}var br,Wr=(s(Mr,br=Er),Mr);function Mr(t){var e=br.call(this,t)||this;return e._initializeProperties(t,gr,Ir),e}var Pr=Rc.Node,Ar=function(t){return t};function Dr(t){return new hr({serialize:Ar,deserialize:Ar}).addTransforms(t)}var Rr=(Nr.prototype.shouldTransform=function(t){return"function"===t},Nr.prototype.toSerializable=function(){return""},Nr.prototype.fromSerializable=function(t){return fr(t.fnCode,t.dependencies)},Nr);function Nr(){this.type="Function"}var kr=(Fr.prototype.shouldTransform=function(t,e){return e instanceof Pr},Fr.prototype.toSerializable=function(t){return new Tr(t)},Fr);function Fr(){this.type="Node"}var Lr=(Ur.prototype._extend=function(t,n){var r=this;o.nativeMethods.objectKeys.call(Rc.Object,this.customDOMProperties).forEach(function(e){try{t[e]=r.customDOMProperties[e](n)}catch(t){throw new Ot(r.instantiationCallsiteName,t,e)}})},Ur.prototype.shouldTransform=function(t,e){return e instanceof Pr},Ur.prototype.toSerializable=function(t){var e=new(1===t.nodeType?Wr:Er)(t);return this._extend(e,t),e},Ur);function Ur(t){this.type="Node",this.customDOMProperties=t||{}}var Or=(Br.prototype.shouldTransform=function(t,e){if(e instanceof Pr)throw new Et(this.instantiationCallsiteName)},Br);function Br(t){this.type="Node",this.instantiationCallsiteName=t}var Hr=(Gr.prototype.getResult=function(){var e=this;return l.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new Ft(e.command.instantiationCallsiteName,t)),t})},Gr.prototype.getResultDriverStatus=function(){var e=this;return this.getResult().then(function(t){return new cr({isCommandResult:!0,result:e.replicator.encode(t)})}).catch(function(t){return new cr({isCommandResult:!0,executionError:t})})},Gr.prototype._createReplicator=function(){return Dr([new Or(this.command.instantiationCallsiteName),new Rr])},Gr.prototype._executeFn=function(t){return this.fn.apply(Rc,t)},Gr);function Gr(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(this.command.dependencies),this.fn=fr(this.command.fnCode,this.dependencies)}var Vr="appeared-dialog",Xr="unexpected-dialog",Yr="handler-error",zr=o.eventSandbox.message,jr=o.processScript,qr=o.nativeMethods,Kr="testcafe|native-dialog-tracker|appeared-dialogs",Jr="testcafe|native-dialog-tracker|unexpected-dialog",$r="testcafe|native-dialog-tracker|error-in-handler",Qr=jr("window.location.href"),Zr=(Object.defineProperty(ti.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(Kr);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(Kr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(ti.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(Jr)},set:function(t){this.contextStorage.setItem(Jr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(ti.prototype,"handlerError",{get:function(){return this.contextStorage.getItem($r)},set:function(t){this.contextStorage.setItem($r,t)},enumerable:!1,configurable:!0}),ti._getPageUrl=function(){return qr.eval(Qr)},ti.prototype._initListening=function(){var n=this;zr.on(zr.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===Vr?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==Xr||n.unexpectedDialog?e.type!==Yr||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},ti.prototype._init=function(){var e=this;o.on(o.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),Rc.alert=function(){return e._defaultDialogHandler("alert")},Rc.confirm=function(){return e._defaultDialogHandler("confirm")},Rc.prompt=function(){return e._defaultDialogHandler("prompt")}},ti.prototype._createDialogHandler=function(i){var o=this;return function(t){var e=ti._getPageUrl();o._addAppearedDialogs(i,t,e);var n=new Hr(o.dialogHandler),r=null;try{r=n.fn.apply(Rc,[i,t,e])}catch(t){o._onHandlerError(i,t.message||String(t),e)}return r}},ti.prototype._defaultDialogHandler=function(t){var e=ti._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},ti.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},ti.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},ti.prototype.setHandler=function(t){var e=this;this.dialogHandler=t,["alert","confirm","prompt"].forEach(function(t){Rc[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}})},ti.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new qn(t.type,t.url):e?new $n(e.type,e.message,e.url):null},ti);function ti(t,e){this.contextStorage=t,this.dialogHandler=e,this._init(),this._initListening(),this.dialogHandler&&this.setHandler(e)}function ei(t){this.type=t,this.id=ar()}var ni,ri="driver|establish-connection",ii="driver|switch-to-window",oi="driver|close-window",si="driver|close-window-validation",ai="driver|switch-to-window-validation",li="driver|get-windows",ci="driver|command-executed",ui="driver|execute-command",di="driver|confirmation",hi="driver|set-native-dialog-handler",fi="driver|set-as-master",mi="driver|close-all-child-windows",pi="driver|start-to-restore-child-link",gi="driver|restore-child-link",vi="driver|child-window-is-loaded-in-iframe",wi="driver|child-window-is-opened-in-iframe",yi=(s(_i,ni=ei),_i);function _i(){return ni.call(this,ri)||this}var Ei,Ci=(s(Si,Ei=ei),Si);function Si(t){var e=t.windowId,n=Ei.call(this,si)||this;return n.windowId=e,n}var Ii,Ti=(s(xi,Ii=ei),xi);function xi(t){var e=t.windowId,n=t.fn,r=Ii.call(this,ai)||this;return r.windowId=e,r.fn=n,r}var bi,Wi=(s(Mi,bi=ei),Mi);function Mi(){return bi.call(this,li)||this}var Pi,Ai=(s(Di,Pi=ei),Di);function Di(t){var e=t.windowId,n=t.isCurrentWindow,r=Pi.call(this,oi)||this;return r.windowId=e,r.isCurrentWindow=n,r}var Ri,Ni=(s(ki,Ri=ei),ki);function ki(t){var e=t.windowId,n=t.fn,r=Ri.call(this,ii)||this;return r.windowId=e,r.fn=n,r}var Fi,Li=(s(Ui,Fi=ei),Ui);function Ui(t){var e=Fi.call(this,ci)||this;return e.driverStatus=t,e}var Oi,Bi=(s(Hi,Oi=ei),Hi);function Hi(t,e){var n=Oi.call(this,ui)||this;return n.command=t,n.testSpeed=e,n}var Gi,Vi=(s(Xi,Gi=ei),Xi);function Xi(t,e){var n=Gi.call(this,di)||this;return n.requestMessageId=t,n.result=e,n}var Yi,zi=(s(ji,Yi=ei),ji);function ji(t){var e=Yi.call(this,hi)||this;return e.dialogHandler=t,e}var qi,Ki=(s(Ji,qi=ei),Ji);function Ji(t){var e=qi.call(this,fi)||this;return e.finalizePendingCommand=t,e}var $i,Qi=(s(Zi,$i=ei),Zi);function Zi(){return $i.call(this,mi)||this}var to,eo=(s(no,to=ei),no);function no(){return to.call(this,pi)||this}var ro,io=(s(oo,ro=ei),oo);function oo(t){var e=ro.call(this,gi)||this;return e.windowId=t,e}var so,ao=(s(lo,so=ei),lo);function lo(t){var e=so.call(this,vi)||this;return e.windowId=t,e}var co,uo=(s(ho,co=ei),ho);function ho(){return co.call(this,wi)||this}var fo=o.json,mo=o.nativeMethods,po=(go.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},go.prototype._loadFromStorage=function(){var t=mo.storageGetItem.call(this.storage,this.storageKey);t&&(this.data=fo.parse(t),mo.storageRemoveItem.call(this.storage,this.storageKey))},go.prototype.save=function(){mo.storageSetItem.call(this.storage,this.storageKey,fo.stringify(this.data))},go.prototype.setItem=function(t,e){this.data[t]=e,this.save()},go.prototype.getItem=function(t){return this.data[t]},go.prototype.dispose=function(){mo.storageRemoveItem.call(this.storage,this.storageKey)},go);function go(t,e,n){this.storage=mo.winSessionStorageGetter.call(t),this.storageKey=this._createStorageKey(e,n),this.data={},this._loadFromStorage()}function vo(n,t,e,r){var i=null,o=null,s=null;return e=Math.max(e||0,2500),l.Promise.race([y.delay(e),new l.Promise(function(e){s=function(t){t.message.type===di&&t.message.requestMessageId===n.id&&e(t.message)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),i=l.nativeMethods.setInterval.call(Rc,function(){return l.eventSandbox.message.sendServiceMsg(n,t)},1e3),l.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(l.nativeMethods.clearInterval.call(Rc,i),l.nativeMethods.clearTimeout.call(Rc,o),l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new r;return t})}var wo=2e4;function yo(t){var e=t.requestMsgId,n=t.result,r=t.window,i=new Vi(e,n);l.eventSandbox.message.sendServiceMsg(i,r)}var _o=(Object.defineProperty(Eo.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!1,configurable:!0}),Eo.prototype._ensureIframe=function(){var t=this;return y.domUtils.isElementInDocument(this.driverIframe)?y.waitFor(function(){return y.positionUtils.isElementVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new Yn}):l.Promise.reject(new Gn)},Eo.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new l.Promise(function(t){e.checkIframeInterval=l.nativeMethods.setInterval.call(Rc,function(){e._ensureIframe().catch(function(){return y.delay(500).then(function(){return t(new cr({isCommandResult:!0}))})})},1e3)})},Eo.prototype._waitForCommandResult=function(){var e=this,n=null;return l.Promise.race([this._waitForIframeRemovedOrHidden(),new l.Promise(function(e){n=function(t){t.message.type===ci&&e(t.message.driverStatus)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),l.nativeMethods.clearInterval.call(Rc,e.checkIframeInterval),t})},Eo.prototype.sendConfirmationMessage=function(t){yo({requestMsgId:t,result:{id:this.driverId},window:this.driverWindow})},Eo.prototype.executeCommand=function(e,n){var r=this;return this._ensureIframe().then(function(){var t=new Bi(e,n);return l.Promise.all([vo(t,r.driverWindow,r.iframeAvailabilityTimeout,rn),r._waitForCommandResult()])}).then(function(t){return t[1]})},Eo);function Eo(t,e){this.driverWindow=t,this.driverIframe=y.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0}var Co=o.Promise,So=o.nativeMethods,Io=(To.prototype._onScriptElementAdded=function(t){var e,n,r=this,i=So.scriptSrcGetter.call(t);void 0!==i&&""!==i&&(this.scriptsCount++,e=null,n=function(){So.removeEventListener.call(t,"load",n),So.removeEventListener.call(t,"error",n),So.clearTimeout.call(Rc,e),r._onScriptLoadedOrFailed()},So.addEventListener.call(t,"load",n),So.addEventListener.call(t,"error",n),e=So.setTimeout.call(Rc,n,this.SCRIPT_LOADING_TIMEOUT))},To.prototype._onScriptLoadedOrFailed=function(){var t=this;this.scriptsCount--,this.scriptsCount||y.delay(25).then(function(){t.resolveWaitingPromise&&(t.scriptsCount||t.resolveWaitingPromise())})},To.prototype.wait=function(){var n=this;return new Co(function(t){function e(){So.clearTimeout.call(Rc,n.watchdog),o.off(o.EVENTS.scriptElementAdded,n.scriptElementAddedHandler),n.watchdog=null,n.resolveWaitingPromise=null,t()}n.scriptsCount?(n.watchdog=So.setTimeout.call(Rc,e,n.BARRIER_TIMEOUT),n.resolveWaitingPromise=e):e()})},To);function To(){var e=this;this.watchdog=null,this.SCRIPT_LOADING_TIMEOUT=2e3,this.BARRIER_TIMEOUT=3e3,this.scriptsCount=0,this.resolveWaitingPromise=null,this.scriptElementAddedHandler=function(t){return e._onScriptElementAdded(t.el)},o.on(o.EVENTS.scriptElementAdded,this.scriptElementAddedHandler)}function xo(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=new y.RequestBarrier,i=new Io;y.pageUnloadBarrier.watchForPageNavigationTriggers();var o=null,s=t.apply(void 0,e),a=s.then(function(t){return o=t,l.Promise.all([r.wait().then(function(){return i.wait()}),y.pageUnloadBarrier.wait()])}).then(function(){return o});return{actionPromise:s,barriersPromise:a}}var bo,Wo=Array.isArray,Mo=Rc.Node,Po=Rc.HTMLCollection,Ao=Rc.NodeList;function Do(t){return!!t}function Ro(t){return!(!y.domUtils.isDomElement(t)&&!y.domUtils.isTextNode(t))&&(y.domUtils.isOptionElement(t)||"optgroup"===y.domUtils.getTagName(t)?n.selectElement.isOptionElementVisible(t):y.positionUtils.isElementVisible(t))}function No(t){return t instanceof Po||t instanceof Ao||function(t){if(Wo(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof Mo))return;return 1}}(t)}var ko=t.arrayUtils,Fo=o.utils.types,Lo=o.nativeMethods,Uo=1,Oo=2,Bo=3,Ho=((bo={})[Uo]=/^\.filterVisible\(\)$/,bo[Oo]=/^\.filterHidden\(\)$/,bo[Bo]=/^\.nth\(\d+\)$/,bo),Go=(Object.defineProperty(Vo.prototype,"error",{get:function(){return this.err},set:function(t){null===this.err&&(this.err=t)},enumerable:!1,configurable:!0}),Vo.prototype.filter=function(t,e,n){var r,i=ko.filter(t,Do);return e.filterVisible&&(i=i.filter(Ro),this.assertFilterError(i,n,Uo)),e.filterHidden&&(i=i.filter(function(t){return!Ro(t)}),this.assertFilterError(i,n,Oo)),e.counterMode?i=null!==e.index?this.getNodeByIndex(i,e.index)?1:0:i.length:(e.collectionMode?null!==e.index&&(i=(r=this.getNodeByIndex(i,e.index))?[r]:[]):i=this.getNodeByIndex(i,e.index||0),"number"==typeof e.index&&this.assertFilterError(i,n,Bo)),i},Vo.prototype.cast=function(t){var e=null;if(Fo.isNullOrUndefined(t))e=[];else if(t instanceof Node)e=[t];else{if(!No(t))throw new bt;e=t}return e},Vo.prototype.assertFilterError=function(t,e,n){t&&0!==t.length||(this.error=this.getErrorItem(e,n))},Vo.prototype.getErrorItem=function(t,e){var n=t.apiFnChain,r=t.apiFnID;if(e)for(var i=r;i<n.length;i++)if(Ho[e].test(n[i]))return i;return null},Vo.prototype.getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},Vo);function Vo(){this.err=null}Lo.objectDefineProperty.call(Rc,Rc,"%testCafeSelectorFilter%",{value:new Go,configurable:!0});var Xo,Yo=l.nativeMethods.date,zo=(s(jo,Xo=Hr),jo.prototype._createReplicator=function(){return Dr([new Rr])},jo.prototype._getTimeoutErrorParams=function(){var t=Rc["%testCafeSelectorFilter%"].error,e=this.command.apiFnChain;return void 0!==t?{apiFnIndex:t,apiFnChain:e}:null},jo.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},jo.prototype._validateElement=function(o,s){var a=this;return l.Promise.resolve().then(function(){return a.fn.apply(Rc,o)}).then(function(t){var e=!!t,n=!a.command.visibilityCheck||Ro(t),r=new Yo-s>=a.timeout;if(e&&(n||y.domUtils.isShadowRoot(t)))return t;if(!r)return y.delay(200).then(function(){return a._validateElement(o,s)});var i=a.getVisibleValueMode?null:a._getTimeoutError(e);if(i)throw i(a._getTimeoutErrorParams());return null})},jo.prototype._executeFn=function(t){if(this.counterMode)return Xo.prototype._executeFn.call(this,t);var e=new Yo,n=null,r=null;return this._validateElement(t,e).catch(function(t){n=t}).then(function(t){if(n)throw n;r=t}).then(function(){return r})},jo);function jo(t,e,n,r,i){var o,s=Xo.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,n&&(o=new Yo-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies&&s.dependencies.customDOMProperties;return s.replicator.addTransforms([new Lr(a)]),s}var qo=l.nativeMethods.date,Ko=(Jo.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 zo(n,e.globalSelectorTimeout,e.ensureElementsStartTime,r,i).getResult()}).then(function(t){if(!y.domUtils.isDomElement(t))throw o(y.NODE_TYPE_DESCRIPTIONS[t.nodeType]);e.elements.push(t)})},Jo.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},Jo);function Jo(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=l.Promise.resolve(),this.ensureElementsStartTime=new qo,t.forEach(function(t){return n._ensureElement(t)})}function $o(t,e){return new Ko(t,e).getElements()}function Qo(t){return{selector:t,createNotFoundError:function(t){return new se(t)},createIsInvisibleError:function(){return new ce},createHasWrongNodeTypeError:function(t){return new he(t)}}}function Zo(t,e){return{selector:t,createNotFoundError:function(t){return new pe(e,t)},createIsInvisibleError:function(){return new we(e)},createHasWrongNodeTypeError:function(t){return new Ee(e,t)}}}var ts=o.utils.browser;function es(t,e,n){var r=ts.isFirefox?Math.ceil:Math.round,i=y.positionUtils.getOffsetPosition(t,r);return{x:(t===Nc.documentElement?0:i.left)+e,y:(t===Nc.documentElement?0:i.top)+n}}function ns(t){if(!t)return null;var e=Rc.screenLeft||Rc.screenX,n=Rc.screenTop||Rc.screenY;return{x:e+t.x,y:n+t.y}}function rs(t){var e=t/2;return e<1?0:Math.round(e)}function is(t,e,n){var r,i,o=(r=t,{offsetX:rs((i=y.positionUtils.getElementRectangle(r)).width),offsetY:rs(i.height)});if(e="number"==typeof e?Math.round(e):o.offsetX,n="number"==typeof n?Math.round(n):o.offsetY,0<e&&0<n)return{offsetX:e,offsetY:n};var s=y.positionUtils.getClientDimensions(t),a=Math.round(Math.max(t.scrollWidth,s.width)),l=Math.round(Math.max(t.scrollHeight,s.height)),c=s.scrollbar.right+s.border.left+s.border.right+a,u=s.scrollbar.bottom+s.border.top+s.border.bottom+l;return{offsetX:e<0?c+e:e,offsetY:n<0?u+n:n}}function os(t){return t.top!==t}var ss=t.domUtils,as=os(Rc)?i.iframeCursorUI:i.cursorUI,ls={x:-1,y:-1,currentActiveWindow:Rc.top,_ensureActiveWindow:function(){var t;this.currentActiveWindow!==Rc&&this.currentActiveWindow!==Rc.parent&&((t=ss.findIframeByWindow(this.currentActiveWindow))&&ss.isElementInDocument(t)||(this.currentActiveWindow=Rc))},get active(){return this._ensureActiveWindow(),this.currentActiveWindow===Rc},set activeWindow(t){this.currentActiveWindow=t},get activeWindow(){return this._ensureActiveWindow(),this.currentActiveWindow},get position(){return{x:this.x,y:this.y}},get visible(){return!os(Rc)&&as.isVisible()},move:function(t,e){return this.x=t,this.y=e,as.move(this.x,this.y)},hide:function(){this.visible&&as.hide()},show:function(){os(Rc)||as.show()},leftButtonDown:function(){return as.leftButtonDown()},rightButtonDown:function(){return as.rightButtonDown()},buttonUp:function(){return as.buttonUp()}},cs=o.utils.browser,us=o.Promise,ds=o.nativeMethods,hs=t.positionUtils,fs=t.domUtils;function ms(t,e,n){var r=null;return i.hide(n).then(function(){return r=hs.getElementFromPoint(t,e),i.show(n)}).then(function(){return r})}function ps(t,e,n){var r=hs.getElementFromPoint(t,e),i=fs.containsElement(n,r)&&ds.nodeTextContentGetter.call(r).length;return r&&r===n||i?r:null}function gs(t,e){if(!e||!fs.isDomElement(e)||!t||t===e)return t;if("tref"===fs.getTagName(e))return e;var n,r,i,o="area"===fs.getTagName(e)&&fs.isImgElement(t);if(cs.isFirefox&&o)return n=t,r=e,(i=fs.closest(r,"map"))&&i.name===n.useMap.substring(1)?r:n;var s=fs.isAnchorElement(e)||fs.getParents(e,"a").length,a=s&&fs.containsElement(e,t)&&ds.nodeTextContentGetter.call(t).length;if(!s||a||!ds.nodeTextContentGetter.call(e).length)return t;var l=e.getBoundingClientRect();return ps(l.right-1,l.top+1,e)||ps(l.left+1,l.bottom-1,e)||t}function vs(n,r,i){var o=null;return ms(n,r).then(function(t){o=t;var e=us.resolve(t);return!o&&os(Rc)&&0<n&&0<r&&(e=e.then(function(){return ms(n,r,!0)}).then(function(t){return o=t})),e.then(function(t){return gs(t,i)}).then(function(t){return{element:t,corrected:t!==o}})})}function ws(){var t=ls.position;return vs(t.x,t.y).then(function(t){return t.element})}var ys="elementIsInvisibleError",_s="foundElementIsNotTarget",Es=(Object.defineProperty(Cs.prototype,"mouseActionStepDelay",{get:function(){return 1===this.speedFactor?10:400*(1-this.speedFactor)},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"keyActionStepDelay",{get:function(){return 1===this.speedFactor?10:200*(1-this.speedFactor)},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"cursorSpeed",{get:function(){return Math.pow(400,this.speedFactor)/4},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"draggingSpeed",{get:function(){return Math.pow(16,this.speedFactor)/4},enumerable:!1,configurable:!0}),Cs);function Cs(t){this.speedFactor=t||1}var Ss=o.Promise,Is=o.eventSandbox.message,Ts="automation|scroll|request",xs="automation|scroll|response";Is.on(Is.SERVICE_MSG_RECEIVED_EVENT,function(t){var e,n,r,i,o,s;t.message.cmd===Ts&&(n=(e=t.message).offsetX,r=e.offsetY,i=e.maxScrollMargin,o=y.domUtils.findIframeByWindow(t.source),(s=new bs(o,{offsetX:n,offsetY:r})).maxScrollMargin=i,s.run().then(function(){return Is.sendServiceMsg({cmd:xs},t.source)}))});var bs=(Ws.prototype._isScrollValuesChanged=function(t,e){return y.styleUtils.getScrollLeft(t)!==e.left||y.styleUtils.getScrollTop(t)!==e.top},Ws.prototype._setScroll=function(t,e){var n=this,r=e.left,i=e.top,o=y.domUtils.isHtmlElement(t)?y.domUtils.findDocument(t):t,s={left:y.styleUtils.getScrollLeft(o),top:y.styleUtils.getScrollTop(o)},r=Math.max(r,0),i=Math.max(i,0),a=y.scrollController.waitForScroll(o);return y.styleUtils.setScrollLeft(o,r),y.styleUtils.setScrollTop(o,i),this._isScrollValuesChanged(o,s)?a=a.then(function(){n.scrollWasPerformed=n.scrollWasPerformed||n._isScrollValuesChanged(o,s)}):(a.cancel(),Ss.resolve())},Ws.prototype._getScrollToPoint=function(t,e,n){var r=e.x,i=e.y,o=Math.floor(t.width/2),s=Math.floor(Math.floor(t.height/2)),a=this.scrollToCenter?o:Math.min(n.left,o),l=this.scrollToCenter?s:Math.min(n.top,s),c=r>=t.scroll.left+t.width-a,u=r<=t.scroll.left+a,d=i>=t.scroll.top+t.height-l,h=i<=t.scroll.top+l,f=t.scroll.left,m=t.scroll.top;return c?f=r-t.width+a:u&&(f=r-a),d?m=i-t.height+l:h&&(m=i-l),{left:f,top:m}},Ws.prototype._getScrollToFullChildView=function(t,e,n){var r,i,o,s,a=null,l=null,c=t.width>=e.width,u=t.height>=e.height,d=y.positionUtils.calcRelativePosition(e,t);return c&&(r=t.width-e.width,i=Math.min(n.left,r),this.scrollToCenter&&(i=r/2),d.left<i?a=Math.round(t.scroll.left+d.left-i):d.right<i&&(a=Math.round(t.scroll.left+Math.min(d.left,-d.right)+i))),u&&(o=t.height-e.height,s=Math.min(n.top,o),this.scrollToCenter&&(s=o/2),d.top<s?l=Math.round(t.scroll.top+d.top-s):d.bottom<s&&(l=Math.round(t.scroll.top+Math.min(d.top,-d.bottom)+s))),{left:a,top:l}},Ws._getChildPoint=function(t,e,n){return{x:e.left-t.left+t.scroll.left+e.border.left+n.x,y:e.top-t.top+t.scroll.top+e.border.top+n.y}},Ws.prototype._getScrollPosition=function(t,e,n,r){var i=Ws._getChildPoint(t,e,n),o=this._getScrollToPoint(t,i,r),s=this._getScrollToFullChildView(t,e,r);return{left:Math.max(null===s.left?o.left:s.left,0),top:Math.max(null===s.top?o.top:s.top,0)}},Ws._getChildPointAfterScroll=function(t,e,n,r){return{x:Math.round(e.left+t.scroll.left-n.left+r.x),y:Math.round(e.top+t.scroll.top-n.top+r.y)}},Ws.prototype._isChildFullyVisible=function(t,e,n){var r=Ws._getChildPointAfterScroll(t,e,t.scroll,n),i=r.x,o=r.y,s=this._getScrollPosition(t,e,n,{left:0,top:0}),a=s.left,l=s.top;return!this._isTargetElementObscuredInPoint(i,o)&&a===t.scroll.left&&l===t.scroll.top},Ws.prototype._scrollToChild=function(t,e,n){for(var r=y.positionUtils.getClientDimensions(t),i=y.positionUtils.getClientDimensions(e),o=y.styleUtils.getInnerWidth(Rc),s=y.styleUtils.getInnerHeight(Rc),a=r.scroll,l=!this._isChildFullyVisible(r,i,n);l;){a=this._getScrollPosition(r,i,n,this.maxScrollMargin);var c=Ws._getChildPointAfterScroll(r,i,a,n),u=c.x,d=c.y,h=this._isTargetElementObscuredInPoint(u,d);this.maxScrollMargin.left+=20,this.maxScrollMargin.left>=o&&(this.maxScrollMargin.left=50,this.maxScrollMargin.top+=20),l=h&&this.maxScrollMargin.top<s}return this.maxScrollMargin={left:50,top:50},this._setScroll(t,a)},Ws.prototype._scrollElement=function(){if(!y.styleUtils.hasScroll(this.element))return Ss.resolve();var t=y.positionUtils.getClientDimensions(this.element),e=this._getScrollToPoint(t,{x:this.offsetX,y:this.offsetY},this.maxScrollMargin);return this._setScroll(this.element,e)},Ws.prototype._scrollParents=function(){var e,n,r=this,i=y.styleUtils.getScrollableParents(this.element),o=this.element,s=this.offsetX-Math.round(y.styleUtils.getScrollLeft(o)),a=this.offsetY-Math.round(y.styleUtils.getScrollTop(o));return y.promiseUtils.times(i.length,function(t){return r._scrollToChild(i[t],o,{x:s,y:a}).then(function(){e=y.positionUtils.getClientDimensions(o),n=y.positionUtils.getClientDimensions(i[t]),s+=e.left-n.left+n.border.left,a+=e.top-n.top+n.border.top,o=i[t]})}).then(function(){return os(Rc)&&!r.skipParentFrames?y.sendRequestToFrame({cmd:Ts,offsetX:s,offsetY:a,maxScrollMargin:r.maxScrollMargin},xs,Rc.parent):Ss.resolve()})},Ws._getFixedAncestorOrSelf=function(t){return y.domUtils.findParent(t,!0,y.styleUtils.isFixedElement)},Ws.prototype._isTargetElementObscuredInPoint=function(t,e){var n=y.positionUtils.getElementFromPoint(t,e);if(!n)return!1;var r=Ws._getFixedAncestorOrSelf(n);return r&&!r.contains(this.element)},Ws.prototype.run=function(){var t=this;return this._scrollElement().then(function(){return t._scrollParents()}).then(function(){return t.scrollWasPerformed})},Ws);function Ws(t,e){this.element=t,this.offsetX=e.offsetX,this.offsetY=e.offsetY,this.scrollToCenter=e.scrollToCenter,this.skipParentFrames=e.skipParentFrames,this.raiseEvents=e.raiseEvents,this.maxScrollMargin={left:50,top:50},this.scrollWasPerformed=!1}function Ms(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 Ps,As,Ds,Rs,Ns,ks=Ms(qt),Fs=(As=Ms(Ps=$t),function(t,e){if(As(t,e),e<0)throw new Ps(t,e)}),Ls=(Ds=te,function(t,e){var n=typeof e;if("boolean"!=n)throw new Ds(t,n)}),Us=(Rs=re,function(t,e){var n=typeof e;if("number"!=n)throw new Rs(t,n);if(isNaN(e)||e<.01||1<e)throw new Rs(t,e)}),Os=(s(Bs,Ns=or),Bs.prototype._getAssignableProperties=function(){return[{name:"speed",type:Us}]},Bs);function Bs(t,e){var n=Ns.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var Hs,Gs=(s(Vs,Hs=Os),Vs.prototype._getAssignableProperties=function(){return Hs.prototype._getAssignableProperties.call(this).concat([{name:"offsetX",type:ks},{name:"offsetY",type:ks}])},Vs);function Vs(t,e){var n=Hs.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var Xs,Ys=(s(zs,Xs=Gs),zs.prototype._getAssignableProperties=function(){return Xs.prototype._getAssignableProperties.call(this).concat([{name:"scrollToCenter",type:Ls},{name:"skipParentFrames",type:Ls}])},zs);function zs(t,e){var n=Xs.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var js,qs=(s(Ks,js=Os),Ks.prototype._getAssignableProperties=function(){return js.prototype._getAssignableProperties.call(this).concat([{name:"scrollTargetX",type:ks},{name:"scrollTargetY",type:ks},{name:"crop.left",type:ks},{name:"crop.right",type:ks},{name:"crop.top",type:ks},{name:"crop.bottom",type:ks},{name:"includeMargins",type:Ls},{name:"includeBorders",type:Ls},{name:"includePaddings",type:Ls}])},Ks);function Ks(t,e){var n=js.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 Js,$s=(s(Qs,Js=Gs),Qs.prototype._getAssignableProperties=function(){return Js.prototype._getAssignableProperties.call(this).concat([{name:"modifiers.ctrl",type:Ls},{name:"modifiers.alt",type:Ls},{name:"modifiers.shift",type:Ls},{name:"modifiers.meta",type:Ls}])},Qs);function Qs(t,e){var n=Js.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var Zs,ta=(s(ea,Zs=$s),ea.prototype._getAssignableProperties=function(){return Zs.prototype._getAssignableProperties.call(this).concat([{name:"caretPos",type:Fs}])},ea);function ea(t,e){var n=Zs.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}var na,ra,ia,oa,sa,aa,la=(s(ca,na=$s),ca.prototype._getAssignableProperties=function(){return na.prototype._getAssignableProperties.call(this).concat([{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:Ls},{name:"skipDefaultDragBehavior",type:Ls}])},ca);function ca(t,e){var n=na.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 ua(t,e){var n=ra.call(this)||this;return n.replace=!1,n.paste=!1,n.confidential=void 0,n._assignFrom(t,e),n}function da(t,e){var n=ia.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function ha(t,e){var n=oa.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function fa(t,e){var n=sa.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}function ma(t,e){var n=aa.call(this)||this;return n.confidential=void 0,n._assignFrom(t,e),n}function pa(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ga(t,e,n){for(var r,i=[],o=[{x1:n.left,y1:n.top,x2:n.left,y2:n.bottom,isHorizontal:!1},{x1:n.right,y1:n.top,x2:n.right,y2:n.bottom,isHorizontal:!1},{x1:n.left,y1:n.top,x2:n.right,y2:n.top,isHorizontal:!0},{x1:n.left,y1:n.bottom,x2:n.right,y2:n.bottom,isHorizontal:!0}],s=0;s<o.length;s++)(r=function(t,e,n){var r;if(n.isHorizontal)return(r=y.positionUtils.getLineXByYCoord(t,e,n.y1))&&r>=n.x1&&r<=n.x2?{x:r,y:n.y1}:null;var i=y.positionUtils.getLineYByXCoord(t,e,n.x1);return i&&i>=n.y1&&i<=n.y2?{x:n.x1,y:i}:null}(t,e,o[s]))&&i.push(r);return i.length?1===i.length||pa(t,i[0])<pa(t,i[1])?i[0]:i[1]:null}s(ua,ra=ta),ua.prototype._getAssignableProperties=function(){return ra.prototype._getAssignableProperties.call(this).concat([{name:"replace",type:Ls},{name:"paste",type:Ls},{name:"confidential",type:Ls}])},s(da,ia=$s),da.prototype._getAssignableProperties=function(){return ia.prototype._getAssignableProperties.call(this).concat([{name:"destinationOffsetX",type:ks},{name:"destinationOffsetY",type:ks}])},s(ha,oa=or),ha.prototype._getAssignableProperties=function(){return[{name:"portraitOrientation",type:Ls}]},s(fa,sa=or),fa.prototype._getAssignableProperties=function(){return[{name:"timeout",type:Fs},{name:"allowUnawaitedPromise",type:Ls}]},s(ma,aa=Os),ma.prototype._getAssignableProperties=function(){return aa.prototype._getAssignableProperties.call(this).concat([{name:"confidential",type:Ls}])};var va=o.Promise,wa=o.nativeMethods;function ya(){return new va(function(t){return wa.setTimeout.call(Rc,t,0)})}var _a=function(){this.enabled=!1,this.dropAllowed=!1,this.element=null,this.dataTransfer=null,this.dataStore=null},Ea=o.utils.browser,Ca=(Sa.prototype.setup=function(){this.dragAndDropMode=!1,this.dropAllowed=!1},Sa.prototype.leaveElement=function(){},Sa.prototype.move=function(){},Sa.prototype.enterElement=function(){},Sa.prototype.dragAndDrop=function(){},Sa.prototype.teardown=function(){},Sa.prototype.run=function(t,e,n,r,i){var o=e&&y.domUtils.isElementInDocument(e),s=e&&y.domUtils.isElementInIframe(e)&&!y.domUtils.getIframeByElement(e);o&&!s||(e=null);var a=t!==e,l=a?y.domUtils.getCommonAncestor(t,e):null;this.setup(),a&&e&&this.leaveElement(t,e,l,n),Ea.isIE&&this.move(t,n),a&&y.domUtils.isElementInDocument(t)&&this.enterElement(t,e,l,n),Ea.isIE||this.move(t,n),this.dragAndDrop(r,t,e,n,i),this.teardown(t,n,e);var c=this.dragAndDropMode,u=this.dropAllowed;return this.dragAndDropMode=!1,this.dropAllowed=!1,{dragAndDropMode:c,dropAllowed:u}},Sa);function Sa(t){var e=t.moveEvent;this.dragAndDropMode=!1,this.dropAllowed=!1,this.moveEvent=e}var Ia=o.eventSandbox.eventSimulator,Ta=o.utils.extend,xa=o.nativeMethods,ba=(Wa.leaveElement=function(t,e,n,r){Ia.mouseout(e,Ta({relatedTarget:t},r));for(var i=e;i&&i!==n;)Ia.mouseleave(i,Ta({relatedTarget:t},r)),i=xa.nodeParentNodeGetter.call(i)},Wa.enterElement=function(t,e,n,r){Ia.mouseover(t,Ta({relatedTarget:e},r));for(var i=t,o=[];i&&i!==n;)o.push(i),i=y.domUtils.getParentExceptShadowRoot(i);for(var s=o.length-1;-1<s;s--)Ia.mouseenter(o[s],Ta({relatedTarget:e},r))},Wa.move=function(t,e,n){Ia[t](e,n)},Wa);function Wa(){}var Ma=(Pa.dragAndDrop=function(t,e,n,r){return Ia.drag(t,r),e!==n&&(y.domUtils.isElementInDocument(e)&&(r.relatedTarget=n,Ia.dragenter(e,r)),n&&(r.relatedTarget=e,Ia.dragleave(n,r))),!Ia.dragover(e,r)},Pa);function Pa(){}var Aa,Da=o.eventSandbox.eventSimulator,Ra=(s(Na,Aa=Ca),Na.prototype.leaveElement=function(t,e,n,r){ba.leaveElement(t,e,n,r)},Na.prototype.enterElement=function(t,e,n,r){ba.enterElement(t,e,n,r)},Na.prototype.move=function(t,e){this._needEmulateMoveEvent()&&ba.move(this.moveEvent,t,e)},Na.prototype.teardown=function(t,e,n){this._needEmulateMoveEvent()&&y.domUtils.isElementInDocument(t)&&t!==n&&Da[this.moveEvent](t,e)},Na.prototype._needEmulateMoveEvent=function(){return"touchmove"!==this.moveEvent||this.holdLeftButton},Na);function Na(t){var e=Aa.call(this,t)||this;return e.holdLeftButton=t.holdLeftButton,e}var ka,Fa=(s(La,ka=Ca),La.prototype.setup=function(){ka.prototype.setup.call(this),this.dragAndDropMode=!0},La.prototype.dragAndDrop=function(t,e,n,r){this.dropAllowed=Ma.dragAndDrop(t,e,n,r)},La);function La(){return null!==ka&&ka.apply(this,arguments)||this}var Ua,Oa=o.eventSandbox.eventSimulator,Ba=(s(Ha,Ua=Ca),Ha.prototype.setup=function(){Ua.prototype.setup.call(this),this.dragAndDropMode=!0},Ha.prototype.leaveElement=function(t,e,n,r){ba.leaveElement(t,e,n,r)},Ha.prototype.move=function(t,e){ba.move(this.moveEvent,t,e)},Ha.prototype.enterElement=function(t,e,n,r){ba.enterElement(t,e,n,r)},Ha.prototype.dragAndDrop=function(t,e,n,r,i){var o=Oa.dragstart(t,r);i.setReadOnlyMode(),o?this.dropAllowed=Ma.dragAndDrop(t,e,n,r):this.dragAndDropMode=!1},Ha.prototype.run=function(t,e,n,r,i){return Ua.prototype.run.call(this,t,null,n,r,i)},Ha);function Ha(){return null!==Ua&&Ua.apply(this,arguments)||this}var Ga=null,Va=function(){return Ga},Xa=function(t){Ga=t},Ya=o.Promise,za=o.nativeMethods,ja=o.utils.featureDetection,qa=o.utils.html,Ka=o.utils.url,Ja=o.eventSandbox.eventSimulator,$a=o.eventSandbox.message,Qa=o.eventSandbox.DataTransfer,Za=o.eventSandbox.DragDataStore,tl=t.positionUtils,el=t.domUtils,nl=t.styleUtils,rl=t.eventUtils,il=t.promiseUtils,ol=t.sendRequestToFrame,sl="automation|move|request",al="automation|move|response";$a.on($a.SERVICE_MSG_RECEIVED_EVENT,function(t){t.message.cmd===sl&&(t.source.parent===Rc?ll.onMoveToIframeRequest(t):(o.on(o.EVENTS.beforeUnload,function(){return $a.sendServiceMsg({cmd:al},t.source)}),ll.onMoveOutRequest(t)))});var ll=(cl.getTarget=function(t,e,n){var r=!tl.containsOffset(t,e,n),i=r?es(t,e,n):{x:e,y:n};return{element:r?Nc.documentElement:t,offsetX:i.x,offsetY:i.y}},cl.onMoveToIframeRequest=function(t){var e={x:t.message.endX,y:t.message.endY},n=t.source,r=el.findIframeByWindow(n),i=nl.getBordersWidth(r),o=nl.getElementPadding(r),s=tl.getIframeClientCoordinates(r),a=tl.getIframePointRelativeToParentFrame(e,n),l=ls.position,c=tl.isInRectangle(l,s)?l:ga(l,a,s),u={x:c.x-s.left,y:c.y-s.top},d=new cl(r,new la({modifiers:t.message.modifiers,offsetX:u.x+i.left+o.left,offsetY:u.y+i.top+o.top,speed:t.message.speed,skipScrolling:!0},!1)),h={cmd:al,x:u.x,y:u.y};ls.activeWindow!==n?d.run().then(function(){ls.activeWindow=n,$a.sendServiceMsg(h,n)}):$a.sendServiceMsg(h,n)},cl.onMoveOutRequest=function(t){var e=t.source,n={left:t.message.left,right:t.message.right,top:t.message.top,bottom:t.message.bottom};if(!t.message.iframeUnderCursor){var r=t.message,i=r.startX,o=r.startY,s=i-n.left,a=o-n.top,l=Va();return l&&(Ja.mouseout(l,{clientX:s,clientY:a,relatedTarget:null}),Ja.mouseleave(l,{clientX:s,clientY:a,relatedTarget:null})),void $a.sendServiceMsg({cmd:al},e)}var c,u=ls.position,d=ga({x:n.left+u.x,y:n.top+u.y},{x:t.message.endX,y:t.message.endY},n);d?(c=new la({modifiers:t.message.modifiers,offsetX:d.x-n.left,offsetY:d.y-n.top,speed:t.message.speed,skipScrolling:!0},!1),new cl(Nc.documentElement,c).run().then(function(){var t={cmd:al,x:d.x,y:d.y};ls.activeWindow=e,$a.sendServiceMsg(t,e)})):$a.sendServiceMsg({cmd:al,x:n.left,y:n.top},e)},cl.prototype._getTargetClientPoint=function(){var t=nl.getElementScroll(this.element);if(el.isHtmlElement(this.element))return{x:Math.floor(this.offsetX-t.left),y:Math.floor(this.offsetY-t.top)};var e=tl.getClientPosition(this.element),n=this.element.tagName&&el.isBodyElement(this.element);return{x:Math.floor(n?e.x+this.offsetX:e.x+this.offsetX-t.left),y:Math.floor(n?e.y+this.offsetY:e.y+this.offsetY-t.top)}},cl.prototype._emulateEvents=function(t){var e,n,r=this.holdLeftButton?rl.BUTTONS_PARAMETER.leftButton:rl.BUTTONS_PARAMETER.noButton,i=ns({x:this.x,y:this.y}),o={clientX:this.x,clientY:this.y,screenX:i.x,screenY:i.y,buttons:r,ctrl:this.modifiers.ctrl,alt:this.modifiers.alt,shift:this.modifiers.shift,meta:this.modifiers.meta,dataTransfer:this.dragAndDropState.dataTransfer},s={moveEvent:this.moveEvent,holdLeftButton:this.holdLeftButton},a=(e=this.dragAndDropState.enabled,n=this.firstMovingStepOccured,new(e?n?Fa:Ba:Ra)(s).run(t,Va(),o,this.dragElement,this.dragAndDropState.dataStore)),l=a.dragAndDropMode,c=a.dropAllowed;this.firstMovingStepOccured=!0,this.dragAndDropState.enabled=l,this.dragAndDropState.dropAllowed=c,Xa(t)},cl.prototype._movingStep=function(){var t,n=this;return this.touchMode&&!this.holdLeftButton?(this.x=this.endPoint.x,this.y=this.endPoint.y):this.startTime?(t=(Math.min(za.dateNow(),this.endTime)-this.startTime)/(this.endTime-this.startTime),this.x=Math.floor(this.startPoint.x+this.distanceX*t),this.y=Math.floor(this.startPoint.y+this.distanceY*t)):(this.startTime=za.dateNow(),this.endTime=this.startTime+this.movingTime,this.x+=0<this.distanceX?1:-1,this.y+=0<this.distanceY?1:-1),ls.move(this.x,this.y).then(ws).then(function(t){var e=n.holdLeftButton&&n.touchMode?n.dragElement:t;return e?n._emulateEvents(e):null}).then(ya)},cl.prototype._isMovingFinished=function(){return this.x===this.endPoint.x&&this.y===this.endPoint.y},cl.prototype._move=function(){var t=this;return this.startPoint=ls.position,this.x=this.startPoint.x,this.y=this.startPoint.y,this.distanceX=this.endPoint.x-this.startPoint.x,this.distanceY=this.endPoint.y-this.startPoint.y,this.movingTime=Math.max(Math.abs(this.distanceX),Math.abs(this.distanceY))/this.cursorSpeed,this.minMovingTime&&(this.movingTime=Math.max(this.movingTime,this.minMovingTime)),il.whilst(function(){return!t._isMovingFinished()},function(){return t._movingStep()})},cl.prototype._scroll=function(){if(this.skipScrolling)return Ya.resolve();var t=new Ys({offsetX:this.offsetX,offsetY:this.offsetY},!1);return new bs(this.element,t).run()},cl.prototype._moveToCurrentFrame=function(){if(ls.active)return Ya.resolve();var t,e=ls.position,n=e.x,r=e.y,i=ls.activeWindow,o=null,s=null,a={cmd:sl,startX:n,startY:r,endX:this.endPoint.x,endY:this.endPoint.y,modifiers:this.modifiers,speed:this.speed};return i.parent===Rc&&(o=el.findIframeByWindow(i),t=tl.getIframeClientCoordinates(o),a.left=t.left,a.top=t.top,a.right=t.right,a.bottom=t.bottom),ws().then(function(t){return s=t===o,i.parent===Rc&&(a.iframeUnderCursor=s),ol(a,al,i)}).then(function(t){return ls.activeWindow=Rc,s||os(Rc)?ls.move(t.x,t.y):null})},cl.prototype.run=function(){var a=this;return ws().then(function(t){a.dragElement=a.holdLeftButton?t:null;var e,n,r,i,o,s=function(t){for(var e=t;e;){if(e.draggable)return e;e=za.nodeParentNodeGetter.call(e)}return null}(a.dragElement);return s&&ja.hasDataTransfer&&!a.skipDefaultDragBehavior&&(a.dragAndDropState.enabled=!0,a.dragElement=s,a.dragAndDropState.element=a.dragElement,a.dragAndDropState.dataStore=new Za,a.dragAndDropState.dataTransfer=new Qa(a.dragAndDropState.dataStore),((e=el.isAnchorElement(a.dragElement))||el.isImgElement(a.dragElement))&&(n=e?"href":"src",i=(r=Ka.parseProxyUrl(a.dragElement[n]))?r.destUrl:a.dragElement[n],o=qa.cleanUpHtml(za.elementOuterHTMLGetter.call(a.dragElement)),a.dragAndDropState.dataTransfer.setData("text/plain",i),a.dragAndDropState.dataTransfer.setData("text/uri-list",i),a.dragAndDropState.dataTransfer.setData("text/html",o))),a._scroll()}).then(function(){var t=a._getTargetClientPoint(),e=t.x,n=t.y,r=nl.getWidth(Rc),i=nl.getHeight(Rc);return 0<=e&&e<=r&&0<=n&&n<=i?(a.endPoint={x:e,y:n},a._moveToCurrentFrame().then(function(){return a._move()})):null}).then(function(){return a.dragAndDropState})},cl);function cl(t,e){this.touchMode=ja.isTouchDevice,this.moveEvent=this.touchMode?"touchmove":"mousemove",this.holdLeftButton=e.holdLeftButton,this.dragElement=null,this.dragAndDropState=new _a,this.automationSettings=new Es(e.speed);var n=cl.getTarget(t,e.offsetX,e.offsetY);this.element=n.element,this.offsetX=n.offsetX,this.offsetY=n.offsetY,this.speed=e.speed,this.cursorSpeed=this.holdLeftButton?this.automationSettings.draggingSpeed:this.automationSettings.cursorSpeed,this.minMovingTime=e.minMovingTime||null,this.modifiers=e.modifiers||{},this.skipScrolling=e.skipScrolling,this.skipDefaultDragBehavior=e.skipDefaultDragBehavior,this.endPoint=null,this.movingTime=null,this.x=null,this.y=null,this.startTime=null,this.endTime=null,this.distanceX=null,this.distanceY=null,this.firstMovingStepOccured=!1}var ul,dl=o.utils.extend,hl=function(t){var e=t.element,n=void 0===e?null:e,r=t.clientPoint,i=void 0===r?null:r,o=t.screenPoint,s=void 0===o?null:o,a=t.isTarget,l=void 0!==a&&a,c=t.inMoving,u=void 0!==c&&c;this.element=n,this.clientPoint=i,this.screenPoint=s,this.isTarget=l,this.inMoving=u,this.devicePoint=ns(i)},fl=(s(ml,ul=y.serviceUtils.EventEmitter),ml.prototype._getElementForEvent=function(t){var e=t.point;return vs(e.x,e.y,y.positionUtils.containsOffset(this.element,this.options.offsetX,this.options.offsetY)?this.element:null).then(function(t){return t.element})},ml.prototype._moveToElement=function(){var t=this,e=new la(dl({skipScrolling:!0},this.options),!1);return new ll(this.element,e).run().then(function(){return y.delay(t.automationSettings.mouseActionStepDelay)})},ml.prototype._scrollToElement=function(){var s=this,t=new Ys(this.options),e=new bs(this.element,t),a=!1;return e.run().then(function(t){return a=t,y.delay(s.automationSettings.mouseActionStepDelay)}).then(ws).then(function(t){if(!t||!y.domUtils.contains(s.element,t)||!a)return null;var e=Va(),n=y.domUtils.getCommonAncestor(t,e),r=y.positionUtils.getClientPosition(t),i=ns({x:r.x,y:r.y}),o={clientX:r.x,clientY:r.y,screenX:i.x,screenY:i.y,ctrl:!1,alt:!1,shift:!1,meta:!1,buttons:y.eventUtils.BUTTONS_PARAMETER.leftButton};return ba.leaveElement(t,e,n,o),ba.enterElement(t,e,n,o),Xa(t),a})},ml.prototype._getElementOffset=function(){var t=is(this.element),e=this.options,n=e.offsetX,r=e.offsetY;return{offsetX:n=n||0===n?n:t.offsetX,offsetY:r=r||0===r?r:t.offsetY}},ml.prototype._wrapAction=function(t){var d=this,e=this._getElementOffset(),r=e.offsetX,i=e.offsetY,h=es(this.element,r,i),f=y.positionUtils.getClientPosition(this.element);return t().then(function(){var t,e,n,a=es(d.element,r,i),l=y.positionUtils.getClientPosition(d.element),c=(t=d.element,e=a,n=y.styleUtils.getElementScroll(t),!/html/i.test(t.tagName)&&y.styleUtils.hasScroll(t)&&(e.x-=n.left,e.y-=n.top),y.positionUtils.offsetToClientCoords(e)),u=y.positionUtils.containsOffset(d.element,r,i)?d.element:null;return vs(c.x,c.y,u).then(function(t){var e=t.element,n=t.corrected,r=e;if(!r)return new hl({});var i=(i=!u||n||r===d.element)||-1<y.arrayUtils.indexOf(y.domUtils.getParents(r),d.element),o=h.x!==a.x||h.y!==a.y,s=f.x!==l.x||f.y!==l.y;return new hl({element:e,clientPoint:c,screenPoint:a,isTarget:i,inMoving:o&&s})})})},ml._checkElementState=function(t,e){if(!t.element)throw new Error(ys);if(e&&(!t.isTarget||t.inMoving))throw new Error(_s);return t},ml.prototype._ensureElement=function(e,n,r){var i=this;return this._wrapAction(function(){return i._scrollToElement()}).then(function(t){return ml._checkElementState(t,e)}).then(function(t){return r?t:i._wrapAction(function(){return i._moveToElement()})}).then(function(t){return n||ml._checkElementState(t,e),t}).then(function(t){return i.emit(i.TARGET_ELEMENT_FOUND_EVENT,{element:t.element}),{element:t.element,clientPoint:t.clientPoint,screenPoint:t.screenPoint,devicePoint:t.devicePoint}})},ml);function ml(t,e){var n=ul.call(this)||this;return n.TARGET_ELEMENT_FOUND_EVENT="automation|target-element-found-event",n.element=t,n.options=e,n.automationSettings=new Es(e.speed),n}var pl,gl=o.Promise,vl=(s(wl,pl=fl),wl.prototype.run=function(t){var e=this,n=gl.resolve();return this.element!==Nc.scrollingElement&&this.element!==Nc.documentElement&&(n=this._ensureElement(t,!0,!0)),n.then(function(){e.element.scrollLeft=e.scrollLeft,e.element.scrollTop=e.scrollTop})},wl);function wl(t,e,n){var r,i,o,s,a,l=e.x,c=e.y,u=e.position,d=e.byX,h=e.byY,f=pl.call(this,t,n)||this;return u&&(i=t,o=u,s=Math.floor(i.scrollWidth/2-i.clientWidth/2),a=Math.floor(i.scrollHeight/2-i.clientHeight/2),l=(r={top:[s,0],right:[i.scrollWidth,a],bottom:[s,i.scrollHeight],left:[0,a],topRight:[i.scrollWidth,0],topLeft:[0,0],bottomRight:[i.scrollWidth,i.scrollHeight],bottomLeft:[0,i.scrollHeight],center:[s,a]}[o])[0],c=r[1]),f.scrollLeft="number"==typeof l?l:t.scrollLeft,f.scrollTop="number"==typeof c?c:t.scrollTop,d&&(f.scrollLeft+=d),h&&(f.scrollTop+=h),f}var yl,_l=(s(El,yl=fl),El.prototype.run=function(t){return this._ensureElement(t,!0,!0)},El);function El(t,e){return yl.call(this,t,e)||this}function Cl(t,e){if(!y.domUtils.isContentEditableElement(t))throw new Pe(e)}var Sl=l.nativeMethods.date,Il=(Tl.prototype._getSpecificTimeout=function(){return this.command.selector&&"number"==typeof this.command.selector.timeout?this.command.selector.timeout:this.globalSelectorTimeout},Tl.prototype._delayAfterExecution=function(){return this.command.options&&1!==this.command.options.speed?y.delay(2e3*(1-this.command.options.speed)):l.Promise.resolve()},Tl.prototype._isExecutionTimeoutExpired=function(){return l.nativeMethods.dateNow()-this.executionStartTime>=this.commandSelectorTimeout},Tl.prototype._ensureCommandArguments=function(){if(this.command.type===m.pressKey&&y.parseKeySequence(this.command.keys).error)throw new Fe("keys")},Tl.prototype._ensureCommandElements=function(){var e=this,t=[];return this.command.selector&&t.push(Qo(this.command.selector)),this.command.type===m.dragToElement?t.push(Zo(this.command.destinationSelector,"destinationSelector")):this.command.type===m.selectEditableContent?(t.push(Zo(this.command.startSelector,"startSelector")),t.push(Zo(this.command.endSelector||this.command.startSelector,"endSelector"))):this.command.type===m.dispatchEvent&&this.command.relatedTarget&&t.push(Zo(this.command.relatedTarget,"relatedTarget")),$o(t,this.globalSelectorTimeout).then(function(t){e.elements=t})},Tl.prototype._ensureCommandElementsProperties=function(){this.command.type===m.selectText?function(t){if(!y.domUtils.isEditableElement(t))throw new Ie}(this.elements[0]):this.command.type===m.selectTextAreaContent?function(t){if(!y.domUtils.isTextAreaElement(t))throw new be}(this.elements[0]):this.command.type===m.selectEditableContent?(Cl(this.elements[0],"startSelector"),Cl(this.elements[1],"endSelector"),function(t){if(!y.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new Re}(this.elements)):this.command.type!==m.setFilesToUpload&&this.command.type!==m.clearUpload||function(t){if(!y.domUtils.isFileInput(t))throw new Ge}(this.elements[0])},Tl.prototype._ensureCommandOptions=function(){var t,e,n,r,i;this.elements.length&&this.command.options&&"offsetX"in this.command.options&&"offsetY"in this.command.options&&(t=this.elements[0],e=this.command.options,n=_.getOffsetOptions(t,e.offsetX,e.offsetY),r=n.offsetX,i=n.offsetY,e.offsetX=r,e.offsetY=i)},Tl.prototype._createAutomation=function(){var t;switch(this.command.type){case m.dispatchEvent:return this.elements[1]&&(this.command.options.relatedTarget=this.elements[1]),new _.DispatchEvent(this.elements[0],this.command.eventName,this.command.options);case m.click:return/option|optgroup/.test(y.domUtils.getTagName(this.elements[0]))?new _.SelectChildClick(this.elements[0],this.command.options):new _.Click(this.elements[0],this.command.options);case m.rightClick:return new _.RClick(this.elements[0],this.command.options);case m.doubleClick:return new _.DblClick(this.elements[0],this.command.options);case m.hover:return new _.Hover(this.elements[0],this.command.options);case m.drag:return new _.DragToOffset(this.elements[0],this.command.dragOffsetX,this.command.dragOffsetY,this.command.options);case m.dragToElement:return new _.DragToElement(this.elements[0],this.elements[1],this.command.options);case m.scroll:var e=this.command,n=e.x,r=e.y,i=e.position,o=e.options;return new vl(this.elements[0],{x:n,y:r,position:i},o);case m.scrollBy:var s=this.command,a=s.byX,l=s.byY,o=s.options;return new vl(this.elements[0],{byX:a,byY:l},o);case m.scrollIntoView:return new _l(this.elements[0],this.command.options);case m.typeText:return new _.Type(this.elements[0],this.command.text,this.command.options);case m.selectText:case m.selectTextAreaContent:return t=_.calculateSelectTextArguments(this.elements[0],this.command),new _.SelectText(this.elements[0],t.startPos,t.endPos,this.command.options);case m.selectEditableContent:return new _.SelectEditableContent(this.elements[0],this.elements[1],this.command.options);case m.pressKey:return new _.Press(y.parseKeySequence(this.command.keys).combinations,this.command.options);case m.setFilesToUpload:return new _.Upload(this.elements[0],this.command.filePath,function(t,e){return new Oe(t,e)});case m.clearUpload:return new _.Upload(this.elements[0])}return null},Tl.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){n._ensureCommandOptions();var t=n._createAutomation();return t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n.targetElement=t.element,n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()}):(n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()),t.run(e)})},Tl.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return y.promiseUtils.whilst(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(e._isExecutionTimeoutExpired()){if(t.message===_.ERROR_TYPES.foundElementIsNotTarget)return n=!1,l.Promise.resolve();throw t.message===_.ERROR_TYPES.elementIsInvisibleError?new ce:t}return y.delay(250)})})},Tl.prototype.execute=function(){var i=this;return this.command.options&&!this.command.options.speed&&(this.command.options.speed=this.testSpeed),{startPromise:new l.Promise(function(t){i.executionStartedHandler=t}),completionPromise:new l.Promise(function(n){i.executionStartTime=new Sl;try{i._ensureCommandArguments()}catch(t){return void n(new cr({isCommandResult:!0,executionError:t}))}i.commandSelectorTimeout=i._getSpecificTimeout(),i.statusBar.showWaitingElementStatus(i.commandSelectorTimeout);var t=xo(function(){return i._runRecursively()}),e=t.actionPromise,r=t.barriersPromise;e.then(function(){return l.Promise.all([i._delayAfterExecution(),r])}).then(function(){var t={isCommandResult:!0},e=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(i.elements);i.targetElement&&(e[0]=i.targetElement),t.result=Dr(new kr).encode(e),n(new cr(t))}).catch(function(t){return i.statusBar.hideWaitingElementStatus(!1).then(function(){return n(new cr({isCommandResult:!0,executionError:t}))})})})}},Tl);function Tl(t,e,n,r){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.testSpeed=r,this.targetElement=null,this.elements=[],this.ensureElementsPromise=null,this.ensureElementsStartTime=null,this.executionStartTime=null,this.executionStartedHandler=null,this.commandSelectorTimeout=null}function xl(t,e,n){return Math.min(Math.max(e,t),n)}function bl(t,e){var n="number"==typeof t.min,r="number"==typeof t.max,i="number"==typeof t.length;return i&&(t.length=xl(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=xl(t.min,0,e),t.max=xl(t.max,0,e),t.length=t.max-t.min,t}function Wl(t,e,n){return Math.round(t+xl(e-t,0,n)/2)}var Ml=l.eventSandbox.message,Pl="driver|browser-manipulation|request",Al="driver|browser-manipulation|response";Ml.on(Ml.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,r,i,o;e.message.cmd===Pl&&(t=y.domUtils.findIframeByWindow(e.source),r=(n=e.message).command,(i=n.cropDimensions)&&(r.options=new qs({crop:i,includePaddings:!1})),(o=new Dl(r)).element=t,o.execute().then(function(t){return Ml.sendServiceMsg({cmd:Al,result:t},e.source)}))});var Dl=(Rl.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}},Rl.prototype._createManipulationReadyMessage=function(){var t=Rc.devicePixelRatio||1,e={cmd:f.readyForBrowserManipulation,pageDimensions:{dpr:t,innerWidth:Rc.innerWidth,innerHeight:Rc.innerHeight,documentWidth:Nc.documentElement.clientWidth,documentHeight:Nc.documentElement.clientHeight,bodyWidth:Nc.body.clientWidth,bodyHeight:Nc.body.clientHeight},disableResending:!0};return this.command.type===m.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},Rl.prototype._runScrollBeforeScreenshot=function(){var i=this;return l.Promise.resolve().then(function(){if(i.element||!i.command.selector)return l.Promise.resolve();var t=i.command.selector.timeout,e="number"==typeof t?t:i.globalSelectorTimeout;return i.statusBar.showWaitingElementStatus(e),$o([Qo(i.command.selector)],i.globalSelectorTimeout).then(function(t){i.statusBar.hideWaitingElementStatus(),i.element=t[0]}).catch(function(t){throw i.statusBar.hideWaitingElementStatus(),t})}).then(function(){!function(t,e){var n=t.getBoundingClientRect(),r={left:n.left,right:n.right,top:n.top,bottom:n.bottom},i=y.styleUtils.getElementMargin(t),o=y.styleUtils.getElementPadding(t),s=y.styleUtils.getBordersWidth(t);e.originOffset={x:0,y:0};var a=r.left+t.scrollWidth+s.left+s.right,l=r.top+t.scrollHeight+s.top+s.bottom;r.right=Math.max(r.right,a),r.bottom=Math.max(r.bottom,l),e.includeBorders&&e.includePaddings?e.includeMargins&&(e.originOffset.x-=i.left,e.originOffset.y-=i.top,r.left-=i.left,r.top-=i.top,r.right+=i.right,r.bottom+=i.bottom):(e.originOffset.x+=s.left,e.originOffset.y+=s.top,r.left+=s.left,r.top+=s.top,r.right-=s.right,r.bottom-=s.bottom,e.includePaddings||(e.originOffset.x+=o.left,e.originOffset.y+=o.top,r.left+=o.left,r.top+=o.top,r.right-=o.right,r.bottom-=o.bottom)),r.width=r.right-r.left,r.height=r.bottom-r.top;var c=bl({min:e.crop.left,max:e.crop.right,length:e.crop.width},r.width),u=bl({min:e.crop.top,max:e.crop.bottom,length:e.crop.height},r.height);if(e.crop.left=c.min,e.crop.right=c.max,e.crop.width=c.length,e.crop.top=u.min,e.crop.bottom=u.max,e.crop.height=u.length,e.crop.width<=0||e.crop.height<=0)throw new qe(e.crop.width,e.crop.height);var d=y.styleUtils.getViewportDimensions();(r.width>d.width||r.height>d.height)&&(e.scrollToCenter=!0);var h="number"==typeof e.scrollTargetX,f="number"==typeof e.scrollTargetY;h||(e.scrollTargetX=Wl(e.crop.left,e.crop.right,d.width)),f||(e.scrollTargetY=Wl(e.crop.top,e.crop.bottom,d.height));var m=_.getOffsetOptions(t,e.scrollTargetX,e.scrollTargetY),p=m.offsetX,g=m.offsetY;e.scrollTargetX=p,e.scrollTargetY=g;var v=!h||e.scrollTargetX>=e.crop.left&&e.scrollTargetX<=e.crop.right,w=!f||e.scrollTargetY>=e.crop.top&&e.scrollTargetY<=e.crop.bottom;if(!v||!w)throw new Ye(v,w)}(i.element,i.command.options);var t=i.command.options,e=t.scrollTargetX,n=t.scrollTargetY,r=t.scrollToCenter;return new _.Scroll(i.element,new Ys({offsetX:e,offsetY:n,scrollToCenter:r,skipParentFrames:!0})).run()})},Rl.prototype._hideUI=function(){return n.hide(),this.command.markData&&n.showScreenshotMark(this.command.markData),y.delay(500)},Rl.prototype._showUI=function(){this.command.markData&&n.hideScreenshotMark(),n.show()},Rl.prototype._requestManipulation=function(){if(!os(Rc))return l.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var t=this._getAbsoluteCropValues();return y.sendRequestToFrame({cmd:Pl,command:this.command,cropDimensions:t},Al,Rc.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}})},Rl.prototype._runManipulation=function(){var r=this,i=null;return l.Promise.resolve().then(function(){return r.command.type!==m.takeElementScreenshot?l.Promise.resolve():(y.scrollController.stopPropagation(),r._runScrollBeforeScreenshot())}).then(function(){return os(Rc)?l.Promise.resolve():r._hideUI()}).then(function(){return r._requestManipulation()}).then(function(t){var e=t.result,n=t.error;if(n)throw n;return y.scrollController.enablePropagation(),i=e,os(Rc)||r._showUI(),y.delay(200)}).then(function(){return new cr({isCommandResult:!0,result:i})}).catch(function(t){return y.scrollController.enablePropagation(),new cr({isCommandResult:!0,executionError:t})})},Rl.prototype.execute=function(){var t=this;return xo(function(){return t._runManipulation()}).barriersPromise},Rl);function Rl(t,e,n){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.element=null}var Nl=o.Promise,kl=(Fl.prototype.setAsMaster=function(t){return vo(new Ki(t),this.driverWindow,wo,fn)},Fl.prototype.closeAllChildWindows=function(){return vo(new Qi,this.driverWindow,wo,gn)},Fl.prototype.findChildWindows=function(t,e){return vo(new e(t),this.driverWindow,wo,fn)},Fl.prototype.startToRestore=function(){return vo(new eo,this.driverWindow,wo,fn)},Fl);function Fl(t,e){this.driverWindow=t,this.windowId=e}var Ll=(Ul.prototype._getTopOpenedWindow=function(t){for(var e=t;e.opener;)e=e.opener;return e.top},Ul.prototype._setAsMaster=function(t,e){return vo(new Ki(e),t,wo,fn)},Ul.prototype.getTopOpenedWindow=function(){return this._getTopOpenedWindow(this.currentDriverWindow)},Ul.prototype.setTopOpenedWindowAsMaster=function(){var t=this._getTopOpenedWindow(this.currentDriverWindow);return this._setAsMaster(t)},Ul.prototype.setParentWindowAsMaster=function(t){void 0===t&&(t={});var e=this.currentDriverWindow.opener;return this._setAsMaster(e,t.finalizePendingCommand)},Ul.prototype.restoreChild=function(r){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){return e=new io(r),n=this.currentDriverWindow.opener,vo(e,n,wo,fn),[2]})})},Ul);function Ul(t){this.currentDriverWindow=t}var Ol,Bl="master",Hl="replica",Gl=o.settings,Vl=o.transport,Xl=o.Promise,Yl=o.eventSandbox.message,zl=o.storages,jl=o.nativeMethods,ql=jl.date,Kl=o.eventSandbox.listeners,Jl="testcafe|driver|test-done-sent-flag",$l="testcafe|driver|pending-status",Ql="testcafe|driver|executing-client-function-descriptor",Zl="testcafe|driver|selector-execution-start-time",tc="testcafe|driver|pending-page-error",ec="testcafe|driver|active-iframe-selector",nc="testcafe|driver|test-speed",rc="testcafe|driver|assertion-retries-timeout",ic="testcafe|driver|assertion-retries-start-time",oc="testcafe|driver|console-messages",sc="testcafe|driver|pending-child-window-count",ac={NotLoadedError:tn,NotFoundError:se,IsInvisibleError:ce},lc={NotLoadedError:rn,NotFoundError:Gn,IsInvisibleError:Yn},cc=Math.pow(2,31)-1,uc="status-with-command-result-event",dc="empty-command-event",hc="child-window-closed",fc=(s(mc,Ol=y.serviceUtils.EventEmitter),mc.prototype._isOpenedInIframe=function(){var t=Rc.opener;return t&&t.top&&t.top!==t},Object.defineProperty(mc.prototype,"speed",{get:function(){return this.contextStorage.getItem(nc)},set:function(t){this.contextStorage.setItem(nc,t)},enumerable:!1,configurable:!0}),Object.defineProperty(mc.prototype,"consoleMessages",{get:function(){return new rr(this.contextStorage.getItem(oc))},set:function(t){return this.contextStorage.setItem(oc,t?t.getCopy():null)},enumerable:!1,configurable:!0}),mc.prototype._getReadyPromise=function(){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,y.eventUtils.documentReady(this.pageLoadTimeout)];case 1:return t.sent(),[4,this.pageInitialRequestBarrier.wait(!0)];case 2:return t.sent(),[2]}})})},mc.prototype._hasPendingActionFlags=function(t){return t.getItem(this.COMMAND_EXECUTING_FLAG)||t.getItem(this.EXECUTING_IN_IFRAME_FLAG)},mc.prototype._getCurrentWindowId=function(){var t=Rc.location.toString(),e=o.utils.url.parseProxyUrl(t);return e&&e.windowId||null},mc.prototype._onJsError=function(t){if(this.skipJsErrors||this.contextStorage.getItem(Jl))return Xl.resolve();var e=new Rt(t.stack,t.pageUrl);return this.contextStorage.getItem(tc)||this.contextStorage.setItem(tc,e),null},mc.prototype._unlockPageAfterTestIsDone=function(){return y.disableRealEventsPreventing(),Xl.resolve()},mc.prototype._getActiveElement=function(){return c(this,void 0,void 0,function(){var e;return u(this,function(t){return e=y.domUtils.getActiveElement(),[2,this.replicator.encode(e)]})})},mc.prototype._failIfClientCodeExecutionIsInterrupted=function(){var t=this.contextStorage.getItem(Ql);return!!t&&(this._onReady(new cr({isCommandResult:!0,executionError:new wt(t.instantiationCallsiteName)})),!0)},mc.prototype.onCustomClientScriptError=function(t,e){var n=e?new Yt(t,e):new Gt(t);this.contextStorage.getItem(tc)||this.contextStorage.setItem(tc,n)},mc.prototype._addChildWindowDriverLink=function(t){var e=new kl(t.window,t.windowId);this.childWindowDriverLinks.push(e),this._ensureClosedChildWindowWatcher()},mc.prototype._ensureClosedChildWindowWatcher=function(){var e=this;this.checkClosedChildWindowIntervalId||(this.checkClosedChildWindowIntervalId=jl.setInterval.call(Rc,function(){var t=y.arrayUtils.find(e.childWindowDriverLinks,function(t){return t.driverWindow.closed});t&&(e.emit(hc),y.arrayUtils.remove(e.childWindowDriverLinks,t),t.ignoreMasterSwitching||e._setCurrentWindowAsMaster(),e.childWindowDriverLinks.length||(jl.clearInterval.call(Rc,e.checkClosedChildWindowIntervalId),delete e.checkClosedChildWindowIntervalId))},200))},mc.prototype._setAsMasterInProgressOrCompleted=function(){return this.setAsMasterInProgress||this.role===Bl},mc.prototype._setCurrentWindowAsMaster=function(){var t=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,this._clearActiveChildIframeInfo(),Xl.resolve().then(function(){return y.browser.setActiveWindowId(t.browserActiveWindowId,o.createNativeXHR,t.windowId)}).then(function(){t._startInternal({finalizePendingCommand:!0,isFirstRequestAfterWindowSwitching:!0}),t.setAsMasterInProgress=!1}).catch(function(){t._onReady(new cr({isCommandResult:!0,executionError:new fn}))}))},mc.prototype._onChildWindowOpened=function(t){this._addChildWindowDriverLink(t),this._switchToChildWindow(t.windowId)},mc.prototype._sendStartToRestoreCommand=function(){if(this.contextStorage){this._stopRespondToChildren=!0,this.contextStorage.setItem(sc,this.childWindowDriverLinks.length);for(var t=0,e=this.childWindowDriverLinks;t<e.length;t++)e[t].startToRestore()}},mc.prototype._onFormSubmit=function(t){this.contextStorage&&this.contextStorage.getItem(Jl)&&(t.preventSubmit=!0)},mc.prototype._onConsoleMessage=function(t){var e=t.meth,n=t.line,r=this.consoleMessages;r.addMessage(e,n,this.windowId),this.consoleMessages=r},mc.prototype._addPendingErrorToStatus=function(t){var e=this.contextStorage.getItem(tc);e&&(this.contextStorage.setItem(tc,null),t.pageError=e)},mc.prototype._addUnexpectedDialogErrorToStatus=function(t){var e=this.nativeDialogsTracker.getUnexpectedDialogError();t.pageError=t.pageError||e},mc.prototype._addConsoleMessagesToStatus=function(t){t.consoleMessages=this.consoleMessages,this.consoleMessages=null},mc.prototype._addPendingWindowSwitchingStateToStatus=function(t){t.isPendingWindowSwitching=!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},mc.prototype._sendStatusRequest=function(t){function e(){return y.getTimeLimitedPromise(Vl.asyncServiceMsg(r),5e3)}function n(){return y.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},mc.prototype._sendStatus=function(t){var e=this;t.resent||(this._addPendingErrorToStatus(t),this._addUnexpectedDialogErrorToStatus(t),this._addConsoleMessagesToStatus(t),this._addPendingWindowSwitchingStateToStatus(t)),this.contextStorage.setItem($l,t);var n=null;return y.pageUnloadBarrier.wait(0).then(function(){return e._sendStatusRequest(t)}).then(function(t){return n=t,y.pageUnloadBarrier.wait(0)}).then(function(){return e.contextStorage.setItem($l,null),n})},mc.prototype._addChildIframeDriverLink=function(t,e){var n,r=this._getChildIframeDriverLinkByWindow(e);r||(n=this.testRunId+"-"+ar(),r=new _o(e,n),this.childIframeDriverLinks.push(r)),r.sendConfirmationMessage(t)},mc.prototype._getTargetWindowNotFoundResult=function(t,e){return Xl.resolve({success:!1,errCode:t,errMsg:e})},mc.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===rt||t.result.errCode===lt});return(n=n||t.find(function(t){return!!t.result.errCode}))?{errCode:n.result.errCode}:void 0},mc.prototype._handleWindowValidation=function(n,r,i,o){return c(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this._validateWindow(n,r,i,o)];case 1:return e=t.sent(),yo({requestMsgId:n.id,window:r,result:e}),[2]}})})},mc.prototype._getWindowInfo=function(){var t=o.utils.url.parseProxyUrl(Rc.location.toString());return{id:this.windowId,title:Nc.title,url:t.destUrl}},mc.prototype._isTargetWindow=function(t){return t.windowId===this.windowId},mc.prototype._validateWindow=function(r,t,i,o){return c(this,void 0,void 0,function(){var e,n;return u(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,Xl.all(e)]):[2,this._getTargetWindowNotFoundResult(it)];case 1:return n=t.sent(),[2,this._getChildWindowValidateResult(n)]}})})},mc._createWindowValidationError=function(t){var e=t.errCode;return new(e===rt?yn:e===lt?Sn:bn)},mc.prototype._getCloseWindowFoundResult=function(){return this.parentWindowDriverLink?this.childWindowDriverLinks.length?Xl.resolve({success:!1,errCode:rt}):Xl.resolve({success:!0}):Xl.resolve({success:!1,errCode:lt})},mc.prototype._handleCloseWindowValidation=function(t,e){var n=this;return this._handleWindowValidation(t,e,function(){return n._getCloseWindowFoundResult()},Ci)},mc.prototype._handleSwitchToWindowValidation=function(t,e){return this._handleWindowValidation(t,e,function(){return Xl.resolve({success:!0})},Ti)},mc.prototype._handleCloseWindow=function(e,n){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this._closeWindow(e,n)];case 1:return t.sent(),yo({requestMsgId:e.id,window:n}),[2]}})})},mc.prototype._closeWindowAndWait=function(t,e){var n=this._createWaitForEventPromise(hc,2e3);return t.ignoreMasterSwitching=!e.isCurrentWindow,t.driverWindow.close(),n},mc.prototype._closeWindow=function(e){if(!this.childWindowDriverLinks.length)return Xl.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,Ai)});return Xl.all(n)},mc.prototype._getWindows=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return u(this,function(t){switch(t.label){case 0:return this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows({},Wi)}),[4,Xl.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]}})})},mc.prototype._handleGetWindows=function(n,r){return c(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this._getWindows(n,r)];case 1:return e=t.sent(),yo({requestMsgId:n.id,window:r,result:e}),[2]}})})},mc.prototype._handleSwitchToWindow=function(e,n){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this._switchToWindow(e)];case 1:return t.sent(),yo({requestMsgId:e.id,window:n}),[2]}})})},mc.prototype._switchToWindow=function(e){var t=this;return this._isTargetWindow(e)?Xl.resolve().then(function(){t._setCurrentWindowAsMaster()}):this.childWindowDriverLinks.length?Xl.all(this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,Ni)})):Xl.resolve()},mc.prototype._handleSetAsMasterMessage=function(t,e){var n=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,yo({requestMsgId:t.id,window:e}),Xl.resolve().then(function(){return y.browser.setActiveWindowId(n.browserActiveWindowId,o.createNativeXHR,n.windowId)}).then(function(){n._startInternal({finalizePendingCommand:t.finalizePendingCommand,result:{id:n.windowId}}),n.setAsMasterInProgress=!1}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new fn}))}))},mc.prototype._handleCloseAllWindowsMessage=function(t,e){var n=this;this._closeAllChildWindows().then(function(){yo({requestMsgId:t.id,window:e})}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new gn}))})},mc.prototype._handleStartToRestoreChildLinkMessage=function(){this.parentWindowDriverLink.restoreChild(this._getCurrentWindowId())},mc.prototype._handleRestoreChildLink=function(t,e){this._stopRespondToChildren||(this._addChildWindowDriverLink({window:e,windowId:t.windowId}),this.childWindowDriverLinks.length===this.contextStorage.getItem(sc)&&this._restoreChildWindowsPromiseResolver&&(this._restoreChildWindowsPromiseResolver(),delete this._restoreChildWindowsPromiseResolver,this.contextStorage.setItem(sc,0)),yo({requestMsgId:t.id,window:e}))},mc.prototype._handleChildWindowIsOpenedInIFrame=function(){var e=this;this._pendingChildWindowInIFrame=new Xl(function(t){e._resolvePendingChildWindowInIframe=t})},mc.prototype._handleChildWindowIsLoadedInIFrame=function(e,t){yo({requestMsgId:e.id,window:t}),this._resolvePendingChildWindowInIframe(),this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId})||this._onChildWindowOpened({window:t,windowId:e.windowId})},mc.prototype._initChildDriverListening=function(){var r=this;Yl.on(Yl.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message,n=t.source;switch(e.type){case ri:r._addChildIframeDriverLink(e.id,n);break;case wi:r._handleChildWindowIsOpenedInIFrame(e,n);break;case vi:r._handleChildWindowIsLoadedInIFrame(e,n);break;case fi:r._handleSetAsMasterMessage(e,n);break;case ii:r._handleSwitchToWindow(e,n);break;case oi:r._handleCloseWindow(e,n);break;case ai:r._handleSwitchToWindowValidation(e,n);break;case si:r._handleCloseWindowValidation(e,n);break;case li:r._handleGetWindows(e,n);break;case mi:r._handleCloseAllWindowsMessage(e,n);break;case pi:r._handleStartToRestoreChildLinkMessage();break;case gi:r._handleRestoreChildLink(e,n)}})},mc.prototype._getChildIframeDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childIframeDriverLinks,function(t){return t.driverWindow===e})},mc.prototype._getChildWindowDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childWindowDriverLinks,function(t){return t.driverWindow===e})},mc.prototype._runInActiveIframe=function(t){var e=this,n=Xl.resolve(),r=this.contextStorage.getItem(ec);!this.activeChildIframeDriverLink&&r&&(n=this._switchToIframe(r,lc)),n.then(function(){return e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!0),e.activeChildIframeDriverLink.executeCommand(t,e.speed)}).then(function(t){return e._onCommandExecutedInIframe(t)}).catch(function(t){return e._onCommandExecutedInIframe(new cr({isCommandResult:!0,executionError:t}))})},mc.prototype._onCommandExecutedInIframe=function(t){var e=this;this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1);var n=Xl.resolve();this._pendingChildWindowInIFrame&&(n=this._pendingChildWindowInIFrame),n.then(function(){e._onReady(t)})},mc.prototype._ensureChildIframeDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildIframeDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},mc.prototype._ensureChildWindowDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildWindowDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},mc.prototype._switchToIframe=function(e,n){var t,r,i,o,s,a,l,c=this,u="number"==typeof e.timeout?e.timeout:this.selectorTimeout;return t=e,r=u,i=null,o=function(t){return new n.NotFoundError(t)},s=function(){return new n.IsInvisibleError},a=this.statusBar,l=new zo(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(!y.domUtils.isIframeElement(t))throw new $e;return c._ensureChildIframeDriverLink(jl.contentWindowGetter.call(t),n.NotLoadedError,u)}).then(function(t){t.availabilityTimeout=u,c.activeChildIframeDriverLink=t,c.contextStorage.setItem(ec,e)})},mc.prototype._createWaitForEventPromise=function(e,n){var r=this,i=null,t=new Xl(function(t){jl.setTimeout.call(Rc,function(){r.off(e,i),t()},n)}),o=new Xl(function(t){i=function(){this.off(e,i),t()},r.on(e,i)});return Xl.race([t,o])},mc.prototype._waitForCurrentCommandCompletion=function(){return this.contextStorage.getItem(this.COMMAND_EXECUTING_FLAG)?this._createWaitForEventPromise(uc,cc):Xl.resolve()},mc.prototype._waitForEmptyCommand=function(){return this._createWaitForEventPromise(dc,3e4)},mc.prototype._abortSwitchingToChildWindowIfItClosed=function(){if(this.activeChildWindowDriverLink.driverWindow.closed)throw y.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),this.activeChildWindowDriverLink=null,new Fn},mc.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 Nl.resolve(null);var n=y.arrayUtils.find(t,function(t){return t.windowId===e});if(n)return Nl.resolve(n);var r=new an;return Nl.reject(r)}(t,this.childWindowDriverLinks).then(function(t){return e._ensureChildWindowDriverLink(t.driverWindow,un,e.childWindowReadyTimeout)}).then(function(t){return e.activeChildWindowDriverLink=t,e._waitForCurrentCommandCompletion()}).then(function(){return n?void 0:e._waitForEmptyCommand()}).then(function(){return 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 Fn?e._onReady(new cr):e._onReady(new cr({isCommandResult:!0,executionError:new fn}))})},mc.prototype._switchToTopParentWindow=function(){var t=this.parentWindowDriverLink.setTopOpenedWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(t)},mc.prototype._switchToParentWindow=function(t){void 0===t&&(t={});var e=this.parentWindowDriverLink.setParentWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(e,t)},mc.prototype._switchToParentWindowInternal=function(t,e){var n=this;return void 0===e&&(e={}),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0),Xl.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 cr({isCommandResult:!0,executionError:new fn}))})},mc.prototype._switchToMainWindow=function(t){this.activeChildIframeDriverLink&&this.activeChildIframeDriverLink.executeCommand(t),this._clearActiveChildIframeInfo()},mc.prototype._clearActiveChildIframeInfo=function(){this.contextStorage.setItem(ec,null),this.activeChildIframeDriverLink=null},mc.prototype._setNativeDialogHandlerInIframes=function(t){for(var e=new zi(t),n=0;n<this.childIframeDriverLinks.length;n++)Yl.sendServiceMsg(e,this.childIframeDriverLinks[n].driverWindow)},mc.prototype._onActionCommand=function(t){var e,n,r,i,o=this,s=(e=t,n=this.selectorTimeout,r=this.statusBar,i=this.speed,new Il(e,n,r,i).execute()),a=s.startPromise,l=s.completionPromise;a.then(function(){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!0)}),l.then(function(t){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!1),o._onReady(t)})},mc.prototype._onSetNativeDialogHandlerCommand=function(t){this.nativeDialogsTracker.setHandler(t.dialogHandler),this._setNativeDialogHandlerInIframes(t.dialogHandler),this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new cr({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},mc.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onNavigateToCommand=function(t){var e=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),function(r){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new y.RequestBarrier,l.navigateTo(r.url,r.forceReload),[4,l.Promise.all([e.wait(),y.pageUnloadBarrier.wait()])];case 1:return t.sent(),[2,new cr({isCommandResult:!0})];case 2:return n=t.sent(),[2,new cr({isCommandResult:!0,executionError:n})];case 3:return[2]}})})}(t).then(function(t){return e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e._onReady(t)})},mc.prototype._onExecuteClientFunctionCommand=function(t){var e=this;this.contextStorage.setItem(Ql,{instantiationCallsiteName:t.instantiationCallsiteName}),new Hr(t).getResultDriverStatus().then(function(t){e.contextStorage.setItem(Ql,null),e._onReady(t)})},mc.prototype._onExecuteSelectorCommand=function(t){var e,n,r,i,o,s,a,l=this,c=this.contextStorage.getItem(Zl)||new ql,u=t.needError?function(t){return new Pt(null,t)}:null;e=t,n=this.selectorTimeout,r=c,o=i=u,s=this.statusBar,a=new zo(e,n,r,i,o),s.showWaitingElementStatus(a.timeout),a.getResultDriverStatus().then(function(t){return s.hideWaitingElementStatus(!!t.result).then(function(){return t})}).then(function(t){l.contextStorage.setItem(Zl,null),l._onReady(t)})},mc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t),this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onSwitchToIframeCommand=function(t){var e=this;this._switchToIframe(t.selector,ac).then(function(){return e._onReady(new cr({isCommandResult:!0}))}).catch(function(t){return e._onReady(new cr({isCommandResult:!0,executionError:t}))})},mc.prototype._onWindowOpenCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!0),Rc.open(t.url)},mc.prototype._onWindowCloseCommand=function(a){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return u(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 mc._createWindowValidationError(o);return[4,vo(new Ai({windowId:n,isCurrentWindow:r}),e,wo,fn)];case 3:return t.sent(),r||this._onReady(new cr({isCommandResult:!0})),[3,5];case 4:return s=t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:s})),[3,5];case 5:return[2]}})})},mc.prototype._onGetCurrentWindowCommand=function(){this._onReady(new cr({isCommandResult:!0,result:{id:this.windowId}}))},mc.prototype._onGetWindowsCommand=function(){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,vo(new Wi,e,wo,fn)];case 1:return n=t.sent(),this._onReady(new cr({isCommandResult:!0,result:n.result})),[2]}})})},mc.prototype._validateChildWindowCloseCommandExists=function(t,e){return vo(new Ci({windowId:t}),e,wo,fn)},mc.prototype._validateChildWindowSwitchToWindowCommandExists=function(t,e){var n=t.windowId,r=t.fn;return vo(new Ti({windowId:n,fn:r}),e,wo,fn)},mc.prototype._getTopOpenedWindow=function(){var t;return((null===(t=this.parentWindowDriverLink)||void 0===t?void 0:t.getTopOpenedWindow())||Rc).top},mc.prototype._onSwitchToWindow=function(i,o){return c(this,void 0,void 0,function(){var e,n,r;return u(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,this._validateChildWindowSwitchToWindowCommandExists({windowId:i.windowId,fn:i.findWindow},e)];case 1:return n=t.sent(),(r=n.result).success?(this._stopInternal(),vo(new Ni({windowId:i.windowId,fn:i.findWindow}),e,wo,fn)):this._onReady(new cr({isCommandResult:!0,executionError:o||mc._createWindowValidationError(r)})),[2]}})})},mc.prototype._restoreChildWindowLinks=function(){return c(this,void 0,void 0,function(){var e,n=this;return u(this,function(t){switch(t.label){case 0:if(!this.contextStorage.getItem(sc))return[2];e=new Xl(function(t){n._restoreChildWindowsPromiseResolver=t}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,y.getTimeLimitedPromise(e,3e4)];case 2:return t.sent(),[3,4];case 3:return t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:new On})),[3,4];case 4:return[2]}})})},mc.prototype._onSwitchToPreviousWindow=function(t){this._onSwitchToWindow(t,new Rn)},mc.prototype._onSwitchToParentWindow=function(){this.parentWindowDriverLink?this._switchToParentWindow({finalizePendingCommand:!0}):this._onReady(new cr({isCommandResult:!0,executionError:new Pn}))},mc.prototype._onBrowserManipulationCommand=function(t){var e,n,r,i=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),e=t,n=this.selectorTimeout,r=this.statusBar,new Dl(e,n,r).execute().then(function(t){return i.contextStorage.setItem(i.COMMAND_EXECUTING_FLAG,!1),i._onReady(t)})},mc.prototype._onSetBreakpointCommand=function(t){var e=this;this.statusBar.showDebuggingStatus(t).then(function(t){return e._onReady(new cr({isCommandResult:!0,result:t}))})},mc.prototype._onSetTestSpeedCommand=function(t){this.speed=t.speed,this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onShowAssertionRetriesStatusCommand=function(t){this.contextStorage.setItem(rc,t.timeout),this.contextStorage.setItem(ic,jl.dateNow()),this.statusBar.showWaitingAssertionRetriesStatus(t.timeout),this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onHideAssertionRetriesStatusCommand=function(t){var e=this;this.contextStorage.setItem(rc,null),this.contextStorage.setItem(ic,null),this.statusBar.hideWaitingAssertionRetriesStatus(t.success).then(function(){return e._onReady(new cr({isCommandResult:!0}))})},mc.prototype._checkStatus=function(){var r=this;return y.browser.checkStatus(this.browserStatusDoneUrl,o.createNativeXHR,{manualRedirect:!0}).then(function(t){var e=t.command,n=t.redirecting;n&&e.url.indexOf(r.testRunId)<0?(zl.clear(),zl.lock()):r.contextStorage.setItem(Jl,!1),n?y.browser.redirect(e):r._onReady({isCommandResult:!1})}).catch(function(){return y.delay(1e3)})},mc.prototype._onCustomCommand=function(t){var e=this;(0,this.customCommandHandlers[t.type].handler)(t).then(function(t){e._onReady(new cr({isCommandResult:!0,result:t}))})},mc.prototype._closeAllChildWindows=function(){var t=this;return this.childWindowDriverLinks.length?Xl.all(this.childWindowDriverLinks.map(function(t){return t.closeAllChildWindows()})).then(function(){jl.arrayForEach.call(t.childWindowDriverLinks,function(t){t.driverWindow.close()})}):Xl.resolve()},mc.prototype._onTestDone=function(t){var e=this;this.contextStorage.setItem(Jl,!0),this.parentWindowDriverLink?this._switchToTopParentWindow():this._closeAllChildWindows().then(function(){return e._sendStatus(t)}).then(function(){e._checkStatus()}).catch(function(){e._onReady(new cr({isCommandResult:!0,executionError:gn}))})},mc.prototype._onBackupStoragesCommand=function(){this._onReady(new cr({isCommandResult:!0,result:zl.backup()}))},mc.prototype._isStatusWithCommandResultInPendingWindowSwitchingMode=function(t){return t.isCommandResult&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},mc.prototype._isEmptyCommandInPendingWindowSwitchingMode=function(t){return!t&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},mc.prototype._onReady=function(t){var e=this;this._isStatusWithCommandResultInPendingWindowSwitchingMode(t)&&this.emit(uc),this._sendStatus(t).then(function(t){if(t)e._onCommand(t);else{if(e._isEmptyCommandInPendingWindowSwitchingMode(t))return void e.emit(dc);e._onReady(new cr)}})},mc.prototype._executeCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!1),this.customCommandHandlers[t.type]?this._onCustomCommand(t):t.type===m.testDone?this._onTestDone(new cr({isCommandResult:!0})):t.type===m.setBreakpoint?this._onSetBreakpointCommand(t.isTestError):t.type===m.switchToMainWindow?this._onSwitchToMainWindowCommand(t):t.type===m.switchToIframe?this._onSwitchToIframeCommand(t):t.type===m.openWindow?this._onWindowOpenCommand(t):t.type===m.closeWindow?this._onWindowCloseCommand(t):t.type===m.getCurrentWindow?this._onGetCurrentWindowCommand(t):t.type===m.getCurrentWindows?this._onGetWindowsCommand():t.type===m.switchToWindow?this._onSwitchToWindow(t):t.type===m.switchToPreviousWindow?this._onSwitchToPreviousWindow(t):t.type===m.switchToParentWindow?this._onSwitchToParentWindow():ht(t)?this._onBrowserManipulationCommand(t):t.type===m.executeClientFunction?this._onExecuteClientFunctionCommand(t):t.type===m.executeSelector?this._onExecuteSelectorCommand(t):t.type===m.navigateTo?this._onNavigateToCommand(t):t.type===m.setNativeDialogHandler?this._onSetNativeDialogHandlerCommand(t):t.type===m.getNativeDialogHistory?this._onGetNativeDialogHistoryCommand(t):t.type===m.getBrowserConsoleMessages?this._onGetBrowserConsoleMessagesCommand(t):t.type===m.setTestSpeed?this._onSetTestSpeedCommand(t):t.type===m.showAssertionRetriesStatus?this._onShowAssertionRetriesStatusCommand(t):t.type===m.hideAssertionRetriesStatus?this._onHideAssertionRetriesStatusCommand(t):t.type===m.backupStorages?this._onBackupStoragesCommand():this._onActionCommand(t)},mc.prototype._isExecutableInTopWindowOnly=function(t){if((e=t).type===m.testDone||e.type===m.switchToMainWindow||e.type===m.setNativeDialogHandler||e.type===m.getNativeDialogHistory||e.type===m.setTestSpeed||e.type===m.showAssertionRetriesStatus||e.type===m.hideAssertionRetriesStatus||e.type===m.setBreakpoint||ht(e)&&e.type!==m.takeElementScreenshot)return!0;var e,n=this.customCommandHandlers[t.type];return t.forceExecutionInTopWindowOnly||n&&n.isExecutableInTopWindowOnly},mc.prototype._onCommand=function(n){var r=this;this.readyPromise.then(function(){var t,e=ut(n);r.contextStorage.getItem(tc)&&e?r._onReady(new cr({isCommandResult:!0})):(t=r.activeChildIframeDriverLink||r.contextStorage.getItem(ec),r._isExecutableInTopWindowOnly(n)||!t?r._executeCommand(n):r._runInActiveIframe(n))})},mc.prototype.setCustomCommandHandlers=function(t,e,n){this.customCommandHandlers[t]={isExecutableInTopWindowOnly:n,handler:e}},mc.prototype._startInternal=function(t){this.role=Bl,y.browser.startHeartbeat(this.heartbeatUrl,o.createNativeXHR),this._setupAssertionRetryIndication(),this._startCommandsProcessing(t)},mc.prototype._stopInternal=function(){this.role=Hl,y.browser.stopHeartbeat(),_.cursor.hide()},mc.prototype._setupAssertionRetryIndication=function(){var n=this;this.readyPromise.then(function(){n.statusBar.hidePageLoadingStatus();var t,e=n.contextStorage.getItem(rc);e&&(t=n.contextStorage.getItem(ic),0<e-(new ql-t)&&n.statusBar.showWaitingAssertionRetriesStatus(e,t))})},mc.prototype._startCommandsProcessing=function(t){void 0===t&&(t={finalizePendingCommand:!1,isFirstRequestAfterWindowSwitching:!1,result:void 0});var e,n,r=this.contextStorage.getItem($l);r&&(r.resent=!0),this.contextStorage.getItem(Jl)?r?this._onTestDone(r):this._checkStatus():this._failIfClientCodeExecutionIsInterrupted()||(e=t.finalizePendingCommand||this._hasPendingActionFlags(this.contextStorage),n=r||new cr({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))},mc.prototype._initParentWindowLink=function(){Rc.opener&&Rc.opener!==Rc&&this.windowId&&(this.parentWindowDriverLink=new Ll(Rc))},mc.prototype._initConsoleMessages=function(){var t=this.consoleMessages;t.ensureMessageContainer(this.windowId),this.consoleMessages=t},mc.prototype._getDriverRole=function(){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return this.windowId?[4,y.browser.getActiveWindowId(this.browserActiveWindowId,o.createNativeXHR)]:[2,Bl];case 1:return[2,t.sent().activeWindowId===this.windowId?Bl:Hl]}})})},mc.prototype._init=function(){this.contextStorage=new po(Rc,this.testRunId,this.windowId),this.nativeDialogsTracker=new Zr(this.contextStorage,this.dialogHandler),this.statusBar=new n.StatusBar(this.userAgent,this.fixtureName,this.testName,this.contextStorage),this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK,y.disableRealEventsPreventing),this.speed=this.initialSpeed,this._initConsoleMessages(),this._initParentWindowLink(),this._isOpenedInIframe()&&vo(new ao(this.windowId),Rc.opener.top,wo,bn)},mc.prototype._doFirstPageLoadSetup=function(){return c(this,void 0,void 0,function(){return u(this,function(t){return this.isFirstPageLoad&&this.canUseDefaultWindowActions,[2]})})},mc.prototype.start=function(){return c(this,void 0,void 0,function(){var e;return u(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===Bl||e===Bl&&this._startInternal(),[2]}})})},mc);function mc(t,e,n,r){var i=Ol.call(this)||this;return 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.heartbeatUrl=e.heartbeat,i.browserStatusUrl=e.status,i.browserStatusDoneUrl=e.statusDone,i.browserActiveWindowId=e.activeWindowId,i.userAgent=n.userAgent,i.fixtureName=n.fixtureName,i.testName=n.testName,i.selectorTimeout=r.selectorTimeout,i.pageLoadTimeout=r.pageLoadTimeout,i.childWindowReadyTimeout=r.childWindowReadyTimeout,i.initialSpeed=r.speed,i.skipJsErrors=r.skipJsErrors,i.dialogHandler=r.dialogHandler,i.canUseDefaultWindowActions=r.canUseDefaultWindowActions,i.isFirstPageLoad=Gl.get().isFirstPageLoad,i.customCommandHandlers={},i.contextStorage=null,i.nativeDialogsTracker=null,i.childIframeDriverLinks=[],i.activeChildIframeDriverLink=null,i.childWindowDriverLinks=[],i.parentWindowDriverLink=null,i.statusBar=null,i.windowId=i._getCurrentWindowId(),i.role=Hl,i.setAsMasterInProgress=!1,i.checkClosedChildWindowIntervalId=null,i.pageInitialRequestBarrier=new y.RequestBarrier,i.readyPromise=i._getReadyPromise(),i._initChildDriverListening(),y.pageUnloadBarrier.init(),y.preventRealEvents(),o.on(o.EVENTS.uncaughtJsError,function(t){return i._onJsError(t)}),o.on(o.EVENTS.unhandledRejection,function(t){return i._onJsError(t)}),o.on(o.EVENTS.consoleMethCalled,function(t){return i._onConsoleMessage(t)}),o.on(o.EVENTS.beforeFormSubmit,function(t){return i._onFormSubmit(t)}),o.on(o.EVENTS.windowOpened,function(t){return i._onChildWindowOpened(t)}),i.setCustomCommandHandlers(m.unlockPage,function(){return i._unlockPageAfterTestIsDone()}),i.setCustomCommandHandlers(m.getActiveElement,function(){return i._getActiveElement()}),Kl.addInternalEventBeforeListener(Rc,["beforeunload"],function(){i._sendStartToRestoreCommand()}),i.replicator=Dr([new Lr]),i}var pc=(gc.prototype.establishConnection=function(){return vo(new yi,this.driverWindow,5e3,rn).then(function(t){return t.result.id})},gc.prototype.sendConfirmationMessage=function(t){yo({requestMsgId:t,window:this.driverWindow})},gc.prototype.onCommandExecuted=function(t){var e=new Li(t);l.eventSandbox.message.sendServiceMsg(e,this.driverWindow)},gc);function gc(t){this.driverWindow=t}var vc,wc=o.eventSandbox.message,yc=(s(_c,vc=Zr),_c.prototype._defaultDialogHandler=function(t){wc.sendServiceMsg({type:Xr,dialogType:t,url:Zr._getPageUrl()},Rc.top)},_c.prototype._addAppearedDialogs=function(t,e){wc.sendServiceMsg({type:Vr,dialogType:t,text:e,url:Zr._getPageUrl()},Rc.top)},_c.prototype._onHandlerError=function(t,e){wc.sendServiceMsg({type:Yr,dialogType:t,message:e,url:Zr._getPageUrl()},Rc.top)},_c);function _c(t){return vc.call(this,null,t)||this}var Ec,Cc=l.eventSandbox.message,Sc=(s(Ic,Ec=fc),Ic.prototype._onJsError=function(){},Ic.prototype._onConsoleMessage=function(){},Ic.prototype._onChildWindowOpened=function(){Cc.sendServiceMsg(new uo,Rc.top)},Ic.prototype._initParentDriverListening=function(){var n=this;l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;y.pageUnloadBarrier.wait(0).then(function(){if(e.type===ui){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===hi&&(n.nativeDialogsTracker.setHandler(e.dialogHandler),n._setNativeDialogHandlerInIframes(e.dialogHandler))})})},Ic.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t)},Ic.prototype._onReady=function(t){this.parentDriverLink.onCommandExecuted(t)},Ic.prototype.start=function(){var e=this;this.nativeDialogsTracker=new yc(this.dialogHandler),this.statusBar=new n.IframeStatusBar;var t=this.parentDriverLink.establishConnection().then(function(t){e.contextStorage=new po(Rc,t,e.windowId),e._failIfClientCodeExecutionIsInterrupted()||(e.contextStorage.getItem(e.COMMAND_EXECUTING_FLAG)||e.contextStorage.getItem(e.EXECUTING_IN_IFRAME_FLAG))&&(e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!1),e._onReady(new cr({isCommandResult:!0})))});this.readyPromise=l.Promise.all([this.readyPromise,t])},Ic);function Ic(t,e){var n=Ec.call(this,t,{},{},e)||this;return n.lastParentDriverMessageId=null,n.parentDriverLink=new pc(Rc.parent),n._initParentDriverListening(),n}var Tc={NodeSnapshot:Er,ElementSnapshot:Wr,SelectorExecutor:zo},xc="%testCafeDriver%",bc="%testCafeIframeDriver%",Wc="%ScriptExecutionBarrier%",Mc="%testCafeEmbeddingUtils%",Pc=o.nativeMethods,Ac=o.EVENTS.evalIframeScript;Pc.objectDefineProperty(Rc,xc,{configurable:!0,value:fc}),Pc.objectDefineProperty(Rc,bc,{configurable:!0,value:Sc}),Pc.objectDefineProperty(Rc,Wc,{configurable:!0,value:Io}),Pc.objectDefineProperty(Rc,Mc,{configurable:!0,value:Tc}),o.on(Ac,function(t){return Dc(Pc.contentWindowGetter.call(t.iframe))})}(Rc["%hammerhead%"],Rc["%hammerhead%"].Promise,Rc["%testCafeCore%"],Rc["%testCafeAutomation%"],Rc["%testCafeUI%"])}(window);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
4
|
-
testCafeDriver: '%testCafeDriver%',
|
|
5
|
-
testCafeIframeDriver: '%testCafeIframeDriver%',
|
|
6
|
-
scriptExecutionBarrier: '%ScriptExecutionBarrier%',
|
|
7
|
-
testCafeEmbeddingUtils: '%testCafeEmbeddingUtils%',
|
|
8
|
-
testCafeDriverInstance: '%testCafeDriverInstance%'
|
|
9
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
testCafeDriver: '%testCafeDriver%',
|
|
5
|
+
testCafeIframeDriver: '%testCafeIframeDriver%',
|
|
6
|
+
scriptExecutionBarrier: '%ScriptExecutionBarrier%',
|
|
7
|
+
testCafeEmbeddingUtils: '%testCafeEmbeddingUtils%',
|
|
8
|
+
testCafeDriverInstance: '%testCafeDriverInstance%'
|
|
9
|
+
};
|
|
10
10
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJuYWwtcHJvcGVydGllcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGllbnQvZHJpdmVyL2ludGVybmFsLXByb3BlcnRpZXMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxrQkFBZTtJQUNYLGNBQWMsRUFBVSxrQkFBa0I7SUFDMUMsb0JBQW9CLEVBQUksd0JBQXdCO0lBQ2hELHNCQUFzQixFQUFFLDBCQUEwQjtJQUNsRCxzQkFBc0IsRUFBRSwwQkFBMEI7SUFDbEQsc0JBQXNCLEVBQUUsMEJBQTBCO0NBQ3JELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCB7XG4gICAgdGVzdENhZmVEcml2ZXI6ICAgICAgICAgJyV0ZXN0Q2FmZURyaXZlciUnLFxuICAgIHRlc3RDYWZlSWZyYW1lRHJpdmVyOiAgICcldGVzdENhZmVJZnJhbWVEcml2ZXIlJyxcbiAgICBzY3JpcHRFeGVjdXRpb25CYXJyaWVyOiAnJVNjcmlwdEV4ZWN1dGlvbkJhcnJpZXIlJyxcbiAgICB0ZXN0Q2FmZUVtYmVkZGluZ1V0aWxzOiAnJXRlc3RDYWZlRW1iZWRkaW5nVXRpbHMlJyxcbiAgICB0ZXN0Q2FmZURyaXZlckluc3RhbmNlOiAnJXRlc3RDYWZlRHJpdmVySW5zdGFuY2UlJ1xufTtcbiJdfQ==
|