react-semaphor 0.1.327 → 0.1.328

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 (60) hide show
  1. package/dist/brand-studio/index.cjs +5 -5
  2. package/dist/brand-studio/index.js +23 -24
  3. package/dist/chunks/_commonjsHelpers-BVfed4GL.js +28 -0
  4. package/dist/chunks/_commonjsHelpers-DwTZ_eVU.js +1 -0
  5. package/dist/chunks/{braces-BGWZEnQJ.js → braces-CG8viaD2.js} +1 -1
  6. package/dist/chunks/{braces-B6qRDu1H.js → braces-DSaa_4Oc.js} +1 -1
  7. package/dist/chunks/{calendar-preferences-dialog-fkLUMJyR.js → calendar-preferences-dialog-DD_qAthL.js} +1 -1
  8. package/dist/chunks/{calendar-preferences-dialog-CjwbE_82.js → calendar-preferences-dialog-JRmNJptJ.js} +3 -3
  9. package/dist/chunks/{chevrons-up-down-xG-bVFD9.js → chevrons-up-down-CBa0uh0X.js} +1 -1
  10. package/dist/chunks/{chevrons-up-down-BpsogQvv.js → chevrons-up-down-ChDNqVP7.js} +1 -1
  11. package/dist/chunks/dashboard-briefing-launcher-BKdJFwH5.js +106 -0
  12. package/dist/chunks/{dashboard-briefing-launcher-Cy1nWZRW.js → dashboard-briefing-launcher-BfyNkd8i.js} +1141 -1137
  13. package/dist/chunks/{dashboard-controls-BWnVEFJq.js → dashboard-controls-0pZDLvFL.js} +218 -218
  14. package/dist/chunks/{dashboard-controls-C7rOGZO-.js → dashboard-controls-C0xm1QMR.js} +10 -10
  15. package/dist/chunks/dashboard-json-BW5OVZ6m.js +1 -0
  16. package/dist/chunks/{dashboard-json-BpRNSsF3.js → dashboard-json-DsruhRPD.js} +14 -13
  17. package/dist/chunks/{edit-dashboard-visual-B2vkIKEa.js → edit-dashboard-visual-DQyJ7SSv.js} +1 -1
  18. package/dist/chunks/{edit-dashboard-visual-CYf26co_.js → edit-dashboard-visual-g5SZZahJ.js} +9 -8
  19. package/dist/chunks/index-1JWDPCun.js +1935 -0
  20. package/dist/chunks/index-BdjXTQt4.js +1444 -0
  21. package/dist/chunks/{index-DTlbYpxd.js → index-BmKr-K7J.js} +116971 -113296
  22. package/dist/chunks/index-C1l78BIx.js +3247 -0
  23. package/dist/chunks/lib-Ce3zosXY.js +38 -0
  24. package/dist/chunks/lib-DFvr9fM4.js +5500 -0
  25. package/dist/chunks/{palette-CSF7IVJn.js → palette-D0YmAqBS.js} +1 -1
  26. package/dist/chunks/{palette-CWgEPBoG.js → palette-DQgq3edH.js} +1 -1
  27. package/dist/chunks/{resource-management-panel-D6nbfJY3.js → resource-management-panel-CIfBh46E.js} +1 -1
  28. package/dist/chunks/{resource-management-panel-D893Onv8.js → resource-management-panel-Cj19pw9M.js} +145 -145
  29. package/dist/chunks/{switch-DJJJD_g1.js → switch-BvTzw2AW.js} +39 -34
  30. package/dist/chunks/{switch-DKf6vHfP.js → switch-De31SR3q.js} +878 -885
  31. package/dist/chunks/typescript-Cmizj1hi.js +446 -0
  32. package/dist/chunks/typescript-H1EwZsOb.js +159820 -0
  33. package/dist/chunks/use-create-flow-overlay-state-BTQiKRD1.js +26 -0
  34. package/dist/chunks/{use-create-flow-overlay-state-p21zs2p6.js → use-create-flow-overlay-state-IcHP0l39.js} +150 -151
  35. package/dist/chunks/{use-visual-utils-BKBua6o4.js → use-visual-utils-DQ5zGYD2.js} +13 -13
  36. package/dist/chunks/{use-visual-utils-BqWm0QeW.js → use-visual-utils-XF-AqV8o.js} +1 -1
  37. package/dist/dashboard/index.cjs +1 -1
  38. package/dist/dashboard/index.js +1 -1
  39. package/dist/data-app-builder/index.cjs +1 -0
  40. package/dist/data-app-builder/index.js +4 -0
  41. package/dist/data-app-builder-browser-runtime/index.cjs +1 -0
  42. package/dist/data-app-builder-browser-runtime/index.js +10 -0
  43. package/dist/data-app-sdk/index.cjs +1 -1
  44. package/dist/data-app-sdk/index.js +208 -196
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.js +14 -14
  47. package/dist/style.css +1 -1
  48. package/dist/surfboard/index.cjs +1 -1
  49. package/dist/surfboard/index.js +2 -2
  50. package/dist/types/data-app-builder-browser-runtime.d.ts +185 -0
  51. package/dist/types/data-app-builder.d.ts +630 -0
  52. package/dist/types/data-app-sdk.d.ts +14 -1
  53. package/dist/types/main.d.ts +2 -0
  54. package/package.json +11 -1
  55. package/dist/chunks/dashboard-briefing-launcher-Co57xBfS.js +0 -106
  56. package/dist/chunks/dashboard-json-DBPMknGo.js +0 -1
  57. package/dist/chunks/index-BD90s-wf.js +0 -1309
  58. package/dist/chunks/save-CtQbSub2.js +0 -6
  59. package/dist/chunks/save-DRdFKF57.js +0 -21
  60. package/dist/chunks/use-create-flow-overlay-state-C4LgoK8q.js +0 -26
