@weapp-vite/web 1.3.36 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/README.md +144 -5
  2. package/dist/_virtual/_rolldown/runtime.mjs +19 -1
  3. package/dist/compiler/wxml/attributes.mjs +1 -1
  4. package/dist/compiler/wxml/attributes.mjs.map +1 -1
  5. package/dist/compiler/wxml/compile.mjs +6 -3
  6. package/dist/compiler/wxml/compile.mjs.map +1 -1
  7. package/dist/compiler/wxml/interpolation.mjs +1 -2
  8. package/dist/compiler/wxml/interpolation.mjs.map +1 -1
  9. package/dist/compiler/wxml/navigation.mjs +5 -7
  10. package/dist/compiler/wxml/navigation.mjs.map +1 -1
  11. package/dist/compiler/wxml/parser.mjs +5 -5
  12. package/dist/compiler/wxml/parser.mjs.map +1 -1
  13. package/dist/compiler/wxml/renderer.mjs +13 -12
  14. package/dist/compiler/wxml/renderer.mjs.map +1 -1
  15. package/dist/compiler/wxml/specialNodes.mjs +6 -1
  16. package/dist/compiler/wxml/specialNodes.mjs.map +1 -1
  17. package/dist/compiler/wxml/types.d.mts +12 -0
  18. package/dist/compiler/wxs.mjs +5 -5
  19. package/dist/compiler/wxs.mjs.map +1 -1
  20. package/dist/css/wxss.d.mts +1 -0
  21. package/dist/css/wxss.mjs +110 -9
  22. package/dist/css/wxss.mjs.map +1 -1
  23. package/dist/index.d.mts +29 -6
  24. package/dist/index.mjs +197 -4
  25. package/dist/index.mjs.map +1 -0
  26. package/dist/plugin/assets.d.mts +7 -0
  27. package/dist/plugin/assets.mjs +122 -0
  28. package/dist/plugin/assets.mjs.map +1 -0
  29. package/dist/plugin/constants.mjs +10 -1
  30. package/dist/plugin/constants.mjs.map +1 -1
  31. package/dist/plugin/dependencyScan.mjs +41 -0
  32. package/dist/plugin/dependencyScan.mjs.map +1 -0
  33. package/dist/plugin/entry.mjs +56 -7
  34. package/dist/plugin/entry.mjs.map +1 -1
  35. package/dist/plugin/files.mjs +1 -1
  36. package/dist/plugin/files.mjs.map +1 -1
  37. package/dist/plugin/index.d.mts +37 -3
  38. package/dist/plugin/index.mjs +245 -74
  39. package/dist/plugin/index.mjs.map +1 -1
  40. package/dist/plugin/layout.mjs +24 -0
  41. package/dist/plugin/layout.mjs.map +1 -0
  42. package/dist/plugin/path.mjs +4 -1
  43. package/dist/plugin/path.mjs.map +1 -1
  44. package/dist/plugin/register.mjs +48 -36
  45. package/dist/plugin/register.mjs.map +1 -1
  46. package/dist/plugin/scan.mjs +206 -94
  47. package/dist/plugin/scan.mjs.map +1 -1
  48. package/dist/plugin/scanSfc.mjs +65 -0
  49. package/dist/plugin/scanSfc.mjs.map +1 -0
  50. package/dist/plugin/state.mjs +3 -2
  51. package/dist/plugin/state.mjs.map +1 -1
  52. package/dist/plugin/styleModule.mjs +52 -0
  53. package/dist/plugin/styleModule.mjs.map +1 -0
  54. package/dist/plugin/types.d.mts +46 -1
  55. package/dist/plugin/vueSfc.mjs +149 -0
  56. package/dist/plugin/vueSfc.mjs.map +1 -0
  57. package/dist/runtime/appShell/container.mjs +25 -0
  58. package/dist/runtime/appShell/container.mjs.map +1 -0
  59. package/dist/runtime/appShell/tabBar/index.mjs +192 -0
  60. package/dist/runtime/appShell/tabBar/index.mjs.map +1 -0
  61. package/dist/runtime/appShell/tabBar/style.mjs +127 -0
  62. package/dist/runtime/appShell/tabBar/style.mjs.map +1 -0
  63. package/dist/runtime/button/helpers.mjs +1 -58
  64. package/dist/runtime/button/helpers.mjs.map +1 -1
  65. package/dist/runtime/button/index.d.mts +4 -5
  66. package/dist/runtime/button/index.mjs +6 -28
  67. package/dist/runtime/button/index.mjs.map +1 -1
  68. package/dist/runtime/button/style.mjs +53 -28
  69. package/dist/runtime/button/style.mjs.map +1 -1
  70. package/dist/runtime/component/behavior.mjs +26 -2
  71. package/dist/runtime/component/behavior.mjs.map +1 -1
  72. package/dist/runtime/component/element.mjs +107 -31
  73. package/dist/runtime/component/element.mjs.map +1 -1
  74. package/dist/runtime/component/observers.mjs +36 -0
  75. package/dist/runtime/component/observers.mjs.map +1 -0
  76. package/dist/runtime/component/publicInstance.mjs +48 -0
  77. package/dist/runtime/component/publicInstance.mjs.map +1 -0
  78. package/dist/runtime/component/relations.mjs +35 -0
  79. package/dist/runtime/component/relations.mjs.map +1 -0
  80. package/dist/runtime/component/slots.mjs +24 -0
  81. package/dist/runtime/component/slots.mjs.map +1 -0
  82. package/dist/runtime/component/state.mjs +13 -3
  83. package/dist/runtime/component/state.mjs.map +1 -1
  84. package/dist/runtime/component/types.d.mts +29 -4
  85. package/dist/runtime/component/virtualHost.mjs +83 -0
  86. package/dist/runtime/component/virtualHost.mjs.map +1 -0
  87. package/dist/runtime/host/index.d.mts +13 -0
  88. package/dist/runtime/host/index.mjs +47 -0
  89. package/dist/runtime/host/index.mjs.map +1 -0
  90. package/dist/runtime/host/types.d.mts +28 -0
  91. package/dist/runtime/hostGlobals.d.mts +9 -0
  92. package/dist/runtime/hostGlobals.mjs +39 -0
  93. package/dist/runtime/hostGlobals.mjs.map +1 -0
  94. package/dist/runtime/index.d.mts +21 -3
  95. package/dist/runtime/index.mjs +26 -4
  96. package/dist/runtime/index.mjs.map +1 -0
  97. package/dist/runtime/legacyTemplate/dom.mjs +3 -3
  98. package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
  99. package/dist/runtime/legacyTemplate/expression.mjs +9 -9
  100. package/dist/runtime/legacyTemplate/expression.mjs.map +1 -1
  101. package/dist/runtime/legacyTemplate/index.mjs +6 -6
  102. package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
  103. package/dist/runtime/nativeComponents/canvas/index.mjs +53 -0
  104. package/dist/runtime/nativeComponents/canvas/index.mjs.map +1 -0
  105. package/dist/runtime/nativeComponents/checkbox.mjs +137 -0
  106. package/dist/runtime/nativeComponents/checkbox.mjs.map +1 -0
  107. package/dist/runtime/nativeComponents/cover/index.mjs +23 -0
  108. package/dist/runtime/nativeComponents/cover/index.mjs.map +1 -0
  109. package/dist/runtime/nativeComponents/form.d.mts +7 -0
  110. package/dist/runtime/nativeComponents/form.mjs +50 -0
  111. package/dist/runtime/nativeComponents/form.mjs.map +1 -0
  112. package/dist/runtime/nativeComponents/formControl.mjs +61 -0
  113. package/dist/runtime/nativeComponents/formControl.mjs.map +1 -0
  114. package/dist/runtime/nativeComponents/helpers.mjs +25 -0
  115. package/dist/runtime/nativeComponents/helpers.mjs.map +1 -0
  116. package/dist/runtime/nativeComponents/icon/helpers.mjs +42 -0
  117. package/dist/runtime/nativeComponents/icon/helpers.mjs.map +1 -0
  118. package/dist/runtime/nativeComponents/icon/index.mjs +45 -0
  119. package/dist/runtime/nativeComponents/icon/index.mjs.map +1 -0
  120. package/dist/runtime/nativeComponents/icon/style.mjs +176 -0
  121. package/dist/runtime/nativeComponents/icon/style.mjs.map +1 -0
  122. package/dist/runtime/nativeComponents/image.d.mts +8 -0
  123. package/dist/runtime/nativeComponents/image.mjs +121 -0
  124. package/dist/runtime/nativeComponents/image.mjs.map +1 -0
  125. package/dist/runtime/nativeComponents/index.d.mts +11 -0
  126. package/dist/runtime/nativeComponents/index.mjs +83 -0
  127. package/dist/runtime/nativeComponents/index.mjs.map +1 -0
  128. package/dist/runtime/nativeComponents/input.d.mts +8 -0
  129. package/dist/runtime/nativeComponents/input.mjs +131 -0
  130. package/dist/runtime/nativeComponents/input.mjs.map +1 -0
  131. package/dist/runtime/nativeComponents/label.mjs +36 -0
  132. package/dist/runtime/nativeComponents/label.mjs.map +1 -0
  133. package/dist/runtime/nativeComponents/mediaRegistry.mjs +47 -0
  134. package/dist/runtime/nativeComponents/mediaRegistry.mjs.map +1 -0
  135. package/dist/runtime/nativeComponents/movable/helpers.mjs +23 -0
  136. package/dist/runtime/nativeComponents/movable/helpers.mjs.map +1 -0
  137. package/dist/runtime/nativeComponents/movable/index.mjs +117 -0
  138. package/dist/runtime/nativeComponents/movable/index.mjs.map +1 -0
  139. package/dist/runtime/nativeComponents/navigator.mjs +200 -0
  140. package/dist/runtime/nativeComponents/navigator.mjs.map +1 -0
  141. package/dist/runtime/nativeComponents/picker/editors.mjs +74 -0
  142. package/dist/runtime/nativeComponents/picker/editors.mjs.map +1 -0
  143. package/dist/runtime/nativeComponents/picker/helpers.mjs +57 -0
  144. package/dist/runtime/nativeComponents/picker/helpers.mjs.map +1 -0
  145. package/dist/runtime/nativeComponents/picker/index.mjs +210 -0
  146. package/dist/runtime/nativeComponents/picker/index.mjs.map +1 -0
  147. package/dist/runtime/nativeComponents/picker/style.mjs +71 -0
  148. package/dist/runtime/nativeComponents/picker/style.mjs.map +1 -0
  149. package/dist/runtime/nativeComponents/pickerView/column.mjs +134 -0
  150. package/dist/runtime/nativeComponents/pickerView/column.mjs.map +1 -0
  151. package/dist/runtime/nativeComponents/pickerView/helpers.mjs +17 -0
  152. package/dist/runtime/nativeComponents/pickerView/helpers.mjs.map +1 -0
  153. package/dist/runtime/nativeComponents/pickerView/index.mjs +128 -0
  154. package/dist/runtime/nativeComponents/pickerView/index.mjs.map +1 -0
  155. package/dist/runtime/nativeComponents/pickerView/style.mjs +58 -0
  156. package/dist/runtime/nativeComponents/pickerView/style.mjs.map +1 -0
  157. package/dist/runtime/nativeComponents/primitives.mjs +16 -0
  158. package/dist/runtime/nativeComponents/primitives.mjs.map +1 -0
  159. package/dist/runtime/nativeComponents/progress/helpers.mjs +29 -0
  160. package/dist/runtime/nativeComponents/progress/helpers.mjs.map +1 -0
  161. package/dist/runtime/nativeComponents/progress/index.mjs +130 -0
  162. package/dist/runtime/nativeComponents/progress/index.mjs.map +1 -0
  163. package/dist/runtime/nativeComponents/progress/style.mjs +40 -0
  164. package/dist/runtime/nativeComponents/progress/style.mjs.map +1 -0
  165. package/dist/runtime/nativeComponents/radio.mjs +147 -0
  166. package/dist/runtime/nativeComponents/radio.mjs.map +1 -0
  167. package/dist/runtime/nativeComponents/richText/helpers.mjs +230 -0
  168. package/dist/runtime/nativeComponents/richText/helpers.mjs.map +1 -0
  169. package/dist/runtime/nativeComponents/richText/index.mjs +74 -0
  170. package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -0
  171. package/dist/runtime/nativeComponents/scrollView.d.mts +15 -0
  172. package/dist/runtime/nativeComponents/scrollView.mjs +79 -0
  173. package/dist/runtime/nativeComponents/scrollView.mjs.map +1 -0
  174. package/dist/runtime/nativeComponents/slider/helpers.mjs +28 -0
  175. package/dist/runtime/nativeComponents/slider/helpers.mjs.map +1 -0
  176. package/dist/runtime/nativeComponents/slider/index.mjs +120 -0
  177. package/dist/runtime/nativeComponents/slider/index.mjs.map +1 -0
  178. package/dist/runtime/nativeComponents/slider/style.mjs +60 -0
  179. package/dist/runtime/nativeComponents/slider/style.mjs.map +1 -0
  180. package/dist/runtime/nativeComponents/style.mjs +41 -0
  181. package/dist/runtime/nativeComponents/style.mjs.map +1 -0
  182. package/dist/runtime/nativeComponents/swiper/helpers.mjs +52 -0
  183. package/dist/runtime/nativeComponents/swiper/helpers.mjs.map +1 -0
  184. package/dist/runtime/nativeComponents/swiper/index.mjs +235 -0
  185. package/dist/runtime/nativeComponents/swiper/index.mjs.map +1 -0
  186. package/dist/runtime/nativeComponents/swiper/item.mjs +14 -0
  187. package/dist/runtime/nativeComponents/swiper/item.mjs.map +1 -0
  188. package/dist/runtime/nativeComponents/swiper/style.mjs +20 -0
  189. package/dist/runtime/nativeComponents/swiper/style.mjs.map +1 -0
  190. package/dist/runtime/nativeComponents/switch.d.mts +7 -0
  191. package/dist/runtime/nativeComponents/switch.mjs +132 -0
  192. package/dist/runtime/nativeComponents/switch.mjs.map +1 -0
  193. package/dist/runtime/nativeComponents/textarea.d.mts +9 -0
  194. package/dist/runtime/nativeComponents/textarea.mjs +144 -0
  195. package/dist/runtime/nativeComponents/textarea.mjs.map +1 -0
  196. package/dist/runtime/nativeComponents/video/helpers.d.mts +12 -0
  197. package/dist/runtime/nativeComponents/video/helpers.mjs +21 -0
  198. package/dist/runtime/nativeComponents/video/helpers.mjs.map +1 -0
  199. package/dist/runtime/nativeComponents/video/index.mjs +124 -0
  200. package/dist/runtime/nativeComponents/video/index.mjs.map +1 -0
  201. package/dist/runtime/nativeComponents/video/style.mjs +14 -0
  202. package/dist/runtime/nativeComponents/video/style.mjs.map +1 -0
  203. package/dist/runtime/navigationBar/index.mjs +1 -3
  204. package/dist/runtime/navigationBar/index.mjs.map +1 -1
  205. package/dist/runtime/pageLayout.d.mts +9 -0
  206. package/dist/runtime/pageLayout.mjs +16 -0
  207. package/dist/runtime/pageLayout.mjs.map +1 -0
  208. package/dist/runtime/polyfill/animation.mjs +120 -0
  209. package/dist/runtime/polyfill/animation.mjs.map +1 -0
  210. package/dist/runtime/polyfill/appState.mjs +1 -1
  211. package/dist/runtime/polyfill/appState.mjs.map +1 -1
  212. package/dist/runtime/polyfill/async.d.mts +7 -0
  213. package/dist/runtime/polyfill/async.mjs.map +1 -1
  214. package/dist/runtime/polyfill/canvasContext.mjs +41 -0
  215. package/dist/runtime/polyfill/canvasContext.mjs.map +1 -1
  216. package/dist/runtime/polyfill/device.mjs +1 -1
  217. package/dist/runtime/polyfill/device.mjs.map +1 -1
  218. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +8 -2
  219. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
  220. package/dist/runtime/polyfill/eventBus.mjs +56 -0
  221. package/dist/runtime/polyfill/eventBus.mjs.map +1 -0
  222. package/dist/runtime/polyfill/fileSystemManager.mjs +5 -2
  223. package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
  224. package/dist/runtime/polyfill/files.mjs +10 -10
  225. package/dist/runtime/polyfill/files.mjs.map +1 -1
  226. package/dist/runtime/polyfill/font.mjs +32 -0
  227. package/dist/runtime/polyfill/font.mjs.map +1 -0
  228. package/dist/runtime/polyfill/index.d.mts +2 -2
  229. package/dist/runtime/polyfill/index.mjs +49 -45
  230. package/dist/runtime/polyfill/index.mjs.map +1 -1
  231. package/dist/runtime/polyfill/interaction.mjs +7 -6
  232. package/dist/runtime/polyfill/interaction.mjs.map +1 -1
  233. package/dist/runtime/polyfill/interactionApi.mjs +3 -2
  234. package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
  235. package/dist/runtime/polyfill/intersectionObserver.mjs +106 -0
  236. package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -0
  237. package/dist/runtime/polyfill/locale.mjs +14 -0
  238. package/dist/runtime/polyfill/locale.mjs.map +1 -0
  239. package/dist/runtime/polyfill/locationApi.mjs +7 -4
  240. package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
  241. package/dist/runtime/polyfill/mediaActions.mjs +2 -2
  242. package/dist/runtime/polyfill/mediaActions.mjs.map +1 -1
  243. package/dist/runtime/polyfill/mediaApi/file.mjs +1 -1
  244. package/dist/runtime/polyfill/mediaApi/info.mjs +6 -4
  245. package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
  246. package/dist/runtime/polyfill/menuApi.mjs +38 -4
  247. package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
  248. package/dist/runtime/polyfill/navigationBarRuntime.mjs +6 -1
  249. package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
  250. package/dist/runtime/polyfill/network/request.mjs +2 -2
  251. package/dist/runtime/polyfill/network/request.mjs.map +1 -1
  252. package/dist/runtime/polyfill/platformApi.mjs +1 -1
  253. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +88 -0
  254. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs.map +1 -0
  255. package/dist/runtime/polyfill/routeRuntime/dom.mjs +44 -15
  256. package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -1
  257. package/dist/runtime/polyfill/routeRuntime/history.d.mts +30 -0
  258. package/dist/runtime/polyfill/routeRuntime/history.mjs +148 -0
  259. package/dist/runtime/polyfill/routeRuntime/history.mjs.map +1 -0
  260. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +39 -8
  261. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -1
  262. package/dist/runtime/polyfill/routeRuntime/options.d.mts +11 -1
  263. package/dist/runtime/polyfill/routeRuntime/options.mjs +0 -1
  264. package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
  265. package/dist/runtime/polyfill/routeRuntime/result.mjs +12 -0
  266. package/dist/runtime/polyfill/routeRuntime/result.mjs.map +1 -0
  267. package/dist/runtime/polyfill/routeRuntime/scroll.mjs +39 -0
  268. package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -0
  269. package/dist/runtime/polyfill/routeRuntime/stack.mjs +122 -0
  270. package/dist/runtime/polyfill/routeRuntime/stack.mjs.map +1 -0
  271. package/dist/runtime/polyfill/routeRuntime.d.mts +26 -17
  272. package/dist/runtime/polyfill/routeRuntime.mjs +121 -96
  273. package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
  274. package/dist/runtime/polyfill/runtimeDataApi.mjs +8 -3
  275. package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
  276. package/dist/runtime/polyfill/runtimeOps.mjs +10 -6
  277. package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
  278. package/dist/runtime/polyfill/selectorQuery.mjs +70 -14
  279. package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
  280. package/dist/runtime/polyfill/storage.mjs +5 -2
  281. package/dist/runtime/polyfill/storage.mjs.map +1 -1
  282. package/dist/runtime/polyfill/system.mjs +30 -3
  283. package/dist/runtime/polyfill/system.mjs.map +1 -1
  284. package/dist/runtime/polyfill/types/locationRuntime.d.mts +1 -4
  285. package/dist/runtime/polyfill/types/platformRuntime.d.mts +9 -0
  286. package/dist/runtime/polyfill/types/systemAuth.d.mts +20 -9
  287. package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +25 -0
  288. package/dist/runtime/polyfill/ui.mjs +2 -6
  289. package/dist/runtime/polyfill/ui.mjs.map +1 -1
  290. package/dist/runtime/polyfill/uiMediaApi.d.mts +11 -10
  291. package/dist/runtime/polyfill/uiMediaApi.mjs +26 -2
  292. package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
  293. package/dist/runtime/polyfill/videoContext.mjs +4 -0
  294. package/dist/runtime/polyfill/videoContext.mjs.map +1 -1
  295. package/dist/runtime/polyfill/vkSession.mjs +4 -14
  296. package/dist/runtime/polyfill/vkSession.mjs.map +1 -1
  297. package/dist/runtime/polyfill.d.mts +2 -2
  298. package/dist/runtime/renderContext.mjs +1 -1
  299. package/dist/runtime/renderContext.mjs.map +1 -1
  300. package/dist/runtime/rpx.mjs +17 -8
  301. package/dist/runtime/rpx.mjs.map +1 -1
  302. package/dist/runtime/seo/index.d.mts +31 -0
  303. package/dist/runtime/seo/index.mjs +94 -0
  304. package/dist/runtime/seo/index.mjs.map +1 -0
  305. package/dist/runtime/viewport/index.d.mts +12 -0
  306. package/dist/runtime/viewport/index.mjs +44 -0
  307. package/dist/runtime/viewport/index.mjs.map +1 -0
  308. package/dist/runtime/viewport/style.mjs +62 -0
  309. package/dist/runtime/viewport/style.mjs.map +1 -0
  310. package/dist/runtime/viewport/types.d.mts +14 -0
  311. package/dist/runtime/wevu.d.mts +20 -0
  312. package/dist/runtime/wevu.mjs +73 -0
  313. package/dist/runtime/wevu.mjs.map +1 -0
  314. package/dist/shared/nativeComponents.mjs +401 -0
  315. package/dist/shared/nativeComponents.mjs.map +1 -0
  316. package/dist/shared/tabBar.d.mts +19 -0
  317. package/dist/shared/tabBar.mjs +37 -0
  318. package/dist/shared/tabBar.mjs.map +1 -0
  319. package/dist/shared/wxml.mjs +3 -20
  320. package/dist/shared/wxml.mjs.map +1 -1
  321. package/package.json +13 -5
