@despia-native/kernel 0.0.0-stage → 0.3.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 (661) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +1414 -0
  3. package/README.md +17 -2
  4. package/dist/.dsx-build-stamp.json +7 -0
  5. package/dist/api-cohort.d.ts +27 -0
  6. package/dist/api-cohort.d.ts.map +1 -0
  7. package/dist/api-cohort.js +94 -0
  8. package/dist/api-cohort.js.map +1 -0
  9. package/dist/api.d.ts +454 -0
  10. package/dist/api.d.ts.map +1 -0
  11. package/dist/api.js +2442 -0
  12. package/dist/api.js.map +1 -0
  13. package/dist/app-consts.d.ts +10 -0
  14. package/dist/app-consts.d.ts.map +1 -0
  15. package/dist/app-consts.js +39 -0
  16. package/dist/app-consts.js.map +1 -0
  17. package/dist/app-update.d.ts +12 -0
  18. package/dist/app-update.d.ts.map +1 -0
  19. package/dist/app-update.js +32 -0
  20. package/dist/app-update.js.map +1 -0
  21. package/dist/aria.d.ts +152 -0
  22. package/dist/aria.d.ts.map +1 -0
  23. package/dist/aria.js +524 -0
  24. package/dist/aria.js.map +1 -0
  25. package/dist/audio-core.d.ts +260 -0
  26. package/dist/audio-core.d.ts.map +1 -0
  27. package/dist/audio-core.js +1440 -0
  28. package/dist/audio-core.js.map +1 -0
  29. package/dist/audio-edit.d.ts +100 -0
  30. package/dist/audio-edit.d.ts.map +1 -0
  31. package/dist/audio-edit.js +489 -0
  32. package/dist/audio-edit.js.map +1 -0
  33. package/dist/audio-mix.d.ts +84 -0
  34. package/dist/audio-mix.d.ts.map +1 -0
  35. package/dist/audio-mix.js +393 -0
  36. package/dist/audio-mix.js.map +1 -0
  37. package/dist/auth-proof.d.ts +145 -0
  38. package/dist/auth-proof.d.ts.map +1 -0
  39. package/dist/auth-proof.js +644 -0
  40. package/dist/auth-proof.js.map +1 -0
  41. package/dist/availability-explain.d.ts +3 -0
  42. package/dist/availability-explain.d.ts.map +1 -0
  43. package/dist/availability-explain.js +322 -0
  44. package/dist/availability-explain.js.map +1 -0
  45. package/dist/availability.d.ts +246 -0
  46. package/dist/availability.d.ts.map +1 -0
  47. package/dist/availability.js +615 -0
  48. package/dist/availability.js.map +1 -0
  49. package/dist/background.d.ts +116 -0
  50. package/dist/background.d.ts.map +1 -0
  51. package/dist/background.js +235 -0
  52. package/dist/background.js.map +1 -0
  53. package/dist/boot-tables-flag.d.ts +2 -0
  54. package/dist/boot-tables-flag.d.ts.map +1 -0
  55. package/dist/boot-tables-flag.js +16 -0
  56. package/dist/boot-tables-flag.js.map +1 -0
  57. package/dist/boot-tables.d.ts +40 -0
  58. package/dist/boot-tables.d.ts.map +1 -0
  59. package/dist/boot-tables.js +102 -0
  60. package/dist/boot-tables.js.map +1 -0
  61. package/dist/border-edges.d.ts +5 -0
  62. package/dist/border-edges.d.ts.map +1 -0
  63. package/dist/border-edges.js +47 -0
  64. package/dist/border-edges.js.map +1 -0
  65. package/dist/bus.d.ts +1203 -0
  66. package/dist/bus.d.ts.map +1 -0
  67. package/dist/bus.js +2647 -0
  68. package/dist/bus.js.map +1 -0
  69. package/dist/calendar-core.d.ts +143 -0
  70. package/dist/calendar-core.d.ts.map +1 -0
  71. package/dist/calendar-core.js +372 -0
  72. package/dist/calendar-core.js.map +1 -0
  73. package/dist/call-value.d.ts +16 -0
  74. package/dist/call-value.d.ts.map +1 -0
  75. package/dist/call-value.js +54 -0
  76. package/dist/call-value.js.map +1 -0
  77. package/dist/camera-core.d.ts +222 -0
  78. package/dist/camera-core.d.ts.map +1 -0
  79. package/dist/camera-core.js +980 -0
  80. package/dist/camera-core.js.map +1 -0
  81. package/dist/canvas-core.d.ts +404 -0
  82. package/dist/canvas-core.d.ts.map +1 -0
  83. package/dist/canvas-core.js +2186 -0
  84. package/dist/canvas-core.js.map +1 -0
  85. package/dist/capture-core.d.ts +74 -0
  86. package/dist/capture-core.d.ts.map +1 -0
  87. package/dist/capture-core.js +158 -0
  88. package/dist/capture-core.js.map +1 -0
  89. package/dist/compile/codegen.d.ts +146 -0
  90. package/dist/compile/codegen.d.ts.map +1 -0
  91. package/dist/compile/codegen.js +1949 -0
  92. package/dist/compile/codegen.js.map +1 -0
  93. package/dist/compile/jstier.d.ts +44 -0
  94. package/dist/compile/jstier.d.ts.map +1 -0
  95. package/dist/compile/jstier.js +181 -0
  96. package/dist/compile/jstier.js.map +1 -0
  97. package/dist/compile/tier-door.d.ts +41 -0
  98. package/dist/compile/tier-door.d.ts.map +1 -0
  99. package/dist/compile/tier-door.js +167 -0
  100. package/dist/compile/tier-door.js.map +1 -0
  101. package/dist/compile/tier-realm.d.ts +49 -0
  102. package/dist/compile/tier-realm.d.ts.map +1 -0
  103. package/dist/compile/tier-realm.js +368 -0
  104. package/dist/compile/tier-realm.js.map +1 -0
  105. package/dist/compile/tier.d.ts +23 -0
  106. package/dist/compile/tier.d.ts.map +1 -0
  107. package/dist/compile/tier.js +157 -0
  108. package/dist/compile/tier.js.map +1 -0
  109. package/dist/compose-core.d.ts +86 -0
  110. package/dist/compose-core.d.ts.map +1 -0
  111. package/dist/compose-core.js +112 -0
  112. package/dist/compose-core.js.map +1 -0
  113. package/dist/config-validate.d.ts +31 -0
  114. package/dist/config-validate.d.ts.map +1 -0
  115. package/dist/config-validate.js +147 -0
  116. package/dist/config-validate.js.map +1 -0
  117. package/dist/config-values.d.ts +106 -0
  118. package/dist/config-values.d.ts.map +1 -0
  119. package/dist/config-values.js +340 -0
  120. package/dist/config-values.js.map +1 -0
  121. package/dist/contacts-core.d.ts +127 -0
  122. package/dist/contacts-core.d.ts.map +1 -0
  123. package/dist/contacts-core.js +211 -0
  124. package/dist/contacts-core.js.map +1 -0
  125. package/dist/content-transition.d.ts +58 -0
  126. package/dist/content-transition.d.ts.map +1 -0
  127. package/dist/content-transition.js +94 -0
  128. package/dist/content-transition.js.map +1 -0
  129. package/dist/controls-core.d.ts +227 -0
  130. package/dist/controls-core.d.ts.map +1 -0
  131. package/dist/controls-core.js +652 -0
  132. package/dist/controls-core.js.map +1 -0
  133. package/dist/cookies.d.ts +78 -0
  134. package/dist/cookies.d.ts.map +1 -0
  135. package/dist/cookies.js +265 -0
  136. package/dist/cookies.js.map +1 -0
  137. package/dist/corner-shape-core.d.ts +69 -0
  138. package/dist/corner-shape-core.d.ts.map +1 -0
  139. package/dist/corner-shape-core.js +261 -0
  140. package/dist/corner-shape-core.js.map +1 -0
  141. package/dist/crypto-core.d.ts +57 -0
  142. package/dist/crypto-core.d.ts.map +1 -0
  143. package/dist/crypto-core.js +128 -0
  144. package/dist/crypto-core.js.map +1 -0
  145. package/dist/dataviz.d.ts +436 -0
  146. package/dist/dataviz.d.ts.map +1 -0
  147. package/dist/dataviz.js +956 -0
  148. package/dist/dataviz.js.map +1 -0
  149. package/dist/debug.d.ts +293 -0
  150. package/dist/debug.d.ts.map +1 -0
  151. package/dist/debug.js +767 -0
  152. package/dist/debug.js.map +1 -0
  153. package/dist/device-ownership.d.ts +50 -0
  154. package/dist/device-ownership.d.ts.map +1 -0
  155. package/dist/device-ownership.js +105 -0
  156. package/dist/device-ownership.js.map +1 -0
  157. package/dist/effects.d.ts +86 -0
  158. package/dist/effects.d.ts.map +1 -0
  159. package/dist/effects.js +98 -0
  160. package/dist/effects.js.map +1 -0
  161. package/dist/element.d.ts +108 -0
  162. package/dist/element.d.ts.map +1 -0
  163. package/dist/element.js +63 -0
  164. package/dist/element.js.map +1 -0
  165. package/dist/file-watch.d.ts +16 -0
  166. package/dist/file-watch.d.ts.map +1 -0
  167. package/dist/file-watch.js +49 -0
  168. package/dist/file-watch.js.map +1 -0
  169. package/dist/filepaths.d.ts +72 -0
  170. package/dist/filepaths.d.ts.map +1 -0
  171. package/dist/filepaths.js +271 -0
  172. package/dist/filepaths.js.map +1 -0
  173. package/dist/film.d.ts +264 -0
  174. package/dist/film.d.ts.map +1 -0
  175. package/dist/film.js +313 -0
  176. package/dist/film.js.map +1 -0
  177. package/dist/fonts.d.ts +66 -0
  178. package/dist/fonts.d.ts.map +1 -0
  179. package/dist/fonts.js +135 -0
  180. package/dist/fonts.js.map +1 -0
  181. package/dist/forms.d.ts +191 -0
  182. package/dist/forms.d.ts.map +1 -0
  183. package/dist/forms.js +663 -0
  184. package/dist/forms.js.map +1 -0
  185. package/dist/geo.d.ts +289 -0
  186. package/dist/geo.d.ts.map +1 -0
  187. package/dist/geo.js +460 -0
  188. package/dist/geo.js.map +1 -0
  189. package/dist/handler-announce.d.ts +46 -0
  190. package/dist/handler-announce.d.ts.map +1 -0
  191. package/dist/handler-announce.js +96 -0
  192. package/dist/handler-announce.js.map +1 -0
  193. package/dist/handoff.d.ts +71 -0
  194. package/dist/handoff.d.ts.map +1 -0
  195. package/dist/handoff.js +250 -0
  196. package/dist/handoff.js.map +1 -0
  197. package/dist/identity-durability.d.ts +76 -0
  198. package/dist/identity-durability.d.ts.map +1 -0
  199. package/dist/identity-durability.js +150 -0
  200. package/dist/identity-durability.js.map +1 -0
  201. package/dist/image-core.d.ts +240 -0
  202. package/dist/image-core.d.ts.map +1 -0
  203. package/dist/image-core.js +618 -0
  204. package/dist/image-core.js.map +1 -0
  205. package/dist/image-schemes.d.ts +10 -0
  206. package/dist/image-schemes.d.ts.map +1 -0
  207. package/dist/image-schemes.js +28 -0
  208. package/dist/image-schemes.js.map +1 -0
  209. package/dist/index.d.ts +143 -0
  210. package/dist/index.d.ts.map +1 -0
  211. package/dist/index.js +299 -0
  212. package/dist/index.js.map +1 -0
  213. package/dist/ink-core.d.ts +53 -0
  214. package/dist/ink-core.d.ts.map +1 -0
  215. package/dist/ink-core.js +119 -0
  216. package/dist/ink-core.js.map +1 -0
  217. package/dist/input.d.ts +148 -0
  218. package/dist/input.d.ts.map +1 -0
  219. package/dist/input.js +358 -0
  220. package/dist/input.js.map +1 -0
  221. package/dist/integrity.d.ts +63 -0
  222. package/dist/integrity.d.ts.map +1 -0
  223. package/dist/integrity.js +150 -0
  224. package/dist/integrity.js.map +1 -0
  225. package/dist/intents.d.ts +95 -0
  226. package/dist/intents.d.ts.map +1 -0
  227. package/dist/intents.js +282 -0
  228. package/dist/intents.js.map +1 -0
  229. package/dist/interpolate-core.d.ts +37 -0
  230. package/dist/interpolate-core.d.ts.map +1 -0
  231. package/dist/interpolate-core.js +443 -0
  232. package/dist/interpolate-core.js.map +1 -0
  233. package/dist/jse/color.d.ts +12 -0
  234. package/dist/jse/color.d.ts.map +1 -0
  235. package/dist/jse/color.js +196 -0
  236. package/dist/jse/color.js.map +1 -0
  237. package/dist/jse/core.d.ts +54 -0
  238. package/dist/jse/core.d.ts.map +1 -0
  239. package/dist/jse/core.js +1519 -0
  240. package/dist/jse/core.js.map +1 -0
  241. package/dist/jse/dispatch.d.ts +28 -0
  242. package/dist/jse/dispatch.d.ts.map +1 -0
  243. package/dist/jse/dispatch.js +116 -0
  244. package/dist/jse/dispatch.js.map +1 -0
  245. package/dist/jse/highlight-grammar.d.ts +15 -0
  246. package/dist/jse/highlight-grammar.d.ts.map +1 -0
  247. package/dist/jse/highlight-grammar.js +161 -0
  248. package/dist/jse/highlight-grammar.js.map +1 -0
  249. package/dist/jse/highlight-grammars.generated.d.ts +2 -0
  250. package/dist/jse/highlight-grammars.generated.d.ts.map +1 -0
  251. package/dist/jse/highlight-grammars.generated.js +4 -0
  252. package/dist/jse/highlight-grammars.generated.js.map +1 -0
  253. package/dist/jse/highlight.d.ts +37 -0
  254. package/dist/jse/highlight.d.ts.map +1 -0
  255. package/dist/jse/highlight.js +323 -0
  256. package/dist/jse/highlight.js.map +1 -0
  257. package/dist/jse/jse.d.ts +674 -0
  258. package/dist/jse/jse.d.ts.map +1 -0
  259. package/dist/jse/jse.js +5841 -0
  260. package/dist/jse/jse.js.map +1 -0
  261. package/dist/jse/pathmatch.d.ts +10 -0
  262. package/dist/jse/pathmatch.d.ts.map +1 -0
  263. package/dist/jse/pathmatch.js +73 -0
  264. package/dist/jse/pathmatch.js.map +1 -0
  265. package/dist/jse/regex.d.ts +33 -0
  266. package/dist/jse/regex.d.ts.map +1 -0
  267. package/dist/jse/regex.js +375 -0
  268. package/dist/jse/regex.js.map +1 -0
  269. package/dist/jse/stdlib.d.ts +8 -0
  270. package/dist/jse/stdlib.d.ts.map +1 -0
  271. package/dist/jse/stdlib.js +765 -0
  272. package/dist/jse/stdlib.js.map +1 -0
  273. package/dist/jse/tokens.d.ts +102 -0
  274. package/dist/jse/tokens.d.ts.map +1 -0
  275. package/dist/jse/tokens.js +982 -0
  276. package/dist/jse/tokens.js.map +1 -0
  277. package/dist/jse/values.d.ts +206 -0
  278. package/dist/jse/values.d.ts.map +1 -0
  279. package/dist/jse/values.js +846 -0
  280. package/dist/jse/values.js.map +1 -0
  281. package/dist/keyboard.d.ts +196 -0
  282. package/dist/keyboard.d.ts.map +1 -0
  283. package/dist/keyboard.js +186 -0
  284. package/dist/keyboard.js.map +1 -0
  285. package/dist/label-choices.d.ts +3 -0
  286. package/dist/label-choices.d.ts.map +1 -0
  287. package/dist/label-choices.js +168 -0
  288. package/dist/label-choices.js.map +1 -0
  289. package/dist/language.d.ts +33 -0
  290. package/dist/language.d.ts.map +1 -0
  291. package/dist/language.js +50 -0
  292. package/dist/language.js.map +1 -0
  293. package/dist/length-units.d.ts +30 -0
  294. package/dist/length-units.d.ts.map +1 -0
  295. package/dist/length-units.js +83 -0
  296. package/dist/length-units.js.map +1 -0
  297. package/dist/lightsensor.d.ts +48 -0
  298. package/dist/lightsensor.d.ts.map +1 -0
  299. package/dist/lightsensor.js +97 -0
  300. package/dist/lightsensor.js.map +1 -0
  301. package/dist/link-refresh.d.ts +27 -0
  302. package/dist/link-refresh.d.ts.map +1 -0
  303. package/dist/link-refresh.js +166 -0
  304. package/dist/link-refresh.js.map +1 -0
  305. package/dist/link.d.ts +57 -0
  306. package/dist/link.d.ts.map +1 -0
  307. package/dist/link.js +333 -0
  308. package/dist/link.js.map +1 -0
  309. package/dist/linkpreview.d.ts +114 -0
  310. package/dist/linkpreview.d.ts.map +1 -0
  311. package/dist/linkpreview.js +439 -0
  312. package/dist/linkpreview.js.map +1 -0
  313. package/dist/list-presence.d.ts +32 -0
  314. package/dist/list-presence.d.ts.map +1 -0
  315. package/dist/list-presence.js +48 -0
  316. package/dist/list-presence.js.map +1 -0
  317. package/dist/live-stream.d.ts +27 -0
  318. package/dist/live-stream.d.ts.map +1 -0
  319. package/dist/live-stream.js +274 -0
  320. package/dist/live-stream.js.map +1 -0
  321. package/dist/livelogs.d.ts +134 -0
  322. package/dist/livelogs.d.ts.map +1 -0
  323. package/dist/livelogs.js +409 -0
  324. package/dist/livelogs.js.map +1 -0
  325. package/dist/logs.d.ts +80 -0
  326. package/dist/logs.d.ts.map +1 -0
  327. package/dist/logs.js +206 -0
  328. package/dist/logs.js.map +1 -0
  329. package/dist/mcp/apps.d.ts +82 -0
  330. package/dist/mcp/apps.d.ts.map +1 -0
  331. package/dist/mcp/apps.js +219 -0
  332. package/dist/mcp/apps.js.map +1 -0
  333. package/dist/mcp/entities.d.ts +25 -0
  334. package/dist/mcp/entities.d.ts.map +1 -0
  335. package/dist/mcp/entities.js +71 -0
  336. package/dist/mcp/entities.js.map +1 -0
  337. package/dist/mcp/result.d.ts +73 -0
  338. package/dist/mcp/result.d.ts.map +1 -0
  339. package/dist/mcp/result.js +119 -0
  340. package/dist/mcp/result.js.map +1 -0
  341. package/dist/mcp/webmcp.d.ts +162 -0
  342. package/dist/mcp/webmcp.d.ts.map +1 -0
  343. package/dist/mcp/webmcp.js +214 -0
  344. package/dist/mcp/webmcp.js.map +1 -0
  345. package/dist/mcp.d.ts +5 -0
  346. package/dist/mcp.d.ts.map +1 -0
  347. package/dist/mcp.js +14 -0
  348. package/dist/mcp.js.map +1 -0
  349. package/dist/media-core.d.ts +191 -0
  350. package/dist/media-core.d.ts.map +1 -0
  351. package/dist/media-core.js +446 -0
  352. package/dist/media-core.js.map +1 -0
  353. package/dist/media-timeline-core.d.ts +94 -0
  354. package/dist/media-timeline-core.d.ts.map +1 -0
  355. package/dist/media-timeline-core.js +620 -0
  356. package/dist/media-timeline-core.js.map +1 -0
  357. package/dist/message.d.ts +42 -0
  358. package/dist/message.d.ts.map +1 -0
  359. package/dist/message.js +582 -0
  360. package/dist/message.js.map +1 -0
  361. package/dist/missing-element.d.ts +29 -0
  362. package/dist/missing-element.d.ts.map +1 -0
  363. package/dist/missing-element.js +76 -0
  364. package/dist/missing-element.js.map +1 -0
  365. package/dist/motion-core.d.ts +160 -0
  366. package/dist/motion-core.d.ts.map +1 -0
  367. package/dist/motion-core.js +752 -0
  368. package/dist/motion-core.js.map +1 -0
  369. package/dist/motion-pose.d.ts +65 -0
  370. package/dist/motion-pose.d.ts.map +1 -0
  371. package/dist/motion-pose.js +143 -0
  372. package/dist/motion-pose.js.map +1 -0
  373. package/dist/motion.d.ts +132 -0
  374. package/dist/motion.d.ts.map +1 -0
  375. package/dist/motion.js +260 -0
  376. package/dist/motion.js.map +1 -0
  377. package/dist/mount-core.d.ts +203 -0
  378. package/dist/mount-core.d.ts.map +1 -0
  379. package/dist/mount-core.js +437 -0
  380. package/dist/mount-core.js.map +1 -0
  381. package/dist/net-core.d.ts +110 -0
  382. package/dist/net-core.d.ts.map +1 -0
  383. package/dist/net-core.js +225 -0
  384. package/dist/net-core.js.map +1 -0
  385. package/dist/notify.d.ts +399 -0
  386. package/dist/notify.d.ts.map +1 -0
  387. package/dist/notify.js +964 -0
  388. package/dist/notify.js.map +1 -0
  389. package/dist/orientation-binding.d.ts +39 -0
  390. package/dist/orientation-binding.d.ts.map +1 -0
  391. package/dist/orientation-binding.js +64 -0
  392. package/dist/orientation-binding.js.map +1 -0
  393. package/dist/orientation.d.ts +55 -0
  394. package/dist/orientation.d.ts.map +1 -0
  395. package/dist/orientation.js +89 -0
  396. package/dist/orientation.js.map +1 -0
  397. package/dist/ota.d.ts +52 -0
  398. package/dist/ota.d.ts.map +1 -0
  399. package/dist/ota.js +122 -0
  400. package/dist/ota.js.map +1 -0
  401. package/dist/passkeys.d.ts +91 -0
  402. package/dist/passkeys.d.ts.map +1 -0
  403. package/dist/passkeys.js +307 -0
  404. package/dist/passkeys.js.map +1 -0
  405. package/dist/payment.d.ts +85 -0
  406. package/dist/payment.d.ts.map +1 -0
  407. package/dist/payment.js +270 -0
  408. package/dist/payment.js.map +1 -0
  409. package/dist/pending-presenter.d.ts +31 -0
  410. package/dist/pending-presenter.d.ts.map +1 -0
  411. package/dist/pending-presenter.js +119 -0
  412. package/dist/pending-presenter.js.map +1 -0
  413. package/dist/permission-core.d.ts +59 -0
  414. package/dist/permission-core.d.ts.map +1 -0
  415. package/dist/permission-core.js +102 -0
  416. package/dist/permission-core.js.map +1 -0
  417. package/dist/persist.d.ts +169 -0
  418. package/dist/persist.d.ts.map +1 -0
  419. package/dist/persist.js +361 -0
  420. package/dist/persist.js.map +1 -0
  421. package/dist/phase-plan.d.ts +114 -0
  422. package/dist/phase-plan.d.ts.map +1 -0
  423. package/dist/phase-plan.js +837 -0
  424. package/dist/phase-plan.js.map +1 -0
  425. package/dist/playback-core.d.ts +64 -0
  426. package/dist/playback-core.d.ts.map +1 -0
  427. package/dist/playback-core.js +176 -0
  428. package/dist/playback-core.js.map +1 -0
  429. package/dist/player-sources.d.ts +12 -0
  430. package/dist/player-sources.d.ts.map +1 -0
  431. package/dist/player-sources.js +44 -0
  432. package/dist/player-sources.js.map +1 -0
  433. package/dist/proxy-denylist.d.ts +11 -0
  434. package/dist/proxy-denylist.d.ts.map +1 -0
  435. package/dist/proxy-denylist.js +44 -0
  436. package/dist/proxy-denylist.js.map +1 -0
  437. package/dist/public-config.d.ts +20 -0
  438. package/dist/public-config.d.ts.map +1 -0
  439. package/dist/public-config.js +109 -0
  440. package/dist/public-config.js.map +1 -0
  441. package/dist/qoe-core.d.ts +72 -0
  442. package/dist/qoe-core.d.ts.map +1 -0
  443. package/dist/qoe-core.js +113 -0
  444. package/dist/qoe-core.js.map +1 -0
  445. package/dist/reactive-request.d.ts +80 -0
  446. package/dist/reactive-request.d.ts.map +1 -0
  447. package/dist/reactive-request.js +192 -0
  448. package/dist/reactive-request.js.map +1 -0
  449. package/dist/read-cache.d.ts +129 -0
  450. package/dist/read-cache.d.ts.map +1 -0
  451. package/dist/read-cache.js +566 -0
  452. package/dist/read-cache.js.map +1 -0
  453. package/dist/recorder-core.d.ts +57 -0
  454. package/dist/recorder-core.d.ts.map +1 -0
  455. package/dist/recorder-core.js +136 -0
  456. package/dist/recorder-core.js.map +1 -0
  457. package/dist/ref.d.ts +41 -0
  458. package/dist/ref.d.ts.map +1 -0
  459. package/dist/ref.js +98 -0
  460. package/dist/ref.js.map +1 -0
  461. package/dist/refusal.d.ts +82 -0
  462. package/dist/refusal.d.ts.map +1 -0
  463. package/dist/refusal.js +218 -0
  464. package/dist/refusal.js.map +1 -0
  465. package/dist/region-insets.d.ts +61 -0
  466. package/dist/region-insets.d.ts.map +1 -0
  467. package/dist/region-insets.js +67 -0
  468. package/dist/region-insets.js.map +1 -0
  469. package/dist/rive-core.d.ts +323 -0
  470. package/dist/rive-core.d.ts.map +1 -0
  471. package/dist/rive-core.js +677 -0
  472. package/dist/rive-core.js.map +1 -0
  473. package/dist/runner.d.ts +595 -0
  474. package/dist/runner.d.ts.map +1 -0
  475. package/dist/runner.js +4094 -0
  476. package/dist/runner.js.map +1 -0
  477. package/dist/scene/a11y.d.ts +11 -0
  478. package/dist/scene/a11y.d.ts.map +1 -0
  479. package/dist/scene/a11y.js +67 -0
  480. package/dist/scene/a11y.js.map +1 -0
  481. package/dist/scene/anim.d.ts +149 -0
  482. package/dist/scene/anim.d.ts.map +1 -0
  483. package/dist/scene/anim.js +396 -0
  484. package/dist/scene/anim.js.map +1 -0
  485. package/dist/scene/bind.d.ts +33 -0
  486. package/dist/scene/bind.d.ts.map +1 -0
  487. package/dist/scene/bind.js +66 -0
  488. package/dist/scene/bind.js.map +1 -0
  489. package/dist/scene/collide.d.ts +56 -0
  490. package/dist/scene/collide.d.ts.map +1 -0
  491. package/dist/scene/collide.js +146 -0
  492. package/dist/scene/collide.js.map +1 -0
  493. package/dist/scene/frame.d.ts +22 -0
  494. package/dist/scene/frame.d.ts.map +1 -0
  495. package/dist/scene/frame.js +57 -0
  496. package/dist/scene/frame.js.map +1 -0
  497. package/dist/scene/gltf.d.ts +79 -0
  498. package/dist/scene/gltf.d.ts.map +1 -0
  499. package/dist/scene/gltf.js +409 -0
  500. package/dist/scene/gltf.js.map +1 -0
  501. package/dist/scene/ir.d.ts +293 -0
  502. package/dist/scene/ir.d.ts.map +1 -0
  503. package/dist/scene/ir.js +692 -0
  504. package/dist/scene/ir.js.map +1 -0
  505. package/dist/scene/math.d.ts +50 -0
  506. package/dist/scene/math.d.ts.map +1 -0
  507. package/dist/scene/math.js +180 -0
  508. package/dist/scene/math.js.map +1 -0
  509. package/dist/scene/orbit.d.ts +19 -0
  510. package/dist/scene/orbit.d.ts.map +1 -0
  511. package/dist/scene/orbit.js +60 -0
  512. package/dist/scene/orbit.js.map +1 -0
  513. package/dist/scene/physics.d.ts +228 -0
  514. package/dist/scene/physics.d.ts.map +1 -0
  515. package/dist/scene/physics.js +1500 -0
  516. package/dist/scene/physics.js.map +1 -0
  517. package/dist/scene/registry.d.ts +85 -0
  518. package/dist/scene/registry.d.ts.map +1 -0
  519. package/dist/scene/registry.js +75 -0
  520. package/dist/scene/registry.js.map +1 -0
  521. package/dist/scene/skin.d.ts +82 -0
  522. package/dist/scene/skin.d.ts.map +1 -0
  523. package/dist/scene/skin.js +351 -0
  524. package/dist/scene/skin.js.map +1 -0
  525. package/dist/scene/sprite.d.ts +36 -0
  526. package/dist/scene/sprite.d.ts.map +1 -0
  527. package/dist/scene/sprite.js +107 -0
  528. package/dist/scene/sprite.js.map +1 -0
  529. package/dist/scene/viewer.d.ts +96 -0
  530. package/dist/scene/viewer.d.ts.map +1 -0
  531. package/dist/scene/viewer.js +235 -0
  532. package/dist/scene/viewer.js.map +1 -0
  533. package/dist/scoped-slots.d.ts +9 -0
  534. package/dist/scoped-slots.d.ts.map +1 -0
  535. package/dist/scoped-slots.js +42 -0
  536. package/dist/scoped-slots.js.map +1 -0
  537. package/dist/screen.d.ts +109 -0
  538. package/dist/screen.d.ts.map +1 -0
  539. package/dist/screen.js +309 -0
  540. package/dist/screen.js.map +1 -0
  541. package/dist/scroll.d.ts +525 -0
  542. package/dist/scroll.d.ts.map +1 -0
  543. package/dist/scroll.js +1226 -0
  544. package/dist/scroll.js.map +1 -0
  545. package/dist/settings-plane.d.ts +58 -0
  546. package/dist/settings-plane.d.ts.map +1 -0
  547. package/dist/settings-plane.js +86 -0
  548. package/dist/settings-plane.js.map +1 -0
  549. package/dist/share-inbox.d.ts +56 -0
  550. package/dist/share-inbox.d.ts.map +1 -0
  551. package/dist/share-inbox.js +114 -0
  552. package/dist/share-inbox.js.map +1 -0
  553. package/dist/shared-transition.d.ts +152 -0
  554. package/dist/shared-transition.d.ts.map +1 -0
  555. package/dist/shared-transition.js +257 -0
  556. package/dist/shared-transition.js.map +1 -0
  557. package/dist/sheet-content-padding.d.ts +24 -0
  558. package/dist/sheet-content-padding.d.ts.map +1 -0
  559. package/dist/sheet-content-padding.js +32 -0
  560. package/dist/sheet-content-padding.js.map +1 -0
  561. package/dist/shot-devices.d.ts +36 -0
  562. package/dist/shot-devices.d.ts.map +1 -0
  563. package/dist/shot-devices.js +90 -0
  564. package/dist/shot-devices.js.map +1 -0
  565. package/dist/shot-guards.d.ts +100 -0
  566. package/dist/shot-guards.d.ts.map +1 -0
  567. package/dist/shot-guards.js +260 -0
  568. package/dist/shot-guards.js.map +1 -0
  569. package/dist/shot-scope.d.ts +140 -0
  570. package/dist/shot-scope.d.ts.map +1 -0
  571. package/dist/shot-scope.js +302 -0
  572. package/dist/shot-scope.js.map +1 -0
  573. package/dist/slot-partition.d.ts +9 -0
  574. package/dist/slot-partition.d.ts.map +1 -0
  575. package/dist/slot-partition.js +38 -0
  576. package/dist/slot-partition.js.map +1 -0
  577. package/dist/snackbar.d.ts +165 -0
  578. package/dist/snackbar.d.ts.map +1 -0
  579. package/dist/snackbar.js +220 -0
  580. package/dist/snackbar.js.map +1 -0
  581. package/dist/socket.d.ts +96 -0
  582. package/dist/socket.d.ts.map +1 -0
  583. package/dist/socket.js +370 -0
  584. package/dist/socket.js.map +1 -0
  585. package/dist/spotlight.d.ts +77 -0
  586. package/dist/spotlight.d.ts.map +1 -0
  587. package/dist/spotlight.js +174 -0
  588. package/dist/spotlight.js.map +1 -0
  589. package/dist/state-primitive.d.ts +37 -0
  590. package/dist/state-primitive.d.ts.map +1 -0
  591. package/dist/state-primitive.js +91 -0
  592. package/dist/state-primitive.js.map +1 -0
  593. package/dist/store-query.d.ts +25 -0
  594. package/dist/store-query.d.ts.map +1 -0
  595. package/dist/store-query.js +88 -0
  596. package/dist/store-query.js.map +1 -0
  597. package/dist/store-value.d.ts +48 -0
  598. package/dist/store-value.d.ts.map +1 -0
  599. package/dist/store-value.js +264 -0
  600. package/dist/store-value.js.map +1 -0
  601. package/dist/store-versioning.d.ts +70 -0
  602. package/dist/store-versioning.d.ts.map +1 -0
  603. package/dist/store-versioning.js +188 -0
  604. package/dist/store-versioning.js.map +1 -0
  605. package/dist/store.d.ts +282 -0
  606. package/dist/store.d.ts.map +1 -0
  607. package/dist/store.js +1144 -0
  608. package/dist/store.js.map +1 -0
  609. package/dist/strings.d.ts +141 -0
  610. package/dist/strings.d.ts.map +1 -0
  611. package/dist/strings.js +581 -0
  612. package/dist/strings.js.map +1 -0
  613. package/dist/telemetry.d.ts +95 -0
  614. package/dist/telemetry.d.ts.map +1 -0
  615. package/dist/telemetry.js +255 -0
  616. package/dist/telemetry.js.map +1 -0
  617. package/dist/transform-core.d.ts +228 -0
  618. package/dist/transform-core.d.ts.map +1 -0
  619. package/dist/transform-core.js +921 -0
  620. package/dist/transform-core.js.map +1 -0
  621. package/dist/transition-core.d.ts +58 -0
  622. package/dist/transition-core.d.ts.map +1 -0
  623. package/dist/transition-core.js +352 -0
  624. package/dist/transition-core.js.map +1 -0
  625. package/dist/trim-trailing.d.ts +3 -0
  626. package/dist/trim-trailing.d.ts.map +1 -0
  627. package/dist/trim-trailing.js +14 -0
  628. package/dist/trim-trailing.js.map +1 -0
  629. package/dist/upload.d.ts +51 -0
  630. package/dist/upload.d.ts.map +1 -0
  631. package/dist/upload.js +68 -0
  632. package/dist/upload.js.map +1 -0
  633. package/dist/vendor-face.d.ts +44 -0
  634. package/dist/vendor-face.d.ts.map +1 -0
  635. package/dist/vendor-face.js +80 -0
  636. package/dist/vendor-face.js.map +1 -0
  637. package/dist/vendor-session.d.ts +166 -0
  638. package/dist/vendor-session.d.ts.map +1 -0
  639. package/dist/vendor-session.js +423 -0
  640. package/dist/vendor-session.js.map +1 -0
  641. package/dist/vendor-surface.d.ts +290 -0
  642. package/dist/vendor-surface.d.ts.map +1 -0
  643. package/dist/vendor-surface.js +439 -0
  644. package/dist/vendor-surface.js.map +1 -0
  645. package/dist/version-rules.generated.d.ts +17 -0
  646. package/dist/version-rules.generated.d.ts.map +1 -0
  647. package/dist/version-rules.generated.js +99 -0
  648. package/dist/version-rules.generated.js.map +1 -0
  649. package/dist/view-transition-core.d.ts +99 -0
  650. package/dist/view-transition-core.d.ts.map +1 -0
  651. package/dist/view-transition-core.js +127 -0
  652. package/dist/view-transition-core.js.map +1 -0
  653. package/dist/view-transition-door.d.ts +26 -0
  654. package/dist/view-transition-door.d.ts.map +1 -0
  655. package/dist/view-transition-door.js +88 -0
  656. package/dist/view-transition-door.js.map +1 -0
  657. package/dist/window-identity.d.ts +3 -0
  658. package/dist/window-identity.d.ts.map +1 -0
  659. package/dist/window-identity.js +27 -0
  660. package/dist/window-identity.js.map +1 -0
  661. package/package.json +139 -4
