@sqaitech/visualizer 0.5.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.
Files changed (152) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/dist/es/assets/sqai-logo.mjs +2 -0
  4. package/dist/es/component/blackboard/index.css +33 -0
  5. package/dist/es/component/blackboard/index.mjs +278 -0
  6. package/dist/es/component/config-selector/index.mjs +104 -0
  7. package/dist/es/component/context-preview/index.mjs +38 -0
  8. package/dist/es/component/env-config/index.mjs +112 -0
  9. package/dist/es/component/env-config-reminder/index.css +22 -0
  10. package/dist/es/component/env-config-reminder/index.mjs +28 -0
  11. package/dist/es/component/form-field/index.mjs +163 -0
  12. package/dist/es/component/history-selector/index.css +135 -0
  13. package/dist/es/component/history-selector/index.mjs +170 -0
  14. package/dist/es/component/index.mjs +1 -0
  15. package/dist/es/component/logo/index.css +13 -0
  16. package/dist/es/component/logo/index.mjs +21 -0
  17. package/dist/es/component/misc/index.mjs +94 -0
  18. package/dist/es/component/nav-actions/index.mjs +32 -0
  19. package/dist/es/component/nav-actions/style.css +35 -0
  20. package/dist/es/component/player/index.css +185 -0
  21. package/dist/es/component/player/index.mjs +856 -0
  22. package/dist/es/component/playground/index.css +431 -0
  23. package/dist/es/component/playground/index.mjs +8 -0
  24. package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
  25. package/dist/es/component/playground-result/index.css +34 -0
  26. package/dist/es/component/playground-result/index.mjs +62 -0
  27. package/dist/es/component/prompt-input/index.css +391 -0
  28. package/dist/es/component/prompt-input/index.mjs +730 -0
  29. package/dist/es/component/service-mode-control/index.mjs +105 -0
  30. package/dist/es/component/shiny-text/index.css +75 -0
  31. package/dist/es/component/shiny-text/index.mjs +15 -0
  32. package/dist/es/component/universal-playground/index.css +341 -0
  33. package/dist/es/component/universal-playground/index.mjs +302 -0
  34. package/dist/es/component/universal-playground/providers/context-provider.mjs +52 -0
  35. package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +207 -0
  36. package/dist/es/component/universal-playground/providers/storage-provider.mjs +210 -0
  37. package/dist/es/hooks/usePlaygroundExecution.mjs +180 -0
  38. package/dist/es/hooks/usePlaygroundState.mjs +203 -0
  39. package/dist/es/hooks/useSafeOverrideAIConfig.mjs +24 -0
  40. package/dist/es/hooks/useServerValid.mjs +30 -0
  41. package/dist/es/icons/avatar.mjs +28 -0
  42. package/dist/es/icons/close.mjs +19 -0
  43. package/dist/es/icons/global-perspective.mjs +16 -0
  44. package/dist/es/icons/history.mjs +30 -0
  45. package/dist/es/icons/magnifying-glass.mjs +39 -0
  46. package/dist/es/icons/player-setting.mjs +26 -0
  47. package/dist/es/icons/setting.mjs +20 -0
  48. package/dist/es/icons/show-marker.mjs +16 -0
  49. package/dist/es/index.mjs +25 -0
  50. package/dist/es/static/image/sqai-logo.png +0 -0
  51. package/dist/es/store/history.mjs +89 -0
  52. package/dist/es/store/store.mjs +186 -0
  53. package/dist/es/types.mjs +70 -0
  54. package/dist/es/utils/color.mjs +35 -0
  55. package/dist/es/utils/constants.mjs +99 -0
  56. package/dist/es/utils/index.mjs +10 -0
  57. package/dist/es/utils/pixi-loader.mjs +16 -0
  58. package/dist/es/utils/playground-utils.mjs +67 -0
  59. package/dist/es/utils/replay-scripts.mjs +312 -0
  60. package/dist/lib/assets/sqai-logo.js +24 -0
  61. package/dist/lib/component/blackboard/index.css +33 -0
  62. package/dist/lib/component/blackboard/index.js +321 -0
  63. package/dist/lib/component/config-selector/index.js +148 -0
  64. package/dist/lib/component/context-preview/index.js +83 -0
  65. package/dist/lib/component/env-config/index.js +146 -0
  66. package/dist/lib/component/env-config-reminder/index.css +22 -0
  67. package/dist/lib/component/env-config-reminder/index.js +62 -0
  68. package/dist/lib/component/form-field/index.js +209 -0
  69. package/dist/lib/component/history-selector/index.css +135 -0
  70. package/dist/lib/component/history-selector/index.js +216 -0
  71. package/dist/lib/component/index.js +60 -0
  72. package/dist/lib/component/logo/index.css +13 -0
  73. package/dist/lib/component/logo/index.js +68 -0
  74. package/dist/lib/component/misc/index.js +150 -0
  75. package/dist/lib/component/nav-actions/index.js +66 -0
  76. package/dist/lib/component/nav-actions/style.css +35 -0
  77. package/dist/lib/component/player/index.css +185 -0
  78. package/dist/lib/component/player/index.js +902 -0
  79. package/dist/lib/component/playground/index.css +431 -0
  80. package/dist/lib/component/playground/index.js +113 -0
  81. package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
  82. package/dist/lib/component/playground-result/index.css +34 -0
  83. package/dist/lib/component/playground-result/index.js +106 -0
  84. package/dist/lib/component/prompt-input/index.css +391 -0
  85. package/dist/lib/component/prompt-input/index.js +774 -0
  86. package/dist/lib/component/service-mode-control/index.js +139 -0
  87. package/dist/lib/component/shiny-text/index.css +75 -0
  88. package/dist/lib/component/shiny-text/index.js +49 -0
  89. package/dist/lib/component/universal-playground/index.css +341 -0
  90. package/dist/lib/component/universal-playground/index.js +350 -0
  91. package/dist/lib/component/universal-playground/providers/context-provider.js +95 -0
  92. package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +247 -0
  93. package/dist/lib/component/universal-playground/providers/storage-provider.js +268 -0
  94. package/dist/lib/hooks/usePlaygroundExecution.js +214 -0
  95. package/dist/lib/hooks/usePlaygroundState.js +237 -0
  96. package/dist/lib/hooks/useSafeOverrideAIConfig.js +61 -0
  97. package/dist/lib/hooks/useServerValid.js +64 -0
  98. package/dist/lib/icons/avatar.js +62 -0
  99. package/dist/lib/icons/close.js +53 -0
  100. package/dist/lib/icons/global-perspective.js +50 -0
  101. package/dist/lib/icons/history.js +64 -0
  102. package/dist/lib/icons/magnifying-glass.js +73 -0
  103. package/dist/lib/icons/player-setting.js +60 -0
  104. package/dist/lib/icons/setting.js +54 -0
  105. package/dist/lib/icons/show-marker.js +50 -0
  106. package/dist/lib/index.js +187 -0
  107. package/dist/lib/static/image/sqai-logo.png +0 -0
  108. package/dist/lib/store/history.js +96 -0
  109. package/dist/lib/store/store.js +196 -0
  110. package/dist/lib/types.js +116 -0
  111. package/dist/lib/utils/color.js +75 -0
  112. package/dist/lib/utils/constants.js +154 -0
  113. package/dist/lib/utils/index.js +63 -0
  114. package/dist/lib/utils/pixi-loader.js +56 -0
  115. package/dist/lib/utils/playground-utils.js +110 -0
  116. package/dist/lib/utils/replay-scripts.js +355 -0
  117. package/dist/types/component/blackboard/index.d.ts +15 -0
  118. package/dist/types/component/config-selector/index.d.ts +9 -0
  119. package/dist/types/component/context-preview/index.d.ts +9 -0
  120. package/dist/types/component/env-config/index.d.ts +6 -0
  121. package/dist/types/component/env-config-reminder/index.d.ts +6 -0
  122. package/dist/types/component/form-field/index.d.ts +17 -0
  123. package/dist/types/component/history-selector/index.d.ts +10 -0
  124. package/dist/types/component/index.d.ts +1 -0
  125. package/dist/types/component/logo/index.d.ts +5 -0
  126. package/dist/types/component/misc/index.d.ts +6 -0
  127. package/dist/types/component/nav-actions/index.d.ts +10 -0
  128. package/dist/types/component/player/index.d.ts +13 -0
  129. package/dist/types/component/playground/index.d.ts +7 -0
  130. package/dist/types/component/playground-result/index.d.ts +20 -0
  131. package/dist/types/component/prompt-input/index.d.ts +22 -0
  132. package/dist/types/component/service-mode-control/index.d.ts +6 -0
  133. package/dist/types/component/shiny-text/index.d.ts +12 -0
  134. package/dist/types/component/universal-playground/index.d.ts +4 -0
  135. package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
  136. package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
  137. package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
  138. package/dist/types/hooks/usePlaygroundExecution.d.ts +10 -0
  139. package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
  140. package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
  141. package/dist/types/hooks/useServerValid.d.ts +1 -0
  142. package/dist/types/index.d.ts +27 -0
  143. package/dist/types/store/history.d.ts +16 -0
  144. package/dist/types/store/store.d.ts +36 -0
  145. package/dist/types/types.d.ts +161 -0
  146. package/dist/types/utils/color.d.ts +4 -0
  147. package/dist/types/utils/constants.d.ts +74 -0
  148. package/dist/types/utils/index.d.ts +4 -0
  149. package/dist/types/utils/pixi-loader.d.ts +5 -0
  150. package/dist/types/utils/playground-utils.d.ts +6 -0
  151. package/dist/types/utils/replay-scripts.d.ts +34 -0
  152. package/package.json +85 -0