@@ -1,3 +1,4 @@
1
+ import { openRuntimeUrl } from "../host/index.mjs";
1
2
  import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
2
3
  import { getGlobalDialogHandlers } from "./ui.mjs";
3
4
  import { readClipboardData, resolveScanCodeResult, writeClipboardData } from "./interaction.mjs";
@@ -5,8 +6,8 @@ import { readClipboardData, resolveScanCodeResult, writeClipboardData } from "./
5
6
  //#region src/runtime/polyfill/interactionApi.ts
6
7
  function openCustomerServiceChatBridge(options) {
7
8
  const url = options?.url?.trim() ?? "";
8
- if (url && typeof window !== "undefined" && typeof window.open === "function") try {
9
- window.open(url, "_blank", "noopener,noreferrer");
9
+ if (url) try {
10
+ openRuntimeUrl(url, "_blank", "noopener,noreferrer");
10
11
  } catch {}
11
12
  return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "openCustomerServiceChat:ok" }));
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interactionApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/interactionApi.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n readClipboardData,\n resolveScanCodeResult,\n writeClipboardData,\n} from './interaction'\nimport { getGlobalDialogHandlers } from './ui'\n\nexport function openCustomerServiceChatBridge(options?: any) {\n const url = options?.url?.trim() ?? ''\n if (url && typeof window !== 'undefined' && typeof window.open === 'function') {\n try {\n window.open(url, '_blank', 'noopener,noreferrer')\n }\n catch {\n // ignore browser popup restrictions\n }\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'openCustomerServiceChat:ok' }))\n}\n\nexport function scanCodeBridge(options?: any) {\n const { prompt } = getGlobalDialogHandlers()\n const resultText = resolveScanCodeResult(prompt)\n if (resultText == null) {\n const failure = callMiniProgramAsyncFailure(options, 'scanCode:fail cancel')\n return Promise.reject(failure)\n }\n const result = callMiniProgramAsyncSuccess(options, {\n errMsg: 'scanCode:ok',\n result: resultText,\n scanType: 'QR_CODE',\n charSet: 'utf-8',\n path: resultText,\n rawData: resultText,\n })\n return Promise.resolve(result)\n}\n\nexport async function setClipboardDataBridge(options?: any) {\n const data = String(options?.data ?? '')\n try {\n await writeClipboardData(data)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `setClipboardData:fail ${message}`)\n return Promise.reject(failure)\n }\n return callMiniProgramAsyncSuccess(options, { errMsg: 'setClipboardData:ok' })\n}\n\nexport async function getClipboardDataBridge(options?: any) {\n try {\n const data = await readClipboardData()\n return callMiniProgramAsyncSuccess(options, { errMsg: 'getClipboardData:ok', data })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getClipboardData:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n"],"mappings":";;;;;AAWA,SAAgB,8BAA8B,SAAe;CAC3D,MAAM,MAAM,SAAS,KAAK,KAAK,KAAK;CACpC,IAAI,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,SAAS,YACjE,IAAI;EACF,OAAO,KAAK,KAAK,UAAU,qBAAqB;CAClD,QACM,CAEN;CAEF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,6BAA6B,CAAC,CAAC;AACvG;AAEA,SAAgB,eAAe,SAAe;CAC5C,MAAM,EAAE,WAAW,wBAAwB;CAC3C,MAAM,aAAa,sBAAsB,MAAM;CAC/C,IAAI,cAAc,MAAM;EACtB,MAAM,UAAU,4BAA4B,SAAS,sBAAsB;EAC3E,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,MAAM,SAAS,4BAA4B,SAAS;EAClD,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,SAAS;EACT,MAAM;EACN,SAAS;CACX,CAAC;CACD,OAAO,QAAQ,QAAQ,MAAM;AAC/B;AAEA,eAAsB,uBAAuB,SAAe;CAC1D,MAAM,OAAO,OAAO,SAAS,QAAQ,EAAE;CACvC,IAAI;EACF,MAAM,mBAAmB,IAAI;CAC/B,SACO,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,yBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACkB;EACvF,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,OAAO,4BAA4B,SAAS,EAAE,QAAQ,sBAAsB,CAAC;AAC/E;AAEA,eAAsB,uBAAuB,SAAe;CAC1D,IAAI;EAEF,OAAO,4BAA4B,SAAS;GAAE,QAAQ;GAAuB,YAD1D,kBAAkB;EAC6C,CAAC;CACrF,SACO,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,yBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACkB;EACvF,OAAO,QAAQ,OAAO,OAAO;CAC/B;AACF"}
1
+ {"version":3,"file":"interactionApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/interactionApi.ts"],"sourcesContent":["import { openRuntimeUrl } from '../host'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n readClipboardData,\n resolveScanCodeResult,\n writeClipboardData,\n} from './interaction'\nimport { getGlobalDialogHandlers } from './ui'\n\nexport function openCustomerServiceChatBridge(options?: any) {\n const url = options?.url?.trim() ?? ''\n if (url) {\n try {\n openRuntimeUrl(url, '_blank', 'noopener,noreferrer')\n }\n catch {\n // ignore browser popup restrictions\n }\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'openCustomerServiceChat:ok' }))\n}\n\nexport function scanCodeBridge(options?: any) {\n const { prompt } = getGlobalDialogHandlers()\n const resultText = resolveScanCodeResult(prompt)\n if (resultText == null) {\n const failure = callMiniProgramAsyncFailure(options, 'scanCode:fail cancel')\n return Promise.reject(failure)\n }\n const result = callMiniProgramAsyncSuccess(options, {\n errMsg: 'scanCode:ok',\n result: resultText,\n scanType: 'QR_CODE',\n charSet: 'utf-8',\n path: resultText,\n rawData: resultText,\n })\n return Promise.resolve(result)\n}\n\nexport async function setClipboardDataBridge(options?: any) {\n const data = String(options?.data ?? '')\n try {\n await writeClipboardData(data)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `setClipboardData:fail ${message}`)\n return Promise.reject(failure)\n }\n return callMiniProgramAsyncSuccess(options, { errMsg: 'setClipboardData:ok' })\n}\n\nexport async function getClipboardDataBridge(options?: any) {\n try {\n const data = await readClipboardData()\n return callMiniProgramAsyncSuccess(options, { errMsg: 'getClipboardData:ok', data })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getClipboardData:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n"],"mappings":";;;;;;AAYA,SAAgB,8BAA8B,SAAe;CAC3D,MAAM,MAAM,SAAS,KAAK,KAAK,KAAK;CACpC,IAAI,KACF,IAAI;EACF,eAAe,KAAK,UAAU,qBAAqB;CACrD,QACM,CAEN;CAEF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,6BAA6B,CAAC,CAAC;AACvG;AAEA,SAAgB,eAAe,SAAe;CAC5C,MAAM,EAAE,WAAW,wBAAwB;CAC3C,MAAM,aAAa,sBAAsB,MAAM;CAC/C,IAAI,cAAc,MAAM;EACtB,MAAM,UAAU,4BAA4B,SAAS,sBAAsB;EAC3E,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,MAAM,SAAS,4BAA4B,SAAS;EAClD,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,SAAS;EACT,MAAM;EACN,SAAS;CACX,CAAC;CACD,OAAO,QAAQ,QAAQ,MAAM;AAC/B;AAEA,eAAsB,uBAAuB,SAAe;CAC1D,MAAM,OAAO,OAAO,SAAS,QAAQ,EAAE;CACvC,IAAI;EACF,MAAM,mBAAmB,IAAI;CAC/B,SACO,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,yBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACkB;EACvF,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,OAAO,4BAA4B,SAAS,EAAE,QAAQ,sBAAsB,CAAC;AAC/E;AAEA,eAAsB,uBAAuB,SAAe;CAC1D,IAAI;EAEF,OAAO,4BAA4B,SAAS;GAAE,QAAQ;GAAuB,YAD1D,kBAAkB;EAC6C,CAAC;CACrF,SACO,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,yBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACkB;EACvF,OAAO,QAAQ,OAAO,OAAO;CAC/B;AACF"}
@@ -0,0 +1,106 @@
1
+ import { resolveSelectorTargets } from "./selectorQuery.mjs";
2
+
3
+ //#region src/runtime/polyfill/intersectionObserver.ts
4
+ function isObservableElement(value) {
5
+ return Boolean(value && typeof value === "object" && typeof value.getBoundingClientRect === "function");
6
+ }
7
+ function normalizeNumber(value, fallback = 0) {
8
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
9
+ }
10
+ function normalizeMargins(margins = {}) {
11
+ return {
12
+ left: normalizeNumber(margins.left),
13
+ right: normalizeNumber(margins.right),
14
+ top: normalizeNumber(margins.top),
15
+ bottom: normalizeNumber(margins.bottom)
16
+ };
17
+ }
18
+ function toRootMargin(margins) {
19
+ const normalized = normalizeMargins(margins);
20
+ return `${normalized.top}px ${normalized.right}px ${normalized.bottom}px ${normalized.left}px`;
21
+ }
22
+ function toRect(value) {
23
+ if (!value) return null;
24
+ return {
25
+ left: value.left,
26
+ right: value.right,
27
+ top: value.top,
28
+ bottom: value.bottom,
29
+ width: value.width,
30
+ height: value.height
31
+ };
32
+ }
33
+ function mapIntersectionEntry(entry) {
34
+ const target = entry.target;
35
+ return {
36
+ id: target.id ?? target.getAttribute?.("id") ?? "",
37
+ dataset: { ...target.dataset ?? {} },
38
+ intersectionRatio: entry.intersectionRatio,
39
+ intersectionRect: toRect(entry.intersectionRect),
40
+ boundingClientRect: toRect(entry.boundingClientRect),
41
+ relativeRect: toRect(entry.rootBounds),
42
+ time: entry.time
43
+ };
44
+ }
45
+ function createIntersectionObserverBridge(scope, options = {}) {
46
+ let relativeSelector;
47
+ let relativeMargins = {};
48
+ let viewportRelative = true;
49
+ const observers = /* @__PURE__ */ new Set();
50
+ const api = {
51
+ relativeTo(selector, margins = {}) {
52
+ relativeSelector = selector;
53
+ relativeMargins = margins;
54
+ viewportRelative = false;
55
+ return api;
56
+ },
57
+ relativeToViewport(margins = {}) {
58
+ relativeSelector = void 0;
59
+ relativeMargins = margins;
60
+ viewportRelative = true;
61
+ return api;
62
+ },
63
+ observe(selector, callback) {
64
+ const targets = resolveSelectorTargets(scope, selector, Boolean(options.observeAll)).filter(isObservableElement);
65
+ const relativeTarget = viewportRelative || !relativeSelector ? null : resolveSelectorTargets(scope, relativeSelector, false)[0];
66
+ const root = isObservableElement(relativeTarget) ? relativeTarget : null;
67
+ const thresholds = Array.isArray(options.thresholds) && options.thresholds.length > 0 ? options.thresholds.map((value) => normalizeNumber(value)).filter((value) => value >= 0 && value <= 1) : [normalizeNumber(options.initialRatio)];
68
+ if (typeof IntersectionObserver !== "function") {
69
+ queueMicrotask(() => {
70
+ for (const target of targets) {
71
+ const rect = target.getBoundingClientRect();
72
+ callback({
73
+ id: target.id,
74
+ dataset: { ...target.dataset ?? {} },
75
+ intersectionRatio: 1,
76
+ intersectionRect: toRect(rect),
77
+ boundingClientRect: toRect(rect),
78
+ relativeRect: null,
79
+ time: Date.now()
80
+ });
81
+ }
82
+ });
83
+ return api;
84
+ }
85
+ const observer = new IntersectionObserver((entries) => {
86
+ for (const entry of entries) callback(mapIntersectionEntry(entry));
87
+ }, {
88
+ root,
89
+ rootMargin: toRootMargin(relativeMargins),
90
+ threshold: thresholds.length > 0 ? thresholds : [0]
91
+ });
92
+ observers.add(observer);
93
+ for (const target of targets) observer.observe(target);
94
+ return api;
95
+ },
96
+ disconnect() {
97
+ for (const observer of observers) observer.disconnect();
98
+ observers.clear();
99
+ }
100
+ };
101
+ return api;
102
+ }
103
+
104
+ //#endregion
105
+ export { createIntersectionObserverBridge };
106
+ //# sourceMappingURL=intersectionObserver.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intersectionObserver.mjs","names":[],"sources":["../../../src/runtime/polyfill/intersectionObserver.ts"],"sourcesContent":["import { resolveSelectorTargets } from './selectorQuery'\n\nexport interface IntersectionMargins {\n left?: number\n right?: number\n top?: number\n bottom?: number\n}\n\nexport interface MiniProgramIntersectionObserverOptions {\n initialRatio?: number\n observeAll?: boolean\n thresholds?: number[]\n}\n\ntype MiniProgramIntersectionCallback = (result: Record<string, any>) => void\n\nexport interface MiniProgramIntersectionObserver {\n relativeTo: (selector: string, margins?: IntersectionMargins) => MiniProgramIntersectionObserver\n relativeToViewport: (margins?: IntersectionMargins) => MiniProgramIntersectionObserver\n observe: (selector: string, callback: MiniProgramIntersectionCallback) => MiniProgramIntersectionObserver\n disconnect: () => void\n}\n\nfunction isObservableElement(value: unknown): value is Element {\n return Boolean(value && typeof value === 'object' && typeof (value as Element).getBoundingClientRect === 'function')\n}\n\nfunction normalizeNumber(value: unknown, fallback = 0) {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback\n}\n\nfunction normalizeMargins(margins: IntersectionMargins = {}) {\n return {\n left: normalizeNumber(margins.left),\n right: normalizeNumber(margins.right),\n top: normalizeNumber(margins.top),\n bottom: normalizeNumber(margins.bottom),\n }\n}\n\nfunction toRootMargin(margins: IntersectionMargins) {\n const normalized = normalizeMargins(margins)\n return `${normalized.top}px ${normalized.right}px ${normalized.bottom}px ${normalized.left}px`\n}\n\nfunction toRect(value: DOMRectReadOnly | null) {\n if (!value) {\n return null\n }\n return {\n left: value.left,\n right: value.right,\n top: value.top,\n bottom: value.bottom,\n width: value.width,\n height: value.height,\n }\n}\n\nfunction mapIntersectionEntry(entry: IntersectionObserverEntry) {\n const target = entry.target as HTMLElement & { getAttribute?: (name: string) => string | null }\n return {\n id: target.id ?? target.getAttribute?.('id') ?? '',\n dataset: { ...(target.dataset ?? {}) },\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: toRect(entry.intersectionRect),\n boundingClientRect: toRect(entry.boundingClientRect),\n relativeRect: toRect(entry.rootBounds),\n time: entry.time,\n }\n}\n\nexport function createIntersectionObserverBridge(\n scope?: unknown,\n options: MiniProgramIntersectionObserverOptions = {},\n): MiniProgramIntersectionObserver {\n let relativeSelector: string | undefined\n let relativeMargins: IntersectionMargins = {}\n let viewportRelative = true\n const observers = new Set<IntersectionObserver>()\n\n const api = {\n relativeTo(selector: string, margins: IntersectionMargins = {}) {\n relativeSelector = selector\n relativeMargins = margins\n viewportRelative = false\n return api\n },\n relativeToViewport(margins: IntersectionMargins = {}) {\n relativeSelector = undefined\n relativeMargins = margins\n viewportRelative = true\n return api\n },\n observe(selector: string, callback: MiniProgramIntersectionCallback) {\n const targets = resolveSelectorTargets(scope, selector, Boolean(options.observeAll))\n .filter(isObservableElement)\n const relativeTarget = viewportRelative || !relativeSelector\n ? null\n : resolveSelectorTargets(scope, relativeSelector, false)[0]\n const root = isObservableElement(relativeTarget) ? relativeTarget : null\n const thresholds = Array.isArray(options.thresholds) && options.thresholds.length > 0\n ? options.thresholds.map(value => normalizeNumber(value)).filter(value => value >= 0 && value <= 1)\n : [normalizeNumber(options.initialRatio)]\n\n if (typeof IntersectionObserver !== 'function') {\n queueMicrotask(() => {\n for (const target of targets) {\n const rect = target.getBoundingClientRect()\n callback({\n id: (target as HTMLElement).id,\n dataset: { ...((target as HTMLElement).dataset ?? {}) },\n intersectionRatio: 1,\n intersectionRect: toRect(rect),\n boundingClientRect: toRect(rect),\n relativeRect: null,\n time: Date.now(),\n })\n }\n })\n return api\n }\n\n const observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n callback(mapIntersectionEntry(entry))\n }\n }, {\n root,\n rootMargin: toRootMargin(relativeMargins),\n threshold: thresholds.length > 0 ? thresholds : [0],\n })\n observers.add(observer)\n for (const target of targets) {\n observer.observe(target)\n }\n return api\n },\n disconnect() {\n for (const observer of observers) {\n observer.disconnect()\n }\n observers.clear()\n },\n }\n\n return api\n}\n"],"mappings":";;;AAwBA,SAAS,oBAAoB,OAAkC;CAC7D,OAAO,QAAQ,SAAS,OAAO,UAAU,YAAY,OAAQ,MAAkB,0BAA0B,UAAU;AACrH;AAEA,SAAS,gBAAgB,OAAgB,WAAW,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+1,14 @@
1
+ //#region src/runtime/polyfill/locale.ts
2
+ function normalizeLocale(locale) {
3
+ const normalized = locale.trim().replace("_", "-").toLowerCase();
4
+ if (normalized === "zh-tw" || normalized === "zh-hk" || normalized === "zh-mo" || normalized.startsWith("zh-hant")) return "zh-Hant";
5
+ if (normalized.startsWith("zh")) return "zh-Hans";
6
+ return normalized.split("-")[0] || "en";
7
+ }
8
+ function getLocale() {
9
+ return normalizeLocale((typeof navigator === "undefined" ? void 0 : navigator)?.language ?? "en");
10
+ }
11
+
12
+ //#endregion
13
+ export { getLocale };
14
+ //# sourceMappingURL=locale.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.mjs","names":[],"sources":["../../../src/runtime/polyfill/locale.ts"],"sourcesContent":["function normalizeLocale(locale: string): string {\n const normalized = locale.trim().replace('_', '-').toLowerCase()\n if (normalized === 'zh-tw' || normalized === 'zh-hk' || normalized === 'zh-mo' || normalized.startsWith('zh-hant')) {\n return 'zh-Hant'\n }\n if (normalized.startsWith('zh')) {\n return 'zh-Hans'\n }\n return normalized.split('-')[0] || 'en'\n}\n\nexport function getLocale(): string {\n const runtimeNavigator = typeof navigator === 'undefined' ? undefined : navigator\n return normalizeLocale(runtimeNavigator?.language ?? 'en')\n}\n"],"mappings":";AAAA,SAAS,gBAAgB,QAAwB;CAC/C,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,YAAY;CAC/D,IAAI,eAAe,WAAW,eAAe,WAAW,eAAe,WAAW,WAAW,WAAW,SAAS,GAC/G,OAAO;CAET,IAAI,WAAW,WAAW,IAAI,GAC5B,OAAO;CAET,OAAO,WAAW,MAAM,GAAG,CAAC,CAAC,MAAM;AACrC;AAEA,SAAgB,YAAoB;CAElC,OAAO,iBADkB,OAAO,cAAc,cAAc,SAAY,UACjC,EAAE,YAAY,IAAI;AAC3D"}
@@ -1,3 +1,4 @@
1
+ import { openRuntimeUrl } from "../host/index.mjs";
1
2
  import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
2
3
  import { normalizeFuzzyCoordinate, normalizeGeoNumber, parseChooseAddressPromptInput, parseChooseLocationPromptInput, readCurrentLocation, readPresetChooseAddress, readPresetChooseLocation, readPresetFuzzyLocation } from "./location.mjs";
3
4
  import { openTargetInNewWindow } from "./mediaActions.mjs";
@@ -10,8 +11,8 @@ function makePhoneCallBridge(options) {
10
11
  const failure = callMiniProgramAsyncFailure(options, "makePhoneCall:fail invalid phoneNumber");
11
12
  return Promise.reject(failure);
12
13
  }
13
- if (typeof window !== "undefined" && typeof window.open === "function") try {
14
- window.open(`tel:${encodeURIComponent(phoneNumber)}`, "_self");
14
+ try {
15
+ openRuntimeUrl(`tel:${encodeURIComponent(phoneNumber)}`, "_self");
15
16
  } catch {}
16
17
  return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "makePhoneCall:ok" }));
