react-semaphor 0.1.359 → 0.1.361

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 (38) hide show
  1. package/dist/chunks/{calendar-preferences-dialog-BeZvsJV0.js → calendar-preferences-dialog-BEKBpwMY.js} +1 -1
  2. package/dist/chunks/{calendar-preferences-dialog-BHq3bPkF.js → calendar-preferences-dialog-GwtaSN53.js} +1 -1
  3. package/dist/chunks/{dashboard-briefing-launcher-gm3YPxOh.js → dashboard-briefing-launcher-D6gGO5wz.js} +3 -3
  4. package/dist/chunks/{dashboard-briefing-launcher-Dr6trdJw.js → dashboard-briefing-launcher-DYxd4856.js} +1 -1
  5. package/dist/chunks/{dashboard-controls-BZljC-GB.js → dashboard-controls-B4u5RsKl.js} +3 -3
  6. package/dist/chunks/{dashboard-controls-4a3fKtuD.js → dashboard-controls-C_rExqPw.js} +1 -1
  7. package/dist/chunks/{dashboard-json-wTRw_VIn.js → dashboard-json-BWWU6a7V.js} +1 -1
  8. package/dist/chunks/{dashboard-json-4uDp0D6Y.js → dashboard-json-CPGTofhm.js} +1 -1
  9. package/dist/chunks/{edit-dashboard-visual-CqnMxF8h.js → edit-dashboard-visual-D_jZ-iix.js} +1 -1
  10. package/dist/chunks/{edit-dashboard-visual-BztJSdkR.js → edit-dashboard-visual-biMO829J.js} +3 -3
  11. package/dist/chunks/{index-DZ3lq1Pk.js → index-CJ2IEuKz.js} +31368 -31127
  12. package/dist/chunks/index-Db1XVmfU.js +1411 -0
  13. package/dist/chunks/{resource-management-panel-CEVKKwSW.js → resource-management-panel-B9-5VHYe.js} +2 -2
  14. package/dist/chunks/{resource-management-panel-BajPY5IU.js → resource-management-panel-Bam-yvnt.js} +1 -1
  15. package/dist/chunks/{use-create-flow-overlay-state-CT1BlsPJ.js → use-create-flow-overlay-state-DAvEqaJV.js} +2 -2
  16. package/dist/chunks/{use-create-flow-overlay-state-D010FtSh.js → use-create-flow-overlay-state-dhxgdLYo.js} +1 -1
  17. package/dist/chunks/{use-visual-utils-CIHFvxpt.js → use-visual-utils-CAKdXsr5.js} +1 -1
  18. package/dist/chunks/{use-visual-utils-H2FXMsGo.js → use-visual-utils-FoHNPwpu.js} +1 -1
  19. package/dist/chunks/validation-3nSax_Vs.js +672 -0
  20. package/dist/chunks/validation-bKtG7HIt.js +1 -0
  21. package/dist/dashboard/index.cjs +1 -1
  22. package/dist/dashboard/index.js +1 -1
  23. package/dist/data-app-builder/index.cjs +1 -1
  24. package/dist/data-app-builder/index.js +1 -1
  25. package/dist/data-app-sdk/index.cjs +1 -1
  26. package/dist/data-app-sdk/index.js +308 -440
  27. package/dist/data-app-sdk-validation/index.cjs +1 -0
  28. package/dist/data-app-sdk-validation/index.js +7 -0
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +5 -5
  31. package/dist/style.css +1 -1
  32. package/dist/surfboard/index.cjs +1 -1
  33. package/dist/surfboard/index.js +2 -2
  34. package/dist/types/data-app-builder.d.ts +68 -9
  35. package/dist/types/data-app-sdk-validation.d.ts +595 -0
  36. package/dist/types/data-app-sdk.d.ts +333 -0
  37. package/package.json +6 -1
  38. package/dist/chunks/index-YZnHD2NF.js +0 -1410
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-YZnHD2NF.js");exports.DataAppBuilder=e.DataAppBuilder;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-Db1XVmfU.js");exports.DataAppBuilder=e.DataAppBuilder;
@@ -1,4 +1,4 @@
1
- import { b as r } from "../chunks/index-DZ3lq1Pk.js";
1
+ import { b as r } from "../chunks/index-CJ2IEuKz.js";
2
2
  export {
3
3
  r as DataAppBuilder
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../chunks/source-identity-C-xaeE_I.js"),K=require("../chunks/index-BxM99sFL.js"),a=require("react"),F=require("react/jsx-runtime"),z=require("../chunks/validators-Cu_w8ZEP.js");function E(e){var r;const t=j(e);return{version:1,kind:"metric",id:e.id,label:e.label,source:k(e),metrics:t,primaryMetric:V(e,t),dateField:e.dateField?l(e.dateField,"date"):void 0,timeGrain:e.timeGrain,dimensions:(r=e.dimensions)==null?void 0:r.map(n=>l(n,"dimension")),comparison:Y(e.comparison),orderBy:e.orderBy?{field:l(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:R(e.inputs),limit:e.limit}}function V(e,t){if(!e.primaryMetric)return t[0]||{name:"",role:"measure"};const r=l(e.primaryMetric,"measure"),n=G(r,t),o=n.length===1?n[0]:void 0;return o?B(r,o):r}function j(e){const t=[];for(const r of e.metrics.map(n=>l(n,"measure"))){if(!r.name)continue;const n=t.findIndex(o=>N(o,r));if(n===-1){t.push(r);continue}t[n]=B(t[n],r)}return t}function N(e,t){return A.semaphorFieldRefsMatch(e,t)&&y(e)===y(t)}function Q(e,t){return y(t)===y(e)}function L(e,t){return t.name!==e.name||e.source&&!A.semaphorFieldRefsMatch(t,e)?!1:Q(e,t)}function G(e,t){const r=t.filter(n=>L(e,n));return e.aggregate!==void 0,r}function y(e){return(e.aggregate||"SUM").toUpperCase()}function B(e,t){if(e.aggregate&&t.aggregate&&e.aggregate!==t.aggregate)throw new Error(`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${t.aggregate}.`);return{...A.preferSemaphorFieldRefMetadata(e,t),aggregate:e.aggregate||t.aggregate}}function w(e){if("sort"in e)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!X(e))throw new Error("useSemaphorRecords needs at least one field.");const t=J(e.fields);return{version:1,kind:"records",id:e.id,label:e.label,source:k(e),fields:t,dateField:e.dateField?l(e.dateField,"date"):void 0,timeGrain:e.timeGrain,orderBy:e.orderBy?{field:l(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:R(e.inputs),limit:e.limit}}function J(e){return e.map(t=>{const r=l(t);if(!r.role)throw new Error(`useSemaphorRecords field "${r.name}" needs an explicit role.`);return r})}function O(e){return{version:1,kind:"inputOptions",id:e.id,label:e.label,source:k(e),field:l(e.field,"dimension"),search:e.search,limit:e.limit}}function q(e){if("toAnalyticsInput"in e){const t=e.toAnalyticsInput();return{inputId:t.inputId,...t.field?{field:t.field}:{}}}return{inputId:e.inputId,...e.field?{field:e.field}:{}}}function H(e){const t=R(e);return t.length>0?t:void 0}function $(e){return(e||[]).map(W)}function M(e){return $(e).filter(t=>t.isActive)}function C(e){return e.kind==="filter"?{inputId:e.id,kind:e.kind,label:e.label,field:l(e.field,"dimension"),operator:e.operator||"in"}:{inputId:e.id,kind:e.kind,label:e.label}}function T(e=[]){return e.map(t=>typeof t=="object"?t:{label:String(t),value:t})}function g(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim().length>0:!0}function W(e){return"toAnalyticsInput"in e?e.toAnalyticsInput():"kind"in e&&"isActive"in e?e:{...e,kind:"filter",isActive:g(e.value),value:e.value}}function k(e){return e.source}function X(e){var t;return!!((t=e.fields)!=null&&t.length)}function l(e,t){return{...e,role:e.role||t}}function R(e){return(e||[]).map(q)}function Y(e){if(e)return e}function P(){return{executeMetric:(e,t)=>S(e,t),executeRecords:(e,t)=>S(e,t),executeInputOptions:(e,t)=>S(e,t)}}async function S(e,t){if(!t.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const r=await fetch(te(t),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.token}`},body:JSON.stringify({intent:e,activeInputs:t.activeInputs,resultShape:e.kind})}),n=await Z(r);if(!r.ok||n.error)throw new Error(n.error||`Semaphor Data App execution failed with status ${r.status}.`);return n}async function Z(e){const t=await e.text().catch(()=>"");if(!t.trim())return e.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(t)}catch{return e.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:t}:{error:ee(e,t),details:t}}}function ee(e,t){const r=e.statusText?` ${e.statusText}`:"",n=t.replace(/\s+/g," ").trim();return n?`Semaphor Data App execution failed with status ${e.status}${r}: ${n.slice(0,240)}`:`Semaphor Data App execution failed with status ${e.status}${r}.`}function te(e){const t=re(e).replace(/\/+$/,"");return t?t.endsWith("/api")?`${t}/v1/data-app/execute`:`${t}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function re(e){if(e.apiBaseUrl)return e.apiBaseUrl;if(!e.token)return"";try{return K.jwtDecode(e.token).apiServiceUrl||""}catch{return""}}const D=a.createContext({});function U(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function _(){return a.useContext(D)}function ne({token:e,apiBaseUrl:t,executor:r,children:n}){var d;const o=U(),u=((d=o==null?void 0:o.authToken)==null?void 0:d.accessToken)||e,i=(o==null?void 0:o.dataApiBaseUrl)||(o==null?void 0:o.apiBaseUrl)||t,m=a.useMemo(()=>P(),[]),s=r||m,f=a.useMemo(()=>({token:u,apiBaseUrl:i,executor:s}),[i,s,u]);return F.jsx(D.Provider,{value:f,children:n})}const v={value:null},oe={records:[]},I={options:[]};function ie(e){const t=M(e.inputs);try{const r=E(e),n=b(r);return n?{error:n,activeInputs:t,queryKey:c(void 0,t,n),idleData:v}:{intent:r,error:null,activeInputs:t,queryKey:c(r,t),idleData:v}}catch(r){const n=h(r);return{error:n,activeInputs:t,queryKey:c(void 0,t,n),idleData:v}}}function ae(e){const t=M(e.inputs),r=oe;try{const n=w(e),o=b(n);return o?{error:o,activeInputs:t,queryKey:c(void 0,t,o),idleData:r}:{intent:n,error:null,activeInputs:t,queryKey:c(n,t),idleData:r}}catch(n){const o=h(n);return{error:o,activeInputs:t,queryKey:c(void 0,t,o),idleData:r}}}function ue(e){try{const t=O(e),r=b(t);return r?{error:r,queryKey:c(void 0,void 0,r),idleData:I}:{intent:t,error:null,queryKey:c(t),idleData:I}}catch(t){const r=h(t);return{error:r,queryKey:c(void 0,void 0,r),idleData:I}}}function h(e){return e instanceof Error?e:new Error(String(e))}function b(e){const t=z.validateSemaphorAnalyticsIntent(e);if(t.ok)return null;const r=t.errors.map(n=>n.path?`${n.code} at ${n.path}: ${n.message}`:`${n.code}: ${n.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${r}`)}function c(e,t,r){return JSON.stringify({intent:e,activeInputs:t,error:r==null?void 0:r.message})}function se(e){const[t,r]=a.useState(e.defaultValue),n=Object.prototype.hasOwnProperty.call(e,"value"),o=n?e.value:t,u=a.useMemo(()=>T(e.options),[e.options]),i=a.useCallback(s=>{var d;const f=s;(d=e.onValueChange)==null||d.call(e,f),n||r(f)},[n,e]),m=a.useCallback(()=>i(void 0),[i]);return a.useMemo(()=>{const s=C(e);return{id:e.id,kind:e.kind,label:e.label,field:s.field,operator:s.operator,controlRole:e.kind==="control"?e.role:void 0,value:o,options:u,isActive:g(o),setValue:i,clear:m,toAnalyticsInput:()=>({inputId:s.inputId,field:s.field,kind:e.kind,label:e.label,value:o,isActive:g(o),operator:s.operator,controlRole:e.kind==="control"?e.role:void 0})}},[m,u,i,e,o])}function le(e){const t=a.useMemo(()=>ie(e),[e]),r=a.useCallback(u=>{var i;return t.intent?(i=u.executor)==null?void 0:i.executeMetric(t.intent,u):void 0},[t.intent]),n=x(t.queryKey,r,t.idleData,t.activeInputs),o=t.error?t.idleData:n.data;return{id:e.id,intent:t.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:t.error?"error":n.status,isLoading:!t.error&&n.status==="loading",error:t.error||n.error}}function de(e){const t=a.useMemo(()=>ae(e),[e]),r=a.useCallback(u=>{var i;return t.intent?(i=u.executor)==null?void 0:i.executeRecords(t.intent,u):void 0},[t.intent]),n=x(t.queryKey,r,t.idleData,t.activeInputs),o=t.error?t.idleData:n.data;return{id:e.id,intent:t.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,status:t.error?"error":n.status,isLoading:!t.error&&n.status==="loading",error:t.error||n.error}}function ce(e){const t=a.useMemo(()=>ue(e),[e]),r=a.useCallback(u=>{var i;return t.intent?(i=u.executor)==null?void 0:i.executeInputOptions(t.intent,u):void 0},[t.intent]),n=x(t.queryKey,r,t.idleData),o=t.error?t.idleData:n.data;return{id:e.id,intent:t.intent,options:(o==null?void 0:o.options)||[],status:t.error?"error":n.status,isLoading:!t.error&&n.status==="loading",error:t.error||n.error}}function x(e,t,r,n){const o=_(),u=a.useRef(t),i=a.useRef(n),[m,s]=a.useState({status:"idle",data:r,error:null});return u.current=t,i.current=n,a.useEffect(()=>{let f;try{f=u.current({...o,activeInputs:i.current})}catch(p){s({status:"error",data:r,error:h(p)});return}if(!f){s({status:"idle",data:r,error:null});return}let d=!1;return s(p=>({status:"loading",data:p.data,error:null})),f.then(p=>{d||s({status:"success",data:p,error:null})}).catch(p=>{d||s({status:"error",data:r,error:h(p)})}),()=>{d=!0}},[r,e,o]),m}exports.SemaphorDataAppContext=D;exports.SemaphorDataAppProvider=ne;exports.createSemaphorQueryExecutor=P;exports.hasSemaphorInputValue=g;exports.normalizeSemaphorInputOptions=T;exports.readWindowRuntime=U;exports.toSemaphorActiveInputSnapshots=M;exports.toSemaphorInputBinding=q;exports.toSemaphorInputBindings=H;exports.toSemaphorInputOptionsIntent=O;exports.toSemaphorInputSnapshots=$;exports.toSemaphorInputSpec=C;exports.toSemaphorMetricIntent=E;exports.toSemaphorRecordsIntent=w;exports.useSemaphorDataAppRuntime=_;exports.useSemaphorInput=se;exports.useSemaphorInputOptions=ce;exports.useSemaphorMetric=le;exports.useSemaphorRecords=de;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/validation-bKtG7HIt.js"),O=require("../chunks/index-BxM99sFL.js"),u=require("react"),E=require("react/jsx-runtime"),g=require("../chunks/validators-Cu_w8ZEP.js");function R(){return{executeAnalysis:(t,e,n)=>y(t,e,n??{}),executeMetric:(t,e)=>y(t,e),executeRecords:(t,e)=>y(t,e),executeInputOptions:(t,e)=>y(t,e)}}async function y(t,e,n){if(!e.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const o=await fetch(T(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({intent:t,activeInputs:e.activeInputs,...n?{analysisOptions:n}:{},resultShape:t.kind})}),r=await b(o);if(!o.ok||r.error)throw new Error(r.error||`Semaphor Data App execution failed with status ${o.status}.`);return r}async function b(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:M(t,e),details:e}}}function M(t,e){const n=t.statusText?` ${t.statusText}`:"",o=e.replace(/\s+/g," ").trim();return o?`Semaphor Data App execution failed with status ${t.status}${n}: ${o.slice(0,240)}`:`Semaphor Data App execution failed with status ${t.status}${n}.`}function T(t){const e=C(t).replace(/\/+$/,"");return e?e.endsWith("/api")?`${e}/v1/data-app/execute`:`${e}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function C(t){if(t.apiBaseUrl)return t.apiBaseUrl;if(!t.token)return"";try{return O.jwtDecode(t.token).apiServiceUrl||""}catch{return""}}const x=u.createContext({});function k(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function q(){return u.useContext(x)}function K({token:t,apiBaseUrl:e,executor:n,children:o}){var l;const r=k(),s=((l=r==null?void 0:r.authToken)==null?void 0:l.accessToken)||t,i=(r==null?void 0:r.dataApiBaseUrl)||(r==null?void 0:r.apiBaseUrl)||e,m=u.useMemo(()=>R(),[]),c=n||m,d=u.useMemo(()=>({token:s,apiBaseUrl:i,executor:c}),[i,c,s]);return E.jsx(x.Provider,{value:d,children:o})}const f={value:null},A={},$={records:[]},D={options:[]};function _(t){const e=a.toSemaphorActiveInputSnapshots(t.inputs),n=a.toSemaphorAnalysisQueryOptions(t);try{const o=a.toSemaphorAnalysisIntent(t),r=v(o);return r?{error:r,activeInputs:e,analysisOptions:n,queryKey:p(void 0,e,r,n),idleData:A}:{intent:o,error:null,activeInputs:e,analysisOptions:n,queryKey:p(o,e,void 0,n),idleData:A}}catch(o){const r=S(o);return{error:r,activeInputs:e,analysisOptions:n,queryKey:p(void 0,e,r,n),idleData:A}}}function P(t){const e=a.toSemaphorActiveInputSnapshots(t.inputs);try{const n=a.toSemaphorMetricIntent(t),o=v(n);return o?{error:o,activeInputs:e,queryKey:p(void 0,e,o),idleData:f}:{intent:n,error:null,activeInputs:e,queryKey:p(n,e),idleData:f}}catch(n){const o=S(n);return{error:o,activeInputs:e,queryKey:p(void 0,e,o),idleData:f}}}function V(t){const e=a.toSemaphorActiveInputSnapshots(t.inputs),n=$;try{const o=a.toSemaphorRecordsIntent(t),r=v(o);return r?{error:r,activeInputs:e,queryKey:p(void 0,e,r),idleData:n}:{intent:o,error:null,activeInputs:e,queryKey:p(o,e),idleData:n}}catch(o){const r=S(o);return{error:r,activeInputs:e,queryKey:p(void 0,e,r),idleData:n}}}function w(t){try{const e=a.toSemaphorInputOptionsIntent(t),n=v(e);return n?{error:n,queryKey:p(void 0,void 0,n),idleData:D}:{intent:e,error:null,queryKey:p(e),idleData:D}}catch(e){const n=S(e);return{error:n,queryKey:p(void 0,void 0,n),idleData:D}}}function S(t){return t instanceof Error?t:new Error(String(t))}function v(t){const e=g.validateSemaphorAnalyticsIntent(t);if(e.ok)return null;const n=e.errors.map(o=>o.path?`${o.code} at ${o.path}: ${o.message}`:`${o.code}: ${o.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${n}`)}function p(t,e,n,o){return JSON.stringify({intent:t,activeInputs:e,analysisOptions:o,error:n==null?void 0:n.message})}function B(t){const[e,n]=u.useState(t.defaultValue),o=Object.prototype.hasOwnProperty.call(t,"value"),r=o?t.value:e,s=u.useMemo(()=>a.normalizeSemaphorInputOptions(t.options),[t.options]),i=u.useCallback(c=>{var l;const d=c;(l=t.onValueChange)==null||l.call(t,d),o||n(d)},[o,t]),m=u.useCallback(()=>i(void 0),[i]);return u.useMemo(()=>{const c=a.toSemaphorInputSpec(t);return{id:t.id,kind:t.kind,label:t.label,field:c.field,operator:c.operator,controlRole:t.kind==="control"?t.role:void 0,value:r,options:s,isActive:a.hasSemaphorInputValue(r),setValue:i,clear:m,toAnalyticsInput:()=>({inputId:c.inputId,field:c.field,kind:t.kind,label:t.label,value:r,isActive:a.hasSemaphorInputValue(r),operator:c.operator,controlRole:t.kind==="control"?t.role:void 0})}},[m,s,i,t,r])}function Q(t){const e=u.useMemo(()=>_(t),[t]),n=u.useCallback(s=>{var i;return e.intent?(i=s.executor)==null?void 0:i.executeAnalysis(e.intent,s,e.analysisOptions):void 0},[e.analysisOptions,e.intent]),o=I(e.queryKey,n,e.idleData,e.activeInputs),r=e.error?e.idleData:o.data;return{id:t.id,intent:e.intent,...r||{},status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function U(t){const e=u.useMemo(()=>P(t),[t]),n=u.useCallback(s=>{var i;return e.intent?(i=s.executor)==null?void 0:i.executeMetric(e.intent,s):void 0},[e.intent]),o=I(e.queryKey,n,e.idleData,e.activeInputs),r=e.error?e.idleData:o.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,executionResult:r==null?void 0:r.executionResult,status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function z(t){const e=u.useMemo(()=>V(t),[t]),n=u.useCallback(s=>{var i;return e.intent?(i=s.executor)==null?void 0:i.executeRecords(e.intent,s):void 0},[e.intent]),o=I(e.queryKey,n,e.idleData,e.activeInputs),r=e.error?e.idleData:o.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,executionResult:r==null?void 0:r.executionResult,status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function L(t){const e=u.useMemo(()=>w(t),[t]),n=u.useCallback(s=>{var i;return e.intent?(i=s.executor)==null?void 0:i.executeInputOptions(e.intent,s):void 0},[e.intent]),o=I(e.queryKey,n,e.idleData),r=e.error?e.idleData:o.data;return{id:t.id,intent:e.intent,options:(r==null?void 0:r.options)||[],executionResult:r==null?void 0:r.executionResult,status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function I(t,e,n,o){const r=q(),s=u.useRef(e),i=u.useRef(o),[m,c]=u.useState({status:"idle",data:n,error:null});return s.current=e,i.current=o,u.useEffect(()=>{let d;try{d=s.current({...r,activeInputs:i.current})}catch(h){c({status:"error",data:n,error:S(h)});return}if(!d){c({status:"idle",data:n,error:null});return}let l=!1;return c(h=>({status:"loading",data:h.data,error:null})),d.then(h=>{l||c({status:"success",data:h,error:null})}).catch(h=>{l||c({status:"error",data:n,error:S(h)})}),()=>{l=!0}},[n,t,r]),m}exports.hasSemaphorInputValue=a.hasSemaphorInputValue;exports.normalizeSemaphorAnalysisQueryOptions=a.normalizeSemaphorAnalysisQueryOptions;exports.normalizeSemaphorInputOptions=a.normalizeSemaphorInputOptions;exports.toSemaphorActiveInputSnapshots=a.toSemaphorActiveInputSnapshots;exports.toSemaphorAnalysisIntent=a.toSemaphorAnalysisIntent;exports.toSemaphorAnalysisQueryOptions=a.toSemaphorAnalysisQueryOptions;exports.toSemaphorInputBinding=a.toSemaphorInputBinding;exports.toSemaphorInputBindings=a.toSemaphorInputBindings;exports.toSemaphorInputOptionsIntent=a.toSemaphorInputOptionsIntent;exports.toSemaphorInputSnapshots=a.toSemaphorInputSnapshots;exports.toSemaphorInputSpec=a.toSemaphorInputSpec;exports.toSemaphorMetricIntent=a.toSemaphorMetricIntent;exports.toSemaphorRecordsIntent=a.toSemaphorRecordsIntent;exports.validateSemaphorDataAppHookSpecs=a.validateSemaphorDataAppHookSpecs;exports.SemaphorDataAppContext=x;exports.SemaphorDataAppProvider=K;exports.createSemaphorQueryExecutor=R;exports.readWindowRuntime=k;exports.useSemaphorAnalysis=Q;exports.useSemaphorDataAppRuntime=q;exports.useSemaphorInput=B;exports.useSemaphorInputOptions=L;exports.useSemaphorMetric=U;exports.useSemaphorRecords=z;