@@ -1,5 +1,5 @@
1
- import { ac as X, u as Y, ad as Z, ae as ee, af as te, ag as re, ah as se, ai as ae, o as V, aj as oe } from "./index-DTlbYpxd.js";
2
- import { H as ne, E as ie, u as b, G as H, I as ce } from "./switch-DKf6vHfP.js";
1
+ import { ad as X, u as Y, ae as Z, af as ee, ag as te, ah as re, ai as se, aj as ae, p as V, ak as oe } from "./index-BmKr-K7J.js";
2
+ import { H as ne, E as ie, u as b, G as H, I as ce } from "./switch-De31SR3q.js";
3
3
  import { useState as z, useEffect as de, useCallback as A } from "react";
4
4
  function le(e) {
5
5
  const [a, s] = z(null), [r, t] = z(null), o = X();
@@ -194,12 +194,12 @@ function be() {
194
194
  setSelectedDatamodelId: g,
195
195
  setFilterValues: P,
196
196
  setInlineFilterValuesMap: j,
197
- setApplyFilters: D,
198
- clearEditorContext: L
197
+ setApplyFilters: k,
198
+ clearEditorContext: D
199
199
  } = ne(), {
200
200
  setIsDashboardEditing: U,
201
- setIsVisualEditing: T,
202
- setSelectedFrameId: k,
201
+ setIsVisualEditing: L,
202
+ setSelectedFrameId: T,
203
203
  clearSelectedFrameId: N,
204
204
  setIsDashboardPanelOpen: W
205
205
  } = ie(), E = b((c) => c.selectedSheetId), $ = b((c) => c.selectedFrameId), R = b((c) => c.dashboard), x = b((c) => c.filterValues), O = b(
@@ -209,7 +209,7 @@ function be() {
209
209
  }), G = A(
210
210
  async (c) => {
211
211
  try {
212
- o(c), N(), L();
212
+ o(c), N(), D();
213
213
  const { data: u, fromCache: v } = await Q(
214
214
  a.apiServiceUrl,
215
215
  (e == null ? void 0 : e.accessToken) || "",
@@ -231,9 +231,9 @@ function be() {
231
231
  setSelectedDatamodelId: g,
232
232
  setFilterValues: P,
233
233
  setInlineFilterValuesMap: j,
234
- setApplyFilters: D,
234
+ setApplyFilters: k,
235
235
  setIsDashboardEditing: U,
236
- setIsVisualEditing: T,
236
+ setIsVisualEditing: L,
237
237
  dashboard: R,
238
238
  selectedSheetId: E,
239
239
  selectedFrameId: $,
@@ -254,7 +254,7 @@ function be() {
254
254
  l,
255
255
  n,
256
256
  U,
257
- T,
257
+ L,
258
258
  i,
259
259
  f,
260
260
  h,
@@ -267,8 +267,8 @@ function be() {
267
267
  g,
268
268
  P,
269
269
  j,
270
+ k,
270
271
  D,
271
- L,
272
272
  N,
273
273
  R,
274
274
  E,
@@ -303,7 +303,7 @@ function be() {
303
303
  E,
304
304
  B,
305
305
  "end"
306
- ), U(!0), k(B.id), W(!1), { success: !0, fromCache: K };
306
+ ), U(!0), T(B.id), W(!1), { success: !0, fromCache: K };
307
307
  } catch (d) {
308
308
  return console.error("Error adding visual:", d), u(
309
309
  d instanceof Error ? d.message : "Failed to add visual to dashboard"
@@ -317,7 +317,7 @@ function be() {
317
317
  o,
318
318
  E,
319
319
  U,
320
- k,
320
+ T,
321
321
  W,
322
322
  r
323
323
  ]
@@ -1 +1 @@
1
- "use strict";const u=require("./index-BD90s-wf.js"),f=require("./switch-DJJJD_g1.js"),S=require("react");function K(e){const[a,s]=S.useState(null),[r,t]=S.useState(null),o=u.useEnsureReactGlobals();return S.useEffect(()=>{if(!e||e.trim()===""){s(null),t(null);return}if(!o)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const i=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(i,{method:"HEAD"})).ok)throw new Error(`Module not found at ${i}`)}catch{}const m=await import(i);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");s(()=>m.useChartStore),t(null)}catch(n){const i=n instanceof Error?n.message:"Unknown error";console.error("Failed to load remote chart store:",i),t(i),s(null)}})()},[e,o]),a}function X(e,a){if(e.length===0)return"";const s=e.find(r=>{var t,o;return((t=r.customCardPreferences)==null?void 0:t.visualType)==="multiple"||!!((o=r.customCardPreferences)!=null&&o.dataInputCardIds)});if(s)return s.id;if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const l=t.split("__")[0],n=e.find(i=>i.tabTitle===l);return n?n.id:e[0].id}return a}}return e[0].id}const A=new Set;function Y(e){return A.add(e),()=>{A.delete(e)}}function z(){A.forEach(e=>{e()})}const Z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:a,...s}=e;return s};async function B(e,a,s,r){if(!a||!s)throw new Error("Missing auth token or visual ID");const t=["resource-by-id","visual",s],o=r.getQueryData(t);if(o)return console.log("Using cached visual data for:",s),{data:o,fromCache:!0};console.log("Fetching visual data from network for:",s);const l=u.ue.loading("Loading visual...",{position:"top-center"});try{const n=await fetch(`${e}/management/v1/visuals/${s}`,{headers:{Authorization:`Bearer ${a}`}});if(!n.ok)throw new Error("Failed to load visual");const i=await n.json();return r.setQueryData(t,i),u.ue.dismiss(l),{data:i,fromCache:!1}}catch(n){throw u.ue.dismiss(l),n}}function H(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function ee(e,a){var o,l;const s=(e==null?void 0:e.frameObject)??((o=e==null?void 0:e.visual)==null?void 0:o.frameObject);if(!s)return!1;const r=H(s);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const t=(l=r.cards)==null?void 0:l.find(n=>n.id===r.activeCardId);return t?(u.setupEditorWithCard({...a,frame:r,card:t,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function te(){const e=f.useEditorStore(r=>{var t;return((t=r.card.customCardPreferences)==null?void 0:t.url)||""}),a=K(e);return{getUpdatedFrame:S.useCallback(()=>{var b;z();const{frame:r,card:t,isDevMode:o,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y}=f.useEditorStore.getState(),I=t.sql,U=(b=a==null?void 0:a.getState())==null?void 0:b.settings,V=f.buildSavedEditorCard(t,{isDevMode:o,cardSql:I,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y,remoteChartSettings:U,stripConfig:Z}),g=r.cards.map(E=>E.id===t.id?V:E);return{...r,cards:g,activeCardId:X(g,r.activeCardId)}},[a])}}function re(){const{authToken:e,tokenProps:a}=u.useSemaphorContext(),s=u.useQueryClient(),r=u.useAddFrameWithFreshSemanticExecutionPayload(),t=u.useSelectedVisual(),{selectVisual:o}=u.useManagementActions(),{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,clearEditorContext:L}=f.useEditorActions(),{setIsDashboardEditing:v,setIsVisualEditing:T,setSelectedFrameId:j,clearSelectedFrameId:N,setIsDashboardPanelOpen:R}=f.useDashboardActions(),w=f.useDashboardStore(c=>c.selectedSheetId),W=f.useDashboardStore(c=>c.selectedFrameId),$=f.useDashboardStore(c=>c.dashboard),_=f.useDashboardStore(c=>c.filterValues),x=f.useDashboardStore(c=>c.inlineFilterValuesMap),F=u.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),Q=S.useCallback(async c=>{try{o(c),N(),L();const{data:h,fromCache:D}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s);if(!ee(h,{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,setIsDashboardEditing:v,setIsVisualEditing:T,dashboard:$,selectedSheetId:w,selectedFrameId:W,filterValues:_,inlineFilterValuesMap:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:D}}catch(h){return console.error("Error editing visual:",h),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,l,n,v,T,i,m,p,y,I,U,V,g,b,E,P,M,k,L,N,$,w,W,_,x]),G=S.useCallback(async c=>{var D;const h=d=>(u.ue.error(d),{success:!1,error:d});try{if(o(c),!w)return h("No sheet selected. Please select a sheet first.");const{data:d,fromCache:J}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s),O=(d==null?void 0:d.frameObject)??((D=d==null?void 0:d.visual)==null?void 0:D.frameObject);if(!O)return h("Visual has no frame data");const C=H(O);if(!(C!=null&&C.cards)||C.cards.length===0)return h("Visual frame is malformed");const q={...u.cloneLinkedFrameWithSourceMapping(C),visualId:c.id};return await r(w,q,"end"),v(!0),j(q.id),R(!1),{success:!0,fromCache:J}}catch(d){return console.error("Error adding visual:",d),h(d instanceof Error?d.message:"Failed to add visual to dashboard")}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,w,v,j,R,r]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:Q,handleAddLibraryVisual:G,getUpdatedFrame:te().getUpdatedFrame,refetch:F.refetch}}exports.flushPendingEditorDrafts=z;exports.registerPendingEditorDraftFlusher=Y;exports.useVisualUtils=re;
1
+ "use strict";const u=require("./index-BdjXTQt4.js"),f=require("./switch-BvTzw2AW.js"),S=require("react");function K(e){const[a,s]=S.useState(null),[r,t]=S.useState(null),o=u.useEnsureReactGlobals();return S.useEffect(()=>{if(!e||e.trim()===""){s(null),t(null);return}if(!o)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const i=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(i,{method:"HEAD"})).ok)throw new Error(`Module not found at ${i}`)}catch{}const m=await import(i);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");s(()=>m.useChartStore),t(null)}catch(n){const i=n instanceof Error?n.message:"Unknown error";console.error("Failed to load remote chart store:",i),t(i),s(null)}})()},[e,o]),a}function X(e,a){if(e.length===0)return"";const s=e.find(r=>{var t,o;return((t=r.customCardPreferences)==null?void 0:t.visualType)==="multiple"||!!((o=r.customCardPreferences)!=null&&o.dataInputCardIds)});if(s)return s.id;if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const l=t.split("__")[0],n=e.find(i=>i.tabTitle===l);return n?n.id:e[0].id}return a}}return e[0].id}const A=new Set;function Y(e){return A.add(e),()=>{A.delete(e)}}function z(){A.forEach(e=>{e()})}const Z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:a,...s}=e;return s};async function B(e,a,s,r){if(!a||!s)throw new Error("Missing auth token or visual ID");const t=["resource-by-id","visual",s],o=r.getQueryData(t);if(o)return console.log("Using cached visual data for:",s),{data:o,fromCache:!0};console.log("Fetching visual data from network for:",s);const l=u.ue.loading("Loading visual...",{position:"top-center"});try{const n=await fetch(`${e}/management/v1/visuals/${s}`,{headers:{Authorization:`Bearer ${a}`}});if(!n.ok)throw new Error("Failed to load visual");const i=await n.json();return r.setQueryData(t,i),u.ue.dismiss(l),{data:i,fromCache:!1}}catch(n){throw u.ue.dismiss(l),n}}function H(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function ee(e,a){var o,l;const s=(e==null?void 0:e.frameObject)??((o=e==null?void 0:e.visual)==null?void 0:o.frameObject);if(!s)return!1;const r=H(s);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const t=(l=r.cards)==null?void 0:l.find(n=>n.id===r.activeCardId);return t?(u.setupEditorWithCard({...a,frame:r,card:t,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function te(){const e=f.useEditorStore(r=>{var t;return((t=r.card.customCardPreferences)==null?void 0:t.url)||""}),a=K(e);return{getUpdatedFrame:S.useCallback(()=>{var b;z();const{frame:r,card:t,isDevMode:o,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y}=f.useEditorStore.getState(),I=t.sql,U=(b=a==null?void 0:a.getState())==null?void 0:b.settings,V=f.buildSavedEditorCard(t,{isDevMode:o,cardSql:I,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y,remoteChartSettings:U,stripConfig:Z}),g=r.cards.map(E=>E.id===t.id?V:E);return{...r,cards:g,activeCardId:X(g,r.activeCardId)}},[a])}}function re(){const{authToken:e,tokenProps:a}=u.useSemaphorContext(),s=u.useQueryClient(),r=u.useAddFrameWithFreshSemanticExecutionPayload(),t=u.useSelectedVisual(),{selectVisual:o}=u.useManagementActions(),{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,clearEditorContext:L}=f.useEditorActions(),{setIsDashboardEditing:v,setIsVisualEditing:T,setSelectedFrameId:j,clearSelectedFrameId:N,setIsDashboardPanelOpen:R}=f.useDashboardActions(),w=f.useDashboardStore(c=>c.selectedSheetId),W=f.useDashboardStore(c=>c.selectedFrameId),$=f.useDashboardStore(c=>c.dashboard),_=f.useDashboardStore(c=>c.filterValues),x=f.useDashboardStore(c=>c.inlineFilterValuesMap),F=u.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),Q=S.useCallback(async c=>{try{o(c),N(),L();const{data:h,fromCache:D}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s);if(!ee(h,{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,setIsDashboardEditing:v,setIsVisualEditing:T,dashboard:$,selectedSheetId:w,selectedFrameId:W,filterValues:_,inlineFilterValuesMap:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:D}}catch(h){return console.error("Error editing visual:",h),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,l,n,v,T,i,m,p,y,I,U,V,g,b,E,P,M,k,L,N,$,w,W,_,x]),G=S.useCallback(async c=>{var D;const h=d=>(u.ue.error(d),{success:!1,error:d});try{if(o(c),!w)return h("No sheet selected. Please select a sheet first.");const{data:d,fromCache:J}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s),O=(d==null?void 0:d.frameObject)??((D=d==null?void 0:d.visual)==null?void 0:D.frameObject);if(!O)return h("Visual has no frame data");const C=H(O);if(!(C!=null&&C.cards)||C.cards.length===0)return h("Visual frame is malformed");const q={...u.cloneLinkedFrameWithSourceMapping(C),visualId:c.id};return await r(w,q,"end"),v(!0),j(q.id),R(!1),{success:!0,fromCache:J}}catch(d){return console.error("Error adding visual:",d),h(d instanceof Error?d.message:"Failed to add visual to dashboard")}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,w,v,j,R,r]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:Q,handleAddLibraryVisual:G,getUpdatedFrame:te().getUpdatedFrame,refetch:F.refetch}}exports.flushPendingEditorDrafts=z;exports.registerPendingEditorDraftFlusher=Y;exports.useVisualUtils=re;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-BD90s-wf.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-BdjXTQt4.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as o } from "../chunks/index-DTlbYpxd.js";
1
+ import { D as o } from "../chunks/index-BmKr-K7J.js";
2
2
  import { C as s, E as C } from "../chunks/common-types-4bjoIgvm.js";
3
3
  export {
4
4
  s as CONTROL_CARD_DEFAULT_VALUE,
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-BdjXTQt4.js");exports.DataAppBuilder=e.DataAppBuilder;
@@ -0,0 +1,4 @@
1
+ import { b as r } from "../chunks/index-BmKr-K7J.js";
2
+ export {
3
+ r as DataAppBuilder
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=async(r="semaphor-browser-runtime")=>{if(r!=="semaphor-browser-runtime")throw new Error("Custom browser runtime specifiers are not supported in the bundled App Builder. Install or link semaphor-browser-runtime.");return Promise.resolve().then(()=>require("../chunks/index-1JWDPCun.js"))};exports.loadSemaphorBrowserRuntime=e;
@@ -0,0 +1,10 @@
1
+ const e = async (r = "semaphor-browser-runtime") => {
2
+ if (r !== "semaphor-browser-runtime")
3
+ throw new Error(
4
+ "Custom browser runtime specifiers are not supported in the bundled App Builder. Install or link semaphor-browser-runtime."
5
+ );
6
+ return import("../chunks/index-C1l78BIx.js");
7
+ };
8
+ export {
9
+ e as loadSemaphorBrowserRuntime
10
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("../chunks/index-BxM99sFL.js"),T=require("react/jsx-runtime"),u=require("react"),P=require("../chunks/validators-odlRJblR.js");function q(t){var e;return{version:1,kind:"metric",id:t.id,label:t.label,source:g(t),metric:t.metric,metrics:t.metrics,dateField:t.dateField?d(t.dateField,"date"):void 0,timeGrain:t.timeGrain,dimensions:(e=t.dimensions)==null?void 0:e.map(n=>d(n,"dimension")),comparison:L(t.comparison),inputs:b(t.inputs),limit:t.limit}}function E(t){if("sort"in t)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!F(t))throw new Error("useSemaphorRecords needs at least one field, dimension, or measure.");const e=V(t.fields,t.dimensions,t.measures);return{version:1,kind:"records",id:t.id,label:t.label,source:g(t),fields:e,measures:t.measures,dateField:t.dateField?d(t.dateField,"date"):void 0,timeGrain:t.timeGrain,orderBy:t.orderBy,inputs:b(t.inputs),limit:t.limit}}function R(t){return{version:1,kind:"inputOptions",id:t.id,label:t.label,source:g(t),field:d(t.field,"dimension"),search:t.search,limit:t.limit}}function w(t){if("toAnalyticsInput"in t){const e=t.toAnalyticsInput();return{inputId:e.inputId,field:e.field}}return{inputId:t.inputId,field:t.field}}function _(t){const e=b(t);return e.length>0?e:void 0}function x(t){return(t||[]).map(j)}function A(t){return x(t).filter(e=>e.isActive)}function O(t){return t.kind==="filter"?{inputId:t.id,kind:t.kind,label:t.label,field:d(t.field,"dimension"),operator:t.operator||"in",source:t.source}:{inputId:t.id,kind:t.kind,label:t.label}}function $(t=[]){return t.map(e=>typeof e=="object"?e:{label:String(e),value:e})}function h(t){return t==null?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t.trim().length>0:!0}function j(t){return"toAnalyticsInput"in t?t.toAnalyticsInput():"kind"in t&&"isActive"in t?t:{...t,kind:"filter",isActive:h(t.value),value:t.value}}function g(t){if("source"in t&&t.source)return t.source;const e=t.datasetName||t.dataset;if(!e)throw new Error("Semaphor data app source needs datasetName or dataset.");return{kind:"semantic",domainId:t.domainId,datasetName:e,datasetId:t.datasetId,connectionId:t.connectionId,label:t.sourceLabel}}function F(t){var e,n,r;return!!((e=t.fields)!=null&&e.length||(n=t.dimensions)!=null&&n.length||(r=t.measures)!=null&&r.length)}function N(t){return!!(t!=null&&t.length)}function V(t,e,n){const r=[],o=new Set,a=i=>{const c=`${i.role||""}:${i.name}`;o.has(c)||(o.add(c),r.push(i))};return N(t)&&t.map(i=>d(i)).forEach(a),e==null||e.map(i=>d(i,"dimension")).forEach(a),n==null||n.map(i=>d(i,"measure")).forEach(a),r}function d(t,e){return typeof t=="string"?e?{name:t,role:e}:{name:t}:{...t,role:t.role||e}}function b(t){return(t||[]).map(w)}function L(t){if(!(!t||t==="none"))return typeof t=="object"?t:t==="same_period_last_year"?{kind:"previous_year"}:{kind:t}}function M(){return{executeMetric:(t,e)=>S(t,e),executeRecords:(t,e)=>S(t,e),executeInputOptions:(t,e)=>S(t,e)}}async function S(t,e){if(!e.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const n=await fetch(Q(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({intent:t,activeInputs:e.activeInputs,resultShape:t.kind})}),r=await z(n);if(!n.ok||r.error)throw new Error(r.error||`Semaphor Data App query failed with status ${n.status}.`);return r}async function z(t){const e=await t.text().catch(()=>"");if(!e.trim())return t.ok?{error:"Semaphor Data App query returned an empty response."}:{};try{return JSON.parse(e)}catch{return t.ok?{error:"Semaphor Data App query returned invalid JSON.",details:e}:{error:U(t,e),details:e}}}function U(t,e){const n=t.statusText?` ${t.statusText}`:"",r=e.replace(/\s+/g," ").trim();return r?`Semaphor Data App query failed with status ${t.status}${n}: ${r.slice(0,240)}`:`Semaphor Data App query failed with status ${t.status}${n}.`}function Q(t){const e=G(t).replace(/\/+$/,"");return e?e.endsWith("/api")?`${e}/v1/data-app/query`:`${e}/api/v1/data-app/query`:"/api/v1/data-app/query"}function G(t){if(t.apiBaseUrl)return t.apiBaseUrl;if(!t.token)return"";try{return K.jwtDecode(t.token).apiServiceUrl||""}catch{return""}}const C=u.createContext({});function J({token:t,apiBaseUrl:e,executor:n,children:r}){const o=u.useMemo(()=>M(),[]),a=n||o,i=u.useMemo(()=>({token:t,apiBaseUrl:e,executor:a}),[e,a,t]);return T.jsx(C.Provider,{value:i,children:r})}function B(){return u.useContext(C)}const I={value:null},H={records:[]},v={options:[]};function W(t){const e=A(t.inputs);try{const n=q(t),r=k(n);return r?{error:r,activeInputs:e,queryKey:l(void 0,e,r),idleData:I}:{intent:n,error:null,activeInputs:e,queryKey:l(n,e),idleData:I}}catch(n){const r=f(n);return{error:r,activeInputs:e,queryKey:l(void 0,e,r),idleData:I}}}function X(t){const e=A(t.inputs),n=H;try{const r=E(t),o=k(r);return o?{error:o,activeInputs:e,queryKey:l(void 0,e,o),idleData:n}:{intent:r,error:null,activeInputs:e,queryKey:l(r,e),idleData:n}}catch(r){const o=f(r);return{error:o,activeInputs:e,queryKey:l(void 0,e,o),idleData:n}}}function Y(t){try{const e=R(t),n=k(e);return n?{error:n,queryKey:l(void 0,void 0,n),idleData:v}:{intent:e,error:null,queryKey:l(e),idleData:v}}catch(e){const n=f(e);return{error:n,queryKey:l(void 0,void 0,n),idleData:v}}}function f(t){return t instanceof Error?t:new Error(String(t))}function k(t){const e=P.validateSemaphorAnalyticsIntent(t);if(e.ok)return null;const n=e.errors.map(r=>r.path?`${r.code} at ${r.path}: ${r.message}`:`${r.code}: ${r.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${n}`)}function l(t,e,n){return JSON.stringify({intent:t,activeInputs:e,error:n==null?void 0:n.message})}function Z(t){const[e,n]=u.useState(t.defaultValue),r=Object.prototype.hasOwnProperty.call(t,"value"),o=r?t.value:e,a=u.useMemo(()=>$(t.options),[t.options]),i=u.useCallback(s=>{var m;(m=t.onValueChange)==null||m.call(t,s),r||n(s)},[r,t]),c=u.useCallback(()=>i(void 0),[i]);return u.useMemo(()=>{const s=O(t);return{id:t.id,kind:t.kind,label:t.label,field:s.field,operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0,value:o,options:a,isActive:h(o),setValue:i,clear:c,toAnalyticsInput:()=>({inputId:s.inputId,field:s.field,kind:t.kind,label:t.label,value:o,isActive:h(o),operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0})}},[c,a,i,t,o])}function tt(t){const e=u.useMemo(()=>W(t),[t]),n=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeMetric(e.intent,a):void 0},[e.intent]),r=D(e.queryKey,n,e.idleData,e.activeInputs),o=e.error?e.idleData:r.data;return{id:t.id,intent:e.intent,value:(o==null?void 0:o.value)??null,metrics:o==null?void 0:o.metrics,comparisonValue:o==null?void 0:o.comparisonValue,delta:o==null?void 0:o.delta,deltaPercent:o==null?void 0:o.deltaPercent,records:o==null?void 0:o.records,status:e.error?"error":r.status,isLoading:!e.error&&r.status==="loading",error:e.error||r.error}}function et(t){const e=u.useMemo(()=>X(t),[t]),n=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeRecords(e.intent,a):void 0},[e.intent]),r=D(e.queryKey,n,e.idleData,e.activeInputs),o=e.error?e.idleData:r.data;return{id:t.id,intent:e.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,status:e.error?"error":r.status,isLoading:!e.error&&r.status==="loading",error:e.error||r.error}}function rt(t){const e=u.useMemo(()=>Y(t),[t]),n=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeInputOptions(e.intent,a):void 0},[e.intent]),r=D(e.queryKey,n,e.idleData),o=e.error?e.idleData:r.data;return{id:t.id,intent:e.intent,options:(o==null?void 0:o.options)||[],status:e.error?"error":r.status,isLoading:!e.error&&r.status==="loading",error:e.error||r.error}}function D(t,e,n,r){const o=B(),a=u.useRef(e),i=u.useRef(r),[c,s]=u.useState({status:"idle",data:n,error:null});return a.current=e,i.current=r,u.useEffect(()=>{let m;try{m=a.current({...o,activeInputs:i.current})}catch(p){s({status:"error",data:n,error:f(p)});return}if(!m){s({status:"idle",data:n,error:null});return}let y=!1;return s(p=>({status:"loading",data:p.data,error:null})),m.then(p=>{y||s({status:"success",data:p,error:null})}).catch(p=>{y||s({status:"error",data:n,error:f(p)})}),()=>{y=!0}},[n,t,o]),c}exports.SemaphorDataAppProvider=J;exports.createSemaphorDataAppExecutor=M;exports.hasSemaphorInputValue=h;exports.normalizeSemaphorInputOptions=$;exports.toSemaphorActiveInputSnapshots=A;exports.toSemaphorInputBinding=w;exports.toSemaphorInputBindings=_;exports.toSemaphorInputOptionsIntent=R;exports.toSemaphorInputSnapshots=x;exports.toSemaphorInputSpec=O;exports.toSemaphorMetricIntent=q;exports.toSemaphorRecordsIntent=E;exports.useSemaphorDataAppRuntime=B;exports.useSemaphorInput=Z;exports.useSemaphorInputOptions=rt;exports.useSemaphorMetric=tt;exports.useSemaphorRecords=et;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../chunks/index-BxM99sFL.js"),u=require("react"),P=require("react/jsx-runtime"),K=require("../chunks/validators-odlRJblR.js");function x(t){var e;return{version:1,kind:"metric",id:t.id,label:t.label,source:k(t),metric:t.metric,metrics:t.metrics,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,dimensions:(e=t.dimensions)==null?void 0:e.map(o=>m(o,"dimension")),comparison:L(t.comparison),inputs:g(t.inputs),limit:t.limit}}function R(t){if("sort"in t)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!N(t))throw new Error("useSemaphorRecords needs at least one field, dimension, or measure.");const e=F(t.fields,t.dimensions,t.measures);return{version:1,kind:"records",id:t.id,label:t.label,source:k(t),fields:e,measures:t.measures,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,orderBy:t.orderBy,inputs:g(t.inputs),limit:t.limit}}function q(t){return{version:1,kind:"inputOptions",id:t.id,label:t.label,source:k(t),field:m(t.field,"dimension"),search:t.search,limit:t.limit}}function O(t){if("toAnalyticsInput"in t){const e=t.toAnalyticsInput();return{inputId:e.inputId,field:e.field}}return{inputId:t.inputId,field:t.field}}function U(t){const e=g(t);return e.length>0?e:void 0}function M(t){return(t||[]).map(V)}function A(t){return M(t).filter(e=>e.isActive)}function w(t){return t.kind==="filter"?{inputId:t.id,kind:t.kind,label:t.label,field:m(t.field,"dimension"),operator:t.operator||"in",source:t.source}:{inputId:t.id,kind:t.kind,label:t.label}}function $(t=[]){return t.map(e=>typeof e=="object"?e:{label:String(e),value:e})}function S(t){return t==null?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t.trim().length>0:!0}function V(t){return"toAnalyticsInput"in t?t.toAnalyticsInput():"kind"in t&&"isActive"in t?t:{...t,kind:"filter",isActive:S(t.value),value:t.value}}function k(t){if("source"in t&&t.source)return t.source;const e=t.datasetName||t.dataset;if(!e)throw new Error("Semaphor data app source needs datasetName or dataset.");return{kind:"semantic",domainId:t.domainId,datasetName:e,datasetId:t.datasetId,connectionId:t.connectionId,label:t.sourceLabel}}function N(t){var e,o,n;return!!((e=t.fields)!=null&&e.length||(o=t.dimensions)!=null&&o.length||(n=t.measures)!=null&&n.length)}function j(t){return!!(t!=null&&t.length)}function F(t,e,o){const n=[],r=new Set,a=i=>{const l=`${i.role||""}:${i.name}`;r.has(l)||(r.add(l),n.push(i))};return j(t)&&t.map(i=>m(i)).forEach(a),e==null||e.map(i=>m(i,"dimension")).forEach(a),o==null||o.map(i=>m(i,"measure")).forEach(a),n}function m(t,e){return typeof t=="string"?e?{name:t,role:e}:{name:t}:{...t,role:t.role||e}}function g(t){return(t||[]).map(O)}function L(t){if(!(!t||t==="none"))return typeof t=="object"?t:t==="same_period_last_year"?{kind:"previous_year"}:{kind:t}}function B(){return{executeMetric:(t,e)=>y(t,e),executeRecords:(t,e)=>y(t,e),executeInputOptions:(t,e)=>y(t,e)}}async function y(t,e){if(!e.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const o=await fetch(G(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({intent:t,activeInputs:e.activeInputs,resultShape:t.kind})}),n=await z(o);if(!o.ok||n.error)throw new Error(n.error||`Semaphor Data App execution failed with status ${o.status}.`);return n}async function z(t){const e=await t.text().catch(()=>"");if(!e.trim())return t.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(e)}catch{return t.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:e}:{error:Q(t,e),details:e}}}function Q(t,e){const o=t.statusText?` ${t.statusText}`:"",n=e.replace(/\s+/g," ").trim();return n?`Semaphor Data App execution failed with status ${t.status}${o}: ${n.slice(0,240)}`:`Semaphor Data App execution failed with status ${t.status}${o}.`}function G(t){const e=J(t).replace(/\/+$/,"");return e?e.endsWith("/api")?`${e}/v1/data-app/execute`:`${e}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function J(t){if(t.apiBaseUrl)return t.apiBaseUrl;if(!t.token)return"";try{return T.jwtDecode(t.token).apiServiceUrl||""}catch{return""}}const D=u.createContext({});function _(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function C(){return u.useContext(D)}function W({token:t,apiBaseUrl:e,executor:o,children:n}){var d;const r=_(),a=((d=r==null?void 0:r.authToken)==null?void 0:d.accessToken)||t,i=(r==null?void 0:r.dataApiBaseUrl)||(r==null?void 0:r.apiBaseUrl)||e,l=u.useMemo(()=>B(),[]),s=o||l,p=u.useMemo(()=>({token:a,apiBaseUrl:i,executor:s}),[i,s,a]);return P.jsx(D.Provider,{value:p,children:n})}const I={value:null},H={records:[]},v={options:[]};function X(t){const e=A(t.inputs);try{const o=x(t),n=b(o);return n?{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}:{intent:o,error:null,activeInputs:e,queryKey:c(o,e),idleData:I}}catch(o){const n=h(o);return{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}}}function Y(t){const e=A(t.inputs),o=H;try{const n=R(t),r=b(n);return r?{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}:{intent:n,error:null,activeInputs:e,queryKey:c(n,e),idleData:o}}catch(n){const r=h(n);return{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}}}function Z(t){try{const e=q(t),o=b(e);return o?{error:o,queryKey:c(void 0,void 0,o),idleData:v}:{intent:e,error:null,queryKey:c(e),idleData:v}}catch(e){const o=h(e);return{error:o,queryKey:c(void 0,void 0,o),idleData:v}}}function h(t){return t instanceof Error?t:new Error(String(t))}function b(t){const e=K.validateSemaphorAnalyticsIntent(t);if(e.ok)return null;const o=e.errors.map(n=>n.path?`${n.code} at ${n.path}: ${n.message}`:`${n.code}: ${n.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${o}`)}function c(t,e,o){return JSON.stringify({intent:t,activeInputs:e,error:o==null?void 0:o.message})}function tt(t){const[e,o]=u.useState(t.defaultValue),n=Object.prototype.hasOwnProperty.call(t,"value"),r=n?t.value:e,a=u.useMemo(()=>$(t.options),[t.options]),i=u.useCallback(s=>{var d;const p=s;(d=t.onValueChange)==null||d.call(t,p),n||o(p)},[n,t]),l=u.useCallback(()=>i(void 0),[i]);return u.useMemo(()=>{const s=w(t);return{id:t.id,kind:t.kind,label:t.label,field:s.field,operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0,value:r,options:a,isActive:S(r),setValue:i,clear:l,toAnalyticsInput:()=>({inputId:s.inputId,field:s.field,kind:t.kind,label:t.label,value:r,isActive:S(r),operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0})}},[l,a,i,t,r])}function et(t){const e=u.useMemo(()=>X(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeMetric(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,value:(r==null?void 0:r.value)??null,metrics:r==null?void 0:r.metrics,comparisonValue:r==null?void 0:r.comparisonValue,delta:r==null?void 0:r.delta,deltaPercent:r==null?void 0:r.deltaPercent,records:r==null?void 0:r.records,status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function rt(t){const e=u.useMemo(()=>Y(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeRecords(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,records:(r==null?void 0:r.records)||[],columns:r==null?void 0:r.columns,rowCount:r==null?void 0:r.rowCount,status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function nt(t){const e=u.useMemo(()=>Z(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeInputOptions(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,options:(r==null?void 0:r.options)||[],status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function E(t,e,o,n){const r=C(),a=u.useRef(e),i=u.useRef(n),[l,s]=u.useState({status:"idle",data:o,error:null});return a.current=e,i.current=n,u.useEffect(()=>{let p;try{p=a.current({...r,activeInputs:i.current})}catch(f){s({status:"error",data:o,error:h(f)});return}if(!p){s({status:"idle",data:o,error:null});return}let d=!1;return s(f=>({status:"loading",data:f.data,error:null})),p.then(f=>{d||s({status:"success",data:f,error:null})}).catch(f=>{d||s({status:"error",data:o,error:h(f)})}),()=>{d=!0}},[o,t,r]),l}exports.SemaphorDataAppContext=D;exports.SemaphorDataAppProvider=W;exports.createSemaphorDataAppExecutor=B;exports.hasSemaphorInputValue=S;exports.normalizeSemaphorInputOptions=$;exports.readWindowRuntime=_;exports.toSemaphorActiveInputSnapshots=A;exports.toSemaphorInputBinding=O;exports.toSemaphorInputBindings=U;exports.toSemaphorInputOptionsIntent=q;exports.toSemaphorInputSnapshots=M;exports.toSemaphorInputSpec=w;exports.toSemaphorMetricIntent=x;exports.toSemaphorRecordsIntent=R;exports.useSemaphorDataAppRuntime=C;exports.useSemaphorInput=tt;exports.useSemaphorInputOptions=nt;exports.useSemaphorMetric=et;exports.useSemaphorRecords=rt;