17
18
  }
@@ -91,7 +92,8 @@ function getLocationBridge(options) {
91
92
  return Promise.reject(failure);
92
93
  });
93
94
  } catch (error) {
94
- const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${error instanceof Error ? error.message : String(error)}`);
95
+ const message = error.message;
96
+ const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${message}`);
95
97
  return Promise.reject(failure);
96
98
  }
97
99
  }
@@ -110,7 +112,8 @@ async function getFuzzyLocationBridge(options) {
110
112
  accuracy: Math.max(1e3, normalizeGeoNumber(location.accuracy, 1e3))
111
113
  });
112
114
  } catch (error) {
113
- const failure = callMiniProgramAsyncFailure(options, `getFuzzyLocation:fail ${typeof error?.errMsg === "string" ? error.errMsg : error instanceof Error ? error.message : String(error)}`);
115
+ const message = error.errMsg;
116
+ const failure = callMiniProgramAsyncFailure(options, `getFuzzyLocation:fail ${message}`);
114
117
  return Promise.reject(failure);
115
118
  }
116
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"locationApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/locationApi.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n normalizeFuzzyCoordinate,\n normalizeGeoNumber,\n parseChooseAddressPromptInput,\n parseChooseLocationPromptInput,\n readCurrentLocation,\n readPresetChooseAddress,\n readPresetChooseLocation,\n readPresetFuzzyLocation,\n} from './location'\nimport { openTargetInNewWindow } from './mediaActions'\nimport { getGlobalDialogHandlers } from './ui'\n\nexport function makePhoneCallBridge(options?: any) {\n const phoneNumber = typeof options?.phoneNumber === 'string' ? options.phoneNumber.trim() : ''\n if (!phoneNumber) {\n const failure = callMiniProgramAsyncFailure(options, 'makePhoneCall:fail invalid phoneNumber')\n return Promise.reject(failure)\n }\n if (typeof window !== 'undefined' && typeof window.open === 'function') {\n try {\n window.open(`tel:${encodeURIComponent(phoneNumber)}`, '_self')\n }\n catch {\n // ignore browser restrictions and keep API-level success semantics\n }\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'makePhoneCall:ok' }))\n}\n\nexport function chooseAddressBridge(options?: any) {\n const preset = readPresetChooseAddress()\n if (preset) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseAddress:ok',\n ...preset,\n }))\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const input = prompt('请输入地址(格式:省,市,区,详细地址,姓名,电话)', '')\n if (input == null) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail cancel')\n return Promise.reject(failure)\n }\n const parsed = parseChooseAddressPromptInput(input)\n if (!parsed) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail invalid input')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseAddress:ok',\n ...parsed,\n }))\n }\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail address picker is unavailable')\n return Promise.reject(failure)\n}\n\nexport function chooseLocationBridge(options?: any) {\n const preset = readPresetChooseLocation()\n if (preset) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseLocation:ok',\n ...preset,\n }))\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const input = prompt('请输入坐标(格式:latitude,longitude)', '')\n if (input == null) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail cancel')\n return Promise.reject(failure)\n }\n const parsed = parseChooseLocationPromptInput(input)\n if (!parsed) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail invalid latitude/longitude')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseLocation:ok',\n name: '',\n address: '',\n latitude: parsed.latitude,\n longitude: parsed.longitude,\n }))\n }\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail location picker is unavailable')\n return Promise.reject(failure)\n}\n\nexport function openLocationBridge(options?: any) {\n const latitude = options?.latitude\n const longitude = options?.longitude\n if (typeof latitude !== 'number' || Number.isNaN(latitude) || typeof longitude !== 'number' || Number.isNaN(longitude)) {\n const failure = callMiniProgramAsyncFailure(options, 'openLocation:fail invalid latitude/longitude')\n return Promise.reject(failure)\n }\n const query = `${latitude},${longitude}`\n const target = `https://maps.google.com/?q=${encodeURIComponent(query)}`\n openTargetInNewWindow(target)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'openLocation:ok' }))\n}\n\nexport function getLocationBridge(options?: any) {\n try {\n return readCurrentLocation(options)\n .then(location => callMiniProgramAsyncSuccess(options, {\n errMsg: 'getLocation:ok',\n ...location,\n }))\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${message}`)\n return Promise.reject(failure)\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport async function getFuzzyLocationBridge(options?: any) {\n const preset = readPresetFuzzyLocation()\n if (preset) {\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getFuzzyLocation:ok',\n ...preset,\n })\n }\n try {\n const location = await getLocationBridge()\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getFuzzyLocation:ok',\n latitude: normalizeFuzzyCoordinate(location.latitude),\n longitude: normalizeFuzzyCoordinate(location.longitude),\n accuracy: Math.max(1000, normalizeGeoNumber(location.accuracy, 1000)),\n })\n }\n catch (error) {\n const message = typeof (error as { errMsg?: unknown })?.errMsg === 'string'\n ? (error as { errMsg: string }).errMsg\n : error instanceof Error\n ? error.message\n : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getFuzzyLocation:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,oBAAoB,SAAe;CACjD,MAAM,cAAc,OAAO,SAAS,gBAAgB,WAAW,QAAQ,YAAY,KAAK,IAAI;CAC5F,IAAI,CAAC,aAAa;EAChB,MAAM,UAAU,4BAA4B,SAAS,wCAAwC;EAC7F,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,SAAS,YAC1D,IAAI;EACF,OAAO,KAAK,OAAO,mBAAmB,WAAW,KAAK,OAAO;CAC/D,QACM,CAEN;CAEF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,mBAAmB,CAAC,CAAC;AAC7F;AAEA,SAAgB,oBAAoB,SAAe;CACjD,MAAM,SAAS,wBAAwB;CACvC,IAAI,QACF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR,GAAG;CACL,CAAC,CAAC;CAEJ,MAAM,EAAE,WAAW,wBAAwB;CAC3C,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,QAAQ,OAAO,8BAA8B,EAAE;EACrD,IAAI,SAAS,MAAM;GACjB,MAAM,UAAU,4BAA4B,SAAS,2BAA2B;GAChF,OAAO,QAA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["../../../src/runtime/polyfill/locationApi.ts"],"sourcesContent":["import { openRuntimeUrl } from '../host'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n normalizeFuzzyCoordinate,\n normalizeGeoNumber,\n parseChooseAddressPromptInput,\n parseChooseLocationPromptInput,\n readCurrentLocation,\n readPresetChooseAddress,\n readPresetChooseLocation,\n readPresetFuzzyLocation,\n} from './location'\nimport { openTargetInNewWindow } from './mediaActions'\nimport { getGlobalDialogHandlers } from './ui'\n\nexport function makePhoneCallBridge(options?: any) {\n const phoneNumber = typeof options?.phoneNumber === 'string' ? options.phoneNumber.trim() : ''\n if (!phoneNumber) {\n const failure = callMiniProgramAsyncFailure(options, 'makePhoneCall:fail invalid phoneNumber')\n return Promise.reject(failure)\n }\n try {\n openRuntimeUrl(`tel:${encodeURIComponent(phoneNumber)}`, '_self')\n }\n catch {\n // ignore browser restrictions and keep API-level success semantics\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'makePhoneCall:ok' }))\n}\n\nexport function chooseAddressBridge(options?: any) {\n const preset = readPresetChooseAddress()\n if (preset) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseAddress:ok',\n ...preset,\n }))\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const input = prompt('请输入地址(格式:省,市,区,详细地址,姓名,电话)', '')\n if (input == null) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail cancel')\n return Promise.reject(failure)\n }\n const parsed = parseChooseAddressPromptInput(input)\n if (!parsed) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail invalid input')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseAddress:ok',\n ...parsed,\n }))\n }\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail address picker is unavailable')\n return Promise.reject(failure)\n}\n\nexport function chooseLocationBridge(options?: any) {\n const preset = readPresetChooseLocation()\n if (preset) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseLocation:ok',\n ...preset,\n }))\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const input = prompt('请输入坐标(格式:latitude,longitude)', '')\n if (input == null) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail cancel')\n return Promise.reject(failure)\n }\n const parsed = parseChooseLocationPromptInput(input)\n if (!parsed) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail invalid latitude/longitude')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseLocation:ok',\n name: '',\n address: '',\n latitude: parsed.latitude,\n longitude: parsed.longitude,\n }))\n }\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail location picker is unavailable')\n return Promise.reject(failure)\n}\n\nexport function openLocationBridge(options?: any) {\n const latitude = options?.latitude\n const longitude = options?.longitude\n if (typeof latitude !== 'number' || Number.isNaN(latitude) || typeof longitude !== 'number' || Number.isNaN(longitude)) {\n const failure = callMiniProgramAsyncFailure(options, 'openLocation:fail invalid latitude/longitude')\n return Promise.reject(failure)\n }\n const query = `${latitude},${longitude}`\n const target = `https://maps.google.com/?q=${encodeURIComponent(query)}`\n openTargetInNewWindow(target)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'openLocation:ok' }))\n}\n\nexport function getLocationBridge(options?: any) {\n try {\n return readCurrentLocation(options)\n .then(location => callMiniProgramAsyncSuccess(options, {\n errMsg: 'getLocation:ok',\n ...location,\n }))\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${message}`)\n return Promise.reject(failure)\n })\n }\n catch (error) {\n const message = (error as Error).message\n const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport async function getFuzzyLocationBridge(options?: any) {\n const preset = readPresetFuzzyLocation()\n if (preset) {\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getFuzzyLocation:ok',\n ...preset,\n })\n }\n try {\n const location = await getLocationBridge()\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getFuzzyLocation:ok',\n latitude: normalizeFuzzyCoordinate(location.latitude),\n longitude: normalizeFuzzyCoordinate(location.longitude),\n accuracy: Math.max(1000, normalizeGeoNumber(location.accuracy, 1000)),\n })\n }\n catch (error) {\n const message = (error as { errMsg: string }).errMsg\n const failure = callMiniProgramAsyncFailure(options, `getFuzzyLocation:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n"],"mappings":";;;;;;;AAkBA,SAAgB,oBAAoB,SAAe;CACjD,MAAM,cAAc,OAAO,SAAS,gBAAgB,WAAW,QAAQ,YAAY,KAAK,IAAI;CAC5F,IAAI,CAAC,aAAa;EAChB,MAAM,UAAU,4BAA4B,SAAS,wCAAwC;EAC7F,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,IAAI;EACF,eAAe,OAAO,mBAAmB,WAAW,KAAK,OAAO;CAClE,QACM,CAEN;CACA,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,mBAAmB,CAAC,CAAC;AAC7F;AAEA,SAAgB,oBAAoB,SAAe;CACjD,MAAM,SAAS,wBAAwB;CACvC,IAAI,QACF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR,GAAG;CACL,CAAC,CAAC;CAEJ,MAAM,EAAE,WAAW,wBAAwB;CAC3C,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,QAAQ,OAAO,8BAA8B,EAAE;EACrD,IAAI,SAAS,MAAM;GACjB,MAAM,UAAU,4BAA4B,SAAS,2BAA2B;GAChF,OAAO,QAAQ,OAAO,OAAO;EAC/B;EACA,MAAM,SAAS,8BAA8B,KAAK;EAClD,IAAI,CAAC,QAAQ;GACX,MAAM,UAAU,4BAA4B,SAAS,kC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AmB,KAAK,GACzC;CAC5B,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,kBAAkB,CAAC,CAAC;AAC5F;AAEA,SAAgB,kBAAkB,SAAe;CAC/C,IAAI;EACF,OAAO,oBAAoB,OAAO,CAAC,CAChC,MAAK,aAAY,4BAA4B,SAAS;GACrD,QAAQ;GACR,GAAG;EACL,CAAC,CAAC,CAAC,CACF,OAAO,UAAU;GAEhB,MAAM,UAAU,4BAA4B,SAAS,oBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACa;GAClF,OAAO,QAAQ,OAAO,OAAO;EAC/B,CAAC;CACL,SACO,OAAO;EACZ,MAAM,UAAW,MAAgB;EACjC,MAAM,UAAU,4BAA4B,SAAS,oBAAoB,SAAS;EAClF,OAAO,QAAQ,OAAO,OAAO;CAC/B;AACF;AAEA,eAAsB,uBAAuB,SAAe;CAC1D,MAAM,SAAS,wBAAwB;CACvC,IAAI,QACF,OAAO,4BAA4B,SAAS;EAC1C,QAAQ;EACR,GAAG;CACL,CAAC;CAEH,IAAI;EACF,MAAM,WAAW,MAAM,kBAAkB;EACzC,OAAO,4BAA4B,SAAS;GAC1C,QAAQ;GACR,UAAU,yBAAyB,SAAS,QAAQ;GACpD,WAAW,yBAAyB,SAAS,SAAS;GACtD,UAAU,KAAK,IAAI,KAAM,mBAAmB,SAAS,UAAU,GAAI,CAAC;EACtE,CAAC;CACH,SACO,OAAO;EACZ,MAAM,UAAW,MAA6B;EAC9C,MAAM,UAAU,4BAA4B,SAAS,yBAAyB,SAAS;EACvF,OAAO,QAAQ,OAAO,OAAO;CAC/B;AACF"}
@@ -1,10 +1,10 @@
1
+ import { openRuntimeUrl } from "../host/index.mjs";
1
2
  import { WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY } from "@weapp-core/constants";
2
3
 
3
4
  //#region src/runtime/polyfill/mediaActions.ts
4
5
  function openTargetInNewWindow(target) {
5
- if (typeof window === "undefined" || typeof window.open !== "function") return;
6
6
  try {
7
- window.open(target, "_blank", "noopener,noreferrer");
7
+ openRuntimeUrl(target, "_blank", "noopener,noreferrer");
8
8
  } catch {}
9
9
  }
10
10
  function normalizePreviewMediaSources(sources) {
@@ -1 +1 @@
1
- {"version":3,"file":"mediaActions.mjs","names":["runtimeGlobal"],"sources":["../../../src/runtime/polyfill/mediaActions.ts"],"sourcesContent":["import { WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY } from '@weapp-core/constants'\n\ninterface PreviewMediaSourceRecord {\n url: string\n type: 'image' | 'video'\n poster: string\n}\n\nexport function openTargetInNewWindow(target: string) {\n if (typeof window === 'undefined' || typeof window.open !== 'function') {\n return\n }\n try {\n window.open(target, '_blank', 'noopener,noreferrer')\n }\n catch {\n // ignore browser popup restrictions and keep API-level success semantics\n }\n}\n\nexport function normalizePreviewMediaSources(sources: unknown): PreviewMediaSourceRecord[] {\n if (!Array.isArray(sources)) {\n return []\n }\n return sources\n .map((source) => {\n if (!source || typeof source !== 'object') {\n return null\n }\n const sourceRecord = source as Record<string, unknown>\n const url = typeof sourceRecord.url === 'string' ? sourceRecord.url.trim() : ''\n if (!url) {\n return null\n }\n return {\n url,\n type: sourceRecord.type === 'video' ? 'video' : 'image',\n poster: typeof sourceRecord.poster === 'string' ? sourceRecord.poster : '',\n }\n })\n .filter((item): item is PreviewMediaSourceRecord => Boolean(item))\n}\n\nexport function readOpenVideoEditorPreset(src: string) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY]\n if (typeof preset === 'function') {\n const value = (preset as (value: string) => unknown)(src)\n return typeof value === 'string' && value.trim() ? value.trim() : ''\n }\n if (typeof preset === 'string' && preset.trim()) {\n return preset.trim()\n }\n if (preset && typeof preset === 'object') {\n const value = (preset as Record<string, unknown>)[src]\n return typeof value === 'string' && value.trim() ? value.trim() : ''\n }\n return ''\n}\n\nexport function triggerDownload(filePath: string, fileName = '') {\n if (typeof document === 'undefined' || !document.body) {\n return\n }\n try {\n const link = document.createElement('a')\n link.setAttribute('href', filePath)\n link.setAttribute('download', fileName)\n link.setAttribute('style', 'display:none')\n document.body.append(link)\n link.click?.()\n if (link.parentNode) {\n link.parentNode.removeChild(link)\n }\n }\n catch {\n // keep API-level success semantics for browser restrictions\n }\n}\n"],"mappings":";;;AAQA,SAAgB,sBAAsB,QAAgB;CACpD,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,SAAS,YAC1D;CAEF,IAAI;EACF,OAAO,KAAK,QAAQ,UAAU,qBAAqB;CACrD,QACM,CAEN;AACF;AAEA,SAAgB,6BAA6B,SAA8C;CACzF,IAAI,CAAC,MAAM,QAAQ,OAAO,GACxB,OAAO,CAAC;CAEV,OAAO,QACJ,KAAK,WAAW;EACf,IAAI,CAAC,UAAU,OAAO,WAAW,UAC/B,OAAO;EAET,MAAM,eAAe;EACrB,MAAM,MAAM,OAAO,aAAa,QAAQ,WAAW,aAAa,IAAI,KAAK,IAAI;EAC7E,IAAI,CAAC,KACH,OAAO;EAET,OAAO;GACL;GACA,MAAM,aAAa,SAAS,UAAU,UAAU;GAChD,QAAQ,OAAO,aAAa,WAAW,WAAW,aAAa,SAAS;EAC1E;CACF,CAAC,CAAC,CACD,QAAQ,SAA2C,QAAQ,IAAI,CAAC;AACrE;AAEA,SAAgB,0BAA0B,KAAa;CAErD,MAAM,SAASA,WAAc;CAC7B,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,QAAS,OAAsC,GAAG;EACxD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;CACpE;CACA,IAAI,OAAO,WAAW,YAAY,OAAO,KAAK,GAC5C,OAAO,OAAO,KAAK;CAErB,IAAI,UAAU,OAAO,WAAW,UAAU;EACxC,MAAM,QAAS,OAAmC;EAClD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;CACpE;CACA,OAAO;AACT;AAEA,SAAgB,gBAAgB,UAAkB,WAAW,IAAI;CAC/D,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,MAC/C;CAEF,IAAI;EACF,MAAM,OAAO,SAAS,cAAc,GAAG;EACvC,KAAK,aAAa,QAAQ,QAAQ;EAClC,KAAK,aAAa,YAAY,QAAQ;EACtC,KAAK,aAAa,SAAS,cAAc;EACzC,SAAS,KAAK,OAAO,IAAI;EACzB,KAAK,QAAQ;EACb,IAAI,KAAK,YACP,KAAK,WAAW,YAAY,IAAI;CAEpC,QACM,CAEN;AACF"}
1
+ {"version":3,"file":"mediaActions.mjs","names":["runtimeGlobal"],"sources":["../../../src/runtime/polyfill/mediaActions.ts"],"sourcesContent":["import { WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY } from '@weapp-core/constants'\nimport { openRuntimeUrl } from '../host'\n\ninterface PreviewMediaSourceRecord {\n url: string\n type: 'image' | 'video'\n poster: string\n}\n\nexport function openTargetInNewWindow(target: string) {\n try {\n openRuntimeUrl(target, '_blank', 'noopener,noreferrer')\n }\n catch {\n // ignore browser popup restrictions and keep API-level success semantics\n }\n}\n\nexport function normalizePreviewMediaSources(sources: unknown): PreviewMediaSourceRecord[] {\n if (!Array.isArray(sources)) {\n return []\n }\n return sources\n .map((source) => {\n if (!source || typeof source !== 'object') {\n return null\n }\n const sourceRecord = source as Record<string, unknown>\n const url = typeof sourceRecord.url === 'string' ? sourceRecord.url.trim() : ''\n if (!url) {\n return null\n }\n return {\n url,\n type: sourceRecord.type === 'video' ? 'video' : 'image',\n poster: typeof sourceRecord.poster === 'string' ? sourceRecord.poster : '',\n }\n })\n .filter((item): item is PreviewMediaSourceRecord => Boolean(item))\n}\n\nexport function readOpenVideoEditorPreset(src: string) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY]\n if (typeof preset === 'function') {\n const value = (preset as (value: string) => unknown)(src)\n return typeof value === 'string' && value.trim() ? value.trim() : ''\n }\n if (typeof preset === 'string' && preset.trim()) {\n return preset.trim()\n }\n if (preset && typeof preset === 'object') {\n const value = (preset as Record<string, unknown>)[src]\n return typeof value === 'string' && value.trim() ? value.trim() : ''\n }\n return ''\n}\n\nexport function triggerDownload(filePath: string, fileName = '') {\n if (typeof document === 'undefined' || !document.body) {\n return\n }\n try {\n const link = document.createElement('a')\n link.setAttribute('href', filePath)\n link.setAttribute('download', fileName)\n link.setAttribute('style', 'display:none')\n document.body.append(link)\n link.click?.()\n if (link.parentNode) {\n link.parentNode.removeChild(link)\n }\n }\n catch {\n // keep API-level success semantics for browser restrictions\n }\n}\n"],"mappings":";;;;AASA,SAAgB,sBAAsB,QAAgB;CACpD,IAAI;EACF,eAAe,QAAQ,UAAU,qBAAqB;CACxD,QACM,CAEN;AACF;AAEA,SAAgB,6BAA6B,SAA8C;CACzF,IAAI,CAAC,MAAM,QAAQ,OAAO,GACxB,OAAO,CAAC;CAEV,OAAO,QACJ,KAAK,WAAW;EACf,IAAI,CAAC,UAAU,OAAO,WAAW,UAC/B,OAAO;EAET,MAAM,eAAe;EACrB,MAAM,MAAM,OAAO,aAAa,QAAQ,WAAW,aAAa,IAAI,KAAK,IAAI;EAC7E,IAAI,CAAC,KACH,OAAO;EAET,OAAO;GACL;GACA,MAAM,aAAa,SAAS,UAAU,UAAU;GAChD,QAAQ,OAAO,aAAa,WAAW,WAAW,aAAa,SAAS;EAC1E;CACF,CAAC,CAAC,CACD,QAAQ,SAA2C,QAAQ,IAAI,CAAC;AACrE;AAEA,SAAgB,0BAA0B,KAAa;CAErD,MAAM,SAASA,WAAc;CAC7B,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,QAAS,OAAsC,GAAG;EACxD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;CACpE;CACA,IAAI,OAAO,WAAW,YAAY,OAAO,KAAK,GAC5C,OAAO,OAAO,KAAK;CAErB,IAAI,UAAU,OAAO,WAAW,UAAU;EACxC,MAAM,QAAS,OAAmC;EAClD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;CACpE;CACA,OAAO;AACT;AAEA,SAAgB,gBAAgB,UAAkB,WAAW,IAAI;CAC/D,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,MAC/C;CAEF,IAAI;EACF,MAAM,OAAO,SAAS,cAAc,GAAG;EACvC,KAAK,aAAa,QAAQ,QAAQ;EAClC,KAAK,aAAa,YAAY,QAAQ;EACtC,KAAK,aAAa,SAAS,cAAc;EACzC,SAAS,KAAK,OAAO,IAAI;EACzB,KAAK,QAAQ;EACb,IAAI,KAAK,YACP,KAAK,WAAW,YAAY,IAAI;CAEpC,QACM,CAEN;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../async.mjs";
2
- import { openTargetInNewWindow, triggerDownload } from "../mediaActions.mjs";
3
2
  import { normalizeFilePath, resolveOpenDocumentUrl, resolveSaveFilePath, saveMemoryFile } from "../files.mjs";
3
+ import { openTargetInNewWindow, triggerDownload } from "../mediaActions.mjs";
4
4
 
5
5
  //#region src/runtime/polyfill/mediaApi/file.ts
6
6
  function saveImageToPhotosAlbumBridge(options) {
@@ -6,7 +6,7 @@ function getImageInfoBridge(options) {
6
6
  const src = typeof options?.src === "string" ? options.src.trim() : "";
7
7
  if (!src) {
8
8
  const failure = callMiniProgramAsyncFailure(options, "getImageInfo:fail invalid src");
9
- return Promise.reject(failure);
9
+ return typeof options?.fail === "function" ? Promise.resolve(failure) : Promise.reject(failure);
10
10
  }
11
11
  return readImageInfoFromSource(src).then(({ width, height }) => callMiniProgramAsyncSuccess(options, {
12
12
  errMsg: "getImageInfo:ok",
@@ -16,8 +16,9 @@ function getImageInfoBridge(options) {
16
16
  type: inferImageTypeFromPath(src),
17
17
  orientation: "up"
18
18
  })).catch((error) => {
19
- const failure = callMiniProgramAsyncFailure(options, `getImageInfo:fail ${error instanceof Error ? error.message : String(error)}`);
20
- return Promise.reject(failure);
19
+ const message = error.message;
20
+ const failure = callMiniProgramAsyncFailure(options, `getImageInfo:fail ${message}`);
21
+ return typeof options?.fail === "function" ? failure : Promise.reject(failure);
21
22
  });
22
23
  }
23
24
  function getVideoInfoBridge(options) {
@@ -49,7 +50,8 @@ function getVideoInfoBridge(options) {
49
50
  fps
50
51
  });
51
52
  }).catch((error) => {
52
- const failure = callMiniProgramAsyncFailure(options, `getVideoInfo:fail ${error instanceof Error ? error.message : String(error)}`);
53
+ const message = error.message;
54
+ const failure = callMiniProgramAsyncFailure(options, `getVideoInfo:fail ${message}`);
53
55
  return Promise.reject(failure);
54
56
  });
55
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"info.mjs","names":[],"sources":["../../../../src/runtime/polyfill/mediaApi/info.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from '../async'\nimport {\n inferImageTypeFromPath,\n inferVideoTypeFromPath,\n normalizeVideoInfoNumber,\n readImageInfoFromSource,\n readPresetVideoInfo,\n readVideoInfoFromSource,\n} from '../mediaInfo'\n\nexport function getImageInfoBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'getImageInfo:fail invalid src')\n return Promise.reject(failure)\n }\n return readImageInfoFromSource(src)\n .then(({ width, height }) => callMiniProgramAsyncSuccess(options, {\n errMsg: 'getImageInfo:ok',\n width,\n height,\n path: src,\n type: inferImageTypeFromPath(src),\n orientation: 'up',\n }))\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getImageInfo:fail ${message}`)\n return Promise.reject(failure)\n })\n}\n\nexport function getVideoInfoBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'getVideoInfo:fail invalid src')\n return Promise.reject(failure)\n }\n const preset = readPresetVideoInfo(src)\n const resolveResult = async () => {\n if (preset) {\n return preset\n }\n return readVideoInfoFromSource(src)\n }\n return resolveResult()\n .then((result) => {\n const duration = normalizeVideoInfoNumber(result.duration)\n const width = normalizeVideoInfoNumber(result.width)\n const height = normalizeVideoInfoNumber(result.height)\n const bitrate = normalizeVideoInfoNumber((result as Record<string, unknown>).bitrate)\n const fps = normalizeVideoInfoNumber((result as Record<string, unknown>).fps)\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getVideoInfo:ok',\n orientation: 'up',\n type: inferVideoTypeFromPath(src),\n duration,\n size: normalizeVideoInfoNumber((result as Record<string, unknown>).size),\n width,\n height,\n bitrate,\n fps,\n })\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getVideoInfo:fail ${message}`)\n return Promise.reject(failure)\n })\n}\n"],"mappings":";;;;AAaA,SAAgB,mBAAmB,SAAe;CAChD,MAAM,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ,IAAI,KAAK,IAAI;CACpE,IAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,+BAA+B;EACpF,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,OAAO,wBAAwB,GAAG,CAAC,CAChC,MAAM,EAAE,OAAO,aAAa,4BAA4B,SAAS;EAChE,QAAQ;EACR;EACA;EACA,MAAM;EACN,MAAM,uBAAuB,GAAG;EAChC,aAAa;CACf,CAAC,CAAC,CAAC,CACF,OAAO,UAAU;EAEhB,MAAM,UAAU,4BAA4B,SAAS,qBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACc;EACnF,OAAO,QAAQ,OAAO,OAAO;CAC/B,CAAC;AACL;AAEA,SAAgB,mBAAmB,SAAe;CAChD,MAAM,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ,IAAI,KAAK,IAAI;CACpE,IAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,+BAA+B;EACpF,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,MAAM,SAAS,oBAAoB,GAAG;CACtC,MAAM,gBAAgB,YAAY;EAChC,IAAI,QACF,OAAO;EAET,OAAO,wBAAwB,GAAG;CACpC;CACA,OAAO,cAAc,CAAC,CACnB,MAAM,WAAW;EAChB,MAAM,WAAW,yBAAyB,OAAO,QAAQ;EACzD,MAAM,QAAQ,yBAAyB,OAAO,KAAK;EACnD,MAAM,SAAS,yBAAyB,OAAO,MAAM;EACrD,MAAM,UAAU,yBAA0B,OAAmC,OAAO;EACpF,MAAM,MAAM,yBAA0B,OAAmC,GAAG;EAC5E,OAAO,4BAA4B,SAAS;GAC1C,QAAQ;GACR,aAAa;GACb,MAAM,uBAAuB,GAAG;GAChC;GACA,MAAM,yBAA0B,OAAmC,IAAI;GACvE;GACA;GACA;GACA;EACF,CAAC;CACH,CAAC,CAAC,CACD,OAAO,UAAU;EAEhB,MAAM,UAAU,4BAA4B,SAAS,qBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACc;EACnF,OAAO,QAAQ,OAAO,OAAO;CAC/B,CAAC;AACL"}
1
+ {"version":3,"file":"info.mjs","names":[],"sources":["../../../../src/runtime/polyfill/mediaApi/info.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from '../async'\nimport {\n inferImageTypeFromPath,\n inferVideoTypeFromPath,\n normalizeVideoInfoNumber,\n readImageInfoFromSource,\n readPresetVideoInfo,\n readVideoInfoFromSource,\n} from '../mediaInfo'\n\nexport function getImageInfoBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'getImageInfo:fail invalid src')\n return typeof options?.fail === 'function' ? Promise.resolve(failure) : Promise.reject(failure)\n }\n return readImageInfoFromSource(src)\n .then(({ width, height }) => callMiniProgramAsyncSuccess(options, {\n errMsg: 'getImageInfo:ok',\n width,\n height,\n path: src,\n type: inferImageTypeFromPath(src),\n orientation: 'up',\n }))\n .catch((error) => {\n const message = (error as Error).message\n const failure = callMiniProgramAsyncFailure(options, `getImageInfo:fail ${message}`)\n return typeof options?.fail === 'function' ? failure : Promise.reject(failure)\n })\n}\n\nexport function getVideoInfoBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'getVideoInfo:fail invalid src')\n return Promise.reject(failure)\n }\n const preset = readPresetVideoInfo(src)\n const resolveResult = async () => {\n if (preset) {\n return preset\n }\n return readVideoInfoFromSource(src)\n }\n return resolveResult()\n .then((result) => {\n const duration = normalizeVideoInfoNumber(result.duration)\n const width = normalizeVideoInfoNumber(result.width)\n const height = normalizeVideoInfoNumber(result.height)\n const bitrate = normalizeVideoInfoNumber((result as Record<string, unknown>).bitrate)\n const fps = normalizeVideoInfoNumber((result as Record<string, unknown>).fps)\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getVideoInfo:ok',\n orientation: 'up',\n type: inferVideoTypeFromPath(src),\n duration,\n size: normalizeVideoInfoNumber((result as Record<string, unknown>).size),\n width,\n height,\n bitrate,\n fps,\n })\n })\n .catch((error) => {\n const message = (error as Error).message\n const failure = callMiniProgramAsyncFailure(options, `getVideoInfo:fail ${message}`)\n return Promise.reject(failure)\n })\n}\n"],"mappings":";;;;AAaA,SAAgB,mBAAmB,SAAe;CAChD,MAAM,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ,IAAI,KAAK,IAAI;CACpE,IAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,+BAA+B;EACpF,OAAO,OAAO,SAAS,SAAS,aAAa,QAAQ,QAAQ,OAAO,IAAI,QAAQ,OAAO,OAAO;CAChG;CACA,OAAO,wBAAwB,GAAG,CAAC,CAChC,MAAM,EAAE,OAAO,aAAa,4BAA4B,SAAS;EAChE,QAAQ;EACR;EACA;EACA,MAAM;EACN,MAAM,uBAAuB,GAAG;EAChC,aAAa;CACf,CAAC,CAAC,CAAC,CACF,OAAO,UAAU;EAChB,MAAM,UAAW,MAAgB;EACjC,MAAM,UAAU,4BAA4B,SAAS,qBAAqB,SAAS;EACnF,OAAO,OAAO,SAAS,SAAS,aAAa,UAAU,QAAQ,OAAO,OAAO;CAC/E,CAAC;AACL;AAEA,SAAgB,mBAAmB,SAAe;CAChD,MAAM,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ,IAAI,KAAK,IAAI;CACpE,IAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,+BAA+B;EACpF,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,MAAM,SAAS,oBAAoB,GAAG;CACtC,MAAM,gBAAgB,YAAY;EAChC,IAAI,QACF,OAAO;EAET,OAAO,wBAAwB,GAAG;CACpC;CACA,OAAO,cAAc,CAAC,CACnB,MAAM,WAAW;EAChB,MAAM,WAAW,yBAAyB,OAAO,QAAQ;EACzD,MAAM,QAAQ,yBAAyB,OAAO,KAAK;EACnD,MAAM,SAAS,yBAAyB,OAAO,MAAM;EACrD,MAAM,UAAU,yBAA0B,OAAmC,OAAO;EACpF,MAAM,MAAM,yBAA0B,OAAmC,GAAG;EAC5E,OAAO,4BAA4B,SAAS;GAC1C,QAAQ;GACR,aAAa;GACb,MAAM,uBAAuB,GAAG;GAChC;GACA,MAAM,yBAA0B,OAAmC,IAAI;GACvE;GACA;GACA;GACA;EACF,CAAC;CACH,CAAC,CAAC,CACD,OAAO,UAAU;EAChB,MAAM,UAAW,MAAgB;EACjC,MAAM,UAAU,4BAA4B,SAAS,qBAAqB,SAAS;EACnF,OAAO,QAAQ,OAAO,OAAO;CAC/B,CAAC;AACL"}
@@ -1,6 +1,7 @@
1
+ import { setTabBarBadgeState, setTabBarRedDotState, setTabBarVisible, updateTabBarItem, updateTabBarStyle } from "../appShell/tabBar/index.mjs";
1
2
  import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
2
- import { normalizeActionSheetItems, resolveActionSheetSelection, resolveModalSelection } from "./ui.mjs";
3
3
  import { readNetworkStatusSnapshot } from "./network/status.mjs";
4
+ import { normalizeActionSheetItems, resolveActionSheetSelection, resolveModalSelection } from "./ui.mjs";
4
5
  import { normalizeSubscribeTemplateIds, resolveSubscribeDecisionMap } from "./subscribe.mjs";
5
6
 
6
7
  //#region src/runtime/polyfill/menuApi.ts
@@ -11,11 +12,44 @@ function getNetworkTypeBridge(options) {
11
12
  ...status
12
13
  }));
13
14
  }
