@midscene/visualizer 0.26.2 → 0.26.3-beta-20250813021342.0
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/dist/es/blank_polyfill.mjs +2 -0
- package/dist/es/component/blackboard.css +12 -5
- package/dist/es/component/blackboard.mjs +266 -0
- package/dist/es/component/color.mjs +35 -0
- package/dist/es/component/describer.css +9 -5
- package/dist/es/component/describer.mjs +128 -0
- package/dist/es/component/env-config.mjs +112 -0
- package/dist/es/component/github-star.css +1 -0
- package/dist/es/component/github-star.mjs +20 -0
- package/dist/es/component/logo.css +5 -3
- package/dist/es/component/logo.mjs +20 -0
- package/dist/es/component/misc.mjs +54 -0
- package/dist/es/component/pixi-loader.mjs +16 -0
- package/dist/es/component/player.css +88 -70
- package/dist/es/component/player.mjs +628 -0
- package/dist/es/component/playground/ConfigSelector.mjs +53 -0
- package/dist/es/component/playground/ContextPreview.mjs +39 -0
- package/dist/es/component/playground/HistorySelector.mjs +193 -0
- package/dist/es/component/playground/PlaygroundResult.mjs +60 -0
- package/dist/es/component/playground/PromptInput.mjs +225 -0
- package/dist/es/component/playground/ServiceModeControl.mjs +100 -0
- package/dist/es/component/playground/index.css +140 -98
- package/dist/es/component/playground/playground-constants.mjs +45 -0
- package/dist/es/component/playground/playground-utils.mjs +89 -0
- package/dist/es/component/playground/useServerValid.mjs +27 -0
- package/dist/es/component/playground/useStaticPageAgent.mjs +12 -0
- package/dist/es/component/replay-scripts.mjs +271 -0
- package/dist/es/component/shiny-text.css +33 -22
- package/dist/es/component/shiny-text.mjs +15 -0
- package/dist/es/component/store/history.mjs +55 -0
- package/dist/es/component/store/store.mjs +128 -0
- package/dist/es/icons/close.mjs +19 -0
- package/dist/es/icons/history.mjs +30 -0
- package/dist/es/icons/magnifying-glass.mjs +39 -0
- package/dist/es/icons/setting.mjs +20 -0
- package/dist/es/index.mjs +21 -0
- package/dist/es/init.mjs +10 -0
- package/dist/es/{utils.js → utils.mjs} +51 -75
- package/dist/lib/blank_polyfill.js +34 -38
- package/dist/lib/component/blackboard.css +12 -5
- package/dist/lib/component/blackboard.js +293 -306
- package/dist/lib/component/color.js +64 -74
- package/dist/lib/component/describer.css +9 -5
- package/dist/lib/component/describer.js +158 -198
- package/dist/lib/component/env-config.js +142 -147
- package/dist/lib/component/github-star.css +1 -0
- package/dist/lib/component/github-star.js +51 -62
- package/dist/lib/component/logo.css +5 -3
- package/dist/lib/component/logo.js +53 -56
- package/dist/lib/component/misc.js +85 -84
- package/dist/lib/component/pixi-loader.js +49 -80
- package/dist/lib/component/player.css +88 -70
- package/dist/lib/component/player.js +627 -738
- package/dist/lib/component/playground/ConfigSelector.js +91 -92
- package/dist/lib/component/playground/ContextPreview.js +80 -72
- package/dist/lib/component/playground/HistorySelector.js +234 -197
- package/dist/lib/component/playground/PlaygroundResult.js +100 -103
- package/dist/lib/component/playground/PromptInput.js +250 -237
- package/dist/lib/component/playground/ServiceModeControl.js +124 -124
- package/dist/lib/component/playground/index.css +140 -98
- package/dist/lib/component/playground/playground-constants.js +97 -73
- package/dist/lib/component/playground/playground-types.js +17 -31
- package/dist/lib/component/playground/playground-utils.js +140 -168
- package/dist/lib/component/playground/useServerValid.js +55 -86
- package/dist/lib/component/playground/useStaticPageAgent.js +45 -51
- package/dist/lib/component/replay-scripts.js +291 -373
- package/dist/lib/component/shiny-text.css +33 -22
- package/dist/lib/component/shiny-text.js +46 -57
- package/dist/lib/component/store/history.js +58 -64
- package/dist/lib/component/store/store.js +132 -128
- package/dist/lib/icons/close.js +53 -0
- package/dist/lib/icons/history.js +64 -0
- package/dist/lib/icons/magnifying-glass.js +73 -0
- package/dist/lib/icons/setting.js +54 -0
- package/dist/lib/index.js +158 -124
- package/dist/lib/init.js +39 -46
- package/dist/lib/utils.js +105 -109
- package/dist/types/blank_polyfill.d.ts +2 -2
- package/dist/types/component/playground/ConfigSelector.d.ts +1 -0
- package/dist/types/component/playground/ContextPreview.d.ts +1 -0
- package/dist/types/component/playground/HistorySelector.d.ts +1 -0
- package/dist/types/component/playground/PlaygroundResult.d.ts +1 -0
- package/dist/types/component/playground/PromptInput.d.ts +1 -0
- package/dist/types/component/playground/ServiceModeControl.d.ts +1 -0
- package/package.json +16 -18
- package/dist/es/assets/close.909351c0.svg +0 -4
- package/dist/es/assets/history.164a4eab.svg +0 -4
- package/dist/es/assets/magnifying-glass.9498e70e.svg +0 -12
- package/dist/es/assets/setting.80ab7285.svg +0 -11
- package/dist/es/blank_polyfill.js +0 -10
- package/dist/es/component/blackboard.js +0 -286
- package/dist/es/component/color.js +0 -49
- package/dist/es/component/describer.js +0 -173
- package/dist/es/component/env-config.js +0 -117
- package/dist/es/component/github-star.js +0 -31
- package/dist/es/component/logo.js +0 -25
- package/dist/es/component/misc.js +0 -63
- package/dist/es/component/pixi-loader.js +0 -51
- package/dist/es/component/player.js +0 -746
- package/dist/es/component/playground/ConfigSelector.js +0 -64
- package/dist/es/component/playground/ContextPreview.js +0 -42
- package/dist/es/component/playground/HistorySelector.js +0 -168
- package/dist/es/component/playground/PlaygroundResult.js +0 -73
- package/dist/es/component/playground/PromptInput.js +0 -212
- package/dist/es/component/playground/ServiceModeControl.js +0 -100
- package/dist/es/component/playground/playground-constants.js +0 -39
- package/dist/es/component/playground/playground-types.js +0 -6
- package/dist/es/component/playground/playground-utils.js +0 -141
- package/dist/es/component/playground/useServerValid.js +0 -58
- package/dist/es/component/playground/useStaticPageAgent.js +0 -20
- package/dist/es/component/replay-scripts.js +0 -361
- package/dist/es/component/shiny-text.js +0 -30
- package/dist/es/component/store/history.js +0 -34
- package/dist/es/component/store/store.js +0 -99
- package/dist/es/index.js +0 -79
- package/dist/es/init.js +0 -17
- package/dist/index.css +0 -595
- package/dist/index.js +0 -1
- package/dist/lib/assets/close.909351c0.svg +0 -4
- package/dist/lib/assets/history.164a4eab.svg +0 -4
- package/dist/lib/assets/magnifying-glass.9498e70e.svg +0 -12
- package/dist/lib/assets/setting.80ab7285.svg +0 -11
- package/dist/lib/component/common.css +0 -0
- /package/dist/es/component/{common.css → playground/playground-types.mjs} +0 -0
|
@@ -1,396 +1,314 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
32
|
-
for (let key of __getOwnPropNames(from))
|
|
33
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
34
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
35
|
-
}
|
|
36
|
-
return to;
|
|
37
|
-
};
|
|
38
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
39
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
40
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
41
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
42
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
43
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
44
|
-
mod
|
|
45
|
-
));
|
|
46
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
47
|
-
var replay_scripts_exports = {};
|
|
48
|
-
__export(replay_scripts_exports, {
|
|
49
|
-
allScriptsFromDump: () => allScriptsFromDump,
|
|
50
|
-
cameraStateForRect: () => cameraStateForRect,
|
|
51
|
-
generateAnimationScripts: () => generateAnimationScripts,
|
|
52
|
-
mergeTwoCameraState: () => mergeTwoCameraState
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
cameraStateForRect: ()=>cameraStateForRect,
|
|
29
|
+
mergeTwoCameraState: ()=>mergeTwoCameraState,
|
|
30
|
+
generateAnimationScripts: ()=>generateAnimationScripts,
|
|
31
|
+
allScriptsFromDump: ()=>allScriptsFromDump
|
|
53
32
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var buffer = {
|
|
59
|
-
Buffer: import_buffer.default
|
|
60
|
-
};
|
|
61
|
-
var import_player = require("./player.css");
|
|
62
|
-
var import_utils = require("../utils");
|
|
63
|
-
var import_ui_utils = require("@midscene/web/ui-utils");
|
|
64
|
-
var import_extractor = require("@midscene/shared/extractor");
|
|
33
|
+
require("./player.css");
|
|
34
|
+
const external_utils_js_namespaceObject = require("../utils.js");
|
|
35
|
+
const ui_utils_namespaceObject = require("@midscene/web/ui-utils");
|
|
36
|
+
const extractor_namespaceObject = require("@midscene/shared/extractor");
|
|
65
37
|
const stillDuration = 900;
|
|
66
38
|
const actionSpinningPointerDuration = 300;
|
|
67
39
|
const stillAfterInsightDuration = 300;
|
|
68
40
|
const locateDuration = 800;
|
|
69
|
-
const actionDuration =
|
|
41
|
+
const actionDuration = 1000;
|
|
70
42
|
const clearInsightDuration = 200;
|
|
71
|
-
const cameraStateForRect = (rect, imageWidth, imageHeight)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
imageWidth - cameraWidth
|
|
89
|
-
);
|
|
90
|
-
left = Math.max(left, 0);
|
|
91
|
-
let top = Math.min(
|
|
92
|
-
rect.top - imageHeight * cameraPaddingRatio,
|
|
93
|
-
imageHeight - cameraHeight
|
|
94
|
-
);
|
|
95
|
-
top = Math.max(top, 0);
|
|
96
|
-
return {
|
|
97
|
-
left: Math.round(left),
|
|
98
|
-
top: Math.round(top),
|
|
99
|
-
width: Math.round(cameraWidth)
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
const mergeTwoCameraState = (cameraState1, cameraState2) => {
|
|
103
|
-
const newLeft = Math.min(cameraState1.left, cameraState2.left);
|
|
104
|
-
const newTop = Math.min(cameraState1.top, cameraState2.top);
|
|
105
|
-
const newRight = Math.max(
|
|
106
|
-
cameraState1.left + cameraState1.width,
|
|
107
|
-
cameraState2.left + cameraState2.width
|
|
108
|
-
);
|
|
109
|
-
const newWidth = newRight - newLeft;
|
|
110
|
-
return {
|
|
111
|
-
left: newLeft,
|
|
112
|
-
top: newTop,
|
|
113
|
-
width: newWidth
|
|
114
|
-
};
|
|
43
|
+
const cameraStateForRect = (rect, imageWidth, imageHeight)=>{
|
|
44
|
+
const canvasRatio = imageWidth / imageHeight;
|
|
45
|
+
const rectRatio = rect.width / rect.height;
|
|
46
|
+
let rectWidthOnPage;
|
|
47
|
+
rectWidthOnPage = rectRatio >= canvasRatio ? rect.width : rect.height / imageHeight * imageWidth;
|
|
48
|
+
const cameraPaddingRatio = rectWidthOnPage > 400 ? 0.1 : rectWidthOnPage > 50 ? 0.2 : 0.3;
|
|
49
|
+
const cameraWidth = Math.min(imageWidth, rectWidthOnPage + imageWidth * cameraPaddingRatio * 2);
|
|
50
|
+
const cameraHeight = imageHeight / imageWidth * cameraWidth;
|
|
51
|
+
let left = Math.min(rect.left - imageWidth * cameraPaddingRatio, imageWidth - cameraWidth);
|
|
52
|
+
left = Math.max(left, 0);
|
|
53
|
+
let top = Math.min(rect.top - imageHeight * cameraPaddingRatio, imageHeight - cameraHeight);
|
|
54
|
+
top = Math.max(top, 0);
|
|
55
|
+
return {
|
|
56
|
+
left: Math.round(left),
|
|
57
|
+
top: Math.round(top),
|
|
58
|
+
width: Math.round(cameraWidth)
|
|
59
|
+
};
|
|
115
60
|
};
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
let modelDescription = void 0;
|
|
122
|
-
dump.executions.forEach((execution) => {
|
|
123
|
-
if (execution.sdkVersion) {
|
|
124
|
-
sdkVersion = execution.sdkVersion;
|
|
125
|
-
}
|
|
126
|
-
if (execution.model_name) {
|
|
127
|
-
modelName = execution.model_name;
|
|
128
|
-
}
|
|
129
|
-
if (execution.model_description) {
|
|
130
|
-
modelDescription = execution.model_description;
|
|
131
|
-
}
|
|
132
|
-
execution.tasks.forEach((task) => {
|
|
133
|
-
var _a, _b;
|
|
134
|
-
const insightTask = task;
|
|
135
|
-
if ((_b = (_a = insightTask.pageContext) == null ? void 0 : _a.size) == null ? void 0 : _b.width) {
|
|
136
|
-
width = insightTask.pageContext.size.width;
|
|
137
|
-
height = insightTask.pageContext.size.height;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
if (!width || !height) {
|
|
142
|
-
import_console_browserify.default.warn("width or height is missing in dump file");
|
|
61
|
+
const mergeTwoCameraState = (cameraState1, cameraState2)=>{
|
|
62
|
+
const newLeft = Math.min(cameraState1.left, cameraState2.left);
|
|
63
|
+
const newTop = Math.min(cameraState1.top, cameraState2.top);
|
|
64
|
+
const newRight = Math.max(cameraState1.left + cameraState1.width, cameraState2.left + cameraState2.width);
|
|
65
|
+
const newWidth = newRight - newLeft;
|
|
143
66
|
return {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
modelDescription
|
|
67
|
+
left: newLeft,
|
|
68
|
+
top: newTop,
|
|
69
|
+
width: newWidth
|
|
148
70
|
};
|
|
149
|
-
}
|
|
150
|
-
const allScripts = [];
|
|
151
|
-
dump.executions.forEach((execution) => {
|
|
152
|
-
const scripts = generateAnimationScripts(execution, -1, width, height);
|
|
153
|
-
if (scripts) {
|
|
154
|
-
allScripts.push(...scripts);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
const allScriptsWithoutIntermediateDoneFrame = allScripts.filter(
|
|
158
|
-
(script, index) => {
|
|
159
|
-
if (index !== allScripts.length - 1 && script.title === "Done") {
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
return {
|
|
166
|
-
scripts: allScriptsWithoutIntermediateDoneFrame,
|
|
167
|
-
width,
|
|
168
|
-
height,
|
|
169
|
-
sdkVersion,
|
|
170
|
-
modelName,
|
|
171
|
-
modelDescription
|
|
172
|
-
};
|
|
173
71
|
};
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
72
|
+
const allScriptsFromDump = (dump)=>{
|
|
73
|
+
let width;
|
|
74
|
+
let height;
|
|
75
|
+
let sdkVersion;
|
|
76
|
+
let modelName;
|
|
77
|
+
let modelDescription;
|
|
78
|
+
dump.executions.forEach((execution)=>{
|
|
79
|
+
if (execution.sdkVersion) sdkVersion = execution.sdkVersion;
|
|
80
|
+
if (execution.model_name) modelName = execution.model_name;
|
|
81
|
+
if (execution.model_description) modelDescription = execution.model_description;
|
|
82
|
+
execution.tasks.forEach((task)=>{
|
|
83
|
+
var _insightTask_pageContext_size, _insightTask_pageContext;
|
|
84
|
+
const insightTask = task;
|
|
85
|
+
if (null == (_insightTask_pageContext = insightTask.pageContext) ? void 0 : null == (_insightTask_pageContext_size = _insightTask_pageContext.size) ? void 0 : _insightTask_pageContext_size.width) {
|
|
86
|
+
width = insightTask.pageContext.size.width;
|
|
87
|
+
height = insightTask.pageContext.size.height;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
if (!width || !height) {
|
|
92
|
+
console.warn('width or height is missing in dump file');
|
|
93
|
+
return {
|
|
94
|
+
scripts: [],
|
|
95
|
+
sdkVersion,
|
|
96
|
+
modelName,
|
|
97
|
+
modelDescription
|
|
98
|
+
};
|
|
197
99
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
height: imageHeight
|
|
208
|
-
},
|
|
209
|
-
imageWidth,
|
|
210
|
-
imageHeight
|
|
211
|
-
);
|
|
212
|
-
const pointerScript = (img, title, subTitle) => {
|
|
100
|
+
const allScripts = [];
|
|
101
|
+
dump.executions.forEach((execution)=>{
|
|
102
|
+
const scripts = generateAnimationScripts(execution, -1, width, height);
|
|
103
|
+
if (scripts) allScripts.push(...scripts);
|
|
104
|
+
});
|
|
105
|
+
const allScriptsWithoutIntermediateDoneFrame = allScripts.filter((script, index)=>{
|
|
106
|
+
if (index !== allScripts.length - 1 && 'Done' === script.title) return false;
|
|
107
|
+
return true;
|
|
108
|
+
});
|
|
213
109
|
return {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
110
|
+
scripts: allScriptsWithoutIntermediateDoneFrame,
|
|
111
|
+
width,
|
|
112
|
+
height,
|
|
113
|
+
sdkVersion,
|
|
114
|
+
modelName,
|
|
115
|
+
modelDescription
|
|
219
116
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
117
|
+
};
|
|
118
|
+
const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
119
|
+
if (!execution || !execution.tasks.length) return null;
|
|
120
|
+
if (0 === imageWidth || 0 === imageHeight) return null;
|
|
121
|
+
let tasksIncluded = [];
|
|
122
|
+
if (-1 === task) tasksIncluded = execution.tasks;
|
|
123
|
+
else {
|
|
124
|
+
const startIndex = execution.tasks.findIndex((t)=>t === task);
|
|
125
|
+
if (-1 === startIndex) {
|
|
126
|
+
console.error("task not found, cannot generate animation scripts");
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
if (startIndex === execution.tasks.length - 1) return null;
|
|
130
|
+
for(let i = startIndex; i < execution.tasks.length; i++){
|
|
131
|
+
if (i > startIndex && 'Planning' === execution.tasks[i].type) break;
|
|
132
|
+
tasksIncluded.push(execution.tasks[i]);
|
|
133
|
+
}
|
|
234
134
|
}
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
} else if (task2.type === "Insight" && task2.subType === "Locate") {
|
|
248
|
-
const insightTask = task2;
|
|
249
|
-
const resultElement = (_c = insightTask.output) == null ? void 0 : _c.element;
|
|
250
|
-
const title = (0, import_ui_utils.typeStr)(task2);
|
|
251
|
-
const subTitle = (0, import_ui_utils.paramStr)(task2);
|
|
252
|
-
if (resultElement == null ? void 0 : resultElement.rect) {
|
|
253
|
-
insightCameraState = __spreadProps(__spreadValues({}, cameraStateForRect(resultElement.rect, imageWidth, imageHeight)), {
|
|
254
|
-
pointerLeft: resultElement.center[0],
|
|
255
|
-
pointerTop: resultElement.center[1]
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
const context = insightTask.pageContext;
|
|
259
|
-
if (context == null ? void 0 : context.screenshotBase64) {
|
|
260
|
-
const insightDump = (_d = insightTask.log) == null ? void 0 : _d.dump;
|
|
261
|
-
const insightContentLength = context.tree ? (0, import_extractor.treeToList)(context.tree).length : 0;
|
|
262
|
-
if (context.screenshotBase64) {
|
|
263
|
-
scripts.push({
|
|
264
|
-
type: "img",
|
|
265
|
-
img: context.screenshotBase64,
|
|
266
|
-
duration: stillAfterInsightDuration,
|
|
135
|
+
if (0 === tasksIncluded.length) return null;
|
|
136
|
+
const fullPageCameraState = cameraStateForRect({
|
|
137
|
+
left: 0,
|
|
138
|
+
top: 0,
|
|
139
|
+
width: imageWidth,
|
|
140
|
+
height: imageHeight
|
|
141
|
+
}, imageWidth, imageHeight);
|
|
142
|
+
const pointerScript = (img, title, subTitle)=>({
|
|
143
|
+
type: 'pointer',
|
|
144
|
+
img,
|
|
145
|
+
duration: 0,
|
|
267
146
|
title,
|
|
268
147
|
subTitle
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
148
|
+
});
|
|
149
|
+
const scripts = [];
|
|
150
|
+
let insightCameraState;
|
|
151
|
+
let currentCameraState = fullPageCameraState;
|
|
152
|
+
let insightOnTop = false;
|
|
153
|
+
const taskCount = tasksIncluded.length;
|
|
154
|
+
let initSubTitle = '';
|
|
155
|
+
let errorStateFlag = false;
|
|
156
|
+
tasksIncluded.forEach((task, index)=>{
|
|
157
|
+
if (errorStateFlag) return;
|
|
158
|
+
if (0 === index) initSubTitle = (0, ui_utils_namespaceObject.paramStr)(task);
|
|
159
|
+
if ('Planning' === task.type) {
|
|
160
|
+
const planningTask = task;
|
|
161
|
+
if (planningTask.recorder && planningTask.recorder.length > 0) {
|
|
162
|
+
var _planningTask_recorder_, _planningTask_recorder;
|
|
163
|
+
scripts.push({
|
|
164
|
+
type: 'img',
|
|
165
|
+
img: null == (_planningTask_recorder = planningTask.recorder) ? void 0 : null == (_planningTask_recorder_ = _planningTask_recorder[0]) ? void 0 : _planningTask_recorder_.screenshot,
|
|
166
|
+
camera: 0 === index ? fullPageCameraState : void 0,
|
|
167
|
+
duration: stillDuration,
|
|
168
|
+
title: (0, ui_utils_namespaceObject.typeStr)(task),
|
|
169
|
+
subTitle: (0, ui_utils_namespaceObject.paramStr)(task)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
} else if ('Insight' === task.type && 'Locate' === task.subType) {
|
|
173
|
+
var _insightTask_output;
|
|
174
|
+
const insightTask = task;
|
|
175
|
+
const resultElement = null == (_insightTask_output = insightTask.output) ? void 0 : _insightTask_output.element;
|
|
176
|
+
const title = (0, ui_utils_namespaceObject.typeStr)(task);
|
|
177
|
+
const subTitle = (0, ui_utils_namespaceObject.paramStr)(task);
|
|
178
|
+
if (null == resultElement ? void 0 : resultElement.rect) insightCameraState = {
|
|
179
|
+
...cameraStateForRect(resultElement.rect, imageWidth, imageHeight),
|
|
180
|
+
pointerLeft: resultElement.center[0],
|
|
181
|
+
pointerTop: resultElement.center[1]
|
|
182
|
+
};
|
|
183
|
+
const context = insightTask.pageContext;
|
|
184
|
+
if (null == context ? void 0 : context.screenshotBase64) {
|
|
185
|
+
var _insightTask_log, _insightTask_output1, _insightDump_taskInfo;
|
|
186
|
+
const insightDump = null == (_insightTask_log = insightTask.log) ? void 0 : _insightTask_log.dump;
|
|
187
|
+
const insightContentLength = context.tree ? (0, extractor_namespaceObject.treeToList)(context.tree).length : 0;
|
|
188
|
+
if (context.screenshotBase64) scripts.push({
|
|
189
|
+
type: 'img',
|
|
190
|
+
img: context.screenshotBase64,
|
|
191
|
+
duration: stillAfterInsightDuration,
|
|
192
|
+
title,
|
|
193
|
+
subTitle
|
|
194
|
+
});
|
|
195
|
+
let cameraState;
|
|
196
|
+
cameraState = currentCameraState === fullPageCameraState ? void 0 : insightCameraState ? mergeTwoCameraState(currentCameraState, insightCameraState) : void 0;
|
|
197
|
+
scripts.push({
|
|
198
|
+
type: 'insight',
|
|
199
|
+
img: context.screenshotBase64,
|
|
200
|
+
context: context,
|
|
201
|
+
camera: cameraState,
|
|
202
|
+
highlightElement: (null == (_insightTask_output1 = insightTask.output) ? void 0 : _insightTask_output1.element) || void 0,
|
|
203
|
+
searchArea: null == insightDump ? void 0 : null == (_insightDump_taskInfo = insightDump.taskInfo) ? void 0 : _insightDump_taskInfo.searchArea,
|
|
204
|
+
duration: insightContentLength > 20 ? locateDuration : 0.5 * locateDuration,
|
|
205
|
+
insightCameraDuration: locateDuration,
|
|
206
|
+
title,
|
|
207
|
+
subTitle
|
|
208
|
+
});
|
|
209
|
+
scripts.push({
|
|
210
|
+
type: 'sleep',
|
|
211
|
+
duration: stillAfterInsightDuration,
|
|
212
|
+
title,
|
|
213
|
+
subTitle
|
|
214
|
+
});
|
|
215
|
+
insightOnTop = true;
|
|
216
|
+
}
|
|
217
|
+
} else if ('Action' === task.type && 'FalsyConditionStatement' !== task.subType) {
|
|
218
|
+
var _task_recorder_, _task_recorder, _task_recorder_1, _task_recorder1;
|
|
219
|
+
const title = (0, ui_utils_namespaceObject.typeStr)(task);
|
|
220
|
+
const subTitle = (0, ui_utils_namespaceObject.paramStr)(task);
|
|
221
|
+
scripts.push(pointerScript(external_utils_js_namespaceObject.mousePointer, title, subTitle));
|
|
222
|
+
currentCameraState = null != insightCameraState ? insightCameraState : fullPageCameraState;
|
|
223
|
+
scripts.push({
|
|
224
|
+
type: 'img',
|
|
225
|
+
img: null == (_task_recorder = task.recorder) ? void 0 : null == (_task_recorder_ = _task_recorder[0]) ? void 0 : _task_recorder_.screenshot,
|
|
226
|
+
duration: actionDuration,
|
|
227
|
+
camera: 'Sleep' === task.subType ? fullPageCameraState : insightCameraState,
|
|
228
|
+
title,
|
|
229
|
+
subTitle
|
|
230
|
+
});
|
|
231
|
+
if (insightOnTop) {
|
|
232
|
+
scripts.push({
|
|
233
|
+
type: 'clear-insight',
|
|
234
|
+
duration: clearInsightDuration,
|
|
235
|
+
title,
|
|
236
|
+
subTitle
|
|
237
|
+
});
|
|
238
|
+
insightOnTop = false;
|
|
239
|
+
}
|
|
240
|
+
const imgStillDuration = index < taskCount - 1 ? stillDuration : 0;
|
|
241
|
+
if (null == (_task_recorder1 = task.recorder) ? void 0 : null == (_task_recorder_1 = _task_recorder1[1]) ? void 0 : _task_recorder_1.screenshot) {
|
|
242
|
+
var _task_recorder_2, _task_recorder2;
|
|
243
|
+
scripts.push({
|
|
244
|
+
type: 'spinning-pointer',
|
|
245
|
+
duration: actionSpinningPointerDuration,
|
|
246
|
+
title,
|
|
247
|
+
subTitle
|
|
248
|
+
});
|
|
249
|
+
scripts.push(pointerScript(external_utils_js_namespaceObject.mousePointer, title, subTitle));
|
|
250
|
+
scripts.push({
|
|
251
|
+
type: 'img',
|
|
252
|
+
img: null == (_task_recorder2 = task.recorder) ? void 0 : null == (_task_recorder_2 = _task_recorder2[1]) ? void 0 : _task_recorder_2.screenshot,
|
|
253
|
+
duration: imgStillDuration,
|
|
254
|
+
title,
|
|
255
|
+
subTitle
|
|
256
|
+
});
|
|
257
|
+
} else scripts.push({
|
|
258
|
+
type: 'sleep',
|
|
259
|
+
duration: imgStillDuration,
|
|
260
|
+
title,
|
|
261
|
+
subTitle
|
|
262
|
+
});
|
|
276
263
|
} else {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
264
|
+
var _task_recorder_3, _task_recorder3;
|
|
265
|
+
const title = (0, ui_utils_namespaceObject.typeStr)(task);
|
|
266
|
+
const subTitle = (0, ui_utils_namespaceObject.paramStr)(task);
|
|
267
|
+
const screenshot = null == (_task_recorder3 = task.recorder) ? void 0 : null == (_task_recorder_3 = _task_recorder3[task.recorder.length - 1]) ? void 0 : _task_recorder_3.screenshot;
|
|
268
|
+
if (screenshot) scripts.push({
|
|
269
|
+
type: 'img',
|
|
270
|
+
img: screenshot,
|
|
271
|
+
duration: stillDuration,
|
|
272
|
+
camera: fullPageCameraState,
|
|
273
|
+
title,
|
|
274
|
+
subTitle
|
|
275
|
+
});
|
|
281
276
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
} else if (task2.type === "Action" && task2.subType !== "FalsyConditionStatement") {
|
|
303
|
-
const title = (0, import_ui_utils.typeStr)(task2);
|
|
304
|
-
const subTitle = (0, import_ui_utils.paramStr)(task2);
|
|
305
|
-
scripts.push(pointerScript(import_utils.mousePointer, title, subTitle));
|
|
306
|
-
currentCameraState = insightCameraState != null ? insightCameraState : fullPageCameraState;
|
|
307
|
-
scripts.push({
|
|
308
|
-
type: "img",
|
|
309
|
-
img: (_h = (_g = task2.recorder) == null ? void 0 : _g[0]) == null ? void 0 : _h.screenshot,
|
|
310
|
-
duration: actionDuration,
|
|
311
|
-
camera: task2.subType === "Sleep" ? fullPageCameraState : insightCameraState,
|
|
312
|
-
title,
|
|
313
|
-
subTitle
|
|
314
|
-
});
|
|
315
|
-
if (insightOnTop) {
|
|
316
|
-
scripts.push({
|
|
317
|
-
type: "clear-insight",
|
|
318
|
-
duration: clearInsightDuration,
|
|
319
|
-
title,
|
|
320
|
-
subTitle
|
|
321
|
-
});
|
|
322
|
-
insightOnTop = false;
|
|
323
|
-
}
|
|
324
|
-
const imgStillDuration = index < taskCount - 1 ? stillDuration : 0;
|
|
325
|
-
if ((_j = (_i = task2.recorder) == null ? void 0 : _i[1]) == null ? void 0 : _j.screenshot) {
|
|
326
|
-
scripts.push({
|
|
327
|
-
type: "spinning-pointer",
|
|
328
|
-
duration: actionSpinningPointerDuration,
|
|
329
|
-
title,
|
|
330
|
-
subTitle
|
|
331
|
-
});
|
|
332
|
-
scripts.push(pointerScript(import_utils.mousePointer, title, subTitle));
|
|
333
|
-
scripts.push({
|
|
334
|
-
type: "img",
|
|
335
|
-
img: (_l = (_k = task2.recorder) == null ? void 0 : _k[1]) == null ? void 0 : _l.screenshot,
|
|
336
|
-
duration: imgStillDuration,
|
|
337
|
-
title,
|
|
338
|
-
subTitle
|
|
339
|
-
});
|
|
340
|
-
} else {
|
|
341
|
-
scripts.push({
|
|
342
|
-
type: "sleep",
|
|
343
|
-
duration: imgStillDuration,
|
|
344
|
-
title,
|
|
345
|
-
subTitle
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
} else {
|
|
349
|
-
const title = (0, import_ui_utils.typeStr)(task2);
|
|
350
|
-
const subTitle = (0, import_ui_utils.paramStr)(task2);
|
|
351
|
-
const screenshot = (_n = (_m = task2.recorder) == null ? void 0 : _m[task2.recorder.length - 1]) == null ? void 0 : _n.screenshot;
|
|
352
|
-
if (screenshot) {
|
|
353
|
-
scripts.push({
|
|
354
|
-
type: "img",
|
|
355
|
-
img: screenshot,
|
|
356
|
-
duration: stillDuration,
|
|
357
|
-
camera: fullPageCameraState,
|
|
358
|
-
title,
|
|
359
|
-
subTitle
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
if (task2.status !== "finished") {
|
|
364
|
-
errorStateFlag = true;
|
|
365
|
-
const errorTitle = (0, import_ui_utils.typeStr)(task2);
|
|
366
|
-
const errorMsg = task2.errorMessage || "unknown error";
|
|
367
|
-
const errorSubTitle = errorMsg.indexOf("NOT_IMPLEMENTED_AS_DESIGNED") > 0 ? "Further actions cannot be performed in the current environment" : errorMsg;
|
|
368
|
-
scripts.push({
|
|
369
|
-
type: "img",
|
|
370
|
-
img: task2.recorder && task2.recorder.length > 0 ? task2.recorder[task2.recorder.length - 1].screenshot : "",
|
|
371
|
-
camera: fullPageCameraState,
|
|
277
|
+
if ('finished' !== task.status) {
|
|
278
|
+
errorStateFlag = true;
|
|
279
|
+
const errorTitle = (0, ui_utils_namespaceObject.typeStr)(task);
|
|
280
|
+
const errorMsg = task.errorMessage || 'unknown error';
|
|
281
|
+
const errorSubTitle = errorMsg.indexOf('NOT_IMPLEMENTED_AS_DESIGNED') > 0 ? 'Further actions cannot be performed in the current environment' : errorMsg;
|
|
282
|
+
scripts.push({
|
|
283
|
+
type: 'img',
|
|
284
|
+
img: task.recorder && task.recorder.length > 0 ? task.recorder[task.recorder.length - 1].screenshot : '',
|
|
285
|
+
camera: fullPageCameraState,
|
|
286
|
+
duration: stillDuration,
|
|
287
|
+
title: errorTitle,
|
|
288
|
+
subTitle: errorSubTitle
|
|
289
|
+
});
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
if (!errorStateFlag) scripts.push({
|
|
294
|
+
title: 'Done',
|
|
295
|
+
subTitle: initSubTitle,
|
|
296
|
+
type: 'img',
|
|
372
297
|
duration: stillDuration,
|
|
373
|
-
|
|
374
|
-
subTitle: errorSubTitle
|
|
375
|
-
});
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
if (!errorStateFlag) {
|
|
380
|
-
scripts.push({
|
|
381
|
-
title: "Done",
|
|
382
|
-
subTitle: initSubTitle,
|
|
383
|
-
type: "img",
|
|
384
|
-
duration: stillDuration,
|
|
385
|
-
camera: fullPageCameraState
|
|
298
|
+
camera: fullPageCameraState
|
|
386
299
|
});
|
|
387
|
-
|
|
388
|
-
return scripts;
|
|
300
|
+
return scripts;
|
|
389
301
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
302
|
+
exports.allScriptsFromDump = __webpack_exports__.allScriptsFromDump;
|
|
303
|
+
exports.cameraStateForRect = __webpack_exports__.cameraStateForRect;
|
|
304
|
+
exports.generateAnimationScripts = __webpack_exports__.generateAnimationScripts;
|
|
305
|
+
exports.mergeTwoCameraState = __webpack_exports__.mergeTwoCameraState;
|
|
306
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
307
|
+
"allScriptsFromDump",
|
|
308
|
+
"cameraStateForRect",
|
|
309
|
+
"generateAnimationScripts",
|
|
310
|
+
"mergeTwoCameraState"
|
|
311
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
312
|
+
Object.defineProperty(exports, '__esModule', {
|
|
313
|
+
value: true
|
|
396
314
|
});
|