@altertable/data-app 0.68.0 → 0.69.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 (175) hide show
  1. package/AGENTS.md +6 -0
  2. package/CONTRIBUTING.md +27 -1
  3. package/README.md +18 -21
  4. package/THIRD_PARTY_NOTICES +18 -0
  5. package/dist/chunks/index-22d576sn.js +153 -0
  6. package/dist/chunks/index-22d576sn.js.map +11 -0
  7. package/dist/chunks/{index-ktmvs916.js → index-2sbp9h2b.js} +37 -21
  8. package/dist/chunks/index-2sbp9h2b.js.map +13 -0
  9. package/dist/chunks/{index-23dktynd.js → index-ap60vggk.js} +4 -4
  10. package/dist/chunks/{index-m6n8ctfc.js → index-cv36cyna.js} +4 -4
  11. package/dist/chunks/index-cv36cyna.js.map +10 -0
  12. package/dist/chunks/{index-ag0cgnvq.js → index-k766wwwr.js} +13 -9
  13. package/dist/chunks/index-k766wwwr.js.map +13 -0
  14. package/dist/chunks/{index-mt93ff2b.js → index-kwnqycjt.js} +2 -2
  15. package/dist/chunks/index-kwnqycjt.js.map +10 -0
  16. package/dist/chunks/index-m0gbxtgp.js +355 -0
  17. package/dist/chunks/index-m0gbxtgp.js.map +13 -0
  18. package/dist/chunks/{index-gvers8jw.js → index-qhzdzca2.js} +3709 -2170
  19. package/dist/chunks/index-qhzdzca2.js.map +118 -0
  20. package/dist/chunks/{index-x69p7cv7.js → index-r7b1ftwy.js} +3 -3
  21. package/dist/chunks/index-r7b1ftwy.js.map +10 -0
  22. package/dist/chunks/{index-ev2b5aaf.js → index-sx488hvs.js} +4 -4
  23. package/dist/chunks/{index-f5cnbrjz.js → index-wss3gd3h.js} +39 -9
  24. package/dist/chunks/index-wss3gd3h.js.map +13 -0
  25. package/dist/chunks/{index-qd5xgx6y.js → index-zcqxfwdq.js} +5 -12
  26. package/dist/chunks/index-zcqxfwdq.js.map +13 -0
  27. package/dist/client/index.js +6 -6
  28. package/dist/core/appearance.js +1 -1
  29. package/dist/core/config.js +3 -3
  30. package/dist/core/contract.js +3 -3
  31. package/dist/core/format.js +10 -2
  32. package/dist/core/format.js.map +1 -1
  33. package/dist/embed/index.js +26 -25
  34. package/dist/embed/index.js.map +4 -4
  35. package/dist/index.js +3 -3
  36. package/dist/local.js +166 -144
  37. package/dist/local.js.map +8 -7
  38. package/dist/preview.js +1456 -0
  39. package/dist/preview.js.map +17 -0
  40. package/dist/react/embed/index.js +1 -1
  41. package/dist/react/index.js +250 -93
  42. package/dist/react/index.js.map +10 -10
  43. package/dist/react/ui/index.js +1168 -1165
  44. package/dist/react/ui/index.js.map +13 -11
  45. package/dist/server.js +68 -57
  46. package/dist/server.js.map +7 -6
  47. package/dist/types/client/download.d.ts +5 -0
  48. package/dist/types/client/iframe.d.ts +4 -2
  49. package/dist/types/client/logger.d.ts +10 -2
  50. package/dist/types/core/annotations.d.ts +5 -0
  51. package/dist/types/core/appearance.d.ts +2 -0
  52. package/dist/types/core/bridge-endpoint.d.ts +2 -2
  53. package/dist/types/core/bridge.d.ts +22 -0
  54. package/dist/types/core/config.d.ts +5 -0
  55. package/dist/types/core/contract.d.ts +3 -1
  56. package/dist/types/core/date-format.d.ts +24 -0
  57. package/dist/types/core/dimension.d.ts +2 -1
  58. package/dist/types/core/filters.d.ts +4 -3
  59. package/dist/types/core/format.d.ts +5 -3
  60. package/dist/types/core/messages.d.ts +3 -1
  61. package/dist/types/core/operation-types.d.ts +7 -7
  62. package/dist/types/core/time-interval.d.ts +96 -0
  63. package/dist/types/core/variables.d.ts +13 -4
  64. package/dist/types/embed/host.d.ts +4 -4
  65. package/dist/types/react/annotations/annotation-editor-state.d.ts +2 -0
  66. package/dist/types/react/annotations/annotation-targets.d.ts +1 -0
  67. package/dist/types/react/annotations/getAnnotationProps.d.ts +5 -3
  68. package/dist/types/react/annotations/useAnnotationGeometry.d.ts +2 -2
  69. package/dist/types/react/bindings.d.ts +26 -3
  70. package/dist/types/react/date-formatting.d.ts +12 -0
  71. package/dist/types/react/hooks.d.ts +10 -9
  72. package/dist/types/react/index.d.ts +7 -2
  73. package/dist/types/react/search-suggestions.d.ts +8 -0
  74. package/dist/types/react/style-contract.d.ts +1 -5
  75. package/dist/types/react/ui/ChartLegend.d.ts +3 -2
  76. package/dist/types/react/ui/ChoicePicker.d.ts +2 -0
  77. package/dist/types/react/ui/DataApp.d.ts +5 -4
  78. package/dist/types/react/ui/DataAppFrame.d.ts +14 -3
  79. package/dist/types/react/ui/DataTable.d.ts +6 -4
  80. package/dist/types/react/ui/DataWidget.d.ts +4 -0
  81. package/dist/types/react/ui/DateDisplay.d.ts +9 -0
  82. package/dist/types/react/ui/DateRangePicker.d.ts +3 -1
  83. package/dist/types/react/ui/DateTimeTooltip.d.ts +3 -2
  84. package/dist/types/react/ui/DimensionPicker.d.ts +3 -1
  85. package/dist/types/react/ui/EmptyState.d.ts +1 -1
  86. package/dist/types/react/ui/GradientScroll.d.ts +8 -0
  87. package/dist/types/react/ui/Grid.d.ts +1 -1
  88. package/dist/types/react/ui/MetricWidget.d.ts +2 -0
  89. package/dist/types/react/ui/NumberFilterPicker.d.ts +3 -1
  90. package/dist/types/react/ui/PeriodSummary.d.ts +2 -1
  91. package/dist/types/react/ui/PickerField.d.ts +15 -0
  92. package/dist/types/react/ui/PopoverSurface.d.ts +5 -0
  93. package/dist/types/react/ui/RequestHint.d.ts +2 -2
  94. package/dist/types/react/ui/SearchField.d.ts +3 -1
  95. package/dist/types/react/ui/SearchTypeahead.d.ts +15 -0
  96. package/dist/types/react/ui/SectionHeading.d.ts +8 -0
  97. package/dist/types/react/ui/Select.d.ts +5 -1
  98. package/dist/types/react/ui/Sheet.d.ts +3 -1
  99. package/dist/types/react/ui/TableWidget.d.ts +8 -0
  100. package/dist/types/react/ui/Tabs.d.ts +4 -3
  101. package/dist/types/react/ui/VariableBar.d.ts +1 -1
  102. package/dist/types/react/ui/VisualizationWidget.d.ts +1 -1
  103. package/dist/types/react/ui/chart-date-axis.d.ts +15 -0
  104. package/dist/types/react/ui/chart-interaction.d.ts +21 -0
  105. package/dist/types/react/ui/chart-primitives.d.ts +4 -4
  106. package/dist/types/react/ui/chart-time.d.ts +16 -0
  107. package/dist/types/react/ui/chartColor.d.ts +1 -1
  108. package/dist/types/react/ui/icons.d.ts +3 -1
  109. package/dist/types/react/ui/index.d.ts +8 -4
  110. package/dist/types/react/ui/metric-comparison.d.ts +2 -2
  111. package/dist/types/react/ui/metric.d.ts +2 -2
  112. package/dist/types/react/ui/presentation.d.ts +2 -0
  113. package/dist/types/react/ui/searchItems.d.ts +2 -0
  114. package/dist/types/react/ui/variables.d.ts +1 -1
  115. package/dist/types/react/view-control-bar.d.ts +16 -0
  116. package/dist/types/react/view-controls.d.ts +3 -2
  117. package/dist/types/react/view-runtime.d.ts +3 -1
  118. package/dist/types/react/view.d.ts +14 -2
  119. package/dist/types/server/local.d.ts +3 -1
  120. package/dist/types/server/preview/host.d.ts +1 -0
  121. package/dist/types/server/preview/index.d.ts +16 -0
  122. package/dist/types/server/reload-channel.d.ts +6 -0
  123. package/dist/types/server/request-body.d.ts +4 -0
  124. package/dist/worker.js +1 -1
  125. package/docs/app-authoring.md +17 -9
  126. package/docs/client.md +1 -1
  127. package/docs/contract.md +8 -9
  128. package/docs/embed.md +11 -3
  129. package/docs/formatting-and-appearance.md +36 -5
  130. package/docs/layout.md +31 -8
  131. package/docs/react-embed.md +4 -4
  132. package/docs/react.md +1 -1
  133. package/docs/server-bun.md +25 -0
  134. package/docs/server.md +1 -1
  135. package/docs/styling.md +7 -28
  136. package/docs/ui.md +21 -18
  137. package/docs/variables.md +92 -15
  138. package/docs/views.md +13 -36
  139. package/docs/widgets.md +38 -26
  140. package/examples/starter-data-app/index.tsx +0 -1
  141. package/examples/starter-local-data-app/.bun-version +1 -0
  142. package/examples/starter-local-data-app/.node-version +1 -0
  143. package/examples/starter-local-data-app/.oxfmtrc.json +4 -0
  144. package/examples/starter-local-data-app/.oxlintrc.json +33 -0
  145. package/examples/starter-local-data-app/AGENTS.md +22 -0
  146. package/examples/starter-local-data-app/README.md +54 -0
  147. package/examples/starter-local-data-app/app.ts +22 -0
  148. package/examples/starter-local-data-app/bunfig.toml +2 -0
  149. package/examples/starter-local-data-app/package.json +33 -0
  150. package/examples/starter-local-data-app/src/App.tsx +8 -0
  151. package/examples/starter-local-data-app/src/assets.d.ts +1 -0
  152. package/examples/starter-local-data-app/src/data-context.ts +21 -0
  153. package/examples/starter-local-data-app/src/favicon.svg +13 -0
  154. package/examples/starter-local-data-app/src/index.html +14 -0
  155. package/examples/starter-local-data-app/src/main.tsx +7 -0
  156. package/examples/starter-local-data-app/src/operations.ts +6 -0
  157. package/examples/starter-local-data-app/src/server.ts +6 -0
  158. package/examples/starter-local-data-app/tsconfig.json +15 -0
  159. package/package.json +13 -3
  160. package/dist/chunks/index-ag0cgnvq.js.map +0 -13
  161. package/dist/chunks/index-dq7b35fn.js +0 -307
  162. package/dist/chunks/index-dq7b35fn.js.map +0 -13
  163. package/dist/chunks/index-f5cnbrjz.js.map +0 -13
  164. package/dist/chunks/index-gvers8jw.js.map +0 -109
  165. package/dist/chunks/index-ktmvs916.js.map +0 -13
  166. package/dist/chunks/index-m6n8ctfc.js.map +0 -10
  167. package/dist/chunks/index-mev09s5v.js +0 -77
  168. package/dist/chunks/index-mev09s5v.js.map +0 -10
  169. package/dist/chunks/index-mt93ff2b.js.map +0 -10
  170. package/dist/chunks/index-qd5xgx6y.js.map +0 -13
  171. package/dist/chunks/index-x69p7cv7.js.map +0 -10
  172. package/dist/types/react/shellStyles.d.ts +0 -3
  173. package/dist/types/react/ui/DataAppSkeleton.d.ts +0 -7
  174. /package/dist/chunks/{index-23dktynd.js.map → index-ap60vggk.js.map} +0 -0
  175. /package/dist/chunks/{index-ev2b5aaf.js.map → index-sx488hvs.js.map} +0 -0