15
+ function resolveTabBarMutation(action, options, succeeded, failureReason = "tabBar not configured") {
16
+ if (succeeded) return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: `${action}:ok` }));
17
+ const failure = callMiniProgramAsyncFailure(options, `${action}:fail ${failureReason}`);
18
+ return Promise.reject(failure);
19
+ }
14
20
  function showTabBarBridge(options) {
15
- return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "showTabBar:ok" }));
21
+ return resolveTabBarMutation("showTabBar", options, setTabBarVisible(true, options?.animation === true));
16
22
  }
17
23
  function hideTabBarBridge(options) {
18
- return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "hideTabBar:ok" }));
24
+ return resolveTabBarMutation("hideTabBar", options, setTabBarVisible(false, options?.animation === true));
25
+ }
26
+ function setTabBarItemBridge(options) {
27
+ const patch = {
28
+ ...typeof options?.text === "string" ? { text: options.text } : {},
29
+ ...typeof options?.iconPath === "string" ? { iconPath: options.iconPath } : {},
30
+ ...typeof options?.selectedIconPath === "string" ? { selectedIconPath: options.selectedIconPath } : {}
31
+ };
32
+ return resolveTabBarMutation("setTabBarItem", options, updateTabBarItem(options?.index, patch), "invalid index");
33
+ }
34
+ function setTabBarStyleBridge(options) {
35
+ return resolveTabBarMutation("setTabBarStyle", options, updateTabBarStyle({
36
+ ...typeof options?.color === "string" ? { color: options.color } : {},
37
+ ...typeof options?.selectedColor === "string" ? { selectedColor: options.selectedColor } : {},
38
+ ...typeof options?.backgroundColor === "string" ? { backgroundColor: options.backgroundColor } : {},
39
+ ...options?.borderStyle === "black" || options?.borderStyle === "white" ? { borderStyle: options.borderStyle } : {}
40
+ }));
41
+ }
42
+ function setTabBarBadgeBridge(options) {
43
+ return resolveTabBarMutation("setTabBarBadge", options, typeof options?.text === "string" && setTabBarBadgeState(options?.index, options.text), "invalid index or text");
44
+ }
45
+ function removeTabBarBadgeBridge(options) {
46
+ return resolveTabBarMutation("removeTabBarBadge", options, setTabBarBadgeState(options?.index, void 0), "invalid index");
47
+ }
48
+ function showTabBarRedDotBridge(options) {
49
+ return resolveTabBarMutation("showTabBarRedDot", options, setTabBarRedDotState(options?.index, true), "invalid index");
50
+ }
51
+ function hideTabBarRedDotBridge(options) {
52
+ return resolveTabBarMutation("hideTabBarRedDot", options, setTabBarRedDotState(options?.index, false), "invalid index");
19
53
  }
