@absolutejs/absolute 0.19.0-beta.783 → 0.19.0-beta.785

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 (252) hide show
  1. package/dist/angular/browser.js +57 -9801
  2. package/dist/angular/browser.js.map +4 -246
  3. package/dist/angular/index.js +61 -14967
  4. package/dist/angular/index.js.map +4 -282
  5. package/dist/angular/server.js +45 -5699
  6. package/dist/angular/server.js.map +3 -52
  7. package/dist/build.js +45 -18021
  8. package/dist/build.js.map +3 -100
  9. package/dist/chunk-102fp7xe.js +63 -0
  10. package/dist/chunk-102fp7xe.js.map +10 -0
  11. package/dist/chunk-11zpfqz6.js +19 -0
  12. package/dist/chunk-11zpfqz6.js.map +10 -0
  13. package/dist/chunk-1e9vsfyh.js +100 -0
  14. package/dist/chunk-1e9vsfyh.js.map +10 -0
  15. package/dist/chunk-25v9t56f.js +29 -0
  16. package/dist/chunk-25v9t56f.js.map +11 -0
  17. package/dist/chunk-2f21eenc.js +21 -0
  18. package/dist/chunk-2f21eenc.js.map +10 -0
  19. package/dist/chunk-2ga2znex.js +13 -0
  20. package/dist/chunk-2ga2znex.js.map +9 -0
  21. package/dist/chunk-30yrw0f6.js +33 -0
  22. package/dist/chunk-30yrw0f6.js.map +10 -0
  23. package/dist/chunk-3c7mpj3m.js +784 -0
  24. package/dist/chunk-3c7mpj3m.js.map +10 -0
  25. package/dist/chunk-3g91wb4f.js +358 -0
  26. package/dist/chunk-3g91wb4f.js.map +10 -0
  27. package/dist/chunk-3yjzpcne.js +34 -0
  28. package/dist/chunk-3yjzpcne.js.map +10 -0
  29. package/dist/chunk-4bq79t8v.js +136 -0
  30. package/dist/chunk-4bq79t8v.js.map +10 -0
  31. package/dist/chunk-4d39r92n.js +81 -0
  32. package/dist/chunk-4d39r92n.js.map +10 -0
  33. package/dist/chunk-4m75s5xf.js +184 -0
  34. package/dist/chunk-4m75s5xf.js.map +11 -0
  35. package/dist/chunk-5003emhv.js +17 -0
  36. package/dist/chunk-5003emhv.js.map +10 -0
  37. package/dist/chunk-5fhp1jap.js +9169 -0
  38. package/dist/chunk-5fhp1jap.js.map +236 -0
  39. package/dist/chunk-6fkgm9s5.js +569 -0
  40. package/dist/chunk-6fkgm9s5.js.map +10 -0
  41. package/dist/chunk-6pdj08z3.js +73 -0
  42. package/dist/chunk-6pdj08z3.js.map +12 -0
  43. package/dist/chunk-6qjbrt0k.js +13 -0
  44. package/dist/chunk-6qjbrt0k.js.map +9 -0
  45. package/dist/chunk-6sccb4jr.js +14 -0
  46. package/dist/chunk-6sccb4jr.js.map +9 -0
  47. package/dist/chunk-73brtyw5.js +16 -0
  48. package/dist/chunk-73brtyw5.js.map +9 -0
  49. package/dist/chunk-77cqkarb.js +25 -0
  50. package/dist/chunk-77cqkarb.js.map +9 -0
  51. package/dist/chunk-798spvzv.js +50 -0
  52. package/dist/chunk-798spvzv.js.map +10 -0
  53. package/dist/chunk-7fw6x3js.js +131 -0
  54. package/dist/chunk-7fw6x3js.js.map +11 -0
  55. package/dist/chunk-7kjj42xm.js +11 -0
  56. package/dist/chunk-7kjj42xm.js.map +10 -0
  57. package/dist/chunk-851whwc7.js +17 -0
  58. package/dist/chunk-851whwc7.js.map +10 -0
  59. package/dist/chunk-85n68sy6.js +103 -0
  60. package/dist/chunk-85n68sy6.js.map +10 -0
  61. package/dist/chunk-8feq2qek.js +17 -0
  62. package/dist/chunk-8feq2qek.js.map +9 -0
  63. package/dist/chunk-8kcfffry.js +35 -0
  64. package/dist/chunk-8kcfffry.js.map +10 -0
  65. package/dist/chunk-93sqk7be.js +139 -0
  66. package/dist/chunk-93sqk7be.js.map +12 -0
  67. package/dist/chunk-97572s32.js +262 -0
  68. package/dist/chunk-97572s32.js.map +12 -0
  69. package/dist/chunk-9a307ca6.js +1742 -0
  70. package/dist/chunk-9a307ca6.js.map +11 -0
  71. package/dist/chunk-9c5tj4k3.js +130 -0
  72. package/dist/chunk-9c5tj4k3.js.map +10 -0
  73. package/dist/chunk-9xrsjeem.js +12 -0
  74. package/dist/chunk-9xrsjeem.js.map +9 -0
  75. package/dist/chunk-a9mvyp04.js +87 -0
  76. package/dist/chunk-a9mvyp04.js.map +10 -0
  77. package/dist/chunk-b3gbnrwe.js +21 -0
  78. package/dist/chunk-b3gbnrwe.js.map +10 -0
  79. package/dist/chunk-bmgqm774.js +65 -0
  80. package/dist/chunk-bmgqm774.js.map +9 -0
  81. package/dist/chunk-bxfghpma.js +69 -0
  82. package/dist/chunk-bxfghpma.js.map +10 -0
  83. package/dist/chunk-c1jfjnka.js +74 -0
  84. package/dist/chunk-c1jfjnka.js.map +10 -0
  85. package/dist/chunk-cbkrwmvh.js +80 -0
  86. package/dist/chunk-cbkrwmvh.js.map +10 -0
  87. package/dist/chunk-cdxd7sy2.js +71 -0
  88. package/dist/chunk-cdxd7sy2.js.map +10 -0
  89. package/dist/chunk-cg95827x.js +21 -0
  90. package/dist/chunk-cg95827x.js.map +10 -0
  91. package/dist/chunk-d9c0am65.js +12 -0
  92. package/dist/chunk-d9c0am65.js.map +10 -0
  93. package/dist/chunk-daqghmg8.js +12 -0
  94. package/dist/chunk-daqghmg8.js.map +9 -0
  95. package/dist/chunk-dr9yqsdb.js +203 -0
  96. package/dist/chunk-dr9yqsdb.js.map +10 -0
  97. package/dist/chunk-e8eecyrq.js +244 -0
  98. package/dist/chunk-e8eecyrq.js.map +10 -0
  99. package/dist/chunk-ex2hxe0v.js +160 -0
  100. package/dist/chunk-ex2hxe0v.js.map +11 -0
  101. package/dist/chunk-ey5hs6x6.js +253 -0
  102. package/dist/chunk-ey5hs6x6.js.map +11 -0
  103. package/dist/chunk-fak944et.js +91 -0
  104. package/dist/chunk-fak944et.js.map +10 -0
  105. package/dist/chunk-fygx2ymm.js +118 -0
  106. package/dist/chunk-fygx2ymm.js.map +12 -0
  107. package/dist/chunk-g15qj669.js +271 -0
  108. package/dist/chunk-g15qj669.js.map +11 -0
  109. package/dist/chunk-g3j22qf6.js +51 -0
  110. package/dist/chunk-g3j22qf6.js.map +9 -0
  111. package/dist/chunk-gd6wmknh.js +121 -0
  112. package/dist/chunk-gd6wmknh.js.map +11 -0
  113. package/dist/chunk-gf0ygptk.js +85 -0
  114. package/dist/chunk-gf0ygptk.js.map +11 -0
  115. package/dist/chunk-gq0zxpm0.js +90 -0
  116. package/dist/chunk-gq0zxpm0.js.map +10 -0
  117. package/dist/chunk-gytkmthr.js +220 -0
  118. package/dist/chunk-gytkmthr.js.map +10 -0
  119. package/dist/chunk-h5bbfn3n.js +28 -0
  120. package/dist/chunk-h5bbfn3n.js.map +11 -0
  121. package/dist/chunk-h6mye9r3.js +93 -0
  122. package/dist/chunk-h6mye9r3.js.map +10 -0
  123. package/dist/chunk-hcsmxw1v.js +85 -0
  124. package/dist/chunk-hcsmxw1v.js.map +10 -0
  125. package/dist/chunk-hep68ja7.js +4444 -0
  126. package/dist/chunk-hep68ja7.js.map +29 -0
  127. package/dist/chunk-hhqh49fz.js +149 -0
  128. package/dist/chunk-hhqh49fz.js.map +10 -0
  129. package/dist/chunk-hyjs4bqs.js +8 -0
  130. package/dist/chunk-hyjs4bqs.js.map +10 -0
  131. package/dist/chunk-hza0n8qm.js +20 -0
  132. package/dist/chunk-hza0n8qm.js.map +9 -0
  133. package/dist/chunk-jn91vzkh.js +66 -0
  134. package/dist/chunk-jn91vzkh.js.map +10 -0
  135. package/dist/chunk-jwxt8gnp.js +13 -0
  136. package/dist/chunk-jwxt8gnp.js.map +9 -0
  137. package/dist/chunk-kk8w9rh5.js +195 -0
  138. package/dist/chunk-kk8w9rh5.js.map +10 -0
  139. package/dist/chunk-kndkjsya.js +261 -0
  140. package/dist/chunk-kndkjsya.js.map +10 -0
  141. package/dist/chunk-kvq01j35.js +36 -0
  142. package/dist/chunk-kvq01j35.js.map +10 -0
  143. package/dist/chunk-mbazhahf.js +60 -0
  144. package/dist/chunk-mbazhahf.js.map +10 -0
  145. package/dist/chunk-mgfwq18r.js +15 -0
  146. package/dist/chunk-mgfwq18r.js.map +9 -0
  147. package/dist/chunk-mtgf69xn.js +88 -0
  148. package/dist/chunk-mtgf69xn.js.map +10 -0
  149. package/dist/chunk-nehhtthw.js +225 -0
  150. package/dist/chunk-nehhtthw.js.map +10 -0
  151. package/dist/chunk-nhzf4az4.js +149 -0
  152. package/dist/chunk-nhzf4az4.js.map +10 -0
  153. package/dist/chunk-p5504p14.js +16 -0
  154. package/dist/chunk-p5504p14.js.map +10 -0
  155. package/dist/chunk-pnscgw95.js +90 -0
  156. package/dist/chunk-pnscgw95.js.map +10 -0
  157. package/dist/chunk-pvpp4pvs.js +17 -0
  158. package/dist/chunk-pvpp4pvs.js.map +10 -0
  159. package/dist/chunk-qh75agse.js +95 -0
  160. package/dist/chunk-qh75agse.js.map +10 -0
  161. package/dist/chunk-qk8kd3hr.js +526 -0
  162. package/dist/chunk-qk8kd3hr.js.map +12 -0
  163. package/dist/chunk-qxq2zcty.js +52 -0
  164. package/dist/chunk-qxq2zcty.js.map +10 -0
  165. package/dist/chunk-r7jmgqnw.js +114 -0
  166. package/dist/chunk-r7jmgqnw.js.map +10 -0
  167. package/dist/chunk-s6defjk2.js +116 -0
  168. package/dist/chunk-s6defjk2.js.map +10 -0
  169. package/dist/chunk-sd39p726.js +619 -0
  170. package/dist/chunk-sd39p726.js.map +10 -0
  171. package/dist/chunk-smgj0epn.js +18 -0
  172. package/dist/chunk-smgj0epn.js.map +9 -0
  173. package/dist/chunk-swrnzs4c.js +63 -0
  174. package/dist/chunk-swrnzs4c.js.map +10 -0
  175. package/dist/chunk-t81a331y.js +27 -0
  176. package/dist/chunk-t81a331y.js.map +10 -0
  177. package/dist/chunk-tfe3sb44.js +33 -0
  178. package/dist/chunk-tfe3sb44.js.map +10 -0
  179. package/dist/chunk-tx9edm1x.js +34 -0
  180. package/dist/chunk-tx9edm1x.js.map +10 -0
  181. package/dist/chunk-vkrpm7kc.js +247 -0
  182. package/dist/chunk-vkrpm7kc.js.map +12 -0
  183. package/dist/chunk-vvz7dcvq.js +434 -0
  184. package/dist/chunk-vvz7dcvq.js.map +13 -0
  185. package/dist/chunk-w3m4m5we.js +4925 -0
  186. package/dist/chunk-w3m4m5we.js.map +12 -0
  187. package/dist/chunk-wrxtn9ve.js +18 -0
  188. package/dist/chunk-wrxtn9ve.js.map +10 -0
  189. package/dist/chunk-xpkjbmd3.js +428 -0
  190. package/dist/chunk-xpkjbmd3.js.map +14 -0
  191. package/dist/chunk-xrmjy8kk.js +454 -0
  192. package/dist/chunk-xrmjy8kk.js.map +10 -0
  193. package/dist/chunk-xw0tx842.js +13 -0
  194. package/dist/chunk-xw0tx842.js.map +9 -0
  195. package/dist/chunk-xx5b6b9m.js +69 -0
  196. package/dist/chunk-xx5b6b9m.js.map +10 -0
  197. package/dist/chunk-xz1kdswj.js +21 -0
  198. package/dist/chunk-xz1kdswj.js.map +9 -0
  199. package/dist/chunk-xzvy9hr4.js +377 -0
  200. package/dist/chunk-xzvy9hr4.js.map +10 -0
  201. package/dist/chunk-yfqhr31t.js +39 -0
  202. package/dist/chunk-yfqhr31t.js.map +9 -0
  203. package/dist/chunk-ygzd5s4z.js +184 -0
  204. package/dist/chunk-ygzd5s4z.js.map +10 -0
  205. package/dist/chunk-ywjn0rad.js +14 -0
  206. package/dist/chunk-ywjn0rad.js.map +9 -0
  207. package/dist/chunk-z9nvhm6r.js +13 -0
  208. package/dist/chunk-z9nvhm6r.js.map +9 -0
  209. package/dist/chunk-zhmvdpk6.js +15 -0
  210. package/dist/chunk-zhmvdpk6.js.map +9 -0
  211. package/dist/client/index.js +32 -1112
  212. package/dist/client/index.js.map +4 -22
  213. package/dist/core/streamingSlotRegistrar.js +11 -108
  214. package/dist/core/streamingSlotRegistrar.js.map +3 -4
  215. package/dist/core/streamingSlotRegistry.js +7 -169
  216. package/dist/core/streamingSlotRegistry.js.map +3 -5
  217. package/dist/index.js +536 -19835
  218. package/dist/index.js.map +3 -117
  219. package/dist/islands/browser.js +9 -228
  220. package/dist/islands/browser.js.map +4 -9
  221. package/dist/islands/index.js +17 -1986
  222. package/dist/islands/index.js.map +3 -28
  223. package/dist/react/browser.js +12 -328
  224. package/dist/react/browser.js.map +4 -12
  225. package/dist/react/components/index.js +16 -167
  226. package/dist/react/components/index.js.map +3 -6
  227. package/dist/react/hooks/index.js +8 -183
  228. package/dist/react/hooks/index.js.map +3 -7
  229. package/dist/react/index.js +36 -3705
  230. package/dist/react/index.js.map +4 -46
  231. package/dist/react/jsxDevRuntimeCompat.js +2 -61
  232. package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
  233. package/dist/react/server.js +18 -1789
  234. package/dist/react/server.js.map +3 -21
  235. package/dist/src/core/index.d.ts +0 -2
  236. package/dist/svelte/browser.js +12 -247
  237. package/dist/svelte/browser.js.map +3 -10
  238. package/dist/svelte/index.js +37 -3810
  239. package/dist/svelte/index.js.map +4 -48
  240. package/dist/svelte/server.js +21 -2787
  241. package/dist/svelte/server.js.map +3 -27
  242. package/dist/vue/browser.js +12 -348
  243. package/dist/vue/browser.js.map +4 -12
  244. package/dist/vue/components/Image.js +7 -240
  245. package/dist/vue/components/Image.js.map +3 -6
  246. package/dist/vue/components/index.js +11 -544
  247. package/dist/vue/components/index.js.map +3 -9
  248. package/dist/vue/index.js +52 -4290
  249. package/dist/vue/index.js.map +4 -51
  250. package/dist/vue/server.js +18 -1849
  251. package/dist/vue/server.js.map +3 -21
  252. package/package.json +1 -1
