@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,85 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
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
|
-
__export(color_exports, {
|
|
31
|
-
colorForName: () => colorForName,
|
|
32
|
-
globalThemeConfig: () => globalThemeConfig,
|
|
33
|
-
highlightColorForType: () => highlightColorForType
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
colorForName: ()=>colorForName,
|
|
28
|
+
globalThemeConfig: ()=>globalThemeConfig,
|
|
29
|
+
highlightColorForType: ()=>highlightColorForType
|
|
34
30
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Buffer: import_buffer.default
|
|
41
|
-
};
|
|
42
|
-
const elementColor = ["#01204E"];
|
|
43
|
-
const highlightColorForSearchArea = "#028391";
|
|
44
|
-
const highlightColorForElement = "#fd5907";
|
|
31
|
+
const elementColor = [
|
|
32
|
+
'#01204E'
|
|
33
|
+
];
|
|
34
|
+
const highlightColorForSearchArea = '#028391';
|
|
35
|
+
const highlightColorForElement = '#fd5907';
|
|
45
36
|
function djb2Hash(str) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (let i = 0; i < str.length; i++) {
|
|
51
|
-
hash = (hash << 5) + hash + str.charCodeAt(i);
|
|
52
|
-
}
|
|
53
|
-
return hash >>> 0;
|
|
37
|
+
if (!str) str = 'unnamed';
|
|
38
|
+
let hash = 5381;
|
|
39
|
+
for(let i = 0; i < str.length; i++)hash = (hash << 5) + hash + str.charCodeAt(i);
|
|
40
|
+
return hash >>> 0;
|
|
54
41
|
}
|
|
55
42
|
function colorForName(name) {
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
const hashNumber = djb2Hash(name);
|
|
44
|
+
return elementColor[hashNumber % elementColor.length];
|
|
58
45
|
}
|
|
59
46
|
function highlightColorForType(type) {
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
return highlightColorForElement;
|
|
47
|
+
if ('searchArea' === type) return highlightColorForSearchArea;
|
|
48
|
+
return highlightColorForElement;
|
|
64
49
|
}
|
|
65
50
|
function globalThemeConfig() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
51
|
+
return {
|
|
52
|
+
token: {
|
|
53
|
+
colorPrimary: '#2B83FF'
|
|
54
|
+
},
|
|
55
|
+
components: {
|
|
56
|
+
Layout: {
|
|
57
|
+
headerHeight: 60,
|
|
58
|
+
headerPadding: '0 30px',
|
|
59
|
+
headerBg: '#FFF',
|
|
60
|
+
bodyBg: '#FFF'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
79
64
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
65
|
+
exports.colorForName = __webpack_exports__.colorForName;
|
|
66
|
+
exports.globalThemeConfig = __webpack_exports__.globalThemeConfig;
|
|
67
|
+
exports.highlightColorForType = __webpack_exports__.highlightColorForType;
|
|
68
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
69
|
+
"colorForName",
|
|
70
|
+
"globalThemeConfig",
|
|
71
|
+
"highlightColorForType"
|
|
72
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
73
|
+
Object.defineProperty(exports, '__esModule', {
|
|
74
|
+
value: true
|
|
85
75
|
});
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
.image-describer {
|
|
2
2
|
position: relative;
|
|
3
3
|
}
|
|
4
|
+
|
|
4
5
|
.image-describer .describe-text {
|
|
5
6
|
box-sizing: border-box;
|
|
6
|
-
|
|
7
|
+
color: #fff;
|
|
7
8
|
background: #000;
|
|
8
9
|
width: 100%;
|
|
9
10
|
height: 30px;
|
|
10
|
-
left: 0;
|
|
11
|
-
bottom: 0;
|
|
12
|
-
color: #FFF;
|
|
13
|
-
font-size: 12px;
|
|
14
11
|
padding: 10px;
|
|
12
|
+
font-size: 12px;
|
|
13
|
+
position: absolute;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
left: 0;
|
|
15
16
|
}
|
|
17
|
+
|
|
16
18
|
.image-describer .describe-text.success {
|
|
17
19
|
background: #047704;
|
|
18
20
|
}
|
|
21
|
+
|
|
19
22
|
.image-describer .describe-text.error {
|
|
20
23
|
background: #870707;
|
|
21
24
|
}
|
|
25
|
+
|
|
@@ -1,205 +1,165 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
-
var __spreadValues = (a, b) => {
|
|
15
|
-
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
if (__getOwnPropSymbols)
|
|
19
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
-
if (__propIsEnum.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
}
|
|
23
|
-
return a;
|
|
24
|
-
};
|
|
25
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
-
var __export = (target, all) => {
|
|
27
|
-
for (var name in all)
|
|
28
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
29
|
-
};
|
|
30
|
-
var __copyProps = (to, from, except, desc) => {
|
|
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 __async = (__this, __arguments, generator) => {
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
49
|
-
var fulfilled = (value) => {
|
|
50
|
-
try {
|
|
51
|
-
step(generator.next(value));
|
|
52
|
-
} catch (e) {
|
|
53
|
-
reject(e);
|
|
54
|
-
}
|
|
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
|
+
});
|
|
55
10
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
+
});
|
|
62
23
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Describer: () => Describer,
|
|
70
|
-
default: () => describer_default
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
Describer: ()=>Describer,
|
|
29
|
+
default: ()=>describer
|
|
71
30
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const useStaticPageAgent_js_namespaceObject = require("./playground/useStaticPageAgent.js");
|
|
34
|
+
require("./describer.css");
|
|
35
|
+
const external_react_resizable_panels_namespaceObject = require("react-resizable-panels");
|
|
36
|
+
const external_blackboard_js_namespaceObject = require("./blackboard.js");
|
|
37
|
+
const PlaygroundResult_js_namespaceObject = require("./playground/PlaygroundResult.js");
|
|
38
|
+
const Describer = (props)=>{
|
|
39
|
+
var _result_verifyResult;
|
|
40
|
+
const { uiContext } = props;
|
|
41
|
+
const image = uiContext.screenshotBase64;
|
|
42
|
+
const canvasRef = (0, external_react_namespaceObject.useRef)(null);
|
|
43
|
+
const [highlightPoints, setHighlightPoints] = (0, external_react_namespaceObject.useState)([]);
|
|
44
|
+
const [highlightRect, setHighlightRect] = (0, external_react_namespaceObject.useState)();
|
|
45
|
+
const [error, setError] = (0, external_react_namespaceObject.useState)();
|
|
46
|
+
const [loading, setLoading] = (0, external_react_namespaceObject.useState)(false);
|
|
47
|
+
const [result, setResult] = (0, external_react_namespaceObject.useState)();
|
|
48
|
+
const agent = (0, useStaticPageAgent_js_namespaceObject.useStaticPageAgent)(uiContext);
|
|
49
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
50
|
+
const canvas = canvasRef.current;
|
|
51
|
+
if (!canvas || !image) return;
|
|
52
|
+
const ctx = canvas.getContext('2d');
|
|
53
|
+
if (!ctx) return;
|
|
54
|
+
const img = new Image();
|
|
55
|
+
img.onload = ()=>{
|
|
56
|
+
canvas.width = img.width;
|
|
57
|
+
canvas.height = img.height;
|
|
58
|
+
ctx.drawImage(img, 0, 0);
|
|
59
|
+
};
|
|
60
|
+
img.src = image;
|
|
61
|
+
}, [
|
|
62
|
+
image
|
|
63
|
+
]);
|
|
64
|
+
const handleClick = async (position)=>{
|
|
65
|
+
if (!agent) return void console.error('agent is not initialized');
|
|
66
|
+
setLoading(true);
|
|
67
|
+
setError(void 0);
|
|
68
|
+
setResult(void 0);
|
|
69
|
+
setHighlightPoints([]);
|
|
70
|
+
setHighlightRect(void 0);
|
|
71
|
+
try {
|
|
72
|
+
var _result_verifyResult;
|
|
73
|
+
const userLocation = [
|
|
74
|
+
position[0],
|
|
75
|
+
position[1]
|
|
76
|
+
];
|
|
77
|
+
setHighlightPoints([
|
|
78
|
+
userLocation
|
|
79
|
+
]);
|
|
80
|
+
const result = await (null == agent ? void 0 : agent.describeElementAtPoint(userLocation));
|
|
81
|
+
console.log('describe result', result);
|
|
82
|
+
setResult(result);
|
|
83
|
+
if (null == (_result_verifyResult = result.verifyResult) ? void 0 : _result_verifyResult.rect) setHighlightRect(result.verifyResult.rect);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
setError(error.message);
|
|
86
|
+
} finally{
|
|
87
|
+
setLoading(false);
|
|
88
|
+
}
|
|
111
89
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
hideController: true
|
|
178
|
-
}
|
|
179
|
-
)
|
|
180
|
-
] })
|
|
181
|
-
}
|
|
182
|
-
),
|
|
183
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.PanelResizeHandle, { className: "panel-resize-handle" }),
|
|
184
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
185
|
-
import_PlaygroundResult.PlaygroundResultView,
|
|
186
|
-
{
|
|
187
|
-
result: {
|
|
188
|
-
result: resultText,
|
|
189
|
-
error: error || null
|
|
190
|
-
},
|
|
191
|
-
loading,
|
|
192
|
-
serverValid: true,
|
|
193
|
-
serviceMode: "In-Browser",
|
|
194
|
-
replayScriptsInfo: null,
|
|
195
|
-
replayCounter: 0,
|
|
196
|
-
loadingProgressText: ""
|
|
197
|
-
}
|
|
198
|
-
) })
|
|
199
|
-
] }) });
|
|
90
|
+
let resultText = '';
|
|
91
|
+
if (error) resultText = error;
|
|
92
|
+
else if (!result || (null == (_result_verifyResult = result.verifyResult) ? void 0 : _result_verifyResult.pass)) {
|
|
93
|
+
if (result) resultText = result.deepThink ? `Deep think: ${result.prompt}` : result.prompt;
|
|
94
|
+
else if (loading) resultText = 'Loading...';
|
|
95
|
+
} else resultText = `Locate failed with prompt: ${result.prompt}`;
|
|
96
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
97
|
+
className: "image-describer",
|
|
98
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_react_resizable_panels_namespaceObject.PanelGroup, {
|
|
99
|
+
autoSaveId: "describer-layout",
|
|
100
|
+
direction: "horizontal",
|
|
101
|
+
children: [
|
|
102
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_resizable_panels_namespaceObject.Panel, {
|
|
103
|
+
defaultSize: 32,
|
|
104
|
+
maxSize: 60,
|
|
105
|
+
minSize: 20,
|
|
106
|
+
style: {
|
|
107
|
+
paddingRight: '24px'
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
110
|
+
className: "form-part context-panel",
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h3", {
|
|
113
|
+
children: "Screenshot"
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
116
|
+
className: "form-sub-title",
|
|
117
|
+
children: "Click on the screenshot, Midscene will help you describe the element at the clicked point."
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_blackboard_js_namespaceObject.Blackboard, {
|
|
120
|
+
uiContext: {
|
|
121
|
+
...uiContext,
|
|
122
|
+
tree: {
|
|
123
|
+
node: null,
|
|
124
|
+
children: []
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
highlightPoints: highlightPoints,
|
|
128
|
+
highlightRect: highlightRect,
|
|
129
|
+
onCanvasClick: handleClick,
|
|
130
|
+
hideController: true
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_resizable_panels_namespaceObject.PanelResizeHandle, {
|
|
136
|
+
className: "panel-resize-handle"
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_resizable_panels_namespaceObject.Panel, {
|
|
139
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PlaygroundResult_js_namespaceObject.PlaygroundResultView, {
|
|
140
|
+
result: {
|
|
141
|
+
result: resultText,
|
|
142
|
+
error: error || null
|
|
143
|
+
},
|
|
144
|
+
loading: loading,
|
|
145
|
+
serverValid: true,
|
|
146
|
+
serviceMode: 'In-Browser',
|
|
147
|
+
replayScriptsInfo: null,
|
|
148
|
+
replayCounter: 0,
|
|
149
|
+
loadingProgressText: ''
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
})
|
|
154
|
+
});
|
|
200
155
|
};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
156
|
+
const describer = Describer;
|
|
157
|
+
exports.Describer = __webpack_exports__.Describer;
|
|
158
|
+
exports["default"] = __webpack_exports__["default"];
|
|
159
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
160
|
+
"Describer",
|
|
161
|
+
"default"
|
|
162
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
163
|
+
Object.defineProperty(exports, '__esModule', {
|
|
164
|
+
value: true
|
|
205
165
|
});
|