20
54
  function requestPaymentBridge(options) {
21
55
  return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "requestPayment:ok" }));
@@ -66,5 +100,5 @@ function updateShareMenuBridge(options) {
66
100
  }
67
101
 
68
102
  //#endregion
69
- export { getNetworkTypeBridge, hideTabBarBridge, requestPaymentBridge, requestSubscribeMessageBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, updateShareMenuBridge };
103
+ export { getNetworkTypeBridge, hideTabBarBridge, hideTabBarRedDotBridge, removeTabBarBadgeBridge, requestPaymentBridge, requestSubscribeMessageBridge, setTabBarBadgeBridge, setTabBarItemBridge, setTabBarStyleBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, showTabBarRedDotBridge, updateShareMenuBridge };
70
104
  //# sourceMappingURL=menuApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"menuApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/menuApi.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport { readNetworkStatusSnapshot } from './network'\nimport {\n normalizeSubscribeTemplateIds,\n resolveSubscribeDecisionMap,\n} from './subscribe'\nimport {\n normalizeActionSheetItems,\n resolveActionSheetSelection,\n resolveModalSelection,\n} from './ui'\n\nexport function getNetworkTypeBridge(options?: any): Promise<any> {\n const status = readNetworkStatusSnapshot()\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'getNetworkType:ok',\n ...status,\n }))\n}\n\nexport function showTabBarBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showTabBar:ok' }))\n}\n\nexport function hideTabBarBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideTabBar:ok' }))\n}\n\nexport function requestPaymentBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'requestPayment:ok' }))\n}\n\nexport function requestSubscribeMessageBridge(options?: any): Promise<any> {\n const tmplIds = normalizeSubscribeTemplateIds(options?.tmplIds)\n if (tmplIds.length === 0) {\n const failure = callMiniProgramAsyncFailure(options, 'requestSubscribeMessage:fail invalid tmplIds')\n return Promise.reject(failure)\n }\n const decisionMap = resolveSubscribeDecisionMap(tmplIds)\n const result: Record<string, any> & { errMsg: string } = tmplIds.reduce<Record<string, any> & { errMsg: string }>((payload, tmplId) => {\n payload[tmplId] = decisionMap[tmplId]\n return payload\n }, { errMsg: 'requestSubscribeMessage:ok' })\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showModalBridge(options?: any): Promise<any> {\n const modalResult = resolveModalSelection(options)\n const result = {\n errMsg: 'showModal:ok',\n confirm: modalResult.confirm,\n cancel: modalResult.cancel,\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showActionSheetBridge(options?: any): Promise<any> {\n const itemList = normalizeActionSheetItems(options?.itemList)\n if (!itemList.length) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail invalid itemList')\n return Promise.reject(failure)\n }\n const tapIndex = resolveActionSheetSelection(itemList)\n if (tapIndex === null) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail cancel')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'showActionSheet:ok',\n tapIndex,\n }))\n}\n\nexport function showShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showShareMenu:ok' }))\n}\n\nexport function updateShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'updateShareMenu:ok' }))\n}\n"],"mappings":";;;;;;AAeA,SAAgB,qBAAqB,SAA6B;CAChE,MAAM,SAAS,0BAA0B;CACzC,OAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR,GAAG;CACL,CAAC,CAAC;AACJ;AAEA,SAAgB,iBAAiB,SAA6B;CAC5D,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,gBAAgB,CAAC,CAAC;AAC1F;AAEA,SAAgB,iBAAiB,SAA6B;CAC5D,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,gBAAgB,CAAC,CAAC;AAC1F;AAEA,SAAgB,qBAAqB,SAA6B;CAChE,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,oBAAoB,CAAC,CAAC;AAC9F;AAEA,SAAgB,8BAA8B,SAA6B;CACzE,MAAM,UAAU,8BAA8B,SAAS,OAAO;CAC9D,IAAI,QAAQ,WAAW,GAAG;EACxB,MAAM,UAAU,4BAA4B,SAAS,8CAA8C;EACnG,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,MAAM,cAAc,4BAA4B,OAAO;CACvD,MAAM,SAAmD,QAAQ,QAAkD,SAAS,WAAW;EACrI,QAAQ,UAAU,YAAY;EAC9B,OAAO;CACT,GAAG,EAAE,QAAQ,6BAA6B,CAAC;CAC3C,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,MAAM,CAAC;AACrE;AAEA,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,cAAc,sBAAsB,OAAO;CACjD,MAAM,SAAS;EACb,QAAQ;EACR,SAAS,YAAY;EACrB,QAAQ,YAAY;CACtB;CACA,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,MAAM,CAAC;AACrE;AAEA,SAAgB,sBAAsB,SAA6B;CACjE,MAAM,WAAW,0BAA0B,SAAS,QAAQ;CAC5D,IAAI,CAAC,SAAS,QAAQ;EACpB,MAAM,UAAU,4BAA4B,SAAS,uCAAuC;EAC5F,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,MAAM,WAAW,4BAA4B,QAAQ;CACrD,IAAI,aAAa,MAAM;EACrB,MAAM,UAAU,4BAA4B,SAAS,6BAA6B;EAClF,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,OAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR;CACF,CAAC,CAAC;AACJ;AAEA,SAAgB,oBAAoB,SAA6B;CAC/D,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,mBAAmB,CAAC,CAAC;AAC7F;AAEA,SAAgB,sBAAsB,SAA6B;CACjE,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,qBAAqB,CAAC,CAAC;AAC/F"}