@@ -1,916 +1,35 @@
1
1
  // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- function __accessProp(key) {
8
- return this[key];
9
- }
10
- var __toESMCache_node;
11
- var __toESMCache_esm;
12
- var __toESM = (mod, isNodeMode, target) => {
13
- var canCache = mod != null && typeof mod === "object";
14
- if (canCache) {
15
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
- var cached = cache.get(mod);
17
- if (cached)
18
- return cached;
19
- }
20
- target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- for (let key of __getOwnPropNames(mod))
23
- if (!__hasOwnProp.call(to, key))
24
- __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
26
- enumerable: true
27
- });
28
- if (canCache)
29
- cache.set(mod, to);
30
- return to;
31
- };
32
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
- var __returnValue = (v) => v;
34
- function __exportSetter(name, newValue) {
35
- this[name] = __returnValue.bind(null, newValue);
36
- }
37
- var __export = (target, all) => {
38
- for (var name in all)
39
- __defProp(target, name, {
40
- get: all[name],
41
- enumerable: true,
42
- configurable: true,
43
- set: __exportSetter.bind(all, name)
44
- });
45
- };
46
- var __legacyDecorateClassTS = function(decorators, target, key, desc) {
47
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
48
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
49
- r = Reflect.decorate(decorators, target, key, desc);
50
- else
51
- for (var i = decorators.length - 1;i >= 0; i--)
52
- if (d = decorators[i])
53
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
54
- return c > 3 && r && Object.defineProperty(target, key, r), r;
55
- };
56
- var __legacyMetadataTS = (k, v) => {
57
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
58
- return Reflect.metadata(k, v);
59
- };
60
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
61
- var __require = import.meta.require;
62
-
63
- // src/core/islandManifest.ts
64
- var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
65
- const entries = {};
66
- let found = false;
67
- for (const [key, value] of Object.entries(manifest)) {
68
- if (!key.startsWith(prefix))
69
- continue;
70
- const component = key.slice(prefix.length);
71
- if (!component)
72
- continue;
73
- entries[component] = value;
74
- found = true;
75
- }
76
- return found ? entries : undefined;
77
- }, getIslandManifestEntries = (manifest) => {
78
- const islands = {};
79
- const frameworks = ["react", "svelte", "vue", "angular"];
80
- for (const framework of frameworks) {
81
- const prefix = `Island${toIslandFrameworkSegment(framework)}`;
82
- const entries = collectFrameworkIslands(manifest, prefix);
83
- if (entries)
84
- islands[framework] = entries;
85
- }
86
- return islands;
87
- }, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
88
-
89
- // src/client/streamSwap.ts
90
- var streamSwapRuntime = () => {
91
- const absoluteWindow = window;
92
- const SLOT_PATCH_EVENT = "absolutejs:slot-patch";
93
- if (absoluteWindow.__ABS_SLOT_RUNTIME__ === true)
94
- return;
95
- absoluteWindow.__ABS_SLOT_RUNTIME__ = true;
96
- absoluteWindow.__ABS_SLOT_CONSUMERS__ = absoluteWindow.__ABS_SLOT_CONSUMERS__ ?? {};
97
- absoluteWindow.__ABS_SLOT_PENDING__ = absoluteWindow.__ABS_SLOT_PENDING__ ?? {};
98
- const consumers = absoluteWindow.__ABS_SLOT_CONSUMERS__;
99
- const pending = absoluteWindow.__ABS_SLOT_PENDING__;
100
- const isObjectRecord = (value) => Boolean(value) && typeof value === "object";
101
- const isPatchedPendingEntry = (value) => {
102
- if (!isObjectRecord(value))
103
- return false;
104
- return value.domPatched === true && "payload" in value;
105
- };
106
- const unwrapPendingPayload = (value) => isPatchedPendingEntry(value) ? value.payload : value;
107
- const canApplyImmediately = () => absoluteWindow.__ABS_SLOT_HYDRATION_PENDING__ !== true;
108
- const isAngularDeferPayload = (payload) => {
109
- if (!isObjectRecord(payload))
110
- return false;
111
- return payload.kind === "angular-defer";
112
- };
113
- const isVueSuspensePayload = (payload) => {
114
- if (!isObjectRecord(payload))
115
- return false;
116
- return payload.kind === "vue-suspense";
117
- };
118
- const resolveHtml = (payload) => {
119
- if (!isObjectRecord(payload)) {
120
- return typeof payload === "string" ? payload : "";
121
- }
122
- if (typeof payload.html === "string") {
123
- return payload.html;
124
- }
125
- return "";
126
- };
127
- const apply = (id, pendingEntry) => {
128
- const payload = unwrapPendingPayload(pendingEntry);
129
- if (!canApplyImmediately()) {
130
- pending[id] = payload;
131
- return;
132
- }
133
- const consumer = consumers[id];
134
- if (typeof consumer !== "function") {
135
- applyToDom(id, payload, pendingEntry);
136
- return;
137
- }
138
- const handled = consumer(payload);
139
- if (handled !== false) {
140
- delete pending[id];
141
- return;
142
- }
143
- applyToDom(id, payload, pendingEntry);
144
- };
145
- const applyToDom = (id, payload, pendingEntry) => {
146
- if (isAngularDeferPayload(payload)) {
147
- pending[id] = payload;
148
- return;
149
- }
150
- const node = document.getElementById(id);
151
- if (!node) {
152
- pending[id] = payload;
153
- return;
154
- }
155
- const html = resolveHtml(payload);
156
- if (isVueSuspensePayload(payload) && isPatchedPendingEntry(pendingEntry)) {
157
- return;
158
- }
159
- node.innerHTML = html;
160
- node.setAttribute("data-absolute-slot-state", "resolved");
161
- window.dispatchEvent(new CustomEvent(SLOT_PATCH_EVENT, {
162
- detail: { html, id, payload }
163
- }));
164
- if (isVueSuspensePayload(payload)) {
165
- pending[id] = { domPatched: true, payload };
166
- return;
167
- }
168
- delete pending[id];
169
- };
170
- const flush = () => {
171
- for (const id in pending) {
172
- if (!Object.prototype.hasOwnProperty.call(pending, id))
173
- continue;
174
- apply(id, pending[id] ?? "");
175
- }
176
- };
177
- absoluteWindow.__ABS_SLOT_FLUSH__ = flush;
178
- absoluteWindow.__ABS_SLOT_ENQUEUE__ = (id, payload) => {
179
- apply(id, payload);
180
- };
181
- if (typeof MutationObserver === "function") {
182
- const observer = new MutationObserver(flush);
183
- const root = document.documentElement ?? document.body ?? document;
184
- observer.observe(root, { childList: true, subtree: true });
185
- }
186
- if (document.readyState === "loading") {
187
- document.addEventListener("DOMContentLoaded", flush, { once: true });
188
- }
189
- flush();
190
- }, stripFunctionWrapper = (value) => {
191
- const start = value.indexOf("{");
192
- const end = value.lastIndexOf("}");
193
- if (start < 0 || end <= start)
194
- return "";
195
- return value.slice(start + 1, end);
196
- }, getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(streamSwapRuntime.toString())}})();`;
197
-
198
- // src/angular/resolveAngularPackage.ts
199
- import { existsSync, readFileSync } from "fs";
200
- import { join, resolve } from "path";
201
- var resolveAngularPackageDir = (specifier) => {
202
- const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
203
- if (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {
204
- return fromCompiledRuntime;
205
- }
206
- const fromProject = resolve(process.cwd(), "node_modules", specifier);
207
- if (existsSync(fromProject)) {
208
- return fromProject;
209
- }
210
- return null;
211
- }, resolvePackageEntry = (packageDir) => {
212
- try {
213
- const pkg = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8"));
214
- const rootExport = pkg.exports?.["."];
215
- const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
216
- return join(packageDir, entry);
217
- } catch {
218
- return packageDir;
219
- }
220
- }, resolveAngularPackage = (specifier) => {
221
- const packageDir = resolveAngularPackageDir(specifier);
222
- if (packageDir)
223
- return resolvePackageEntry(packageDir);
224
- return specifier;
225
- };
226
- var init_resolveAngularPackage = () => {};
227
-
228
- // src/angular/injectorPatch.ts
229
- import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
230
- import { dirname, join as join2 } from "path";
231
- var applyInjectorPatch = (chunkPath, content) => {
232
- if (content.includes('Symbol.for("angular.currentInjector")')) {
233
- return;
234
- }
235
- const original = [
236
- "let _currentInjector = undefined;",
237
- "function getCurrentInjector() {",
238
- " return _currentInjector;",
239
- "}",
240
- "function setCurrentInjector(injector) {",
241
- " const former = _currentInjector;",
242
- " _currentInjector = injector;",
243
- " return former;",
244
- "}"
245
- ].join(`
246
- `);
247
- const replacement = [
248
- 'const _injSym = Symbol.for("angular.currentInjector");',
249
- "if (!globalThis[_injSym]) globalThis[_injSym] = { v: undefined };",
250
- "function getCurrentInjector() {",
251
- " return globalThis[_injSym].v;",
252
- "}",
253
- "function setCurrentInjector(injector) {",
254
- " const former = globalThis[_injSym].v;",
255
- " globalThis[_injSym].v = injector;",
256
- " return former;",
257
- "}"
258
- ].join(`
259
- `);
260
- const patched = content.replace(original, replacement);
261
- if (patched === content) {
262
- return;
263
- }
264
- writeFileSync(chunkPath, patched, "utf-8");
265
- }, resolveAngularCoreDir = () => {
266
- const resolved = resolveAngularPackageDir("@angular/core");
267
- if (resolved && existsSync2(join2(resolved, "package.json"))) {
268
- return resolved;
269
- }
270
- return dirname(__require.resolve("@angular/core/package.json"));
271
- }, patchAngularInjectorSingleton = () => {
272
- try {
273
- const coreDir = resolveAngularCoreDir();
274
- const chunkPath = join2(coreDir, "fesm2022", "_not_found-chunk.mjs");
275
- const content = readFileSync2(chunkPath, "utf-8");
276
- applyInjectorPatch(chunkPath, content);
277
- } catch {}
278
- };
279
- var init_injectorPatch = __esm(() => {
280
- init_resolveAngularPackage();
281
- patchAngularInjectorSingleton();
282
- });
283
-
284
- // src/angular/angularPatch.ts
285
- var exports_angularPatch = {};
286
- __export(exports_angularPatch, {
287
- applyPatches: () => applyPatches
288
- });
289
- var ensureHead = (doc) => {
290
- if (!doc || doc.head || !doc.documentElement) {
291
- return;
292
- }
293
- const head = doc.createElement("head");
294
- doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
295
- }, SSR_LAYOUT_RECT, layoutPatchApplied = false, collectPrototypeChain = (instance) => {
296
- const protos = [];
297
- let current = instance ? Object.getPrototypeOf(instance) : null;
298
- while (current && current !== Object.prototype) {
299
- protos.push(current);
300
- current = Object.getPrototypeOf(current);
301
- }
302
- return protos;
303
- }, patchElementLayout = (doc) => {
304
- if (layoutPatchApplied || !doc) {
305
- return;
306
- }
307
- let element;
308
- try {
309
- element = doc.createElement("div");
310
- } catch {
311
- return;
312
- }
313
- const protos = collectPrototypeChain(element);
314
- if (protos.length === 0)
315
- return;
316
- const copyLayoutRect = (rect) => ({ ...rect });
317
- const createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);
318
- const getClientRects = () => [];
319
- const noop = () => {
320
- return;
321
- };
322
- const numericProps = [
323
- "clientWidth",
324
- "clientHeight",
325
- "clientLeft",
326
- "clientTop",
327
- "offsetWidth",
328
- "offsetHeight",
329
- "offsetLeft",
330
- "offsetTop",
331
- "scrollWidth",
332
- "scrollHeight",
333
- "scrollLeft",
334
- "scrollTop"
335
- ];
336
- for (const proto of protos) {
337
- const define = (name, value) => {
338
- const descriptor = Object.getOwnPropertyDescriptor(proto, name);
339
- if (typeof descriptor?.value === "function")
340
- return;
341
- Object.defineProperty(proto, name, {
342
- configurable: true,
343
- value,
344
- writable: true
345
- });
346
- };
347
- define("getBoundingClientRect", createLayoutRect);
348
- define("getClientRects", getClientRects);
349
- define("scrollTo", noop);
350
- define("scrollBy", noop);
351
- define("scrollIntoView", noop);
352
- define("focus", noop);
353
- define("blur", noop);
354
- for (const prop of numericProps) {
355
- const desc = Object.getOwnPropertyDescriptor(proto, prop);
356
- if (desc)
357
- continue;
358
- Object.defineProperty(proto, prop, {
359
- configurable: true,
360
- get: () => 0
361
- });
362
- }
363
- }
364
- layoutPatchApplied = true;
365
- }, applyPatches = async () => {
366
- const { \u{275}DominoAdapter } = await import(resolveAngularPackage("@angular/platform-server"));
367
- if (!\u{275}DominoAdapter?.prototype) {
368
- console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
369
- return false;
370
- }
371
- try {
372
- const adapter = new \u{275}DominoAdapter;
373
- const seedDoc = typeof adapter.createHtmlDocument === "function" ? adapter.createHtmlDocument() : typeof adapter.getDefaultDocument === "function" ? adapter.getDefaultDocument() : null;
374
- if (seedDoc) {
375
- patchElementLayout(seedDoc);
376
- const probe = seedDoc.createElement("div");
377
- if (typeof probe.getBoundingClientRect !== "function") {
378
- console.warn("[Angular Patch] Layout shim did not stick on probe element prototype chain");
379
- }
380
- }
381
- } catch (error) {
382
- console.warn("[Angular Patch] Could not eagerly patch Element prototypes:", error);
383
- }
384
- const proto = \u{275}DominoAdapter.prototype;
385
- const origGetBaseHref = proto.getBaseHref;
386
- proto.getBaseHref = function(doc) {
387
- if (!doc || !doc.head || typeof doc.head.children === "undefined") {
388
- return "";
389
- }
390
- return origGetBaseHref.call(this, doc);
391
- };
392
- const origCreateHtmlDocument = proto.createHtmlDocument;
393
- proto.createHtmlDocument = function() {
394
- const doc = origCreateHtmlDocument.call(this);
395
- ensureHead(doc);
396
- patchElementLayout(doc);
397
- return doc;
398
- };
399
- const origGetDefaultDocument = proto.getDefaultDocument;
400
- proto.getDefaultDocument = function() {
401
- const doc = origGetDefaultDocument.call(this);
402
- ensureHead(doc);
403
- patchElementLayout(doc);
404
- return doc;
405
- };
406
- return true;
407
- };
408
- var init_angularPatch = __esm(() => {
409
- init_resolveAngularPackage();
410
- SSR_LAYOUT_RECT = Object.freeze({
411
- bottom: 0,
412
- height: 0,
413
- left: 0,
414
- right: 0,
415
- top: 0,
416
- width: 0,
417
- x: 0,
418
- y: 0,
419
- toJSON() {
420
- return this;
421
- }
422
- });
423
- });
424
-
425
- // src/angular/angularDeps.ts
426
- var initDominoAdapter = (platformServer) => {
427
- try {
428
- const DominoAdapter = platformServer.\u{275}DominoAdapter;
429
- DominoAdapter?.makeCurrent?.();
430
- } catch (err) {
431
- console.error("Failed to initialize DominoAdapter:", err);
432
- }
433
- }, loadAngularDeps = async () => {
434
- patchAngularInjectorSingleton();
435
- await import(resolveAngularPackage("@angular/compiler"));
436
- const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
437
- await applyPatches2();
438
- const [platformBrowser, platformServer, common, core] = await Promise.all([
439
- import(resolveAngularPackage("@angular/platform-browser")),
440
- import(resolveAngularPackage("@angular/platform-server")),
441
- import(resolveAngularPackage("@angular/common")),
442
- import(resolveAngularPackage("@angular/core"))
443
- ]);
444
- if (false) {}
445
- initDominoAdapter(platformServer);
446
- return {
447
- APP_BASE_HREF: common.APP_BASE_HREF,
448
- bootstrapApplication: platformBrowser.bootstrapApplication,
449
- DomSanitizer: platformBrowser.DomSanitizer,
450
- ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
451
- inject: core.inject,
452
- provideClientHydration: platformBrowser.provideClientHydration,
453
- provideServerRendering: platformServer.provideServerRendering,
454
- provideZonelessChangeDetection: core.provideZonelessChangeDetection,
455
- reflectComponentType: core.reflectComponentType,
456
- renderApplication: platformServer.renderApplication,
457
- REQUEST: core.REQUEST,
458
- REQUEST_CONTEXT: core.REQUEST_CONTEXT,
459
- RESPONSE_INIT: core.RESPONSE_INIT,
460
- Sanitizer: core.Sanitizer,
461
- SecurityContext: core.SecurityContext,
462
- withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
463
- };
464
- }, angularDeps = null, getAngularDeps = () => {
465
- if (!angularDeps) {
466
- angularDeps = loadAngularDeps();
467
- }
468
- return angularDeps;
469
- };
470
- var init_angularDeps = __esm(() => {
471
- init_injectorPatch();
472
- init_resolveAngularPackage();
473
- });
474
-
475
- // src/utils/stringModifiers.ts
476
- var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
477
- if (!str.includes("-") && !str.includes("_")) {
478
- return str.charAt(0).toUpperCase() + str.slice(1);
479
- }
480
- return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
481
- }, toScreamingSnake = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
482
-
483
- // src/utils/registerClientScript.ts
484
- var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value, registerClientScript = (script, requestId) => {
485
- const id = requestId || getSsrContextId() || getRequestId();
486
- if (!scriptRegistry.has(id)) {
487
- scriptRegistry.set(id, new Set);
488
- }
489
- scriptRegistry.get(id)?.add(script);
490
- return id;
491
- }, setSsrContextGetter = (getter) => {
492
- ssrContextGetter = getter;
493
- }, clearAllClientScripts = () => {
494
- scriptRegistry.clear();
495
- }, generateClientScriptCode = (scripts) => {
496
- if (scripts.length === 0) {
497
- return "";
498
- }
499
- const scriptCode = scripts.map((script, index) => {
500
- const funcString = script.toString();
501
- const bodyMatch = funcString.match(/\{([\s\S]*)\}/);
502
- if (!bodyMatch || !bodyMatch[1]) {
503
- return "";
504
- }
505
- const body = bodyMatch[1].trim();
506
- return `
507
- (function() {
508
- var executed = false;
509
- function executeScript_${index}() {
510
- if (executed) return;
511
- executed = true;
512
- ${body}
513
- }
514
-
515
- if (document.readyState === 'complete' || document.readyState === 'interactive') {
516
- executeScript_${index}();
517
- } else {
518
- document.addEventListener('DOMContentLoaded', executeScript_${index});
519
- }
520
-
521
- // Watch for hydration-added elements
522
- var observer = new MutationObserver(function() {
523
- executeScript_${index}();
524
- if (executed) observer.disconnect();
525
- });
526
- if (!executed) {
527
- observer.observe(document.body || document.documentElement, { childList: true, subtree: true });
528
- }
529
-
530
- // Single fallback timeout
531
- setTimeout(function() {
532
- executeScript_${index}();
533
- observer.disconnect();
534
- }, 1000);
535
- })();`;
536
- }).join(`
537
- `);
538
- return `<script>
539
- (function() {
540
- ${scriptCode}
541
- })();
542
- </script>`;
543
- }, getAndClearClientScripts = (requestId) => {
544
- const id = requestId || ssrContextGetter?.();
545
- if (!id)
546
- return [];
547
- const scripts = scriptRegistry.get(id);
548
- if (!scripts) {
549
- return [];
550
- }
551
- const scriptArray = Array.from(scripts);
552
- scriptRegistry.delete(id);
553
- return scriptArray;
554
- };
555
- var init_registerClientScript = __esm(() => {
556
- scriptRegistry = new Map;
557
- if (typeof globalThis !== "undefined") {
558
- Object.assign(globalThis, { registerClientScript });
559
- }
560
- });
561
-
562
- // src/angular/httpTransferCache.ts
563
- var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
564
- const {
565
- filter: userFilter,
566
- skipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,
567
- ...angularOptions
568
- } = options;
569
- return {
570
- includePostRequests: false,
571
- includeRequestsWithAuthHeaders: false,
572
- ...angularOptions,
573
- filter: (request) => !request.headers.has(skipHeader) && (userFilter?.(request) ?? true)
574
- };
575
- };
576
-
577
- // src/angular/requestProviders.ts
578
- import { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from "@angular/core";
579
- var buildRequestProviders = (deps, request, requestContext, responseInit) => [
580
- { provide: deps.REQUEST, useValue: request ?? null },
581
- { provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },
582
- { provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
583
- ];
584
- var init_requestProviders = () => {};
585
-
586
- // src/angular/ssrRender.ts
587
- var routePropsCache, cacheRouteData = (pagePath, data) => {
588
- const cacheKey = pagePath.split("?")[0] ?? pagePath;
589
- routePropsCache.set(cacheKey, data);
590
- }, getCachedRouteData = (pagePath) => routePropsCache.get(pagePath), selectorCache, buildDeps = (ssrResult, baseDeps) => {
591
- if (!ssrResult?.core) {
592
- return baseDeps;
593
- }
594
- const { common, core, platformBrowser, platformServer } = ssrResult;
595
- return {
596
- APP_BASE_HREF: common?.APP_BASE_HREF ?? baseDeps.APP_BASE_HREF,
597
- bootstrapApplication: platformBrowser?.bootstrapApplication ?? baseDeps.bootstrapApplication,
598
- DomSanitizer: platformBrowser?.DomSanitizer ?? baseDeps.DomSanitizer,
599
- ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER ?? baseDeps.ENVIRONMENT_INITIALIZER,
600
- inject: core.inject ?? baseDeps.inject,
601
- provideClientHydration: platformBrowser?.provideClientHydration ?? baseDeps.provideClientHydration,
602
- provideServerRendering: platformServer?.provideServerRendering ?? baseDeps.provideServerRendering,
603
- provideZonelessChangeDetection: core.provideZonelessChangeDetection,
604
- reflectComponentType: core.reflectComponentType,
605
- renderApplication: platformServer?.renderApplication ?? baseDeps.renderApplication,
606
- REQUEST: core.REQUEST ?? baseDeps.REQUEST,
607
- REQUEST_CONTEXT: core.REQUEST_CONTEXT ?? baseDeps.REQUEST_CONTEXT,
608
- RESPONSE_INIT: core.RESPONSE_INIT ?? baseDeps.RESPONSE_INIT,
609
- Sanitizer: core.Sanitizer,
610
- SecurityContext: core.SecurityContext,
611
- withHttpTransferCacheOptions: platformBrowser?.withHttpTransferCacheOptions ?? baseDeps.withHttpTransferCacheOptions
612
- };
613
- }, buildProviders = (deps, sanitizer, maybeProps, tokenMap, request, requestContext, responseInit, userProviders = []) => {
614
- const providers = [
615
- deps.provideServerRendering(),
616
- deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
617
- deps.provideZonelessChangeDetection(),
618
- { provide: deps.APP_BASE_HREF, useValue: "/" },
619
- {
620
- provide: deps.DomSanitizer,
621
- useValue: sanitizer
622
- },
623
- { provide: deps.Sanitizer, useValue: sanitizer },
624
- ...buildRequestProviders(deps, request, requestContext, responseInit),
625
- ...userProviders
626
- ];
627
- if (!maybeProps) {
628
- return providers;
629
- }
630
- const propProviders = Object.entries(maybeProps).map(([propName, propValue]) => ({
631
- token: tokenMap.get(toScreamingSnake(propName)),
632
- value: propValue
633
- })).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
634
- return [...providers, ...propProviders];
635
- }, clearSelectorCache = () => selectorCache.clear(), isInjectionToken = (value) => {
636
- if (!value || typeof value !== "object") {
637
- return false;
638
- }
639
- return "ngMetadataName" in value && value.ngMetadataName === "InjectionToken";
640
- }, discoverTokens = (pageModule) => new Map(Object.entries(pageModule).filter(([, value]) => isInjectionToken(value))), loadSsrDeps = async (pagePath) => {
641
- const ssrDepsPath = (pagePath.split("?")[0] ?? pagePath).replace(/\.js$/, ".ssr-deps.js");
642
- try {
643
- const ssrDeps = await import(ssrDepsPath);
644
- const result = {
645
- common: ssrDeps.__angularCommon,
646
- core: ssrDeps.__angularCore,
647
- platformBrowser: ssrDeps.__angularPlatformBrowser,
648
- platformServer: ssrDeps.__angularPlatformServer
649
- };
650
- return result;
651
- } catch {
652
- return null;
653
- }
654
- }, resolveSelector = (deps, pagePath, PageComponent) => {
655
- const cached = selectorCache.get(pagePath);
656
- if (cached) {
657
- return cached;
658
- }
659
- const selector = deps.reflectComponentType(PageComponent)?.selector ?? "ng-app";
660
- selectorCache.set(pagePath, selector);
661
- return selector;
662
- }, injectBeforeClose = (html, snippet) => {
663
- if (html.includes("</body>")) {
664
- return html.replace("</body>", `${snippet}</body>`);
665
- }
666
- if (html.includes("</html>")) {
667
- return html.replace("</html>", `${snippet}</html>`);
668
- }
669
- return html + snippet;
670
- }, injectSsrScripts = (html, requestId, indexPath, props) => {
671
- let result = html;
672
- const registeredScripts = getAndClearClientScripts(requestId);
673
- if (registeredScripts.length > 0) {
674
- result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
675
- }
676
- if (props) {
677
- result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_PAGE_PROPS__ = ${JSON.stringify(props)};</script>`);
678
- }
679
- if (indexPath) {
680
- const escapedIndexPath = JSON.stringify(indexPath);
681
- result = injectBeforeClose(result, `<script>import(${escapedIndexPath});</script>`);
682
- }
683
- return result;
684
- }, renderAngularApp = async (deps, PageComponent, providers, document2, url = "/") => {
685
- const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
686
- return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
687
- document: document2,
688
- platformProviders: [],
689
- url
690
- }));
691
- }, withSuppressedAngularDevLogs = async (render) => {
692
- const origLog = console.log;
693
- console.log = (...args) => {
694
- if (typeof args[0] === "string" && args[0].includes("development mode")) {
695
- return;
696
- }
697
- origLog.apply(console, args);
698
- };
699
- try {
700
- return await render();
701
- } finally {
702
- console.log = origLog;
703
- }
704
- };
705
- var init_ssrRender = __esm(() => {
706
- init_registerClientScript();
707
- init_requestProviders();
708
- routePropsCache = new Map;
709
- selectorCache = new Map;
710
- });
711
-
712
- // src/angular/islands.ts
713
- var exports_islands = {};
714
- __export(exports_islands, {
715
- renderAngularIslandToHtml: () => renderAngularIslandToHtml,
716
- mountAngularIsland: () => mountAngularIsland,
717
- getAngularIslandSelector: () => getAngularIslandSelector
718
- });
719
- var angularIslandSelector = "abs-angular-island", getAngularIslandSelector = (_islandId) => angularIslandSelector, getSelectorFromRenderedIsland = (rootElement) => {
720
- const firstChild = rootElement.firstElementChild;
721
- if (!(firstChild instanceof HTMLElement)) {
722
- return null;
723
- }
724
- const selector = firstChild.tagName.toLowerCase();
725
- return selector.length > 0 ? selector : null;
726
- }, getClientAngularComponentSelector = (component) => {
727
- const maybeDef = Reflect.get(component, "\u0275cmp");
728
- if (typeof maybeDef !== "object" || maybeDef === null) {
729
- return null;
730
- }
731
- const maybeSelectors = Reflect.get(maybeDef, "selectors");
732
- if (!Array.isArray(maybeSelectors)) {
733
- return null;
734
- }
735
- const [firstSelectorGroup] = maybeSelectors;
736
- if (!Array.isArray(firstSelectorGroup)) {
737
- return null;
738
- }
739
- const [selector] = firstSelectorGroup;
740
- return typeof selector === "string" && selector.length > 0 ? selector : null;
741
- }, createAngularIslandApp = async () => {
742
- const { EnvironmentInjector, provideZonelessChangeDetection } = await import("@angular/core");
743
- const { createApplication } = await import("@angular/platform-browser");
744
- const app = await createApplication({
745
- providers: [provideZonelessChangeDetection()]
746
- });
747
- const environmentInjector = app.injector.get(EnvironmentInjector);
748
- return { app, environmentInjector };
749
- }, angularIslandAppPromise = null, getAngularIslandApp = async () => {
750
- if (!angularIslandAppPromise) {
751
- angularIslandAppPromise = createAngularIslandApp();
752
- }
753
- return angularIslandAppPromise;
754
- }, wrapperMetadataCache, requestRenderCache, getRequestRenderCache = () => {
755
- const requestId = getSsrContextId();
756
- if (!requestId) {
757
- return null;
758
- }
759
- const cached = requestRenderCache.get(requestId);
760
- if (cached) {
761
- return cached;
762
- }
763
- const renderCache = new Map;
764
- requestRenderCache.set(requestId, renderCache);
765
- return renderCache;
766
- }, getAngularIslandWrapperKey = (component, _islandId) => {
767
- const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
768
- return `${componentName}:${angularIslandSelector}`;
769
- }, getIslandRenderCacheKey = (component, props) => {
770
- const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
771
- return `${componentName}:${JSON.stringify(props)}`;
772
- }, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
773
- const { Component, InjectionToken, inject } = await import("@angular/core");
774
- const { NgComponentOutlet } = await import("@angular/common");
775
- const deps = await getAngularDeps();
776
- const selector = getAngularIslandSelector(islandId);
777
- const propsToken = new InjectionToken(`${wrapperKey}:props`);
778
-
779
- class AngularIslandWrapperComponent {
780
- component = component;
781
- props = inject(propsToken);
782
- }
783
- return {
784
- deps,
785
- propsToken,
786
- selector,
787
- WrapperComponent: Component({
788
- imports: [NgComponentOutlet, component],
789
- selector,
790
- standalone: true,
791
- template: '<ng-container *ngComponentOutlet="component; inputs: props"></ng-container>'
792
- })(AngularIslandWrapperComponent)
793
- };
794
- }, createAngularIslandWrapper = async (component, islandId) => {
795
- const wrapperKey = getAngularIslandWrapperKey(component, islandId);
796
- const cached = wrapperMetadataCache.get(wrapperKey);
797
- if (cached) {
798
- return cached;
799
- }
800
- const metadataPromise = buildAngularIslandWrapperMetadata(component, islandId, wrapperKey);
801
- wrapperMetadataCache.set(wrapperKey, metadataPromise);
802
- return metadataPromise;
803
- }, extractAngularIslandRoot = (html, selector) => {
804
- const openTag = `<${selector}`;
805
- const start = html.indexOf(openTag);
806
- if (start < 0) {
807
- throw new Error(`Could not find Angular island root "${selector}".`);
808
- }
809
- const endTag = `</${selector}>`;
810
- const end = html.indexOf(endTag, start);
811
- if (end < 0) {
812
- throw new Error(`Could not close Angular island root "${selector}".`);
813
- }
814
- return html.slice(start, end + endTag.length);
815
- }, mountAngularIsland = async (component, element, props, islandId) => {
816
- await import("@angular/compiler");
817
- const { createComponent, inputBinding } = await import("@angular/core");
818
- const selector = getAngularIslandSelector(islandId);
819
- const { app, environmentInjector } = await getAngularIslandApp();
820
- let rootElement = element.querySelector(selector);
821
- if (!(rootElement instanceof HTMLElement)) {
822
- element.innerHTML = `<${selector}></${selector}>`;
823
- rootElement = element.querySelector(selector);
824
- }
825
- if (!(rootElement instanceof HTMLElement))
826
- return app;
827
- const componentSelector = getClientAngularComponentSelector(component) ?? getSelectorFromRenderedIsland(rootElement);
828
- if (!componentSelector)
829
- return app;
830
- rootElement.innerHTML = `<${componentSelector}></${componentSelector}>`;
831
- const hostElement = rootElement.querySelector(componentSelector);
832
- if (!(hostElement instanceof HTMLElement))
833
- return app;
834
- const bindings = Object.entries(props).map(([key, value]) => inputBinding(key, () => value));
835
- const componentRef = createComponent(component, {
836
- bindings,
837
- environmentInjector,
838
- hostElement
839
- });
840
- app.attachView(componentRef.hostView);
841
- componentRef.changeDetectorRef.detectChanges();
842
- window.__ABS_ANGULAR_ISLAND_APPS__ ??= [];
843
- window.__ABS_ANGULAR_ISLAND_APPS__.push(app);
844
- return app;
845
- }, renderAngularIslandToHtml = async (component, props, islandId) => {
846
- const requestCache = getRequestRenderCache();
847
- const renderCacheKey = getIslandRenderCacheKey(component, props);
848
- const cachedHtml = requestCache?.get(renderCacheKey);
849
- if (cachedHtml) {
850
- return cachedHtml;
851
- }
852
- const { deps, propsToken, selector, WrapperComponent } = await createAngularIslandWrapper(component, islandId);
853
- const providers = [
854
- deps.provideServerRendering(),
855
- deps.provideZonelessChangeDetection(),
856
- { provide: deps.APP_BASE_HREF, useValue: "/" },
857
- { provide: propsToken, useValue: props }
858
- ];
859
- const document2 = `<!DOCTYPE html><html><body><${selector}></${selector}></body></html>`;
860
- const html = await withSuppressedAngularDevLogs(() => deps.renderApplication((context) => deps.bootstrapApplication(WrapperComponent, { providers }, context), {
861
- document: document2,
862
- platformProviders: [],
863
- url: "/"
864
- }));
865
- const islandHtml = extractAngularIslandRoot(html, selector);
866
- requestCache?.set(renderCacheKey, islandHtml);
867
- return islandHtml;
868
- };
869
- var init_islands = __esm(() => {
870
- init_angularDeps();
871
- init_ssrRender();
872
- init_registerClientScript();
873
- wrapperMetadataCache = new Map;
874
- requestRenderCache = new Map;
875
- });
876
-
877
- // src/core/islands.ts
878
- function getIslandComponent(component) {
879
- if (isIslandComponentDefinition(component)) {
880
- return component.component;
881
- }
882
- return component;
883
- }
884
- var defineIslandComponent = (component, options) => ({
885
- component,
886
- export: options.export,
887
- source: options.source
888
- }), defineIslandRegistry = (registry) => registry, isRecord = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
889
- if (!isIslandComponentDefinition(component))
890
- return null;
891
- return {
892
- export: component.export,
893
- source: component.source
894
- };
895
- }, isIslandComponentDefinition = (value) => isRecord(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
896
- if (!rawProps)
897
- return {};
898
- return JSON.parse(rawProps);
899
- }, serializeIslandProps = (props) => JSON.stringify(props ?? {});
900
- var init_islands2 = () => {};
901
-
902
- // src/core/islandMarkupAttributes.ts
903
- var getIslandMarkerAttributes = (props, islandId) => ({
904
- "data-component": props.component,
905
- "data-framework": props.framework,
906
- "data-hydrate": props.hydrate ?? "load",
907
- "data-island": "true",
908
- ...islandId ? { "data-island-id": islandId } : {},
909
- "data-props": serializeIslandProps(props.props)
910
- }), escapeHtmlAttribute = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;"), serializeIslandAttributes = (attributes) => Object.entries(attributes).map(([key, value]) => `${key}="${escapeHtmlAttribute(value)}"`).join(" ");
911
- var init_islandMarkupAttributes = __esm(() => {
912
- init_islands2();
913
- });
2
+ import {
3
+ mountAngularIsland
4
+ } from "../chunk-ygzd5s4z.js";
5
+ import {
6
+ initializeIslandMarkupSnapshot
7
+ } from "../chunk-fak944et.js";
8
+ import"../chunk-97572s32.js";
9
+ import"../chunk-kvq01j35.js";
10
+ import"../chunk-pnscgw95.js";
11
+ import {
12
+ getStreamSwapRuntimeScript
13
+ } from "../chunk-s6defjk2.js";
14
+ import"../chunk-p5504p14.js";
15
+ import"../chunk-25v9t56f.js";
16
+ import"../chunk-2f21eenc.js";
17
+ import {
18
+ createIslandStore,
19
+ getIslandStoreServerSnapshot,
20
+ initializeIslandStores,
21
+ readIslandStore,
22
+ subscribeIslandStore
23
+ } from "../chunk-fygx2ymm.js";
24
+ import {
25
+ getIslandComponent,
26
+ parseIslandProps
27
+ } from "../chunk-8kcfffry.js";
28
+ import {
29
+ getIslandManifestEntries,
30
+ getIslandManifestKey
31
+ } from "../chunk-3yjzpcne.js";
32
+ import"../chunk-bmgqm774.js";
914
33
 