@@ -0,0 +1,96 @@
1
+ "use strict";
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
+ useHistoryStore: ()=>useHistoryStore
28
+ });
29
+ const external_zustand_namespaceObject = require("zustand");
30
+ const { create } = external_zustand_namespaceObject;
31
+ const HISTORY_KEY = 'sqai-prompt-history-v2';
32
+ const LAST_SELECTED_TYPE_KEY = 'sqai-last-selected-type';
33
+ const getHistoryFromLocalStorage = ()=>{
34
+ const historyString = localStorage.getItem(HISTORY_KEY);
35
+ return historyString ? JSON.parse(historyString) : {};
36
+ };
37
+ const getLastSelectedType = ()=>localStorage.getItem(LAST_SELECTED_TYPE_KEY) || 'aiAction';
38
+ const setLastSelectedType = (type)=>{
39
+ localStorage.setItem(LAST_SELECTED_TYPE_KEY, type);
40
+ };
41
+ const useHistoryStore = create((set, get)=>({
42
+ history: getHistoryFromLocalStorage(),
43
+ lastSelectedType: getLastSelectedType(),
44
+ clearHistory: (type)=>{
45
+ const newHistory = {
46
+ ...get().history
47
+ };
48
+ delete newHistory[type];
49
+ set({
50
+ history: newHistory
51
+ });
52
+ localStorage.setItem(HISTORY_KEY, JSON.stringify(newHistory));
53
+ },
54
+ addHistory: (historyItem)=>{
55
+ const { type } = historyItem;
56
+ const currentHistory = get().history;
57
+ const typeHistory = currentHistory[type] || [];
58
+ const stringifiedNewItem = JSON.stringify({
59
+ prompt: historyItem.prompt,
60
+ params: historyItem.params
61
+ });
62
+ const newTypeHistory = [
63
+ historyItem,
64
+ ...typeHistory.filter((h)=>{
65
+ const stringifiedOldItem = JSON.stringify({
66
+ prompt: h.prompt,
67
+ params: h.params
68
+ });
69
+ return stringifiedOldItem !== stringifiedNewItem;
70
+ })
71
+ ];
72
+ if (newTypeHistory.length > 10) newTypeHistory.length = 10;
73
+ const newHistory = {
74
+ ...currentHistory,
75
+ [type]: newTypeHistory
76
+ };
77
+ set({
78
+ history: newHistory
79
+ });
80
+ localStorage.setItem(HISTORY_KEY, JSON.stringify(newHistory));
81
+ },
82
+ getHistoryForType: (type)=>get().history[type] || [],
83
+ setLastSelectedType: (type)=>{
84
+ set({
85
+ lastSelectedType: type
86
+ });
87
+ setLastSelectedType(type);
88
+ }
89
+ }));
90
+ exports.useHistoryStore = __webpack_exports__.useHistoryStore;
91
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
92
+ "useHistoryStore"
93
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
94
+ Object.defineProperty(exports, '__esModule', {
95
+ value: true
96
+ });
@@ -0,0 +1,196 @@
1
+ "use strict";
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
+ useBlackboardPreference: ()=>useBlackboardPreference,
28
+ useEnvConfig: ()=>useEnvConfig
29
+ });
30
+ const external_zustand_namespaceObject = require("zustand");
31
+ const { create } = external_zustand_namespaceObject;
32
+ const AUTO_ZOOM_KEY = 'sqai-auto-zoom';
33
+ const BACKGROUND_VISIBLE_KEY = 'sqai-background-visible';
34
+ const ELEMENTS_VISIBLE_KEY = 'sqai-elements-visible';
35
+ const parseBooleanParam = (value)=>{
36
+ if (null === value) return;
37
+ const normalized = value.trim().toLowerCase();
38
+ if ([
39
+ '1',
40
+ 'true',
41
+ 'yes',
42
+ 'on'
43
+ ].includes(normalized)) return true;
44
+ if ([
45
+ '0',
46
+ 'false',
47
+ 'no',
48
+ 'off'
49
+ ].includes(normalized)) return false;
50
+ };
51
+ const getQueryPreference = (paramName)=>{
52
+ if ('undefined' == typeof window) return;
53
+ const searchParams = new URLSearchParams(window.location.search);
54
+ return parseBooleanParam(searchParams.get(paramName));
55
+ };
56
+ const useBlackboardPreference = create((set)=>{
57
+ const savedAutoZoom = 'false' !== localStorage.getItem(AUTO_ZOOM_KEY);
58
+ const savedBackgroundVisible = 'false' !== localStorage.getItem(BACKGROUND_VISIBLE_KEY);
59
+ const savedElementsVisible = 'false' !== localStorage.getItem(ELEMENTS_VISIBLE_KEY);
60
+ const autoZoomFromQuery = getQueryPreference('focusOnCursor');
61
+ const elementsVisibleFromQuery = getQueryPreference('showElementMarkers');
62
+ return {
63
+ backgroundVisible: savedBackgroundVisible,
64
+ elementsVisible: void 0 === elementsVisibleFromQuery ? savedElementsVisible : elementsVisibleFromQuery,
65
+ autoZoom: void 0 === autoZoomFromQuery ? savedAutoZoom : autoZoomFromQuery,
66
+ setBackgroundVisible: (visible)=>{
67
+ set({
68
+ backgroundVisible: visible
69
+ });
70
+ localStorage.setItem(BACKGROUND_VISIBLE_KEY, visible.toString());
71
+ },
72
+ setElementsVisible: (visible)=>{
73
+ set({
74
+ elementsVisible: visible
75
+ });
76
+ localStorage.setItem(ELEMENTS_VISIBLE_KEY, visible.toString());
77
+ },
78
+ setAutoZoom: (enabled)=>{
79
+ set({
80
+ autoZoom: enabled
81
+ });
82
+ localStorage.setItem(AUTO_ZOOM_KEY, enabled.toString());
83
+ }
84
+ };
85
+ });
86
+ const CONFIG_KEY = 'sqai-env-config';
87
+ const SERVICE_MODE_KEY = 'sqai-service-mode';
88
+ const TRACKING_ACTIVE_TAB_KEY = 'sqai-tracking-active-tab';
89
+ const DEEP_THINK_KEY = 'sqai-deep-think';
90
+ const SCREENSHOT_INCLUDED_KEY = 'sqai-screenshot-included';
91
+ const DOM_INCLUDED_KEY = 'sqai-dom-included';
92
+ const getConfigStringFromLocalStorage = ()=>{
93
+ const configString = localStorage.getItem(CONFIG_KEY);
94
+ return configString || '';
95
+ };
96
+ const parseConfig = (configString)=>{
97
+ const lines = configString.split('\n');
98
+ const config = {};
99
+ lines.forEach((line)=>{
100
+ const trimmed = line.trim();
101
+ if (trimmed.startsWith('#')) return;
102
+ const cleanLine = trimmed.replace(/^export\s+/i, '').replace(/;$/, '').trim();
103
+ const match = cleanLine.match(/^(\w+)=(.*)$/);
104
+ if (match) {
105
+ const [, key, value] = match;
106
+ let parsedValue = value.trim();
107
+ if (parsedValue.startsWith("'") && parsedValue.endsWith("'") || parsedValue.startsWith('"') && parsedValue.endsWith('"')) parsedValue = parsedValue.slice(1, -1);
108
+ config[key] = parsedValue;
109
+ }
110
+ });
111
+ return config;
112
+ };
113
+ const useEnvConfig = create((set, get)=>{
114
+ const configString = getConfigStringFromLocalStorage();
115
+ const config = parseConfig(configString);
116
+ const ifInExtension = window.location.href.startsWith('chrome-extension');
117
+ const savedServiceMode = localStorage.getItem(SERVICE_MODE_KEY);
118
+ const savedForceSameTabNavigation = 'false' !== localStorage.getItem(TRACKING_ACTIVE_TAB_KEY);
119
+ const savedDeepThink = 'true' === localStorage.getItem(DEEP_THINK_KEY);
120
+ const savedScreenshotIncluded = 'false' !== localStorage.getItem(SCREENSHOT_INCLUDED_KEY);
121
+ const savedDomIncluded = localStorage.getItem(DOM_INCLUDED_KEY) || 'false';
122
+ return {
123
+ serviceMode: ifInExtension ? 'In-Browser-Extension' : savedServiceMode || 'Server',
124
+ setServiceMode: (serviceMode)=>{
125
+ if (ifInExtension) throw new Error('serviceMode cannot be set in extension');
126
+ set({
127
+ serviceMode
128
+ });
129
+ localStorage.setItem(SERVICE_MODE_KEY, serviceMode);
130
+ },
131
+ config,
132
+ configString,
133
+ setConfig: (config)=>set({
134
+ config
135
+ }),
136
+ loadConfig: (configString)=>{
137
+ const config = parseConfig(configString);
138
+ set({
139
+ config,
140
+ configString
141
+ });
142
+ localStorage.setItem(CONFIG_KEY, configString);
143
+ },
144
+ syncFromStorage: ()=>{
145
+ const latestConfigString = getConfigStringFromLocalStorage();
146
+ const latestConfig = parseConfig(latestConfigString);
147
+ set({
148
+ config: latestConfig,
149
+ configString: latestConfigString
150
+ });
151
+ },
152
+ forceSameTabNavigation: savedForceSameTabNavigation,
153
+ setForceSameTabNavigation: (forceSameTabNavigation)=>{
154
+ set({
155
+ forceSameTabNavigation
156
+ });
157
+ localStorage.setItem(TRACKING_ACTIVE_TAB_KEY, forceSameTabNavigation.toString());
158
+ },
159
+ deepThink: savedDeepThink,
160
+ setDeepThink: (deepThink)=>{
161
+ set({
162
+ deepThink
163
+ });
164
+ localStorage.setItem(DEEP_THINK_KEY, deepThink.toString());
165
+ },
166
+ screenshotIncluded: savedScreenshotIncluded,
167
+ setScreenshotIncluded: (screenshotIncluded)=>{
168
+ set({
169
+ screenshotIncluded
170
+ });
171
+ localStorage.setItem(SCREENSHOT_INCLUDED_KEY, screenshotIncluded.toString());
172
+ },
173
+ domIncluded: 'visible-only' === savedDomIncluded ? 'visible-only' : 'true' === savedDomIncluded,
174
+ setDomIncluded: (domIncluded)=>{
175
+ set({
176
+ domIncluded
177
+ });
178
+ localStorage.setItem(DOM_INCLUDED_KEY, domIncluded.toString());
179
+ },
180
+ popupTab: 'playground',
181
+ setPopupTab: (tab)=>{
182
+ set({
183
+ popupTab: tab
184
+ });
185
+ }
186
+ };
187
+ });
188
+ exports.useBlackboardPreference = __webpack_exports__.useBlackboardPreference;
189
+ exports.useEnvConfig = __webpack_exports__.useEnvConfig;
190
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
191
+ "useBlackboardPreference",
192
+ "useEnvConfig"
193
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
194
+ Object.defineProperty(exports, '__esModule', {
195
+ value: true
196
+ });
@@ -0,0 +1,116 @@
1
+ "use strict";
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
+ VALIDATION_CONSTANTS: ()=>VALIDATION_CONSTANTS,
28
+ extractDefaultValue: ()=>extractDefaultValue,
29
+ isLocateField: ()=>isLocateField,
30
+ isZodObjectSchema: ()=>isZodObjectSchema,
31
+ unwrapZodType: ()=>unwrapZodType
32
+ });
33
+ const VALIDATION_CONSTANTS = {
34
+ ZOD_TYPES: {
35
+ OPTIONAL: 'ZodOptional',
36
+ DEFAULT: 'ZodDefault',
37
+ NULLABLE: 'ZodNullable',
38
+ OBJECT: 'ZodObject',
39
+ ENUM: 'ZodEnum',
40
+ NUMBER: 'ZodNumber',
41
+ STRING: 'ZodString',
42
+ BOOLEAN: 'ZodBoolean'
43
+ },
44
+ FIELD_FLAGS: {
45
+ LOCATION: 'midscene_location_field_flag'
46
+ },
47
+ DEFAULT_VALUES: {
48
+ ACTION_TYPE: 'aiAction',
49
+ TIMEOUT_MS: 15000,
50
+ CHECK_INTERVAL_MS: 3000
51
+ }
52
+ };
53
+ const isZodObjectSchema = (schema)=>'object' == typeof schema && null !== schema && ('shape' in schema || 'ZodObject' === schema.type);
54
+ const isLocateField = (field)=>{
55
+ var _field__def;
56
+ const fieldWithRuntime = field;
57
+ if ((null == (_field__def = field._def) ? void 0 : _field__def.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.OBJECT) {
58
+ var _field__def1;
59
+ let shape;
60
+ if (field._def.shape) shape = 'function' == typeof field._def.shape ? field._def.shape() : field._def.shape;
61
+ if (!shape && fieldWithRuntime.shape) shape = fieldWithRuntime.shape;
62
+ if (shape && VALIDATION_CONSTANTS.FIELD_FLAGS.LOCATION in shape) return true;
63
+ const description = (null == (_field__def1 = field._def) ? void 0 : _field__def1.description) || fieldWithRuntime.description || '';
64
+ if ('string' == typeof description && description.toLowerCase().includes('input field')) return true;
65
+ }
66
+ if ('object' == typeof field && null !== field) {
67
+ var _fieldWithRuntime__def;
68
+ const description = fieldWithRuntime.description || (null == (_fieldWithRuntime__def = fieldWithRuntime._def) ? void 0 : _fieldWithRuntime__def.description) || '';
69
+ if ('string' == typeof description) {
70
+ const desc = description.toLowerCase();
71
+ if (desc.includes('input field') || desc.includes('element') || desc.includes('locate')) return true;
72
+ }
73
+ if ('ZodObject' === fieldWithRuntime.typeName || 'ZodObject' === fieldWithRuntime.type) return 'string' == typeof description && description.toLowerCase().includes('input field');
74
+ }
75
+ return false;
76
+ };
77
+ const unwrapZodType = (field)=>{
78
+ var _actualField__def, _actualField__def1, _actualField__def2;
79
+ let actualField = field;
80
+ let isOptional = false;
81
+ let hasDefault = false;
82
+ while((null == (_actualField__def = actualField._def) ? void 0 : _actualField__def.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.OPTIONAL || (null == (_actualField__def1 = actualField._def) ? void 0 : _actualField__def1.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT || (null == (_actualField__def2 = actualField._def) ? void 0 : _actualField__def2.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.NULLABLE){
83
+ var _actualField__def3, _actualField__def4;
84
+ if ((null == (_actualField__def3 = actualField._def) ? void 0 : _actualField__def3.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.OPTIONAL) isOptional = true;
85
+ if ((null == (_actualField__def4 = actualField._def) ? void 0 : _actualField__def4.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT) hasDefault = true;
86
+ actualField = actualField._def.innerType || actualField;
87
+ }
88
+ return {
89
+ actualField,
90
+ isOptional,
91
+ hasDefault
92
+ };
93
+ };
94
+ const extractDefaultValue = (field)=>{
95
+ var _currentField__def;
96
+ let currentField = field;
97
+ while(null == (_currentField__def = currentField._def) ? void 0 : _currentField__def.innerType){
98
+ if (currentField._def.typeName === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT && currentField._def.defaultValue) return currentField._def.defaultValue();
99
+ currentField = currentField._def.innerType;
100
+ }
101
+ };
102
+ exports.VALIDATION_CONSTANTS = __webpack_exports__.VALIDATION_CONSTANTS;
103
+ exports.extractDefaultValue = __webpack_exports__.extractDefaultValue;
104
+ exports.isLocateField = __webpack_exports__.isLocateField;
105
+ exports.isZodObjectSchema = __webpack_exports__.isZodObjectSchema;
106
+ exports.unwrapZodType = __webpack_exports__.unwrapZodType;
107
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
108
+ "VALIDATION_CONSTANTS",
109
+ "extractDefaultValue",
110
+ "isLocateField",
111
+ "isZodObjectSchema",
112
+ "unwrapZodType"
113
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
114
+ Object.defineProperty(exports, '__esModule', {
115
+ value: true
116
+ });
@@ -0,0 +1,75 @@
1
+ "use strict";
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
30
+ });
31
+ const elementColor = [
32
+ '#01204E'
33
+ ];
34
+ const highlightColorForSearchArea = '#028391';
35
+ const highlightColorForElement = '#fd5907';
36
+ function djb2Hash(str) {
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;
41
+ }
42
+ function colorForName(name) {
43
+ const hashNumber = djb2Hash(name);
44
+ return elementColor[hashNumber % elementColor.length];
45
+ }
46
+ function highlightColorForType(type) {
47
+ if ('searchArea' === type) return highlightColorForSearchArea;
48
+ return highlightColorForElement;
49
+ }
50
+ function globalThemeConfig() {
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
+ };
64
+ }
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
75
+ });
@@ -0,0 +1,154 @@
1
+ "use strict";
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
+ BLANK_RESULT: ()=>BLANK_RESULT,
28
+ WELCOME_MESSAGE_TEMPLATE: ()=>WELCOME_MESSAGE_TEMPLATE,
29
+ apiMetadata: ()=>apiMetadata,
30
+ deepThinkTip: ()=>deepThinkTip,
31
+ defaultMainButtons: ()=>defaultMainButtons,
32
+ domIncludedTip: ()=>domIncludedTip,
33
+ screenshotIncludedTip: ()=>screenshotIncludedTip,
34
+ trackingTip: ()=>trackingTip
35
+ });
36
+ const trackingTip = 'limit popup to current tab';
37
+ const deepThinkTip = 'deep think';
38
+ const screenshotIncludedTip = 'include screenshot in request';
39
+ const domIncludedTip = 'include DOM info in request';
40
+ const apiMetadata = {
41
+ aiAction: {
42
+ group: 'interaction',
43
+ title: 'Auto Planning: plan the steps and execute'
44
+ },
45
+ aiTap: {
46
+ group: 'interaction',
47
+ title: 'Click an element'
48
+ },
49
+ aiDoubleClick: {
50
+ group: 'interaction',
51
+ title: 'Double-click an element'
52
+ },
53
+ aiHover: {
54
+ group: 'interaction',
55
+ title: 'Hover over an element'
56
+ },
57
+ aiInput: {
58
+ group: 'interaction',
59
+ title: 'Input text into an element'
60
+ },
61
+ aiRightClick: {
62
+ group: 'interaction',
63
+ title: 'Right-click an element'
64
+ },
65
+ aiKeyboardPress: {
66
+ group: 'interaction',
67
+ title: 'Press keyboard keys'
68
+ },
69
+ aiScroll: {
70
+ group: 'interaction',
71
+ title: 'Scroll the page or element'
72
+ },
73
+ aiLocate: {
74
+ group: 'interaction',
75
+ title: 'Locate an element on the page'
76
+ },
77
+ aiQuery: {
78
+ group: 'extraction',
79
+ title: 'Extract data directly from the UI'
80
+ },
81
+ aiBoolean: {
82
+ group: 'extraction',
83
+ title: 'Get true/false answer'
84
+ },
85
+ aiNumber: {
86
+ group: 'extraction',
87
+ title: 'Extract numeric value'
88
+ },
89
+ aiString: {
90
+ group: 'extraction',
91
+ title: 'Extract text value'
92
+ },
93
+ aiAsk: {
94
+ group: 'extraction',
95
+ title: 'Ask a question about the UI'
96
+ },
97
+ aiAssert: {
98
+ group: 'validation',
99
+ title: 'Assert a condition is true'
100
+ },
101
+ aiWaitFor: {
102
+ group: 'validation',
103
+ title: 'Wait for a condition to be met'
104
+ }
105
+ };
106
+ const defaultMainButtons = [
107
+ 'aiAction',
108
+ 'aiTap',
109
+ 'aiQuery',
110
+ 'aiAssert'
111
+ ];
112
+ const WELCOME_MESSAGE_TEMPLATE = {
113
+ type: 'system',
114
+ content: `
115
+ Welcome to Midscene.js Playground!
116
+
117
+ This is a panel for experimenting and testing Midscene.js features. You can use natural language instructions to operate the web page, such as clicking buttons, filling in forms, querying information, etc.
118
+
119
+ Please enter your instructions in the input box below to start experiencing.
120
+ `,
121
+ loading: false,
122
+ result: void 0,
123
+ replayScriptsInfo: null,
124
+ replayCounter: 0,
125
+ loadingProgressText: '',
126
+ verticalMode: false
127
+ };
128
+ const BLANK_RESULT = {
129
+ result: void 0,
130
+ dump: null,
131
+ reportHTML: null,
132
+ error: null
133
+ };
134
+ exports.BLANK_RESULT = __webpack_exports__.BLANK_RESULT;
135
+ exports.WELCOME_MESSAGE_TEMPLATE = __webpack_exports__.WELCOME_MESSAGE_TEMPLATE;
136
+ exports.apiMetadata = __webpack_exports__.apiMetadata;
137
+ exports.deepThinkTip = __webpack_exports__.deepThinkTip;
138
+ exports.defaultMainButtons = __webpack_exports__.defaultMainButtons;
139
+ exports.domIncludedTip = __webpack_exports__.domIncludedTip;
140
+ exports.screenshotIncludedTip = __webpack_exports__.screenshotIncludedTip;
141
+ exports.trackingTip = __webpack_exports__.trackingTip;
142
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
143
+ "BLANK_RESULT",
144
+ "WELCOME_MESSAGE_TEMPLATE",
145
+ "apiMetadata",
146
+ "deepThinkTip",
147
+ "defaultMainButtons",
148
+ "domIncludedTip",
149
+ "screenshotIncludedTip",
150
+ "trackingTip"
151
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
152
+ Object.defineProperty(exports, '__esModule', {
153
+ value: true
154
+ });