1
+ {"version":3,"file":"menuApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/menuApi.ts"],"sourcesContent":["import {\n setTabBarBadgeState,\n setTabBarRedDotState,\n setTabBarVisible,\n updateTabBarItem,\n updateTabBarStyle,\n} from '../appShell/tabBar'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport { readNetworkStatusSnapshot } from './network'\nimport {\n normalizeSubscribeTemplateIds,\n resolveSubscribeDecisionMap,\n} from './subscribe'\nimport {\n normalizeActionSheetItems,\n resolveActionSheetSelection,\n resolveModalSelection,\n} from './ui'\n\nexport function getNetworkTypeBridge(options?: any): Promise<any> {\n const status = readNetworkStatusSnapshot()\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'getNetworkType:ok',\n ...status,\n }))\n}\n\nfunction resolveTabBarMutation(action: string, options: any, succeeded: boolean, failureReason = 'tabBar not configured') {\n if (succeeded) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: `${action}:ok` }))\n }\n const failure = callMiniProgramAsyncFailure(options, `${action}:fail ${failureReason}`)\n return Promise.reject(failure)\n}\n\nexport function showTabBarBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('showTabBar', options, setTabBarVisible(true, options?.animation === true))\n}\n\nexport function hideTabBarBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('hideTabBar', options, setTabBarVisible(false, options?.animation === true))\n}\n\nexport function setTabBarItemBridge(options?: any): Promise<any> {\n const patch = {\n ...(typeof options?.text === 'string' ? { text: options.text } : {}),\n ...(typeof options?.iconPath === 'string' ? { iconPath: options.iconPath } : {}),\n ...(typeof options?.selectedIconPath === 'string' ? { selectedIconPath: options.selectedIconPath } : {}),\n }\n return resolveTabBarMutation('setTabBarItem', options, updateTabBarItem(options?.index, patch), 'invalid index')\n}\n\nexport function setTabBarStyleBridge(options?: any): Promise<any> {\n const patch = {\n ...(typeof options?.color === 'string' ? { color: options.color } : {}),\n ...(typeof options?.selectedColor === 'string' ? { selectedColor: options.selectedColor } : {}),\n ...(typeof options?.backgroundColor === 'string' ? { backgroundColor: options.backgroundColor } : {}),\n ...(options?.borderStyle === 'black' || options?.borderStyle === 'white'\n ? { borderStyle: options.borderStyle }\n : {}),\n }\n return resolveTabBarMutation('setTabBarStyle', options, updateTabBarStyle(patch))\n}\n\nexport function setTabBarBadgeBridge(options?: any): Promise<any> {\n const succeeded = typeof options?.text === 'string'\n && setTabBarBadgeState(options?.index, options.text)\n return resolveTabBarMutation('setTabBarBadge', options, succeeded, 'invalid index or text')\n}\n\nexport function removeTabBarBadgeBridge(options?: any): Promise<any> {\n return resolveTabBarMutation(\n 'removeTabBarBadge',\n options,\n setTabBarBadgeState(options?.index, undefined),\n 'invalid index',\n )\n}\n\nexport function showTabBarRedDotBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('showTabBarRedDot', options, setTabBarRedDotState(options?.index, true), 'invalid index')\n}\n\nexport function hideTabBarRedDotBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('hideTabBarRedDot', options, setTabBarRedDotState(options?.index, false), 'invalid index')\n}\n\nexport function requestPaymentBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'requestPayment:ok' }))\n}\n\nexport function requestSubscribeMessageBridge(options?: any): Promise<any> {\n const tmplIds = normalizeSubscribeTemplateIds(options?.tmplIds)\n if (tmplIds.length === 0) {\n const failure = callMiniProgramAsyncFailure(options, 'requestSubscribeMessage:fail invalid tmplIds')\n return Promise.reject(failure)\n }\n const decisionMap = resolveSubscribeDecisionMap(tmplIds)\n const result: Record<string, any> & { errMsg: string } = tmplIds.reduce<Record<string, any> & { errMsg: string }>((payload, tmplId) => {\n payload[tmplId] = decisionMap[tmplId]\n return payload\n }, { errMsg: 'requestSubscribeMessage:ok' })\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showModalBridge(options?: any): Promise<any> {\n const modalResult = resolveModalSelection(options)\n const result = {\n errMsg: 'showModal:ok',\n confirm: modalResult.confirm,\n cancel: modalResult.cancel,\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showActionSheetBridge(options?: any): Promise<any> {\n const itemList = normalizeActionSheetItems(options?.itemList)\n if (!itemList.length) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail invalid itemList')\n return Promise.reject(failure)\n }\n const tapIndex = resolveActionSheetSelection(itemList)\n if (tapIndex === null) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail cancel')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'showActionSheet:ok',\n tapIndex,\n }))\n}\n\nexport function showShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showShareMenu:ok' }))\n}\n\nexport function updateShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'updateShareMenu:ok' }))\n}\n"],"mappings":";;;;;;;AAsBA,SAAgB,qBAAqB,SAA6B;CAChE,MAAM,SAAS,0BAA0B;CACzC,OAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR,GAAG;CACL,CAAC,CAAC;AACJ;AAEA,SAAS,sBAAsB,QAAgB,SAAc,WAAoB,gBAAgB,yBAAyB;CACxH,IAAI,WACF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,GAAG,OAAO,KAAK,CAAC,CAAC;CAEzF,MAAM,UAAU,4BAA4B,SAAS,GAAG,OAAO,QAAQ,eAAe;CACtF,OAAO,QAAQ,OAAO,OAAO;AAC/B;AAEA,SAAgB,iBAAiB,SAA6B;CAC5D,OAAO,sBAAsB,cAAc,SAAS,iBAAiB,MAAM,SAAS,cAAc,IAAI,CAAC;AACzG;AAEA,SAAgB,iBAAiB,SAA6B;CAC5D,OAAO,sBAAsB,cAAc,SAAS,iBAAiB,OAAO,SAAS,cAAc,IAAI,CAAC;AAC1G;AAEA,SAAgB,oBAAoB,SAA6B;CAC/D,MAAM,QAAQ;EACZ,GAAI,OAAO,SAAS,SAAS,WAAW,EAAE,MAAM,QAAQ,KAAK,IAAI,CAAC;EAClE,GAAI,OAAO,SAAS,aAAa,WAAW,EAAE,UAAU,QAAQ,SAAS,IAAI,CAAC;EAC9E,GAAI,OAAO,SAAS,qBAAqB,WAAW,EAAE,kBAAkB,QAAQ,iBAAiB,IAAI,CAAC;CACxG;CACA,OAAO,sBAAsB,iBAAiB,SAAS,iBAA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AA4B,OAAO;CACvD,MAAM,SAAmD,QAAQ,QAAkD,SAAS,WAAW;EACrI,QAAQ,UAAU,YAAY;EAC9B,OAAO;CACT,GAAG,EAAE,QAAQ,6BAA6B,CAAC;CAC3C,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,MAAM,CAAC;AACrE;AAEA,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,cAAc,sBAAsB,OAAO;CACjD,MAAM,SAAS;EACb,QAAQ;EACR,SAAS,YAAY;EACrB,QAAQ,YAAY;CACtB;CACA,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,MAAM,CAAC;AACrE;AAEA,SAAgB,sBAAsB,SAA6B;CACjE,MAAM,WAAW,0BAA0B,SAAS,QAAQ;CAC5D,IAAI,CAAC,SAAS,QAAQ;EACpB,MAAM,UAAU,4BAA4B,SAAS,uCAAuC;EAC5F,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,MAAM,WAAW,4BAA4B,QAAQ;CACrD,IAAI,aAAa,MAAM;EACrB,MAAM,UAAU,4BAA4B,SAAS,6BAA6B;EAClF,OAAO,QAAQ,OAAO,OAAO;CAC/B;CACA,OAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR;CACF,CAAC,CAAC;AACJ;AAEA,SAAgB,oBAAoB,SAA6B;CAC/D,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,mBAAmB,CAAC,CAAC;AAC7F;AAEA,SAAgB,sBAAsB,SAA6B;CACjE,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,qBAAqB,CAAC,CAAC;AAC/F"}
@@ -1,3 +1,5 @@
1
+ import { updateWebDocumentTitle } from "../seo/index.mjs";
2
+
1
3
  //#region src/runtime/polyfill/navigationBarRuntime.ts