@@ -0,0 +1,355 @@
1
+ import {
2
+ randomUuid,
3
+ PARENT_PARAM,
4
+ MAX_PENDING,
5
+ REQUEST_TIMEOUT_MS,
6
+ validId,
7
+ createBridgeEndpoint
8
+ } from "./index-wss3gd3h.js";
9
+ import {
10
+ MessageRoutingError2
11
+ } from "./index-zcqxfwdq.js";
12
+
13
+ // src/embed/host.ts
14
+ function attachDataAppConnection({
15
+ iframe,
16
+ connection,
17
+ javascript,
18
+ presentation,
19
+ logger,
20
+ onStatusChange,
21
+ onDiagnostic,
22
+ onMessage,
23
+ window: host = window
24
+ }) {
25
+ const frameOrigin = connection.type === "origin" ? connection.origin : "null";
26
+ if (connection.type === "origin" && new URL(frameOrigin).origin !== frameOrigin)
27
+ throw new Error("Expected an exact frame origin.");
28
+ if (connection.type === "opaque" && !validId(connection.token))
29
+ throw new Error("Invalid sandbox token.");
30
+ let token = connection.type === "opaque" ? connection.token : undefined;
31
+ const targetOrigin = connection.type === "opaque" ? "*" : frameOrigin;
32
+ let currentPresentation;
33
+ let presentationIdentity;
34
+ let annotationDismissal;
35
+ let disposed = false;
36
+ let documentId;
37
+ let sessionId;
38
+ const pending = new Map;
39
+ const requestStartedAt = new Map;
40
+ function reportDiagnostic(event) {
41
+ if (!onDiagnostic)
42
+ return;
43
+ if (event.direction === "drop" || !event.id)
44
+ return onDiagnostic(event);
45
+ switch (event.type) {
46
+ case "bridge:request":
47
+ if (!requestStartedAt.has(event.id) && requestStartedAt.size < MAX_PENDING * 2)
48
+ requestStartedAt.set(event.id, host.performance.now());
49
+ break;
50
+ case "bridge:cancel":
51
+ requestStartedAt.delete(event.id);
52
+ break;
53
+ case "bridge:result":
54
+ case "bridge:error": {
55
+ const startedAt = requestStartedAt.get(event.id);
56
+ requestStartedAt.delete(event.id);
57
+ if (startedAt !== undefined)
58
+ return onDiagnostic({
59
+ ...event,
60
+ durationMs: Math.round(host.performance.now() - startedAt)
61
+ });
62
+ break;
63
+ }
64
+ }
65
+ onDiagnostic(event);
66
+ }
67
+ function hostState() {
68
+ const presentation = currentPresentation?.annotations && annotationDismissal ? {
69
+ ...currentPresentation,
70
+ annotations: {
71
+ ...currentPresentation.annotations,
72
+ dismissal: annotationDismissal
73
+ }
74
+ } : currentPresentation;
75
+ return {
76
+ search: host.location.search,
77
+ hash: host.location.hash,
78
+ ...presentation ? { presentation } : {},
79
+ logging: logger !== undefined
80
+ };
81
+ }
82
+ function setLogger(value) {
83
+ if (disposed || value === logger)
84
+ return;
85
+ const wasEnabled = logger !== undefined;
86
+ logger = value;
87
+ if (wasEnabled !== (logger !== undefined))
88
+ publishState();
89
+ }
90
+ function setPresentation(value) {
91
+ if (disposed)
92
+ return;
93
+ const identity = JSON.stringify(value);
94
+ if (identity === presentationIdentity)
95
+ return;
96
+ presentationIdentity = identity;
97
+ currentPresentation = identity === undefined ? undefined : JSON.parse(identity);
98
+ publishState();
99
+ }
100
+ function cancelAll() {
101
+ for (const controller of pending.values())
102
+ controller.abort();
103
+ pending.clear();
104
+ requestStartedAt.clear();
105
+ }
106
+ const endpoint = createBridgeEndpoint({
107
+ role: "host",
108
+ origin: frameOrigin,
109
+ source: () => iframe.contentWindow,
110
+ opaque: connection.type === "opaque",
111
+ context: () => ({ documentId, sessionId, token }),
112
+ post: (message) => iframe.contentWindow?.postMessage(message, targetOrigin),
113
+ diagnostic: reportDiagnostic,
114
+ invalidRequest: (id) => {
115
+ if (pending.has(id))
116
+ return;
117
+ if (pending.size >= MAX_PENDING)
118
+ error(id, "bridge_busy", "Too many pending data requests.");
119
+ else
120
+ error(id, "invalid_message", "Invalid message route.");
121
+ },
122
+ handlers: {
123
+ ready(message) {
124
+ if (message.documentId !== documentId) {
125
+ cancelAll();
126
+ documentId = message.documentId;
127
+ sessionId = randomUuid();
128
+ }
129
+ onStatusChange?.("connected");
130
+ if (disposed)
131
+ return;
132
+ send("initialize", { state: hostState() });
133
+ if (disposed)
134
+ return;
135
+ if (javascript !== undefined)
136
+ send("scriptLoad", { javascript });
137
+ },
138
+ runtimeLog({ payload }) {
139
+ try {
140
+ logger?.[payload.method](...payload.args);
141
+ } catch {}
142
+ },
143
+ runtimeReady() {
144
+ onStatusChange?.("ready");
145
+ },
146
+ runtimeError() {
147
+ onStatusChange?.("failed");
148
+ },
149
+ request(message) {
150
+ request(message);
151
+ },
152
+ cancel(message) {
153
+ pending.get(message.id)?.abort();
154
+ pending.delete(message.id);
155
+ },
156
+ disconnect() {
157
+ cancelAll();
158
+ documentId = undefined;
159
+ sessionId = undefined;
160
+ onStatusChange?.("disconnected");
161
+ }
162
+ }
163
+ });
164
+ const send = endpoint.send;
165
+ const receive = endpoint.receive;
166
+ function error(id, code, message, requestId) {
167
+ send("error", { id, code, message, requestId });
168
+ }
169
+ async function request(message) {
170
+ const id = message.id;
171
+ if (pending.has(id))
172
+ return;
173
+ if (pending.size >= MAX_PENDING)
174
+ return error(id, "bridge_busy", "Too many pending data requests.");
175
+ try {
176
+ const body = JSON.stringify(message.payload);
177
+ const limit = message.route === "annotation:draft" ? 384000 : 16384;
178
+ if (message.payload !== undefined && (typeof body !== "string" || body.length > limit))
179
+ throw new Error("Invalid payload");
180
+ } catch {
181
+ return error(id, "invalid_payload", "The message payload is invalid or too large.");
182
+ }
183
+ const controller = new AbortController;
184
+ pending.set(id, controller);
185
+ const timer = setTimeout(() => {
186
+ if (pending.get(id) !== controller)
187
+ return;
188
+ pending.delete(id);
189
+ controller.abort();
190
+ error(id, "timeout", "The data request timed out.");
191
+ }, REQUEST_TIMEOUT_MS);
192
+ controller.signal.addEventListener("abort", () => clearTimeout(timer), {
193
+ once: true
194
+ });
195
+ try {
196
+ const response = await onMessage({ route: message.route, payload: message.payload }, { signal: controller.signal });
197
+ if (pending.get(id) === controller)
198
+ send("result", { id, response });
199
+ } catch (failure) {
200
+ if (pending.get(id) === controller) {
201
+ if (failure instanceof MessageRoutingError2)
202
+ error(id, failure.code, failure.message, failure.requestId);
203
+ else
204
+ error(id, "request_failed", "The message request failed. Retry the request.");
205
+ }
206
+ } finally {
207
+ clearTimeout(timer);
208
+ if (pending.get(id) === controller)
209
+ pending.delete(id);
210
+ }
211
+ }
212
+ function publishState() {
213
+ if (disposed || !sessionId)
214
+ return;
215
+ send("stateUpdate", { state: hostState() });
216
+ }
217
+ function publishAnnotationDismissal(event) {
218
+ if (!currentPresentation?.annotations?.enabled || event.composedPath().includes(iframe))
219
+ return;
220
+ annotationDismissal = {
221
+ id: randomUuid(),
222
+ occurredAt: host.performance.timeOrigin + host.performance.now()
223
+ };
224
+ publishState();
225
+ }
226
+ function load() {
227
+ if (connection.type === "opaque")
228
+ token = randomUuid();
229
+ cancelAll();
230
+ documentId = undefined;
231
+ sessionId = undefined;
232
+ onStatusChange?.("connecting");
233
+ send("connect", {});
234
+ }
235
+ function dispose() {
236
+ disposed = true;
237
+ endpoint.dispose();
238
+ cancelAll();
239
+ iframe.removeEventListener("load", load);
240
+ host.removeEventListener("message", receive);
241
+ host.removeEventListener("popstate", publishState);
242
+ host.removeEventListener("pagehide", cancelAll);
243
+ host.removeEventListener("click", publishAnnotationDismissal, true);
244
+ }
245
+ setPresentation(presentation);
246
+ iframe.addEventListener("load", load);
247
+ host.addEventListener("message", receive);
248
+ host.addEventListener("popstate", publishState);
249
+ host.addEventListener("pagehide", cancelAll);
250
+ host.addEventListener("click", publishAnnotationDismissal, true);
251
+ onStatusChange?.("connecting");
252
+ send("connect", {});
253
+ return { dispose, setPresentation, setLogger };
254
+ }
255
+
256
+ // src/embed/runtime-html.ts
257
+ var PAGE_CSP = "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; connect-src 'none'; form-action 'none'; base-uri 'none'";
258
+ var inlineBootstrap = '(()=>{function D(){if(typeof crypto.randomUUID==="function")return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,(n)=>n.toString(16).padStart(2,"0"));return[t.slice(0,4),t.slice(4,6),t.slice(6,8),t.slice(8,10),t.slice(10)].map((n)=>n.join("")).join("-")}function Z(e){if(!e||typeof e!=="object")return!1;let t=e;return(t.method==="log"||t.method==="info"||t.method==="warn"||t.method==="error")&&Array.isArray(t.args)&&t.args.length<=128}var F="altertable:data-app";var Y=128,ee=60000;function P(e){return typeof e==="string"&&/^[a-zA-Z0-9_-]{1,128}$/.test(e)}function w({wire:e,from:t,session:n,parse:r}){return{wire:e,from:t,session:n,parse:r}}function L(e){if(!P(e.id))throw Error("Invalid request ID.");return e.id}function S(e,t){let n=e[t];if(typeof n!=="string")throw Error(`Invalid ${t}.`);return n}function j(){return{}}var h={channel:F,version:1,events:{connect:w({wire:"bridge:connect",from:"host",session:"none",parse:j}),ready:w({wire:"bridge:ready",from:"app",session:"none",parse:j}),initialize:w({wire:"bridge:initialize",from:"host",session:"establish",parse:(e)=>({state:e.state})}),request:w({wire:"bridge:request",from:"app",session:"current",parse:(e)=>{let t=S(e,"route");if(!t||t.length>256)throw Error("Invalid message route.");return{id:L(e),route:t,payload:e.payload}}}),result:w({wire:"bridge:result",from:"host",session:"current",parse:(e)=>{if(!Object.hasOwn(e,"response"))throw Error("Missing response.");return{id:L(e),response:e.response}}}),error:w({wire:"bridge:error",from:"host",session:"current",parse:(e)=>{if(e.requestId!==void 0&&typeof e.requestId!=="string")throw Error("Invalid requestId.");return{id:L(e),code:S(e,"code"),message:S(e,"message"),...e.requestId===void 0?{}:{requestId:e.requestId}}}}),cancel:w({wire:"bridge:cancel",from:"app",session:"current",parse:(e)=>({id:L(e)})}),disconnect:w({wire:"bridge:disconnect",from:"app",session:"current",parse:j}),scriptLoad:w({wire:"script:load",from:"host",session:"current",parse:(e)=>({javascript:S(e,"javascript")})}),stateUpdate:w({wire:"state:update",from:"host",session:"current",parse:(e)=>({state:e.state})}),runtimeLog:w({wire:"runtime:log",from:"app",session:"current",parse:(e)=>{if(!Z(e.payload))throw Error("Invalid log entry.");return{payload:e.payload}}}),runtimeReady:w({wire:"runtime:ready",from:"app",session:"current",parse:j}),runtimeError:w({wire:"runtime:error",from:"app",session:"current",parse:j})}};function W(e){let t={type:e.type};if("id"in e)t.id=e.id;if(e.type==="bridge:request"){t.route=e.route;let n=e.payload;if(e.route==="data:query"&&n&&typeof n==="object"&&"operation"in n&&typeof n.operation==="string")t.operation=n.operation.slice(0,256)}if(e.type==="bridge:error")t.error={code:e.code,message:e.message,...e.requestId===void 0?{}:{requestId:e.requestId}};return t}var C=new Map;for(let e of Object.keys(h.events)){let t=h.events[e].wire;if(C.has(t))throw Error(`Duplicate bridge event: ${t}`);C.set(t,e)}function z(e){return C.get(e)}function V(e){if(!e||typeof e!=="object")return;let t=e;if(t.channel!==F||t.version!==h.version||typeof t.type!=="string"||typeof t.documentId!=="string"||!t.documentId||t.documentId.length>128||t.sessionId!==void 0&&!P(t.sessionId)||t.token!==void 0&&typeof t.token!=="string")return;return t}function H(e,t){try{return{channel:F,version:h.version,documentId:e.documentId,...e.sessionId===void 0?{}:{sessionId:e.sessionId},...e.token===void 0?{}:{token:e.token},type:t.wire,...t.parse(e)}}catch{return}}function te(e){let t=V(e);if(!t)return;let n=z(t.type);if(!n)return;let r=h.events[n];if(r.session!=="none"&&t.sessionId===void 0)return;return H(t,r)}function ne({role:e,origin:t,source:n,opaque:r,context:o,post:a,diagnostic:l,invalidRequest:u,handlers:f}){let c=!1;function i(y,p){l?.({direction:"drop",reason:y,...typeof p==="string"?{type:p.slice(0,64)}:{}})}function v(y,p){if(c)throw Error("The bridge endpoint has closed.");let d=h.events[y],g=o(),x=te({...p,channel:h.channel,version:h.version,type:d.wire,documentId:y==="connect"?"host":g.documentId,sessionId:g.sessionId,token:r?g.token:void 0});if(!x||r&&!P(g.token))throw Error("The bridge is not ready to send this event.");if(l?.({direction:"send",...W(x)}),c)return;a(x)}function B(y){let p=n();if(c||!p||y.origin!==t||y.source!==p)return;let d=V(y.data);if(!d){let k=y.data;if(k&&typeof k==="object"&&"channel"in k&&k.channel===h.channel)i("invalid_envelope","type"in k?k.type:void 0);return}let g=o(),x=e==="app"&&d.type===h.events.connect.wire;if(r&&(x?!P(d.token):!g.token||d.token!==g.token))return i("token_mismatch",d.type);let M=z(d.type);if(!M)return i("unexpected_type",d.type);let T=h.events[M];if(T.from===e)return i("unexpected_type",d.type);if(T.session==="establish"){if(d.documentId!==g.documentId||d.sessionId===void 0)return i("session_mismatch",d.type)}else if(T.session==="current"){if(!g.sessionId||d.sessionId!==g.sessionId||d.documentId!==g.documentId)return i("session_mismatch",d.type)}let q=H(d,T);if(!q){if(i("invalid_payload",d.type),e==="host"&&M==="request"&&P(d.id))u?.(d.id);return}if(l?.({direction:"receive",...W(q)}),c)return;let Q=f[M];Q(q)}return{send:v,receive:B,dispose(){c=!0}}}function we(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&Number.isFinite(e)}function G(e){return!!e&&typeof e==="object"&&!Array.isArray(e)&&Object.values(e).every(we)}var re=Symbol.for("@altertable/data-app/MessageRoutingError");class I extends Error{code;requestId;[re]=!0;static[Symbol.hasInstance](e){return e instanceof Error&&e[re]===!0}constructor(e,t,n,r){super(t,r);this.code=e;this.requestId=n;this.name="MessageRoutingError"}}function he(e){return e}function oe(e){return{operations:e,input(t){if(!t||typeof t!=="object")throw Error("Invalid query.");let n=t;if(typeof n.operation!=="string"||!n.operation||n.operation.length>256||n.operation.includes("/"))throw Error("Invalid operation.");let r=e&&Object.hasOwn(e,n.operation)?e[n.operation]:void 0;if(e&&!r)throw Error("Unknown operation.");return{operation:n.operation,input:r?r.input(n.input):n.input}},output(t){if(!t||typeof t!=="object")throw Error("Invalid data response.");let n=t;if(!Number.isInteger(n.status)||n.status<100||n.status>599||!n.body||typeof n.body!=="object"||Array.isArray(n.body))throw Error("Invalid data response.");let r=n.body;if(n.status<200||n.status>=300){let o=r.error;throw new I(typeof o?.code==="string"?o.code:"request_failed",typeof o?.message==="string"?o.message:"Could not load data.",typeof o?.requestId==="string"?o.requestId:void 0)}if(!("data"in r)||typeof r.requestId!=="string"||typeof r.queriedAt!=="string"||!Array.isArray(r.queryIds)||!r.queryIds.every((o)=>typeof o==="string"))throw Error("Invalid data envelope.");if(r.queries!==void 0&&(!Array.isArray(r.queries)||!r.queries.every((o)=>o&&typeof o==="object"&&typeof o.name==="string"&&typeof o.statement==="string"&&(o.params===void 0||G(o.params))&&(o.queryId===void 0||typeof o.queryId==="string"))))throw Error("Invalid query evidence.");return{status:n.status,body:r}}}}var se=he({input(e){if(!e||typeof e!=="object")throw Error("Invalid SQL query.");let t=e;if(typeof t.statement!=="string"||!t.statement.trim()||typeof t.limit!=="number"||!Number.isSafeInteger(t.limit)||t.limit<1||t.params!==void 0&&!G(t.params))throw Error("Invalid SQL query.");return{statement:t.statement,limit:t.limit,...t.params===void 0?{}:{params:t.params}}},output(e,t){if(!e||typeof e!=="object")throw Error("Invalid query result.");let n=e;if(!Array.isArray(n.columns)||!n.columns.every((r)=>r&&typeof r.name==="string"&&(r.type===void 0||typeof r.type==="string"))||!Array.isArray(n.rows)||n.rows.length>t.limit||!n.rows.every((r)=>Array.isArray(r)&&r.length===n.columns.length)||n.queryId!==void 0&&typeof n.queryId!=="string")throw Error("Invalid query result.");return{columns:n.columns,rows:n.rows,...n.queryId===void 0?{}:{queryId:n.queryId}}}});function ie(e,t){return{async request(n,r,{signal:o}={}){if(o?.throwIfAborted(),!Object.hasOwn(e,n))throw new I("unknown_route","Unknown message route.");let a=e[n],l;try{l=a.input(r)}catch{throw new I("invalid_payload","Invalid message payload.")}let u=await t({route:n,payload:l},o);o?.throwIfAborted();try{return a.output(u,l)}catch(f){if(f instanceof I)throw f;throw new I("invalid_response","Invalid message response.")}}}}var ae=Symbol.for("@altertable/data-app/DataAppError");class R extends Error{code;requestId;[ae]=!0;static[Symbol.hasInstance](e){return e instanceof Error&&e[ae]===!0}constructor(e,t,n){super(e);this.code=t;this.requestId=n;this.name="DataAppError"}}function de(e,t){function n(o){if(o.length===1&&typeof o[0]==="function"){let a=o[0]();return Array.isArray(a)?a:[a]}return o.map((a)=>typeof a==="function"?a():a)}function r(o,a){if(!e())return;try{t({method:o,args:n(a)})}catch{}}return{log:(...o)=>r("log",o),info:(...o)=>r("info",o),warn:(...o)=>r("warn",o),error:(...o)=>r("error",o)}}var ve={send:"Sending message to parent",receive:"Received message from parent",drop:"Ignored message from parent"};function ue(e,{direction:t,...n}){if(n.type==="runtime:log")return;e.log(ve[t],n)}function pe(e){if(e instanceof Error)return{name:e.name,message:e.message,...e.stack?{stack:e.stack}:{}};return{message:String(e)}}function ce(e){if(e instanceof I)throw new R(e.message,e.code,e.requestId);throw e}function le({parentOrigin:e,window:t=window,timeoutMs:n=ee,mode:r="url",loadScript:o}){if(new URL(e).origin!==e)throw Error("Expected an exact parent origin.");let a=D(),l,u,f=!1,c=new Map,i,v=new Set,B=de(()=>!f&&!!u&&!!i&&typeof i==="object"&&("logging"in i)&&i.logging===!0,(s)=>p("runtimeLog",{payload:s})),y=ne({role:"app",origin:e,source:()=>t.parent,opaque:r==="bundle",context:()=>({documentId:a,sessionId:u,token:l}),post(s){t.parent.postMessage(s,e)},diagnostic:(s)=>ue(B,s),handlers:{connect(s){if(r==="bundle")l=s.token;p("ready",{})},initialize(s){if(u&&u!==s.sessionId){if(c.size)B.warn("Preview reconnected; rejecting pending requests",{count:c.size});for(let E of c.values())E.reject(new R("The preview reconnected. Retry the request.","bridge_reset"))}let m=!u;if(u=s.sessionId,g(s.state),m)for(let E of c.values())E.start();if(f)return;if(r==="url")p("runtimeReady",{})},stateUpdate(s){g(s.state)},scriptLoad(s){if(r==="bundle")o?.(s.javascript)},result(s){c.get(s.id)?.resolve(s.response)},error(s){c.get(s.id)?.reject(new I(s.code,s.message,s.requestId))}}}),{send:p,receive:d}=y;function g(s){i=s;for(let m of v)m(s)}t.addEventListener("message",d);function x(s,m){return new Promise((E,b)=>{if(f)return b(new R("The preview has closed.","bridge_closed"));if(m?.aborted)return b(m.reason);if(c.size>=Y)return b(new R("Too many pending data requests.","bridge_busy"));let O=D(),A=!1;function N(){clearTimeout(me),m?.removeEventListener("abort",X),c.delete(O)}function X(){if(A)p("cancel",{id:O});N(),b(m?.reason)}let me=setTimeout(()=>{if(B.warn("Message request timed out",{id:O,route:s.route,timeoutMs:n,sent:A}),A)p("cancel",{id:O});N(),b(new R(u?"The data request timed out.":"The preview shell is unavailable. Reload the preview.",u?"timeout":"bridge_unavailable"))},n),J={start(){if(A)return;try{p("request",{id:O,route:s.route,payload:s.payload}),A=!0}catch{N(),b(new R("The message payload could not be sent.","invalid_payload"))}},resolve(U){N(),E(U)},reject(U){N(),b(U)}};if(c.set(O,J),m?.addEventListener("abort",X,{once:!0}),u)J.start();else if(r==="url"||l)p("ready",{})})}let M=ie({"data:query":oe(),"data:sql":se},x);function T(s,m,E){return M.request("data:query",{operation:s,input:m},{signal:E}).catch(ce)}function q(){if(u)p("disconnect",{});u=void 0;for(let s of c.values())s.reject(new R("The preview has closed.","bridge_closed"))}function Q(s){if(s.persisted&&(r==="url"||l))p("ready",{})}function k(){if(f)return;q(),f=!0,y.dispose(),t.removeEventListener("message",d),t.removeEventListener("pagehide",q),t.removeEventListener("pageshow",Q),v.clear()}if(t.addEventListener("pagehide",q),t.addEventListener("pageshow",Q),r==="url")p("ready",{});return{logger:B,request:x,transport:T,lakehouse:{queryAll(s,{limit:m,signal:E,params:b}){return M.request("data:sql",{statement:s,limit:m,...b===void 0?{}:{params:b}},{signal:E}).catch(ce)}},dispose:k,mode:r,snapshot(){return i},subscribe(s){return v.add(s),()=>{v.delete(s)}},ready(){if(!f&&u)p("runtimeReady",{})},fail(s){if(f||!u)return;if(s!==void 0)B.error(()=>["Data app failed",pe(s)]);p("runtimeError",{})}}}var K=Symbol.for("altertable.localFrameBridge"),_=Symbol.for("altertable.installedTransport");function fe(e,t=window){let n=t;if(n[_])throw Error("A data app transport is already installed.");return n[K]=e,n[_]=e,()=>{if(n[K]===e)delete n[K];if(n[_]===e)delete n[_];e.dispose()}}function ge({parentOrigin:e,window:t=window}){let n,r,o=`altertable-data-app-${D()}.js`,a=le({parentOrigin:e,window:t,mode:"bundle",loadScript(i){if(n!==void 0){if(i!==n)a.fail(Error("This frame already evaluated a different app script."));else if(r)a.fail(r.cause);else a.ready();return}n=i;try{let v=t.document.createElement("script");if(v.textContent=`${i}\n//# sourceURL=${o}`,t.document.body.append(v),!r)a.ready()}catch(v){l(v)}}});function l(i){r={cause:i},a.fail(i)}function u(i){if(i.filename===o)l(i.error??i.message)}function f(i){if(i.reason instanceof Error&&i.reason.stack?.includes(o))l(i.reason)}t.addEventListener("error",u),t.addEventListener("unhandledrejection",f);let c=fe(a,t);return()=>{t.removeEventListener("error",u),t.removeEventListener("unhandledrejection",f),c()}}var ye=document.currentScript?.dataset.parentOrigin;if(!ye)throw Error("Missing trusted parent origin.");ge({parentOrigin:ye});})();\n'.replace(/<\/script/gi, (match) => `<\\${match.slice(1)}`);
259
+ function runtimeHtml(parentOrigin) {
260
+ const attribute = parentOrigin.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("'", "&#39;");
261
+ return `<!doctype html>
262
+ <html>
263
+ <head>
264
+ <meta charset="utf-8">
265
+ <meta name="viewport" content="width=device-width,initial-scale=1">
266
+ <meta http-equiv="Content-Security-Policy" content="${PAGE_CSP}">
267
+ </head>
268
+ <body>
269
+ <div id="root"></div>
270
+ <script data-parent-origin="${attribute}">${inlineBootstrap}</script>
271
+ </body>
272
+ </html>
273
+ `;
274
+ }
275
+
276
+ // src/embed/source.ts
277
+ function attachDataAppSource({
278
+ iframe,
279
+ source,
280
+ presentation,
281
+ logger,
282
+ onMessage,
283
+ onStatusChange,
284
+ onDiagnostic,
285
+ startupTimeoutMs = 30000
286
+ }) {
287
+ const host = iframe.ownerDocument.defaultView;
288
+ if (!host)
289
+ throw new Error("The iframe requires a host window.");
290
+ const url = new URL(source.type === "url" ? source.url : source.bootstrapUrl ?? `data:text/html;charset=utf-8,${encodeURIComponent(runtimeHtml(host.location.origin))}`, host.location.href);
291
+ if (!(source.type === "bundle" && source.bootstrapUrl === undefined) && !/^https?:$/.test(url.protocol))
292
+ throw new Error("Data apps require an HTTP(S) URL.");
293
+ const opaque = source.type === "bundle";
294
+ if (!opaque && url.origin === host.location.origin)
295
+ throw new Error("URL data apps require a separate origin from the host.");
296
+ iframe.setAttribute("sandbox", opaque ? "allow-scripts" : "allow-scripts allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox");
297
+ iframe.referrerPolicy = "no-referrer";
298
+ if (!opaque)
299
+ url.searchParams.set(PARENT_PARAM, host.location.origin);
300
+ let timer;
301
+ let failed = false;
302
+ function status(value) {
303
+ if (value === "connecting")
304
+ failed = false;
305
+ if (failed && value !== "connecting")
306
+ return;
307
+ clearTimeout(timer);
308
+ if (value === "connecting" || value === "connected")
309
+ timer = setTimeout(() => {
310
+ failed = true;
311
+ bridge.dispose();
312
+ onStatusChange?.("failed");
313
+ }, startupTimeoutMs);
314
+ if (value === "failed") {
315
+ failed = true;
316
+ bridge.dispose();
317
+ }
318
+ onStatusChange?.(value);
319
+ }
320
+ const bridge = attachDataAppConnection({
321
+ iframe,
322
+ connection: opaque ? { type: "opaque", token: randomUuid() } : { type: "origin", origin: url.origin },
323
+ javascript: opaque ? source.javascript : undefined,
324
+ presentation,
325
+ logger,
326
+ onMessage,
327
+ onStatusChange: status,
328
+ onDiagnostic,
329
+ window: host
330
+ });
331
+ function error() {
332
+ return status("failed");
333
+ }
334
+ iframe.addEventListener("error", error);
335
+ iframe.src = url.href;
336
+ function dispose() {
337
+ clearTimeout(timer);
338
+ iframe.removeEventListener("error", error);
339
+ bridge.dispose();
340
+ }
341
+ return {
342
+ dispose,
343
+ setPresentation: bridge.setPresentation,
344
+ setLogger: bridge.setLogger
345
+ };
346
+ }
347
+
348
+ // src/embed/bridge.ts
349
+ function attachDataAppBridge2(options) {
350
+ return options.source ? attachDataAppSource(options) : attachDataAppConnection(options);
351
+ }
352
+
353
+ export { attachDataAppBridge2 };
354
+
355
+ //# debugId=C67168866CE5728964756E2164756E21
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/embed/host.ts", "../src/embed/runtime-html.ts", "../src/embed/source.ts", "../src/embed/bridge.ts"],
4
+ "sourcesContent": [
5
+ "import { randomUuid } from '@/src/core/uuid';\nimport { createBridgeEndpoint } from '@/src/core/bridge-endpoint';\nimport type { DataAppAnnotationPresentation } from '@/src/core/annotations';\nimport type { DataAppPresentation } from '@/src/core/presentation';\nimport type { DataAppLogger } from '@/src/core/logger';\nimport {\n MAX_PENDING,\n REQUEST_TIMEOUT_MS,\n validId,\n type BridgeDiagnostic,\n type BridgeEventMessage,\n} from '@/src/core/bridge';\n\nimport {\n MessageRoutingError,\n type MessageDispatcher,\n} from '@/src/core/messages';\n\nexport type DataAppConnection =\n | { type: 'origin'; origin: string }\n | { type: 'opaque'; token: string };\nexport type DataAppStatus =\n | 'connecting'\n | 'connected'\n | 'ready'\n | 'failed'\n | 'disconnected';\n/** Delivery metadata only; never tokens or payloads. `durationMs` measures host handling of a request, reported on its result or error. */\nexport type DataAppDiagnostic = BridgeDiagnostic & { durationMs?: number };\n\nexport type DataAppHost = {\n dispose: () => void;\n setPresentation: (presentation?: DataAppPresentation) => void;\n setLogger: (logger?: DataAppLogger) => void;\n};\n\nexport type DataAppHostOptions = {\n iframe: HTMLIFrameElement;\n presentation?: DataAppPresentation;\n logger?: DataAppLogger;\n onStatusChange?: (status: DataAppStatus) => void;\n onDiagnostic?: (event: DataAppDiagnostic) => void;\n onMessage: MessageDispatcher;\n};\n\nexport type DataAppConnectionOptions = DataAppHostOptions & {\n connection: DataAppConnection;\n javascript?: string;\n window?: Window;\n};\n\n/** The bridge owns delivery and cancellation; the routed handler owns validation, authorization and execution. */\nexport function attachDataAppConnection({\n iframe,\n connection,\n javascript,\n presentation,\n logger,\n onStatusChange,\n onDiagnostic,\n onMessage,\n window: host = window,\n}: DataAppConnectionOptions): DataAppHost {\n const frameOrigin = connection.type === 'origin' ? connection.origin : 'null';\n if (\n connection.type === 'origin' &&\n new URL(frameOrigin).origin !== frameOrigin\n )\n throw new Error('Expected an exact frame origin.');\n if (connection.type === 'opaque' && !validId(connection.token))\n throw new Error('Invalid sandbox token.');\n let token = connection.type === 'opaque' ? connection.token : undefined;\n const targetOrigin = connection.type === 'opaque' ? '*' : frameOrigin;\n let currentPresentation: DataAppPresentation | undefined;\n let presentationIdentity: string | undefined;\n let annotationDismissal: DataAppAnnotationPresentation['dismissal'];\n let disposed = false;\n let documentId: string | undefined;\n let sessionId: string | undefined;\n const pending = new Map<string, AbortController>();\n const requestStartedAt = new Map<string, number>();\n\n function reportDiagnostic(event: BridgeDiagnostic) {\n if (!onDiagnostic) return;\n if (event.direction === 'drop' || !event.id) return onDiagnostic(event);\n switch (event.type) {\n case 'bridge:request':\n if (\n !requestStartedAt.has(event.id) &&\n requestStartedAt.size < MAX_PENDING * 2\n )\n requestStartedAt.set(event.id, host.performance.now());\n break;\n case 'bridge:cancel':\n requestStartedAt.delete(event.id);\n break;\n case 'bridge:result':\n case 'bridge:error': {\n const startedAt = requestStartedAt.get(event.id);\n requestStartedAt.delete(event.id);\n if (startedAt !== undefined)\n return onDiagnostic({\n ...event,\n durationMs: Math.round(host.performance.now() - startedAt),\n });\n break;\n }\n }\n onDiagnostic(event);\n }\n\n function hostState() {\n const presentation =\n currentPresentation?.annotations && annotationDismissal\n ? {\n ...currentPresentation,\n annotations: {\n ...currentPresentation.annotations,\n dismissal: annotationDismissal,\n },\n }\n : currentPresentation;\n return {\n search: host.location.search,\n hash: host.location.hash,\n ...(presentation ? { presentation } : {}),\n logging: logger !== undefined,\n };\n }\n\n function setLogger(value: DataAppLogger | undefined) {\n if (disposed || value === logger) return;\n const wasEnabled = logger !== undefined;\n logger = value;\n if (wasEnabled !== (logger !== undefined)) publishState();\n }\n\n function setPresentation(value: DataAppPresentation | undefined) {\n if (disposed) return;\n const identity = JSON.stringify(value);\n if (identity === presentationIdentity) return;\n presentationIdentity = identity;\n currentPresentation =\n identity === undefined\n ? undefined\n : (JSON.parse(identity) as DataAppPresentation);\n publishState();\n }\n\n function cancelAll() {\n for (const controller of pending.values()) controller.abort();\n pending.clear();\n requestStartedAt.clear();\n }\n\n const endpoint = createBridgeEndpoint({\n role: 'host',\n origin: frameOrigin,\n source: () => iframe.contentWindow,\n opaque: connection.type === 'opaque',\n context: () => ({ documentId, sessionId, token }),\n post: message => iframe.contentWindow?.postMessage(message, targetOrigin),\n diagnostic: reportDiagnostic,\n invalidRequest: id => {\n if (pending.has(id)) return;\n if (pending.size >= MAX_PENDING)\n error(id, 'bridge_busy', 'Too many pending data requests.');\n else error(id, 'invalid_message', 'Invalid message route.');\n },\n handlers: {\n ready(message) {\n if (message.documentId !== documentId) {\n cancelAll();\n documentId = message.documentId;\n sessionId = randomUuid();\n }\n onStatusChange?.('connected');\n if (disposed) return;\n send('initialize', { state: hostState() });\n if (disposed) return;\n if (javascript !== undefined) send('scriptLoad', { javascript });\n },\n runtimeLog({ payload }) {\n try {\n logger?.[payload.method](...payload.args);\n } catch {\n // A host logger failure must not break bridge delivery.\n }\n },\n runtimeReady() {\n onStatusChange?.('ready');\n },\n runtimeError() {\n onStatusChange?.('failed');\n },\n request(message) {\n void request(message);\n },\n cancel(message) {\n pending.get(message.id)?.abort();\n pending.delete(message.id);\n },\n disconnect() {\n cancelAll();\n documentId = undefined;\n sessionId = undefined;\n onStatusChange?.('disconnected');\n },\n },\n });\n const send = endpoint.send;\n const receive = endpoint.receive;\n\n function error(\n id: string,\n code: string,\n message: string,\n requestId?: string\n ) {\n send('error', { id, code, message, requestId });\n }\n\n async function request(message: BridgeEventMessage<'request'>) {\n const id = message.id;\n if (pending.has(id)) return;\n if (pending.size >= MAX_PENDING)\n return error(id, 'bridge_busy', 'Too many pending data requests.');\n try {\n const body = JSON.stringify(message.payload);\n // PNG annotation captures have a separate validated 256 KiB image budget.\n const limit = message.route === 'annotation:draft' ? 384_000 : 16_384;\n if (\n message.payload !== undefined &&\n (typeof body !== 'string' || body.length > limit)\n )\n throw new Error('Invalid payload');\n } catch {\n return error(\n id,\n 'invalid_payload',\n 'The message payload is invalid or too large.'\n );\n }\n const controller = new AbortController();\n pending.set(id, controller);\n const timer = setTimeout(() => {\n if (pending.get(id) !== controller) return;\n pending.delete(id);\n controller.abort();\n error(id, 'timeout', 'The data request timed out.');\n }, REQUEST_TIMEOUT_MS);\n controller.signal.addEventListener('abort', () => clearTimeout(timer), {\n once: true,\n });\n try {\n const response = await onMessage(\n { route: message.route, payload: message.payload },\n { signal: controller.signal }\n );\n if (pending.get(id) === controller) send('result', { id, response });\n } catch (failure) {\n if (pending.get(id) === controller) {\n if (failure instanceof MessageRoutingError)\n error(id, failure.code, failure.message, failure.requestId);\n else\n error(\n id,\n 'request_failed',\n 'The message request failed. Retry the request.'\n );\n }\n } finally {\n clearTimeout(timer);\n if (pending.get(id) === controller) pending.delete(id);\n }\n }\n\n function publishState() {\n if (disposed || !sessionId) return;\n send('stateUpdate', { state: hostState() });\n }\n\n function publishAnnotationDismissal(event: MouseEvent) {\n if (\n !currentPresentation?.annotations?.enabled ||\n event.composedPath().includes(iframe)\n )\n return;\n annotationDismissal = {\n id: randomUuid(),\n occurredAt: host.performance.timeOrigin + host.performance.now(),\n };\n publishState();\n }\n\n function load() {\n if (connection.type === 'opaque') token = randomUuid();\n cancelAll();\n documentId = undefined;\n sessionId = undefined;\n onStatusChange?.('connecting');\n send('connect', {});\n }\n\n function dispose() {\n disposed = true;\n endpoint.dispose();\n cancelAll();\n iframe.removeEventListener('load', load);\n host.removeEventListener('message', receive);\n host.removeEventListener('popstate', publishState);\n host.removeEventListener('pagehide', cancelAll);\n host.removeEventListener('click', publishAnnotationDismissal, true);\n }\n\n setPresentation(presentation);\n iframe.addEventListener('load', load);\n host.addEventListener('message', receive);\n host.addEventListener('popstate', publishState);\n host.addEventListener('pagehide', cancelAll);\n host.addEventListener('click', publishAnnotationDismissal, true);\n // Reconnect an already-loaded iframe when its host bridge mounts again.\n onStatusChange?.('connecting');\n send('connect', {});\n\n return { dispose, setPresentation, setLogger };\n}\n",
6
+ "// The package build embeds the compiled classic script, never a runtime import.\ndeclare const DATA_APP_BOOTSTRAP: string;\n\nexport const PAGE_CSP =\n \"default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; connect-src 'none'; form-action 'none'; base-uri 'none'\";\nconst inlineBootstrap = DATA_APP_BOOTSTRAP.replace(\n /<\\/script/gi,\n match => `<\\\\${match.slice(1)}`\n);\n\nexport function runtimeHtml(parentOrigin: string) {\n const attribute = parentOrigin\n .replaceAll('&', '&amp;')\n .replaceAll('\"', '&quot;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;')\n .replaceAll(\"'\", '&#39;');\n\n return `<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <meta http-equiv=\"Content-Security-Policy\" content=\"${PAGE_CSP}\">\n </head>\n <body>\n <div id=\"root\"></div>\n <script data-parent-origin=\"${attribute}\">${inlineBootstrap}</script>\n </body>\n</html>\n`;\n}\n",
7
+ "import { randomUuid } from '@/src/core/uuid';\nimport { runtimeHtml } from '@/src/embed/runtime-html';\nimport { PARENT_PARAM } from '@/src/core/bridge';\nimport {\n attachDataAppConnection,\n type DataAppStatus,\n type DataAppHost,\n type DataAppHostOptions,\n} from '@/src/embed/host';\n\nexport type DataAppSource =\n | { type: 'url'; url: string }\n | {\n type: 'bundle';\n /** Omit to use the packaged, network-isolated data document. */\n bootstrapUrl?: string;\n javascript: string;\n };\nexport type DataAppSourceOptions = DataAppHostOptions & {\n source: DataAppSource;\n startupTimeoutMs?: number;\n};\n\n/** Owns loading and sandbox policy. Dispose before replacing the source or retrying. */\nexport function attachDataAppSource({\n iframe,\n source,\n presentation,\n logger,\n onMessage,\n onStatusChange,\n onDiagnostic,\n startupTimeoutMs = 30_000,\n}: DataAppSourceOptions): DataAppHost {\n const host = iframe.ownerDocument.defaultView;\n if (!host) throw new Error('The iframe requires a host window.');\n const url = new URL(\n source.type === 'url'\n ? source.url\n : (source.bootstrapUrl ??\n `data:text/html;charset=utf-8,${encodeURIComponent(runtimeHtml(host.location.origin))}`),\n host.location.href\n );\n if (\n !(source.type === 'bundle' && source.bootstrapUrl === undefined) &&\n !/^https?:$/.test(url.protocol)\n )\n throw new Error('Data apps require an HTTP(S) URL.');\n const opaque = source.type === 'bundle';\n if (!opaque && url.origin === host.location.origin)\n throw new Error('URL data apps require a separate origin from the host.');\n iframe.setAttribute(\n 'sandbox',\n opaque\n ? 'allow-scripts'\n : 'allow-scripts allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox'\n );\n iframe.referrerPolicy = 'no-referrer';\n if (!opaque) url.searchParams.set(PARENT_PARAM, host.location.origin);\n let timer: ReturnType<typeof setTimeout> | undefined;\n let failed = false;\n\n function status(value: DataAppStatus) {\n if (value === 'connecting') failed = false;\n if (failed && value !== 'connecting') return;\n clearTimeout(timer);\n if (value === 'connecting' || value === 'connected')\n timer = setTimeout(() => {\n failed = true;\n bridge.dispose();\n onStatusChange?.('failed');\n }, startupTimeoutMs);\n if (value === 'failed') {\n failed = true;\n bridge.dispose();\n }\n onStatusChange?.(value);\n }\n\n const bridge = attachDataAppConnection({\n iframe,\n connection: opaque\n ? { type: 'opaque', token: randomUuid() }\n : { type: 'origin', origin: url.origin },\n javascript: opaque ? source.javascript : undefined,\n presentation,\n logger,\n onMessage,\n onStatusChange: status,\n onDiagnostic,\n window: host,\n });\n\n function error() {\n return status('failed');\n }\n\n iframe.addEventListener('error', error);\n iframe.src = url.href;\n\n function dispose() {\n clearTimeout(timer);\n iframe.removeEventListener('error', error);\n bridge.dispose();\n }\n\n return {\n dispose,\n setPresentation: bridge.setPresentation,\n setLogger: bridge.setLogger,\n };\n}\n",
8
+ "import {\n attachDataAppConnection,\n type DataAppConnectionOptions,\n} from '@/src/embed/host';\nimport {\n attachDataAppSource,\n type DataAppSourceOptions,\n} from '@/src/embed/source';\n\nexport type DataAppBridgeOptions =\n | (DataAppSourceOptions & {\n connection?: never;\n window?: never;\n javascript?: never;\n })\n | (DataAppConnectionOptions & { source?: never; startupTimeoutMs?: never });\n\n/** Source mode configures and loads the iframe; connection mode attaches to a host-owned document. */\nexport function attachDataAppBridge(options: DataAppBridgeOptions) {\n return options.source\n ? attachDataAppSource(options)\n : attachDataAppConnection(options);\n}\n"
9
+ ],
10
+ "mappings": ";;;;;;;;;;;;;AAoDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ,OAAO;AAAA,GACyB;AAAA,EACxC,MAAM,cAAc,WAAW,SAAS,WAAW,WAAW,SAAS;AAAA,EACvE,IACE,WAAW,SAAS,YACpB,IAAI,IAAI,WAAW,EAAE,WAAW;AAAA,IAEhC,MAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD,IAAI,WAAW,SAAS,YAAY,CAAC,QAAQ,WAAW,KAAK;AAAA,IAC3D,MAAM,IAAI,MAAM,wBAAwB;AAAA,EAC1C,IAAI,QAAQ,WAAW,SAAS,WAAW,WAAW,QAAQ;AAAA,EAC9D,MAAM,eAAe,WAAW,SAAS,WAAW,MAAM;AAAA,EAC1D,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI,WAAW;AAAA,EACf,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM,UAAU,IAAI;AAAA,EACpB,MAAM,mBAAmB,IAAI;AAAA,EAE7B,SAAS,gBAAgB,CAAC,OAAyB;AAAA,IACjD,IAAI,CAAC;AAAA,MAAc;AAAA,IACnB,IAAI,MAAM,cAAc,UAAU,CAAC,MAAM;AAAA,MAAI,OAAO,aAAa,KAAK;AAAA,IACtE,QAAQ,MAAM;AAAA,WACP;AAAA,QACH,IACE,CAAC,iBAAiB,IAAI,MAAM,EAAE,KAC9B,iBAAiB,OAAO,cAAc;AAAA,UAEtC,iBAAiB,IAAI,MAAM,IAAI,KAAK,YAAY,IAAI,CAAC;AAAA,QACvD;AAAA,WACG;AAAA,QACH,iBAAiB,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