@dimina-kit/devtools 0.4.0 → 0.5.0-dev.20260908120530

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 (507) hide show
  1. package/README.md +51 -660
  2. package/dist/main/api.d.ts +2 -1
  3. package/dist/main/app/app.d.ts +41 -12
  4. package/dist/main/app/app.js +299 -514
  5. package/dist/main/app/bootstrap.d.ts +8 -5
  6. package/dist/main/app/bootstrap.js +15 -15
  7. package/dist/main/app/editor-view.d.ts +21 -0
  8. package/dist/main/app/editor-view.js +71 -0
  9. package/dist/main/app/global-mirrors.d.ts +23 -0
  10. package/dist/main/app/global-mirrors.js +37 -0
  11. package/dist/main/app/host-sidebar-default.d.ts +19 -0
  12. package/dist/main/app/host-sidebar-default.js +44 -0
  13. package/dist/main/app/lifecycle.d.ts +12 -1
  14. package/dist/main/app/lifecycle.js +27 -1
  15. package/dist/main/app/menu-setup.d.ts +13 -0
  16. package/dist/main/app/menu-setup.js +49 -0
  17. package/dist/main/app/native-overview.d.ts +1 -1
  18. package/dist/main/app/open-project-ipc.d.ts +13 -0
  19. package/dist/main/app/open-project-ipc.js +21 -0
  20. package/dist/main/app/project-list-surface.d.ts +31 -0
  21. package/dist/main/app/project-list-surface.js +20 -0
  22. package/dist/main/app/project-window.d.ts +36 -0
  23. package/dist/main/app/project-window.js +93 -0
  24. package/dist/main/app/servers.d.ts +17 -0
  25. package/dist/main/app/servers.js +60 -0
  26. package/dist/main/app/ui-extension-targets.d.ts +42 -0
  27. package/dist/main/app/ui-extension-targets.js +101 -0
  28. package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
  29. package/dist/main/app/window-close-reveal.harness.js +65 -0
  30. package/dist/main/app/window-events.d.ts +15 -0
  31. package/dist/main/app/window-events.js +45 -0
  32. package/dist/main/app/window-runtime-services.d.ts +41 -0
  33. package/dist/main/app/window-runtime-services.js +197 -0
  34. package/dist/main/app/workbench-modules.d.ts +24 -0
  35. package/dist/main/app/workbench-modules.js +51 -0
  36. package/dist/main/app/workbench-window.d.ts +85 -0
  37. package/dist/main/app/workbench-window.js +310 -0
  38. package/dist/main/index.bundle.js +11712 -9986
  39. package/dist/main/index.js +49 -1
  40. package/dist/main/ipc/app-lifecycle.d.ts +1 -31
  41. package/dist/main/ipc/app-lifecycle.js +1 -53
  42. package/dist/main/ipc/app.d.ts +4 -1
  43. package/dist/main/ipc/app.js +4 -3
  44. package/dist/main/ipc/bridge-router.d.ts +19 -116
  45. package/dist/main/ipc/bridge-router.js +28 -2128
  46. package/dist/main/ipc/device-picker.d.ts +16 -0
  47. package/dist/main/ipc/device-picker.js +27 -0
  48. package/dist/main/ipc/index.d.ts +5 -0
  49. package/dist/main/ipc/index.js +5 -0
  50. package/dist/main/ipc/internal-devtools.d.ts +16 -0
  51. package/dist/main/ipc/internal-devtools.js +10 -0
  52. package/dist/main/ipc/page-scroll.d.ts +1 -13
  53. package/dist/main/ipc/page-scroll.js +1 -16
  54. package/dist/main/ipc/popover.d.ts +4 -1
  55. package/dist/main/ipc/popover.js +26 -19
  56. package/dist/main/ipc/project-create.d.ts +16 -0
  57. package/dist/main/ipc/project-create.js +27 -0
  58. package/dist/main/ipc/project-fs.d.ts +38 -3
  59. package/dist/main/ipc/project-fs.js +53 -22
  60. package/dist/main/ipc/projects.d.ts +3 -3
  61. package/dist/main/ipc/projects.js +47 -11
  62. package/dist/main/ipc/session-listener-bag.d.ts +1 -40
  63. package/dist/main/ipc/session-listener-bag.js +1 -39
  64. package/dist/main/ipc/session.d.ts +4 -1
  65. package/dist/main/ipc/session.js +26 -26
  66. package/dist/main/ipc/settings.d.ts +4 -1
  67. package/dist/main/ipc/settings.js +17 -19
  68. package/dist/main/ipc/simulator-module.d.ts +9 -3
  69. package/dist/main/ipc/simulator-module.js +13 -10
  70. package/dist/main/ipc/simulator.d.ts +4 -1
  71. package/dist/main/ipc/simulator.js +12 -18
  72. package/dist/main/ipc/tooltip.d.ts +14 -0
  73. package/dist/main/ipc/tooltip.js +29 -0
  74. package/dist/main/ipc/views.d.ts +19 -2
  75. package/dist/main/ipc/views.js +76 -8
  76. package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
  77. package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
  78. package/dist/main/runtime/devtools-backend.js +60 -4
  79. package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
  80. package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
  81. package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
  82. package/dist/main/services/app-services.d.ts +62 -0
  83. package/dist/main/services/app-services.js +64 -0
  84. package/dist/main/services/automation/connection-target.d.ts +36 -0
  85. package/dist/main/services/automation/connection-target.js +29 -0
  86. package/dist/main/services/automation/console-bridge.d.ts +28 -0
  87. package/dist/main/services/automation/console-bridge.js +91 -0
  88. package/dist/main/services/automation/handlers/app.js +4 -4
  89. package/dist/main/services/automation/handlers/element.js +55 -21
  90. package/dist/main/services/automation/index.d.ts +12 -1
  91. package/dist/main/services/automation/index.js +54 -133
  92. package/dist/main/services/cdp-session/index.d.ts +87 -0
  93. package/dist/main/services/cdp-session/index.js +173 -0
  94. package/dist/main/services/compile-standby.js +4 -0
  95. package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
  96. package/dist/main/services/console-forward/cdp-inject.js +30 -0
  97. package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
  98. package/dist/main/services/console-forward/global-console-mirror.js +71 -0
  99. package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
  100. package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
  101. package/dist/main/services/console-forward/index.d.ts +1 -46
  102. package/dist/main/services/console-forward/index.js +1 -185
  103. package/dist/main/services/console-forward/internal-log.d.ts +2 -0
  104. package/dist/main/services/console-forward/internal-log.js +2 -0
  105. package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
  106. package/dist/main/services/console-forward/open-gated-relay.js +55 -0
  107. package/dist/main/services/default-adapter.js +1 -1
  108. package/dist/main/services/diagnostics/index.d.ts +1 -48
  109. package/dist/main/services/diagnostics/index.js +1 -60
  110. package/dist/main/services/dimina-resource-server.d.ts +1 -6
  111. package/dist/main/services/dimina-resource-server.js +1 -98
  112. package/dist/main/services/elements-forward/index.d.ts +132 -15
  113. package/dist/main/services/elements-forward/index.js +155 -304
  114. package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
  115. package/dist/main/services/fs-bridge-protocol.js +34 -0
  116. package/dist/main/services/fs-watch-sse.d.ts +40 -0
  117. package/dist/main/services/fs-watch-sse.js +113 -0
  118. package/dist/main/services/http-json.d.ts +9 -0
  119. package/dist/main/services/http-json.js +6 -0
  120. package/dist/main/services/layout/index.d.ts +11 -0
  121. package/dist/main/services/layout/index.js +23 -0
  122. package/dist/main/services/mcp/connection-owner.d.ts +38 -0
  123. package/dist/main/services/mcp/connection-owner.js +79 -0
  124. package/dist/main/services/mcp/index.d.ts +3 -1
  125. package/dist/main/services/mcp/index.js +4 -3
  126. package/dist/main/services/mcp/opened-project.d.ts +88 -0
  127. package/dist/main/services/mcp/opened-project.js +60 -0
  128. package/dist/main/services/mcp/server.d.ts +2 -1
  129. package/dist/main/services/mcp/server.js +29 -4
  130. package/dist/main/services/mcp/target-manager.d.ts +71 -23
  131. package/dist/main/services/mcp/target-manager.js +269 -138
  132. package/dist/main/services/mcp/target-selection.d.ts +47 -0
  133. package/dist/main/services/mcp/target-selection.js +71 -0
  134. package/dist/main/services/mcp/tools/context-tools.js +20 -5
  135. package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
  136. package/dist/main/services/mcp/tools/project-tools.js +133 -0
  137. package/dist/main/services/module.d.ts +13 -5
  138. package/dist/main/services/network-forward/body-cache.d.ts +72 -0
  139. package/dist/main/services/network-forward/body-cache.js +179 -0
  140. package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
  141. package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
  142. package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
  143. package/dist/main/services/network-forward/global-body-gate.js +93 -0
  144. package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
  145. package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
  146. package/dist/main/services/network-forward/http.d.ts +47 -0
  147. package/dist/main/services/network-forward/http.js +162 -0
  148. package/dist/main/services/network-forward/index.d.ts +135 -15
  149. package/dist/main/services/network-forward/index.js +854 -224
  150. package/dist/main/services/network-forward/request-ids.d.ts +5 -0
  151. package/dist/main/services/network-forward/request-ids.js +5 -0
  152. package/dist/main/services/network-forward/user-facing.d.ts +21 -0
  153. package/dist/main/services/network-forward/user-facing.js +50 -0
  154. package/dist/main/services/network-forward/websocket.d.ts +36 -0
  155. package/dist/main/services/network-forward/websocket.js +120 -0
  156. package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
  157. package/dist/main/services/notifications/renderer-notifier.js +45 -8
  158. package/dist/main/services/projects/create-project-service.js +19 -5
  159. package/dist/main/services/projects/local-provider.js +8 -4
  160. package/dist/main/services/projects/project-repository.d.ts +59 -7
  161. package/dist/main/services/projects/project-repository.js +285 -51
  162. package/dist/main/services/projects/types.d.ts +44 -34
  163. package/dist/main/services/render-inspect/index.d.ts +12 -2
  164. package/dist/main/services/render-inspect/index.js +21 -102
  165. package/dist/main/services/safe-area/index.d.ts +21 -6
  166. package/dist/main/services/safe-area/index.js +92 -46
  167. package/dist/main/services/service-host-pool/pool.d.ts +1 -196
  168. package/dist/main/services/service-host-pool/pool.js +1 -363
  169. package/dist/main/services/settings/index.d.ts +7 -1
  170. package/dist/main/services/settings/index.js +22 -2
  171. package/dist/main/services/simulator/custom-apis.d.ts +1 -42
  172. package/dist/main/services/simulator/custom-apis.js +1 -46
  173. package/dist/main/services/simulator/referer.d.ts +1 -9
  174. package/dist/main/services/simulator/referer.js +1 -19
  175. package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
  176. package/dist/main/services/simulator/ui-extensions.js +176 -0
  177. package/dist/main/services/simulator-appdata/index.d.ts +6 -0
  178. package/dist/main/services/simulator-appdata/index.js +21 -2
  179. package/dist/main/services/simulator-current-page/index.d.ts +5 -3
  180. package/dist/main/services/simulator-current-page/index.js +8 -1
  181. package/dist/main/services/simulator-storage/index.d.ts +34 -5
  182. package/dist/main/services/simulator-storage/index.js +73 -71
  183. package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
  184. package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
  185. package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
  186. package/dist/main/services/simulator-storage/window-scope.js +20 -0
  187. package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
  188. package/dist/main/services/simulator-temp-files/disk.js +1 -237
  189. package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
  190. package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
  191. package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
  192. package/dist/main/services/simulator-temp-files/index.js +1 -181
  193. package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
  194. package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
  195. package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
  196. package/dist/main/services/simulator-temp-files/resolver.js +1 -21
  197. package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
  198. package/dist/main/services/simulator-temp-files/store.js +1 -23
  199. package/dist/main/services/update/github-release-checker.js +22 -3
  200. package/dist/main/services/update/update-manager.d.ts +21 -4
  201. package/dist/main/services/update/update-manager.js +55 -11
  202. package/dist/main/services/views/clear-console-filter.d.ts +44 -0
  203. package/dist/main/services/views/clear-console-filter.js +86 -0
  204. package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
  205. package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
  206. package/dist/main/services/views/console-filter.d.ts +94 -0
  207. package/dist/main/services/views/console-filter.js +190 -0
  208. package/dist/main/services/views/devtools-tabs.d.ts +24 -4
  209. package/dist/main/services/views/devtools-tabs.js +40 -21
  210. package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
  211. package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
  212. package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
  213. package/dist/main/services/views/host-dialog-port-channel.js +15 -0
  214. package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
  215. package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
  216. package/dist/main/services/views/host-dialog-view.d.ts +95 -0
  217. package/dist/main/services/views/host-dialog-view.js +147 -0
  218. package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
  219. package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
  220. package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
  221. package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
  222. package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
  223. package/dist/main/services/views/host-sidebar-view.js +44 -0
  224. package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
  225. package/dist/main/services/views/host-slot-port-channel.js +289 -0
  226. package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
  227. package/dist/main/services/views/host-slot-session-runtime.js +50 -0
  228. package/dist/main/services/views/host-slot-view.d.ts +109 -0
  229. package/dist/main/services/views/host-slot-view.js +147 -0
  230. package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
  231. package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
  232. package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
  233. package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
  234. package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
  235. package/dist/main/services/views/host-toolbar-view.js +30 -237
  236. package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
  237. package/dist/main/services/views/managed-web-contents-view.js +143 -0
  238. package/dist/main/services/views/miniapp-partition.d.ts +1 -89
  239. package/dist/main/services/views/miniapp-partition.js +1 -158
  240. package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
  241. package/dist/main/services/views/native-simulator-view.d.ts +6 -0
  242. package/dist/main/services/views/native-simulator-view.js +47 -40
  243. package/dist/main/services/views/native-view-tree.d.ts +25 -0
  244. package/dist/main/services/views/native-view-tree.js +69 -0
  245. package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
  246. package/dist/main/services/views/overlay-panels-view.js +257 -108
  247. package/dist/main/services/views/placement-reconciler.d.ts +18 -18
  248. package/dist/main/services/views/placement-reconciler.js +91 -29
  249. package/dist/main/services/views/placement-test-driver.d.ts +27 -0
  250. package/dist/main/services/views/placement-test-driver.js +29 -0
  251. package/dist/main/services/views/refresh-styles.d.ts +10 -0
  252. package/dist/main/services/views/refresh-styles.js +57 -0
  253. package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
  254. package/dist/main/services/views/simulator-session-policy.js +1 -98
  255. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
  256. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
  257. package/dist/main/services/views/view-manager.d.ts +69 -88
  258. package/dist/main/services/views/view-manager.js +62 -7
  259. package/dist/main/services/views/workbench-view.d.ts +2 -0
  260. package/dist/main/services/views/workbench-view.js +104 -17
  261. package/dist/main/services/window-contexts/context-router.d.ts +36 -0
  262. package/dist/main/services/window-contexts/context-router.js +55 -0
  263. package/dist/main/services/workbench-coi-host.d.ts +52 -0
  264. package/dist/main/services/workbench-coi-host.js +227 -0
  265. package/dist/main/services/workbench-coi-server.d.ts +11 -0
  266. package/dist/main/services/workbench-coi-server.js +126 -126
  267. package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
  268. package/dist/main/services/workbench-coi-shutdown.js +69 -0
  269. package/dist/main/services/workbench-coi-static.d.ts +23 -0
  270. package/dist/main/services/workbench-coi-static.js +87 -0
  271. package/dist/main/services/workbench-context.d.ts +88 -8
  272. package/dist/main/services/workbench-context.js +54 -6
  273. package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
  274. package/dist/main/services/workspace/compile-log-buffer.js +41 -0
  275. package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
  276. package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
  277. package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
  278. package/dist/main/services/workspace/compile-mode-store.js +71 -0
  279. package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
  280. package/dist/main/services/workspace/open-project-guards.js +42 -0
  281. package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
  282. package/dist/main/services/workspace/rebuild-status.js +36 -0
  283. package/dist/main/services/workspace/session-status-store.d.ts +47 -0
  284. package/dist/main/services/workspace/session-status-store.js +73 -0
  285. package/dist/main/services/workspace/status-tap.d.ts +20 -0
  286. package/dist/main/services/workspace/status-tap.js +32 -0
  287. package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
  288. package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
  289. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
  290. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
  291. package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
  292. package/dist/main/services/workspace/workspace-referer.js +26 -0
  293. package/dist/main/services/workspace/workspace-service.d.ts +7 -5
  294. package/dist/main/services/workspace/workspace-service.js +96 -135
  295. package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
  296. package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
  297. package/dist/main/utils/ipc-context-source.d.ts +40 -0
  298. package/dist/main/utils/ipc-context-source.js +23 -0
  299. package/dist/main/utils/ipc-registry.d.ts +46 -21
  300. package/dist/main/utils/ipc-registry.js +166 -76
  301. package/dist/main/utils/paths.d.ts +18 -0
  302. package/dist/main/utils/paths.js +18 -0
  303. package/dist/main/utils/sender-policy.d.ts +10 -1
  304. package/dist/main/utils/sender-policy.js +42 -4
  305. package/dist/main/utils/theme.d.ts +18 -8
  306. package/dist/main/utils/theme.js +19 -9
  307. package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
  308. package/dist/main/windows/internal-devtools-window/index.js +160 -0
  309. package/dist/main/windows/main-window/create.d.ts +16 -0
  310. package/dist/main/windows/main-window/create.js +19 -11
  311. package/dist/main/windows/main-window/events.d.ts +1 -1
  312. package/dist/main/windows/main-window/events.js +26 -13
  313. package/dist/main/windows/main-window/index.d.ts +1 -1
  314. package/dist/main/windows/main-window/index.js +1 -1
  315. package/dist/main/windows/service-host-window/create.d.ts +1 -92
  316. package/dist/main/windows/service-host-window/create.js +1 -154
  317. package/dist/native-host/common/common.js +173 -53
  318. package/dist/native-host/container/pageFrame.css +1 -1
  319. package/dist/native-host/render/render.js +8278 -3659
  320. package/dist/native-host/service/service.js +2 -2
  321. package/dist/preload/index.d.ts +2 -0
  322. package/dist/preload/index.js +1 -0
  323. package/dist/preload/instrumentation/app-data.d.ts +2 -2
  324. package/dist/preload/instrumentation/app-data.js +1 -1
  325. package/dist/preload/instrumentation/wxml.js +1 -1
  326. package/dist/preload/runtime/bridge.d.ts +3 -3
  327. package/dist/preload/runtime/bridge.js +2 -2
  328. package/dist/preload/runtime/clipboard.d.ts +6 -0
  329. package/dist/preload/runtime/clipboard.js +12 -0
  330. package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
  331. package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
  332. package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
  333. package/dist/preload/runtime/host-dialog-port.js +53 -0
  334. package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
  335. package/dist/preload/runtime/host-dialog-runtime.js +36 -0
  336. package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
  337. package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
  338. package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
  339. package/dist/preload/runtime/host-sidebar-port.js +53 -0
  340. package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
  341. package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
  342. package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
  343. package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
  344. package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
  345. package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
  346. package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
  347. package/dist/preload/runtime/host-toolbar-port.js +11 -95
  348. package/dist/preload/runtime/native-host.d.ts +14 -0
  349. package/dist/preload/runtime/native-host.js +5 -8
  350. package/dist/preload/runtime/node-bindings.d.ts +18 -0
  351. package/dist/preload/runtime/node-bindings.js +44 -0
  352. package/dist/preload/runtime/temp-files.js +9 -2
  353. package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
  354. package/dist/preload/runtime/wait-for-slot-root.js +80 -0
  355. package/dist/preload/shared/api-compat.js +63 -41
  356. package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
  357. package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
  358. package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
  359. package/dist/preload/windows/host-dialog-runtime.js +13 -0
  360. package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
  361. package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
  362. package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
  363. package/dist/preload/windows/host-sidebar-runtime.js +13 -0
  364. package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
  365. package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
  366. package/dist/preload/windows/main.cjs +4922 -1246
  367. package/dist/preload/windows/main.cjs.map +4 -4
  368. package/dist/preload/windows/main.css +428 -0
  369. package/dist/preload/windows/main.css.map +7 -0
  370. package/dist/preload/windows/simulator.cjs +376 -322
  371. package/dist/preload/windows/simulator.cjs.map +4 -4
  372. package/dist/preload/windows/simulator.js +376 -322
  373. package/dist/render-host/pageFrame.html +4 -4
  374. package/dist/render-host/preload.cjs +30 -0
  375. package/dist/render-host/render-inspect.js +184 -115
  376. package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
  377. package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
  378. package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
  379. package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
  380. package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
  381. package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
  382. package/dist/renderer/assets/dist-B5HADirS.js +2 -0
  383. package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
  384. package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
  385. package/dist/renderer/assets/index-CEL_XFge.js +2 -0
  386. package/dist/renderer/assets/input-CAObw95L.js +2 -0
  387. package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
  388. package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
  389. package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
  390. package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
  391. package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
  392. package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
  393. package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
  394. package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
  395. package/dist/renderer/assets/search-BMvuYF48.js +2 -0
  396. package/dist/renderer/assets/select-nFP95TxM.js +2 -0
  397. package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
  398. package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
  399. package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
  400. package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
  401. package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
  402. package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
  403. package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
  404. package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
  405. package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
  406. package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
  407. package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
  408. package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
  409. package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
  410. package/dist/renderer/entries/device-picker/index.html +28 -0
  411. package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
  412. package/dist/renderer/entries/main/index.html +16 -7
  413. package/dist/renderer/entries/popover/index.html +16 -6
  414. package/dist/renderer/entries/project-create-dialog/index.html +27 -0
  415. package/dist/renderer/entries/settings/index.html +10 -5
  416. package/dist/renderer/entries/tooltip/index.html +21 -0
  417. package/dist/renderer/entries/update-dialog/index.html +25 -0
  418. package/dist/renderer/entries/workbench/index.html +49 -0
  419. package/dist/renderer/entries/workbench-settings/index.html +12 -5
  420. package/dist/service-host/appdata-set-data.cjs +39 -0
  421. package/dist/service-host/host-env-update.cjs +23 -0
  422. package/dist/service-host/preload.cjs +54 -48
  423. package/dist/service-host/service-message-queue.cjs +71 -0
  424. package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
  425. package/dist/service-host/sync-impls/menu-button.js +5 -3
  426. package/dist/service-host/sync-impls/system-info.js +31 -9
  427. package/dist/shared/bridge-channels.d.ts +1 -416
  428. package/dist/shared/bridge-channels.js +1 -89
  429. package/dist/shared/compile-mode-state.d.ts +73 -0
  430. package/dist/shared/compile-mode-state.js +100 -0
  431. package/dist/shared/compile-modes.d.ts +152 -0
  432. package/dist/shared/compile-modes.js +237 -0
  433. package/dist/shared/constants.d.ts +22 -0
  434. package/dist/shared/constants.js +22 -0
  435. package/dist/shared/dmb-resource-url.d.ts +2 -0
  436. package/dist/shared/dmb-resource-url.js +2 -0
  437. package/dist/shared/ipc-channels-overlays.d.ts +162 -0
  438. package/dist/shared/ipc-channels-overlays.js +203 -0
  439. package/dist/shared/ipc-channels.d.ts +24 -154
  440. package/dist/shared/ipc-channels.js +48 -96
  441. package/dist/shared/ipc-schemas.d.ts +143 -54
  442. package/dist/shared/ipc-schemas.js +137 -45
  443. package/dist/shared/node-bindings.d.ts +2 -0
  444. package/dist/shared/node-bindings.js +2 -0
  445. package/dist/shared/project-window-types.d.ts +42 -0
  446. package/dist/shared/project-window-types.js +2 -0
  447. package/dist/shared/simulator-route.d.ts +8 -0
  448. package/dist/shared/simulator-route.js +15 -0
  449. package/dist/shared/simulator-ui.d.ts +61 -0
  450. package/dist/shared/simulator-ui.js +12 -0
  451. package/dist/shared/types.d.ts +126 -41
  452. package/dist/shared/view-ids.d.ts +10 -0
  453. package/dist/shared/view-ids.js +23 -0
  454. package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
  455. package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
  456. package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
  457. package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
  458. package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
  459. package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
  460. package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
  461. package/dist/simulator/simulator.html +4 -3
  462. package/dist/simulator/temp-files.d.ts +35 -0
  463. package/dist/simulator/temp-files.js +121 -0
  464. package/dist/simulator/types.d.ts +50 -0
  465. package/dist/simulator/types.js +2 -0
  466. package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
  467. package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
  468. package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
  469. package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
  470. package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
  471. package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
  472. package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
  473. package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
  474. package/dist/vscode-workbench/index.html +21 -1
  475. package/package.json +23 -13
  476. package/dist/main/services/views/destroy-child-view.d.ts +0 -9
  477. package/dist/main/services/views/destroy-child-view.js +0 -23
  478. package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
  479. package/dist/preload/instrumentation/wxml-extract.js +0 -382
  480. package/dist/preload/shared/sid-registry.d.ts +0 -11
  481. package/dist/preload/shared/sid-registry.js +0 -38
  482. package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
  483. package/dist/renderer/assets/index-BMqyDx71.js +0 -49
  484. package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
  485. package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
  486. package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
  487. package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
  488. package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
  489. package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
  490. package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
  491. package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
  492. package/dist/shared/appdata-accumulator.d.ts +0 -95
  493. package/dist/shared/appdata-accumulator.js +0 -218
  494. package/dist/shared/request-core.d.ts +0 -84
  495. package/dist/shared/request-core.js +0 -168
  496. package/dist/shared/simulator-api-metadata.d.ts +0 -26
  497. package/dist/shared/simulator-api-metadata.js +0 -59
  498. package/dist/shared/vpath.d.ts +0 -42
  499. package/dist/shared/vpath.js +0 -105
  500. package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
  501. package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
  502. package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
  503. package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
  504. package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
  505. package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
  506. package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
  507. package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