2
4
  function getActiveNavigationBar(pages) {
3
5
  const current = pages[pages.length - 1];
@@ -21,7 +23,10 @@ function createNavigationBarRuntimeBridge(getCurrentPages, emitWarning) {
21
23
  warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}setNavigationBarTitle`);
22
24
  return Promise.resolve();
23
25
  }
24
- if (options?.title !== void 0) bar.setAttribute("title", options.title);
26
+ if (options?.title !== void 0) {
27
+ bar.setAttribute("title", options.title);
28
+ updateWebDocumentTitle(options.title);
29
+ }
25
30
  return Promise.resolve();
26
31
  },
27
32
  setNavigationBarColor(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"navigationBarRuntime.mjs","names":[],"sources":["../../../src/runtime/polyfill/navigationBarRuntime.ts"],"sourcesContent":["interface RuntimeWarningOptions {\n key: string\n context: string\n}\n\ntype RuntimeWarningEmitter = (message: string, options: RuntimeWarningOptions) => void\n\ninterface PageLike extends HTMLElement {\n renderRoot?: ShadowRoot | HTMLElement\n}\n\nfunction getActiveNavigationBar(pages: PageLike[]) {\n const current = pages[pages.length - 1]\n if (!current) {\n return undefined\n }\n const renderRoot = current.renderRoot\n ?? current.shadowRoot\n ?? current\n if (!renderRoot || typeof (renderRoot as ParentNode).querySelector !== 'function') {\n return undefined\n }\n return (renderRoot as ParentNode).querySelector('weapp-navigation-bar') as HTMLElement | null\n}\n\nfunction warnNavigationBarMissing(emitWarning: RuntimeWarningEmitter, action: string) {\n emitWarning(`[@weapp-vite/web] ${action} 需要默认导航栏支持,但当前页面未渲染 weapp-navigation-bar。`, {\n key: 'navigation-bar-missing',\n context: 'runtime:navigation',\n })\n}\n\nexport function createNavigationBarRuntimeBridge(\n getCurrentPages: () => PageLike[],\n emitWarning: RuntimeWarningEmitter,\n) {\n const navigationBarActionPrefix = 'miniProgram.'\n\n return {\n setNavigationBarTitle(options: { title: string }) {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}setNavigationBarTitle`)\n return Promise.resolve()\n }\n if (options?.title !== undefined) {\n bar.setAttribute('title', options.title)\n }\n return Promise.resolve()\n },\n setNavigationBarColor(options: {\n frontColor?: string\n backgroundColor?: string\n animation?: { duration?: number, timingFunction?: string }\n }) {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}setNavigationBarColor`)\n return Promise.resolve()\n }\n if (options?.frontColor) {\n bar.setAttribute('front-color', options.frontColor)\n }\n if (options?.backgroundColor) {\n bar.setAttribute('background-color', options.backgroundColor)\n }\n if (options?.animation) {\n const duration = typeof options.animation.duration === 'number'\n ? `${options.animation.duration}ms`\n : undefined\n const easing = options.animation.timingFunction\n if (duration) {\n bar.style.setProperty('--weapp-nav-transition-duration', duration)\n }\n if (easing) {\n bar.style.setProperty('--weapp-nav-transition-easing', easing)\n }\n }\n return Promise.resolve()\n },\n showNavigationBarLoading() {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}showNavigationBarLoading`)\n return Promise.resolve()\n }\n bar.setAttribute('loading', 'true')\n return Promise.resolve()\n },\n hideNavigationBarLoading() {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}hideNavigationBarLoading`)\n return Promise.resolve()\n }\n bar.removeAttribute('loading')\n return Promise.resolve()\n },\n }\n}\n"],"mappings":";AAWA,SAAS,uBAAuB,OAAmB;CACjD,MAAM,UAAU,MAAM,MAAM,SAAS;CACrC,IAAI,CAAC,SACH;CAEF,MAAM,aAAa,QAAQ,cACtB,QAAQ,cACR;CACL,IAAI,CAAC,cAAc,OAAQ,WAA0B,kBAAkB,YACrE;CAEF,OAAQ,WAA0B,cAAc,sBAAsB;AACxE;AAEA,SAAS,yBAAyB,aAAoC,QAAgB;CACpF,YAAY,qBAAqB,OAAO,4CAA4C;EAClF,KAAK;EACL,SAAS;CACX,CAAC;AACH;AAEA,SAAgB,iCACd,iBACA,aACA;CACA,MAAM,4BAA4B;CAElC,OAAO;EACL,sBAAsB,SAA4B;GAChD,MAAM,MAAM,uBAAuB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[],"sources":["../../../src/runtime/polyfill/navigationBarRuntime.ts"],"sourcesContent":["import { updateWebDocumentTitle } from '../seo'\n\ninterface RuntimeWarningOptions {\n key: string\n context: string\n}\n\ntype RuntimeWarningEmitter = (message: string, options: RuntimeWarningOptions) => void\n\ninterface PageLike extends HTMLElement {\n renderRoot?: ShadowRoot | HTMLElement\n}\n\nfunction getActiveNavigationBar(pages: PageLike[]) {\n const current = pages[pages.length - 1]\n if (!current) {\n return undefined\n }\n const renderRoot = current.renderRoot\n ?? current.shadowRoot\n ?? current\n if (!renderRoot || typeof (renderRoot as ParentNode).querySelector !== 'function') {\n return undefined\n }\n return (renderRoot as ParentNode).querySelector('weapp-navigation-bar') as HTMLElement | null\n}\n\nfunction warnNavigationBarMissing(emitWarning: RuntimeWarningEmitter, action: string) {\n emitWarning(`[@weapp-vite/web] ${action} 需要默认导航栏支持,但当前页面未渲染 weapp-navigation-bar。`, {\n key: 'navigation-bar-missing',\n context: 'runtime:navigation',\n })\n}\n\nexport function createNavigationBarRuntimeBridge(\n getCurrentPages: () => PageLike[],\n emitWarning: RuntimeWarningEmitter,\n) {\n const navigationBarActionPrefix = 'miniProgram.'\n\n return {\n setNavigationBarTitle(options: { title: string }) {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}setNavigationBarTitle`)\n return Promise.resolve()\n }\n if (options?.title !== undefined) {\n bar.setAttribute('title', options.title)\n updateWebDocumentTitle(options.title)\n }\n return Promise.resolve()\n },\n setNavigationBarColor(options: {\n frontColor?: string\n backgroundColor?: string\n animation?: { duration?: number, timingFunction?: string }\n }) {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}setNavigationBarColor`)\n return Promise.resolve()\n }\n if (options?.frontColor) {\n bar.setAttribute('front-color', options.frontColor)\n }\n if (options?.backgroundColor) {\n bar.setAttribute('background-color', options.backgroundColor)\n }\n if (options?.animation) {\n const duration = typeof options.animation.duration === 'number'\n ? `${options.animation.duration}ms`\n : undefined\n const easing = options.animation.timingFunction\n if (duration) {\n bar.style.setProperty('--weapp-nav-transition-duration', duration)\n }\n if (easing) {\n bar.style.setProperty('--weapp-nav-transition-easing', easing)\n }\n }\n return Promise.resolve()\n },\n showNavigationBarLoading() {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}showNavigationBarLoading`)\n return Promise.resolve()\n }\n bar.setAttribute('loading', 'true')\n return Promise.resolve()\n },\n hideNavigationBarLoading() {\n const bar = getActiveNavigationBar(getCurrentPages())\n if (!bar) {\n warnNavigationBarMissing(emitWarning, `${navigationBarActionPrefix}hideNavigationBarLoading`)\n return Promise.resolve()\n }\n bar.removeAttribute('loading')\n return Promise.resolve()\n },\n }\n}\n"],"mappings":";;;AAaA,SAAS,uBAAuB,OAAmB;CACjD,MAAM,UAAU,MAAM,MAAM,SAAS;CACrC,IAAI,CAAC,SACH;CAEF,MAAM,aAAa,QAAQ,cACtB,QAAQ,cACR;CACL,IAAI,CAAC,cAAc,OAAQ,WAA0B,kBAAkB,YACrE;CAEF,OAAQ,WAA0B,cAAc,sBAAsB;AACxE;AAEA,SAAS,yBAAyB,aAAoC,QAAgB;CACpF,YAAY,qBAAqB,OAAO,4CAA4C;EAClF,KAAK;EACL,SAAS;CACX,CAAC;AACH;AAEA,SAAgB,iCACd,iBACA,aACA;CACA,MAAM,4BAA4B;CAElC,OAAO;EACL,sBAAsB,SAA4B;GAChD,MAAM,MAAM,uBAAuB,gBAAgB,CAAC;GACpD,IAAI,CAAC,KAAK;IACR,yBAAyB,aAAa,GAAG,0BAA0B,sBAAsB;IACzF,OAAO,QAAQ,QAAQ;GACzB;GACA,IAAI,SAAS,UAAU,QAAW;IAChC,IAAI,aAAa,SAAS,QAAQ,KAAK;IACvC,uBAAuB,QAAQ,KAAK;GACtC;GACA,OAAO,QAAQ,QAAQ;EACzB;EACA,sBAAsB,SAInB;GACD,MAAM,MAAM,uBAAuB,gBAAgB,CAAC;GACpD,IAAI,CAAC,KAAK;IACR,yBAAyB,aAAa,GAAG,0BAA0B,sBAAsB;IACzF,OAAO,QAAQ,QAAQ;GACzB;GACA,IAAI,SAAS,YACX,IAAI,aAAa,eAAe,QAAQ,UAAU;GAEpD,IAAI,SAAS,iBACX,IAAI,aAAa,oBAAoB,QAAQ,eAAe;GAE9D,IAAI,SAAS,WAAW;IACtB,MAAM,WAAW,OAAO,QAAQ,UAAU,aAAa,WACnD,GAAG,QAAQ,UAAU,SAAS,MAC9B;IACJ,MAAM,SAAS,QAAQ,UAAU;IACjC,IAAI,UACF,IAAI,MAAM,YAAY,mCAAmC,QAAQ;IAEnE,IAAI,QACF,IAAI,MAAM,YAAY,iCAAiC,MAAM;GAEjE;GACA,OAAO,QAAQ,QAAQ;EACzB;EACA,2BAA2B;GACzB,MAAM,MAAM,uBAAuB,gBAAgB,CAAC;GACpD,IAAI,CAAC,KAAK;IACR,yBAAyB,aAAa,GAAG,0BAA0B,yBAAyB;IAC5F,OAAO,QAAQ,QAAQ;GACzB;GACA,IAAI,aAAa,WAAW,MAAM;GAClC,OAAO,QAAQ,QAAQ;EACzB;EACA,2BAA2B;GACzB,MAAM,MAAM,uBAAuB,gBAAgB,CAAC;GACpD,IAAI,CAAC,KAAK;IACR,yBAAyB,aAAa,GAAG,0BAA0B,yBAAyB;IAC5F,OAAO,QAAQ,QAAQ;GACzB;GACA,IAAI,gBAAgB,SAAS;GAC7B,OAAO,QAAQ,QAAQ;EACzB;CACF;AACF"}
@@ -1,3 +1,4 @@
1
+ import { getRuntimeFetch as getRuntimeFetch$1 } from "../../host/index.mjs";
1
2
  import { normalizeFilePath, resolveUploadFileBlob, resolveUploadFileName } from "../files.mjs";
2
3
 
3
4
  //#region src/runtime/polyfill/network/request.ts
@@ -13,8 +14,7 @@ function resolveTimeoutSignal(timeout) {
13
14
  };
14
15
  }
15
16
  function getRuntimeFetch() {
16
- const maybeFetch = globalThis.fetch;
17
- if (typeof maybeFetch === "function") return maybeFetch;
17
+ return getRuntimeFetch$1();
18
18
  }