915
34
  // src/client/islandResolver.ts
916
35
  var createIslandManifestResolver = (manifest) => {
@@ -923,210 +42,11 @@ var createIslandManifestResolver = (manifest) => {
923
42
  return loadedModule.default;
924
43
  };
925
44
  };
926
- // node_modules/zustand/esm/vanilla.mjs
927
- var createStoreImpl = (createState) => {
928
- let state;
929
- const listeners = /* @__PURE__ */ new Set;
930
- const setState = (partial, replace) => {
931
- const nextState = typeof partial === "function" ? partial(state) : partial;
932
- if (!Object.is(nextState, state)) {
933
- const previousState = state;
934
- state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
935
- listeners.forEach((listener) => listener(state, previousState));
936
- }
937
- };
938
- const getState = () => state;
939
- const getInitialState = () => initialState;
940
- const subscribe = (listener) => {
941
- listeners.add(listener);
942
- return () => listeners.delete(listener);
943
- };
944
- const api = { setState, getState, getInitialState, subscribe };
945
- const initialState = state = createState(setState, getState, api);
946
- return api;
947
- };
948
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
949
-
950
- // node_modules/zustand/esm/middleware.mjs
951
- function combine(initialState, create) {
952
- return (...args) => Object.assign({}, initialState, create(...args));
953
- }
954
-
955
- // src/client/islandStore.ts
956
- var getIslandStoreSnapshot = () => {
957
- globalThis.__ABS_ISLAND_STATE__ ??= {};
958
- return globalThis.__ABS_ISLAND_STATE__;
959
- };
960
- var getIslandStores = () => {
961
- globalThis.__ABS_ISLAND_STORES__ ??= new Map;
962
- return globalThis.__ABS_ISLAND_STORES__;
963
- };
964
- var isSerializableValue = (value) => typeof value !== "function" && value !== undefined;
965
- var toSerializableState = (state) => Object.fromEntries(Object.entries(state).filter(([, value]) => isSerializableValue(value)));
966
- var applySnapshot = (store, snapshot) => {
967
- if (!snapshot) {
968
- return;
969
- }
970
- store.setState({
971
- ...store.getState(),
972
- ...snapshot
973
- });
974
- };
975
- var getPeerStores = (storeInstances, ownerStore) => [...storeInstances].filter((peer) => peer.store !== ownerStore);
976
- var syncIslandSnapshot = (storeId, state, storeInstances, ownerStore) => {
977
- const nextSnapshot = toSerializableState(state);
978
- getIslandStoreSnapshot()[storeId] = nextSnapshot;
979
- for (const peerStore of getPeerStores(storeInstances, ownerStore)) {
980
- peerStore.applyExternalSnapshot(nextSnapshot);
981
- }
982
- };
983
- var createIslandStore = (storeId, initialState, createState) => {
984
- const store = createStore(combine(initialState, createState));
985
- const stores = getIslandStores();
986
- const storeInstances = stores.get(storeId) ?? new Set;
987
- const initialSnapshot = getIslandStoreSnapshot()[storeId];
988
- applySnapshot(store, initialSnapshot);
989
- let isApplyingExternalSnapshot = false;
990
- const applyExternalSnapshot = (snapshot) => {
991
- isApplyingExternalSnapshot = true;
992
- applySnapshot(store, snapshot);
993
- };
994
- storeInstances.add({
995
- applyExternalSnapshot,
996
- store
997
- });
998
- stores.set(storeId, storeInstances);
999
- syncIslandSnapshot(storeId, store.getState(), storeInstances, store);
1000
- store.subscribe((state) => {
1001
- if (isApplyingExternalSnapshot) {
1002
- isApplyingExternalSnapshot = false;
1003
- return;
1004
- }
1005
- syncIslandSnapshot(storeId, state, storeInstances, store);
1006
- });
1007
- return store;
1008
- };
1009
- var getIslandStoreServerSnapshot = (store, selector) => selector(store.getInitialState());
1010
- var applySnapshotToStoreInstances = (storeId, instances, snapshot) => {
1011
- for (const instance of instances) {
1012
- instance.applyExternalSnapshot(snapshot[storeId] ?? {});
1013
- }
1014
- };
1015
- var initializeIslandStores = (state) => {
1016
- const currentSnapshot = getIslandStoreSnapshot();
1017
- const nextSnapshot = {
1018
- ...state,
1019
- ...currentSnapshot
1020
- };
1021
- globalThis.__ABS_ISLAND_STATE__ = nextSnapshot;
1022
- for (const [storeId, store] of getIslandStores()) {
1023
- applySnapshotToStoreInstances(storeId, store, nextSnapshot);
1024
- }
1025
- };
1026
- var readIslandStore = (store, selector) => selector(store.getState());
1027
- var subscribeIslandStore = (store, selector, listener) => {
1028
- let currentSelection = selector(store.getState());
1029
- return store.subscribe((state) => {
1030
- const nextSelection = selector(state);
1031
- if (Object.is(nextSelection, currentSelection)) {
1032
- return;
1033
- }
1034
- currentSelection = nextSelection;
1035
- listener(nextSelection);
1036
- });
1037
- };
1038
45
  // src/client/islandRuntime.ts