@@ -0,0 +1,618 @@
1
+ //
2
+ // image-core.ts — the `<image>` PURE CORE (U05). Everything the three renderers must agree
3
+ // on before a single pixel is drawn: the contentFit x contentPosition geometry solver, the
4
+ // cache-policy ladder (with the legacy binary `cache` folded in), the transition gate, the
5
+ // decode-at-display-size ladder, placeholder classification, the recycling identity, and the
6
+ // blurhash / thumbhash decoders.
7
+ //
8
+ // The law is the corpus, OpenSource/Conformance/image/resolution.json
9
+ // (parity/U05-image.md); the Kotlin twin is :core ImageCore.kt and the Swift twin is
10
+ // Engine/Swift/ImageCore.swift. Everything platform-shaped lives OUTSIDE this file — the actual
11
+ // network fetch, the NSCache/LruCache, ImageIO/BitmapFactory, `<img>` — because keeping the
12
+ // DECISION separate from the PLUMBING is what lets one corpus judge three renderers.
13
+ //
14
+ // The two hash decoders are re-implementations of the published BlurHash (Wolt, MIT) and
15
+ // ThumbHash (Evan Wallace, MIT) formats. Nothing is vendored: this file is original code that
16
+ // reads the same bytes, cross-checked against the reference algorithms and then pinned to
17
+ // exact RGBA in the corpus, because a placeholder that differs per platform is worse than no
18
+ // placeholder at all.
19
+ //
20
+ import { trimTrailing } from "./trim-trailing.js";
21
+ export const CONTENT_FITS = ["cover", "contain", "fill", "none", "scaleDown"];
22
+ export const CACHE_POLICIES = ["memory", "disk", "memoryDisk", "none"];
23
+ export const IMAGE_PRIORITIES = ["low", "normal", "high"];
24
+ export const TRANSITION_EFFECTS = [
25
+ "none", "crossDissolve", "flipFromLeft", "flipFromRight",
26
+ "flipFromTop", "flipFromBottom", "curlUp", "curlDown",
27
+ ];
28
+ export const CONTENT_FIT_DEFAULT = "cover";
29
+ export const CONTENT_POSITION_DEFAULT = "center";
30
+ export const CACHE_POLICY_DEFAULT = "memoryDisk";
31
+ export const TRANSITION_DURATION_DEFAULT = 200;
32
+ /** The named anchors, as fractions of the free space. Twin of the Kotlin/Swift tables. */
33
+ export const POSITION_ANCHORS = {
34
+ center: { x: 0.5, y: 0.5 },
35
+ top: { x: 0.5, y: 0 },
36
+ bottom: { x: 0.5, y: 1 },
37
+ leading: { x: 0, y: 0.5 },
38
+ left: { x: 0, y: 0.5 },
39
+ trailing: { x: 1, y: 0.5 },
40
+ right: { x: 1, y: 0.5 },
41
+ topLeading: { x: 0, y: 0 },
42
+ topTrailing: { x: 1, y: 0 },
43
+ bottomLeading: { x: 0, y: 1 },
44
+ bottomTrailing: { x: 1, y: 1 },
45
+ };
46
+ /** Unknown word folds to `cover` — an image is never not drawn because a token was misspelled. */
47
+ export function resolveContentFit(fit) {
48
+ const word = (fit ?? "").trim();
49
+ return CONTENT_FITS.includes(word) ? word : CONTENT_FIT_DEFAULT;
50
+ }
51
+ function clamp01(value) {
52
+ return value < 0 ? 0 : value > 1 ? 1 : value;
53
+ }
54
+ const HORIZONTAL_KEYWORDS = ["left", "right", "leading", "trailing"];
55
+ const VERTICAL_KEYWORDS = ["top", "bottom"];
56
+ const HORIZONTAL_KEYWORD_FRACTIONS = { left: 0, leading: 0, center: 0.5, right: 1, trailing: 1 };
57
+ const VERTICAL_KEYWORD_FRACTIONS = { top: 0, center: 0.5, bottom: 1 };
58
+ function positionScalar(token, keywords = {}) {
59
+ const text = token.trim();
60
+ if (text === "")
61
+ return null;
62
+ if (Object.prototype.hasOwnProperty.call(keywords, text))
63
+ return keywords[text];
64
+ if (text.endsWith("%")) {
65
+ const percent = Number(text.slice(0, -1));
66
+ return Number.isFinite(percent) ? clamp01(percent / 100) : null;
67
+ }
68
+ const value = Number(text);
69
+ return Number.isFinite(value) ? clamp01(value) : null;
70
+ }
71
+ /**
72
+ * `contentPosition` → the anchor fractions the drawn rect is placed at. A named anchor, or an
73
+ * `x y` pair in percentages or 0…1 fractions. Anything unparseable is `center`, because an
74
+ * off-screen image is a worse failure than a mis-anchored one.
75
+ */
76
+ export function resolveContentPosition(position) {
77
+ const text = (position ?? "").trim();
78
+ if (text === "")
79
+ return { x: 0.5, y: 0.5 };
80
+ const anchor = POSITION_ANCHORS[text];
81
+ if (anchor)
82
+ return { x: anchor.x, y: anchor.y };
83
+ const parts = text.replace(/,/g, " ").split(" ").filter((part) => part !== "");
84
+ if (parts.length === 1) {
85
+ const only = positionScalar(parts[0]);
86
+ return only === null ? { x: 0.5, y: 0.5 } : { x: only, y: 0.5 };
87
+ }
88
+ if (parts.length >= 2) {
89
+ // CSS `object-position` (Images 3): the two keywords may come in either order (`top left`), a keyword may sit
90
+ // beside a percentage (`left 25%`); a length offset has no fraction and folds to the centre (a named degradation).
91
+ let first = parts[0];
92
+ let second = parts[1];
93
+ if (VERTICAL_KEYWORDS.includes(first) || HORIZONTAL_KEYWORDS.includes(second))
94
+ [first, second] = [second, first];
95
+ const x = positionScalar(first, HORIZONTAL_KEYWORD_FRACTIONS);
96
+ const y = positionScalar(second, VERTICAL_KEYWORD_FRACTIONS);
97
+ if (x === null || y === null)
98
+ return { x: 0.5, y: 0.5 };
99
+ return { x, y };
100
+ }
101
+ return { x: 0.5, y: 0.5 };
102
+ }
103
+ /**
104
+ * THE GEOMETRY SOLVER. Given the source and the container, what rect is drawn?
105
+ *
106
+ * A negative x/y is the crop offset `cover` needs — the same sign convention CSS
107
+ * `object-position` uses, so the web mapping is an identity and the two natives translate one
108
+ * subtraction. Any non-positive dimension yields the empty rect rather than a NaN that
109
+ * propagates into a layout pass.
110
+ */
111
+ export function solveImageRect(fit, position, source, container) {
112
+ const mode = resolveContentFit(fit);
113
+ const sw = source.width, sh = source.height, cw = container.width, ch = container.height;
114
+ if (!(sw > 0) || !(sh > 0) || !(cw > 0) || !(ch > 0)) {
115
+ return { x: 0, y: 0, width: 0, height: 0, scale: 0 };
116
+ }
117
+ let drawnWidth, drawnHeight;
118
+ if (mode === "fill") {
119
+ drawnWidth = cw;
120
+ drawnHeight = ch;
121
+ }
122
+ else {
123
+ let factor;
124
+ if (mode === "cover")
125
+ factor = Math.max(cw / sw, ch / sh);
126
+ else if (mode === "contain")
127
+ factor = Math.min(cw / sw, ch / sh);
128
+ else if (mode === "none")
129
+ factor = 1;
130
+ else
131
+ factor = Math.min(1, Math.min(cw / sw, ch / sh));
132
+ drawnWidth = sw * factor;
133
+ drawnHeight = sh * factor;
134
+ }
135
+ const anchor = resolveContentPosition(position);
136
+ return {
137
+ x: (cw - drawnWidth) * anchor.x,
138
+ y: (ch - drawnHeight) * anchor.y,
139
+ width: drawnWidth,
140
+ height: drawnHeight,
141
+ scale: mode === "fill" ? 0 : drawnWidth / sw,
142
+ };
143
+ }
144
+ /**
145
+ * The cache-policy ladder. `cachePolicy` wins when it names one of the four words; otherwise
146
+ * the legacy binary `cache` decides, so every app written against `cache="none"` keeps its
147
+ * behaviour byte for byte. An unrecognised `cachePolicy` falls through to the legacy read
148
+ * rather than disabling caching, because a typo must never turn a feed into a download loop.
149
+ */
150
+ export function resolveCachePolicy(cachePolicy, cache) {
151
+ const word = (cachePolicy ?? "").trim();
152
+ let policy;
153
+ if (CACHE_POLICIES.includes(word))
154
+ policy = word;
155
+ else
156
+ policy = (cache ?? "").trim() === "none" ? "none" : CACHE_POLICY_DEFAULT;
157
+ return {
158
+ policy,
159
+ memory: policy === "memory" || policy === "memoryDisk",
160
+ disk: policy === "disk" || policy === "memoryDisk",
161
+ revalidate: policy === "none",
162
+ };
163
+ }
164
+ /** What `on:load` reports, given where the bytes were actually found. */
165
+ export function cacheTypeFor(policy, found) {
166
+ if (policy.memory && found.memory === true)
167
+ return "memory";
168
+ if (policy.disk && found.disk === true)
169
+ return "disk";
170
+ return "none";
171
+ }
172
+ export function resolveTransition(spec) {
173
+ if (spec === null || spec === undefined) {
174
+ return { duration: TRANSITION_DURATION_DEFAULT, effect: "crossDissolve" };
175
+ }
176
+ if (typeof spec === "number")
177
+ return fromDuration(spec, "crossDissolve");
178
+ if (typeof spec === "object") {
179
+ const raw = spec;
180
+ const duration = typeof raw.duration === "number" && Number.isFinite(raw.duration)
181
+ ? Math.max(0, Math.trunc(raw.duration))
182
+ : TRANSITION_DURATION_DEFAULT;
183
+ const word = typeof raw.effect === "string" ? raw.effect.trim() : "crossDissolve";
184
+ const effect = TRANSITION_EFFECTS.includes(word)
185
+ ? word
186
+ : "crossDissolve";
187
+ return normalise(duration, effect);
188
+ }
189
+ const text = String(spec).trim();
190
+ if (text === "")
191
+ return { duration: TRANSITION_DURATION_DEFAULT, effect: "crossDissolve" };
192
+ if (TRANSITION_EFFECTS.includes(text)) {
193
+ return normalise(text === "none" ? 0 : TRANSITION_DURATION_DEFAULT, text);
194
+ }
195
+ const numeric = Number(text);
196
+ if (Number.isFinite(numeric))
197
+ return fromDuration(numeric, "crossDissolve");
198
+ return { duration: TRANSITION_DURATION_DEFAULT, effect: "crossDissolve" };
199
+ }
200
+ function fromDuration(value, effect) {
201
+ return normalise(Math.max(0, Math.trunc(value)), effect);
202
+ }
203
+ /** Zero duration and `none` are the same statement; keep them from disagreeing. */
204
+ function normalise(duration, effect) {
205
+ if (duration === 0 || effect === "none")
206
+ return { duration: 0, effect: "none" };
207
+ return { duration, effect };
208
+ }
209
+ /**
210
+ * THE RULE THAT MAKES A FAST APP LOOK FAST: an image already decoded in memory appears in the
211
+ * same frame, with no fade. Fading in something that was instantly available is the tell that
212
+ * an app is doing theatre instead of work.
213
+ */
214
+ export function shouldTransition(transition, cacheType) {
215
+ return transition.duration > 0 && transition.effect !== "none" && cacheType !== "memory";
216
+ }
217
+ /**
218
+ * `allowDownscaling` — decode at display size, the single biggest memory win in list-heavy
219
+ * apps. A 4000 px hero in a 48 pt avatar decodes at 96 px on a @2x screen: 64 KB instead of
220
+ * 64 MB. Never upscales (a factor above 1 is clamped), and an unknown display size decodes at
221
+ * source rather than guessing.
222
+ */
223
+ export function resolveDecodeSize(args) {
224
+ const sw = args.source.width, sh = args.source.height;
225
+ if (!(sw > 0) || !(sh > 0))
226
+ return { width: 0, height: 0, downscaled: false };
227
+ const allow = args.allowDownscaling !== false;
228
+ const density = args.scale ?? 1;
229
+ const dw = args.display.width, dh = args.display.height;
230
+ if (!allow || !(dw > 0) || !(dh > 0) || !(density > 0)) {
231
+ return { width: sw, height: sh, downscaled: false };
232
+ }
233
+ const targetWidth = dw * density, targetHeight = dh * density;
234
+ const mode = resolveContentFit(args.fit);
235
+ let required;
236
+ if (mode === "cover" || mode === "fill")
237
+ required = Math.max(targetWidth / sw, targetHeight / sh);
238
+ else if (mode === "none")
239
+ required = 1;
240
+ else
241
+ required = Math.min(targetWidth / sw, targetHeight / sh);
242
+ const factor = Math.min(1, required);
243
+ const width = Math.max(1, Math.round(sw * factor));
244
+ const height = Math.max(1, Math.round(sh * factor));
245
+ return { width, height, downscaled: width < sw || height < sh };
246
+ }
247
+ const BASE83 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~";
248
+ const BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
249
+ /** The semantic colour words `placeholder` may name. Hexes and `rgb(a)()` are recognised by shape. */
250
+ export const PLACEHOLDER_COLOR_TOKENS = [
251
+ "accent", "label", "separator", "white", "black", "clear", "transparent",
252
+ "background", "secondaryLabel", "tertiaryLabel", "systemFill",
253
+ ];
254
+ /** A blurhash carries its own component count, so the length check is exact — not a heuristic. */
255
+ export function isBlurhash(text) {
256
+ if (text.length < 6)
257
+ return false;
258
+ for (const character of text)
259
+ if (!BASE83.includes(character))
260
+ return false;
261
+ const flag = BASE83.indexOf(text[0]);
262
+ const numY = Math.floor(flag / 9) + 1;
263
+ const numX = (flag % 9) + 1;
264
+ return text.length === 4 + 2 * numX * numY;
265
+ }
266
+ /** Byte length of a well-formed base64 payload, or -1. Used to tell a thumbhash from an asset name. */
267
+ export function base64ByteLength(text) {
268
+ if (text.length < 8 || text.length % 4 !== 0)
269
+ return -1;
270
+ const body = trimTrailing(text, "=");
271
+ if (text.length - body.length > 2)
272
+ return -1;
273
+ for (const character of body)
274
+ if (!BASE64.includes(character))
275
+ return -1;
276
+ return Math.floor((body.length * 3) / 4);
277
+ }
278
+ /**
279
+ * `placeholder` is one attribute carrying four different things, so the classification has to
280
+ * be deterministic rather than clever: an explicit `blurhash:` / `thumbhash:` prefix always
281
+ * wins, then colour by shape, then a blurhash by its self-describing length, then a thumbhash
282
+ * by being well-formed base64 of at least the 5-byte header, and an asset name otherwise.
283
+ */
284
+ export function classifyPlaceholder(value) {
285
+ const text = (value ?? "").trim();
286
+ if (text === "")
287
+ return { kind: "none", value: "" };
288
+ if (text.startsWith("blurhash:"))
289
+ return { kind: "blurhash", value: text.slice(9) };
290
+ if (text.startsWith("thumbhash:"))
291
+ return { kind: "thumbhash", value: text.slice(10) };
292
+ if (text.startsWith("#") || text.startsWith("rgb(") || text.startsWith("rgba(")
293
+ || PLACEHOLDER_COLOR_TOKENS.includes(text)) {
294
+ return { kind: "color", value: text };
295
+ }
296
+ if (isBlurhash(text))
297
+ return { kind: "blurhash", value: text };
298
+ if (base64ByteLength(text) >= 5)
299
+ return { kind: "thumbhash", value: text };
300
+ return { kind: "asset", value: text };
301
+ }
302
+ /**
303
+ * `recyclingKey` — the fix for the bug every list in every app has: row A shows image 1, the
304
+ * row is reused for item 47, and image 1 stays on screen under item 47's text until the new
305
+ * bytes land. The identity ladder is author key → the list's row key (set automatically, so
306
+ * the correct behaviour is the default) → src → asset.
307
+ */
308
+ export function resolveRecycling(args) {
309
+ const candidates = [args.recyclingKey, args.rowKey, args.src, args.asset];
310
+ let key = "";
311
+ for (const candidate of candidates) {
312
+ const text = (candidate ?? "").trim();
313
+ if (text !== "") {
314
+ key = text;
315
+ break;
316
+ }
317
+ }
318
+ return { key, clear: key !== (args.previousKey ?? "").trim() };
319
+ }
320
+ function srgbToLinear(component) {
321
+ const value = component / 255;
322
+ return value <= 0.04045 ? value / 12.92 : Math.pow((value + 0.055) / 1.055, 2.4);
323
+ }
324
+ function linearToSrgb(value) {
325
+ const clamped = value < 0 ? 0 : value > 1 ? 1 : value;
326
+ return clamped <= 0.0031308
327
+ ? Math.trunc(clamped * 12.92 * 255 + 0.5)
328
+ : Math.trunc((1.055 * Math.pow(clamped, 1 / 2.4) - 0.055) * 255 + 0.5);
329
+ }
330
+ function signedPow(value, exponent) {
331
+ return (value < 0 ? -1 : 1) * Math.pow(Math.abs(value), exponent);
332
+ }
333
+ function decode83(text) {
334
+ let value = 0;
335
+ for (const character of text) {
336
+ const digit = BASE83.indexOf(character);
337
+ if (digit < 0)
338
+ return -1;
339
+ value = value * 83 + digit;
340
+ }
341
+ return value;
342
+ }
343
+ /**
344
+ * Decode a BlurHash to RGBA at an arbitrary size. Returns null for a malformed hash rather
345
+ * than throwing: a bad placeholder must degrade to no placeholder, never to a crashed row.
346
+ */
347
+ export function decodeBlurhash(hash, width, height, punch = 1) {
348
+ if (!isBlurhash(hash) || !(width > 0) || !(height > 0))
349
+ return null;
350
+ const flag = decode83(hash[0]);
351
+ const numY = Math.floor(flag / 9) + 1;
352
+ const numX = (flag % 9) + 1;
353
+ const maximum = ((decode83(hash[1]) + 1) / 166) * punch;
354
+ const colors = new Array(numX * numY);
355
+ const dc = decode83(hash.substring(2, 6));
356
+ colors[0] = [srgbToLinear(dc >> 16), srgbToLinear((dc >> 8) & 255), srgbToLinear(dc & 255)];
357
+ for (let index = 1; index < numX * numY; index++) {
358
+ const value = decode83(hash.substring(4 + index * 2, 6 + index * 2));
359
+ const quantR = Math.floor(value / (19 * 19));
360
+ const quantG = Math.floor(value / 19) % 19;
361
+ const quantB = value % 19;
362
+ colors[index] = [
363
+ signedPow((quantR - 9) / 9, 2) * maximum,
364
+ signedPow((quantG - 9) / 9, 2) * maximum,
365
+ signedPow((quantB - 9) / 9, 2) * maximum,
366
+ ];
367
+ }
368
+ const rgba = new Uint8ClampedArray(width * height * 4);
369
+ const stride = width * 4;
370
+ for (let y = 0; y < height; y++) {
371
+ for (let x = 0; x < width; x++) {
372
+ let red = 0, green = 0, blue = 0;
373
+ for (let j = 0; j < numY; j++) {
374
+ const basisY = Math.cos((Math.PI * y * j) / height);
375
+ for (let i = 0; i < numX; i++) {
376
+ const basis = Math.cos((Math.PI * x * i) / width) * basisY;
377
+ const color = colors[i + j * numX];
378
+ red += color[0] * basis;
379
+ green += color[1] * basis;
380
+ blue += color[2] * basis;
381
+ }
382
+ }
383
+ const offset = y * stride + x * 4;
384
+ rgba[offset] = linearToSrgb(red);
385
+ rgba[offset + 1] = linearToSrgb(green);
386
+ rgba[offset + 2] = linearToSrgb(blue);
387
+ rgba[offset + 3] = 255;
388
+ }
389
+ }
390
+ return { width, height, rgba };
391
+ }
392
+ /** Decode standard base64 to bytes without depending on a platform codec. */
393
+ function decodeBase64(text) {
394
+ if (base64ByteLength(text) < 0)
395
+ return null;
396
+ const body = trimTrailing(text, "=");
397
+ const bytes = new Uint8Array(Math.floor((body.length * 3) / 4));
398
+ let accumulator = 0, bits = 0, written = 0;
399
+ for (const character of body) {
400
+ accumulator = (accumulator << 6) | BASE64.indexOf(character);
401
+ bits += 6;
402
+ if (bits >= 8) {
403
+ bits -= 8;
404
+ bytes[written++] = (accumulator >> bits) & 255;
405
+ }
406
+ }
407
+ return bytes;
408
+ }
409
+ /**
410
+ * Decode a ThumbHash to RGBA. Unlike a blurhash the size is not the caller's choice — the hash
411
+ * carries its own aspect ratio and the decode is defined at ≤32 px on the long edge, which is
412
+ * exactly why it is worth the extra bytes over a blurhash: the placeholder has the right shape.
413
+ * `hash` is the base64 transport form (with or without the `thumbhash:` prefix).
414
+ */
415
+ export function decodeThumbhash(hash) {
416
+ const text = hash.startsWith("thumbhash:") ? hash.slice(10) : hash;
417
+ const bytes = decodeBase64(text.trim());
418
+ if (bytes === null || bytes.length < 5)
419
+ return null;
420
+ const header24 = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16);
421
+ const header16 = bytes[3] | (bytes[4] << 8);
422
+ const lDc = (header24 & 63) / 63;
423
+ const pDc = ((header24 >> 6) & 63) / 31.5 - 1;
424
+ const qDc = ((header24 >> 12) & 63) / 31.5 - 1;
425
+ const lScale = ((header24 >> 18) & 31) / 31;
426
+ const hasAlpha = (header24 >> 23) !== 0;
427
+ if (hasAlpha && bytes.length < 6)
428
+ return null;
429
+ const pScale = ((header16 >> 3) & 63) / 63;
430
+ const qScale = ((header16 >> 9) & 63) / 63;
431
+ const isLandscape = (header16 >> 15) !== 0;
432
+ const lx = Math.max(3, isLandscape ? (hasAlpha ? 5 : 7) : header16 & 7);
433
+ const ly = Math.max(3, isLandscape ? header16 & 7 : hasAlpha ? 5 : 7);
434
+ const aDc = hasAlpha ? (bytes[5] & 15) / 15 : 1;
435
+ const aScale = hasAlpha ? (bytes[5] >> 4) / 15 : 0;
436
+ const acStart = hasAlpha ? 6 : 5;
437
+ let acIndex = 0;
438
+ let overran = false;
439
+ const channel = (nx, ny, scale) => {
440
+ const factors = [];
441
+ for (let cy = 0; cy < ny; cy++) {
442
+ for (let cx = cy === 0 ? 1 : 0; cx * ny < nx * (ny - cy); cx++) {
443
+ const byteIndex = acStart + (acIndex >> 1);
444
+ if (byteIndex >= bytes.length) {
445
+ overran = true;
446
+ factors.push(0);
447
+ acIndex++;
448
+ continue;
449
+ }
450
+ const nibble = (bytes[byteIndex] >> ((acIndex & 1) << 2)) & 15;
451
+ acIndex++;
452
+ factors.push((nibble / 7.5 - 1) * scale);
453
+ }
454
+ }
455
+ return factors;
456
+ };
457
+ const lAc = channel(lx, ly, lScale);
458
+ const pAc = channel(3, 3, pScale * 1.25);
459
+ const qAc = channel(3, 3, qScale * 1.25);
460
+ const aAc = hasAlpha ? channel(5, 5, aScale) : [];
461
+ if (overran)
462
+ return null;
463
+ const ratio = lx / ly;
464
+ const width = Math.round(ratio > 1 ? 32 : 32 * ratio);
465
+ const height = Math.round(ratio > 1 ? 32 / ratio : 32);
466
+ const rgba = new Uint8ClampedArray(width * height * 4);
467
+ const fx = [];
468
+ const fy = [];
469
+ const coefficientsX = Math.max(lx, hasAlpha ? 5 : 3);
470
+ const coefficientsY = Math.max(ly, hasAlpha ? 5 : 3);
471
+ for (let y = 0, offset = 0; y < height; y++) {
472
+ for (let cy = 0; cy < coefficientsY; cy++)
473
+ fy[cy] = Math.cos((Math.PI / height) * (y + 0.5) * cy);
474
+ for (let x = 0; x < width; x++, offset += 4) {
475
+ for (let cx = 0; cx < coefficientsX; cx++)
476
+ fx[cx] = Math.cos((Math.PI / width) * (x + 0.5) * cx);
477
+ let luminance = lDc, chromaP = pDc, chromaQ = qDc, alpha = aDc;
478
+ for (let cy = 0, j = 0; cy < ly; cy++) {
479
+ const doubled = fy[cy] * 2;
480
+ for (let cx = cy === 0 ? 1 : 0; cx * ly < lx * (ly - cy); cx++, j++) {
481
+ luminance += lAc[j] * fx[cx] * doubled;
482
+ }
483
+ }
484
+ for (let cy = 0, j = 0; cy < 3; cy++) {
485
+ const doubled = fy[cy] * 2;
486
+ for (let cx = cy === 0 ? 1 : 0; cx < 3 - cy; cx++, j++) {
487
+ const basis = fx[cx] * doubled;
488
+ chromaP += pAc[j] * basis;
489
+ chromaQ += qAc[j] * basis;
490
+ }
491
+ }
492
+ if (hasAlpha) {
493
+ for (let cy = 0, j = 0; cy < 5; cy++) {
494
+ const doubled = fy[cy] * 2;
495
+ for (let cx = cy === 0 ? 1 : 0; cx < 5 - cy; cx++, j++) {
496
+ alpha += aAc[j] * fx[cx] * doubled;
497
+ }
498
+ }
499
+ }
500
+ const blue = luminance - (2 / 3) * chromaP;
501
+ const red = (3 * luminance - blue + chromaQ) / 2;
502
+ const green = red - chromaQ;
503
+ rgba[offset] = Math.max(0, Math.trunc(255 * Math.min(1, red)));
504
+ rgba[offset + 1] = Math.max(0, Math.trunc(255 * Math.min(1, green)));
505
+ rgba[offset + 2] = Math.max(0, Math.trunc(255 * Math.min(1, blue)));
506
+ rgba[offset + 3] = Math.max(0, Math.trunc(255 * Math.min(1, alpha)));
507
+ }
508
+ }
509
+ return { width, height, rgba };
510
+ }
511
+ /** Decode whatever kind of hash `placeholder` turned out to be, at the size the caller wants. */
512
+ export function decodePlaceholder(placeholder, width = 32, height = 32) {
513
+ if (placeholder.kind === "blurhash")
514
+ return decodeBlurhash(placeholder.value, width, height);
515
+ if (placeholder.kind === "thumbhash")
516
+ return decodeThumbhash(placeholder.value);
517
+ return null;
518
+ }
519
+ /** `priority` — unknown words are `normal`, never a silent demotion to `low`. */
520
+ export function resolveImagePriority(priority) {
521
+ const word = (priority ?? "").trim();
522
+ return IMAGE_PRIORITIES.includes(word) ? word : "normal";
523
+ }
524
+ /** At most this many candidates are read from one list. A longer list is an authoring mistake,
525
+ * and an unbounded loop over an interpolated attribute is a denial of service surface. */
526
+ export const IMAGE_SOURCES_MAX = 16;
527
+ /**
528
+ * Parse `sources=` into candidates, ascending by width.
529
+ *
530
+ * Everything unreadable is DROPPED rather than refused: a malformed entry must not cost the
531
+ * author the image, because `src` is still there to paint. A list that resolves to nothing is
532
+ * the same as no list at all.
533
+ */
534
+ export function parseImageSources(raw) {
535
+ const text = (raw ?? "").trim();
536
+ if (text === "")
537
+ return [];
538
+ const out = [];
539
+ for (const entry of text.split(",")) {
540
+ if (out.length >= IMAGE_SOURCES_MAX)
541
+ break;
542
+ const spec = entry.trim();
543
+ if (spec === "")
544
+ continue;
545
+ const colon = spec.indexOf(":");
546
+ if (colon < 0)
547
+ continue;
548
+ const width = Number(spec.slice(0, colon).trim());
549
+ const url = spec.slice(colon + 1).trim();
550
+ if (!Number.isFinite(width) || width <= 0 || url === "")
551
+ continue;
552
+ out.push({ url, width: Math.trunc(width) });
553
+ }
554
+ // Ascending, so "the narrowest that is wide enough" is the first match of one walk. A stable
555
+ // sort keeps two candidates that declare the same width in the order the author wrote them.
556
+ return out.sort((a, b) => a.width - b.width);
557
+ }
558
+ /**
559
+ * The candidate the two native lanes fetch: the NARROWEST one at least `boxWidth x scale` wide,
560
+ * the widest when none reaches it, and `fallback` (the author's `src`) when there is no list.
561
+ *
562
+ * `allow-downscaling="false"` takes the widest candidate and the full decode beside it. The
563
+ * attribute means one thing on all three lanes — do not settle for fewer pixels than the file
564
+ * holds — and on a lane that chooses its source that has to include the choice, or the words
565
+ * would disagree with themselves.
566
+ *
567
+ * AN UNMEASURED BOX FALLS BACK rather than guessing. A box of zero (or a scale of zero) is a
568
+ * layout that has not happened yet, and picking the widest there would download the hero to
569
+ * measure it; picking the narrowest would paint a blurry one. `src` is what the author already
570
+ * chose for that case, which is the whole reason it stays the fallback.
571
+ */
572
+ export function pickImageSource(candidates, boxWidth, scale, fallback, allowDownscaling = true) {
573
+ const src = (fallback ?? "").trim();
574
+ if (candidates.length === 0)
575
+ return src;
576
+ const widest = candidates[candidates.length - 1];
577
+ if (!allowDownscaling)
578
+ return widest.url;
579
+ const target = boxWidth * scale;
580
+ if (!Number.isFinite(target) || target <= 0)
581
+ return src !== "" ? src : widest.url;
582
+ for (const candidate of candidates) {
583
+ if (candidate.width >= target)
584
+ return candidate.url;
585
+ }
586
+ return widest.url;
587
+ }
588
+ /**
589
+ * The `srcset` the WEB emits: the same candidates in the `w` descriptor form the browser reads.
590
+ * Empty for an empty list, and the adapter writes no attribute at all in that case.
591
+ */
592
+ export function imageSrcsetValue(candidates) {
593
+ return candidates.map((candidate) => `${candidate.url} ${candidate.width}w`).join(", ");
594
+ }
595
+ /**
596
+ * The `sizes` hint beside it. The adapter knows the layout width only once the element has been
597
+ * laid out, so a measured box is reported in CSS pixels and an unmeasured one says `auto`, which
598
+ * is the HTML spelling of "use this element's own layout width" and the honest answer for a box
599
+ * nobody has measured. Never `100vw`: a guess that is wrong for every thumbnail on the page.
600
+ */
601
+ export function imageSizesValue(clientWidth) {
602
+ return Number.isFinite(clientWidth) && clientWidth > 0 ? `${Math.round(clientWidth)}px` : "auto";
603
+ }
604
+ /** Map the sniffed container to the media type `on:load` reports. Unknown bytes stay unknown. */
605
+ export function imageMediaType(extensionOrType) {
606
+ const text = (extensionOrType ?? "").trim().toLowerCase();
607
+ if (text === "")
608
+ return "unknown";
609
+ if (text.includes("/"))
610
+ return text;
611
+ const table = {
612
+ jpg: "image/jpeg", jpeg: "image/jpeg", png: "image/png", gif: "image/gif",
613
+ webp: "image/webp", avif: "image/avif", heic: "image/heic", heif: "image/heif",
614
+ svg: "image/svg+xml", bmp: "image/bmp", tif: "image/tiff", tiff: "image/tiff",
615
+ };
616
+ return table[text.replace(/^\./, "")] ?? "unknown";
617
+ }
618
+ //# sourceMappingURL=image-core.js.map