19
19
  function normalizeRequestMethod(method) {
20
20
  return (method || "GET").toUpperCase();
@@ -1 +1 @@
1
- {"version":3,"file":"request.mjs","names":["runtime"],"sources":["../../../../src/runtime/polyfill/network/request.ts"],"sourcesContent":["import {\n normalizeFilePath,\n resolveUploadFileBlob,\n resolveUploadFileName,\n} from '../files'\n\ninterface RequestParseOptions {\n responseType?: 'text' | 'arraybuffer'\n dataType?: 'json' | 'text'\n}\n\ninterface RequestLikeOptions extends RequestParseOptions {\n url?: string\n method?: string\n header?: Record<string, string>\n data?: unknown\n timeout?: number\n}\n\ninterface DownloadLikeOptions {\n url?: string\n header?: Record<string, string>\n timeout?: number\n}\n\ninterface UploadLikeOptions {\n url?: string\n filePath?: string\n header?: Record<string, string>\n formData?: Record<string, unknown>\n name?: string\n timeout?: number\n}\n\nfunction resolveTimeoutSignal(timeout: number) {\n const controller = typeof AbortController === 'function' ? new AbortController() : undefined\n let timeoutTimer: ReturnType<typeof setTimeout> | undefined\n if (timeout > 0 && controller) {\n timeoutTimer = setTimeout(() => controller.abort(), timeout)\n }\n return {\n signal: controller?.signal,\n clear: () => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n }\n },\n }\n}\n\nexport function getRuntimeFetch() {\n const runtime = globalThis as Record<string, unknown>\n const maybeFetch = runtime.fetch\n if (typeof maybeFetch === 'function') {\n return maybeFetch as typeof fetch\n }\n return undefined\n}\n\nexport function normalizeRequestMethod(method?: string) {\n return (method || 'GET').toUpperCase()\n}\n\nexport function normalizeRequestHeaders(header?: Record<string, string>) {\n if (!header) {\n return {}\n }\n return { ...header }\n}\n\nexport function buildRequestUrl(url: string, method: string, data: unknown) {\n if (method !== 'GET' || data == null) {\n return url\n }\n if (typeof data === 'string') {\n if (!data) {\n return url\n }\n return `${url}${url.includes('?') ? '&' : '?'}${data}`\n }\n if (typeof URLSearchParams !== 'undefined' && data instanceof URLSearchParams) {\n const query = data.toString()\n if (!query) {\n return url\n }\n return `${url}${url.includes('?') ? '&' : '?'}${query}`\n }\n if (typeof data === 'object') {\n const query = new URLSearchParams()\n for (const [key, value] of Object.entries(data as Record<string, unknown>)) {\n query.append(key, value == null ? '' : String(value))\n }\n const queryText = query.toString()\n if (!queryText) {\n return url\n }\n return `${url}${url.includes('?') ? '&' : '?'}${queryText}`\n }\n return url\n}\n\nexport function buildRequestBody(\n method: string,\n data: unknown,\n headers: Record<string, string>,\n) {\n if (method === 'GET' || data == null) {\n return undefined\n }\n if (typeof data === 'string') {\n return data\n }\n if (typeof URLSearchParams !== 'undefined' && data instanceof URLSearchParams) {\n return data\n }\n if (typeof FormData !== 'undefined' && data instanceof FormData) {\n return data\n }\n const contentTypeKey = Object.keys(headers).find(key => key.toLowerCase() === 'content-type')\n const contentType = contentTypeKey ? headers[contentTypeKey] : ''\n if (contentType && !contentType.includes('application/json')) {\n return String(data)\n }\n if (!contentTypeKey) {\n headers['content-type'] = 'application/json'\n }\n return JSON.stringify(data)\n}\n\nexport async function parseRequestResponseData(\n response: Response,\n options?: RequestParseOptions,\n) {\n if (options?.responseType === 'arraybuffer') {\n return response.arrayBuffer()\n }\n const contentType = response.headers.get('content-type') ?? ''\n if (options?.dataType === 'text') {\n return response.text()\n }\n if (options?.dataType === 'json' || contentType.includes('application/json')) {\n return response.json()\n }\n return response.text()\n}\n\nexport function createBlobObjectUrl(blob: Blob) {\n const runtimeUrl = (globalThis as {\n URL?: {\n createObjectURL?: (value: Blob) => string\n }\n }).URL\n if (runtimeUrl && typeof runtimeUrl.createObjectURL === 'function') {\n return runtimeUrl.createObjectURL(blob)\n }\n return ''\n}\n\nexport function collectResponseHeaders(response: {\n headers: {\n forEach: (callback: (value: string, key: string) => void) => void\n }\n}) {\n const headers: Record<string, string> = {}\n response.headers.forEach((value, key) => {\n headers[key] = value\n })\n return headers\n}\n\nexport function stripUploadContentType(headers: Record<string, string>) {\n const normalized = { ...headers }\n for (const key of Object.keys(normalized)) {\n if (key.toLowerCase() === 'content-type') {\n delete normalized[key]\n }\n }\n return normalized\n}\n\nexport async function performRequestByFetch(options?: RequestLikeOptions) {\n const url = options?.url?.trim() ?? ''\n if (!url) {\n throw new TypeError('invalid url')\n }\n const runtimeFetch = getRuntimeFetch()\n if (!runtimeFetch) {\n throw new TypeError('fetch is unavailable')\n }\n const method = normalizeRequestMethod(options?.method)\n const headers = normalizeRequestHeaders(options?.header)\n const requestUrl = buildRequestUrl(url, method, options?.data)\n const body = buildRequestBody(method, options?.data, headers)\n const timeout = typeof options?.timeout === 'number' && options.timeout > 0 ? options.timeout : 0\n const timeoutControl = resolveTimeoutSignal(timeout)\n\n try {\n const response = await runtimeFetch(requestUrl, {\n method,\n headers,\n body,\n signal: timeoutControl.signal,\n })\n const responseData = await parseRequestResponseData(response, options)\n return {\n data: responseData,\n statusCode: response.status,\n header: collectResponseHeaders(response),\n }\n }\n finally {\n timeoutControl.clear()\n }\n}\n\nexport async function performDownloadByFetch(options?: DownloadLikeOptions) {\n const url = options?.url?.trim() ?? ''\n if (!url) {\n throw new TypeError('invalid url')\n }\n const runtimeFetch = getRuntimeFetch()\n if (!runtimeFetch) {\n throw new TypeError('fetch is unavailable')\n }\n const headers = normalizeRequestHeaders(options?.header)\n const timeout = typeof options?.timeout === 'number' && options.timeout > 0 ? options.timeout : 0\n const timeoutControl = resolveTimeoutSignal(timeout)\n\n try {\n const response = await runtimeFetch(url, {\n method: 'GET',\n headers,\n signal: timeoutControl.signal,\n })\n const blob = await response.blob()\n return {\n tempFilePath: createBlobObjectUrl(blob) || url,\n statusCode: response.status,\n }\n }\n finally {\n timeoutControl.clear()\n }\n}\n\nexport async function performUploadByFetch(options?: UploadLikeOptions) {\n const url = options?.url?.trim() ?? ''\n if (!url) {\n throw new TypeError('invalid url')\n }\n const filePath = normalizeFilePath(options?.filePath)\n if (!filePath) {\n throw new TypeError('invalid filePath')\n }\n const runtimeFetch = getRuntimeFetch()\n if (!runtimeFetch) {\n throw new TypeError('fetch is unavailable')\n }\n const FormDataCtor = (globalThis as { FormData?: typeof FormData }).FormData\n if (typeof FormDataCtor !== 'function') {\n throw new TypeError('FormData is unavailable')\n }\n\n const headers = stripUploadContentType(normalizeRequestHeaders(options?.header))\n const formData = new FormDataCtor()\n for (const [key, value] of Object.entries(options?.formData ?? {})) {\n formData.append(key, value == null ? '' : String(value))\n }\n const blob = await resolveUploadFileBlob(filePath, runtimeFetch)\n formData.append(options?.name?.trim() || 'file', blob, resolveUploadFileName(filePath))\n\n const timeout = typeof options?.timeout === 'number' && options.timeout > 0 ? options.timeout : 0\n const timeoutControl = resolveTimeoutSignal(timeout)\n\n try {\n const response = await runtimeFetch(url, {\n method: 'POST',\n headers,\n body: formData,\n signal: timeoutControl.signal,\n })\n const data = await response.text()\n return {\n data,\n statusCode: response.status,\n header: collectResponseHeaders(response),\n }\n }\n finally {\n timeoutControl.clear()\n }\n}\n"],"mappings":";;;AAkCA,SAAS,qBAAqB,SAAiB;CAC7C,MAAM,aAAa,OAAO,oBAAoB,aAAa,IAAI,gBAAgB,IAAI;CACnF,IAAI;CACJ,IAAI,UAAU,KAAK,YACjB,eAAe,iBAAiB,WAAW,MAAM,GAAG,OAAO;CAE7D,OAAO;EACL,QAAQ,YAAY;EACpB,aAAa;GACX,IAAI,cACF,aAAa,YAAY;EAE7B;CACF;AACF;AAEA,SAAgB,kBAAkB;CAEhC,MAAM,aAAaA,WAAQ;CAC3B,IAAI,OAAO,eAAe,YACxB,OAAO;AAGX;AAEA,SAAgB,uBAAuB,QAAiB;CACtD,QAAQ,UAAU,MAAK,CAAE,YAAY;AACvC;AAEA,SAAgB,wBAAwB,QAAiC;CACvE,IAAI,CAAC,QACH,OAAO,CAAC;CAEV,OAAO,EAAE,GAAG,OAAO;AACrB;AAEA,SAAgB,gBAAgB,KAAa,QAAgB,MAAe;CAC1E,IAAI,WAAW,SAAS,QAAQ,MAC9B,OAAO;CAET,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EzD,MAAM,OAAO,MAAM,sBAAsB,UAAU,YAAY;CAC/D,SAAS,OAAO,SAAS,MAAM,KAAK,KAAK,QAAQ,MAAM,sBAAsB,QAAQ,CAAC;CAGtF,MAAM,iBAAiB,qBADP,OAAO,SAAS,YAAY,YAAY,QAAQ,UAAU,IAAI,QAAQ,UAAU,CAC7C;CAEnD,IAAI;EACF,MAAM,WAAW,MAAM,aAAa,KAAK;GACvC,QAAQ;GACR;GACA,MAAM;GACN,QAAQ,eAAe;EACzB,CAAC;EAED,OAAO;GACL,YAFiB,SAAS,KAAK;GAG/B,YAAY,SAAS;GACrB,QAAQ,uBAAuB,QAAQ;EACzC;CACF,UACQ;EACN,eAAe,MAAM;CACvB;AACF"}
1
+ {"version":3,"file":"request.mjs","names":["getHostRuntimeFetch"],"sources":["../../../../src/runtime/polyfill/network/request.ts"],"sourcesContent":["import { getRuntimeFetch as getHostRuntimeFetch } from '../../host'\nimport {\n normalizeFilePath,\n resolveUploadFileBlob,\n resolveUploadFileName,\n} from '../files'\n\ninterface RequestParseOptions {\n responseType?: 'text' | 'arraybuffer'\n dataType?: 'json' | 'text'\n}\n\ninterface RequestLikeOptions extends RequestParseOptions {\n url?: string\n method?: string\n header?: Record<string, string>\n data?: unknown\n timeout?: number\n}\n\ninterface DownloadLikeOptions {\n url?: string\n header?: Record<string, string>\n timeout?: number\n}\n\ninterface UploadLikeOptions {\n url?: string\n filePath?: string\n header?: Record<string, string>\n formData?: Record<string, unknown>\n name?: string\n timeout?: number\n}\n\nfunction resolveTimeoutSignal(timeout: number) {\n const controller = typeof AbortController === 'function' ? new AbortController() : undefined\n let timeoutTimer: ReturnType<typeof setTimeout> | undefined\n if (timeout > 0 && controller) {\n timeoutTimer = setTimeout(() => controller.abort(), timeout)\n }\n return {\n signal: controller?.signal,\n clear: () => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n }\n },\n }\n}\n\nexport function getRuntimeFetch() {\n return getHostRuntimeFetch()\n}\n\nexport function normalizeRequestMethod(method?: string) {\n return (method || 'GET').toUpperCase()\n}\n\nexport function normalizeRequestHeaders(header?: Record<string, string>) {\n if (!header) {\n return {}\n }\n return { ...header }\n}\n\nexport function buildRequestUrl(url: string, method: string, data: unknown) {\n if (method !== 'GET' || data == null) {\n return url\n }\n if (typeof data === 'string') {\n if (!data) {\n return url\n }\n return `${url}${url.includes('?') ? '&' : '?'}${data}`\n }\n if (typeof URLSearchParams !== 'undefined' && data instanceof URLSearchParams) {\n const query = data.toString()\n if (!query) {\n return url\n }\n return `${url}${url.includes('?') ? '&' : '?'}${query}`\n }\n if (typeof data === 'object') {\n const query = new URLSearchParams()\n for (const [key, value] of Object.entries(data as Record<string, unknown>)) {\n query.append(key, value == null ? '' : String(value))\n }\n const queryText = query.toString()\n if (!queryText) {\n return url\n }\n return `${url}${url.includes('?') ? '&' : '?'}${queryText}`\n }\n return url\n}\n\nexport function buildRequestBody(\n method: string,\n data: unknown,\n headers: Record<string, string>,\n) {\n if (method === 'GET' || data == null) {\n return undefined\n }\n if (typeof data === 'string') {\n return data\n }\n if (typeof URLSearchParams !== 'undefined' && data instanceof URLSearchParams) {\n return data\n }\n if (typeof FormData !== 'undefined' && data instanceof FormData) {\n return data\n }\n const contentTypeKey = Object.keys(headers).find(key => key.toLowerCase() === 'content-type')\n const contentType = contentTypeKey ? headers[contentTypeKey] : ''\n if (contentType && !contentType.includes('application/json')) {\n return String(data)\n }\n if (!contentTypeKey) {\n headers['content-type'] = 'application/json'\n }\n return JSON.stringify(data)\n}\n\nexport async function parseRequestResponseData(\n response: Response,\n options?: RequestParseOptions,\n) {\n if (options?.responseType === 'arraybuffer') {\n return response.arrayBuffer()\n }\n const contentType = response.headers.get('content-type') ?? ''\n if (options?.dataType === 'text') {\n return response.text()\n }\n if (options?.dataType === 'json' || contentType.includes('application/json')) {\n return response.json()\n }\n return response.text()\n}\n\nexport function createBlobObjectUrl(blob: Blob) {\n const runtimeUrl = (globalThis as {\n URL?: {\n createObjectURL?: (value: Blob) => string\n }\n }).URL\n if (runtimeUrl && typeof runtimeUrl.createObjectURL === 'function') {\n return runtimeUrl.createObjectURL(blob)\n }\n return ''\n}\n\nexport function collectResponseHeaders(response: {\n headers: {\n forEach: (callback: (value: string, key: string) => void) => void\n }\n}) {\n const headers: Record<string, string> = {}\n response.headers.forEach((value, key) => {\n headers[key] = value\n })\n return headers\n}\n\nexport function stripUploadContentType(headers: Record<string, string>) {\n const normalized = { ...headers }\n for (const key of Object.keys(normalized)) {\n if (key.toLowerCase() === 'content-type') {\n delete normalized[key]\n }\n }\n return normalized\n}\n\nexport async function performRequestByFetch(options?: RequestLikeOptions) {\n const url = options?.url?.trim() ?? ''\n if (!url) {\n throw new TypeError('invalid url')\n }\n const runtimeFetch = getRuntimeFetch()\n if (!runtimeFetch) {\n throw new TypeError('fetch is unavailable')\n }\n const method = normalizeRequestMethod(options?.method)\n const headers = normalizeRequestHeaders(options?.header)\n const requestUrl = buildRequestUrl(url, method, options?.data)\n const body = buildRequestBody(method, options?.data, headers)\n const timeout = typeof options?.timeout === 'number' && options.timeout > 0 ? options.timeout : 0\n const timeoutControl = resolveTimeoutSignal(timeout)\n\n try {\n const response = await runtimeFetch(requestUrl, {\n method,\n headers,\n body,\n signal: timeoutControl.signal,\n })\n const responseData = await parseRequestResponseData(response, options)\n return {\n data: responseData,\n statusCode: response.status,\n header: collectResponseHeaders(response),\n }\n }\n finally {\n timeoutControl.clear()\n }\n}\n\nexport async function performDownloadByFetch(options?: DownloadLikeOptions) {\n const url = options?.url?.trim() ?? ''\n if (!url) {\n throw new TypeError('invalid url')\n }\n const runtimeFetch = getRuntimeFetch()\n if (!runtimeFetch) {\n throw new TypeError('fetch is unavailable')\n }\n const headers = normalizeRequestHeaders(options?.header)\n const timeout = typeof options?.timeout === 'number' && options.timeout > 0 ? options.timeout : 0\n const timeoutControl = resolveTimeoutSignal(timeout)\n\n try {\n const response = await runtimeFetch(url, {\n method: 'GET',\n headers,\n signal: timeoutControl.signal,\n })\n const blob = await response.blob()\n return {\n tempFilePath: createBlobObjectUrl(blob) || url,\n statusCode: response.status,\n }\n }\n finally {\n timeoutControl.clear()\n }\n}\n\nexport async function performUploadByFetch(options?: UploadLikeOptions) {\n const url = options?.url?.trim() ?? ''\n if (!url) {\n throw new TypeError('invalid url')\n }\n const filePath = normalizeFilePath(options?.filePath)\n if (!filePath) {\n throw new TypeError('invalid filePath')\n }\n const runtimeFetch = getRuntimeFetch()\n if (!runtimeFetch) {\n throw new TypeError('fetch is unavailable')\n }\n const FormDataCtor = (globalThis as { FormData?: typeof FormData }).FormData\n if (typeof FormDataCtor !== 'function') {\n throw new TypeError('FormData is unavailable')\n }\n\n const headers = stripUploadContentType(normalizeRequestHeaders(options?.header))\n const formData = new FormDataCtor()\n for (const [key, value] of Object.entries(options?.formData ?? {})) {\n formData.append(key, value == null ? '' : String(value))\n }\n const blob = await resolveUploadFileBlob(filePath, runtimeFetch)\n formData.append(options?.name?.trim() || 'file', blob, resolveUploadFileName(filePath))\n\n const timeout = typeof options?.timeout === 'number' && options.timeout > 0 ? options.timeout : 0\n const timeoutControl = resolveTimeoutSignal(timeout)\n\n try {\n const response = await runtimeFetch(url, {\n method: 'POST',\n headers,\n body: formData,\n signal: timeoutControl.signal,\n })\n const data = await response.text()\n return {\n data,\n statusCode: response.status,\n header: collectResponseHeaders(response),\n }\n }\n finally {\n timeoutControl.clear()\n }\n}\n"],"mappings":";;;;AAmCA,SAAS,qBAAqB,SAAiB;CAC7C,MAAM,aAAa,OAAO,oBAAoB,aAAa,IAAI,gBAAgB,IAAI;CACnF,IAAI;CACJ,IAAI,UAAU,KAAK,YACjB,eAAe,iBAAiB,WAAW,MAAM,GAAG,OAAO;CAE7D,OAAO;EACL,QAAQ,YAAY;EACpB,aAAa;GACX,IAAI,cACF,aAAa,YAAY;EAE7B;CACF;AACF;AAEA,SAAgB,kBAAkB;CAChC,OAAOA,kBAAoB;AAC7B;AAEA,SAAgB,uBAAuB,QAAiB;CACtD,QAAQ,UAAU,M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AAM,UAAU,uBAAuB,wBAAwB,SAAS,MAAM,CAAC;CAC/E,MAAM,WAAW,IAAI,aAAa;CAClC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,YAAY,CAAC,CAAC,GAC/D,SAAS,OAAO,KAAK,SAAS,OAAO,KAAK,OAAO,KAAK,CAAC;CAEzD,MAAM,OAAO,MAAM,sBAAsB,UAAU,YAAY;CAC/D,SAAS,OAAO,SAAS,MAAM,KAAK,KAAK,QAAQ,MAAM,sBAAsB,QAAQ,CAAC;CAGtF,MAAM,iBAAiB,qBADP,OAAO,SAAS,YAAY,YAAY,QAAQ,UAAU,IAAI,QAAQ,UAAU,CAC7C;CAEnD,IAAI;EACF,MAAM,WAAW,MAAM,aAAa,KAAK;GACvC,QAAQ;GACR;GACA,MAAM;GACN,QAAQ,eAAe;EACzB,CAAC;EAED,OAAO;GACL,YAFiB,SAAS,KAAK;GAG/B,YAAY,SAAS;GACrB,QAAQ,uBAAuB,QAAQ;EACzC;CACF,UACQ;EACN,eAAe,MAAM;CACvB;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { callMiniProgramAsyncSuccess, scheduleMicrotask } from "./async.mjs";
2
- import { createInterstitialAdImpl, createRewardedVideoAdImpl } from "./ad.mjs";
3
2
  import { createLogManagerBridge, createUpdateManagerBridge, readExtConfigValue, readRuntimeConsole, reportAnalyticsEvent, resolveUpdateManagerPreset } from "./platformRuntime.mjs";
3
+ import { createInterstitialAdImpl, createRewardedVideoAdImpl } from "./ad.mjs";
4
4
 
5
5
  //#region src/runtime/polyfill/platformApi.ts
6
6
  function createRewardedVideoAdBridge(options) {