1039
- init_islands();
1040
- init_islands2();
1041
46
  import { createElement } from "react";
1042
47
  import { hydrateRoot } from "react-dom/client";
1043
48
  import { hydrate as hydrateSvelte } from "svelte";
1044
49
  import { createSSRApp, h } from "vue";
1045
-
1046
- // src/client/preserveIslandMarkup.ts
1047
- init_islandMarkupAttributes();
1048
- var getClaimMap = () => {
1049
- if (typeof window === "undefined") {
1050
- return null;
1051
- }
1052
- window.__ABS_CLAIMED_ISLAND_MARKUP__ ??= new Map;
1053
- return window.__ABS_CLAIMED_ISLAND_MARKUP__;
1054
- };
1055
- var getSnapshotMap = () => {
1056
- if (typeof window === "undefined") {
1057
- return null;
1058
- }
1059
- window.__ABS_SERVER_ISLAND_HTML__ ??= new Map;
1060
- return window.__ABS_SERVER_ISLAND_HTML__;
1061
- };
1062
- var getIslandSignature = (props) => {
1063
- const attributes = getIslandMarkerAttributes(props);
1064
- return [
1065
- attributes["data-component"],
1066
- attributes["data-framework"],
1067
- attributes["data-hydrate"],
1068
- attributes["data-props"]
1069
- ].join("::");
1070
- };
1071
- var isMatchingIslandElement = (element, props) => {
1072
- if (!(element instanceof HTMLElement)) {
1073
- return false;
1074
- }
1075
- const attributes = getIslandMarkerAttributes(props);
1076
- return element.dataset.island === "true" && element.dataset.component === attributes["data-component"] && element.dataset.framework === attributes["data-framework"] && (element.dataset.hydrate ?? "load") === attributes["data-hydrate"] && (element.dataset.props ?? "{}") === attributes["data-props"];
1077
- };
1078
- var snapshotIslandElement = (element, snapshotMap) => {
1079
- const signature = [
1080
- element.dataset.component,
1081
- element.dataset.framework,
1082
- element.dataset.hydrate ?? "load",
1083
- element.dataset.props ?? "{}"
1084
- ].join("::");
1085
- const existing = snapshotMap.get(signature) ?? [];
1086
- const attributes = Object.fromEntries(element.getAttributeNames().map((name) => [name, element.getAttribute(name) ?? ""]));
1087
- existing.push({
1088
- attributes,
1089
- innerHTML: element.innerHTML
1090
- });
1091
- snapshotMap.set(signature, existing);
1092
- };
1093
- var initializeIslandMarkupSnapshot = () => {
1094
- if (typeof document === "undefined") {
1095
- return;
1096
- }
1097
- const snapshotMap = getSnapshotMap();
1098
- if (!snapshotMap || snapshotMap.size > 0) {
1099
- return;
1100
- }
1101
- const elements = Array.from(document.querySelectorAll('[data-island="true"]'));
1102
- for (const element of elements) {
1103
- snapshotIslandElement(element, snapshotMap);
1104
- }
1105
- };
1106
- var preserveIslandMarkup = (props) => {
1107
- if (typeof document === "undefined") {
1108
- return {
1109
- attributes: getIslandMarkerAttributes(props),
1110
- innerHTML: ""
1111
- };
1112
- }
1113
- const claimMap = getClaimMap();
1114
- const snapshotMap = getSnapshotMap();
1115
- const signature = getIslandSignature(props);
1116
- const claimedCount = claimMap?.get(signature) ?? 0;
1117
- const snapshotCandidate = snapshotMap?.get(signature)?.[claimedCount];
1118
- const candidates = Array.from(document.querySelectorAll('[data-island="true"]')).filter((element) => isMatchingIslandElement(element, props));
1119
- const candidate = candidates[claimedCount];
1120
- if (claimMap) {
1121
- claimMap.set(signature, claimedCount + 1);
1122
- }
1123
- return {
1124
- attributes: snapshotCandidate?.attributes ?? getIslandMarkerAttributes(props),
1125
- innerHTML: snapshotCandidate?.innerHTML ?? candidate?.innerHTML ?? ""
1126
- };
1127
- };
1128
-
1129
- // src/client/islandRuntime.ts
1130
50
  initializeIslandMarkupSnapshot();
1131
51
  var idleDeadline = {
1132
52
  didTimeout: false,
@@ -1302,5 +222,5 @@ export {
1302
222
  createIslandManifestResolver
1303
223
  };
1304
224
 
1305
- //# debugId=0D5156B49C23ACD164756E2164756E21
225
+ //# debugId=8C111D439F8E329764756E2164756E21
1306
226
  //# sourceMappingURL=index.js.map