@@ -1,6 +1,6 @@
1
- var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){return typeof e==`function`}function r(e){return typeof e==`string`}function i(e){return e==null}function a(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>a(e[n],t[n])):!1}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s(e){return e===`__proto__`}function c(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function l(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return/^(?:0|[1-9]\d*)$/.test(e)}}function u(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function d(e){return typeof e==`symbol`||Object.prototype.toString.call(e)===`[object Symbol]`}function ee(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function f(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function p(e){if(Array.isArray(e))return e.map(f);if(typeof e==`symbol`)return[e];e=m(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function m(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(m).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function te(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||d(e)?!0:typeof e==`string`&&(/^\w*$/.test(e)||!/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/.test(e))||t!=null&&o(t,e)}function ne(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||s(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function h(e,t){if(e!=null)switch(typeof t){case`string`:{if(s(t))return;let n=e[t];return n===void 0?c(t)?h(e,p(t)):void 0:n}case`number`:case`symbol`:{typeof t==`number`&&(t=f(t));let n=e[t];return n===void 0?void 0:n}default:{if(Array.isArray(t))return ne(e,t);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),s(t))return;let n=e[t];return n===void 0?void 0:n}}}function re(e,t,n){ie(e,t,()=>n,()=>void 0)}function ie(e,t,n,r){if(e==null&&!u(e))return e;let i;i=te(t,e)?[t]:Array.isArray(t)?t:p(t);let a=n(h(e,i)),o=e;for(let t=0;t<i.length&&o!=null;t++){let n=f(i[t]);if(s(n))continue;let c;if(t===i.length-1)c=a;else{let a=o[n],s=r?.(a,n,e);c=s===void 0?u(a)?a:l(i[t+1])?[]:{}:s}ae(o,n,c),o=o[n]}return e}function ae(e,t,n){let r=e[t];(!(o(e,t)&&ee(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function g(){return Math.random().toString(36).slice(2,7)}function oe(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function se(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}var _=typeof window<`u`&&typeof navigator<`u`;_&&/Android/i.test(navigator.userAgent),_&&/iPad|iPhone|iPod/.test(navigator.userAgent),_&&/OpenHarmony|harmony/.test(navigator.userAgent),_&&/Android|iPad|iPhone|iPod|OpenHarmony|harmony|Mobile/.test(navigator.userAgent);var v=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function ce(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e.split(`/`),r=t.split(`/`);for(let e of r){let t=e;t===`..`?n.length>0&&n.pop():t!==`.`&&t!==``&&n.push(t)}return n.join(`/`)}function y(e,t){let n=e.split(`/`).slice(0,-1).join(`/`),r=t.split(`?`),i=r[0],a=r[1],o=ce(n,i);return a&&(o+=`?${a}`),o}function b(e){return typeof e==`number`&&Number.isFinite(e)&&!Number.isNaN(e)?`${e}px`:e}function le(e){if(typeof e!=`object`||!e)return e;let t=new WeakMap;function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){if(t.has(e))return t.get(e);let r=[];return t.set(e,r),r.push(...e.map(n)),r}if(t.has(e))return t.get(e);let r=Object.create(Object.getPrototypeOf(e));return t.set(e,r),Object.assign(r,...Object.keys(e).map(t=>({[t]:n(e[t])})))}return n(e)}var ue={},x=1,de=2;function fe(e,t){ue[e]||(ue[e]={factory:t,status:x,exports:void 0})}function S(e,t,r){if(typeof e!=`string`)throw TypeError(`require args must be a string`);let i=ue[e];if(!i)throw Error(`module ${e} not found`);if(i.status===x){i.status=de;let t={exports:{}},a;try{i.factory&&(a=i.factory.call(null,S,t,t.exports))}catch(t){i.status=x;let a=`
1
+ var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){return typeof e==`function`}function r(e){return typeof e==`string`}function i(e){return e==null}function a(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>a(e[n],t[n]))}function o(e){return e===`__proto__`}function s(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function c(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function l(e){if(Array.isArray(e))return e.map(c);if(typeof e==`symbol`)return[e];e=u(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function u(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(u).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function d(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||o(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function f(e,t){if(e!=null)switch(typeof t){case`string`:{if(o(t))return;let n=e[t];return n===void 0?s(t)?f(e,l(t)):void 0:n}case`number`:case`symbol`:{typeof t==`number`&&(t=c(t));let n=e[t];return n===void 0?void 0:n}default:{if(Array.isArray(t))return d(e,t);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),o(t))return;let n=e[t];return n===void 0?void 0:n}}}function p(){return Math.random().toString(36).slice(2,7)}function m(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function h(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}var g=typeof window<`u`&&typeof navigator<`u`;g&&/Android/i.test(navigator.userAgent),g&&/iPad|iPhone|iPod/.test(navigator.userAgent),g&&/OpenHarmony|harmony/.test(navigator.userAgent),g&&/Android|iPad|iPhone|iPod|OpenHarmony|harmony|Mobile/.test(navigator.userAgent);var _=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function ee(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e.split(`/`),r=t.split(`/`);for(let e of r){let t=e;t===`..`?n.length>0&&n.pop():t!==`.`&&t!==``&&n.push(t)}return n.join(`/`)}function te(e,t){let n=e.split(`/`).slice(0,-1).join(`/`),r=t.split(`?`),i=r[0],a=r[1],o=ee(n,i);return a&&(o+=`?${a}`),o}function ne(e){return typeof e==`number`&&Number.isFinite(e)&&!Number.isNaN(e)?`${e}px`:e}function re(e){if(typeof e!=`object`||!e)return e;let t=new WeakMap;function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){if(t.has(e))return t.get(e);let r=[];return t.set(e,r),r.push(...e.map(n)),r}if(t.has(e))return t.get(e);let r=Object.create(Object.getPrototypeOf(e));return t.set(e,r),Object.assign(r,...Object.keys(e).map(t=>({[t]:n(e[t])})))}return n(e)}var ie={},ae=1,oe=2;function se(e,t){ie[e]||(ie[e]={factory:t,status:ae,exports:void 0})}function ce(e){return Object.prototype.hasOwnProperty.call(ie,e)}function v(e,t,r){if(typeof e!=`string`)throw TypeError(`require args must be a string`);let i=ie[e];if(!i)throw Error(`module ${e} not found`);if(i.status===ae){i.status=oe;let t={exports:{}},a;try{i.factory&&(a=i.factory.call(null,v,t,t.exports))}catch(t){i.status=ae;let a=`
2
2
  name: ${t.name}
3
3
  msg: ${t.message}
4
4
  stack:
5
5
  ${t.stack}
6
- `;console.error(`require ${e} error: ${a}`),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}S.async=async e=>new Promise((t,n)=>{try{t(S(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var C=new class{constructor(){this.callbacks={}}store(e,t,n=g()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.callback(t),r.keep||delete this.callbacks[e])}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},w=new class{constructor(){this.reset()}reset(){this.active=!1,this.snapshot={systemInfo:null,menuRect:null}}init(e={}){this.active=!0,this.snapshot={...this.snapshot,...e}}update(e={}){this.snapshot={...this.snapshot,...e}}get(e){return this.active?this.snapshot[e]??null:null}getSystemInfo(){return this.get(`systemInfo`)}getMenuRect(){return this.get(`menuRect`)}};function pe(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var T=new class e{constructor(){this.event=pe(),this.init()}init(){v?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){console.log(`[service] receive msg: `,v?e:JSON.stringify(e));let{type:t,body:n}=e;this.event.emit(t,n)}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return v?e.prototype.send=function(e){e.method=`publish`,globalThis.postMessage(e)}:e.prototype.send=function(e){return DiminaServiceBridge.publish(e.body.bridgeId||``,e)},this.send(t)}invoke(t){return v?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},E=new class{#e=[];#t=``;setInitId(e){this.#t=e}push(e,t){this.stack(t).push(e)}pop(){this.stack().length>0&&this.stack().pop()}getPageInfo(){let e=this.stack();return e[e.length-1]||{id:this.#t}}pushStack(e){let t={id:e,pages:[]};return this.#e.push(t),t}popStack(e){if(e){let t=this.#e.findIndex(t=>t.id===e);t!==-1&&this.#e.splice(t,1)}else this.#e.length>0&&this.#e.pop()}stack(e){if(e){let t=this.#e.find(t=>t.id===e);return t||=this.pushStack(e),t.pages}else{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function D(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var me={getWindowInfo:()=>D(w.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>w.getSystemInfo(),getAppBaseInfo:()=>D(w.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>D(w.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>w.getMenuRect()},he=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),ge=new Set(`FileSystemManager.getSavedFileList,clearStorage,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function _e(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function ve(e,t){return he.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t===void 0?ge.has(e):!0}function ye(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:E.getPageInfo().id,params:t}};return n===`container`?T.invoke(r):T.send(r)}function be(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{C.remove(a),C.remove(o)};a=C.store(e=>{s(),r(e)}),o=C.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{ye(e,t,n)}catch(e){s(),i(e)}})}function O(e,t,r=`container`){let i=me[e];if(r===`container`&&i){let e=i();if(e)return e}let a;if(t===void 0){if(ve(e,t))return be(e,{},r);a=t}else if(typeof t==`string`||Array.isArray(t))a=t;else if(n(t))a={success:C.store(t,!0)};else if(_e(t)){let{success:e,fail:r,complete:i,keep:o,evtId:s,...c}=t;a=c,n(e)?a.success=C.store(e,o,s):a.success=e,n(r)&&(a.fail=C.store(r,o,s)),n(i)&&(a.complete=C.store(i,o,s))}else{let{keep:n,...i}=t;if(delete i.evtId,!n&&ve(e,t))return a={...i},be(e,a,r);a=i}return ye(e,a,r)}var xe=t({navigateBack:()=>Ee,navigateTo:()=>Te,reLaunch:()=>Ce,redirectTo:()=>we,switchTab:()=>Se});function Se(e){return e.url=y(E.getPageInfo().route,e.url),O(`switchTab`,e)}function Ce(e){return e.url=y(E.getPageInfo().route,e.url),O(`reLaunch`,e)}function we(e){let t=y(E.getPageInfo().route,e.url);if(E.getPageInfo().route!==t)return e.url=t,O(`redirectTo`,e)}function Te(e){return e.url=y(E.getPageInfo().route,e.url),O(`navigateTo`,e)}function Ee(e){return O(`navigateBack`,e)}var De=t({offAppHide:()=>Ne,offAppShow:()=>Me,offError:()=>ke,onAppHide:()=>je,onAppRoute:()=>Ie,onAppShow:()=>Ae,onError:()=>Oe,onPageNotFound:()=>Fe,onUnhandledRejection:()=>Pe});function Oe(e){return O(`onError`,e)}function ke(e){return O(`offError`,e)}function Ae(e){return O(`onAppShow`,e)}function je(e){return O(`onAppHide`,e)}function Me(e){return O(`offAppShow`,e)}function Ne(e){return O(`offAppHide`,e)}function Pe(){}function Fe(){}function Ie(){}var Le=t({canIUse:()=>Be,env:()=>Re});function Re(){return{USER_DATA_PATH:`difile://`}}var ze=new Set([`nextTick`,`getUpdateManager`,`UpdateManager`,`UpdateManager.applyUpdate`,`UpdateManager.onCheckForUpdate`,`UpdateManager.onUpdateFailed`,`UpdateManager.onUpdateReady`,`getPerformance`]);function Be(e){if(ze.has(e))return!0;try{return O(`canIUse`,e)}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var Ve=t({getPerformance:()=>He});function He(){return Ue.getInstance()}var Ue=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new We,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){let t=new Ge(e);return e&&O(`addPerformanceObserver`,{success:C.store(e=>{let n=e?.data?.entryList&&JSON.parse(e?.data?.entryList)||[];n&&(this.entryList.push(n),t.notify(n))},!0)},`render`),t}getEntries(){return this.entryList.getEntries()}getEntriesByName(e,t){return this.entryList.getEntriesByName(e,t)}getEntriesByType(e){return this.entryList.getEntriesByType(e)}setBufferSize(e){this.entryList.maxEntrySize=e}},We=class{constructor(){this._list=[],this.maxEntrySize=30}push(e){for(let t of e)this._list.length>=this.maxEntrySize&&this._list.shift(),this._list.push(t)}getEntriesByName(e,t){return this._entryFilter(e,t)}getEntriesByType(e){return this._entryFilter(null,e)}_entryFilter(e,t){return this._list.filter(n=>!(e&&e!==n.name||t&&t!==n.entryType))}getEntries(){return this._list}},Ge=class{constructor(e){this.entryTypes=[],this.callback=e}observe(e){this.connected=!0,this.entryTypes=e.entryTypes}notify(e){if(this.connected){let t=new We;t.push(e.filter(e=>{let t=!1;return this.entryTypes&&this.entryTypes.length>0&&this.entryTypes.forEach(n=>{e.entryType===n&&(t=!0)}),t})),this.callback(t)}}disconnect(){this.connected=!1}},Ke=t({loadSubpackage:()=>Je,preDownloadSubpackage:()=>qe});function qe(e){return O(`preDownloadSubpackage`,e)}function Je(e){return O(`loadSubpackage`,e)}var Ye=t({getAppBaseInfo:()=>nt,getDeviceInfo:()=>rt,getSystemInfo:()=>$e,getSystemInfoAsync:()=>tt,getSystemInfoSync:()=>et,getWindowInfo:()=>Ze,openAppAuthorizeSetting:()=>Qe,openSystemBluetoothSetting:()=>Xe});function Xe(e){return O(`openSystemBluetoothSetting`,e)}function Ze(e){return O(`getWindowInfo`,e)}function Qe(e){return O(`openAppAuthorizeSetting`,e)}function $e(e){return new Promise(t=>{t(O(`getSystemInfo`,e))})}function et(){return O(`getSystemInfoSync`)}function tt(e){return O(`getSystemInfoAsync`,e)}function nt(){return O(`getAppBaseInfo`)}function rt(){return O(`getDeviceInfo`)}var it=t({getUpdateManager:()=>ut}),at=`onUpdateStatusChange`,ot=`updatefail`,st=`updateready`,ct=`noupdate`,lt=`updating`;function ut(){return dt.getInstance()}var dt=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasAppliedUpdate=!1,this.updateFailed=!1,this.updateReady=!1,this.checkForUpdateResult=null,this.updateFailedListeners=[],this.updateReadyListeners=[],this.checkForUpdateListeners=[],T.on(at,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===ot){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===st){this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),this.emit(this.updateReadyListeners);return}if(t===lt){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===ct){this.checkForUpdateResult={hasUpdate:!1},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}typeof e.hasUpdate==`boolean`&&(this.checkForUpdateResult={hasUpdate:e.hasUpdate},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult))}emit(e,...t){e.slice().forEach(e=>{e(...t)})}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){if(!this.updateReady)console.error(`[applyUpdate]: update is not ready`);else if(this.hasAppliedUpdate)console.error(`[applyUpdate]: applyUpdate has been called`);else return this.hasAppliedUpdate=!0,O(`applyUpdate`)}onCheckForUpdate(e){typeof e==`function`&&(this.checkForUpdateListeners.push(e),this.checkForUpdateResult&&e(this.checkForUpdateResult))}onUpdateFailed(e){typeof e==`function`&&(this.updateFailedListeners.push(e),this.updateFailed&&e())}onUpdateReady(e){typeof e==`function`&&(this.updateReadyListeners.push(e),this.updateReady&&e())}};dt.getInstance();var ft=t({createCameraContext:()=>pt});function pt(){return new mt}var mt=class{constructor(){this.bridgeId=E.getPageInfo().id}takePhoto(e){return O(`takePhoto`,e)}startRecord(){return O(`startRecord`)}stopRecord(){return O(`stopRecord`)}},ht=t({reportAnalytics:()=>gt,reportEvent:()=>_t});function gt(...e){return O(`reportAnalytics`,e)}function _t(e,t){return O(`reportAnalytics`,{eventId:e,data:t})}var vt=t({closeBluetoothAdapter:()=>kt,getBluetoothAdapterState:()=>Ot,getBluetoothDevices:()=>Dt,getConnectedBluetoothDevices:()=>Et,offBluetoothAdapterStateChange:()=>Tt,offBluetoothDeviceFound:()=>wt,onBluetoothAdapterStateChange:()=>Ct,onBluetoothDeviceFound:()=>St,openBluetoothAdapter:()=>xt,startBluetoothDevicesDiscovery:()=>bt,stopBluetoothDevicesDiscovery:()=>yt});function yt(e){return O(`stopBluetoothDevicesDiscovery`,e)}function bt(e){return O(`startBluetoothDevicesDiscovery`,e)}function xt(e){return O(`openBluetoothAdapter`,e)}function St(e){return O(`onBluetoothDeviceFound`,e)}function Ct(e){return O(`onBluetoothAdapterStateChange`,e)}function wt(){return O(`offBluetoothDeviceFound`)}function Tt(){return O(`offBluetoothAdapterStateChange`)}function Et(e){return O(`getConnectedBluetoothDevices`,e)}function Dt(e){return O(`getBluetoothDevices`,e)}function Ot(e){return O(`getBluetoothAdapterState`,e)}function kt(e){return O(`closeBluetoothAdapter`,e)}var At=t({closeBLEConnection:()=>Ut,createBLEConnection:()=>Ht,getBLEDeviceCharacteristics:()=>Vt,getBLEDeviceRSSI:()=>Bt,getBLEDeviceServices:()=>zt,notifyBLECharacteristicValueChange:()=>Rt,offBLECharacteristicValueChange:()=>Lt,offBLEConnectionStateChange:()=>It,onBLECharacteristicValueChange:()=>Ft,onBLEConnectionStateChange:()=>Pt,readBLECharacteristicValue:()=>Nt,setBLEMTU:()=>Mt,writeBLECharacteristicValue:()=>jt});function jt(e){return O(`writeBLECharacteristicValue`,e)}function Mt(e){return O(`setBLEMTU`,e)}function Nt(e){return O(`readBLECharacteristicValue`,e)}function Pt(e){return O(`onBLEConnectionStateChange`,e)}function Ft(e){return O(`onBLECharacteristicValueChange`,e)}function It(e){return O(`offBLEConnectionStateChange`,e)}function Lt(){return O(`offBLECharacteristicValueChange`)}function Rt(e){return O(`notifyBLECharacteristicValueChange`,e)}function zt(e){return O(`getBLEDeviceServices`,e)}function Bt(e){return O(`getBLEDeviceRSSI`,e)}function Vt(e){return O(`getBLEDeviceCharacteristics`,e)}function Ht(e){return O(`createBLEConnection`,e)}function Ut(e){return O(`closeBLEConnection`,e)}var Wt=t({getClipboardData:()=>Kt,setClipboardData:()=>Gt});function Gt(e){return O(`setClipboardData`,e)}function Kt(e){return O(`getClipboardData`,e)}var qt=t({addPhoneContact:()=>Yt,chooseContact:()=>Jt});function Jt(e){return O(`chooseContact`,e)}function Yt(e){return O(`addPhoneContact`,e)}var Xt=t({hideKeyboard:()=>Zt});function Zt(e){return O(`hideKeyboard`,e)}var Qt=t({offMemoryWarning:()=>en,onMemoryWarning:()=>$t});function $t(e){return O(`onMemoryWarning`,e)}function en(e){return O(`offMemoryWarning`,e)}var tn=t({getNetworkType:()=>nn});function nn(e){return O(`getNetworkType`,e)}var rn=t({makePhoneCall:()=>an});function an(e){return O(`makePhoneCall`,e)}var on=t({scanCode:()=>sn});function sn(e){return O(`scanCode`,e)}var cn=t({vibrateLong:()=>un,vibrateShort:()=>ln});function ln(e){return O(`vibrateShort`,e)}function un(e){return O(`vibrateLong`,e)}var dn=t({extBridge:()=>fn,extOffBridge:()=>mn,extOnBridge:()=>pn,offLoginStatusChanged:()=>gn,onLoginStatusChanged:()=>hn});function fn({event:e,module:t,data:r={},success:i,fail:a,complete:o},s){let c,l,u;return n(s)?(c=s,l=s):(c=i,l=a,u=o),O(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function pn({event:e,module:t,callBack:n,isSustain:r=!0}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOnBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOnBridge 参数 event 为空`);return}if(!n){console.error(`[ERROR]: extOnBridge 参数 callBack 为空`);return}let i=`${t}_${e}`;O(i,{evtId:i,keep:r,success:n})}function mn({event:e,module:t,callBack:n}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOffBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOffBridge 参数 event 为空`);return}O(`${t}_${e}`,{success:n})}function hn(e){T.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function gn(){T.off(`notifyLoginStatusChanged`)}var _n=t({USER_DATA_PATH:()=>vn,fileSystemManagerAPINames:()=>xn,getFileSystemManager:()=>Cn}),vn=`difile://`,yn=`not supported by the dimina runtime`;function k(e){throw Error(`FileSystemManager.${e} ${yn}`)}function A(e,t={}){let{fail:n,complete:r}=t;n?.({errMsg:`${e}:fail ${yn}`}),r?.()}var bn=class{access(e){A(`access`,e)}accessSync(){k(`accessSync`)}stat(e){A(`stat`,e)}statSync(){k(`statSync`)}readFile(e){A(`readFile`,e)}readFileSync(){k(`readFileSync`)}writeFile(e){A(`writeFile`,e)}writeFileSync(){k(`writeFileSync`)}appendFile(e){A(`appendFile`,e)}appendFileSync(){k(`appendFileSync`)}copyFile(e){A(`copyFile`,e)}copyFileSync(){k(`copyFileSync`)}rename(e){A(`rename`,e)}renameSync(){k(`renameSync`)}unlink(e){A(`unlink`,e)}unlinkSync(){k(`unlinkSync`)}mkdir(e){A(`mkdir`,e)}mkdirSync(){k(`mkdirSync`)}rmdir(e){A(`rmdir`,e)}rmdirSync(){k(`rmdirSync`)}readdir(e){A(`readdir`,e)}readdirSync(){k(`readdirSync`)}getFileInfo(e){A(`getFileInfo`,e)}saveFile(e){A(`saveFile`,e)}saveFileSync(){k(`saveFileSync`)}getSavedFileList(e){A(`getSavedFileList`,e)}removeSavedFile(e){A(`removeSavedFile`,e)}truncate(e){A(`truncate`,e)}truncateSync(){k(`truncateSync`)}unzip(e){A(`unzip`,e)}open(e){A(`open`,e)}openSync(){k(`openSync`)}close(e){A(`close`,e)}closeSync(){k(`closeSync`)}read(e){A(`read`,e)}readSync(){k(`readSync`)}write(e){A(`write`,e)}writeSync(){k(`writeSync`)}fstat(e){A(`fstat`,e)}fstatSync(){k(`fstatSync`)}ftruncate(e){A(`ftruncate`,e)}ftruncateSync(){k(`ftruncateSync`)}readCompressedFile(e){A(`readCompressedFile`,e)}readCompressedFileSync(){k(`readCompressedFileSync`)}readZipEntry(e){A(`readZipEntry`,e)}},xn=Object.getOwnPropertyNames(bn.prototype).filter(e=>e!==`constructor`),Sn;function Cn(){return Sn||=new bn,Sn}var wn=[`onLaunch`,`onShow`,`onHide`],Tn=[`globalData`],En=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){wn.forEach(e=>{let t=this.appModule.moduleInfo[e];n(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)wn.includes(t)||Tn.includes(t)||(n(e[t])?this[t]=e[t].bind(this):this[t]=e[t])}invokeSomeLifecycle(){this.onLaunch?.(this.options),this.onShow?.(this.options)}appShow(){this.onShow?.(this.options)}appHide(){this.onHide?.()}},Dn=new Set([`2d`]),On=new Set([`webgl`,`experimental-webgl`,`webgl2`]),kn=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),An=new Set([`createBuffer`,`createFramebuffer`,`createProgram`,`createRenderbuffer`,`createShader`,`createTexture`]),jn=new Set([`getAttribLocation`,`getUniformLocation`]),j={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713},Mn=1,Nn=1;function M(){let e=E.getPageInfo();return e?.bridgeId||e?.id||``}function N(e,t,n){T.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function Pn(e){Promise.resolve().then(e)}function Fn(e){return Object.prototype.toString.call(e)===`[object Object]`}function In(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function P(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};let t=In(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>P(e));if(Fn(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=P(r);return t}return e}function F(e){return Array.from(e).map(e=>P(e))}function I(e=`canvas_resource`){return`${e}_${g()}`}var Ln=class{constructor(e,t){return this.__canvasResourceId=t,this.__canvasProxyValue=Mn++,this.canvas=e,new Proxy(this,{get(e,n){if(n in e)return e[n];if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:F(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}},Rn=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e;let t=C.store((e={})=>{this.width=e.width||this.width,this.height=e.height||this.height,n(this.onload)&&this.onload(e)}),r=C.store((e={})=>{n(this.onerror)&&this.onerror(e)});this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,onload:t,onerror:r})}},zn=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.state={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,globalAlpha:1,lineWidth:1},new Proxy(this,{get(e,t){if(t in e)return e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.state[n]=r,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:P(r)}),!0}})}call(e,t){if(e===`measureText`)return{width:String(t[0]??``).length*10};let n=kn.has(e)?I():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:F(t),resultId:n}),n)return new Ln(this.canvas,n)}},Bn=class{constructor(e,t,n){return this.canvas=e,this.contextId=t,this.contextType=n,new Proxy(this,{get(e,t){if(t in e)return e[t];if(Object.prototype.hasOwnProperty.call(j,t))return j[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:case`getProgramParameter`:return!0;case`getShaderInfoLog`:case`getProgramInfoLog`:return``;case`getError`:return j.NO_ERROR;case`isContextLost`:return!1;case`checkFramebufferStatus`:return j.FRAMEBUFFER_COMPLETE;case`getContextAttributes`:return{};case`getSupportedExtensions`:return[];case`getExtension`:return null;default:break}let n=An.has(e)||jn.has(e)?I(`webgl_resource`):void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:F(t),resultId:n}),n)return new Ln(this.canvas,n)}getParameter(e){let{width:t,height:n}=this.canvas;switch(e){case j.VERSION:return`WebGL 1.0`;case j.SHADING_LANGUAGE_VERSION:return`WebGL GLSL ES 1.0`;case j.VENDOR:return`Dimina`;case j.RENDERER:return`Dimina WebGL Proxy`;case j.VIEWPORT:return[0,0,t,n];case j.MAX_VIEWPORT_DIMS:return[t||4096,n||4096];case j.ALIASED_POINT_SIZE_RANGE:return[1,64];case j.ALIASED_LINE_WIDTH_RANGE:return[1,1];case j.COLOR_CLEAR_VALUE:return[0,0,0,0];case j.COLOR_WRITEMASK:case j.DEPTH_WRITEMASK:return!0;case j.COMPRESSED_TEXTURE_FORMATS:return[];case j.MAX_TEXTURE_SIZE:case j.MAX_CUBE_MAP_TEXTURE_SIZE:case j.MAX_RENDERBUFFER_SIZE:return 4096;case j.MAX_VERTEX_ATTRIBS:return 16;case j.MAX_TEXTURE_IMAGE_UNITS:case j.MAX_VERTEX_TEXTURE_IMAGE_UNITS:case j.MAX_COMBINED_TEXTURE_IMAGE_UNITS:return 8;case j.MAX_VERTEX_UNIFORM_VECTORS:case j.MAX_FRAGMENT_UNIFORM_VECTORS:case j.MAX_VARYING_VECTORS:return 128;default:return 0}}},Vn=class{constructor({nodeId:e,bridgeId:t=M(),width:n=300,height:r=150,type:i=`2d`,offscreen:a=!1}){this.__diminaCanvasNode=!0,this.nodeId=e,this.bridgeId=t,this.type=i,this.offscreen=a,this.contexts=new Map,this.pendingOperations=[],this.flushScheduled=!1,this._width=n,this._height=r}get width(){return this._width}set width(e){this._width=e,this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:e})}get height(){return this._height}set height(e){this._height=e,this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:e})}getContext(e=`2d`,t){let n=String(e).toLowerCase();if(!Dn.has(n)&&!On.has(n))return null;if(this.contexts.has(n))return this.contexts.get(n);let r=I(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:r,contextType:n,attributes:P(t)});let i=On.has(n)?new Bn(this,r,n):new zn(this,r);return this.contexts.set(n,i),i}createImage(){return new Rn(this,I(`canvas_image`))}requestAnimationFrame(e){let t=Nn++,r=C.store(t=>{n(e)&&e(t)});return N(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r}),t}cancelAnimationFrame(e){N(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}enqueueOperation(e){this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,Pn(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[],N(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e})}};function Hn(e,t=M()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:new Vn({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type})}function Un(e,t=M()){return Array.isArray(e)?e.map(e=>Un(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:Hn(e.node,t)}:e}function Wn(e={}){let t=Number(e.width)||300,n=Number(e.height)||150,r=e.type||`2d`,i=I(`offscreen_canvas`),a=M();return N(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new Vn({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0})}var Gn=t({createSelectorQuery:()=>L});function L(){return new Yn}function Kn(){return E.getPageInfo()}function qn(){let e=Kn();return e?.__id__||e?.id}function Jn(){let e=Kn();return e?.bridgeId||e?.id}var Yn=class{constructor(){this.__componentId=qn(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new R(this,this.__componentId,e,!0)}selectAll(e){return new R(this,this.__componentId,e,!1)}selectViewport(){return new R(this,qn(),``,!0)}__push(e,t,n,r,i){this.__taskQueue.push({moduleId:t,selector:e,single:n,fields:r}),this.__cbQueue.push(i)}exec(e){let t=this,r=Jn();O(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=Un(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},R=class{constructor(e,t,n,r){this.__selectorQuery=e,this.__moduleId=t,this.__selector=n,this.__single=r}fields(e,t){return this.__selectorQuery.__push(this.__selector,this.__moduleId,this.__single,e,t),this.__selectorQuery}boundingClientRect(e){return this.fields({id:!0,dataset:!0,rect:!0,size:!0},e)}context(e){return this.fields({context:!0},e)}node(e){return this.fields({node:!0},e)}scrollOffset(e){return this.fields({id:!0,dataset:!0,scrollOffset:!0},e)}},Xn=t({createIntersectionObserver:()=>Zn});function Zn(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Qn(e,{thresholds:n,initialRatio:r,observeAll:i})}var Qn=class{constructor(e,t){this._component=e,this._options=t,this._relativeInfo=[],this._observerId=null,this._disconnected=!1}relativeTo(e,t={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:e,margins:[`left`,`right`,`top`,`bottom`].map(e=>`${t[e]===void 0?0:t[e]}px`).join(` `)}),this}relativeToViewport(e={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:null,margins:[`left`,`right`,`top`,`bottom`].map(t=>`${e[t]===void 0?0:e[t]}px`).join(` `)}),this}observe(e,t){let n=this,r=C.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);O(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){O(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},z=new Map;function B(e){return z.has(e)||z.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),z.get(e)}function V(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return C.store(()=>{r.forEach(t=>t.call(e))})}function $n(e){let t=B(e);t.depth++}function er(e){let t=B(e);t.depth>0&&t.depth--,t.depth===0&&tr(e)}function H(e,t,n,r){let i=B(e),a=i.byModuleId.get(t);if(a)Object.assign(a.data,n);else{let e={moduleId:t,data:{...n}};i.byModuleId.set(t,e),i.updates.push(e)}r&&i.callbackIds.push(r),i.depth===0&&!i.scheduled&&(i.scheduled=!0,Promise.resolve().then(()=>{i.scheduled=!1,i.depth===0&&tr(e)}))}function tr(e){let t=z.get(e);if(!t||t.updates.length===0)return;let n=t.updates,r=t.callbackIds;t.updates=[],t.byModuleId=new Map,t.callbackIds=[],t.scheduled=!1,T.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function nr(e){let t=e.__mpxProxy?.options?.computed;if(t)for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(e.data,n)||(e.data[n]=null)}function U(e){return i(e)?e:Object.entries(e).reduce((e,[t,r])=>t.startsWith(`$`)?e:n(r)?(console.warn(`[service] 值不支持函数引用`,t),e):(Array.isArray(r)?e[t]=r.map(e=>typeof e==`object`&&e?e instanceof Date?e.getTime():U(e):e):r&&typeof r==`object`&&!Array.isArray(r)?r instanceof Date?e[t]=r.getTime():e[t]=U(r):e[t]=r,e),{})}function rr(e){if(e){let t={};for(let r in e){let i=e[r];t[r]=t[r]||{};let a=i&&typeof i==`object`&&Object.prototype.hasOwnProperty.call(i,`type`)?W(i.type):W(i),o=null;if(o=Array.isArray(a)?[...a]:[a],i&&i.optionalTypes){let e=W(i.optionalTypes);Array.isArray(e)?o=[...e]:o.push(e)}t[r].type=o,t[r].type.length>0&&(i&&n(i.value)?t[r].default=i.value():i&&(t[r].default=i.value))}return t}}var ir=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`],[Function,`f`]]);function W(e){return Array.isArray(e)?e.map(e=>W(e)):e===null||e===``?null:ir.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function ar(e,t,n,r,i){let a=new Set;for(let o of e)for(let e in t){if(a.has(e))continue;let s=e.split(`,`).map(e=>e.trim());if(s.includes(o)){a.add(e);let c=t[e],l=s.map(e=>h(n,e));s.length===1?c.call(r,...l,i[o]):c.call(r,...l);continue}if(e===`**`){a.add(e),t[e].call(r,n);continue}let c=e.split(`.`),l=o.split(`.`),u=!0;for(let e=0;e<c.length&&!(c[e]===`**`||l[e]===void 0);e++)if(c[e]!==l[e]){u=!1;break}if(u&&c.length>1){a.add(e);let s=n;for(let e of c)e!==`**`&&(s=s?.[e]);e===o?t[e].call(r,s,i[o]):t[e].call(r,s)}}}function or(e,t,n,r,i){for(let a in t){let o=t[a],s=a.split(`,`).map(e=>e.trim());if(s.includes(e)){let t=s.map(e=>h(n,e));s.length===1&&s[0]===e?o.call(r,...t,i):o.call(r,...t);continue}if(a===`**`){o.call(r,n);continue}let c=a.split(`.`),l=e.split(`.`),u=!0;for(let e=0;e<c.length&&!(c[e]===`**`||l[e]===void 0);e++)if(c[e]!==l[e]){u=!1;break}if(u){let t=n;for(let e of c)e!==`**`&&(t=t[e]);a===e?o.call(r,t,i):o.call(r,t);continue}let d=a.match(/^(.+)\[(\d+)\]$/);if(d){let t=d[1],i=Number.parseInt(d[2],10);if(t===e.split(`[`)[0]&&n[t]&&n[t][i]!==void 0){o.call(r,n[t][i]);continue}}if(e.startsWith(a)){let e=a.split(`.`).reduce((e,t)=>e&&e[t],n);if(e!==void 0){o.call(r,e);continue}}}}function sr(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,oe(n),se(n),r];for(let t of i)if(t&&e[t]!==void 0)return e[t]}function G(e,t,n){let r=e.__info__||{};if(r.behaviorObservers)for(let i in r.behaviorObservers){let a=r.behaviorObservers[i];if(!(!Array.isArray(a)||a.length===0))for(let r of t)a.forEach(t=>{or(r,{[i]:t},e.data,e,n[r])})}}function cr(e,t,n){ur(e,t,n)}function lr(e,t,i){let a=[];for(let o of t){let t=e.__info__.properties?.[o]?.observer,s=e.data[o],c=i[o];r(t)?a.push(()=>e[t]?.(s,c)):n(t)&&a.push(()=>t.call(e,s,c))}return a}function ur(e,t,n){lr(e,t,n).reverse().forEach(e=>e())}function dr(e,t){if(!Array.isArray(t))return;let r=new WeakMap;function i(e,t){let n={...e};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],a=t[e];r&&typeof r==`object`&&!Array.isArray(r)&&a&&typeof a==`object`&&!Array.isArray(a)?n[e]=i(r,a):n[e]=a}return n}function a(e,t){if(typeof t==`string`){o(e,t);return}if(!t||typeof t!=`object`||r.has(t))return;r.set(t,!0),Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>a(e,t)),t.properties&&(e.properties={...t.properties,...e.properties}),t.data&&(e.data||={},e.data=i(t.data,e.data));let s=[`created`,`attached`,`ready`,`detached`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of s)n(t[r])&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(t[r]));if(t.observers){e.behaviorObservers=e.behaviorObservers||{};for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n])}if(t.methods&&(e.methods={...t.methods,...e.methods}),t.relations&&(e.relations={...e.relations,...t.relations}),t.export&&(e.export=t.export),t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}}function o(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:break;case`wx://form-field-button`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>a(e,t))}function K(e,t,n){let r=e;for(;r&&r.__parentId__;){if(r.__parentId__===t)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}function q(e,t){if(!e||!t)return!1;if(e.startsWith(`#`)){let n=e.slice(1);return t.id===n}if(e.startsWith(`.`)){let n=e.slice(1);return t.__targetInfo__?.class&&t.__targetInfo__.class.split(` `).includes(n)}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=e.slice(1,-1).match(/^(\w+)(?:=["']?([^"']*)["']?)?$/);if(n){let[,e,r]=n,i=t.__targetInfo__?.dataset||{};return r===void 0?Object.prototype.hasOwnProperty.call(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function fr(e,t){if(!e||!Array.isArray(e.dependencies))return!1;for(let n of e.dependencies){if(n in t)return!0;for(let e of Object.keys(t))if(e.startsWith(n+`.`)||e.startsWith(n+`[`)||n.startsWith(e+`.`)||n.startsWith(e+`[`))return!0}return!1}function pr(e,t){if(!(!e||!e.expression)){if(e.isSimple)return h(t,e.expression);try{return Function(`data`,`with(data) { return ${e.expression} }`)(t)}catch(t){console.warn(`[service] 计算表达式失败:`,e.expression,t);return}}}function J(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!K(t,e.__id__,r)||t.__parentId__!==e.__id__)continue;let a=t.__info__?.properties||{},o={};for(let r in a){let i=e.__childPropsBindings__?.[t.__id__]?.[r];i&&fr(i,n)&&(o[r]=pr(i,e.data))}Object.keys(o).length>0&&(t.tO?.(o),t.__pendingSyncedProps__=t.__pendingSyncedProps__||{},Object.assign(t.__pendingSyncedProps__,o),i.push({child:t,data:o}))}return i}var mr=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],hr=[`show`,`hide`,`resize`,`routeDone`],gr=class{constructor(e,t){this.initd=!1,this.opts=t,t.targetInfo&&(this.id=t.targetInfo.id,this.dataset=t.targetInfo.dataset,this.__targetInfo__=t.targetInfo),this.is=t.path,this.route=t.path,this.query=t.query,this.renderer=`webview`,this.bridgeId=t.bridgeId,this.id||=t.bridgeId,this.behaviors=e.behaviors,this.data=le(e.noReferenceData),Object.defineProperty(this,"properties",{get(){return this.data},enumerable:!0,configurable:!1}),this.__isComponent__=e.isComponent,this.__type__=e.type,this.__id__=this.opts.moduleId,this.__info__=e.moduleInfo,this.__eventAttr__=t.eventAttr,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1}init(){if(this.__isComponent__)for(let e in this.__info__.properties)!Object.prototype.hasOwnProperty.call(this.opts.properties,e)||this.opts.properties[e]===void 0?this.data[e]=this.__info__.properties[e]?.value??null:this.data[e]=this.opts.properties[e];return this.#d(),this.#f(),this.#t(),this.#e(),this.#m().then(()=>{nr(this),T.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}})})}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],H(this.bridgeId,this.__id__,{},V(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&n(this.__info__.export)&&(this.export=this.__info__.export.bind(this))}#t(){let e=this.__info__.relations;if(!(!e||typeof e!=`object`))for(let[t]of Object.entries(e)){let e=this.#n(t);this.__relationPaths__.set(t,e),this.__relations__.has(t)||this.__relations__.set(t,[])}}#n(e){if(e.startsWith(`./`)){let t=this.is.lastIndexOf(`/`);return t===-1?e.substring(2):`${this.is.substring(0,t)}/${e.substring(2)}`}else if(e.startsWith(`../`)){let t=this.is.split(`/`),n=e.split(`/`),r=t.slice(0,-1);for(let e of n)e===`..`?r.pop():e!==`.`&&r.push(e);return r.join(`/`)}else return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(Q.instances[this.bridgeId]||{});for(let[n,r]of Object.entries(e)){let{type:e,target:i}=r,a=this.__relationPaths__.get(n),o=t.filter(e=>i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`)).filter(t=>this.#o(t,e)||this.#a(t,e));for(let e of o)this.#c(n,e,r)}this.#i()}#i(){let e=Object.values(Q.instances[this.bridgeId]||{});for(let t of e)t!==this&&t._checkRelationsWithTarget&&t._checkRelationsWithTarget(this)}_checkRelationsWithTarget(e){let t=this.__info__.relations;if(t)for(let[n,r]of Object.entries(t)){let{type:t,target:i}=r,a=this.__relationPaths__.get(n),o=!1;o=i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`);let s=this.#o(e,t),c=this.#a(e,t);o&&(s||c)&&this.#c(n,e,r)}}#a(e,t){if(t!==`descendant`&&t!==`ancestor`)return!1;let n=t===`descendant`?`ancestor`:`descendant`,r=e.__info__?.relations;return r?Object.entries(r).some(([t,r])=>{let i=e.__relationPaths__?.get(t);return r.type===n&&(this.is===i||this.is.endsWith(`/${i}`))}):!1}#o(e,t){let n=Object.values(Q.instances[this.bridgeId]||{});switch(t){case`parent`:return e.__id__===this.__parentId__;case`child`:return e.__parentId__===this.__id__;case`ancestor`:return this.#s(e.__id__,this.__id__,n);case`descendant`:return this.#s(this.__id__,e.__id__,n);default:return!1}}#s(e,t,n){let r=n.find(e=>e.__id__===t);for(;r&&r.__parentId__;){if(r.__parentId__===e)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}#c(e,t,r){let i=this.__relations__.get(e)||[];if(!i.includes(t)&&(i.push(t),this.__relations__.set(e,i),n(r.linked)))try{r.linked.call(this,t)}catch(e){console.error(`[service] relation linked error:`,e)}}#l(e,t,r){let i=this.__relations__.get(e)||[],a=i.indexOf(t);if(a!==-1&&(i.splice(a,1),this.__relations__.set(e,i),n(r.unlinked)))try{r.unlinked.call(this,t)}catch(e){console.error(`[service] relation unlinked error:`,e)}}#u(e,t,r){if(n(r.linkChanged))try{r.linkChanged.call(this,t)}catch(e){console.error(`[service] relation linkChanged error:`,e)}}setData(e,t){let r=U(e),i={};for(let e in r)i[e]=this.data[e],re(this.data,e,r[e]);if(this.__info__.observers&&ar(Object.keys(r),this.__info__.observers,this.data,this,i),G(this,Object.keys(r),i),cr(this,Object.keys(r),i),!this.initd){n(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}if(this.__groupSetDataMode__){for(let e in r)this.__groupSetDataBuffer__[e]=r[e];n(t)&&this.__groupSetDataCallbacks__.push(t);return}let a=J(this,Q.instances[this.bridgeId],r);H(this.bridgeId,this.__id__,r,V(this,t)),a.forEach(({child:e,data:t})=>{H(this.bridgeId,e.__id__,t)})}#d(){mr.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&hr.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(e===`show`?e=`onShow`:e===`hide`&&(e=`onHide`),this[e]=t.bind(this))})}#f(){let e=this.__info__.methods;for(let t in e)n(e[t])&&(this[t]=e[t].bind(this))}#p(){if(!this.__isComponent__||!this.__info__.properties||this.__initialPropertyObserversInvoked__)return;let e=[];for(let t of Object.keys(this.__info__.properties)){let i=this.__info__.properties[t]?.observer,a=this.data[t];r(i)?e.push(()=>this[i]?.(a,void 0)):n(i)&&e.push(()=>i.call(this,a,void 0))}e.forEach(e=>e()),this.__initialPropertyObserversInvoked__=!0}async#m(){this.__isComponent__?(await this.componentCreated(),await this.componentAttached()):(await this.componentCreated(),await this.componentAttached(),await this.onLoad?.(this.opts.query||{})),this.initd=!0}tO(e){let t={};for(let[n,r]of Object.entries(e)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,n)&&a(this.__pendingSyncedProps__[n],r)){this.data[n]=r,delete this.__pendingSyncedProps__[n];continue}t[n]=r}if(Object.keys(t).length===0)return;let n=[],r={};for(let[e,i]of Object.entries(t)){let t=this.data[e];r[e]=t,this.data[e]=i,this.__info__.observers&&n.push(()=>or(e,this.__info__.observers,this.data,this,t))}n.forEach(e=>e()),G(this,Object.keys(t),Object.fromEntries(Object.keys(t).map(e=>[e,void 0]))),ur(this,Object.keys(t),r)}getPageId(){return this.__id__}hasBehavior(e){let t=function(n){if(!Array.isArray(n))return!1;if(n.includes(e))return!0;for(let e of n)if(e&&e.behaviors&&t(e.behaviors))return!0;return!1};return t(this.behaviors)}createSelectorQuery(){return L().in(this)}selectComponent(e){let t=Object.values(Q.instances[this.bridgeId]),n=t.find(n=>K(n,this.__id__,t)&&q(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Q.instances[this.bridgeId]);return t.filter(n=>K(n,this.__id__,t)&&q(e,n))}selectOwnerComponent(){let e=Object.values(Q.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Zn(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,$n(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];try{e.call(this)}catch(e){console.error(`[service] groupSetData callback error:`,e)}finally{if(this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__&&Object.keys(this.__groupSetDataBuffer__).length>0){let e=this.__groupSetDataBuffer__,t=this.__groupSetDataCallbacks__;this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];let n=J(this,Q.instances[this.bridgeId],e);H(this.bridgeId,this.__id__,e,V(this,t)),n.forEach(({child:e,data:t})=>{H(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];er(this.bridgeId)}}createMediaQueryObserver(){console.warn(`[service] 暂不支持 createMediaQueryObserver`)}getRelationNodes(e){return e?[...this.__relations__.get(e)||[]]:(console.warn(`[service] getRelationNodes 需要传入关系路径参数`),[])}animate(){console.warn(`[service] 暂不支持 animate`)}clearAnimation(){console.warn(`[service] 暂不支持 clearAnimation`)}async triggerEvent(e,t,n={}){if(!e)return;let r=e.trim(),i=sr(this.__eventAttr__,r);i&&await Q.triggerEvent({bridgeId:this.bridgeId,moduleId:this.__pageId__,methodName:i,event:{type:r,detail:t,currentTarget:{id:this.id,dataset:this.dataset},target:{id:this.id,dataset:this.dataset}}}),n.bubbles&&await Q.instances[this.bridgeId][this.__parentId__]?.triggerEvent(e,t),n.composed,n.capturePhase}pageReady(){this.__isComponent__||this.ready?.()}pageUnload(){this.__isComponent__||this.onUnload?.()}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;this.onPageScroll?.({scrollTop:t})}}pageShow(){this.__info__.behaviorPageLifetimes?.show?.forEach(e=>e.call(this)),this.onShow?.()}pageHide(){this.__info__.behaviorPageLifetimes?.hide?.forEach(e=>e.call(this)),this.onHide?.()}pageResize(e){this.__info__.behaviorPageLifetimes?.resize?.forEach(t=>t.call(this,e)),this.resize?.(e)}componentRouteDone(){this.__info__.behaviorPageLifetimes?.routeDone?.forEach(e=>e.call(this)),this.routeDone?.()}async componentCreated(){this.__info__.behaviorLifetimes?.created?.forEach(e=>e.call(this)),await this.created?.()}async componentAttached(){this.__info__.behaviorLifetimes?.attached?.forEach(e=>e.call(this)),await this.attached?.(),this.#r()}componentReadied(){this.#p(),this.__info__.behaviorLifetimes?.ready?.forEach(e=>e.call(this)),this.ready?.()}componentMoved(){this.moved?.();let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=this.__relations__.get(t)||[];for(let r of e)this.#u(t,r,n)}}componentDetached(){let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=[...this.__relations__.get(t)||[]];for(let r of e)this.#l(t,r,n)}this.#h(),this.__info__.behaviorLifetimes?.detached?.forEach(e=>e.call(this)),this.detached?.(),this.initd=!1}#h(){let e=Object.values(Q.instances[this.bridgeId]||{});for(let t of e)if(!(t===this||!t.__relations__))for(let[e,r]of t.__relations__.entries()){let i=r.indexOf(this);if(i!==-1){r.splice(i,1),t.__relations__.set(e,r);let a=t.__info__.relations?.[e];if(a&&n(a.unlinked))try{a.unlinked.call(t,this)}catch(e){console.error(`[service] relation unlinked error:`,e)}}}}componentError(e){this.error?.(e)}},Y=class e{static type=`component`;constructor(t,n){this.moduleInfo=t,this.extraInfo=n,this.type=e.type,this.isComponent=this.extraInfo.component,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,dr(this.moduleInfo,this.behaviors),this.noReferenceData=U(this.moduleInfo.data||{})}getProps(){let e=rr(this.moduleInfo.properties);if(Array.isArray(this.moduleInfo.externalClasses)&&this.moduleInfo.externalClasses.length>0){e||={};for(let t of this.moduleInfo.externalClasses)e[t]={type:[`s`],cls:!0}}return e}},_r=class{constructor(e,t){this.initd=!1,this.opts=t,this.is=t.path,this.route=t.path,this.bridgeId=t.bridgeId,this.id=t.bridgeId,this.query=t.query,this.data=le(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init(){return this.#e(),this.#t().then(()=>{nr(this),T.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}})})}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],H(this.bridgeId,this.__id__,{},V(this,e))}setData(e,t){let r=U(e),i={},a=this.__info__||{};for(let e in r)i[e]=this.data[e],re(this.data,e,r[e]);if(a.observers&&ar(Object.keys(r),a.observers,this.data,this,i),G(this,Object.keys(r),i),!this.initd){n(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}let o=J(this,Q.instances[this.bridgeId],r);H(this.bridgeId,this.__id__,r,V(this,t)),o.forEach(({child:e,data:t})=>{H(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return L().in(this)}selectComponent(e){let t=Object.values(Q.instances[this.bridgeId]||{}),n=t.find(n=>K(n,this.__id__,t)&&q(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Q.instances[this.bridgeId]||{});return t.filter(n=>K(n,this.__id__,t)&&q(e,n)).map(e=>e.hasBehavior&&e.hasBehavior(`wx://component-export`)&&e.export?e.export():e)}#e(){for(let e in this.__info__){let t=this.__info__[e];n(t)?this[e]=t.bind(this):this[e]=t}}async#t(){this.__info__.behaviorLifetimes?.created?.forEach(e=>e.call(this)),await this.created?.(),this.__info__.behaviorLifetimes?.attached?.forEach(e=>e.call(this)),await this.attached?.(),await this.onLoad?.(this.opts.query||{}),this.initd=!0}pageShow(){this.__info__.behaviorPageLifetimes?.show?.forEach(e=>e.call(this)),this.onShow?.()}pageHide(){this.__info__.behaviorPageLifetimes?.hide?.forEach(e=>e.call(this)),this.onHide?.()}pageReady(){this.__info__.behaviorLifetimes?.ready?.forEach(e=>e.call(this)),this.ready?.(),this.onReady?.()}pageUnload(){this.__info__.behaviorLifetimes?.detached?.forEach(e=>e.call(this)),this.detached?.(),this.onUnload?.(),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;this.onPageScroll?.({scrollTop:t})}pageResize(e){this.__info__.behaviorPageLifetimes?.resize?.forEach(t=>t.call(this,e)),this.onResize?.(e)}},X=class e{static type=`page`;constructor(t,r){if(this.moduleInfo=t,this.extraInfo=r,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,dr(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&n(t)&&(this.moduleInfo[e]=t);this.noReferenceData=U(this.moduleInfo.data||{})}},vr=class{static type=`app`;constructor(e){this.moduleInfo=e}},Z=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a}=e;if(v&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}E.setInitId(n),S(`app`),S(r),T.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n}})}createAppModule(e){let t=new vr(e);this.staticModules[vr.type]=t}createModule(e,t,n){let{path:r,usingComponents:i}=t;if(!this.staticModules[r]){if(i)for(let e of Object.values(i))S(e);if(n===X.type){let n=new X(e,t);this.staticModules[r]=n}else if(n===Y.type){let n=new Y(e,t);this.staticModules[r]=n}else console.error(`[service] createModule ${n} error`)}}getPropsByPath(e){let t={};return this.getComponentProps(t,e),t}getComponentProps(e,t){if(t)for(let n of Object.values(t)){let t=this.staticModules[n];!t||e[n]||(e[n]=t.getProps(),this.getComponentProps(e,t.usingComponents))}}getAppModule(){return this.staticModules[vr.type]}getModuleByPath(e){return this.staticModules[e]}},Q=new class{constructor(){this.app=null,this.instances={}}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i]))return await e[i](a);console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e){if(this.app){console.log(`[service] app instance already existed`);return}let{scene:t,pagePath:n,query:r}=e,i=Z.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),this.app=new En(i,{scene:t,path:n,query:r})}appShow(){this.app?.appShow()}appHide(){this.app?.appHide()}stackShow(e){E.pushStack(e)}stackHide(e){E.popStack(e)}createInstance(e){let{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,targetInfo:l,stackId:u}=e,d=Z.getModuleByPath(r);if(!d){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},d.type===Y.type){let e=new gr(d,{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,targetInfo:l});return this.instances[t][n]=e,d.isComponent||E.push(e,u),e.init(),e}else if(d.type===X.type){let e=new _r(d,{bridgeId:t,moduleId:n,path:r,query:i});return this.instances[t][n]=e,E.push(e,u),e.init(),e}else console.error(`[service] ${d.type} instance is not exist.`)}moduleReady(e){let{bridgeId:t,moduleId:n,propBindings:r}=e,i=this.instances[t][n];if(i){if(r&&i.__parentId__){let e=this.instances[t]?.[i.__parentId__];e&&(e.__childPropsBindings__||={},e.__childPropsBindings__[n]=r)}if(i.__type__===Y.type){i.componentReadied(),i.__componentReadied__=!0,this.flushPendingEvents(i),i.flushInitSetDataCallbacks?.();let e=this.getPageInstance(t);e&&this.checkAndCallPageReady(t,e.__id__)}}}moduleUnmounted(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&(r.__type__===Y.type&&r.componentDetached(),delete this.instances[t][n])}pageShow(e){let{bridgeId:t}=e,n=this.instances[t];if(!n)return;let r=[];Object.values(n).forEach(e=>{e&&(e.__type__===X.type?r.push(e):e.__type__===Y.type&&(e.__isComponent__?e.pageShow():r.push(e)))}),r.forEach(e=>{e.pageShow()})}pageReady(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&(this.pageShow(e),r.__pageReadyPending__=!0,r.flushInitSetDataCallbacks?.(),this.checkAndCallPageReady(t,n))}getPageInstance(e){let t=this.instances[e];return t?Object.values(t).find(e=>e&&(e.__type__===X.type||e.__type__===Y.type&&!e.__isComponent__)):null}checkAndCallPageReady(e,t){let n=this.instances[e][t];if(!n||!n.__pageReadyPending__)return;let r=this.instances[e];if(!r){n.__pageReadyPending__=!1,n.pageReady();return}Object.values(r).filter(e=>e&&e.__type__===Y.type&&e.__isComponent__&&e.initd&&!e.__componentReadied__).length===0&&(n.__pageReadyPending__=!1,n.pageReady())}pageHide(e){let{bridgeId:t}=e,n=this.instances[t],r=[];Object.values(n).forEach(e=>{e&&(e.__type__===X.type?r.push(e):e.__type__===Y.type&&(e.__isComponent__?e.pageHide():r.push(e)))}),r.forEach(e=>{e&&e.pageHide()})}pageUnload(e){let{bridgeId:t}=e,n=this.instances[t];n&&(Object.values(n).forEach(e=>{e&&(e.__type__===Y.type&&e.componentDetached(),e.pageUnload())}),E.pop(),delete this.instances[t])}pageScroll(e){let{bridgeId:t,moduleId:n,scrollTop:r}=e,i=this.instances[t][n];i&&i.pageScrollTop({scrollTop:r})}pageResize(e){let{bridgeId:t,size:n}=e,r=this.instances[t];r&&Object.values(r).forEach(e=>{e&&(e.__type__===X.type?e.pageResize(n):e.__type__===Y.type&&(e.__isComponent__,e.pageResize(n)))})}componentError(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&r.__type__===Y.type&&r.componentError()}componentRouteDone(e){let{bridgeId:t}=e,n=this.instances[t];n&&Object.values(n).forEach(e=>{e?.__type__===Y.type&&e.componentRouteDone()})}async triggerEvent(e){let{bridgeId:t,moduleId:n,methodName:r,event:i}=e;if(r===void 0)return;let a=this.instances[t];if(!a){console.warn(`[service] No instances found for bridgeId: ${t}`);return}let o=a[n];if(!o){console.warn(`[service] triggerEvent ${t} ${n} ${r}, instance is not exist`);return}return o.__type__===Y.type&&o.__isComponent__&&!o.__componentReadied__?this.queuePendingEvent(o,{instance:o,bridgeId:t,moduleId:n,methodName:r,event:i}):this.dispatchEvent({instance:o,bridgeId:t,moduleId:n,methodName:r,event:i})}},yr=t({getEnterOptionsSync:()=>xr,getLaunchOptionsSync:()=>br});function br(){return Q.app?.options}function xr(){return Q.app?.options}var Sr=t({getLocation:()=>Cr,offLocationChange:()=>Or,onLocationChange:()=>Dr,openLocation:()=>Tr,startLocationUpdate:()=>wr,stopLocationUpdate:()=>Er});function Cr(e){return O(`getLocation`,e)}function wr(e){return O(`startLocationUpdate`,e)}function Tr(e){return O(`openLocation`,e)}function Er(e){return O(`stopLocationUpdate`,e)}function Dr(e){e&&O(`onLocationChange`,{success:C.store(e,!0)})}function Or(e){if(e){let t=C.store(e,!0);O(`offLocationChange`,{success:t}),C.remove(t)}else O(`offLocationChange`),C.remove()}var kr=t({createMapContext:()=>Ar});function Ar(e,t){return new jr({mapId:e,obj:t})}var jr=class{constructor(e){this.opts=e}addMarkers(e){return O(`addMarkers`,e)}removeMarkers(e){return O(`removeMarkers`,e)}includePoints(e){return O(`includePoints`,e)}setCenterOffset(e){return O(`setCenterOffset`,e)}getCenterLocation(e){return O(`getCenterLocation`,e)}getScale(e){return O(`getScale`,e)}moveToLocation(e){return O(`moveToLocation`,e)}translateMarker(e){return O(`translateMarker`,e)}addArc(e){return O(`addArc`,e)}removeArc(e){return O(`removeArc`,e)}},Mr=t({createInnerAudioContext:()=>Fr}),Nr=1,Pr=class{constructor(){this._audioId=Nr++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._currentTime=0,this._duration=0,this._buffered=0,this._paused=!0,this._listeners={},O(`audioCreate`,{audioId:this._audioId}),O(`audioListen`,{audioId:this._audioId,evtId:`audio_${this._audioId}`,keep:!0,success:e=>this._dispatch(e)})}_dispatch(e){if(!e||typeof e!=`object`)return;this._currentTime=e.currentTime||0,this._duration=e.duration||0,this._buffered=e.buffered||0,this._paused=!!e.paused;let t=this._listeners[e.event];if(t)for(let n of t.slice())n(e)}get src(){return this._src}set src(e){this._src=e,O(`audioSetProp`,{audioId:this._audioId,prop:`src`,value:e,startTime:this._startTime,loop:this._loop,volume:this._volume,playbackRate:this._playbackRate,autoplay:this._autoplay})}get startTime(){return this._startTime}set startTime(e){this._startTime=Number(e)||0,O(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,O(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,O(`audioSetProp`,{audioId:this._audioId,prop:`loop`,value:this._loop})}get volume(){return this._volume}set volume(e){this._volume=Math.max(0,Math.min(1,Number(e)||0)),O(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,O(`audioSetProp`,{audioId:this._audioId,prop:`playbackRate`,value:this._playbackRate})}get duration(){return this._duration}get currentTime(){return this._currentTime}get paused(){return this._paused}get buffered(){return this._buffered}play(){this._paused=!1,O(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,O(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,O(`audioStop`,{audioId:this._audioId})}seek(e){O(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){O(`audioDestroy`,{audioId:this._audioId}),this._listeners={}}_on(e,t){typeof t==`function`&&(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t))}_off(e,t){this._listeners[e]&&(t?this._listeners[e]=this._listeners[e].filter(e=>e!==t):this._listeners[e]=[])}onPlay(e){this._on(`play`,e)}onPause(e){this._on(`pause`,e)}onStop(e){this._on(`stop`,e)}onEnded(e){this._on(`ended`,e)}onError(e){this._on(`error`,e)}onTimeUpdate(e){this._on(`timeUpdate`,e)}onWaiting(e){this._on(`waiting`,e)}onSeeking(e){this._on(`seeking`,e)}onSeeked(e){this._on(`seeked`,e)}onCanplay(e){this._on(`canplay`,e)}offPlay(e){this._off(`play`,e)}offPause(e){this._off(`pause`,e)}offStop(e){this._off(`stop`,e)}offEnded(e){this._off(`ended`,e)}offError(e){this._off(`error`,e)}offTimeUpdate(e){this._off(`timeUpdate`,e)}offWaiting(e){this._off(`waiting`,e)}offSeeking(e){this._off(`seeking`,e)}offSeeked(e){this._off(`seeked`,e)}offCanplay(e){this._off(`canplay`,e)}};function Fr(){return new Pr}var Ir=t({chooseImage:()=>Br,compressImage:()=>zr,previewImage:()=>Rr,saveImageToPhotosAlbum:()=>Lr});function Lr(e){return O(`saveImageToPhotosAlbum`,e)}function Rr(e){return O(`previewImage`,e)}function zr(e){return O(`compressImage`,e)}function Br(e){return O(`chooseImage`,e)}var Vr=t({chooseMedia:()=>Wr,chooseVideo:()=>Ur,createVideoContext:()=>Hr});function Hr(e,t){return new Gr({videoId:e,obj:t})}function Ur(e){return O(`chooseVideo`,e)}function Wr(e){return O(`chooseMedia`,e)}var Gr=class{constructor(e){this.opts=e}play(){this.invoke(`play`)}pause(){this.invoke(`pause`)}stop(){this.invoke(`stop`)}seek(e){this.invoke(`seek`,{position:e})}playbackRate(e){this.invoke(`playbackRate`,{rate:e})}requestFullScreen(e={}){this.invoke(`requestFullScreen`,e)}exitFullScreen(){this.invoke(`exitFullScreen`)}requestBackgroundPlayback(e={}){this.invoke(`requestBackgroundPlayback`,e)}exitBackgroundPlayback(){this.invoke(`exitBackgroundPlayback`)}exitPictureInPicture(e={}){this.invoke(`exitPictureInPicture`,e)}showStatusBar(){this.invoke(`showStatusBar`)}hideStatusBar(){this.invoke(`hideStatusBar`)}invoke(e,t={}){O(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},Kr=t({exitMiniProgram:()=>Xr,navigateBackMiniProgram:()=>Yr,navigateToMiniProgram:()=>Jr,restartMiniProgram:()=>qr});function qr(e){return O(`restartMiniProgram`,e)}function Jr(e){return O(`navigateToMiniProgram`,e)}function Yr(e){return O(`navigateBackMiniProgram`,e)}function Xr(e){return O(`exitMiniProgram`,e)}var Zr=t({downloadFile:()=>Qr});function Qr(e){return O(`downloadFile`,e)}var $r=t({request:()=>ei});function ei(e){return O(`request`,e)}var ti=t({uploadFile:()=>ai}),ni=1;function ri(){return`upload_${Date.now()}_${ni++}`}function ii(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function ai(e={}){let t=ri(),n=ii(),r=ii(),i=C.store(e=>n.dispatch(e),!0,`${t}_progress`),a=C.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,C.remove(i),C.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{O(`uploadFile`,{...e,uploadId:t,progress:i,headersReceived:a,complete:c})}catch(e){throw c({errMsg:`uploadFile:fail ${e&&e.message?e.message:e}`}),e}return{abort(){s||O(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var oi=t({closeSocket:()=>ui,connectSocket:()=>ci,onSocketClose:()=>mi,onSocketError:()=>pi,onSocketMessage:()=>fi,onSocketOpen:()=>di,sendSocketMessage:()=>li}),si=class{constructor(e){this.socketId=e,this._readyState=0}send(e={}){let{data:t,success:r,fail:i,complete:a,...o}=e,s={socketId:this.socketId,data:t,...o};return n(r)&&(s.success=C.store(r)),n(i)&&(s.fail=C.store(i)),n(a)&&(s.complete=C.store(a)),O(`sendSocketMessage`,s)}close(e={}){let{code:t=1e3,reason:r=``,success:i,fail:a,complete:o,...s}=e,c={socketId:this.socketId,code:t,reason:r,...s};return n(i)&&(c.success=C.store(i)),n(a)&&(c.fail=C.store(a)),n(o)&&(c.complete=C.store(o)),O(`closeSocket`,c)}onOpen(e){if(n(e))return O(`onSocketOpen`,{socketId:this.socketId,callback:C.store(e,!0)})}offOpen(e){return O(`offSocketOpen`,{socketId:this.socketId,callback:e})}onMessage(e){if(n(e))return O(`onSocketMessage`,{socketId:this.socketId,callback:C.store(e,!0)})}offMessage(e){return O(`offSocketMessage`,{socketId:this.socketId,callback:e})}onError(e){if(n(e))return O(`onSocketError`,{socketId:this.socketId,callback:C.store(e,!0)})}offError(e){return O(`offSocketError`,{socketId:this.socketId,callback:e})}onClose(e){if(n(e))return O(`onSocketClose`,{socketId:this.socketId,callback:C.store(e,!0)})}offClose(e){return O(`offSocketClose`,{socketId:this.socketId,callback:e})}get readyState(){return this._readyState}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}};function ci(e={}){let{url:t,header:r={},protocols:i=[],tcpNoDelay:a=!1,perMessageDeflate:o=!1,timeout:s,forceCellularNetwork:c=!1,success:l,fail:u,complete:d,...ee}=e;if(!t){let e=Error(`url is required`);throw n(u)&&u(e),n(d)&&d(e),e}let f=`socket_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,p=new si(f),m={socketId:f,url:t,header:r,protocols:i,tcpNoDelay:a,perMessageDeflate:o,timeout:s,forceCellularNetwork:c,...ee};return n(l)&&(m.success=C.store(e=>{p._readyState=si.OPEN,l(e)})),n(u)&&(m.fail=C.store(e=>{p._readyState=si.CLOSED,u(e)})),n(d)&&(m.complete=C.store(d)),O(`connectSocket`,m),p}function li(e){return O(`sendSocketMessage`,e)}function ui(e){return O(`closeSocket`,e)}function di(e){return O(`onSocketOpen`,{callback:C.store(e,!0)})}function fi(e){return O(`onSocketMessage`,{callback:C.store(e,!0)})}function pi(e){return O(`onSocketError`,{callback:C.store(e,!0)})}function mi(e){return O(`onSocketClose`,{callback:C.store(e,!0)})}var hi=t({getAccountInfoSync:()=>gi});function gi(){return O(`getAccountInfoSync`)}var _i=t({authorize:()=>vi});function vi(e){return O(`authorize`,e)}var yi=t({login:()=>bi});function bi(e){return O(`login`,e)}var xi=t({login:()=>Si});function Si(e){return O(`login`,e)}var Ci=t({getPrivacySetting:()=>wi});function wi(e){return O(`getPrivacySetting`,e)}var Ti=t({getSetting:()=>Di,openSetting:()=>Ei});function Ei(e){return O(`openSetting`,e)}function Di(e){return O(`getSetting`,e)}var Oi=t({getUserInfo:()=>ki});function ki(e){return O(`getUserInfo`,e)}var Ai=t({requestPayment:()=>ji});function ji(e){return O(`requestPayment`,e)}var Mi=t({hideShareMenu:()=>Fi,showShareImageMenu:()=>Pi,showShareMenu:()=>Ni});function Ni(e){return O(`shareShareMenu`,e)}function Pi(e){return O(`showShareImageMenu`,e)}function Fi(e){return O(`hideShareMenu`,e)}var Ii=t({clearStorage:()=>Wi,clearStorageSync:()=>Bi,getStorage:()=>Hi,getStorageInfo:()=>Ki,getStorageInfoSync:()=>Gi,getStorageSync:()=>Ri,removeStorage:()=>Ui,removeStorageSync:()=>zi,setStorage:()=>Vi,setStorageSync:()=>Li});function Li(...e){return O(`setStorageSync`,e)}function Ri(e){return O(`getStorageSync`,e)}function zi(e){return O(`removeStorageSync`,e)}function Bi(){return O(`clearStorageSync`)}function Vi(e){return O(`setStorage`,e)}function Hi(e){return O(`getStorage`,e)}function Ui(e){return O(`removeStorage`,e)}function Wi(){return O(`clearStorage`)}function Gi(){return O(`getStorageInfoSync`)}function Ki(e){return O(`getStorageInfo`,e)}var qi=t({createAnimation:()=>Ji});function Ji(e={}){return new Yi(e)}var Yi=class{constructor({duration:e=400,timingFunction:t=`linear`,delay:n=0,transformOrigin:r=`50% 50% 0`}={}){this.actions=[],this.currentTransform={},this.currentStepAnimates=[],this.option={transition:{duration:e,timingFunction:t,delay:n},transformOrigin:r}}export(){let e=this.actions;return this.actions=[],{actions:e}}step(e={}){for(let e of this.currentStepAnimates)e.type===`style`?this.currentTransform[`${e.type}.${e.args[0]}`]=e:this.currentTransform[e.type]=e;return this.actions.push({animates:Object.keys(this.currentTransform).reduce((e,t)=>[].concat(...e,[this.currentTransform[t]]),[]),option:{transformOrigin:e.transformOrigin===void 0?this.option.transformOrigin:e.transformOrigin,transition:{duration:e.duration===void 0?this.option.transition.duration:e.duration,timingFunction:e.timingFunction===void 0?this.option.transition.timingFunction:e.timingFunction,delay:e.delay===void 0?this.option.transition.delay:e.delay}}}),this.currentStepAnimates=[],this}backgroundColor(e){return this.currentStepAnimates.push({type:`style`,args:[`background-color`,e]}),this}bottom(e){return this.currentStepAnimates.push({type:`style`,args:[`bottom`,b(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,b(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,b(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,ee=0,f=0,p=0,m=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,ee,f,p,m]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,b(e)]}),this}rotate(e=0){return this.currentStepAnimates.push({type:`rotate`,args:[e]}),this}rotate3d(e=0,t=0,n=0,r=0){return this.currentStepAnimates.push({type:`rotate3d`,args:[e,t,n,r]}),this}rotateX(e){return this.currentStepAnimates.push({type:`rotateX`,args:[e]}),this}rotateY(e){return this.currentStepAnimates.push({type:`rotateY`,args:[e]}),this}rotateZ(e){return this.currentStepAnimates.push({type:`rotateZ`,args:[e]}),this}scale(e=1,t=1){return this.currentStepAnimates.push({type:`scale`,args:[e,t]}),this}scale3d(e=1,t=1,n=1){return this.currentStepAnimates.push({type:`scale3d`,args:[e,t,n]}),this}scaleX(e=1){return this.currentStepAnimates.push({type:`scaleX`,args:[e]}),this}scaleY(e=1){return this.currentStepAnimates.push({type:`scaleY`,args:[e]}),this}scaleZ(e=1){return this.currentStepAnimates.push({type:`scaleZ`,args:[e]}),this}skew(e=0,t=0){return this.currentStepAnimates.push({type:`skew`,args:[e,t]}),this}skewX(e=0){return this.currentStepAnimates.push({type:`skewX`,args:[e]}),this}skewY(e=0){return this.currentStepAnimates.push({type:`skewY`,args:[e]}),this}top(e){return this.currentStepAnimates.push({type:`style`,args:[`top`,b(e)]}),this}translate(e=0,t=0){return this.currentStepAnimates.push({type:`translate`,args:[e,t]}),this}translate3d(e=0,t=0,n=0){return this.currentStepAnimates.push({type:`translate3d`,args:[e,t,n]}),this}translateX(e=0){return this.currentStepAnimates.push({type:`translateX`,args:[e]}),this}translateY(e=0){return this.currentStepAnimates.push({type:`translateY`,args:[e]}),this}width(e){return this.currentStepAnimates.push({type:`style`,args:[`width`,b(e)]}),this}},Xi=t({setBackgroundColor:()=>Qi,setBackgroundTextStyle:()=>Zi});function Zi(e){return O(`setBackgroundTextStyle`,e)}function Qi(e){return O(`setBackgroundColor`,e)}var $i=t({canvasToTempFilePath:()=>ra,createCanvasContext:()=>ta,createContext:()=>ea,createOffscreenCanvas:()=>Wn,drawCanvas:()=>na});function ea(){return new aa}function ta(e,t){return new aa(e,ia(t))}function na(e={}){let t={...e,moduleId:e.moduleId||ia(e.component)};delete t.component,O(`drawCanvas`,t,`render`)}function ra(e={},t){let n={...e,moduleId:e.moduleId||ia(t||e.component)};return delete n.component,O(`canvasToTempFilePath`,n,`render`)}function ia(e){return e?.__id__||E.getPageInfo()?.id}var aa=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[]}pushAction(e,...t){return this.actions.push({type:e,args:t}),this}getActions(){return this.actions.slice()}draw(e=!1,t){this.canvasId&&(na({canvasId:this.canvasId,moduleId:this.moduleId,actions:this.getActions(),reserve:e,success:t}),this.actions=[])}beginPath(){return this.pushAction(`beginPath`)}closePath(){return this.pushAction(`closePath`)}moveTo(e,t){return this.pushAction(`moveTo`,e,t)}lineTo(e,t){return this.pushAction(`lineTo`,e,t)}rect(e,t,n,r){return this.pushAction(`rect`,e,t,n,r)}arc(e,t,n,r,i,a=!1){return this.pushAction(`arc`,e,t,n,r,i,a)}quadraticCurveTo(e,t,n,r){return this.pushAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushAction(`bezierCurveTo`,e,t,n,r,i,a)}fill(){return this.pushAction(`fill`)}stroke(){return this.pushAction(`stroke`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillText(e,t,n,r){return this.pushAction(`fillText`,e,t,n,r)}drawImage(e,...t){return this.pushAction(`drawImage`,e,...t)}save(){return this.pushAction(`save`)}restore(){return this.pushAction(`restore`)}translate(e,t){return this.pushAction(`translate`,e,t)}rotate(e){return this.pushAction(`rotate`,e)}scale(e,t){return this.pushAction(`scale`,e,t)}setShadow(e,t,n,r){return this.pushAction(`setShadow`,e,t,n,r)}setFillStyle(e){return this.pushAction(`setFillStyle`,e)}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,e)}setGlobalAlpha(e){return this.pushAction(`setGlobalAlpha`,e)}setLineCap(e){return this.pushAction(`setLineCap`,e)}setLineJoin(e){return this.pushAction(`setLineJoin`,e)}setLineWidth(e){return this.pushAction(`setLineWidth`,e)}setMiterLimit(e){return this.pushAction(`setMiterLimit`,e)}setFontSize(e){return this.pushAction(`setFontSize`,e)}},oa=t({nextTick:()=>ua}),sa=[],ca=null;function la(){let e=sa;sa=[],ca=null;for(let t=0;t<e.length;t++)e[t]()}function ua(e){n(e)&&(sa.push(e),ca||=setTimeout(la,0))}var da=t({disableAlertBeforeUnload:()=>ya,enableAlertBeforeUnload:()=>va,hideLoading:()=>_a,hideToast:()=>pa,showActionSheet:()=>ga,showLoading:()=>ha,showModal:()=>ma,showToast:()=>fa});function fa(e){return O(`showToast`,e)}function pa(e){return O(`hideToast`,e)}function ma(e){return O(`showModal`,e)}function ha(e){return O(`showLoading`,e)}function ga(e){return O(`showActionSheet`,e)}function _a(e){return O(`hideLoading`,e)}function va(e){return O(`enableAlertBeforeUnload`,e)}function ya(e){return O(`disableAlertBeforeUnload`,e)}var ba=t({getMenuButtonBoundingClientRect:()=>Sa,offMenuButtonBoundingClientRectWeightChange:()=>wa,onMenuButtonBoundingClientRectWeightChange:()=>Ca}),xa=new Set;function Sa(){return O(`getMenuButtonBoundingClientRect`)}function Ca(e){n(e)&&xa.add(e)}function wa(e){n(e)?xa.delete(e):xa.clear()}var Ta=t({hideNavigationBarLoading:()=>ka,setNavigationBarColor:()=>Oa,setNavigationBarTitle:()=>Da,showNavigationBarLoading:()=>Ea});function Ea(e){return O(`showNavigationBarLoading`,e)}function Da(e){return O(`setNavigationBarTitle`,e)}function Oa(e){return O(`setNavigationBarColor`,e)}function ka(e){return O(`hideNavigationBarLoading`,e)}var Aa=t({startPullDownRefresh:()=>Ma,stopPullDownRefresh:()=>ja});function ja(e){return O(`stopPullDownRefresh`,e)}function Ma(e){return O(`startPullDownRefresh`,e)}var Na=t({pageScrollTo:()=>Pa});function Pa(e){return O(`pageScrollTo`,e)}var Fa=t({hideTabBar:()=>za,hideTabBarRedDot:()=>Ua,removeTabBarBadge:()=>Va,setTabBarBadge:()=>Ba,setTabBarItem:()=>La,setTabBarStyle:()=>Ia,showTabBar:()=>Ra,showTabBarRedDot:()=>Ha});function Ia(e){return O(`setTabBarStyle`,e)}function La(e){return O(`setTabBarItem`,e)}function Ra(e){return O(`showTabBar`,e)}function za(e){return O(`hideTabBar`,e)}function Ba(e){return O(`setTabBarBadge`,e)}function Va(e){return O(`removeTabBarBadge`,e)}function Ha(e){return O(`showTabBarRedDot`,e)}function Ua(e){return O(`hideTabBarRedDot`,e)}var Wa=t({onWindowResize:()=>Ga});function Ga(e){e&&O(`onWindowResize`,{success:e})}var Ka=Object.assign({"./core/base/app-event/index.js":De,"./core/base/index.js":Le,"./core/base/performance/index.js":Ve,"./core/base/subpackage/index.js":Ke,"./core/base/system/index.js":Ye,"./core/base/update/index.js":it,"./core/camera/index.js":ft,"./core/data-analysis/index.js":ht,"./core/device/bluetooth/index.js":vt,"./core/device/bluetooth-ble/index.js":At,"./core/device/clipboard/index.js":Wt,"./core/device/contact/index.js":qt,"./core/device/keyboard/index.js":Xt,"./core/device/memory/index.js":Qt,"./core/device/network/index.js":tn,"./core/device/phone/index.js":rn,"./core/device/scan/index.js":on,"./core/device/vibrate/index.js":cn,"./core/ext/index.js":dn,"./core/file/index.js":_n,"./core/life-cycle/index.js":yr,"./core/location/index.js":Sr,"./core/map/index.js":kr,"./core/media/audio/index.js":Mr,"./core/media/image/index.js":Ir,"./core/media/video/index.js":Vr,"./core/navigate/index.js":Kr,"./core/network/download/index.js":Zr,"./core/network/request/index.js":$r,"./core/network/upload/index.js":ti,"./core/network/websocket/index.js":oi,"./core/open-api/account-info/index.js":hi,"./core/open-api/authorize/index.js":_i,"./core/open-api/index.js":yi,"./core/open-api/login/index.js":xi,"./core/open-api/privacy/index.js":Ci,"./core/open-api/setting/index.js":Ti,"./core/open-api/user-info/index.js":Oi,"./core/payment/index.js":Ai,"./core/route/index.js":xe,"./core/share/index.js":Mi,"./core/storage/index.js":Ii,"./core/ui/animation/index.js":qi,"./core/ui/background/index.js":Xi,"./core/ui/canvas/index.js":$i,"./core/ui/custom-component/index.js":oa,"./core/ui/interaction/index.js":da,"./core/ui/menu/index.js":ba,"./core/ui/navigation-bar/index.js":Ta,"./core/ui/pull-down-refresh/index.js":Aa,"./core/ui/scroll/index.js":Na,"./core/ui/tab-bar/index.js":Fa,"./core/ui/window/index.js":Wa,"./core/wxml/intersection-observer/index.js":Xn,"./core/wxml/selector-query/index.js":Gn}),$={};for(let e of Object.values(Ka))for(let[t,n]of Object.entries(e))$[t]=n;function qa(e){for(let t of e||[])typeof t!=`string`||Object.prototype.hasOwnProperty.call($,t)||t in Object.prototype||Object.defineProperty($,t,{value:(...e)=>O(t,...e),writable:!0,enumerable:!0,configurable:!0})}var Ja=new Proxy($,{get(e,t,n){let r=Reflect.get(e,t,n);return typeof r==`function`||r!==void 0||t===`webpackJsonp`?r:(...e)=>O(t,...e)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),Ya=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}qa(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=Ja;globalThis.modRequire=S,globalThis.modDefine=fe,globalThis.global={},globalThis.App=e=>Z.createAppModule(e),globalThis.Page=e=>{Z.createModule(e,globalThis.__extraInfo,X.type)},globalThis.Component=e=>{Z.createModule(e,globalThis.__extraInfo,Y.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>{let t=Q.app;return!t&&e?.allowDefault?{}:t},globalThis.getCurrentPages=()=>E.stack()}},Xa={navigateBack:Ee,navigateTo:Te,reLaunch:Ce,redirectTo:we,switchTab:Se};return new class{constructor(){console.log(`[service] init`),this.env=Ya,this.message=T,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o}=e;o&&w.init(o),Z.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a})}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await Q.triggerEvent({bridgeId:t,moduleId:n,methodName:r,event:i});o!==void 0&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:t,moduleId:n,success:a,data:o}})}),this.message.on(`triggerCallback`,e=>{let{id:t,args:n}=e;C.invoke(t,n)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,scene:n,pagePath:r,query:i,stackId:a}=e;Q.createApp({scene:n,pagePath:r,query:i});let o=Z.getModuleByPath(r);if(!o){console.error(`[service] resourceLoaded: module not found, pagePath: ${r}`);return}let s=Z.getPropsByPath(o.usingComponents),c=`page_${g()}`;Q.createInstance({bridgeId:t,moduleId:c,path:r,query:i,stackId:a}),T.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:c,pagePath:r,initialProps:s,query:i}})}),this.message.on(`appShow`,()=>{Q.appShow()}),this.message.on(`appHide`,()=>{Q.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{Q.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{Q.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{Q.createInstance(e)}),this.message.on(`mR`,e=>{Q.moduleReady(e)}),this.message.on(`mU`,e=>{Q.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{Q.pageUnload(e)}),this.message.on(`pageShow`,e=>{Q.pageShow(e)}),this.message.on(`pageReady`,e=>{Q.pageReady(e)}),this.message.on(`pageHide`,e=>{Q.pageHide(e)}),this.message.on(`pagePullDownRefresh`,()=>{}),this.message.on(`pageReachBottom`,()=>{}),this.message.on(`pageShareAppMessage`,()=>{}),this.message.on(`pageScroll`,e=>{Q.pageScroll(e)}),this.message.on(`pageResize`,e=>{Q.pageResize(e)}),this.message.on(`onTabItemTap`,()=>{}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;Q.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{Q.componentError(e)}),this.message.on(`h5SdkAction`,async(e={})=>{let t=e?.name?.replace(/h5/i,``),{url:n}=e?.params?.data?.params||{};if(e.params&&(e.params.data={...e.params?.data,...e.params?.data?.params||{}}),t===`postMessage`&&e.parentWebViewId){let{moduleId:t,attrs:n,params:r}=e,i={detail:{data:[r?.data?.params?.data]}},a=n.message,o=e.parentWebViewId,s=await Q.triggerEvent({bridgeId:o,moduleId:t,methodName:a,event:i});s!==void 0&&this.message.send({type:`triggerCallback`,target:`service`,body:{bridgeId:o,moduleId:t,success:r?.success,data:s}})}Xa[t]?.({url:n,...e.params})})}}})();
6
+ `;console.error(`require ${e} error: ${a}`),n(globalThis.__diminaReportError)&&globalThis.__diminaReportError(t),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}v.async=async e=>new Promise((t,n)=>{try{t(v(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var y=new class{constructor(){this.callbacks={}}store(e,t,n=p()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.keep||delete this.callbacks[e],r.callback(t))}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},le=33554432;le/4;var ue=Math.floor(le/4/4);function de(e){let t=Number(e);if(!Number.isFinite(t))return null;let n=Math.abs(Math.trunc(t));return Number.isSafeInteger(n)?n:null}function fe(e,t,{allowZero:n=!1,transferable:r=!1}={}){let i=de(e),a=de(t);return i===null||a===null?`pixel dimensions must be finite non-zero safe integers`:i>4096||a>4096?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:i===0||a===0?n?null:`pixel dimensions must be finite non-zero safe integers`:i>Math.floor((r?ue:8388608)/a)?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:null}function b(e,t){if(e===void 0)return t;let n=Number(e);if(!Number.isFinite(n)||n<0)return t;let r=Math.floor(n);if(!Number.isSafeInteger(r)||r>4096)throw RangeError(`canvas dimensions exceed the maximum canvas bitmap`);return r}var pe=`__dimina_data_function_reference__`,me=1;function he(e){return{[pe]:e,version:me}}function ge(e){return typeof e==`object`&&!!e&&e.version===me&&typeof e[pe]==`string`&&Object.keys(e).length===2}function _e(e){return ge(e)?e[pe]:void 0}function ve(e,{mapFunction:t,mapReference:n}={},r=new WeakMap){if(typeof e==`function`)return t?t(e):e;if(typeof e!=`object`||!e)return e;if(ge(e))return n?n(e):e;if(e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Array.isArray(e)){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e}if(r.has(e))return r.get(e);let i=Array.isArray(e)?[]:{};r.set(e,i);for(let a of Object.keys(e))i[a]=ve(e[a],{mapFunction:t,mapReference:n},r);return i}var ye=new Set([String,Number,Boolean,Object,Array,null]);function be(e){return ye.has(e)}function xe(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function Se(e){return Array.isArray(e)?e.filter(be):[]}function Ce(e){let t,n=[],r;return be(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=Se(e.optionalTypes),r=e.value),be(t)||(t=n[0]??null),r===void 0&&(r=xe(t)),{type:t,optionalTypes:n,value:re(r)}}function we(e){return Array.isArray(e)}function Te(e){return we(e)&&e?.constructor?.name===Array.name}function Ee(e,t){return e===String?typeof t==`string`:e===Number?Number.isFinite(t):e===Boolean?typeof t==`boolean`:e===Object?t!==null&&t?.constructor===Object:e===Array?Te(t):t!==void 0}function De(e,t){typeof e==`function`&&e(t)}function Oe(e,t,{absent:n=!1,warn:r}={}){if(n)return re(e.value);for(let n of e.optionalTypes||[])if(Ee(n,t))return t;let i=e.type;if(i===String)return t==null?(De(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&De(r,`property received type-uncompatible value: expected <String> but got object-typed value. Forcely converted.`),String(t));if(i===Number){try{if(Number.isFinite(Number(t)))return Number(t)}catch{}return De(r,`property received type-uncompatible value: expected <Number> but ${typeof t==`number`?`got NaN or Infinity`:`got non-number value`}. Used 0 instead.`),0}return i===Boolean?!!t:i===Array?we(t)?t:(De(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(De(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var x=new class{constructor(){this.listeners=new Set,this.reset()}reset(){this.active=!1,this.snapshot={systemInfo:null,menuRect:null}}init(e={}){this.active=!0,this.snapshot={...this.snapshot,...e}}update(e={}){this.snapshot={...this.snapshot,...e},this.listeners.forEach(t=>t(e,this.snapshot))}onUpdate(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get(e){return this.active?this.snapshot[e]??null:null}getSystemInfo(){return this.get(`systemInfo`)}getMenuRect(){return this.get(`menuRect`)}};function ke(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var Ae={error:[],show:[],hide:[]},je,Me=!1,Ne=!1;function Pe(e,t){return`${t}${e===`error`?`Error`:e===`show`?`AppShow`:`AppHide`}`}function Fe(e,t){if(typeof t!=`function`){console.error(`${Pe(e,`on`)} should accept a function instead of ${typeof t}`);return}Ae[e].push(t)}function Ie(e,t){if(!t){Ae[e]=[];return}if(typeof t!=`function`){console.error(`${Pe(e,`off`)} should accept a function instead of ${typeof t}`);return}Ae[e]=Ae[e].filter(e=>e!==t)}function Le(e,t,n){try{e(...t)}catch(e){Me||S(e),console.error(`[service] ${n} error:`,e)}}function Re(e,t,n){for(let r of[...Ae[e]])Le(r,t,n)}function ze(e){Fe(`error`,e)}function Be(e){Ie(`error`,e)}function Ve(e){Fe(`show`,e)}function He(e){Ie(`show`,e)}function Ue(e){Fe(`hide`,e)}function We(e){Ie(`hide`,e)}function Ge(e){Re(`show`,[e],`wx.onAppShow`)}function Ke(){Re(`hide`,[],`wx.onAppHide`)}function qe(e){je=typeof e==`function`?e:void 0}function Je(e){if(typeof e==`string`)return e;if(e?.stack)return String(e.stack);if(e?.message)return String(e.message);try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}function S(e){let t=Je(e);if(Me)return console.error(`[service] error handler error:`,e),t;Me=!0;try{je&&Le(je,[t],`App.onError`),Re(`error`,[t],`wx.onError`)}finally{Me=!1}return t}function Ye(){if(Ne)return;Ne=!0;let e=e=>{S(e?.error||e?.message||e)};if(typeof globalThis.addEventListener==`function`){globalThis.addEventListener(`error`,e);return}let t=globalThis.onerror;globalThis.onerror=function(n,r,i,a,o){return e(o||n),typeof t==`function`&&t.call(this,n,r,i,a,o)}}var Xe=new WeakMap,Ze=new Map;function Qe(e){let t=Xe.get(e);if(t)return Ze.set(t,e),t;let n;do n=`data-function-${p()}`;while(Ze.has(n));return Xe.set(e,n),Ze.set(n,e),n}function $e(e){return Ze.get(e)}function et(e){return ve(e,{mapFunction(e){return he(Qe(e))}})}function tt(e){return ve(e,{mapReference(e){return $e(_e(e))||e}})}var C=new class e{constructor(){this.event=ke(),this.init()}init(){_?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){try{let t=tt(e);console.log(`[service] receive msg: `,_?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}catch(e){S(e),console.error(`[service] message handler error:`,e)}}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return _?e.prototype.send=function(e){let t=et(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=et(e);return DiminaServiceBridge.publish(t.body.bridgeId||``,t)},this.send(t)}invoke(t){return _?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},w=new class{#e=[];#t=``;setInitId(e){this.#t=e}push(e,t){this.stack(t).push(e)}pop(){this.stack().length>0&&this.stack().pop()}remove(e){for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t].pages,r=n.findIndex(t=>t.id===e);if(r!==-1){n.splice(r,1);return}}}getPageInfo(){let e=this.stack();return e[e.length-1]||{id:this.#t}}pushStack(e){let t={id:e,pages:[]};return this.#e.push(t),t}popStack(e){if(e){let t=this.#e.findIndex(t=>t.id===e);t!==-1&&this.#e.splice(t,1)}else this.#e.length>0&&this.#e.pop()}stack(e){if(e){let t=this.#e.find(t=>t.id===e);return t||=this.pushStack(e),t.pages}{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function nt(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var rt={getWindowInfo:()=>nt(x.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>x.getSystemInfo(),getAppBaseInfo:()=>nt(x.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>nt(x.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>x.getMenuRect()},it=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),at=new Set(`FileSystemManager.getSavedFileList,clearStorage,closeSocket,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,exitMiniProgram,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,navigateBackMiniProgram,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function ot(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function st(e,t){return it.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||at.has(e)}function ct(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:w.getPageInfo().id,params:t}};return n===`container`?C.invoke(r):C.send(r)}function lt(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{y.remove(a),y.remove(o)};a=y.store(e=>{s(),r(e)}),o=y.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{ct(e,t,n)}catch(e){s(),i(e)}})}function ut(e,t,r){let i,a,o,s=()=>{y.remove(i),y.remove(a)},c=()=>{y.remove(o),queueMicrotask(s)};return i=y.store(e=>{s(),n(t)&&t(e)}),a=y.store(e=>{s(),n(r)&&r(e)}),e.success=i,e.fail=a,{registerComplete(t,n,r){return o=y.store(e=>{c(),t(e)},n,r),e.complete=o,o}}}function dt(e){return i(e)||e===``}function ft({success:e,fail:t,keep:r,evtId:i}){return r||i!==void 0||!n(e)&&!n(t)?!1:(n(e)||dt(e))&&(n(t)||dt(t))}function T(e,t,r=`container`,i=!0){let a=rt[e];if(r===`container`&&a){let e=a();if(e)return e}let o,s=[];if(t===void 0){if(i&&st(e,t))return lt(e,{},r);o=t}else if(typeof t==`string`||Array.isArray(t))o=t;else if(n(t))o={success:y.store(t,!0)};else if(ot(t)){let{success:e,fail:r,complete:i,keep:a,evtId:c,...l}=t;o=l,c!==void 0&&(o.evtId=c);let u;if(ft({success:e,fail:r,keep:a,evtId:c}))u=ut(o,e,r),s.push(o.success,o.fail);else{let t=!a&&c===void 0;n(e)?(o.success=y.store(e,a,c),t&&s.push(o.success)):o.success=e,n(r)?(o.fail=y.store(r,a,c),t&&s.push(o.fail)):o.fail=r}n(i)?(o.complete=u?u.registerComplete(i,a,c):y.store(i,a,c),!a&&c===void 0&&s.push(o.complete)):o.complete=i}else{let{keep:n,...a}=t;if(delete a.evtId,!n&&i&&st(e,t))return o={...a},lt(e,o,r);o=a}try{return ct(e,o,r)}catch(e){for(let e of s)y.remove(e);throw e}}function pt(e,t,n=`container`){return T(e,t,n,!1)}var mt=t({navigateBack:()=>yt,navigateTo:()=>vt,reLaunch:()=>gt,redirectTo:()=>_t,switchTab:()=>ht});function ht(e){return e.url=te(w.getPageInfo().route,e.url),T(`switchTab`,e)}function gt(e){return e.url=te(w.getPageInfo().route,e.url),T(`reLaunch`,e)}function _t(e){let t=te(w.getPageInfo().route,e.url);if(w.getPageInfo().route!==t)return e.url=t,T(`redirectTo`,e)}function vt(e){return e.url=te(w.getPageInfo().route,e.url),T(`navigateTo`,e)}function yt(e){return T(`navigateBack`,e)}var bt=t({offAppHide:()=>Et,offAppShow:()=>Tt,offError:()=>St,offHide:()=>At,offShow:()=>Ot,onAppHide:()=>wt,onAppShow:()=>Ct,onError:()=>xt,onHide:()=>kt,onShow:()=>Dt});function xt(e){ze(e)}function St(e){Be(e)}function Ct(e){Ve(e)}function wt(e){Ue(e)}function Tt(e){He(e)}function Et(e){We(e)}function Dt(e){Ve(e)}function Ot(e){He(e)}function kt(e){Ue(e)}function At(e){We(e)}var jt=`difile://`,Mt=new Set([`about`,`blob`,`content`,`data`,`dimina`,`file`,`ftp`,`http`,`https`,`internal`,`javascript`,`resource`,`ws`,`wss`]);function Nt(e){if(typeof e!=`string`)throw TypeError(`virtualFilePrefix must be a string`);let t=e.trim().toLowerCase(),n=t.slice(0,-3);if(!/^[a-z][a-z0-9+.-]*:\/\/$/.test(t)||Mt.has(n))throw Error(`virtualFilePrefix must be a custom URI scheme ending in "://"`);return t}function Pt(e=globalThis){if(e.__VIRTUAL_FILE_PREFIX__!==void 0)return Nt(e.__VIRTUAL_FILE_PREFIX__);if(typeof e.name==`string`&&e.name)try{let t=JSON.parse(e.name);if(t&&typeof t==`object`&&t.virtualFilePrefix!==void 0)return Nt(t.virtualFilePrefix)}catch(e){if(e instanceof SyntaxError)return jt;throw e}return jt}var Ft=Pt(),It=`__diminaArrayBufferBase64`,Lt=`__diminaFileDataBase64`,Rt=`__diminaFileDataType`,E=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,zt=(()=>{let e={};for(let t=0;t<64;t++)e[E[t]]=t;return e})();function Bt(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Vt(e){return e&&e.buffer&&Bt(e.buffer)}function Ht(e){return Bt(e)?e:Vt(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Ut(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=E[t[r]>>2],n+=E[(t[r]&3)<<4|t[r+1]>>4],n+=E[(t[r+1]&15)<<2|t[r+2]>>6],n+=E[t[r+2]&63];return r<t.length&&(n+=E[t[r]>>2],r+1<t.length?(n+=E[(t[r]&3)<<4|t[r+1]>>4],n+=E[(t[r+1]&15)<<2],n+=`=`):(n+=E[(t[r]&3)<<4],n+=`==`)),n}function Wt(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=zt[t[e]],o=zt[t[e+1]],s=t[e+2]===`=`?0:zt[t[e+2]],c=t[e+3]===`=`?0:zt[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function Gt(e){let t=Ht(e);return t?{[Rt]:`base64`,[Lt]:Ut(t)}:e}function Kt(e,t=[`data`,`arrayBuffer`]){if(!e||typeof e!=`object`)return e;let n={...e};for(let e of t)e in n&&(n[e]=Gt(n[e]));return n}function qt(e){return e&&typeof e==`object`&&e[It]!==void 0?Wt(e[It]):e}function Jt(e){return e&&typeof e==`object`&&e.data!==void 0?{...e,data:qt(e.data)}:e}function Yt(e){if(!e||typeof e!=`object`||!e.entries||typeof e.entries!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.entries))t[n]=r&&typeof r==`object`&&r.data!==void 0?{...r,data:qt(r.data)}:r;return{...e,entries:t}}function Xt(e,t,n=0){if(!e||typeof e!=`object`||!t||e[It]===void 0)return e;let r=new Uint8Array(Wt(e[It]));new Uint8Array(t).set(r,n);let{[It]:i,...a}=e;return{...a,arrayBuffer:t}}function Zt(e){let t={...e},n=Ht(e?.arrayBuffer);return n&&(t.arrayBufferLength=n.byteLength,delete t.arrayBuffer),t}var Qt=class{constructor(e={}){this.mode=e.mode,this.size=e.size,this.lastAccessedTime=e.lastAccessedTime,this.lastModifiedTime=e.lastModifiedTime,this._isDirectory=!!e.isDirectory,this._isFile=!!e.isFile}isDirectory(){return this._isDirectory}isFile(){return this._isFile}};function $t(e){return e&&typeof e==`object`&&typeof e.size==`number`&&Object.prototype.hasOwnProperty.call(e,`isDirectory`)&&Object.prototype.hasOwnProperty.call(e,`isFile`)}function en(e){if(!e||typeof e!=`object`||typeof e.isDirectory==`function`&&typeof e.isFile==`function`)return e;if($t(e))return new Qt(e);if(Array.isArray(e))return e.map(e=>en(e));let t={};for(let[n,r]of Object.entries(e))t[n]=en(r);return t}function tn(e){if(e&&typeof e==`object`){if(e.stats!==void 0)return{...e,stats:en(e.stats)};if(e.statsMap!==void 0)return{...e,statsMap:en(e.statsMap)}}return en(e)}function nn(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function D(e,t,{transform:n=e=>e,prepare:r=e=>e}={}){let i=T(e,r(nn(t,n)));return i&&typeof i.then==`function`?i.then(n):i}function rn(e,t){let n=t?.arrayBuffer,r=t?.offset||0;return D(e,t,{prepare:Zt,transform:e=>Xt(e,n,r)})}var an=class{access(e){return D(`FileSystemManager.access`,e)}accessSync(e){return T(`FileSystemManager.accessSync`,e)}appendFile(e){return D(`FileSystemManager.appendFile`,e,{prepare:Kt})}appendFileSync(e,t,n){return T(`FileSystemManager.appendFileSync`,Kt({filePath:e,data:t,encoding:n}))}close(e){return D(`FileSystemManager.close`,e)}closeSync(e){return T(`FileSystemManager.closeSync`,e)}copyFile(e){return D(`FileSystemManager.copyFile`,e)}copyFileSync(e,t){return T(`FileSystemManager.copyFileSync`,{srcPath:e,destPath:t})}fstat(e){return D(`FileSystemManager.fstat`,e,{transform:tn})}fstatSync(e){return tn(T(`FileSystemManager.fstatSync`,e))}ftruncate(e){return D(`FileSystemManager.ftruncate`,e)}ftruncateSync(e){return T(`FileSystemManager.ftruncateSync`,e)}getFileInfo(e){return D(`FileSystemManager.getFileInfo`,e)}getSavedFileList(e){return D(`FileSystemManager.getSavedFileList`,e||{})}mkdir(e){return D(`FileSystemManager.mkdir`,e)}mkdirSync(e,t){return T(`FileSystemManager.mkdirSync`,{dirPath:e,recursive:t})}open(e){return D(`FileSystemManager.open`,e)}openSync(e){return T(`FileSystemManager.openSync`,e)}read(e){return rn(`FileSystemManager.read`,e)}readSync(e){return Xt(T(`FileSystemManager.readSync`,Zt(e)),e?.arrayBuffer,e?.offset||0)}readCompressedFile(e){return D(`FileSystemManager.readCompressedFile`,e,{transform:Jt})}readCompressedFileSync(e){return qt(T(`FileSystemManager.readCompressedFileSync`,e))}readdir(e){return D(`FileSystemManager.readdir`,e)}readdirSync(e){return T(`FileSystemManager.readdirSync`,e)}readFile(e){return D(`FileSystemManager.readFile`,e,{transform:Jt})}readFileSync(e,t,n,r){return qt(T(`FileSystemManager.readFileSync`,{filePath:e,encoding:t,position:n,length:r}))}readZipEntry(e){return D(`FileSystemManager.readZipEntry`,e,{transform:Yt})}removeSavedFile(e){return D(`FileSystemManager.removeSavedFile`,e)}rename(e){return D(`FileSystemManager.rename`,e)}renameSync(e,t){return T(`FileSystemManager.renameSync`,{oldPath:e,newPath:t})}rmdir(e){return D(`FileSystemManager.rmdir`,e)}rmdirSync(e,t){return T(`FileSystemManager.rmdirSync`,{dirPath:e,recursive:t})}saveFile(e){return D(`FileSystemManager.saveFile`,e)}saveFileSync(e,t){return T(`FileSystemManager.saveFileSync`,{tempFilePath:e,filePath:t})}stat(e){return D(`FileSystemManager.stat`,e,{transform:tn})}statSync(e,t){return tn(T(`FileSystemManager.statSync`,{path:e,recursive:t}))}truncate(e){return D(`FileSystemManager.truncate`,e)}truncateSync(e,t){return T(`FileSystemManager.truncateSync`,{filePath:e,length:t})}unlink(e){return D(`FileSystemManager.unlink`,e)}unlinkSync(e){return T(`FileSystemManager.unlinkSync`,e)}unzip(e){return D(`FileSystemManager.unzip`,e)}write(e){return D(`FileSystemManager.write`,e,{prepare:e=>Kt(e,[`arrayBuffer`,`data`])})}writeSync(e){return T(`FileSystemManager.writeSync`,Kt(e,[`arrayBuffer`,`data`]))}writeFile(e){return D(`FileSystemManager.writeFile`,e,{prepare:Kt})}writeFileSync(e,t,n){return T(`FileSystemManager.writeFileSync`,Kt({filePath:e,data:t,encoding:n}))}},on=Object.getOwnPropertyNames(an.prototype).filter(e=>e!==`constructor`),sn=null;function cn(){if(!sn){let e=new an;for(let t of on)e[t]=e[t].bind(e);sn=e}return sn}var ln=t({USER_DATA_PATH:()=>un,VIRTUAL_FILE_PREFIX:()=>Ft,fileSystemManagerAPINames:()=>dn,getFileSystemManager:()=>vn}),un=`${Ft}usr`,dn=[`access`,`stat`,`readFile`,`writeFile`,`appendFile`,`copyFile`,`rename`,`unlink`,`mkdir`,`rmdir`,`readdir`,`getFileInfo`,`saveFile`,`getSavedFileList`,`removeSavedFile`,`truncate`],fn=`is not supported by the devtools simulator: the service thread talks to the container over an asynchronous postMessage bridge, so a synchronous return value is impossible — use the async variant`,pn=`not supported by the devtools simulator (no container backend)`;function mn(e){return function(){throw Error(`FileSystemManager.${e} ${fn}`)}}function hn(e){return function(t={}){t.fail?.({errMsg:`${e}:fail ${pn}`}),t.complete?.()}}function gn(e){let t=Object.getPrototypeOf(e),n=new Set(dn),r=new Set([...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(e)]);for(let i of r)i===`constructor`||n.has(i)||typeof(Object.getOwnPropertyDescriptor(e,i)??Object.getOwnPropertyDescriptor(t,i))?.value==`function`&&(e[i]=i.endsWith(`Sync`)?mn(i):hn(i));return e}var _n;function vn(){return _n||=gn(cn()),_n}var yn=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],bn=t({canIUse:()=>wn,env:()=>xn}),xn={USER_DATA_PATH:`${Ft}usr`},Sn=new Set([`nextTick`,`onError`,`offError`,`onAppShow`,`onAppHide`,`offAppShow`,`offAppHide`,`onShow`,`offShow`,`onHide`,`offHide`,`createCanvas`,`createImage`,`onTouchStart`,`offTouchStart`,`onTouchMove`,`offTouchMove`,`onTouchEnd`,`offTouchEnd`,`onTouchCancel`,`offTouchCancel`,`getUpdateManager`,`UpdateManager`,...yn.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...dn.map(e=>`FileSystemManager.${e}`)]),Cn={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function wn(e){if(Sn.has(e))return!0;try{return T(`canIUse`,Object.hasOwn(Cn,e)?Cn[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var Tn=t({getPerformance:()=>En});function En(){return Dn.getInstance()}var Dn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new On,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new kn(this,e)}getEntries(){return this.entryList.getEntries()}getEntriesByName(e,t){return this.entryList.getEntriesByName(e,t)}getEntriesByType(e){return this.entryList.getEntriesByType(e)}setBufferSize(e){this.entryList.maxEntrySize=e}},On=class{constructor(){this._list=[],this.maxEntrySize=30}push(e){for(let t of e)this._list.length>=this.maxEntrySize&&this._list.shift(),this._list.push(t)}getEntriesByName(e,t){return this._entryFilter(e,t)}getEntriesByType(e){return this._entryFilter(null,e)}_entryFilter(e,t){return this._list.filter(n=>!(e&&e!==n.name||t&&t!==n.entryType))}getEntries(){return this._list}},kn=class{constructor(e,t){this.performance=e,this.entryTypes=[],this.callback=t,this.observerId=null,this.callbackId=null,this.connected=!1}observe(e={}){this.disconnect(),this.connected=!0,this.entryTypes=Array.isArray(e.entryTypes)?e.entryTypes:[],this.callbackId=y.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){T(`removePerformanceObserver`,{observerId:e.observerId},`render`),y.remove(this.callbackId),this.callbackId=null;return}let t=e?.data?.entryList?JSON.parse(e.data.entryList):[];this.connected&&t.length>0&&(this.performance.entryList.push(t),this.notify(t))},!0),T(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new On;t.push(e.filter(e=>{let t=!1;return this.entryTypes&&this.entryTypes.length>0&&this.entryTypes.forEach(n=>{e.entryType===n&&(t=!0)}),t})),typeof this.callback==`function`&&this.callback(t)}}disconnect(){this.connected=!1,this.observerId&&T(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&y.remove(this.callbackId),this.observerId=null,this.callbackId=null}},An=t({loadSubpackage:()=>Mn,preDownloadSubpackage:()=>jn});function jn(e){return T(`preDownloadSubpackage`,e)}function Mn(e){return T(`loadSubpackage`,e)}var Nn=t({getAppBaseInfo:()=>Vn,getDeviceInfo:()=>Hn,getSystemInfo:()=>Rn,getSystemInfoAsync:()=>Bn,getSystemInfoSync:()=>zn,getWindowInfo:()=>In,offThemeChange:()=>Wn,onThemeChange:()=>Un,openAppAuthorizeSetting:()=>Ln,openSystemBluetoothSetting:()=>Fn}),Pn=new Set;x.onUpdate(e=>{let t=e.systemInfo?.theme;t&&Pn.forEach(e=>e({theme:t}))});function Fn(e){return T(`openSystemBluetoothSetting`,e)}function In(e){return T(`getWindowInfo`,e)}function Ln(e){return T(`openAppAuthorizeSetting`,e)}function Rn(e){return new Promise(t=>{t(T(`getSystemInfo`,e))})}function zn(){return T(`getSystemInfoSync`)}function Bn(e){return T(`getSystemInfoAsync`,e)}function Vn(){return T(`getAppBaseInfo`)}function Hn(){return T(`getDeviceInfo`)}function Un(e){n(e)&&Pn.add(e)}function Wn(e){n(e)?Pn.delete(e):Pn.clear()}var Gn=t({getUpdateManager:()=>Zn}),Kn=`onUpdateStatusChange`,qn=`updatefail`,Jn=`updateready`,Yn=`noupdate`,Xn=`updating`;function Zn(){return Qn.getInstance()}var Qn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasAppliedUpdate=!1,this.updateFailed=!1,this.updateReady=!1,this.checkForUpdateResult=null,this.updateFailedListeners=[],this.updateReadyListeners=[],this.checkForUpdateListeners=[],C.on(Kn,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===qn){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===Jn){let e=this.checkForUpdateResult?.hasUpdate!==!0,t=!this.updateReady;this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},e&&this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),t&&this.emit(this.updateReadyListeners);return}if(t===Xn){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===Yn){this.checkForUpdateResult={hasUpdate:!1},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}typeof e.hasUpdate==`boolean`&&(this.checkForUpdateResult={hasUpdate:e.hasUpdate},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult))}emit(e,...t){e.slice().forEach(e=>{e(...t)})}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){if(!this.updateReady)console.error(`[applyUpdate]: update is not ready`);else if(this.hasAppliedUpdate)console.error(`[applyUpdate]: applyUpdate has been called`);else return this.hasAppliedUpdate=!0,T(`applyUpdate`)}onCheckForUpdate(e){typeof e==`function`&&(this.checkForUpdateListeners.push(e),this.checkForUpdateResult&&e(this.checkForUpdateResult))}onUpdateFailed(e){typeof e==`function`&&(this.updateFailedListeners.push(e),this.updateFailed&&e())}onUpdateReady(e){typeof e==`function`&&(this.updateReadyListeners.push(e),this.updateReady&&e())}};Qn.getInstance();var $n=t({createCameraContext:()=>er});function er(){return new tr}var tr=class{takePhoto(e={}){return T(`takePhoto`,e)}startRecord(e={}){return T(`startRecordCamera`,e)}stopRecord(e={}){return T(`stopRecordCamera`,e)}},nr=t({reportAnalytics:()=>rr,reportEvent:()=>ir});function rr(...e){return T(`reportAnalytics`,e)}function ir(e,t){return T(`reportAnalytics`,{eventId:e,data:t})}var ar=`__diminaArrayBufferBase64`,O=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,or=(()=>{let e={};for(let t=0;t<64;t++)e[O[t]]=t;return e})();function sr(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function cr(e){return sr(e)?e:e&&e.buffer&&sr(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function lr(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=O[t[r]>>2],n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=O[(t[r+1]&15)<<2|t[r+2]>>6],n+=O[t[r+2]&63];return r<t.length&&(n+=O[t[r]>>2],r+1<t.length?(n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=`${O[(t[r+1]&15)<<2]}=`):n+=`${O[(t[r]&3)<<4]}==`),n}function ur(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=or[t[e]],o=or[t[e+1]],s=t[e+2]===`=`?0:or[t[e+2]],c=t[e+3]===`=`?0:or[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function dr(e){let t=cr(e);return t?{[ar]:lr(t)}:e}function fr(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?ur(e[ar]):e}function pr(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=fr(r);return{...e,advertisData:fr(e.advertisData),serviceData:t}}function mr(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(pr)}}function hr(e){return!e||typeof e!=`object`?e:{...e,value:fr(e.value)}}function gr(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function _r(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=T(e,n(gr(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function vr(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=y.store(e=>t(n(e)),!0);return r.set(t,i),T(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),y.remove(n),T(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())y.remove(e);return r.clear(),T(t)}}}var yr=t({closeBluetoothAdapter:()=>Mr,getBluetoothAdapterState:()=>jr,getBluetoothDevices:()=>Ar,getConnectedBluetoothDevices:()=>kr,isBluetoothDevicePaired:()=>Nr,makeBluetoothPair:()=>Pr,offBluetoothAdapterStateChange:()=>Or,offBluetoothDeviceFound:()=>Dr,onBluetoothAdapterStateChange:()=>Er,onBluetoothDeviceFound:()=>Tr,openBluetoothAdapter:()=>wr,startBluetoothDevicesDiscovery:()=>Cr,stopBluetoothDevicesDiscovery:()=>Sr}),br=vr(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,mr),xr=vr(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function Sr(e){return T(`stopBluetoothDevicesDiscovery`,e)}function Cr(e){return T(`startBluetoothDevicesDiscovery`,e)}function wr(e){return T(`openBluetoothAdapter`,e)}function Tr(e){return br.on(e)}function Er(e){return xr.on(e)}function Dr(e){return br.off(e)}function Or(e){return xr.off(e)}function kr(e){return _r(`getConnectedBluetoothDevices`,e,{transform:mr})}function Ar(e){return _r(`getBluetoothDevices`,e,{transform:mr})}function jr(e){return T(`getBluetoothAdapterState`,e)}function Mr(e){return T(`closeBluetoothAdapter`,e)}function Nr(e){return T(`isBluetoothDevicePaired`,e)}function Pr(e){return T(`makeBluetoothPair`,e)}var Fr=t({closeBLEConnection:()=>Zr,createBLEConnection:()=>Xr,getBLEDeviceCharacteristics:()=>Yr,getBLEDeviceRSSI:()=>Jr,getBLEDeviceServices:()=>qr,getBLEMTU:()=>Qr,notifyBLECharacteristicValueChange:()=>Kr,offBLECharacteristicValueChange:()=>Gr,offBLEConnectionStateChange:()=>Wr,offBLEMTUChange:()=>ei,onBLECharacteristicValueChange:()=>Ur,onBLEConnectionStateChange:()=>Hr,onBLEMTUChange:()=>$r,readBLECharacteristicValue:()=>Vr,setBLEMTU:()=>Br,writeBLECharacteristicValue:()=>zr}),Ir=vr(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),Lr=vr(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,hr),Rr=vr(`onBLEMTUChange`,`offBLEMTUChange`);function zr(e){return _r(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:dr(e.value)}:e}})}function Br(e){return T(`setBLEMTU`,e)}function Vr(e){return T(`readBLECharacteristicValue`,e)}function Hr(e){return Ir.on(e)}function Ur(e){return Lr.on(e)}function Wr(e){return Ir.off(e)}function Gr(e){return Lr.off(e)}function Kr(e){return T(`notifyBLECharacteristicValueChange`,e)}function qr(e){return T(`getBLEDeviceServices`,e)}function Jr(e){return T(`getBLEDeviceRSSI`,e)}function Yr(e){return T(`getBLEDeviceCharacteristics`,e)}function Xr(e){return T(`createBLEConnection`,e)}function Zr(e){return T(`closeBLEConnection`,e)}function Qr(e){return T(`getBLEMTU`,e)}function $r(e){return Rr.on(e)}function ei(e){return Rr.off(e)}var ti=t({getClipboardData:()=>ri,setClipboardData:()=>ni});function ni(e){return T(`setClipboardData`,e)}function ri(e){return T(`getClipboardData`,e)}var ii=t({addPhoneContact:()=>oi,chooseContact:()=>ai});function ai(e){return T(`chooseContact`,e)}function oi(e){return T(`addPhoneContact`,e)}var si=t({hideKeyboard:()=>ci});function ci(e){return T(`hideKeyboard`,e)}var li=t({offMemoryWarning:()=>di,onMemoryWarning:()=>ui});function ui(e){return T(`onMemoryWarning`,e)}function di(e){return T(`offMemoryWarning`,e)}var fi=`__diminaArrayBufferBase64`,k=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,pi=Object.fromEntries([...k].map((e,t)=>[e,t]));function mi(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function hi(e){if(mi(e))return e;if(ArrayBuffer.isView(e)){let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=new Uint8Array(t.length);return n.set(t),n.buffer}return null}function gi(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=k[t[r]>>2],n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=k[(t[r+1]&15)<<2|t[r+2]>>6],n+=k[t[r+2]&63];return r<t.length&&(n+=k[t[r]>>2],r+1<t.length?(n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=`${k[(t[r+1]&15)<<2]}=`):n+=`${k[(t[r]&3)<<4]}==`),n}function _i(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=pi[t[e]],o=pi[t[e+1]],s=t[e+2]===`=`?0:pi[t[e+2]],c=t[e+3]===`=`?0:pi[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function vi(e){let t=hi(e);return t?{[fi]:gi(t)}:e}function yi(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:_i(t[fi])}}function bi(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function A(e,t,n={}){return T(e,{socketId:t,...n,keep:!0})}function j(e,t,n={},r=e=>e){let i=new Set,a,o,s;function c(){if(!a)return;let e=a;a=void 0,y.remove(e),o&&y.remove(o),o=void 0,T(t,{...n,callbackId:e,keep:!0})}return{on(t){if(typeof t!=`function`||(i.add(t),a))return;let c=y.store(e=>{o&&y.remove(o),o=void 0;let t=r(e);for(let e of[...i])e(t);s?.()},!0);a=c,o=y.store(()=>{a===c&&(y.remove(c),o&&y.remove(o),a=void 0,o=void 0)});try{return T(e,{...n,callbackId:c,success:c,fail:o,keep:!0})}catch(e){throw y.remove(c),o&&y.remove(o),a=void 0,o=void 0,e}},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return c()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return c();a&&y.remove(a),o&&y.remove(o),a=void 0,o=void 0},hasListeners(){return i.size>0},setAfterEmit(e){s=e}}}var xi=t({getNetworkType:()=>Ci,offNetworkStatusChange:()=>Ti,onNetworkStatusChange:()=>wi}),Si=j(`onNetworkStatusChange`,`offNetworkStatusChange`);function Ci(e){return T(`getNetworkType`,e)}function wi(e){return Si.on(e)}function Ti(e){return Si.off(e)}var Ei=t({makePhoneCall:()=>Di});function Di(e){return T(`makePhoneCall`,e)}var Oi=t({scanCode:()=>ki});function ki(e){return T(`scanCode`,e)}var Ai=t({offUserCaptureScreen:()=>Pi,onUserCaptureScreen:()=>Ni,setKeepScreenOn:()=>Fi}),ji=vr(`onUserCaptureScreen`,`offUserCaptureScreen`),Mi;function Ni(e){if(typeof e==`function`)return Mi&&Mi!==e&&ji.off(Mi),Mi=e,ji.on(e)}function Pi(e){if(typeof e!=`function`||e===Mi)return Mi=void 0,ji.off(e)}function Fi(e){return T(`setKeepScreenOn`,e)}var M={touchstart:[],touchmove:[],touchend:[],touchcancel:[]};function Ii(e,t){M[e]&&typeof t==`function`&&M[e].push(t)}function Li(e,t){if(M[e]){if(!t){M[e]=[];return}M[e]=M[e].filter(e=>e!==t)}}function Ri(e,t={}){if(M[e])for(let n of[...M[e]])try{n(t)}catch(e){S(e)}}var zi=t({offTouchCancel:()=>qi,offTouchEnd:()=>Gi,offTouchMove:()=>Ui,offTouchStart:()=>Vi,onTouchCancel:()=>Ki,onTouchEnd:()=>Wi,onTouchMove:()=>Hi,onTouchStart:()=>Bi});function Bi(e){Ii(`touchstart`,e)}function Vi(e){Li(`touchstart`,e)}function Hi(e){Ii(`touchmove`,e)}function Ui(e){Li(`touchmove`,e)}function Wi(e){Ii(`touchend`,e)}function Gi(e){Li(`touchend`,e)}function Ki(e){Ii(`touchcancel`,e)}function qi(e){Li(`touchcancel`,e)}var Ji=t({vibrateLong:()=>Xi,vibrateShort:()=>Yi});function Yi(e){return T(`vibrateShort`,e)}function Xi(e){return T(`vibrateLong`,e)}var Zi=t({extBridge:()=>Qi,extOffBridge:()=>ea,extOnBridge:()=>$i,offLoginStatusChanged:()=>na,onLoginStatusChanged:()=>ta});function Qi({event:e,module:t,data:r={},success:i,fail:a,complete:o},s){let c,l,u;return n(s)?(c=s,l=s):(c=i,l=a,u=o),T(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function $i({event:e,module:t,callBack:n,isSustain:r=!0}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOnBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOnBridge 参数 event 为空`);return}if(!n){console.error(`[ERROR]: extOnBridge 参数 callBack 为空`);return}let i=`${t}_${e}`;T(i,{evtId:i,keep:r,success:n})}function ea({event:e,module:t,callBack:n}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOffBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOffBridge 参数 event 为空`);return}let r=`${t}_${e}`;T(r,{evtId:r,success:n})}function ta(e){C.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function na(){C.off(`notifyLoginStatusChanged`)}var ra=new WeakSet;function ia(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!ra.has(e)){ra.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{ra.delete(e)}}S(t),console.error(`[service] ${r} error:`,t)}function N(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?ia(e,t,i):(S(t),console.error(`[service] ${i} error:`,t));return}}function P(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])N(e,a,n,r,i)}var aa=[`onLaunch`,`onShow`,`onHide`,`onError`],oa=[`globalData`],sa=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),qe(this.onError),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){aa.forEach(e=>{let t=this.appModule.moduleInfo[e];n(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)aa.includes(t)||oa.includes(t)||(this[t]=n(e[t])?e[t].bind(this):e[t])}invokeSomeLifecycle(){N(this,this.onLaunch,[this.options],`onLaunch`),N(this,this.onShow,[this.options],`onShow`),Ge(this.options)}appShow(e=this.options){N(this,this.onShow,[e],`onShow`),Ge(e)}appHide(){N(this,this.onHide,[],`onHide`),Ke()}},ca={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in ca)Object.freeze(ca[e]);var la=Object.freeze(ca),ua=[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],da=/^(([\w-]+\s)*)(\d+r?px)(\/(\d+\.?\d*(r?px)?))?\s+(.*)/,fa=/\d+\.?\d*px/,pa=/[ᄀ-ᅟ⺀-꓏가-힣豈-﫿︐-︙︰-﹯＀-⦆¢-₩]/,ma=class{constructor(e,t){this.type=e,this.data=t,this.colorStop=[]}addColorStop(e,t){this.colorStop.push([e,t])}},ha=class{constructor(e,t){this.image=e,this.repetition=t}};function ga(e){return typeof e==`string`?e:e?.src??e?._src??e}function _a(e,t,n,r){return new ma(`linear`,[e,t,n,r])}function va(e,t,n){return new ma(`radial`,[e,t,n])}function ya(e,t){if(t===void 0){console.error(`Failed to execute 'createPattern' on 'CanvasContext': 2 arguments required, but only 1 present.`);return}if(!ua.includes(t)){console.error(`Failed to execute 'createPattern' on 'CanvasContext': The provided type ('${t}') is not one of 'repeat', 'no-repeat', 'repeat-x', or 'repeat-y'.`);return}return new ha(ga(e),t)}function ba(e){return e instanceof ma?{__canvasStyle:`gradient`,type:e.type,data:[...e.data],colorStop:e.colorStop.map(([e,t])=>[e,t])}:e instanceof ha?{__canvasStyle:`pattern`,image:e.image,repetition:e.repetition}:e}function xa(e){let t=String(e).match(da);if(!t)return null;let n=t[1].trim().split(/\s/),r=Number.parseFloat(t[3]),i=t[7],a=[],o=`normal`,s=`normal`,c=()=>{a.push(`normal`),s=`normal`};return n.forEach((e,t)=>{[`italic`,`oblique`,`normal`].includes(e)?(a.push(e),o=e):[`bold`,`normal`].includes(e)?(a.push(e),s=e):t===0?(a.push(`normal`),o=`normal`):t===1&&c()}),n.length===1&&c(),{font:`${a.join(` `)} ${r}px ${i}`,fontStyle:o,fontWeight:s,fontSize:r,fontFamily:i}}function Sa(e,t){return String(e).replace(fa,`${t}px`)}function Ca(){try{if(typeof OffscreenCanvas==`function`)return new OffscreenCanvas(0,0).getContext(`2d`);if(typeof document<`u`&&typeof document.createElement==`function`)return document.createElement(`canvas`).getContext(`2d`)}catch{}return null}function wa(e,t,n,r){let i=String(t);if(e)try{e.font=n;let t=e.measureText(i)?.width;if(typeof t==`number`&&!Number.isNaN(t))return t}catch{}let a=typeof r==`number`&&r>0?r:10,o=0;for(let e of i)o+=pa.test(e)?1:.5;return o*a}var Ta=new Set([`2d`]),Ea=new Set([`webgl`,`experimental-webgl`,`webgl2`]),Da=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),Oa=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),ka=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),Aa=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),ja=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),Ma={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},Na=new Map,F=new Map,I=null,Pa=null,L={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713};function Fa(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function Ia(e,t){e&&t&&Na.set(e,t)}function La(e){return Na.get(e)||null}function Ra(e,t){return e&&e[Fa(t)]||null}function R(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>R(e));if(typeof e!=`object`)return e;if(e.__canvasTypedArray){if(e.__canvasTypedArray===`DataView`)return new DataView(new Uint8Array(e.data||[]).buffer);let t=globalThis[e.__canvasTypedArray];return typeof t==`function`?new t(e.data||[]):e.data||[]}if(e.__canvasImageData)return Ua(e.width,e.height,new Uint8ClampedArray(e.data||[]));let t={};for(let[n,r]of Object.entries(e))t[n]=R(r);return t}C.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{Ia(e,t)}),C.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{Ia(e,t)}),C.on(`pageUnload`,({bridgeId:e})=>{To(e)});var za=1,Ba=1;function Va(){let e=w.getPageInfo();return e?.bridgeId||e?.id||``}function z(e,t,n){let r=fe(e,t,n);if(r)throw RangeError(r)}var Ha=class{constructor(e,t,n){this.data=e,this.width=t,this.height=n,Object.defineProperty(this,"__diminaCanvasImageData",{value:!0})}get[Symbol.toStringTag](){return`ImageData`}};function Ua(e,t,n){let r=Math.abs(Math.trunc(Number(e))),i=Math.abs(Math.trunc(Number(t)));z(r,i);let a=n instanceof Uint8ClampedArray?n:new Uint8ClampedArray(n||r*i*4);if(a.length!==r*i*4)throw RangeError(`ImageData data length does not match its dimensions`);if(typeof globalThis.ImageData==`function`)try{return new globalThis.ImageData(a,r,i)}catch{}return new Ha(a,r,i)}function B(e,t,n){C.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function Wa(e){Promise.resolve().then(e)}function Ga(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ka(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function V(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};if(e.__diminaCanvasImageData||Object.prototype.toString.call(e)===`[object ImageData]`&&e.data instanceof Uint8ClampedArray)return z(e.width,e.height,{transferable:!0}),{__canvasImageData:!0,width:e.width,height:e.height,data:Array.from(e.data)};let t=Ka(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>V(e));if(Ga(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=V(r);return t}return e}function H(e){return Array.from(e).map(e=>V(e))}function U(e=`canvas_resource`){return`${e}_${p()}`}var qa=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=za++,this.canvas=e,this.resourceType=n,this.metadata=r,this.deleted=!1,new Proxy(this,{get(e,n){if(n in e){let t=e[n];return typeof t==`function`?t.bind(e):t}if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:H(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},Ja=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this._pendingCallback=null,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e,this.canvas.removeCallback(this._pendingCallback);let t=this.canvas.storeCallback((e={})=>{this._pendingCallback===t&&(this._pendingCallback=null);let r=e.value||{};e.ok?(this.width=r.width||this.width,this.height=r.height||this.height,n(this.onload)&&this.onload(r)):n(this.onerror)&&this.onerror(r)});this._pendingCallback=t;try{this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,callback:t})}catch(e){throw this.canvas.removeCallback(t,e),this._pendingCallback=null,e}}},W=Symbol(`invalid canvas 2d state`),Ya={direction:new Set([`inherit`,`ltr`,`rtl`]),fontKerning:new Set([`auto`,`normal`,`none`]),fontStretch:new Set([`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`]),fontVariantCaps:new Set([`normal`,`small-caps`,`all-small-caps`,`petite-caps`,`all-petite-caps`,`unicase`,`titling-caps`]),globalCompositeOperation:new Set(`source-over.source-in.source-out.source-atop.destination-over.destination-in.destination-out.destination-atop.lighter.copy.xor.multiply.screen.overlay.darken.lighten.color-dodge.color-burn.hard-light.soft-light.difference.exclusion.hue.saturation.color.luminosity.plus-lighter`.split(`.`)),imageSmoothingQuality:new Set([`low`,`medium`,`high`]),lineCap:new Set([`butt`,`round`,`square`]),lineJoin:new Set([`round`,`bevel`,`miter`]),textAlign:new Set([`start`,`end`,`left`,`right`,`center`]),textBaseline:new Set([`top`,`hanging`,`middle`,`alphabetic`,`ideographic`,`bottom`]),textRendering:new Set([`auto`,`optimizeSpeed`,`optimizeLegibility`,`geometricPrecision`])},Xa=new Set([`lineWidth`,`miterLimit`]),Za=new Set([`shadowBlur`]),Qa=new Set([`lineDashOffset`,`shadowOffsetX`,`shadowOffsetY`]),$a=new Set([`accentcolor`,`accentcolortext`,`activetext`,`buttonborder`,`buttonface`,`buttontext`,`canvas`,`canvastext`,`field`,`fieldtext`,`graytext`,`highlight`,`highlighttext`,`linktext`,`mark`,`marktext`,`selecteditem`,`selecteditemtext`,`visitedtext`]),eo=new Set([`caption`,`icon`,`menu`,`message-box`,`small-caption`,`status-bar`]),to=`[-+]?(?:\\d*\\.?\\d+)(?:[eE][-+]?\\d+)?`,no=`(?:%|cap|ch|cm|dvh|dvw|em|ex|ic|in|lh|mm|pc|pt|px|q|rcap|rch|rem|rex|ric|rlh|svh|svw|vmax|vmin|vh|vi|vb|vw)`,ro=RegExp(`(?:^|\\s)(?:(?:xx?-small|small|medium|large|xx?-large|xxx-large|smaller|larger)|${to}${no})(?:\\s*\\/[^\\s]+)?\\s+.+$`,`i`),io=RegExp(`^(?:normal|0|${to}${no})$`,`i`),ao=RegExp(`^${to}[a-z%]*$`,`i`);function oo(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}function so(e,t){let n=1,r=``;for(let i=t+1;i<e.length;i++){let t=e[i];if(r){t===r&&!oo(e,i)&&(r=``);continue}if(t===`"`||t===`'`)r=t;else if(t===`(`)n++;else if(t===`)`&&--n===0)return i+1}return-1}function co(e){let t=0,n=``;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===n&&!oo(e,r)&&(n=``);continue}if(i===`"`||i===`'`)n=i;else if(i===`(`)t++;else if(i===`)`&&--t<0)return!1}return t===0&&!n}function lo(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&!oo(e,n)&&(t=``);continue}if(r===`"`||r===`'`)t=r;else if(/^var\s*\(/i.test(e.slice(n)))return!0}return!1}function uo(e){if(typeof e!=`string`)return!1;let t=e.trim();if(!t||t.includes(`\0`)||lo(t))return!1;let n=t.toLowerCase();return n===`transparent`||n===`currentcolor`||Object.prototype.hasOwnProperty.call(la,n)||$a.has(n)||/^#[\da-f]{3,4}(?:[\da-f]{3,4})?$/i.test(t)?!0:t.includes(`(`)&&co(t)}function fo(e,t){let n=String(t).trim();if(!n||n.includes(`\0`)||lo(n))return W;if(e===`font`){let e=eo.has(n.toLowerCase())||ro.test(n);for(let t of n.matchAll(/\b(calc|clamp|max|min)\s*\(/gi)){let r=so(n,t.index+t[0].lastIndexOf(`(`));r>0&&/^(?:\s*\/[^\s]+)?\s+.+$/.test(n.slice(r))&&(e=!0)}return e||=co(n)&&/\s/.test(n),e?n:W}return e===`filter`?n===`none`||n.includes(`(`)&&co(n)?n:W:io.test(n)||ao.test(n)||n.includes(`(`)&&co(n)?n:W}function po(e,t){if(e===`globalCompositeOperation`&&String(t)===`normal`)return`source-over`;if(Ya[e]){let n=String(t);return Ya[e].has(n)?n:W}if(Xa.has(e)){let e=Number(t);return Number.isFinite(e)&&e>0?e:W}if(Za.has(e)){let e=Number(t);return Number.isFinite(e)&&e>=0?e:W}if(Qa.has(e)){let e=Number(t);return Number.isFinite(e)?e:W}if(e===`globalAlpha`){let e=Number(t);return Number.isFinite(e)&&e>=0&&e<=1?e:W}return e===`imageSmoothingEnabled`?!!t:[`font`,`filter`,`letterSpacing`,`wordSpacing`].includes(e)?fo(e,t):e===`shadowColor`?uo(t)?t:W:e===`fillStyle`||e===`strokeStyle`?typeof t==`string`&&uo(t)||t?.__canvasResourceId?t:W:t}var mo=Object.freeze({direction:`inherit`,fillStyle:`#000000`,filter:`none`,font:`10px sans-serif`,fontKerning:`auto`,fontStretch:`normal`,fontVariantCaps:`normal`,globalAlpha:1,globalCompositeOperation:`source-over`,imageSmoothingEnabled:!0,imageSmoothingQuality:`low`,letterSpacing:`0px`,lineCap:`butt`,lineDashOffset:0,lineJoin:`miter`,lineWidth:1,miterLimit:10,shadowBlur:0,shadowColor:`rgba(0, 0, 0, 0)`,shadowOffsetX:0,shadowOffsetY:0,strokeStyle:`#000000`,textAlign:`start`,textBaseline:`alphabetic`,textRendering:`auto`,wordSpacing:`0px`}),ho=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.measureContext=void 0,this.stateSequences=Object.create(null),this.state={...mo},this.confirmedState={...mo},this.confirmedStateSequences=Object.create(null),this.stateStack=[],new Proxy(this,{get(e,t){if(t in e)return typeof e[t]==`function`?e[t].bind(e):e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){if(typeof n==`symbol`||!(n in e.state))return Reflect.set(e,n,r);let i=e.confirmedState[n],a=po(n,r);if(a===W)return!0;e.state[n]=a;let o=(e.stateSequences[n]||0)+1;return e.stateSequences[n]=o,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:V(a),previousValue:V(i),feedback:`state`,sequence:o}),!0}})}applyFeedback(e={}){for(let t of e.state||[]){let e=R(t.value);(this.confirmedStateSequences[t.prop]||0)<=t.sequence&&(this.confirmedState[t.prop]=e,this.confirmedStateSequences[t.prop]=t.sequence),this.stateSequences[t.prop]===t.sequence&&(this.state[t.prop]=e);for(let n of this.stateStack)n.sequences[t.prop]===t.sequence&&(n.state[t.prop]=e)}}stateSequenceSnapshot(){return Object.fromEntries(Object.keys(this.state).map(e=>[e,this.stateSequences[e]||0]))}replaceState(e,{clearStack:t=!1}={}){for(let e of Object.keys(this.state))this.stateSequences[e]=(this.stateSequences[e]||0)+1;this.state={...e},t&&(this.stateStack=[])}restoreState(e){let t=Object.create(null);for(let n of Object.keys(this.state)){if(Object.is(this.state[n],e.state[n]))continue;let r=Math.max(this.stateSequences[n]||0,e.sequences[n]||0)+1;this.stateSequences[n]=r,t[n]=r}return this.state={...e.state},t}resetStateForBitmapResize(){return this.replaceState(mo,{clearStack:!0}),this.confirmedState={...mo},this.confirmedStateSequences={...this.stateSequenceSnapshot()},this.stateSequenceSnapshot()}getImageData(e,t,n,r){return this.canvas.getImageData({contextId:this.contextId,x:e,y:t,width:n,height:r})}toDataURL(e,t){return this.canvas.toDataURL(e,t)}call(e,t){let n;if(e===`save`?this.stateStack.push({state:{...this.state},sequences:this.stateSequenceSnapshot()}):e===`restore`&&this.stateStack.length>0?n=this.restoreState(this.stateStack.pop()):e===`reset`&&(n=this.resetStateForBitmapResize()),e===`measureText`){this.measureContext??=Ca();let e=xa(this.state.font)?.fontSize||10;return{width:wa(this.measureContext,t[0],this.state.font,e)}}if(e===`createImageData`)return t.length===1&&t[0]?.data instanceof Uint8ClampedArray?Ua(t[0].width,t[0].height):Ua(t[0],t[1]);let r=Da.has(e)?U():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:H(t),resultId:r,feedback:n&&Object.keys(n).length>0?`stateSnapshot`:void 0,stateSequences:n}),r)return new qa(this.canvas,r)}},go=class{constructor(e,t,n,r={}){return this.context=e,this.name=t,this.__canvasResourceId=n,this.constants=r.constants||{},new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e.constants,t))return e.constants[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){let n,r;if(e.startsWith(`create`))r=U(`webgl_extension_resource`),n=new qa(this.context.canvas,r,`${this.name}:${e}`),this.context.resources.set(r,n);else if(e.startsWith(`delete`)&&t[0]?.markDeleted)t[0].markDeleted();else if(e.startsWith(`is`)&&t[0]instanceof qa)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:H(t),resultId:r}),n}},_o=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...Ma,...Ga(r)?r:{}},this.capabilities=null,this.resources=new Map,this.extensions=new Map,this.properties=new Map,this.state=new Map,this.enabledCapabilities=new Set,this.errors=[],this.queryResults=new Map,this.contextLost=!1,this.creationFailed=!1,this.hasActualCapabilities=!1,this.initializeState(),this.updateCapabilities(i),new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(e.properties.has(t))return e.properties.get(t);if(Object.prototype.hasOwnProperty.call(e.capabilities?.constants||{},t))return e.capabilities.constants[t];if(Object.prototype.hasOwnProperty.call(L,t))return L[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.properties.set(n,r),e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:V(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(L.VIEWPORT,[0,0,e,t]),this.state.set(L.SCISSOR_BOX,[0,0,e,t]),this.state.set(L.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(L.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(L.DEPTH_CLEAR_VALUE,1),this.state.set(L.DEPTH_WRITEMASK,!0),this.state.set(L.DEPTH_FUNC,L.LESS),this.state.set(L.STENCIL_CLEAR_VALUE,0),this.state.set(L.LINE_WIDTH,1),this.state.set(L.CULL_FACE_MODE,L.BACK),this.state.set(L.FRONT_FACE,L.CCW),this.state.set(L.ACTIVE_TEXTURE,L.TEXTURE0),this.state.set(L.PACK_ALIGNMENT,4),this.state.set(L.UNPACK_ALIGNMENT,4),this.state.set(L.CURRENT_PROGRAM,null),this.state.set(L.ARRAY_BUFFER_BINDING,null),this.state.set(L.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(L.TEXTURE_BINDING_2D,null),this.state.set(L.FRAMEBUFFER_BINDING,null),this.state.set(L.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=R(e),r={...this.capabilities?.extensions||{}};for(let[e,t]of Object.entries(n.extensions||{}))r[e]={...r[e]||{},...t,constants:{...r[e]?.constants||{},...t.constants||{}}};this.capabilities={...this.capabilities||{},...n,constants:{...this.capabilities?.constants||{},...n.constants||{}},parameters:{...this.capabilities?.parameters||{},...n.parameters||{}},extensions:r,shaderPrecisionFormats:{...this.capabilities?.shaderPrecisionFormats||{},...n.shaderPrecisionFormats||{}}},this.hasActualCapabilities||=t,typeof this.capabilities.contextLost==`boolean`&&(this.contextLost=this.capabilities.contextLost)}applyFeedback(e={}){e.success===!1?(this.creationFailed=!0,this.contextLost=!0,this.canvas.handleContextCreationFailure(this.contextId,this.contextType,e.statusMessage)):e.capabilities&&this.updateCapabilities(e.capabilities,!0),typeof e.contextLost==`boolean`&&(this.contextLost=e.contextLost);for(let t of e.errors||[])this.queueError(t);for(let t of e.resources||[])this.resources.get(t.resourceId)?.updateMetadata(R(t.metadata));for(let t of e.queries||[])this.queryResults.set(t.key,this.deserializeFeedbackValue(t.value))}deserializeFeedbackValue(e){if(e?.__canvasResourceId)return this.resources.get(e.__canvasResourceId)||null;if(Array.isArray(e))return e.map(e=>this.deserializeFeedbackValue(e));if(e&&typeof e==`object`&&!e.__canvasTypedArray){let t={};for(let[n,r]of Object.entries(e))t[n]=this.deserializeFeedbackValue(r);return t}return R(e)}queueError(e){e&&e!==L.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(H(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:H(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=U(`webgl_${n}`),i={};n===`shader`?(i.shaderType=t[0],i.source=``,i.compileStatus=!1,i.infoLog=``):n===`program`&&(i.attachedShaders=[],i.linkStatus=!1,i.validateStatus=!1,i.infoLog=``);let a=new qa(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:H(t),resultId:r}),a}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:return this.getShaderParameter(t[0],t[1]);case`getProgramParameter`:return this.getProgramParameter(t[0],t[1]);case`getShaderInfoLog`:return t[0]?.metadata?.infoLog||``;case`getProgramInfoLog`:return t[0]?.metadata?.infoLog||``;case`getShaderSource`:return t[0]?.metadata?.source||null;case`getAttachedShaders`:return t[0]?.metadata?.attachedShaders?.slice()||[];case`getError`:return this.errors.shift()||(this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),L.NO_ERROR);case`isContextLost`:return this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),this.contextLost;case`isEnabled`:return this.enabledCapabilities.has(t[0]);case`checkFramebufferStatus`:return this.requestQuery(e,t,L.FRAMEBUFFER_COMPLETE);case`getContextAttributes`:return{...this.hasActualCapabilities&&this.capabilities?.contextAttributes?this.capabilities.contextAttributes:this.requestedAttributes};case`getSupportedExtensions`:return(this.capabilities?.supportedExtensions||[]).slice();case`getExtension`:return this.getExtension(t[0]);case`getShaderPrecisionFormat`:return this.getShaderPrecisionFormat(t[0],t[1]);case`getActiveAttrib`:case`getActiveUniform`:case`getBufferParameter`:case`getFramebufferAttachmentParameter`:case`getRenderbufferParameter`:case`getTexParameter`:case`getUniform`:case`getVertexAttrib`:case`getVertexAttribOffset`:return this.requestQuery(e,t)}let n=Oa.get(e)||ka.get(e);if(n)return this.createResource(e,t,n);if(ja.has(e)){let n=t[0];return n instanceof qa&&n.resourceType===ja.get(e)&&!n.deleted}Aa.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:H(t)};e===`compileShader`?(t[0]?.updateMetadata({compileStatus:!0}),r.feedback=`shader`):e===`linkProgram`||e===`validateProgram`?(t[0]?.updateMetadata(e===`linkProgram`?{linkStatus:!0}:{validateStatus:!0}),r.feedback=`program`):e===`readPixels`&&ArrayBuffer.isView(t[6])?(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[6]),r.typedArrayArgIndex=6):e===`getBufferSubData`&&ArrayBuffer.isView(t[2])&&(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[2]),r.typedArrayArgIndex=2),this.canvas.enqueueOperation(r)}updateState(e,t){switch(e){case`viewport`:this.state.set(L.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(L.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(L.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(L.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(L.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(L.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(L.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(L.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(L.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(L.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(L.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(L.ACTIVE_TEXTURE,t[0]);break;case`pixelStorei`:this.state.set(t[0],t[1]);break;case`enable`:this.enabledCapabilities.add(t[0]);break;case`disable`:this.enabledCapabilities.delete(t[0]);break;case`useProgram`:this.state.set(L.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===L.ARRAY_BUFFER?this.state.set(L.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===L.ELEMENT_ARRAY_BUFFER&&this.state.set(L.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===L.TEXTURE_2D&&this.state.set(L.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(L.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(L.RENDERBUFFER_BINDING,t[1]||null);break;case`shaderSource`:t[0]?.updateMetadata({source:String(t[1]??``)});break;case`attachShader`:{let e=t[0]?.metadata?.attachedShaders;e&&t[1]&&!e.includes(t[1])&&e.push(t[1]);break}case`detachShader`:{let e=t[0]?.metadata?.attachedShaders,n=e?.indexOf(t[1])??-1;n>=0&&e.splice(n,1);break}}}getParameter(e){if(this.state.has(e)){let t=this.state.get(e);return ArrayBuffer.isView(t)||Array.isArray(t)?t.slice():t}let t=this.capabilities?.parameters||{};return Object.prototype.hasOwnProperty.call(t,e)?R(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof qa)||e.resourceType!==`shader`)return null;switch(t){case L.DELETE_STATUS:return e.deleted;case L.SHADER_TYPE:return e.metadata.shaderType;case L.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof qa)||e.resourceType!==`program`)return null;switch(t){case L.DELETE_STATUS:return e.deleted;case L.LINK_STATUS:return!!e.metadata.linkStatus;case L.VALIDATE_STATUS:return!!e.metadata.validateStatus;case L.ATTACHED_SHADERS:return e.metadata.attachedShaders.length;default:return this.requestQuery(`getProgramParameter`,[e,t])}}getShaderPrecisionFormat(e,t){let n=`${e}:${t}`,r=this.capabilities?.shaderPrecisionFormats?.[n];return r?{...r}:this.requestQuery(`getShaderPrecisionFormat`,[e,t])}getExtension(e){let t=String(e||``),n=(this.capabilities?.supportedExtensions||[]).find(e=>e.toLowerCase()===t.toLowerCase());if(!n)return null;if(this.extensions.has(n))return this.extensions.get(n);let r=U(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new go(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},vo=class{constructor({nodeId:e,bridgeId:t=Va(),width:n=300,height:r=150,type:i=`2d`,offscreen:a=!1,webglCapabilities:o}){this.__diminaCanvasNode=!0,this.nodeId=e,this.bridgeId=t,this.type=i,this.offscreen=a,this.webglCapabilities=o||La(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingCallbacks=new Map,this.pendingStateFeedbacks=new Map,this.stateFeedbackByProperty=new Map,this.rafCallbacks=new Map,this.pendingOperations=[],this.flushScheduled=!1,this.disposed=!1,this._width=b(n,300),this._height=b(r,150),z(this._width,this._height,{allowZero:!0}),F.has(t)||F.set(t,new Set),F.get(t).add(this)}get width(){return this._width}reset2DStateAfterBitmapResize(){for(let[e,t]of this.contextsById){let n=t.resetStateForBitmapResize?.();n&&this.enqueueOperation({op:`contextStateSnapshot`,contextId:e,feedback:`stateSnapshot`,stateSequences:n})}}set width(e){let t=b(e,300);z(t,this._height,{allowZero:!0}),this._width=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width}),this.reset2DStateAfterBitmapResize()}get height(){return this._height}set height(e){let t=b(e,150);z(this._width,t,{allowZero:!0}),this._height=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height}),this.reset2DStateAfterBitmapResize()}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=Fa(n),i=Ea.has(n);if(!Ta.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?Ra(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=U(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:V(t)});let s=i?new _o(this,o,r,t,a):new ho(this,o);return this.activeContextType=r,this.contexts.set(r,s),this.contextsById.set(o,s),s}addEventListener(e,t){n(t)&&(this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t))}removeEventListener(e,t){this.eventListeners.get(e)?.delete(t)}dispatchEvent(e){if(!e?.type)return!0;let t=!1,r={...e,target:this,currentTarget:this,preventDefault(){t=!0,this.defaultPrevented=!0}};for(let t of this.eventListeners.get(e.type)||[])t.call(this,r);let i=this[`on${e.type}`];return n(i)&&i.call(this,r),!t}notifyContextCreationError(e=`WebGL context creation failed`){this.dispatchEvent({type:`webglcontextcreationerror`,statusMessage:e})}handleContextCreationFailure(e,t,n){let r=this.contextsById.get(e);this.contexts.get(t)===r&&(this.contexts.delete(t),this.activeContextType=null),this.contextsById.delete(e),this.notifyContextCreationError(n)}registerTypedArrayUpdate(e){let t=U(`canvas_typed_array_update`);return this.pendingTypedArrayUpdates.set(t,e),t}applyFlushFeedback(e={}){for(let[t,n]of Object.entries(e.contexts||{}))this.contextsById.get(t)?.applyFeedback?.(n);for(let t of e.typedArrays||[]){let e=this.pendingTypedArrayUpdates.get(t.id);if(e&&ArrayBuffer.isView(e)){let n=R(t.value);ArrayBuffer.isView(n)?e.set(n.subarray(0,e.length)):Array.isArray(n)&&e.set(n.slice(0,e.length))}this.pendingTypedArrayUpdates.delete(t.id)}}createImage(){return new Ja(this,U(`canvas_image`))}storeCallback(e,t){if(this.disposed)throw Error(`canvas node is disposed`);let n;return n=y.store(t=>{this.pendingCallbacks.delete(n),e(t)}),this.pendingCallbacks.set(n,t),n}releaseStateFeedback(e){let t=this.pendingStateFeedbacks.get(e);if(t){this.pendingStateFeedbacks.delete(e);for(let n of t)this.stateFeedbackByProperty.get(n)===e&&this.stateFeedbackByProperty.delete(n)}}removeCallback(e,t){if(!e||!this.pendingCallbacks.has(e))return;let n=this.pendingCallbacks.get(e);this.pendingCallbacks.delete(e),this.releaseStateFeedback(e),y.remove(e),n?.(t)}requestAnimationFrame(e){let t=Ba++,r=this.storeCallback(r=>{this.rafCallbacks.delete(t),n(e)&&e(r)});this.rafCallbacks.set(t,r);try{B(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r})}catch(e){throw this.removeCallback(r,e),this.rafCallbacks.delete(t),e}return t}cancelAnimationFrame(e){this.removeCallback(this.rafCallbacks.get(e)),this.rafCallbacks.delete(e),B(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){let a=fe(r,i,{transferable:!0});return a?Promise.reject(RangeError(a)):new Promise((a,o)=>{let s=this.storeCallback((e={})=>{if(!e.ok){o(Error(e.error||`canvas pixel read failed`));return}a(R(e.value))},e=>o(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s,resultEnvelope:!0})}catch(e){this.removeCallback(s,e)}})}toDataURL(e=`image/png`,t){return z(this._width,this._height,{allowZero:!0}),new Promise((n,r)=>{let i=this.storeCallback((e={})=>{if(!e.ok){r(Error(e.error||`canvas export failed`));return}n(e.value)},e=>r(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:i,resultEnvelope:!0})}catch(e){this.removeCallback(i,e)}})}dispose({notifyRender:e=!0}={}){if(this.disposed)return;this.disposed=!0;let t=Error(`canvas node disposed`);for(let e of[...this.pendingCallbacks.keys()])this.removeCallback(e,t);this.rafCallbacks.clear(),this.pendingOperations=[],this.pendingTypedArrayUpdates.clear(),this.pendingStateFeedbacks.clear(),this.stateFeedbackByProperty.clear(),this.eventListeners.clear();let n=F.get(this.bridgeId);if(n?.delete(this),n?.size===0&&F.delete(this.bridgeId),e)try{B(this.bridgeId,`disposeCanvasNodes`,{nodeIds:[this.nodeId]})}catch{}}enqueueOperation(e){if(this.disposed)throw Error(`canvas node is disposed`);this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,Wa(()=>this.flushOperations()))}compactStateFeedback(e){let t=new Set,n=(e,n={})=>{for(let[r,i]of Object.entries(n))i>0&&t.add(`${e}\0${r}\0${i}`)};for(let[e,t]of this.contextsById)if(t?.stateSequences&&(n(e,t.stateSequences),Array.isArray(t.stateStack)))for(let r of t.stateStack)n(e,r.sequences);return e.map(e=>{if(e.feedback===`state`){let n=`${e.contextId}\0${e.prop}\0${e.sequence}`;if(!t.has(n)){let t={...e};return delete t.feedback,t}}else if(e.feedback===`stateSnapshot`){let n=Object.fromEntries(Object.entries(e.stateSequences||{}).filter(([n,r])=>t.has(`${e.contextId}\0${n}\0${r}`)));if(Object.keys(n).length===0){let t={...e};return delete t.feedback,delete t.stateSequences,t}return{...e,stateSequences:n}}return e})}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.compactStateFeedback(this.pendingOperations);this.pendingOperations=[];let t=e.flatMap(e=>e.feedback===`state`?[`${e.contextId}:${e.prop}`]:e.feedback===`stateSnapshot`?Object.keys(e.stateSequences||{}).map(t=>`${e.contextId}:${t}`):[]),n=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback&&e.feedback!==`state`&&e.feedback!==`stateSnapshot`||e.typedArrayUpdateId),r;if(n||t.length>0){if(!n)for(let e of t){let t=this.stateFeedbackByProperty.get(e),n=this.pendingStateFeedbacks.get(t);n&&(n.delete(e),this.stateFeedbackByProperty.delete(e),n.size===0&&this.removeCallback(t))}if(r=this.storeCallback(e=>{this.releaseStateFeedback(r),this.applyFlushFeedback(e)}),!n){let e=new Set(t);this.pendingStateFeedbacks.set(r,e);for(let t of e)this.stateFeedbackByProperty.set(t,r)}}try{B(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:r})}catch(t){this.removeCallback(r,t);for(let n of e)this.removeCallback(n.callback,t);throw t}}};function yo(e,t=Va()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(Ia(t,e.webglCapabilities),new vo({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function bo(e,t=Va()){return Array.isArray(e)?e.map(e=>bo(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:yo(e.node,t)}:e}function xo(e={}){let t=b(e.width,300),n=b(e.height,150);z(t,n,{allowZero:!0});let r=e.type||`2d`,i=U(`offscreen_canvas`),a=Va();return B(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new vo({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:La(a)})}function So(e={}){if(I)return xo(e);let t=x.getSystemInfo()||{},n=b(e.width,t.windowWidth||300),r=b(e.height,t.windowHeight||150);z(n,r,{allowZero:!0});let i=e.type||`2d`,a=U(`game_canvas`),o=Va();return B(o,`createGameCanvas`,{nodeId:a,width:n,height:r,type:i}),I=new vo({nodeId:a,bridgeId:o,width:n,height:r,type:i,webglCapabilities:La(o)}),I}function Co(){return Pa||=xo({width:1,height:1,type:`2d`}),Pa.createImage()}function wo(){globalThis.GameGlobal=globalThis,globalThis.global=globalThis,globalThis.requestAnimationFrame=e=>{if(!I)throw Error(`requestAnimationFrame requires wx.createCanvas() first`);return I.requestAnimationFrame(e)},globalThis.cancelAnimationFrame=e=>{I?.cancelAnimationFrame(e)}}function To(e){let t=[...F.get(e)||[]],n=t.map(e=>e.nodeId);for(let e of t)e.dispose({notifyRender:!1});if(n.length>0)try{B(e,`disposeCanvasNodes`,{nodeIds:n})}catch{}F.delete(e),Na.delete(e),I?.bridgeId===e&&(I=null),Pa?.bridgeId===e&&(Pa=null)}var Eo=t({createSelectorQuery:()=>Do});function Do(){return new jo}function Oo(){return w.getPageInfo()}function ko(){let e=Oo();return e?.__id__||e?.id}function Ao(){let e=Oo();return e?.bridgeId||e?.id}var jo=class{constructor(){this.__componentId=ko(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Mo(this,this.__componentId,e,!0)}selectAll(e){return new Mo(this,this.__componentId,e,!1)}selectViewport(){return new Mo(this,ko(),``,!0)}__push(e,t,n,r,i){this.__taskQueue.push({moduleId:t,selector:e,single:n,fields:r}),this.__cbQueue.push(i)}exec(e){let t=this,r=Ao();T(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=bo(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Mo=class{constructor(e,t,n,r){this.__selectorQuery=e,this.__moduleId=t,this.__selector=n,this.__single=r}fields(e,t){return this.__selectorQuery.__push(this.__selector,this.__moduleId,this.__single,e,t),this.__selectorQuery}boundingClientRect(e){return this.fields({id:!0,dataset:!0,rect:!0,size:!0},e)}context(e){return this.fields({context:!0},e)}node(e){return this.fields({node:!0},e)}scrollOffset(e){return this.fields({id:!0,dataset:!0,scrollOffset:!0},e)}},No=t({createIntersectionObserver:()=>Po});function Po(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Fo(e,{thresholds:n,initialRatio:r,observeAll:i})}var Fo=class{constructor(e,t){this._component=e,this._options=t,this._relativeInfo=[],this._observerId=null,this._disconnected=!1}relativeTo(e,t={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:e,margins:[`left`,`right`,`top`,`bottom`].map(e=>`${t[e]===void 0?0:t[e]}px`).join(` `)}),this}relativeToViewport(e={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:null,margins:[`left`,`right`,`top`,`bottom`].map(t=>`${e[t]===void 0?0:e[t]}px`).join(` `)}),this}observe(e,t){let n=this,r=y.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);T(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){T(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},Io=t({createMediaQueryObserver:()=>Ro});function Lo(e={}){let t={};for(let n of[`minWidth`,`maxWidth`,`width`,`minHeight`,`maxHeight`,`height`]){let r=Number(e[n]);Number.isFinite(r)&&r>=0&&(t[n]=r)}return typeof e.orientation==`string`&&/^[-_a-z0-9]+$/i.test(e.orientation)&&(t.orientation=e.orientation),t}function Ro(e,t={}){return new zo(e,t)}var zo=class{constructor(e,t){this._component=e,this._options=t,this._observerId=null,this._callbackId=null,this._disconnected=!1}observe(e,t){if(!n(t))throw TypeError(`MediaQueryObserver.observe listener must be a function`);if(this._observerId!==null)throw Error(`MediaQueryObserver.observe can only be called once`);this._disconnected=!1,this._callbackId=y.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){T(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),y.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),T(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:Lo(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,T(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(y.remove(this._callbackId),this._callbackId=null)}};function Bo(e){if(typeof e!=`string`||e.length===0)return null;let t=[],n=``,r=0,i=()=>{n.length>0&&(t.push(n),n=``)};for(;r<e.length;){let a=e[r];if(a===`\\`){let t=e[r+1];if(t===`.`||t===`[`||t===`]`||t===`\\`){n+=t,r+=2;continue}n+=a,r++;continue}if(a===`.`){i(),r++;continue}if(a===`[`){if(t.length===0&&n.length===0)return null;i();let a=e.indexOf(`]`,r+1);if(a===-1)return null;let o=e.slice(r+1,a);if(!/^\d+$/.test(o))return null;t.push(Number(o)),r=a+1;continue}if(a===`]`)return null;n+=a,r++}return i(),t.length>0?t:null}function Vo(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1],a=Object.prototype.hasOwnProperty.call(r,n);typeof i==`number`?(!a||!Array.isArray(r[n]))&&(r[n]=[]):(!a||r[n]===null||typeof r[n]!=`object`||Array.isArray(r[n]))&&(r[n]={}),r=r[n]}r[t[t.length-1]]=n}function Ho(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function Uo(e){let t=e.split(`,`).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){if(e===`**`){n.push({path:[],wildcard:!0});continue}let t=e.endsWith(`.**`),r=Bo(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function Wo(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&Ho(e.path,t)||Ho(t,e.path)}function Go(e){let t=[];if(Array.isArray(e.behaviorObserverList)&&e.behaviorObserverList.length>0)for(let{key:n,observer:r}of e.behaviorObserverList)t.push({expression:n,observer:r});else for(let[n,r]of Object.entries(e.behaviorObservers||{}))for(let e of r||[])t.push({expression:n,observer:e});for(let[n,r]of Object.entries(e.observers||{}))t.push({expression:n,observer:r});return t.map(e=>({...e,paths:Uo(e.expression)}))}function Ko(e,t,r=e.data,i=e.__info__||{}){for(let a of Go(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>Wo(e,t))))continue;let i=a.paths.map(({path:e})=>e.length===0?r:f(r,e));N(e,a.observer,i,`data observer`)}}function qo(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function Jo(e,t){let n=e.__info__?.properties||{};return t.flatMap(e=>{let t=e.path[0];return typeof t!=`string`||!Object.prototype.hasOwnProperty.call(n,t)?[]:[{propertyName:t,oldValue:e.path.length===1?e.oldValue:void 0,path:e.path,value:e.value}]})}function Yo(e,t,r){if(!t||typeof t!=`object`||Array.isArray(t))return console.warn(`[service] setData data must be an object`),null;let i=!e.__dataUpdateTransaction__,a=e.__dataUpdateTransaction__||{changes:[],pendingPaths:[],callbacks:[]};e.__dataUpdateTransaction__=a,n(r)&&a.callbacks.push(r);for(let r of Object.keys(t)){let i=Bo(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=re(t[r]);i.length===1&&e.__propertySchemas__?.[i[0]]&&n(e.normalizePropertyValues)&&(o=e.normalizePropertyValues({[i[0]]:o})[i[0]]);let s=i.length===1?e.data[i[0]]:void 0;Vo(e.data,i,o),a.changes.push({key:r,path:i,oldValue:s,value:o}),a.pendingPaths.push(i)}if(!i)return null;try{for(;a.pendingPaths.length>0;){let t=a.pendingPaths;a.pendingPaths=[],Ko(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:qo(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:Jo(e,a.changes)}}function Xo(e,t){let i=e.__info__?.properties||{};for(let a of t){let t=i[a.propertyName],o=t?.observer,s=a.path,c=Object.prototype.hasOwnProperty.call(a,`value`)?a.value:s.length===1?e.data[a.propertyName]:f(e.data,s);(s.length!==1||c!==a.oldValue||t?.observeAssignments)&&(r(o)?N(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&N(e,o,[c,a.oldValue,s],`property observer`))}}var Zo=new Map;function Qo(e){return Zo.has(e)||Zo.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),Zo.get(e)}function $o(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return y.store(()=>{r.forEach(t=>N(e,t,[],`setData callback`))})}function es(e){let t=Qo(e);t.depth++}function ts(e){let t=Qo(e);t.depth>0&&t.depth--,t.depth===0&&rs(e)}function ns(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=Bo(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(et({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function G(e,t,n,r,i=[]){let a=Qo(e),o=a.byModuleId.get(t),s=ns(n,i);if(o)Object.assign(o.data,s.data),o.changes.push(...s.changes);else{let e={moduleId:t,data:s.data,changes:s.changes};a.byModuleId.set(t,e),a.updates.push(e)}r&&a.callbackIds.push(r),a.depth===0&&!a.scheduled&&(a.scheduled=!0,Promise.resolve().then(()=>{a.scheduled=!1,a.depth===0&&rs(e)}))}function rs(e){let t=Zo.get(e);if(!t||t.updates.length===0)return;let n=t.updates,r=t.callbackIds;t.updates=[],t.byModuleId=new Map,t.callbackIds=[],t.scheduled=!1,C.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function is(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>is(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=is(n)),e),{}):e}function as(e){if(e){let t={};for(let n in e){let r=Ce(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(ss),default:r.value}}return t}}var os=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function ss(e){return Array.isArray(e)?e.map(e=>ss(e)):e===null||e===``?null:os.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function cs(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,m(n),h(n),r];for(let t of i)if(t&&e[t]!==void 0){let n=e[t];if(typeof n==`string`)return{bind:n};if(n&&typeof n==`object`)return n}}function ls(e,t){if(!Array.isArray(t))return;let r=new WeakMap,i=new WeakSet,a=e.properties,o=e.data,s=e.methods,c=e.relations,l=Object.prototype.hasOwnProperty.call(e,`export`),u=e.export,d,f,p,m,h;function g(e,t){let n=Array.isArray(e)?[...e]:{...e};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],i=t[e];n[e]=typeof r==`object`&&typeof i==`object`&&i&&!Array.isArray(i)?g(r,i):i}return n}function _(e,t){if(typeof t==`string`){ee(e,t);return}if(!t||typeof t!=`object`||i.has(t))return;i.add(t);let a=r.has(t);if(Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>_(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=g(f||{},t.data)),!a){r.set(t,!0);let i=[`created`,`attached`,`ready`,`moved`,`detached`,`error`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of i){let i=t.lifetimes?.[r]===void 0?t[r]:t.lifetimes[r];n(i)&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(i))}if(t.observers){e.behaviorObservers=e.behaviorObservers||{},e.behaviorObserverList=e.behaviorObserverList||[];for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n]),e.behaviorObserverList.push({key:n,observer:t.observers[n]})}}if(t.methods&&(p={...p,...t.methods}),t.relations&&(m={...m,...t.relations}),t.export&&(h=t.export),!a&&t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}i.delete(t)}function ee(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:d={...d,name:{type:String},value:{type:null}};break;case`wx://form-field-group`:case`wx://form-field-button`:case`wx://label-target`:case`wx://style-filter`:case`wx://request-filter`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>_(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=g(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function us(e,t,n){let r=e;for(;r&&r.__parentId__;){if(r.__parentId__===t)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}function ds(e,t){if(!e||!t)return!1;if(e.startsWith(`#`)){let n=e.slice(1);return t.id===n}if(e.startsWith(`.`)){let n=e.slice(1);return t.__targetInfo__?.class&&t.__targetInfo__.class.split(` `).includes(n)}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=e.slice(1,-1).match(/^(\w+)(?:=["']?([^"']*)["']?)?$/);if(n){let[,e,r]=n,i=t.__targetInfo__?.dataset||{};return r===void 0?Object.prototype.hasOwnProperty.call(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function fs(e,t){if(!e||!Array.isArray(e.dependencies))return!1;for(let n of e.dependencies){if(n in t)return!0;for(let e of Object.keys(t))if(e.startsWith(n+`.`)||e.startsWith(n+`[`)||n.startsWith(e+`.`)||n.startsWith(e+`[`))return!0}return!1}function ps(e,t){if(e&&e.expression){if(e.isSimple)return f(t,e.expression);try{return Function(`data`,`with(data) { return ${e.expression} }`)(t)}catch(t){console.warn(`[service] 计算表达式失败:`,e.expression,t);return}}}function ms(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!us(t,e.__id__,r)||t.__parentId__!==e.__id__)continue;let a=t.__info__?.properties||{},o={};for(let r in a){let i=e.__childPropsBindings__?.[t.__id__]?.[r];i&&fs(i,n)&&(o[r]=re(ps(i,e.data)))}if(Object.keys(o).length>0){let e=t.normalizePropertyValues?.(o,{applyFilter:!1})||o,n=t.tO?.(e)||t.normalizePropertyValues?.(e)||e;t.__pendingSyncedProps__=t.__pendingSyncedProps__||{},Object.assign(t.__pendingSyncedProps__,e),i.push({child:t,data:n})}}return i}var hs=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],gs=[`show`,`hide`,`resize`,`routeDone`],_s=class e{constructor(e,t){this.initd=!1,this.opts=t,t.targetInfo&&(this.id=t.targetInfo.id,this.dataset=t.targetInfo.dataset,this.__targetInfo__=t.targetInfo),this.is=t.path,this.route=t.path,this.query=t.query,this.renderer=`webview`,this.bridgeId=t.bridgeId,this.id||=t.bridgeId,this.behaviors=e.behaviors,this.data=re(e.noReferenceData),Object.defineProperty(this,"properties",{get(){return this.data},enumerable:!0,configurable:!1}),this.__isComponent__=e.isComponent,this.__type__=e.type,this.__id__=this.opts.moduleId,this.__info__=e.moduleInfo,this.__pageLifetimeMethods__=Object.create(null),this.__eventAttr__=t.eventAttr,this.__eventPath__=null,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__isCustomTabBar__=t.isCustomTabBar===!0,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1,this.__initialPropertyNames__=new Set(t.propertyNames||Object.keys(t.properties||{})),this.__initialPropertyChanges__=[],this.__initialPropertyValues__={},this.__propertySchemas__=Object.fromEntries(Object.entries(this.__info__.properties||{}).map(([e,t])=>[e,Ce(t)]))}init({deferInitialData:e=!1,deferPageLoad:t=!1}={}){if(this.#d(),this.__isComponent__){let e=this.opts.properties||{};for(let[t,n]of Object.entries(this.__propertySchemas__)){let r=Oe(n,void 0,{absent:!0});if(this.data[t]=r,this.__initialPropertyNames__.has(t)){let n=this.normalizePropertyValue(t,e[t],{applyFilter:!1});this.__initialPropertyValues__[t]=n,this.__initialPropertyChanges__.push({propertyName:t,oldValue:void 0,path:[t],value:n})}}}this.#u(),this.#t(),this.#e(),this.#m({deferPageLoad:t}),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,C.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}}))}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],G(this.bridgeId,this.__id__,{},$o(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&n(this.__info__.export)&&(this.export=this.__info__.export.bind(this))}#t(){let e=this.__info__.relations;if(e&&typeof e==`object`)for(let[t]of Object.entries(e)){let e=this.#n(t);this.__relationPaths__.set(t,e),this.__relations__.has(t)||this.__relations__.set(t,[])}}#n(e){if(e.startsWith(`./`)){let t=this.is.lastIndexOf(`/`);return t===-1?e.substring(2):`${this.is.substring(0,t)}/${e.substring(2)}`}if(e.startsWith(`../`)){let t=this.is.split(`/`),n=e.split(`/`),r=t.slice(0,-1);for(let e of n)e===`..`?r.pop():e!==`.`&&r.push(e);return r.join(`/`)}return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(Y.instances[this.bridgeId]||{}).filter(e=>e===this||!e.__isComponent__||e.__componentAttached__||e.__componentAttaching__);for(let[n,r]of Object.entries(e)){let{type:e,target:i}=r,a=this.__relationPaths__.get(n),o=t.filter(e=>i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`)).filter(t=>this.#a(t,e));for(let e of o)this.#s(n,e,r)}this.#i()}#i(){let e=Object.values(Y.instances[this.bridgeId]||{});for(let t of e)t!==this&&t._checkRelationsWithTarget&&t._checkRelationsWithTarget(this)}_checkRelationsWithTarget(e){let t=this.__info__.relations;if(t)for(let[n,r]of Object.entries(t)){let{type:t,target:i}=r,a=this.__relationPaths__.get(n),o=!1;o=i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`),o&&this.#a(e,t)&&this.#s(n,e,r)}}#a(e,t){let n=Object.values(Y.instances[this.bridgeId]||{});switch(t){case`parent`:return e.__id__===this.__parentId__;case`child`:return e.__parentId__===this.__id__;case`ancestor`:return this.#o(e.__id__,this.__id__,n);case`descendant`:return this.#o(this.__id__,e.__id__,n);default:return!1}}#o(e,t,n){let r=n.find(e=>e.__id__===t);for(;r&&r.__parentId__;){if(r.__parentId__===e)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}#s(e,t,n){let r=this.__relations__.get(e)||[];r.includes(t)||(r.push(t),this.__relations__.set(e,r),N(this,n.linked,[t],`relation linked callback`))}#c(e,t,n){let r=this.__relations__.get(e)||[],i=r.indexOf(t);i!==-1&&(r.splice(i,1),this.__relations__.set(e,r),N(this,n.unlinked,[t],`relation unlinked callback`))}#l(e,t,n){N(this,n.linkChanged,[t],`relation linkChanged callback`)}setData(e,t){let n=Yo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),Xo(this,n.propertyChanges);return}if(this.__groupSetDataMode__){for(let e of Object.keys(n.changedData))this.__groupSetDataBuffer__[e]=n.changedData[e];this.__groupSetDataChanges__.push(...n.changes),this.__groupSetDataCallbacks__.push(...n.callbacks),Xo(this,n.propertyChanges);return}let r=ms(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,$o(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)}),Xo(this,n.propertyChanges)}#u(){hs.forEach(e=>{let t=this.__info__.lifetimes?.[e]===void 0?this.__info__[e]:this.__info__.lifetimes[e];n(t)&&(this[e]=t.bind(this))}),gs.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(this.__pageLifetimeMethods__[e]=t.bind(this))})}#d(){let e=this.__info__.methods;for(let t in e)n(e[t])&&(this[t]=e[t].bind(this))}#f(){if(!this.__isComponent__||!this.__info__.properties||this.__initialPropertyObserversInvoked__)return;let e=this.__initialPropertyChanges__.map(e=>e.path);e.length>0&&(Ko(this,e),Xo(this,this.__initialPropertyChanges__)),this.__initialPropertyObserversInvoked__=!0}#p(){for(let[e,t]of Object.entries(this.__initialPropertyValues__)){let n=this.data[e],r=this.normalizePropertyValue(e,t,{oldValue:n});this.data[e]=r;let i=this.__initialPropertyChanges__.find(t=>t.propertyName===e);i&&(i.oldValue=n,i.value=r)}}#m({deferPageLoad:e=!1}={}){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),e?this.__pageLoadPending__=!0:this.pageAttached()),this.__isComponent__&&(this.initd=!0)}pageAttached(){this.__isComponent__||this.initd||(this.__pageLoadPending__=!1,this.initd=!0,N(this,this.onLoad,[this.opts.query||{}],`onLoad`))}tO(e){let t=typeof this.normalizePropertyValues==`function`?this.normalizePropertyValues(e,{applyFilter:!1}):e,n={},r={};for(let[e,i]of Object.entries(t)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,e)&&a(this.__pendingSyncedProps__[e],i)){this.hasPropertyFilter?.(e)||(this.data[e]=i),r[e]=this.data[e],delete this.__pendingSyncedProps__[e];continue}let t=typeof this.normalizePropertyValue==`function`?this.normalizePropertyValue(e,i):i;n[e]=t,r[e]=t}if(Object.keys(n).length===0)return r;let i=[],o=[];for(let[e,t]of Object.entries(n)){let n=this.data[e];this.data[e]=t,o.push([e]),i.push({propertyName:e,oldValue:n,path:[e],value:t})}return Ko(this,o),Xo(this,i),r}hasPropertyFilter(e){let t=this.__info__.properties?.[e];return!!t&&typeof t==`object`&&t.filter!=null}normalizePropertyValue(e,t,{absent:r=!1,applyFilter:i=!0,oldValue:a=this.data[e],path:o=[e]}={}){let s=this.__propertySchemas__[e];if(!s)return t;let c=Oe(s,t,{absent:r});if(r||!i||!this.hasPropertyFilter(e))return c;let l=this.__info__.properties[e],u=n(l.filter)?l.filter:this.__info__.methods?.[l.filter];if(!n(u))return c;let d=N(this,u,[c,a,o],`property filter`);return d===void 0?c:d}normalizePropertyValues(e,{applyFilter:t=!0}={}){let n={};for(let[r,i]of Object.entries(e||{}))n[r]=this.normalizePropertyValue(r,i,{applyFilter:t});return n}getPageId(){return this.__id__}hasBehavior(e){let t=function(n){if(!Array.isArray(n))return!1;if(n.includes(e))return!0;for(let e of n)if(e&&e.behaviors&&t(e.behaviors))return!0;return!1};return t(this.behaviors)}createSelectorQuery(){return Do().in(this)}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]),n=t.find(n=>us(n,this.__id__,t)&&ds(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]);return t.filter(n=>us(n,this.__id__,t)&&ds(e,n))}selectOwnerComponent(){let e=Object.values(Y.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Po(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,es(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];try{N(this,e,[],`groupSetData callback`)}finally{if(this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__&&Object.keys(this.__groupSetDataBuffer__).length>0){let e=this.__groupSetDataBuffer__,t=this.__groupSetDataCallbacks__,n=this.__groupSetDataChanges__;this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];let r=ms(this,Y.instances[this.bridgeId],e);G(this.bridgeId,this.__id__,e,$o(this,t),n),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];ts(this.bridgeId)}}createMediaQueryObserver(e){return Ro(this,e)}getRelationNodes(e){let t=this.__relations__.get(e);return t?[...t]:null}animate(e,t,r,i,a){n(i)&&(a=i,i=void 0),T(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),T(`componentClearAnimation`,{moduleId:this.__id__,selector:e,options:t||{},success:r},`render`)}async triggerEvent(t,n,r={}){if(!t)return;let i=t.trim();if(!i)return;let a={bubbles:r.bubbles===!0,composed:r.composed===!0,capturePhase:r.capturePhase===!0},o={id:this.id,dataset:this.dataset||{}},s=!1,c=!1,l={type:i,timeStamp:Date.now(),detail:n,bubbles:a.bubbles,composed:a.composed,currentTarget:null,target:o,preventDefault(){c=!0},stopPropagation(){s=!0}};Object.defineProperty(l,"defaultPrevented",{enumerable:!0,get:()=>c});let u=e.prototype.getCustomEventPath.call(this,a.composed),d=async(e,t)=>{let n=cs(e.eventAttr,i);if(!n)return;let r=t?n.captureCatch??n.captureBind:n.catch??n.bind;if(!r)return;l.currentTarget=e.currentTarget;let a=await Y.triggerEvent({bridgeId:this.bridgeId,moduleId:e.moduleId,methodName:r,event:l});(t?n.captureCatch:n.catch)&&l.stopPropagation(),a===!1&&(l.preventDefault(),l.stopPropagation())};if(a.capturePhase)for(let e=u.length-1;e>=0&&!s;e--)await d(u[e],!0);if(s)return;let f=a.bubbles?u:u.slice(0,1);for(let e of f)if(await d(e,!1),s)break}getCustomEventPath(e){let t=[{moduleId:this.__pageId__,eventAttr:this.__eventAttr__||{},currentTarget:{id:this.id,dataset:this.dataset||{}}}];if(Array.isArray(this.__eventPath__)){let n=this.__eventPath__.filter(e=>e?.moduleId).map(e=>{let t=e.isComponentHost&&e.nodeModuleId?Y.instances[this.bridgeId]?.[e.nodeModuleId]:null;return{moduleId:e.moduleId,nodeModuleId:e.nodeModuleId,isComponentHost:e.isComponentHost===!0,eventAttr:e.eventAttr||{},currentTarget:{id:t?.id??e.targetInfo?.id,dataset:t?.dataset||e.targetInfo?.dataset||{}}}}),r=Y.instances[this.bridgeId]||{},i=new Set([this.__id__]),a=0,o=r[this.__parentId__];for(;o?.__isComponent__&&!i.has(o.__id__);){i.add(o.__id__);let e=n.findIndex(e=>e.isComponentHost&&e.nodeModuleId===o.__id__);if(e>=0)a=Math.max(a,e+1);else if(Object.keys(o.__eventAttr__||{}).length>0){let e=-1;for(let t=0;t<n.length;t++)n[t].moduleId===o.__id__&&(e=t);let t=Math.max(a,e+1);n.splice(t,0,{moduleId:o.__pageId__,nodeModuleId:o.__id__,isComponentHost:!0,eventAttr:o.__eventAttr__,currentTarget:{id:o.id,dataset:o.dataset||{}}}),a=t+1}o=r[o.__parentId__]}for(let r of n)(e||r.moduleId===this.__pageId__)&&t.push(r);return t}let n=Y.instances[this.bridgeId]||{},r=new Set([this.__id__]),i=n[this.__parentId__];for(;i?.__isComponent__&&!r.has(i.__id__);)r.add(i.__id__),(e||i.__pageId__===this.__pageId__)&&t.push({moduleId:i.__pageId__,eventAttr:i.__eventAttr__||{},currentTarget:{id:i.id,dataset:i.dataset||{}}}),i=n[i.__parentId__];return t}pageReady(){this.__isComponent__||(this.__componentReadied__||(this.__componentReadied__=!0,this.componentReadied()),N(this,this.onReady,[],`onReady`))}pageUnload(){this.__isComponent__||N(this,this.onUnload,[],`onUnload`)}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;N(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}}pagePullDownRefresh(){this.__isComponent__||N(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){this.__isComponent__||N(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){if(!this.__isComponent__)return N(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){this.__isComponent__||N(this,this.onTabItemTap,[e],`onTabItemTap`)}pageShow(){P(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),N(this,this.__pageLifetimeMethods__.show,[],`page show lifetime`),this.__isComponent__||N(this,this.onShow,[],`onShow`)}pageHide(){P(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),N(this,this.__pageLifetimeMethods__.hide,[],`page hide lifetime`),this.__isComponent__||N(this,this.onHide,[],`onHide`)}pageResize(e){P(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),N(this,this.__pageLifetimeMethods__.resize,[e],`page resize lifetime`),this.__isComponent__||N(this,this.onResize,[e],`onResize`)}componentRouteDone(){P(this,this.__info__.behaviorPageLifetimes?.routeDone,[],`page routeDone lifetime`),N(this,this.__pageLifetimeMethods__.routeDone,[],`page routeDone lifetime`)}componentCreated(){P(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),N(this,this.created,[],`created lifetime`)}componentAttached(){P(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),N(this,this.attached,[],`attached lifetime`),this.#r()}componentReadied(){P(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),N(this,this.ready,[],`ready lifetime`)}componentMoved(){P(this,this.__info__.behaviorLifetimes?.moved,[],`moved lifetime`),N(this,this.moved,[],`moved lifetime`);let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=this.__relations__.get(t)||[];for(let r of e)this.#l(t,r,n)}}componentDetached(){this.__componentAttached__=!1,P(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),N(this,this.detached,[],`detached lifetime`);let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=[...this.__relations__.get(t)||[]];for(let r of e)this.#c(t,r,n)}this.#h(),this.initd=!1}#h(){let e=Object.values(Y.instances[this.bridgeId]||{});for(let t of e)if(t!==this&&t.__relations__)for(let[e,n]of t.__relations__.entries()){let r=n.indexOf(this);if(r!==-1){n.splice(r,1),t.__relations__.set(e,n);let i=t.__info__.relations?.[e];N(t,i?.unlinked,[this],`relation unlinked callback`)}}}componentError(e){P(this,this.__info__.behaviorLifetimes?.error,[e],`error lifetime`,!1),N(this,this.error,[e],`error lifetime`,!1)}},K=class e{static type=`component`;constructor(t,n){this.moduleInfo=t,this.extraInfo=n,this.type=e.type,this.isComponent=this.extraInfo.component,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,ls(this.moduleInfo,this.behaviors),this.noReferenceData=is(this.moduleInfo.data||{})}getProps(){let e=as(this.moduleInfo.properties),t=Array.isArray(this.behaviors)?this.behaviors.filter(e=>typeof e==`string`&&e.startsWith(`wx://`)):[];if(Array.isArray(this.moduleInfo.externalClasses)&&this.moduleInfo.externalClasses.length>0){e||={};for(let t of this.moduleInfo.externalClasses)e[t]={type:[`s`],cls:!0}}return t.length&&(e||={},e.__diminaMeta={builtinBehaviors:t}),e}},vs=class{constructor(e,t){this.initd=!1,this.opts=t,this.is=t.path,this.route=t.path,this.bridgeId=t.bridgeId,this.id=t.bridgeId,this.query=t.query,this.data=re(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init({deferInitialData:e=!1,deferPageLoad:t=!1}={}){this.#e(),this.#t({deferPageLoad:t}),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,C.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}}))}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],G(this.bridgeId,this.__id__,{},$o(this,e))}setData(e,t){let n=Yo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=ms(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,$o(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return Do().in(this)}getTabBar(){let e=Object.values(Y.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&us(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]||{}),n=t.find(n=>us(n,this.__id__,t)&&ds(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]||{});return t.filter(n=>us(n,this.__id__,t)&&ds(e,n)).map(e=>e.hasBehavior&&e.hasBehavior(`wx://component-export`)&&e.export?e.export():e)}#e(){for(let e in this.__info__){if(e===`data`)continue;let t=this.__info__[e];this[e]=n(t)?t.bind(this):t}}#t({deferPageLoad:e=!1}={}){P(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),N(this,this.created,[],`created lifetime`),P(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),N(this,this.attached,[],`attached lifetime`),e?this.__pageLoadPending__=!0:this.pageAttached()}pageAttached(){this.initd||(this.__pageLoadPending__=!1,this.initd=!0,N(this,this.onLoad,[this.opts.query||{}],`onLoad`))}pageShow(){P(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),N(this,this.onShow,[],`onShow`)}pageHide(){P(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),N(this,this.onHide,[],`onHide`)}pageReady(){P(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),N(this,this.ready,[],`ready lifetime`),N(this,this.onReady,[],`onReady`)}pageUnload(){N(this,this.onUnload,[],`onUnload`)}pageDetached(){P(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),N(this,this.detached,[],`detached lifetime`),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;N(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}pagePullDownRefresh(){N(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){N(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){return N(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){N(this,this.onTabItemTap,[e],`onTabItemTap`)}pageResize(e){P(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),N(this,this.onResize,[e],`onResize`)}},q=class e{static type=`page`;constructor(t,r){if(this.moduleInfo=t,this.extraInfo=r,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,ls(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&n(t)&&(this.moduleInfo[e]=t);this.noReferenceData=is(this.moduleInfo.data||{})}},ys=class{static type=`app`;constructor(e){this.moduleInfo=e}},J=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o,runtimeType:s}=e;if(_&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}return w.setInitId(n),s===`game`?(To(n),wo(),v(r),C.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0):(ce(`app`)&&v(`app`),v(r),C.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0)}createAppModule(e){let t=new ys(e);this.staticModules[ys.type]=t}createModule(e,t,n){let{path:r,usingComponents:i}=t;if(!this.staticModules[r]){if(i)for(let e of Object.values(i))v(e);if(n===q.type){let n=new q(e,t);this.staticModules[r]=n}else if(n===K.type){let n=new K(e,t);this.staticModules[r]=n}else console.error(`[service] createModule ${n} error`)}}getPropsByPath(e){let t={};return this.getComponentProps(t,e),t}getComponentProps(e,t){if(t)for(let n of Object.values(t)){let t=this.staticModules[n];t&&!e[n]&&(e[n]=t.getProps(),this.getComponentProps(e,t.usingComponents))}}getAppModule(){return this.staticModules[ys.type]}getModuleByPath(e){return this.staticModules[e]}},Y=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.appEnterOptions={},this.instances={},this.pageStates=new Map,this.runtimeType=`miniProgram`,this.gameLaunched=!1}setRuntimeType(e){this.runtimeType=e===`game`?`game`:`miniProgram`}isMiniGame(){return this.runtimeType===`game`}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=this.normalizeAppOptions(e),this.appEnterOptions=this.appLaunchOptions)}normalizeAppOptions(e={}){let{pagePath:t,path:n=t,...r}=e||{},i={...r,path:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];return i}getAppLaunchOptions(){return this.appLaunchOptions}getAppEnterOptions(){return this.appEnterOptions}getApp(e={}){return e.allowDefault?this.app||this.defaultApp:this.app}getPageState(e){return this.pageStates.has(e)||this.pageStates.set(e,{hidden:!1,pendingReady:!1,pendingShow:!1,ready:!1,shown:!1}),this.pageStates.get(e)}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i])){let t=N(e,e[i],[a],`event ${i}`);try{return await t}catch(t){n(e.componentError)&&e.componentError(t),S(t),console.error(`[service] event ${i} error:`,t);return}}console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e=this.appLaunchOptions){if(this.app){console.log(`[service] app instance already existed`);return}let t=this.normalizeAppOptions(e),n=J.getAppModule();if(!n){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(n.moduleInfo,this.defaultApp),this.defaultApp={},this.appLaunchOptions=t,this.appEnterOptions=t,this.app=new sa(n,t)}appShow(e){e&&Object.keys(e).length>0&&(this.appEnterOptions=this.normalizeAppOptions(e)),this.app?this.app.appShow(this.appEnterOptions):this.isMiniGame()&&this.gameLaunched&&Ge(this.appEnterOptions)}appHide(){this.app?this.app.appHide():this.isMiniGame()&&this.gameLaunched&&Ke()}gameLaunch(){this.isMiniGame()&&!this.gameLaunched&&(this.gameLaunched=!0,Ge(this.appEnterOptions))}stackShow(e){w.pushStack(e)}stackHide(e){w.popStack(e)}createInstance(e){let{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u,stackId:d,isCustomTabBar:f=!1,deferInitialData:p=!1,deferPageLoad:m=!1}=e,h=J.getModuleByPath(r);if(!h){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},h.type===K.type){let e=new _s(h,{bridgeId:t,moduleId:n,path:r,isCustomTabBar:f,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u});this.instances[t][n]=e,h.isComponent||w.push(e,d),e.init({deferInitialData:p,deferPageLoad:m});let g=this.getPageState(t);return!h.isComponent&&g.pendingShow&&!g.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}if(h.type===q.type){let e=new vs(h,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,w.push(e,d),e.init({deferInitialData:p,deferPageLoad:m});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}console.error(`[service] ${h.type} instance is not exist.`)}moduleAttached(e){let{bridgeId:t,moduleId:n,parentId:r}=e,i=this.instances[t]?.[n];if(!i||i.__type__!==K.type||!i.__isComponent__||i.__componentAttached__||i.__componentAttaching__)return;r&&this.instances[t]?.[r]&&(i.__parentId__=r);let a=this.instances[t]?.[i.__parentId__];if(a?.__isComponent__&&!a.__componentAttached__){i.__componentAttachPending__=!0;return}i.__componentAttachPending__=!1,i.__componentAttaching__=!0;try{i.__componentAttached__=!0,i.componentAttached(),i.__componentAttaching__=!1;let e=this.getPageState(t);e.shown&&!i.__pageShown__&&(i.__pageShown__=!0,e.ready||i.pageShow());let r=Object.values(this.instances[t]||{}).filter(e=>e?.__parentId__===n&&e.__componentAttachPending__);for(let e of r)this.moduleAttached({bridgeId:t,moduleId:e.__id__});if(i.__pendingReadyOpts__){let e=i.__pendingReadyOpts__;delete i.__pendingReadyOpts__,this.moduleReady(e)}}finally{i.__componentAttaching__=!1}}moduleReady(e){let{bridgeId:t,moduleId:n,propBindings:r,eventPath:i}=e,a=this.instances[t]?.[n];if(a){if(Array.isArray(i)&&(a.__eventPath__=i),r&&a.__parentId__){let e=this.instances[t]?.[a.__parentId__];e&&(e.__childPropsBindings__||={},e.__childPropsBindings__[n]=r)}if(a.__type__===K.type){if(a.__isComponent__&&!a.__componentAttached__){a.__pendingReadyOpts__=e;return}if(a.__componentReadied__)return;let n=this.getPageInstance(t);if(a.__isComponent__&&n?.__pageLoadPending__){a.__pendingReadyOpts__=e;return}if(Object.values(this.instances[t]||{}).some(e=>e?.__isComponent__&&e.__componentAttached__&&!e.__componentReadied__&&this.isDescendantInstance(e,a,t))){a.__pendingReadyOpts__=e;return}a.__componentReadied__=!0,a.componentReadied(),this.flushPendingEvents(a),a.flushInitSetDataCallbacks?.(),n&&this.checkAndCallPageReady(t,n.__id__);let r=this.instances[t]?.[a.__parentId__];for(;r?.__isComponent__;){if(r.__pendingReadyOpts__){let e=r.__pendingReadyOpts__;delete r.__pendingReadyOpts__,this.moduleReady(e)}r=this.instances[t]?.[r.__parentId__]}}}}pageAttached(e){let{bridgeId:t}=e,n=this.getPageInstance(t);if(!n?.__pageLoadPending__)return;n.pageAttached();let r=this.getPageState(t);r.pendingShow&&!r.hidden&&this.pageShow({bridgeId:t,moduleId:n.__id__}),this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__isComponent__&&e.__pendingReadyOpts__).forEach(e=>{let t=e.__pendingReadyOpts__;delete e.__pendingReadyOpts__,this.moduleReady(t)})}isDescendantInstance(e,t,n){let r=e;for(;r?.__parentId__;){if(r.__parentId__===t.__id__)return!0;r=this.instances[n]?.[r.__parentId__]}return!1}moduleUnmounted(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t]?.[n];r&&(r.__type__===K.type&&(!r.__isComponent__||r.__componentAttached__)&&!r.__componentDetached__&&(r.__componentDetached__=!0,r.componentDetached()),delete this.instances[t][n])}pageShow(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!1,n.pendingShow=!0,!this.instances[t])return;let r=this.getPageInstance(t);if(!r?.initd)return;if(n.shown){n.pendingShow=!1;return}n.shown=!0,n.pendingShow=!1;let i=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===q.type?i.push(e):e.__type__===K.type&&(e.__isComponent__?e.__componentAttached__&&!e.__pageShown__&&(e.__pageShown__=!0,e.pageShow()):i.push(e)))}),i.forEach(e=>{e.pageShow()}),n.pendingReady&&this.pageReady({...e,moduleId:r.__id__})}pageReady(e){let{bridgeId:t,moduleId:n}=e,r=this.getPageState(t);r.pendingReady=!0;let i=this.instances[t]?.[n];i&&(r.hidden||!r.shown||r.ready||(i.__pageReadyPending__=!0,i.flushInitSetDataCallbacks?.(),this.checkAndCallPageReady(t,n)))}getPageInstance(e){let t=this.instances[e];return t?Object.values(t).find(e=>e&&(e.__type__===q.type||e.__type__===K.type&&!e.__isComponent__)):null}checkAndCallPageReady(e,t){let n=this.getPageState(e),r=this.instances[e]?.[t];if(!r||!r.__pageReadyPending__||!n.shown||n.ready)return;let i=this.instances[e];if(!i){r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady();return}Object.values(i).filter(e=>e&&e.__type__===K.type&&e.__isComponent__&&e.initd&&!e.__componentReadied__).length===0&&(r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady())}pageHide(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!0,n.pendingShow=!1,!n.shown||(n.shown=!1,!this.instances[t]))return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===q.type?r.push(e):e.__type__===K.type&&(e.__isComponent__?e.__componentAttached__&&e.__pageShown__&&(e.__pageShown__=!1,e.pageHide()):r.push(e)))}),r.forEach(e=>{e&&e.pageHide()})}pageUnload(e){let{bridgeId:t}=e;if(!this.instances[t])return;let n=this.getPageState(t);if(n.unloading)return;n.unloading=!0;let r=this.getPageInstance(t);r?.pageUnload(),this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__type__===K.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.__componentDetached__=!0,e.componentDetached())}),r?.__type__===K.type&&!r.__componentDetached__?(r.__componentDetached__=!0,r.componentDetached()):r?.__type__===q.type&&r.pageDetached?.(),w.remove(t),delete this.instances[t],this.pageStates.delete(t)}getInstancesInTreeOrder(e,{postOrder:t=!1}={}){let n=Object.values(this.instances[e]||{}).filter(Boolean),r=new Map(n.map(e=>[e.__id__,e])),i=new Map,a=[];for(let e of n)if(e.__parentId__&&r.has(e.__parentId__)){let t=i.get(e.__parentId__)||[];t.push(e),i.set(e.__parentId__,t)}else a.push(e);let o=[],s=new Set,c=e=>{if(e&&!s.has(e)){s.add(e),t||o.push(e);for(let t of i.get(e.__id__)||[])c(t);t&&o.push(e)}};return a.forEach(c),n.forEach(c),o}pageScroll(e){let{bridgeId:t,moduleId:n,scrollTop:r}=e,i=this.instances[t]?.[n];i&&i.pageScrollTop({scrollTop:r})}pagePullDownRefresh({bridgeId:e}){this.getPageInstance(e)?.pagePullDownRefresh()}pageReachBottom({bridgeId:e}){this.getPageInstance(e)?.pageReachBottom()}pageShareAppMessage({bridgeId:e,...t}){return this.getPageInstance(e)?.pageShareAppMessage(t)}pageTabItemTap({bridgeId:e,...t}){this.getPageInstance(e)?.pageTabItemTap(t)}pageResize(e){let{bridgeId:t,size:n}=e;if(!this.instances[t])return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===q.type?r.push(e):e.__type__===K.type&&(e.__isComponent__?e.__componentAttached__&&e.pageResize(n):r.push(e)))}),r.forEach(e=>e.pageResize(n))}componentError(e){let{bridgeId:t,moduleId:n,error:r}=e,i=this.instances[t]?.[n];i&&(i.__type__===K.type&&i.componentError(r),S(r))}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===K.type&&(!e.__isComponent__||e.__componentAttached__)&&e.componentRouteDone()})}async triggerEvent(e){let{bridgeId:t,moduleId:n,methodName:r,event:i}=e;if(r===void 0)return;let a=this.instances[t];if(!a){console.warn(`[service] No instances found for bridgeId: ${t}`);return}let o=a[n];if(!o){console.warn(`[service] triggerEvent ${t} ${n} ${r}, instance is not exist`);return}return o.__type__===K.type&&o.__isComponent__&&!o.__componentReadied__?this.queuePendingEvent(o,{instance:o,bridgeId:t,moduleId:n,methodName:r,event:i}):this.dispatchEvent({instance:o,bridgeId:t,moduleId:n,methodName:r,event:i})}},bs=t({getEnterOptionsSync:()=>Ss,getLaunchOptionsSync:()=>xs});function xs(){return Y.getAppLaunchOptions()}function Ss(){return Y.getAppEnterOptions()}var Cs=t({getLocation:()=>ws,offLocationChange:()=>ks,onLocationChange:()=>Os,openLocation:()=>Es,startLocationUpdate:()=>Ts,stopLocationUpdate:()=>Ds});function ws(e){return T(`getLocation`,e)}function Ts(e){return T(`startLocationUpdate`,e)}function Es(e){return T(`openLocation`,e)}function Ds(e){return T(`stopLocationUpdate`,e)}function Os(e){e&&T(`onLocationChange`,{success:y.store(e,!0)})}function ks(e){if(e){let t=y.store(e,!0);T(`offLocationChange`,{success:t}),y.remove(t)}else T(`offLocationChange`),y.remove()}var As=t({createMapContext:()=>js});function js(e,t){return new Ms({mapId:e,obj:t})}var Ms=class{constructor(e){this.opts=e}addMarkers(e){return this.invoke(`addMarkers`,e)}removeMarkers(e){return this.invoke(`removeMarkers`,e)}includePoints(e){return this.invoke(`includePoints`,e)}setCenterOffset(e){return this.invoke(`setCenterOffset`,e)}getCenterLocation(e){return this.invoke(`getCenterLocation`,e)}getScale(e){return this.invoke(`getScale`,e)}moveToLocation(e){return this.invoke(`moveToLocation`,e)}translateMarker(e){return this.invoke(`translateMarker`,e)}addArc(e){return this.invoke(`addArc`,e)}removeArc(e){return this.invoke(`removeArc`,e)}invoke(e,t={}){return T(e,{mapId:this.opts.mapId,...t})}},Ns=t({createInnerAudioContext:()=>Is}),Ps=1,Fs=class{constructor(){this._audioId=Ps++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._currentTime=0,this._duration=0,this._buffered=0,this._paused=!0,this._listeners={},T(`audioCreate`,{audioId:this._audioId}),T(`audioListen`,{audioId:this._audioId,evtId:`audio_${this._audioId}`,keep:!0,success:e=>this._dispatch(e)})}_dispatch(e){if(!e||typeof e!=`object`)return;this._currentTime=e.currentTime||0,this._duration=e.duration||0,this._buffered=e.buffered||0,this._paused=!!e.paused;let t=this._listeners[e.event];if(t)for(let n of t.slice())n(e)}get src(){return this._src}set src(e){this._src=e,T(`audioSetProp`,{audioId:this._audioId,prop:`src`,value:e,startTime:this._startTime,loop:this._loop,volume:this._volume,playbackRate:this._playbackRate,autoplay:this._autoplay})}get startTime(){return this._startTime}set startTime(e){this._startTime=Number(e)||0,T(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,T(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,T(`audioSetProp`,{audioId:this._audioId,prop:`loop`,value:this._loop})}get volume(){return this._volume}set volume(e){this._volume=Math.max(0,Math.min(1,Number(e)||0)),T(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,T(`audioSetProp`,{audioId:this._audioId,prop:`playbackRate`,value:this._playbackRate})}get duration(){return this._duration}get currentTime(){return this._currentTime}get paused(){return this._paused}get buffered(){return this._buffered}play(){this._paused=!1,T(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,T(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,T(`audioStop`,{audioId:this._audioId})}seek(e){T(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){T(`audioDestroy`,{audioId:this._audioId}),this._listeners={}}_on(e,t){typeof t==`function`&&(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t))}_off(e,t){this._listeners[e]&&(t?this._listeners[e]=this._listeners[e].filter(e=>e!==t):this._listeners[e]=[])}onPlay(e){this._on(`play`,e)}onPause(e){this._on(`pause`,e)}onStop(e){this._on(`stop`,e)}onEnded(e){this._on(`ended`,e)}onError(e){this._on(`error`,e)}onTimeUpdate(e){this._on(`timeUpdate`,e)}onWaiting(e){this._on(`waiting`,e)}onSeeking(e){this._on(`seeking`,e)}onSeeked(e){this._on(`seeked`,e)}onCanplay(e){this._on(`canplay`,e)}offPlay(e){this._off(`play`,e)}offPause(e){this._off(`pause`,e)}offStop(e){this._off(`stop`,e)}offEnded(e){this._off(`ended`,e)}offError(e){this._off(`error`,e)}offTimeUpdate(e){this._off(`timeUpdate`,e)}offWaiting(e){this._off(`waiting`,e)}offSeeking(e){this._off(`seeking`,e)}offSeeked(e){this._off(`seeked`,e)}offCanplay(e){this._off(`canplay`,e)}};function Is(){return new Fs}var Ls=t({chooseImage:()=>Ws,chooseMessageFile:()=>Gs,compressImage:()=>Us,createImage:()=>Rs,getImageInfo:()=>Vs,previewImage:()=>Bs,previewMedia:()=>Hs,saveImageToPhotosAlbum:()=>zs});function Rs(){return Co()}function zs(e){return T(`saveImageToPhotosAlbum`,e)}function Bs(e){return T(`previewImage`,e)}function Vs(e){return T(`getImageInfo`,e)}function Hs(e){return T(`previewMedia`,e)}function Us(e){return T(`compressImage`,e)}function Ws(e){return T(`chooseImage`,e)}function Gs(e){return T(`chooseMessageFile`,e)}var Ks=t({chooseMedia:()=>Ys,chooseVideo:()=>Js,compressVideo:()=>Qs,createVideoContext:()=>qs,getVideoInfo:()=>Xs,saveVideoToPhotosAlbum:()=>Zs});function qs(e,t){return new $s({videoId:e,obj:t})}function Js(e){return T(`chooseVideo`,e)}function Ys(e){return T(`chooseMedia`,e)}function Xs(e){return T(`getVideoInfo`,e)}function Zs(e){return T(`saveVideoToPhotosAlbum`,e)}function Qs(e){return T(`compressVideo`,e)}var $s=class{constructor(e){this.opts=e}play(){this.invoke(`play`)}pause(){this.invoke(`pause`)}stop(){this.invoke(`stop`)}seek(e){this.invoke(`seek`,{position:e})}playbackRate(e){this.invoke(`playbackRate`,{rate:e})}requestFullScreen(e={}){this.invoke(`requestFullScreen`,e)}exitFullScreen(){this.invoke(`exitFullScreen`)}requestBackgroundPlayback(e={}){this.invoke(`requestBackgroundPlayback`,e)}exitBackgroundPlayback(){this.invoke(`exitBackgroundPlayback`)}exitPictureInPicture(e={}){this.invoke(`exitPictureInPicture`,e)}showStatusBar(){this.invoke(`showStatusBar`)}hideStatusBar(){this.invoke(`hideStatusBar`)}invoke(e,t={}){T(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},ec=t({exitMiniProgram:()=>ic,navigateBackMiniProgram:()=>rc,navigateToMiniProgram:()=>nc,restartMiniProgram:()=>tc});function tc(e){return T(`restartMiniProgram`,e)}function nc(e){return T(`navigateToMiniProgram`,e)}function rc(e){return T(`navigateBackMiniProgram`,e)}function ic(e){return T(`exitMiniProgram`,e)}var ac=t({downloadFile:()=>oc});function oc(e){return T(`downloadFile`,e)}var sc=t({offLocalServiceDiscoveryStop:()=>hc,offLocalServiceFound:()=>_c,offLocalServiceLost:()=>yc,offLocalServiceResolveFail:()=>xc,onLocalServiceDiscoveryStop:()=>mc,onLocalServiceFound:()=>gc,onLocalServiceLost:()=>vc,onLocalServiceResolveFail:()=>bc,startLocalServiceDiscovery:()=>fc,stopLocalServiceDiscovery:()=>pc}),cc=j(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),lc=j(`onLocalServiceFound`,`offLocalServiceFound`),uc=j(`onLocalServiceLost`,`offLocalServiceLost`),dc=j(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function fc(e={}){return T(`startLocalServiceDiscovery`,e)}function pc(e={}){return T(`stopLocalServiceDiscovery`,e)}function mc(e){return cc.on(e)}function hc(e){return cc.off(e)}function gc(e){return lc.on(e)}function _c(e){return lc.off(e)}function vc(e){return uc.on(e)}function yc(e){return uc.off(e)}function bc(e){return dc.on(e)}function xc(e){return dc.off(e)}var Sc=t({request:()=>Cc});function Cc(e){return T(`request`,e)}var wc=t({createTCPSocket:()=>Ec}),Tc=class{constructor(e){this.socketId=e,this.events={bindWifi:j(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:j(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:j(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:j(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:j(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},yi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return A(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=A(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return A(`TCPSocket.connect`,this.socketId,e)}write(e){return A(`TCPSocket.write`,this.socketId,{data:vi(e)})}onBindWifi(e){return this.events.bindWifi.on(e)}offBindWifi(e){return this.events.bindWifi.off(e)}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onConnect(e){return this.events.connect.on(e)}offConnect(e){return this.events.connect.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}};function Ec(){return new Tc(bi(`tcp`))}var Dc=t({createUDPSocket:()=>kc}),Oc=class{constructor(e){this.socketId=e,this.events={close:j(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:j(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:j(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:j(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},yi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return A(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=A(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return A(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return A(`UDPSocket.setTTL`,this.socketId,{ttl:e})}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onListening(e){return this.events.listening.on(e)}offListening(e){return this.events.listening.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}sendWithName(e,t){return A(e,this.socketId,{...t,message:vi(t.message)})}};function kc(){return new Oc(bi(`udp`))}var Ac=t({uploadFile:()=>Pc}),jc=1;function Mc(){return`upload_${Date.now()}_${jc++}`}function Nc(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function Pc(e={}){let t=Mc(),n=Nc(),r=Nc(),i=y.store(e=>n.dispatch(e),!0,`${t}_progress`),a=y.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,y.remove(i),y.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{T(`uploadFile`,{...e,uploadId:t,progress:i,headersReceived:a,complete:c})}catch(e){throw c({errMsg:`uploadFile:fail ${e&&e.message?e.message:e}`}),e}return{abort(){s||T(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var Fc=t({closeSocket:()=>Sl,connectSocket:()=>bl,onSocketClose:()=>Al,onSocketError:()=>kl,onSocketMessage:()=>Ol,onSocketOpen:()=>Dl,sendSocketMessage:()=>xl}),Ic=0,Lc=1,Rc=3,zc=5,Bc=/^wss:\/\/.*/i,Vc={open:[`header`,`profile`],message:[`data`],error:[`errMsg`],close:[`code`,`reason`]},Hc={...Vc,open:[`header`]};function Uc(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`?{data:gi(e),isBuffer:!0}:{data:e}}function Wc(e,t){let n=Uc(t);return e.data=n.data,n.isBuffer?e.isBuffer=!0:delete e.isBuffer,e}function Gc(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n];t[n]=typeof r==`string`?r:typeof r==`number`?String(r):Object.prototype.toString.apply(r)}return t}function Kc(e,t){let n={};if(!e||typeof e!=`object`)return n;for(let r of t)r in e&&(n[r]=e[r]);return n}function qc(e){let t=Kc(e,Vc.message);return e&&typeof e==`object`&&e.isBuffer&&(t.data=_i(e.data)),t}function Jc(e){return Number.isFinite(e)?e:1e3}function Yc(e){return Number.isFinite(e)&&e>=1?e:0}function Xc(e){return Object.prototype.toString.call(e).slice(8,-1)}function Zc(e){return!!e&&typeof e==`object`}function Qc(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function $c(e,t){n(e.fail)&&e.fail(t),n(e.complete)&&e.complete(t)}function el(e){return Kc(e,[`errMsg`])}function tl(){let e;function t(t){return e=el(t),e}return{settle:t,wrap(n,r){return n===`complete`?n=>r(e??t(n)):e=>r(t(e))}}}function nl(e,t,r){for(let i of[`success`,`fail`,`complete`])n(t[i])&&(e[i]=r.wrap(i,t[i]))}var rl=new Set,X,il={open:void 0,message:void 0,error:void 0,close:void 0},al=[],ol=!1;function sl(){ol=!1;let e=al.splice(0,al.length);for(let t of e)t()}function cl(e,{defer:t=!1}={}){if(!t&&al.length===0){e();return}al.push(e),!ol&&(ol=!0,setTimeout(sl,0))}function ll(e,t,r){let i=il[t];if(!e||!n(i))return;let a=t===`message`?r:Kc(r,Hc[t]);P(void 0,[i],[a],`wx.onSocket-${t}`,!1)}function ul(e,t,r,i){let a=new Set,o,s=!1;function c(e){if(!o)return;let n=o;e&&T(t,{...r,callback:n,keep:!0}),o=void 0,y.remove(n)}return{add(e){return!n(e)||a.has(e)?!1:(a.add(e),!0)},remove(e){a.delete(e)},activate(){if(o||s)return;let t=y.store(e=>i(e,[...a]),!0);o=t;try{T(e,{...r,callback:t,keep:!0})}catch(e){throw o=void 0,y.remove(t),e}},rollback(){c(!0)},seal(){c(!1),a.clear(),s=!0}}}var dl=new WeakMap,fl=Symbol(`SocketTask constructor token`);function Z(e){let t=dl.get(e);if(!t)throw TypeError(`Illegal invocation`);return t}function pl(e){if(rl.delete(e.task),!e.terminal){e.terminal=!0;for(let t of Object.values(e.events))t.seal()}}function ml(e){e.connectionState=Rc,e.terminalEvent=!0}function hl(e){ml(e),pl(e)}function gl(e){if(e.activated||e.terminal)return;e.activated=!0;let t=[];try{for(let n of Object.values(e.events)){if(e.terminal)break;n.activate(),t.push(n)}}catch(n){e.activated=!1;for(let e of t.reverse())try{e.rollback()}catch{}throw n}}function _l(e,t,n){let r=Z(e),i=r.events[t];if(!r.terminal&&i.add(n))try{r.activated||gl(r)}catch(e){throw i.remove(n),e}}function vl(e,t,n){P(void 0,t,[n],`SocketTask.${e}`,!1)}var yl=class{constructor(e,t){if(e!==fl)throw TypeError(`Illegal constructor`);let n=this,r={task:n,socketId:t,connectionState:Ic,opened:!1,terminalEvent:!1,terminal:!1,activated:!1,events:{}};r.events={open:ul(`onSocketOpen`,`offSocketOpen`,{socketId:t},(e,t)=>{r.connectionState=Lc,r.opened=!0;let i=n===X;cl(()=>{vl(`onOpen`,t,Kc(e,Vc.open)),ll(i,`open`,e)})}),message:ul(`onSocketMessage`,`offSocketMessage`,{socketId:t},(e,t)=>{let r=n===X,i=qc(e);cl(()=>{vl(`onMessage`,t,i),ll(r,`message`,i)})}),error:ul(`onSocketError`,`offSocketError`,{socketId:t},(e,t)=>{let i=n===X;r.opened?ml(r):hl(r),cl(()=>{vl(`onError`,t,Kc(e,Vc.error)),ll(i,`error`,e)},{defer:!0})}),close:ul(`onSocketClose`,`offSocketClose`,{socketId:t},(e,t)=>{let i=n===X;hl(r),cl(()=>{vl(`onClose`,t,Kc(e,Vc.close)),ll(i,`close`,e)})})},dl.set(this,r)}send(e={}){let t=Z(this),n=Zc(e)?e:{};if(t.connectionState!==Lc){$c(n,{errMsg:`SocketTask.send:fail WebSocket is not connected`});return}let r=Wc({socketId:t.socketId},n.data);nl(r,n,tl()),pt(`sendSocketMessage`,r)}close(e={}){let t=Z(this),n=Zc(e)?e:{},r={socketId:t.socketId,code:Jc(n.code)};n.reason!==void 0&&(r.reason=n.reason),nl(r,n,tl()),pt(`closeSocket`,r)}onOpen(e){_l(this,`open`,e)}onMessage(e){_l(this,`message`,e)}onError(e){_l(this,`error`,e)}onClose(e){_l(this,`close`,e)}};function bl(e){if(!Zc(e))return;let{url:t}=e;if(typeof t!=`string`){$c(e,{errMsg:`connectSocket:fail parameter error: parameter.url should be String instead of ${Xc(t)};`});return}if(!Bc.test(t)){$c(e,{errMsg:`connectSocket:fail invalid url "${t}"`});return}let r=`socket_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,i=new yl(fl,r),a=Z(i),o=X;if((!X||Z(X).connectionState===Rc)&&(X=i),rl.size>=zc)return a.connectionState=Rc,pl(a),$c(e,{errMsg:`connectSocket:fail fail reach max websocket connect count ${zc}`}),i;rl.add(i);let s=tl(),c,l;try{let i=e.timeout;c={socketId:r,url:t,timeout:Yc(i)};let a=e.header;a!==void 0&&typeof a==`object`&&(c.header=a?Gc(a):{});for(let t of[`protocols`,`tcpNoDelay`,`perMessageDeflate`,`forceCellularNetwork`]){let n=e[t];n!==void 0&&(c[t]=n)}let o=e.success;l=e.fail;let u=e.complete;n(o)&&(c.success=s.wrap(`success`,o)),n(u)&&(c.complete=s.wrap(`complete`,u))}catch(e){throw hl(a),X===i&&(X=o),e}c.fail=e=>{hl(a);let t=s.settle(e);n(l)&&l(t)};let u=!1;try{T(`connectSocket`,c),u=!0,gl(a)}catch(t){if(u)try{pt(`closeSocket`,{socketId:r,code:1e3})}catch{}hl(a),X===i&&(X=o),$c(e,{errMsg:`connectSocket:fail ${t?.message??t}`});return}return i}function xl(e){let t=Zc(e)?e:{},n=Qc(t);return!X||Z(X).connectionState!==Lc?Tl(`sendSocketMessage:fail WebSocket is not connected`,t,n):wl(`sendSocketMessage`,Wc({socketId:Z(X).socketId},t.data),t,n)}function Sl(e){let t=Zc(e)?e:{},n=Qc(t),r;if(X&&Z(X).connectionState===Lc){let e=Z(X),i=Cl(e);try{let a=Jc(t.code),o=t.reason,s={socketId:e.socketId,code:a};o!==void 0&&(s.reason=o),r=wl(`closeSocket`,s,t,n,i)}catch(e){throw i(),e}}else r=Tl(`closeSocket:fail WebSocket is not connected`,t,n);return r}function Cl(e){let t=e.connectionState;return e.connectionState=Rc,()=>{e.terminalEvent||(e.connectionState=t)}}function wl(e,t,r,i,a){if(!i)return T(e,t).then(e=>el(e),e=>{throw a?.(e),el(e)});let o=tl();for(let e of[`success`,`complete`])Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=n(r[e])?o.wrap(e,r[e]):void 0);let s=n(r.fail)?r.fail:void 0;a||s?t.fail=e=>{a?.(e);let t=o.settle(e);s?.(t)}:Object.prototype.hasOwnProperty.call(r,`fail`)&&(t.fail=void 0);try{T(e,t)}catch(e){throw a?.(e),e}}function Tl(e,t,n){let r={errMsg:e};if(!n)return new Promise((e,t)=>t(r));$c(t,r)}function El(e,t){n(t)&&(il[e]=t)}function Dl(e){El(`open`,e)}function Ol(e){El(`message`,e)}function kl(e){El(`error`,e)}function Al(e){El(`close`,e)}var jl=t({getAccountInfoSync:()=>Ml});function Ml(){return T(`getAccountInfoSync`)}var Nl=t({authorize:()=>Pl});function Pl(e){return T(`authorize`,e)}var Fl=t({login:()=>Il});function Il(e){return T(`login`,e)}var Ll=t({login:()=>Rl});function Rl(e){return T(`login`,e)}var zl=t({getPrivacySetting:()=>Bl});function Bl(e){return T(`getPrivacySetting`,e)}var Vl=t({getSetting:()=>Ul,openSetting:()=>Hl});function Hl(e){return T(`openSetting`,e)}function Ul(e){return T(`getSetting`,e)}var Wl=t({getUserInfo:()=>Gl});function Gl(e){return T(`getUserInfo`,e)}var Kl=t({requestPayment:()=>ql});function ql(e){return T(`requestPayment`,e)}var Jl=t({hideShareMenu:()=>Zl,showShareImageMenu:()=>Xl,showShareMenu:()=>Yl});function Yl(e){return T(`shareShareMenu`,e)}function Xl(e){return T(`showShareImageMenu`,e)}function Zl(e){return T(`hideShareMenu`,e)}var Ql=t({clearStorage:()=>ou,clearStorageSync:()=>nu,getStorage:()=>iu,getStorageInfo:()=>cu,getStorageInfoSync:()=>su,getStorageSync:()=>eu,removeStorage:()=>au,removeStorageSync:()=>tu,setStorage:()=>ru,setStorageSync:()=>$l});function $l(...e){return T(`setStorageSync`,e)}function eu(e){return T(`getStorageSync`,e)}function tu(e){return T(`removeStorageSync`,e)}function nu(){return T(`clearStorageSync`)}function ru(e){return T(`setStorage`,e)}function iu(e){return T(`getStorage`,e)}function au(e){return T(`removeStorage`,e)}function ou(){return T(`clearStorage`)}function su(){return T(`getStorageInfoSync`)}function cu(e){return T(`getStorageInfo`,e)}var lu=t({createAnimation:()=>uu});function uu(e={}){return new du(e)}var du=class{constructor({duration:e=400,timingFunction:t=`linear`,delay:n=0,transformOrigin:r=`50% 50% 0`}={}){this.actions=[],this.currentTransform={},this.currentStepAnimates=[],this.option={transition:{duration:e,timingFunction:t,delay:n},transformOrigin:r}}export(){let e=this.actions;return this.actions=[],{actions:e}}step(e={}){for(let e of this.currentStepAnimates)e.type===`style`?this.currentTransform[`${e.type}.${e.args[0]}`]=e:this.currentTransform[e.type]=e;return this.actions.push({animates:Object.keys(this.currentTransform).reduce((e,t)=>[].concat(...e,[this.currentTransform[t]]),[]),option:{transformOrigin:e.transformOrigin===void 0?this.option.transformOrigin:e.transformOrigin,transition:{duration:e.duration===void 0?this.option.transition.duration:e.duration,timingFunction:e.timingFunction===void 0?this.option.transition.timingFunction:e.timingFunction,delay:e.delay===void 0?this.option.transition.delay:e.delay}}}),this.currentStepAnimates=[],this}backgroundColor(e){return this.currentStepAnimates.push({type:`style`,args:[`background-color`,e]}),this}bottom(e){return this.currentStepAnimates.push({type:`style`,args:[`bottom`,ne(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,ne(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,ne(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,ne(e)]}),this}rotate(e=0){return this.currentStepAnimates.push({type:`rotate`,args:[e]}),this}rotate3d(e=0,t=0,n=0,r=0){return this.currentStepAnimates.push({type:`rotate3d`,args:[e,t,n,r]}),this}rotateX(e){return this.currentStepAnimates.push({type:`rotateX`,args:[e]}),this}rotateY(e){return this.currentStepAnimates.push({type:`rotateY`,args:[e]}),this}rotateZ(e){return this.currentStepAnimates.push({type:`rotateZ`,args:[e]}),this}scale(e=1,t=1){return this.currentStepAnimates.push({type:`scale`,args:[e,t]}),this}scale3d(e=1,t=1,n=1){return this.currentStepAnimates.push({type:`scale3d`,args:[e,t,n]}),this}scaleX(e=1){return this.currentStepAnimates.push({type:`scaleX`,args:[e]}),this}scaleY(e=1){return this.currentStepAnimates.push({type:`scaleY`,args:[e]}),this}scaleZ(e=1){return this.currentStepAnimates.push({type:`scaleZ`,args:[e]}),this}skew(e=0,t=0){return this.currentStepAnimates.push({type:`skew`,args:[e,t]}),this}skewX(e=0){return this.currentStepAnimates.push({type:`skewX`,args:[e]}),this}skewY(e=0){return this.currentStepAnimates.push({type:`skewY`,args:[e]}),this}top(e){return this.currentStepAnimates.push({type:`style`,args:[`top`,ne(e)]}),this}translate(e=0,t=0){return this.currentStepAnimates.push({type:`translate`,args:[e,t]}),this}translate3d(e=0,t=0,n=0){return this.currentStepAnimates.push({type:`translate3d`,args:[e,t,n]}),this}translateX(e=0){return this.currentStepAnimates.push({type:`translateX`,args:[e]}),this}translateY(e=0){return this.currentStepAnimates.push({type:`translateY`,args:[e]}),this}width(e){return this.currentStepAnimates.push({type:`style`,args:[`width`,ne(e)]}),this}},fu=t({setBackgroundColor:()=>mu,setBackgroundTextStyle:()=>pu});function pu(e){return T(`setBackgroundTextStyle`,e)}function mu(e){return T(`setBackgroundColor`,e)}var hu=`10px sans-serif`;function gu(){return{lineDash:[0,0],lineDashOffset:0,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:`#000000`,font:hu,fontSize:10,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`}}function _u(e){if(Array.isArray(e))return e.map(_u);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e))t[n]=_u(e[n]);return t}return e}function vu(e){return Array.isArray(e)?e.some(vu):typeof e==`object`&&e?Object.values(e).some(vu):e===void 0||typeof e==`number`&&!Number.isFinite(e)}function Q(e){return e.some(vu)}var yu=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[],this.path=[],this.state=gu(),this.drawingState=[],this._transform={a:1,b:0,c:0,d:1,e:0,f:0}}pushAction(e,...t){return Q(t)||this.actions.push({type:e,args:t}),this}getActions(){let e=this.actions.map(_u).filter(e=>!Q(e.args));return this.actions=[],this.path=[],e}clearActions(){this.actions=[],this.path=[]}pushPathAction(e,...t){return Q(t)||this.path.push({type:e,args:t}),this}pushPathSnapshot(e){return this.pushAction(e,this.path.map(_u))}draw(e=!1,t){let n=t;n!=null&&typeof n!=`function`&&(console.warn(`CanvasContext.draw callback is not a function, got ${typeof n}`),n=void 0);let r=this.getActions();this.canvasId&&T(`drawCanvas`,{canvasId:this.canvasId,moduleId:this.moduleId,actions:r,reserve:e,complete:n},`render`)}beginPath(){return this.path=[],this}closePath(){return this.pushPathAction(`closePath`)}moveTo(e,t){return this.pushPathAction(`moveTo`,e,t)}lineTo(e,t){return this.pushPathAction(this.path.length===0?`moveTo`:`lineTo`,e,t)}rect(e,t,n,r){return this.pushPathAction(`rect`,e,t,n,r)}arcTo(e,t,n,r,i){return this.pushPathAction(`arcTo`,e,t,n,r,i)}quadraticCurveTo(e,t,n,r){return this.pushPathAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushPathAction(`bezierCurveTo`,e,t,n,r,i,a)}arc(e,t,n,r,i,a=!1){return this.pushPathAction(`arc`,e,t,n,r,i,a)}fill(){return this.pushPathSnapshot(`fillPath`)}stroke(){return this.pushPathSnapshot(`strokePath`)}clip(){return this.pushPathSnapshot(`clip`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillRect(e,t,n,r){return this.pushAction(`fillPath`,[{type:`rect`,args:[e,t,n,r]}])}strokeRect(e,t,n,r){return this.pushAction(`strokePath`,[{type:`rect`,args:[e,t,n,r]}])}fillText(e,t,n,r){return this._pushText(`fillText`,e,t,n,r)}strokeText(e,t,n,r){return this._pushText(`strokeText`,e,t,n,r)}_pushText(e,t,n,r,i){if(i!=null){let a=Number(i);if(Number.isFinite(a))return this.pushAction(e,String(t),n,r,a)}return this.pushAction(e,String(t),n,r)}drawImage(e,...t){let n=ga(e),[r,i,a,o,s,c,l,u]=t;u===void 0&&([s,c,l,u]=[r,i,a,o],r=void 0,i=void 0,a=void 0,o=void 0);let d=e=>Number.isFinite(e);return d(r)&&d(i)&&d(a)&&d(o)?this.pushAction(`drawImage`,n,r,i,a,o,s,c,l,u):d(l)&&d(u)?this.pushAction(`drawImage`,n,s,c,l,u):this.pushAction(`drawImage`,n,s,c)}rotate(e){return this.pushAction(`rotate`,e)}translate(e,t){return this.pushAction(`translate`,e,t)}scale(e,t){if(Q([e,t]))return this;let n=this._transform;return this._transform={a:n.a*e,b:n.b*e,c:n.c*t,d:n.d*t,e:n.e,f:n.f},this.pushAction(`scale`,e,t)}transform(e,t,n,r,i,a){if(Q([e,t,n,r,i,a]))return this;let o=this._transform;return this._transform={a:e*o.a+t*o.c,b:e*o.b+t*o.d,c:n*o.a+r*o.c,d:n*o.b+r*o.d,e:i*o.a+a*o.c+o.e,f:i*o.b+a*o.d+o.f},this.pushAction(`transform`,e,t,n,r,i,a)}setTransform(e,t,n,r,i,a){return Q([e,t,n,r,i,a])?this:(this._transform={a:e,b:t,c:n,d:r,e:i,f:a},this.pushAction(`setTransform`,e,t,n,r,i,a))}getTransform(){return this._transform}save(){return this.drawingState.push(this.state),this.pushAction(`save`)}restore(){return this.state=this.drawingState.pop()||gu(),this.pushAction(`restore`)}setFillStyle(e){return this.pushAction(`setFillStyle`,ba(e))}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,ba(e))}setGlobalAlpha(e){return this.pushAction(`setGlobalAlpha`,e)}setLineCap(e){return this.pushAction(`setLineCap`,e)}setLineJoin(e){return this.pushAction(`setLineJoin`,e)}setLineWidth(e){return this.pushAction(`setLineWidth`,e)}setMiterLimit(e){return this.pushAction(`setMiterLimit`,e)}setTextAlign(e){return this.pushAction(`setTextAlign`,e)}setTextBaseline(e){return this.pushAction(`setTextBaseline`,e)}setShadow(e,t,n,r){return Q([e,t,n])?this:(this.state.shadowOffsetX=e,this.state.shadowOffsetY=t,this.state.shadowBlur=n,this.state.shadowColor=r,this.pushAction(`setShadow`,e,t,n,r))}setFontSize(e){let t=Number(e);return Number.isFinite(t)?(this.state.font=Sa(this.state.font,t),this.state.fontSize=t,this.pushAction(`setFontSize`,t)):this}setLineDash(e,t){let n=Array.isArray(e)&&e.length?e:[0,0],r=t??0;return Q([n,r])?this:(this.state.lineDash=n,this.state.lineDashOffset=r,this.pushAction(`setLineDash`,n,r))}getLineDash(){return this.state.lineDash}set fillStyle(e){this.setFillStyle(e)}set strokeStyle(e){this.setStrokeStyle(e)}set globalAlpha(e){this.setGlobalAlpha(e)}set lineCap(e){this.setLineCap(e)}set lineJoin(e){this.setLineJoin(e)}set lineWidth(e){this.setLineWidth(e)}set miterLimit(e){this.setMiterLimit(e)}set textAlign(e){this.setTextAlign(e)}set textBaseline(e){this.setTextBaseline(e)}set globalCompositeOperation(e){this.pushAction(`setGlobalCompositeOperation`,e)}set lineDashOffset(e){Q([e])||(this.state.lineDashOffset=e,this.pushAction(`setLineDashOffset`,e))}set shadowBlur(e){Q([e])||(this.state.shadowBlur=e,this.pushAction(`setShadowBlur`,e))}set shadowColor(e){this.state.shadowColor=e,this.pushAction(`setShadowColor`,e)}set shadowOffsetX(e){Q([e])||(this.state.shadowOffsetX=e,this.pushAction(`setShadowOffsetX`,e))}set shadowOffsetY(e){Q([e])||(this.state.shadowOffsetY=e,this.pushAction(`setShadowOffsetY`,e))}set font(e){this.state.font=e;let t=xa(e);if(!t){console.warn(`Failed to set 'font' on 'CanvasContext': invalid format.`);return}this.state.fontStyle=t.fontStyle,this.state.fontWeight=t.fontWeight,this.state.fontSize=t.fontSize,this.state.fontFamily=t.fontFamily,this.pushAction(`setFont`,t.font)}get font(){return this.state.font}createLinearGradient(e,t,n,r){return _a(e,t,n,r)}createCircularGradient(e,t,n){return va(e,t,n)}createPattern(e,t){return ya(e,t)}measureText(e){return this._measureContext===void 0&&(this._measureContext=Ca()),{width:wa(this._measureContext,e,this.state.font,this.state.fontSize)}}},bu=t({canvasGetImageData:()=>Tu,canvasPutImageData:()=>Eu,canvasToTempFilePath:()=>wu,createCanvas:()=>So,createCanvasContext:()=>Su,createContext:()=>xu,createOffscreenCanvas:()=>xo,drawCanvas:()=>Cu});function xu(){return new yu}function Su(e,t){return new yu(e,ju(t))}function Cu(e={}){let t={...e,moduleId:e.moduleId||ju(e.component)};delete t.component,Array.isArray(t.actions)&&(t.actions=t.actions.filter(e=>!e||typeof e!=`object`?!1:e.args===void 0||Array.isArray(e.args)&&!Q(e.args))),T(`drawCanvas`,t,`render`)}function wu(e={},t){let n=Du(e,t);delete n.pixelRatio;let r=Number(x.getSystemInfo()?.pixelRatio);Number.isFinite(r)&&r>0&&(n.pixelRatio=r);for(let e of[`x`,`y`,`width`,`height`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&delete n[e];for(let e of[`destWidth`,`destHeight`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&(delete n[e],$(n,`${e} must be finite`));return T(`canvasToTempFilePath`,n,`render`)}function Tu(e={},t){let n=e.success,r=e.complete,i=Du(e,t);Ou(i,`x`),Ou(i,`y`),ku(i,`width`),ku(i,`height`);let a=fe(i.width,i.height,{transferable:!0});a&&$(i,a),typeof n==`function`&&(i.success=e=>n(Au(e))),typeof r==`function`&&(i.complete=e=>r(Au(e)));let o=T(`canvasGetImageData`,i,`render`);return o?.then?o.then(Au):o}function Eu(e={},t){let n=Du(e,t);Ou(n,`x`),Ou(n,`y`),(typeof n.width!=`number`||!Number.isFinite(n.width))&&$(n,`invalid width argument`),Object.prototype.toString.call(n.data)!==`[object Uint8ClampedArray]`&&$(n,`data argument must be an Uint8ClampedArray`);let r=n.data?.length,i=typeof n.height==`number`?n.height:Math.floor(r/n.width/4);n.height=i,(!Number.isFinite(i)||n.width*i*4!==r)&&$(n,`invalid data format`);let a=fe(n.width,i,{transferable:!0});return a&&$(n,a),n.canvasValidationError?delete n.data:n.data=Array.from(n.data),T(`canvasPutImageData`,n,`render`)}function Du(e,t){let n={...e,moduleId:e.moduleId||ju(t||e.component)};return delete n.component,n}function Ou(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n}function ku(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n,n===0&&$(e,`the source ${t} is 0`)}function $(e,t){e.canvasValidationError||=t}function Au(e){let t=Array.isArray(e)&&e.length===1?e[0]:e;return!t||!Object.prototype.hasOwnProperty.call(t,`data`)||t.data instanceof Uint8ClampedArray?t:{...t,data:new Uint8ClampedArray(t.data)}}function ju(e){return e?.__id__||w.getPageInfo()?.id}var Mu=t({nextTick:()=>Iu}),Nu=[],Pu=null;function Fu(){let e=Nu;Nu=[],Pu=null;for(let t=0;t<e.length;t++)e[t]()}function Iu(e){n(e)&&(Nu.push(e),Pu||=setTimeout(Fu,0))}var Lu=t({disableAlertBeforeUnload:()=>Gu,enableAlertBeforeUnload:()=>Wu,hideLoading:()=>Uu,hideToast:()=>zu,showActionSheet:()=>Hu,showLoading:()=>Vu,showModal:()=>Bu,showToast:()=>Ru});function Ru(e){return T(`showToast`,e)}function zu(e){return T(`hideToast`,e)}function Bu(e){return T(`showModal`,e)}function Vu(e){return T(`showLoading`,e)}function Hu(e){return T(`showActionSheet`,e)}function Uu(e){return T(`hideLoading`,e)}function Wu(e){return T(`enableAlertBeforeUnload`,e)}function Gu(e){return T(`disableAlertBeforeUnload`,e)}var Ku=t({getMenuButtonBoundingClientRect:()=>Ju,offMenuButtonBoundingClientRectWeightChange:()=>Xu,onMenuButtonBoundingClientRectWeightChange:()=>Yu}),qu=new Set;x.onUpdate(e=>{e.menuRect&&qu.forEach(t=>t(e.menuRect))});function Ju(){return T(`getMenuButtonBoundingClientRect`)}function Yu(e){n(e)&&qu.add(e)}function Xu(e){n(e)?qu.delete(e):qu.clear()}var Zu=t({hideHomeButton:()=>nd,hideNavigationBarLoading:()=>td,setNavigationBarColor:()=>ed,setNavigationBarTitle:()=>$u,showNavigationBarLoading:()=>Qu});function Qu(e){return T(`showNavigationBarLoading`,e)}function $u(e){return T(`setNavigationBarTitle`,e)}function ed(e){return T(`setNavigationBarColor`,e)}function td(e){return T(`hideNavigationBarLoading`,e)}function nd(e){return T(`hideHomeButton`,e)}var rd=t({startPullDownRefresh:()=>ad,stopPullDownRefresh:()=>id});function id(e){return T(`stopPullDownRefresh`,e)}function ad(e){return T(`startPullDownRefresh`,e)}var od=t({pageScrollTo:()=>sd});function sd(e){return T(`pageScrollTo`,e)}var cd=t({hideTabBar:()=>fd,hideTabBarRedDot:()=>gd,removeTabBarBadge:()=>md,setTabBarBadge:()=>pd,setTabBarItem:()=>ud,setTabBarStyle:()=>ld,showTabBar:()=>dd,showTabBarRedDot:()=>hd});function ld(e){return T(`setTabBarStyle`,e)}function ud(e){return T(`setTabBarItem`,e)}function dd(e){return T(`showTabBar`,e)}function fd(e){return T(`hideTabBar`,e)}function pd(e){return T(`setTabBarBadge`,e)}function md(e){return T(`removeTabBarBadge`,e)}function hd(e){return T(`showTabBarRedDot`,e)}function gd(e){return T(`hideTabBarRedDot`,e)}var _d=t({onWindowResize:()=>vd});function vd(e){e&&T(`onWindowResize`,{success:e})}var yd=Object.assign({"./core/base/app-event/index.js":bt,"./core/base/index.js":bn,"./core/base/performance/index.js":Tn,"./core/base/subpackage/index.js":An,"./core/base/system/index.js":Nn,"./core/base/update/index.js":Gn,"./core/camera/index.js":$n,"./core/data-analysis/index.js":nr,"./core/device/bluetooth/index.js":yr,"./core/device/bluetooth-ble/index.js":Fr,"./core/device/clipboard/index.js":ti,"./core/device/contact/index.js":ii,"./core/device/keyboard/index.js":si,"./core/device/memory/index.js":li,"./core/device/network/index.js":xi,"./core/device/phone/index.js":Ei,"./core/device/scan/index.js":Oi,"./core/device/screen/index.js":Ai,"./core/device/touch/index.js":zi,"./core/device/vibrate/index.js":Ji,"./core/ext/index.js":Zi,"./core/file/index.js":ln,"./core/life-cycle/index.js":bs,"./core/location/index.js":Cs,"./core/map/index.js":As,"./core/media/audio/index.js":Ns,"./core/media/image/index.js":Ls,"./core/media/video/index.js":Ks,"./core/navigate/index.js":ec,"./core/network/download/index.js":ac,"./core/network/mdns/index.js":sc,"./core/network/request/index.js":Sc,"./core/network/tcp/index.js":wc,"./core/network/udp/index.js":Dc,"./core/network/upload/index.js":Ac,"./core/network/websocket/index.js":Fc,"./core/open-api/account-info/index.js":jl,"./core/open-api/authorize/index.js":Nl,"./core/open-api/index.js":Fl,"./core/open-api/login/index.js":Ll,"./core/open-api/privacy/index.js":zl,"./core/open-api/setting/index.js":Vl,"./core/open-api/user-info/index.js":Wl,"./core/payment/index.js":Kl,"./core/route/index.js":mt,"./core/share/index.js":Jl,"./core/storage/index.js":Ql,"./core/ui/animation/index.js":lu,"./core/ui/background/index.js":fu,"./core/ui/canvas/index.js":bu,"./core/ui/custom-component/index.js":Mu,"./core/ui/interaction/index.js":Lu,"./core/ui/menu/index.js":Ku,"./core/ui/navigation-bar/index.js":Zu,"./core/ui/pull-down-refresh/index.js":rd,"./core/ui/scroll/index.js":od,"./core/ui/tab-bar/index.js":cd,"./core/ui/window/index.js":_d,"./core/wxml/intersection-observer/index.js":No,"./core/wxml/media-query-observer/index.js":Io,"./core/wxml/selector-query/index.js":Eo}),bd={},xd=new Set([`SocketTask`,`readyState`,`offSocketOpen`,`offSocketMessage`,`offSocketError`,`offSocketClose`,`onUnhandledRejection`,`onPageNotFound`,`onAppRoute`]);for(let e of Object.values(yd))for(let[t,n]of Object.entries(e))bd[t]=n;function Sd(e){for(let t of e||[])typeof t!=`string`||xd.has(t)||Object.prototype.hasOwnProperty.call(bd,t)||t in Object.prototype||Object.defineProperty(bd,t,{value:(...e)=>T(t,...e),writable:!0,enumerable:!0,configurable:!0})}var Cd=new Proxy(bd,{get(e,t,n){return xd.has(t)?void 0:Reflect.get(e,t,n)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),wd=new class{constructor(){this.init()}init(){globalThis.__diminaReportError=S,Ye();let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}Sd(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=Cd;globalThis.modRequire=v,globalThis.modDefine=se,globalThis.global={},globalThis.App=(e={})=>{J.createAppModule(e),Y.createApp()},globalThis.Page=e=>{J.createModule(e,globalThis.__extraInfo,q.type)},globalThis.Component=e=>{J.createModule(e,globalThis.__extraInfo,K.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>Y.getApp(e),globalThis.getCurrentPages=()=>w.stack()}},Td={navigateBack:yt,navigateTo:vt,reLaunch:gt,redirectTo:_t,switchTab:ht};return new class{constructor(){console.log(`[service] init`),this.env=wd,this.message=C,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o,query:s,resourceLoadId:c,runtimeType:l,scene:u,referrerInfo:d}=e;o&&x.init(o),Y.setRuntimeType(l),Y.setAppLaunchOptions({scene:u,pagePath:r,query:s,referrerInfo:d}),J.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c,runtimeType:l})&&Y.isMiniGame()&&Y.gameLaunch()}),this.message.on(`hostEnvUpdate`,e=>{x.update(e)}),this.message.on(`gameTouch`,({eventType:e,...t})=>{Ri(e,t)}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await Y.triggerEvent({bridgeId:t,moduleId:n,methodName:r,event:i});o!==void 0&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:t,moduleId:n,success:a,data:o}})}),this.message.on(`triggerCallback`,e=>{let{id:t,args:n}=e;y.invoke(t,n)}),this.message.on(`flushCallbacks`,({requestId:e})=>{this.message.invoke({type:`callbacksFlushed`,target:`container`,body:{requestId:e}})}),this.message.on(`componentInvokeAPI`,e=>{let{apiName:t,bridgeId:n,callbacks:r={},params:i={}}=e,a,o,s=(e,t)=>{e&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:n,data:t,success:e}})};r.success&&(a=y.store(e=>s(r.success,e))),r.fail&&(o=y.store(e=>s(r.fail,e)));let c=y.store(e=>{s(r.complete,e),y.remove(a),y.remove(o)});this.message.invoke({type:`invokeAPI`,target:`container`,body:{name:t,bridgeId:n,params:{...i,complete:c,fail:o,success:a}}})}),this.message.on(`resourceLoadFailed`,({bridgeId:e,pagePath:t,errors:n=[]})=>{console.error(`[service] resourceLoadFailed: bridgeId: ${e}, pagePath: ${t}, errors: ${n.join(`; `)}`)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,pagePath:n,query:r,resourceLoadId:i,stackId:a}=e;if(Y.isMiniGame())return;let o=J.getModuleByPath(n);if(!o){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let s=J.getPropsByPath(o.usingComponents),c=`page_${p()}`,l=Y.createInstance({bridgeId:t,moduleId:c,path:n,query:r,stackId:a,deferInitialData:!0,deferPageLoad:!0});C.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:c,pagePath:n,initialProps:s,query:r,resourceLoadId:i}}),l?.sendInitialData()}),this.message.on(`appShow`,e=>{Y.appShow(e)}),this.message.on(`appHide`,()=>{Y.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{Y.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{Y.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{Y.createInstance(e)}),this.message.on(`mA`,e=>{Y.moduleAttached(e)}),this.message.on(`mR`,e=>{Y.moduleReady(e)}),this.message.on(`mU`,e=>{Y.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{Y.pageUnload(e)}),this.message.on(`pageShow`,e=>{Y.pageShow(e)}),this.message.on(`pageReady`,e=>{Y.pageReady(e)}),this.message.on(`pageAttached`,e=>{Y.pageAttached(e)}),this.message.on(`pageHide`,e=>{Y.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{Y.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{Y.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=Y.pageShareAppMessage(e);e?.success&&this.message.send({type:`triggerCallback`,target:`container`,body:{bridgeId:e.bridgeId,id:e.success,args:[t],data:t}})}),this.message.on(`pageScroll`,e=>{Y.pageScroll(e)}),this.message.on(`pageResize`,e=>{Y.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{Y.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;Y.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{Y.componentError(e)}),this.message.on(`h5SdkAction`,async(e={})=>{let t=e?.name?.replace(/h5/i,``),{url:n}=e?.params?.data?.params||{};if(e.params&&(e.params.data={...e.params?.data,...e.params?.data?.params||{}}),t===`postMessage`&&e.parentWebViewId){let{moduleId:t,attrs:n,params:r}=e,i={detail:{data:[r?.data?.params?.data]}},a=n.message,o=e.parentWebViewId,s=await Y.triggerEvent({bridgeId:o,moduleId:t,methodName:a,event:i});s!==void 0&&this.message.send({type:`triggerCallback`,target:`service`,body:{bridgeId:o,moduleId:t,success:r?.success,data:s}})}Td[t]?.({url:n,...e.params})})}}})();