react-semaphor 0.1.377 → 0.1.378
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.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +1 -1
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +6 -6
- package/dist/chunks/{braces-C2uBgj3t.js → braces-BT-ZyB-g.js} +1 -1
- package/dist/chunks/{braces-CkXyWzRh.js → braces-DOxxfERN.js} +1 -1
- package/dist/chunks/calendar-preferences-dialog-CRvQz4TE.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-C55VOTIy.js → calendar-preferences-dialog-DZe8Nd-4.js} +16 -17
- package/dist/chunks/catalog-field-grounding-8L9I0zdg.js +1 -0
- package/dist/chunks/{catalog-field-grounding-DHXEI7cW.js → catalog-field-grounding-BK4BX8sZ.js} +7 -6
- package/dist/chunks/{dashboard-briefing-launcher-DMKfG_z3.js → dashboard-briefing-launcher-BWyHpn2M.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CUyeiL_T.js → dashboard-briefing-launcher-DURdx5Ox.js} +204 -204
- package/dist/chunks/{dashboard-controls-B4hxFc3Q.js → dashboard-controls-D5mjF67R.js} +40 -40
- package/dist/chunks/{dashboard-controls-D4vI0wvU.js → dashboard-controls-J71GLAxt.js} +1 -1
- package/dist/chunks/{dashboard-json-pl1_mFqJ.js → dashboard-json-BumvCRuk.js} +3 -3
- package/dist/chunks/{dashboard-json-DQnm6daE.js → dashboard-json-Cv8jXh0X.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CjTXY51a.js → edit-dashboard-visual-dvhQzG_h.js} +33 -33
- package/dist/chunks/{edit-dashboard-visual-CF4aSsav.js → edit-dashboard-visual-eYJMy7aw.js} +1031 -1032
- package/dist/chunks/{index-B2kPleRS.js → index-c_0nwsOM.js} +199 -194
- package/dist/chunks/{index-Bn866BBY.js → index-hhH5F_tQ.js} +20664 -20526
- package/dist/chunks/{layout-grid-BFmJ7vmH.js → layout-grid-DTbOIOsE.js} +1 -1
- package/dist/chunks/{layout-grid-CTOW9oTg.js → layout-grid-DccceHv4.js} +1 -1
- package/dist/chunks/{palette-OFaniMPn.js → palette-DCzLwqIw.js} +1 -1
- package/dist/chunks/{palette-DrhPeer-.js → palette-SimHJELn.js} +1 -1
- package/dist/chunks/{save-BxWBiQv1.js → save-D2O96E5A.js} +1 -1
- package/dist/chunks/{save-Dh6gSC4x.js → save-zNVYH02T.js} +1 -1
- package/dist/chunks/{switch-C-fGjxjY.js → switch-DMPsMpHW.js} +1 -1
- package/dist/chunks/{switch-D5xopzFD.js → switch-Jhyl63RF.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Dg2ffpCE.js → use-create-flow-overlay-state-D9UKBuCA.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DrKP0jWE.js → use-create-flow-overlay-state-hlsTNh2b.js} +4 -4
- package/dist/chunks/{validation-bMedDBOo.js → validation-BM3-ShHV.js} +1 -1
- package/dist/chunks/{validation-BHFaWDU-.js → validation-BVpqRFar.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +3 -3
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +14 -14
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +44 -0
- package/dist/types/dashboard-assistant.d.ts +42 -0
- package/dist/types/data-app-sdk-validation.d.ts +42 -0
- package/dist/types/data-app-sdk.d.ts +42 -0
- package/package.json +1 -1
- package/dist/chunks/calendar-preferences-dialog-DAukJOaP.js +0 -1
- package/dist/chunks/catalog-field-grounding-BGW0hnB9.js +0 -1
- package/dist/chunks/chevrons-up-down-BnzChFLU.js +0 -14
- package/dist/chunks/chevrons-up-down-W0nzHzx0.js +0 -6
|
@@ -2,7 +2,7 @@ import { jsx as x, jsxs as be, Fragment as Dr } from "react/jsx-runtime";
|
|
|
2
2
|
import * as f from "react";
|
|
3
3
|
import Ce, { createContext as ef, useContext as tf, forwardRef as Bs, createElement as Oo, useLayoutEffect as rf, useState as nf, useMemo as of, useId as af } from "react";
|
|
4
4
|
import { j as ui } from "./index-CuHybtft.js";
|
|
5
|
-
import { c as fi } from "./catalog-field-grounding-
|
|
5
|
+
import { c as fi } from "./catalog-field-grounding-BK4BX8sZ.js";
|
|
6
6
|
import * as Tn from "react-dom";
|
|
7
7
|
import sf from "react-dom";
|
|
8
8
|
import { S as lf, b as ua, c as $s, d as cf, e as df, r as uf } from "./index-CJdxSyQq.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const x=require("react/jsx-runtime"),ie=require("react"),_i=require("./index-BxM99sFL.js"),Oi=require("./catalog-field-grounding-BGW0hnB9.js"),gl=require("react-dom"),ut=require("./index-DRlMUglg.js");require("react-dom/client");const gp=require("../layouts/index.cjs"),xe=require("./index-D7KJindZ.js"),xn=require("./common-types-C73-Ud1-.js");function yl(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const f=yl(ie),Bn=yl(gl),Xa=e=>{let r;const t=new Set,n=(c,u)=>{const d=typeof c=="function"?c(r):c;if(!Object.is(d,r)){const p=r;r=u??(typeof d!="object"||d===null)?d:Object.assign({},r,d),t.forEach(h=>h(r,p))}},o=()=>r,s={setState:n,getState:o,getInitialState:()=>l,subscribe:c=>(t.add(c),()=>t.delete(c))},l=r=e(n,o,s);return s},yp=e=>e?Xa(e):Xa,bp=e=>e;function vp(e,r=bp){const t=ie.useSyncExternalStore(e.subscribe,ie.useCallback(()=>r(e.getState()),[e,r]),ie.useCallback(()=>r(e.getInitialState()),[e,r]));return ie.useDebugValue(t),t}const Za=e=>{const r=yp(e),t=n=>vp(r,n);return Object.assign(t,r),t},_t=e=>e?Za(e):Za;var bl=Symbol.for("immer-nothing"),Qa=Symbol.for("immer-draftable"),Q=Symbol.for("immer-state"),Cp=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function ye(e,...r){if(process.env.NODE_ENV!=="production"){const t=Cp[e],n=typeof t=="function"?t.apply(null,r):t;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Fr=Object.getPrototypeOf;function Qt(e){return!!e&&!!e[Q]}function Ze(e){var r;return e?vl(e)||Array.isArray(e)||!!e[Qa]||!!((r=e.constructor)!=null&&r[Qa])||Br(e)||jn(e):!1}var Sp=Object.prototype.constructor.toString(),Ja=new WeakMap;function vl(e){if(!e||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);if(r===null||r===Object.prototype)return!0;const t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;if(t===Object)return!0;if(typeof t!="function")return!1;let n=Ja.get(t);return n===void 0&&(n=Function.toString.call(t),Ja.set(t,n)),n===Sp}function Dr(e,r,t=!0){$n(e)===0?(t?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{r(o,e[o],e)}):e.forEach((n,o)=>r(o,n,e))}function $n(e){const r=e[Q];return r?r.type_:Array.isArray(e)?1:Br(e)?2:jn(e)?3:0}function ei(e,r){return $n(e)===2?e.has(r):Object.prototype.hasOwnProperty.call(e,r)}function Cl(e,r,t){const n=$n(e);n===2?e.set(r,t):n===3?e.add(t):e[r]=t}function xp(e,r){return e===r?e!==0||1/e===1/r:e!==e&&r!==r}function Br(e){return e instanceof Map}function jn(e){return e instanceof Set}function ue(e){return e.copy_||e.base_}function ti(e,r){if(Br(e))return new Map(e);if(jn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const t=vl(e);if(r===!0||r==="class_only"&&!t){const n=Object.getOwnPropertyDescriptors(e);delete n[Q];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){const a=o[i],s=n[a];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[a]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[a]})}return Object.create(Fr(e),n)}else{const n=Fr(e);if(n!==null&&t)return{...e};const o=Object.create(n);return Object.assign(o,e)}}function Mi(e,r=!1){return Un(e)||Qt(e)||!Ze(e)||($n(e)>1&&Object.defineProperties(e,{set:tn,add:tn,clear:tn,delete:tn}),Object.freeze(e),r&&Object.values(e).forEach(t=>Mi(t,!0))),e}function wp(){ye(2)}var tn={value:wp};function Un(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var ri={};function Tt(e){const r=ri[e];return r||ye(0,e),r}function Ip(e,r){ri[e]||(ri[e]=r)}var Rr;function wn(){return Rr}function Ep(e,r){return{drafts_:[],parent_:e,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function es(e,r){r&&(Tt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=r)}function ni(e){oi(e),e.drafts_.forEach(Tp),e.drafts_=null}function oi(e){e===Rr&&(Rr=e.parent_)}function ts(e){return Rr=Ep(Rr,e)}function Tp(e){const r=e[Q];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function rs(e,r){r.unfinalizedDrafts_=r.drafts_.length;const t=r.drafts_[0];return e!==void 0&&e!==t?(t[Q].modified_&&(ni(r),ye(4)),Ze(e)&&(e=In(r,e),r.parent_||En(r,e)),r.patches_&&Tt("Patches").generateReplacementPatches_(t[Q].base_,e,r.patches_,r.inversePatches_)):e=In(r,t,[]),ni(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==bl?e:void 0}function In(e,r,t){if(Un(r))return r;const n=e.immer_.shouldUseStrictIteration(),o=r[Q];if(!o)return Dr(r,(i,a)=>ns(e,o,r,i,a,t),n),r;if(o.scope_!==e)return r;if(!o.modified_)return En(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const i=o.copy_;let a=i,s=!1;o.type_===3&&(a=new Set(i),i.clear(),s=!0),Dr(a,(l,c)=>ns(e,o,i,l,c,t,s),n),En(e,i,!1),t&&e.patches_&&Tt("Patches").generatePatches_(o,t,e.patches_,e.inversePatches_)}return o.copy_}function ns(e,r,t,n,o,i,a){if(o==null||typeof o!="object"&&!a)return;const s=Un(o);if(!(s&&!a)){if(process.env.NODE_ENV!=="production"&&o===t&&ye(5),Qt(o)){const l=i&&r&&r.type_!==3&&!ei(r.assigned_,n)?i.concat(n):void 0,c=In(e,o,l);if(Cl(t,n,c),Qt(c))e.canAutoFreeze_=!1;else return}else a&&t.add(o);if(Ze(o)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||r&&r.base_&&r.base_[n]===o&&s)return;In(e,o),(!r||!r.scope_.parent_)&&typeof n!="symbol"&&(Br(t)?t.has(n):Object.prototype.propertyIsEnumerable.call(t,n))&&En(e,o)}}}function En(e,r,t=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Mi(r,t)}function Ap(e,r){const t=Array.isArray(e),n={type_:t?1:0,scope_:r?r.scope_:wn(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=Ni;t&&(o=[n],i=Pr);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,s}var Ni={get(e,r){if(r===Q)return e;const t=ue(e);if(!ei(t,r))return Fp(e,t,r);const n=t[r];return e.finalized_||!Ze(n)?n:n===Eo(e.base_,r)?(To(e),e.copy_[r]=_r(n,e)):n},has(e,r){return r in ue(e)},ownKeys(e){return Reflect.ownKeys(ue(e))},set(e,r,t){const n=Sl(ue(e),r);if(n!=null&&n.set)return n.set.call(e.draft_,t),!0;if(!e.modified_){const o=Eo(ue(e),r),i=o==null?void 0:o[Q];if(i&&i.base_===t)return e.copy_[r]=t,e.assigned_[r]=!1,!0;if(xp(t,o)&&(t!==void 0||ei(e.base_,r)))return!0;To(e),Ye(e)}return e.copy_[r]===t&&(t!==void 0||r in e.copy_)||Number.isNaN(t)&&Number.isNaN(e.copy_[r])||(e.copy_[r]=t,e.assigned_[r]=!0),!0},deleteProperty(e,r){return Eo(e.base_,r)!==void 0||r in e.base_?(e.assigned_[r]=!1,To(e),Ye(e)):delete e.assigned_[r],e.copy_&&delete e.copy_[r],!0},getOwnPropertyDescriptor(e,r){const t=ue(e),n=Reflect.getOwnPropertyDescriptor(t,r);return n&&{writable:!0,configurable:e.type_!==1||r!=="length",enumerable:n.enumerable,value:t[r]}},defineProperty(){ye(11)},getPrototypeOf(e){return Fr(e.base_)},setPrototypeOf(){ye(12)}},Pr={};Dr(Ni,(e,r)=>{Pr[e]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}});Pr.deleteProperty=function(e,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&ye(13),Pr.set.call(this,e,r,void 0)};Pr.set=function(e,r,t){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&ye(14),Ni.set.call(this,e[0],r,t,e[0])};function Eo(e,r){const t=e[Q];return(t?ue(t):e)[r]}function Fp(e,r,t){var o;const n=Sl(r,t);return n?"value"in n?n.value:(o=n.get)==null?void 0:o.call(e.draft_):void 0}function Sl(e,r){if(!(r in e))return;let t=Fr(e);for(;t;){const n=Object.getOwnPropertyDescriptor(t,r);if(n)return n;t=Fr(t)}}function Ye(e){e.modified_||(e.modified_=!0,e.parent_&&Ye(e.parent_))}function To(e){e.copy_||(e.copy_=ti(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Dp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(r,t,n)=>{if(typeof r=="function"&&typeof t!="function"){const i=t;t=r;const a=this;return function(l=i,...c){return a.produce(l,u=>t.call(this,u,...c))}}typeof t!="function"&&ye(6),n!==void 0&&typeof n!="function"&&ye(7);let o;if(Ze(r)){const i=ts(this),a=_r(r,void 0);let s=!0;try{o=t(a),s=!1}finally{s?ni(i):oi(i)}return es(i,n),rs(o,i)}else if(!r||typeof r!="object"){if(o=t(r),o===void 0&&(o=r),o===bl&&(o=void 0),this.autoFreeze_&&Mi(o,!0),n){const i=[],a=[];Tt("Patches").generateReplacementPatches_(r,o,i,a),n(i,a)}return o}else ye(1,r)},this.produceWithPatches=(r,t)=>{if(typeof r=="function")return(a,...s)=>this.produceWithPatches(a,l=>r(l,...s));let n,o;return[this.produce(r,t,(a,s)=>{n=a,o=s}),n,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ze(e)||ye(8),Qt(e)&&(e=Rp(e));const r=ts(this),t=_r(e,void 0);return t[Q].isManual_=!0,oi(r),t}finishDraft(e,r){const t=e&&e[Q];(!t||!t.isManual_)&&ye(9);const{scope_:n}=t;return es(n,r),rs(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,r){let t;for(t=r.length-1;t>=0;t--){const o=r[t];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}t>-1&&(r=r.slice(t+1));const n=Tt("Patches").applyPatches_;return Qt(e)?n(e,r):this.produce(e,o=>n(o,r))}};function _r(e,r){const t=Br(e)?Tt("MapSet").proxyMap_(e,r):jn(e)?Tt("MapSet").proxySet_(e,r):Ap(e,r);return(r?r.scope_:wn()).drafts_.push(t),t}function Rp(e){return Qt(e)||ye(10,e),xl(e)}function xl(e){if(!Ze(e)||Un(e))return e;const r=e[Q];let t,n=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,t=ti(e,r.scope_.immer_.useStrictShallowCopy_),n=r.scope_.immer_.shouldUseStrictIteration()}else t=ti(e,!0);return Dr(t,(o,i)=>{Cl(t,o,xl(i))},n),r&&(r.finalized_=!1),t}function Pp(){class e extends Map{constructor(l,c){super(),this[Q]={type_:2,parent_:c,scope_:c?c.scope_:wn(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:l,draft_:this,isManual_:!1,revoked_:!1}}get size(){return ue(this[Q]).size}has(l){return ue(this[Q]).has(l)}set(l,c){const u=this[Q];return a(u),(!ue(u).has(l)||ue(u).get(l)!==c)&&(t(u),Ye(u),u.assigned_.set(l,!0),u.copy_.set(l,c),u.assigned_.set(l,!0)),this}delete(l){if(!this.has(l))return!1;const c=this[Q];return a(c),t(c),Ye(c),c.base_.has(l)?c.assigned_.set(l,!1):c.assigned_.delete(l),c.copy_.delete(l),!0}clear(){const l=this[Q];a(l),ue(l).size&&(t(l),Ye(l),l.assigned_=new Map,Dr(l.base_,c=>{l.assigned_.set(c,!1)}),l.copy_.clear())}forEach(l,c){const u=this[Q];ue(u).forEach((d,p,h)=>{l.call(c,this.get(p),p,this)})}get(l){const c=this[Q];a(c);const u=ue(c).get(l);if(c.finalized_||!Ze(u)||u!==c.base_.get(l))return u;const d=_r(u,c);return t(c),c.copy_.set(l,d),d}keys(){return ue(this[Q]).keys()}values(){const l=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{const c=l.next();return c.done?c:{done:!1,value:this.get(c.value)}}}}entries(){const l=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{const c=l.next();if(c.done)return c;const u=this.get(c.value);return{done:!1,value:[c.value,u]}}}}[Symbol.iterator](){return this.entries()}}function r(s,l){return new e(s,l)}function t(s){s.copy_||(s.assigned_=new Map,s.copy_=new Map(s.base_))}class n extends Set{constructor(l,c){super(),this[Q]={type_:3,parent_:c,scope_:c?c.scope_:wn(),modified_:!1,finalized_:!1,copy_:void 0,base_:l,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return ue(this[Q]).size}has(l){const c=this[Q];return a(c),c.copy_?!!(c.copy_.has(l)||c.drafts_.has(l)&&c.copy_.has(c.drafts_.get(l))):c.base_.has(l)}add(l){const c=this[Q];return a(c),this.has(l)||(i(c),Ye(c),c.copy_.add(l)),this}delete(l){if(!this.has(l))return!1;const c=this[Q];return a(c),i(c),Ye(c),c.copy_.delete(l)||(c.drafts_.has(l)?c.copy_.delete(c.drafts_.get(l)):!1)}clear(){const l=this[Q];a(l),ue(l).size&&(i(l),Ye(l),l.copy_.clear())}values(){const l=this[Q];return a(l),i(l),l.copy_.values()}entries(){const l=this[Q];return a(l),i(l),l.copy_.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(l,c){const u=this.values();let d=u.next();for(;!d.done;)l.call(c,d.value,d.value,this),d=u.next()}}function o(s,l){return new n(s,l)}function i(s){s.copy_||(s.copy_=new Set,s.base_.forEach(l=>{if(Ze(l)){const c=_r(l,s);s.drafts_.set(l,c),s.copy_.add(c)}else s.copy_.add(l)}))}function a(s){s.revoked_&&ye(3,JSON.stringify(ue(s)))}Ip("MapSet",{proxyMap_:r,proxySet_:o})}var _p=new Dp,Op=_p.produce;const Mp=e=>(r,t,n)=>(n.setState=(o,i,...a)=>{const s=typeof o=="function"?Op(o):o;return r(s,i,...a)},e(n.setState,t,n)),zn=Mp;var Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Np(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function n(){return this instanceof n?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),t}var kp=function e(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){if(r.constructor!==t.constructor)return!1;var n,o,i;if(Array.isArray(r)){if(n=r.length,n!=t.length)return!1;for(o=n;o--!==0;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if(i=Object.keys(r),n=i.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!(a==="_owner"&&r.$$typeof)&&!e(r[a],t[a]))return!1}return!0}return r!==r&&t!==t};const ii=qn(kp),xt=new Map;function Lp(e,r){return xt.has(e)||xt.set(e,new Set),xt.get(e).add(r),()=>{var t;(t=xt.get(e))==null||t.delete(r)}}function ki(e){const r=xt.get(e);r&&r.forEach(t=>{try{t()}catch(n){console.error(`Error in store event callback for '${e}':`,n)}})}function Vp(e){e?xt.delete(e):xt.clear()}const et={subscribe:Lp,emit:ki,clear:Vp},Bp=()=>ki("dashboard:load"),$p=()=>ki("dashboard:unload"),os={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Or=new Map,rn=e=>{const r=Or.get(e);return r?Object.fromEntries(Object.entries(r.stores).map(([t,n])=>[t,n.getState()])):{}},jp=(e,r,t)=>{if(e===void 0)return{type:"untracked",connection:r.connect(t)};const n=Or.get(t.name);if(n)return{type:"tracked",store:e,...n};const o={connection:r.connect(t),stores:{}};return Or.set(t.name,o),{type:"tracked",store:e,...o}},Up=(e,r)=>{if(r===void 0)return;const t=Or.get(e);t&&(delete t.stores[r],Object.keys(t.stores).length===0&&Or.delete(e))},zp=e=>{var r,t;if(!e)return;const n=e.split(`
|
|
1
|
+
"use strict";const x=require("react/jsx-runtime"),ie=require("react"),_i=require("./index-BxM99sFL.js"),Oi=require("./catalog-field-grounding-8L9I0zdg.js"),gl=require("react-dom"),ut=require("./index-DRlMUglg.js");require("react-dom/client");const gp=require("../layouts/index.cjs"),xe=require("./index-D7KJindZ.js"),xn=require("./common-types-C73-Ud1-.js");function yl(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const f=yl(ie),Bn=yl(gl),Xa=e=>{let r;const t=new Set,n=(c,u)=>{const d=typeof c=="function"?c(r):c;if(!Object.is(d,r)){const p=r;r=u??(typeof d!="object"||d===null)?d:Object.assign({},r,d),t.forEach(h=>h(r,p))}},o=()=>r,s={setState:n,getState:o,getInitialState:()=>l,subscribe:c=>(t.add(c),()=>t.delete(c))},l=r=e(n,o,s);return s},yp=e=>e?Xa(e):Xa,bp=e=>e;function vp(e,r=bp){const t=ie.useSyncExternalStore(e.subscribe,ie.useCallback(()=>r(e.getState()),[e,r]),ie.useCallback(()=>r(e.getInitialState()),[e,r]));return ie.useDebugValue(t),t}const Za=e=>{const r=yp(e),t=n=>vp(r,n);return Object.assign(t,r),t},_t=e=>e?Za(e):Za;var bl=Symbol.for("immer-nothing"),Qa=Symbol.for("immer-draftable"),Q=Symbol.for("immer-state"),Cp=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function ye(e,...r){if(process.env.NODE_ENV!=="production"){const t=Cp[e],n=typeof t=="function"?t.apply(null,r):t;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Fr=Object.getPrototypeOf;function Qt(e){return!!e&&!!e[Q]}function Ze(e){var r;return e?vl(e)||Array.isArray(e)||!!e[Qa]||!!((r=e.constructor)!=null&&r[Qa])||Br(e)||jn(e):!1}var Sp=Object.prototype.constructor.toString(),Ja=new WeakMap;function vl(e){if(!e||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);if(r===null||r===Object.prototype)return!0;const t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;if(t===Object)return!0;if(typeof t!="function")return!1;let n=Ja.get(t);return n===void 0&&(n=Function.toString.call(t),Ja.set(t,n)),n===Sp}function Dr(e,r,t=!0){$n(e)===0?(t?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{r(o,e[o],e)}):e.forEach((n,o)=>r(o,n,e))}function $n(e){const r=e[Q];return r?r.type_:Array.isArray(e)?1:Br(e)?2:jn(e)?3:0}function ei(e,r){return $n(e)===2?e.has(r):Object.prototype.hasOwnProperty.call(e,r)}function Cl(e,r,t){const n=$n(e);n===2?e.set(r,t):n===3?e.add(t):e[r]=t}function xp(e,r){return e===r?e!==0||1/e===1/r:e!==e&&r!==r}function Br(e){return e instanceof Map}function jn(e){return e instanceof Set}function ue(e){return e.copy_||e.base_}function ti(e,r){if(Br(e))return new Map(e);if(jn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const t=vl(e);if(r===!0||r==="class_only"&&!t){const n=Object.getOwnPropertyDescriptors(e);delete n[Q];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){const a=o[i],s=n[a];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[a]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[a]})}return Object.create(Fr(e),n)}else{const n=Fr(e);if(n!==null&&t)return{...e};const o=Object.create(n);return Object.assign(o,e)}}function Mi(e,r=!1){return Un(e)||Qt(e)||!Ze(e)||($n(e)>1&&Object.defineProperties(e,{set:tn,add:tn,clear:tn,delete:tn}),Object.freeze(e),r&&Object.values(e).forEach(t=>Mi(t,!0))),e}function wp(){ye(2)}var tn={value:wp};function Un(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var ri={};function Tt(e){const r=ri[e];return r||ye(0,e),r}function Ip(e,r){ri[e]||(ri[e]=r)}var Rr;function wn(){return Rr}function Ep(e,r){return{drafts_:[],parent_:e,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function es(e,r){r&&(Tt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=r)}function ni(e){oi(e),e.drafts_.forEach(Tp),e.drafts_=null}function oi(e){e===Rr&&(Rr=e.parent_)}function ts(e){return Rr=Ep(Rr,e)}function Tp(e){const r=e[Q];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function rs(e,r){r.unfinalizedDrafts_=r.drafts_.length;const t=r.drafts_[0];return e!==void 0&&e!==t?(t[Q].modified_&&(ni(r),ye(4)),Ze(e)&&(e=In(r,e),r.parent_||En(r,e)),r.patches_&&Tt("Patches").generateReplacementPatches_(t[Q].base_,e,r.patches_,r.inversePatches_)):e=In(r,t,[]),ni(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==bl?e:void 0}function In(e,r,t){if(Un(r))return r;const n=e.immer_.shouldUseStrictIteration(),o=r[Q];if(!o)return Dr(r,(i,a)=>ns(e,o,r,i,a,t),n),r;if(o.scope_!==e)return r;if(!o.modified_)return En(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const i=o.copy_;let a=i,s=!1;o.type_===3&&(a=new Set(i),i.clear(),s=!0),Dr(a,(l,c)=>ns(e,o,i,l,c,t,s),n),En(e,i,!1),t&&e.patches_&&Tt("Patches").generatePatches_(o,t,e.patches_,e.inversePatches_)}return o.copy_}function ns(e,r,t,n,o,i,a){if(o==null||typeof o!="object"&&!a)return;const s=Un(o);if(!(s&&!a)){if(process.env.NODE_ENV!=="production"&&o===t&&ye(5),Qt(o)){const l=i&&r&&r.type_!==3&&!ei(r.assigned_,n)?i.concat(n):void 0,c=In(e,o,l);if(Cl(t,n,c),Qt(c))e.canAutoFreeze_=!1;else return}else a&&t.add(o);if(Ze(o)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||r&&r.base_&&r.base_[n]===o&&s)return;In(e,o),(!r||!r.scope_.parent_)&&typeof n!="symbol"&&(Br(t)?t.has(n):Object.prototype.propertyIsEnumerable.call(t,n))&&En(e,o)}}}function En(e,r,t=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Mi(r,t)}function Ap(e,r){const t=Array.isArray(e),n={type_:t?1:0,scope_:r?r.scope_:wn(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=Ni;t&&(o=[n],i=Pr);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,s}var Ni={get(e,r){if(r===Q)return e;const t=ue(e);if(!ei(t,r))return Fp(e,t,r);const n=t[r];return e.finalized_||!Ze(n)?n:n===Eo(e.base_,r)?(To(e),e.copy_[r]=_r(n,e)):n},has(e,r){return r in ue(e)},ownKeys(e){return Reflect.ownKeys(ue(e))},set(e,r,t){const n=Sl(ue(e),r);if(n!=null&&n.set)return n.set.call(e.draft_,t),!0;if(!e.modified_){const o=Eo(ue(e),r),i=o==null?void 0:o[Q];if(i&&i.base_===t)return e.copy_[r]=t,e.assigned_[r]=!1,!0;if(xp(t,o)&&(t!==void 0||ei(e.base_,r)))return!0;To(e),Ye(e)}return e.copy_[r]===t&&(t!==void 0||r in e.copy_)||Number.isNaN(t)&&Number.isNaN(e.copy_[r])||(e.copy_[r]=t,e.assigned_[r]=!0),!0},deleteProperty(e,r){return Eo(e.base_,r)!==void 0||r in e.base_?(e.assigned_[r]=!1,To(e),Ye(e)):delete e.assigned_[r],e.copy_&&delete e.copy_[r],!0},getOwnPropertyDescriptor(e,r){const t=ue(e),n=Reflect.getOwnPropertyDescriptor(t,r);return n&&{writable:!0,configurable:e.type_!==1||r!=="length",enumerable:n.enumerable,value:t[r]}},defineProperty(){ye(11)},getPrototypeOf(e){return Fr(e.base_)},setPrototypeOf(){ye(12)}},Pr={};Dr(Ni,(e,r)=>{Pr[e]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}});Pr.deleteProperty=function(e,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&ye(13),Pr.set.call(this,e,r,void 0)};Pr.set=function(e,r,t){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&ye(14),Ni.set.call(this,e[0],r,t,e[0])};function Eo(e,r){const t=e[Q];return(t?ue(t):e)[r]}function Fp(e,r,t){var o;const n=Sl(r,t);return n?"value"in n?n.value:(o=n.get)==null?void 0:o.call(e.draft_):void 0}function Sl(e,r){if(!(r in e))return;let t=Fr(e);for(;t;){const n=Object.getOwnPropertyDescriptor(t,r);if(n)return n;t=Fr(t)}}function Ye(e){e.modified_||(e.modified_=!0,e.parent_&&Ye(e.parent_))}function To(e){e.copy_||(e.copy_=ti(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Dp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(r,t,n)=>{if(typeof r=="function"&&typeof t!="function"){const i=t;t=r;const a=this;return function(l=i,...c){return a.produce(l,u=>t.call(this,u,...c))}}typeof t!="function"&&ye(6),n!==void 0&&typeof n!="function"&&ye(7);let o;if(Ze(r)){const i=ts(this),a=_r(r,void 0);let s=!0;try{o=t(a),s=!1}finally{s?ni(i):oi(i)}return es(i,n),rs(o,i)}else if(!r||typeof r!="object"){if(o=t(r),o===void 0&&(o=r),o===bl&&(o=void 0),this.autoFreeze_&&Mi(o,!0),n){const i=[],a=[];Tt("Patches").generateReplacementPatches_(r,o,i,a),n(i,a)}return o}else ye(1,r)},this.produceWithPatches=(r,t)=>{if(typeof r=="function")return(a,...s)=>this.produceWithPatches(a,l=>r(l,...s));let n,o;return[this.produce(r,t,(a,s)=>{n=a,o=s}),n,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ze(e)||ye(8),Qt(e)&&(e=Rp(e));const r=ts(this),t=_r(e,void 0);return t[Q].isManual_=!0,oi(r),t}finishDraft(e,r){const t=e&&e[Q];(!t||!t.isManual_)&&ye(9);const{scope_:n}=t;return es(n,r),rs(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,r){let t;for(t=r.length-1;t>=0;t--){const o=r[t];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}t>-1&&(r=r.slice(t+1));const n=Tt("Patches").applyPatches_;return Qt(e)?n(e,r):this.produce(e,o=>n(o,r))}};function _r(e,r){const t=Br(e)?Tt("MapSet").proxyMap_(e,r):jn(e)?Tt("MapSet").proxySet_(e,r):Ap(e,r);return(r?r.scope_:wn()).drafts_.push(t),t}function Rp(e){return Qt(e)||ye(10,e),xl(e)}function xl(e){if(!Ze(e)||Un(e))return e;const r=e[Q];let t,n=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,t=ti(e,r.scope_.immer_.useStrictShallowCopy_),n=r.scope_.immer_.shouldUseStrictIteration()}else t=ti(e,!0);return Dr(t,(o,i)=>{Cl(t,o,xl(i))},n),r&&(r.finalized_=!1),t}function Pp(){class e extends Map{constructor(l,c){super(),this[Q]={type_:2,parent_:c,scope_:c?c.scope_:wn(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:l,draft_:this,isManual_:!1,revoked_:!1}}get size(){return ue(this[Q]).size}has(l){return ue(this[Q]).has(l)}set(l,c){const u=this[Q];return a(u),(!ue(u).has(l)||ue(u).get(l)!==c)&&(t(u),Ye(u),u.assigned_.set(l,!0),u.copy_.set(l,c),u.assigned_.set(l,!0)),this}delete(l){if(!this.has(l))return!1;const c=this[Q];return a(c),t(c),Ye(c),c.base_.has(l)?c.assigned_.set(l,!1):c.assigned_.delete(l),c.copy_.delete(l),!0}clear(){const l=this[Q];a(l),ue(l).size&&(t(l),Ye(l),l.assigned_=new Map,Dr(l.base_,c=>{l.assigned_.set(c,!1)}),l.copy_.clear())}forEach(l,c){const u=this[Q];ue(u).forEach((d,p,h)=>{l.call(c,this.get(p),p,this)})}get(l){const c=this[Q];a(c);const u=ue(c).get(l);if(c.finalized_||!Ze(u)||u!==c.base_.get(l))return u;const d=_r(u,c);return t(c),c.copy_.set(l,d),d}keys(){return ue(this[Q]).keys()}values(){const l=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{const c=l.next();return c.done?c:{done:!1,value:this.get(c.value)}}}}entries(){const l=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{const c=l.next();if(c.done)return c;const u=this.get(c.value);return{done:!1,value:[c.value,u]}}}}[Symbol.iterator](){return this.entries()}}function r(s,l){return new e(s,l)}function t(s){s.copy_||(s.assigned_=new Map,s.copy_=new Map(s.base_))}class n extends Set{constructor(l,c){super(),this[Q]={type_:3,parent_:c,scope_:c?c.scope_:wn(),modified_:!1,finalized_:!1,copy_:void 0,base_:l,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return ue(this[Q]).size}has(l){const c=this[Q];return a(c),c.copy_?!!(c.copy_.has(l)||c.drafts_.has(l)&&c.copy_.has(c.drafts_.get(l))):c.base_.has(l)}add(l){const c=this[Q];return a(c),this.has(l)||(i(c),Ye(c),c.copy_.add(l)),this}delete(l){if(!this.has(l))return!1;const c=this[Q];return a(c),i(c),Ye(c),c.copy_.delete(l)||(c.drafts_.has(l)?c.copy_.delete(c.drafts_.get(l)):!1)}clear(){const l=this[Q];a(l),ue(l).size&&(i(l),Ye(l),l.copy_.clear())}values(){const l=this[Q];return a(l),i(l),l.copy_.values()}entries(){const l=this[Q];return a(l),i(l),l.copy_.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(l,c){const u=this.values();let d=u.next();for(;!d.done;)l.call(c,d.value,d.value,this),d=u.next()}}function o(s,l){return new n(s,l)}function i(s){s.copy_||(s.copy_=new Set,s.base_.forEach(l=>{if(Ze(l)){const c=_r(l,s);s.drafts_.set(l,c),s.copy_.add(c)}else s.copy_.add(l)}))}function a(s){s.revoked_&&ye(3,JSON.stringify(ue(s)))}Ip("MapSet",{proxyMap_:r,proxySet_:o})}var _p=new Dp,Op=_p.produce;const Mp=e=>(r,t,n)=>(n.setState=(o,i,...a)=>{const s=typeof o=="function"?Op(o):o;return r(s,i,...a)},e(n.setState,t,n)),zn=Mp;var Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Np(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function n(){return this instanceof n?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),t}var kp=function e(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){if(r.constructor!==t.constructor)return!1;var n,o,i;if(Array.isArray(r)){if(n=r.length,n!=t.length)return!1;for(o=n;o--!==0;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if(i=Object.keys(r),n=i.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!(a==="_owner"&&r.$$typeof)&&!e(r[a],t[a]))return!1}return!0}return r!==r&&t!==t};const ii=qn(kp),xt=new Map;function Lp(e,r){return xt.has(e)||xt.set(e,new Set),xt.get(e).add(r),()=>{var t;(t=xt.get(e))==null||t.delete(r)}}function ki(e){const r=xt.get(e);r&&r.forEach(t=>{try{t()}catch(n){console.error(`Error in store event callback for '${e}':`,n)}})}function Vp(e){e?xt.delete(e):xt.clear()}const et={subscribe:Lp,emit:ki,clear:Vp},Bp=()=>ki("dashboard:load"),$p=()=>ki("dashboard:unload"),os={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Or=new Map,rn=e=>{const r=Or.get(e);return r?Object.fromEntries(Object.entries(r.stores).map(([t,n])=>[t,n.getState()])):{}},jp=(e,r,t)=>{if(e===void 0)return{type:"untracked",connection:r.connect(t)};const n=Or.get(t.name);if(n)return{type:"tracked",store:e,...n};const o={connection:r.connect(t),stores:{}};return Or.set(t.name,o),{type:"tracked",store:e,...o}},Up=(e,r)=>{if(r===void 0)return;const t=Or.get(e);t&&(delete t.stores[r],Object.keys(t.stores).length===0&&Or.delete(e))},zp=e=>{var r,t;if(!e)return;const n=e.split(`
|
|
2
2
|
`),o=n.findIndex(a=>a.includes("api.setState"));if(o<0)return;const i=((r=n[o+1])==null?void 0:r.trim())||"";return(t=/.+ (.+) .+/.exec(i))==null?void 0:t[1]},qp=(e,r={})=>(t,n,o)=>{const{enabled:i,anonymousActionType:a,store:s,...l}=r;let c;try{c=(i??(os?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return e(t,n,o);const{connection:u,...d}=jp(s,c,l);let p=!0;o.setState=(m,b,S)=>{const g=t(m,b);if(!p)return g;const y=S===void 0?{type:a||zp(new Error().stack)||"anonymous"}:typeof S=="string"?{type:S}:S;return s===void 0?(u==null||u.send(y,n()),g):(u==null||u.send({...y,type:`${s}/${y.type}`},{...rn(l.name),[s]:o.getState()}),g)},o.devtools={cleanup:()=>{u&&typeof u.unsubscribe=="function"&&u.unsubscribe(),Up(l.name,s)}};const h=(...m)=>{const b=p;p=!1,t(...m),p=b},v=e(o.setState,n,o);if(d.type==="untracked"?u==null||u.init(v):(d.stores[d.store]=o,u==null||u.init(Object.fromEntries(Object.entries(d.stores).map(([m,b])=>[m,m===d.store?v:b.getState()])))),o.dispatchFromDevtools&&typeof o.dispatch=="function"){let m=!1;const b=o.dispatch;o.dispatch=(...S)=>{(os?"production":void 0)!=="production"&&S[0].type==="__setState"&&!m&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),m=!0),b(...S)}}return u.subscribe(m=>{var b;switch(m.type){case"ACTION":if(typeof m.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return Ao(m.payload,S=>{if(S.type==="__setState"){if(s===void 0){h(S.state);return}Object.keys(S.state).length!==1&&console.error(`
|
|
3
3
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
4
4
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("./switch-
|
|
1
|
+
"use strict";const s=require("./switch-Jhyl63RF.js"),C=require("react"),m=require("./index-c_0nwsOM.js"),e=require("react/jsx-runtime");require("./index-BxM99sFL.js");require("./catalog-field-grounding-8L9I0zdg.js");const Se=require("./save-D2O96E5A.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as ge, H as ie, E as Le, u as Z, G as M, a7 as bt, W as yt, Y as vt, Z as xt, a as fe, $ as Ct, a8 as kt, B as q, e as St, X as et, f as tt, a9 as Nt, aa as wt, ab as pe, ac as je, ad as Qe, ae as Se, af as Ne, ag as Dt, ah as $e, ai as Et, aj as It, ak as me, al as Ft, am as Pe, g as He, an as at, ao as rt, ap as st, L as oe, a0 as nt, a1 as we, a2 as De, a3 as Ee, a4 as Ie, a5 as Fe, aq as ot, ar as Vt, as as Tt, at as We, au as _t, av as Ke, aw as Lt, ax as Ve } from "./switch-
|
|
1
|
+
import { c as ge, H as ie, E as Le, u as Z, G as M, a7 as bt, W as yt, Y as vt, Z as xt, a as fe, $ as Ct, a8 as kt, B as q, e as St, X as et, f as tt, a9 as Nt, aa as wt, ab as pe, ac as je, ad as Qe, ae as Se, af as Ne, ag as Dt, ah as $e, ai as Et, aj as It, ak as me, al as Ft, am as Pe, g as He, an as at, ao as rt, ap as st, L as oe, a0 as nt, a1 as we, a2 as De, a3 as Ee, a4 as Ie, a5 as Fe, aq as ot, ar as Vt, as as Tt, at as We, au as _t, av as Ke, aw as Lt, ax as Ve } from "./switch-DMPsMpHW.js";
|
|
2
2
|
import { useState as K, useEffect as de, useCallback as R, useMemo as P, useRef as Te, Fragment as At } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { aD as qt, u as Mt, aE as ce, aF as Ot, aG as Ae, aH as zt, aI as Ut, aJ as Rt, p as B, aK as Bt, aL as jt, aM as lt, aN as Qt, aO as $t, aP as Pt, aQ as Ht, aR as Wt, y as Kt, aS as Yt, aT as it, aU as dt, aV as Gt, aW as Jt, aX as Xt, ay as Ye, aY as Zt, aZ as ea, a_ as ct, a$ as ut, b0 as ta, b1 as aa, b2 as ra, b3 as sa, b4 as na, ar as oa, b5 as la, b6 as ia } from "./index-hhH5F_tQ.js";
|
|
4
4
|
import { jsx as a, jsxs as m, Fragment as re } from "react/jsx-runtime";
|
|
5
5
|
import "./index-CuHybtft.js";
|
|
6
|
-
import "./catalog-field-grounding-
|
|
7
|
-
import { S as pt } from "./save-
|
|
6
|
+
import "./catalog-field-grounding-BK4BX8sZ.js";
|
|
7
|
+
import { S as pt } from "./save-zNVYH02T.js";
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.453.0 - ISC
|
|
10
10
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as z, c as D } from "./validators-CtNmgsvG.js";
|
|
2
|
-
import { n as O } from "./catalog-field-grounding-
|
|
2
|
+
import { n as O } from "./catalog-field-grounding-BK4BX8sZ.js";
|
|
3
3
|
import { b as M, c as j, a as q } from "./source-identity-Dj3dryN9.js";
|
|
4
4
|
function x(e) {
|
|
5
5
|
var t, i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const x=require("./validators-jpoYhpHh.js"),V=require("./catalog-field-grounding-BGW0hnB9.js"),c=require("./source-identity-C-xaeE_I.js");function S(e){var t,i;const r=G(e);return{version:1,kind:"metric",id:e.id,label:e.label,source:g(e),metrics:r,primaryMetric:L(e,r),dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,dimensions:(t=e.dimensions)==null?void 0:t.map(o=>a(o,"dimension")),comparison:le(e.comparison),orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:p(e.inputs),limit:e.limit,...(i=e.derivedFields)!=null&&i.length?{derivedFields:e.derivedFields}:{}}}function R(e){var t;return{...S(e),...e.timeWindow?{timeWindow:e.timeWindow}:{},...(t=e.filters)!=null&&t.length?{filters:e.filters}:{},...e.analysis?{analysis:e.analysis}:{}}}function W(e){return{...e.chartTitle?{chartTitle:e.chartTitle}:{},...e.chartType?{chartType:e.chartType}:{},...e.driverMode?{driverMode:e.driverMode}:{},...e.includePopulation!==void 0?{includePopulation:e.includePopulation}:{},...e.calendarContext?{calendarContext:e.calendarContext}:{}}}function L(e,r){if(!e.primaryMetric)return r[0]||{name:"",role:"measure"};const t=a(e.primaryMetric,"measure"),i=Y(t,r),o=i.length===1?i[0]:void 0;return o?C(t,o):t}function G(e){const r=[];for(const t of e.metrics.map(i=>a(i,"measure"))){if(!t.name)continue;const i=r.findIndex(o=>U(o,t));if(i===-1){r.push(t);continue}r[i]=C(r[i],t)}return r}function U(e,r){return c.semaphorFieldRefsMatch(e,r)&&h(e)===h(r)}function J(e,r){return h(r)===h(e)}function X(e,r){return r.name!==e.name||e.source&&!c.semaphorFieldRefsMatch(r,e)?!1:J(e,r)}function Y(e,r){const t=r.filter(i=>X(e,i));return e.aggregate!==void 0,t}function h(e){return(e.aggregate||"SUM").toUpperCase()}function C(e,r){if(e.aggregate&&r.aggregate&&e.aggregate!==r.aggregate)throw new Error(`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${r.aggregate}.`);return{...c.preferSemaphorFieldRefMetadata(e,r),aggregate:e.aggregate||r.aggregate}}function H(e){var t,i;if("sort"in e)throw new Error("semaphor.records supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!de(e))throw new Error("semaphor.records needs at least one field.");const r=Z(e.fields);return{version:1,kind:"records",id:e.id,label:e.label,source:g(e),fields:r,dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,...e.timeWindow?{timeWindow:e.timeWindow}:{},...(t=e.filters)!=null&&t.length?{filters:e.filters}:{},orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:p(e.inputs),limit:e.limit,...e.pagination?{pagination:e.pagination}:{},...(i=e.derivedFields)!=null&&i.length?{derivedFields:e.derivedFields}:{}}}function Z(e){return e.map(r=>{const t=a(r);if(!t.role)throw new Error(`semaphor.records field "${t.name}" needs an explicit role.`);return t})}function T(e){var r;return{version:1,kind:"inputOptions",id:e.id,label:e.label,source:g(e),field:a(e.field,"dimension"),search:e.search,limit:e.limit,...(r=e.derivedFields)!=null&&r.length?{derivedFields:e.derivedFields}:{}}}function P(e){var r;return{version:1,kind:"sql",id:e.id,label:e.label,source:e.source,sql:e.sql,...e.defaultParameters?{defaultParameters:e.defaultParameters}:{},...e.pythonCode?{pythonCode:e.pythonCode}:{},...(r=e.fields)!=null&&r.length?{fields:e.fields.map(t=>a(t))}:{},inputs:p(e.inputs),limit:e.limit,...e.pagination?{pagination:e.pagination}:{},rationale:e.rationale}}function B(e){var r,t;return{version:1,kind:"matrix",id:e.id,label:e.label,source:g(e),rows:e.rows.map(i=>A(i,"dimension")),...e.columns?{columns:e.columns.map(i=>A(i,"dimension"))}:{},values:e.values.map(ee),...(r=e.filters)!=null&&r.length?{filters:e.filters}:{},inputs:p(e.inputs),...e.totals?{totals:e.totals}:{},...(t=e.sort)!=null&&t.length?{sort:e.sort}:{},...e.expansion?{expansion:e.expansion}:{},...e.layout?{layout:e.layout}:{},...e.displayLimits?{displayLimits:e.displayLimits}:{}}}function A(e,r){return re(e)?{...e,field:a(e.field,r)}:{field:a(e,r)}}function ee(e){return te(e)?{...e,field:a(e.field,"measure")}:{field:a(e,"measure"),aggregate:e.aggregate}}function re(e){return"field"in e}function te(e){return"field"in e}function D(e){if("toAnalyticsInput"in e){const n=e.toAnalyticsInput();return{inputId:n.inputId,kind:n.kind,...n.controlRole?{controlRole:n.controlRole}:{},...n.operator?{operator:n.operator}:{},...n.field?{field:n.field}:{}}}if("id"in e){const n=k(e);return{inputId:n.inputId,kind:n.kind,...n.controlRole?{controlRole:n.controlRole}:{},...n.operator?{operator:n.operator}:{},...n.field?{field:n.field}:{}}}const r="kind"in e?e.kind:void 0,t="operator"in e?O(e.operator,e.inputId):void 0,i="controlRole"in e?e.controlRole:"role"in e?e.role:void 0,o=ie(i)?i:void 0;return{inputId:e.inputId,...r?{kind:r}:{},...o?{controlRole:o}:{},...t?{operator:t}:{},...e.field?{field:e.field}:{}}}function ie(e){return e==="grain"||e==="metric"||e==="dimension"||e==="aggregation"||e==="sqlParam"}function oe(e){const r=p(e);return r.length>0?r:void 0}function z(e){return(e||[]).map(se)}function ne(e){return z(e).filter(r=>r.isActive)}function k(e){if(e.kind==="filter"){const r=O(e.operator,e.id);return{inputId:e.id,kind:e.kind,label:e.label,field:a(e.field,"dimension"),operator:r||"in"}}return{inputId:e.id,kind:e.kind,label:e.label,controlRole:e.role}}function ae(e=[]){return e.map(r=>typeof r=="object"?r:{label:String(r),value:r})}function I(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim().length>0:!0}function se(e){if("toAnalyticsInput"in e)return e.toAnalyticsInput();if("kind"in e&&"isActive"in e)return e;if("id"in e){const r=k(e),t=Object.prototype.hasOwnProperty.call(e,"value")?e.value:e.defaultValue;return{inputId:r.inputId,kind:r.kind,label:r.label,...r.field?{field:r.field}:{},...r.operator?{operator:r.operator}:{},...r.controlRole?{controlRole:r.controlRole}:{},value:t,isActive:I(t)}}return{...e,kind:"filter",isActive:I(e.value),value:e.value}}function g(e){return e.source}function de(e){var r;return!!((r=e.fields)!=null&&r.length)}function a(e,r){return{...e,role:e.role||r}}function p(e){return(e||[]).map(D)}function le(e){if(e)return e}function O(e,r){if(e===void 0)return;const t=x.normalizeSemaphorInputOperator(e);if(!t)throw new Error(`useSemaphorInput "${r}" uses unsupported filter operator "${e}".`);return t}function j(e,r={}){const t=r.pathPrefix||"analysisOptions";if(e===void 0)return{ok:!0};if(!e||typeof e!="object"||Array.isArray(e))return u(t,"Data App analysis options must be an object.");const i=e,o={};if(i.chartTitle!==void 0){if(typeof i.chartTitle!="string")return u(`${t}.chartTitle`,'Data App analysis option "chartTitle" must be a string.');o.chartTitle=i.chartTitle}if(i.chartType!==void 0){if(typeof i.chartType!="string")return u(`${t}.chartType`,'Data App analysis option "chartType" must be a string.');o.chartType=i.chartType}if(i.driverMode!==void 0){if(!ce(i.driverMode))return u(`${t}.driverMode`,'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.');o.driverMode=i.driverMode}if(i.includePopulation!==void 0){if(typeof i.includePopulation!="boolean")return u(`${t}.includePopulation`,'Data App analysis option "includePopulation" must be a boolean.');o.includePopulation=i.includePopulation}if(i.calendarContext!==void 0){const n=ye(i.calendarContext,{pathPrefix:`${t}.calendarContext`,validateTimezone:r.validateTimezone});if(!n.ok)return n;o.calendarContext=n.calendarContext}return{ok:!0,analysisOptions:o}}function ue(e){const r=e.queries.map((o,n)=>fe(o,n,{fieldCatalogs:e.fieldCatalogs||[],requireFieldCatalog:!!e.requireFieldCatalog,validateTimezone:e.validateTimezone})),t=r.flatMap(o=>o.diagnostics),i=r.map(o=>o.executionResult);return{ok:t.every(o=>o.severity!=="error"),diagnostics:t,queries:r,intents:r.flatMap(o=>o.intent?[o.intent]:[]),executionResults:i}}function fe(e,r,t){const i=`queries.${r}`;try{const o=pe(e),n=xe(e,o),s=x.validateSemaphorAnalyticsIntent(o),d=[...ke({querySpec:e,queryId:n,intent:o,pathPrefix:i}),...s.errors.map(m=>w(m,{queryHook:e.queryHook,queryId:n,pathPrefix:i,severity:"error",intent:o})),...s.warnings.map(m=>w(m,{queryHook:e.queryHook,queryId:n,pathPrefix:i,severity:"warning",intent:o})),...ge({querySpec:e,queryId:n,intent:o,pathPrefix:i,fieldCatalogs:t.fieldCatalogs,requireFieldCatalog:t.requireFieldCatalog}),...Se({querySpec:e,queryId:n,intent:o,pathPrefix:i,validateTimezone:t.validateTimezone})],l=Fe(s,d);return{queryHook:e.queryHook,queryId:n,intent:o,diagnostics:d,executionResult:F({intent:o,validation:l,diagnostics:d})}}catch(o){const n={severity:"error",code:"invalid_query_spec",message:o instanceof Error?o.message:String(o),path:i,queryHook:e.queryHook,queryId:N(e.spec)},s=K([n]);return{queryHook:e.queryHook,queryId:n.queryId,diagnostics:[n],executionResult:F({validation:s,diagnostics:[n]})}}}function u(e,r){return{ok:!1,issues:[{code:"invalid_analysis_option",message:r,path:e}]}}function Q(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function ce(e){return e==="absolute_delta"||e==="largest_negative"||e==="largest_positive"||e==="positive_and_negative"||e==="all"}function me(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function ye(e,r){var l;if(!e||typeof e!="object"||Array.isArray(e))return u(r.pathPrefix,'Data App analysis option "calendarContext" must be an object.');const t=e,i=t.tz,o=t.weekStart,n=t.anchor,s=n&&typeof n=="object"&&!Array.isArray(n)?n.iso:void 0,d=typeof i=="string"?((l=r.validateTimezone)==null?void 0:l.call(r,i))??i:null;return d?typeof o!="number"||!Number.isInteger(o)||o<0||o>6?u(`${r.pathPrefix}.weekStart`,'Data App analysis option "calendarContext.weekStart" must be an integer from 0 to 6.'):n!=="now"&&!(typeof s=="string"&&me(s))?u(`${r.pathPrefix}.anchor`,'Data App analysis option "calendarContext.anchor" must be "now" or an object with a valid iso string.'):{ok:!0,calendarContext:{tz:d,weekStart:o,anchor:n}}:u(`${r.pathPrefix}.tz`,'Data App analysis option "calendarContext.tz" must be a valid timezone string.')}function pe(e){return he(e.spec)}function he(e){if(!Q(e))throw new Error("useSemaphorQuery spec must be an object.");if(e.queryKind==="metric")return S(e);if(e.queryKind==="analysis")return R(e);if(e.queryKind==="records")return H(e);if(e.queryKind==="sql")return P(e);if(e.queryKind==="matrix")return B(e);if(e.queryKind==="inputOptions")return T(e);throw new Error("useSemaphorQuery spec.queryKind must be metric, analysis, records, inputOptions, sql, or matrix.")}function ge(e){if(e.intent.kind==="sql")return[];if(e.fieldCatalogs.length===0&&!e.requireFieldCatalog)return[];const r=Ae(e.fieldCatalogs,e.intent.source);if(!r)return[{severity:"error",code:"invalid_source_ref",message:`Source ref for ${e.querySpec.queryHook} does not match a visible Semaphor source.`,path:`${e.pathPrefix}.spec.source`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source}];const t=ve({...e,catalog:r}),i={...r,fields:[...r.fields,...$e(e.intent,r,e.intent.source)]};return[...t,...Ie({...e,catalog:i}),...qe({...e,catalog:i})]}function ve(e){const r=E(e.intent);if(r.length===0)return[];const t=[],i=new Set;return r.forEach((o,n)=>{const s=`${e.pathPrefix}.spec.derivedFields.${n}`,d=$(o.name);d&&(i.has(d)&&t.push({severity:"error",code:"duplicate_derived_field",message:`Derived field "${o.name}" is declared more than once.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source}),i.add(d),e.catalog.fields.some(l=>$(l.name)===d)&&t.push({severity:"error",code:"derived_field_name_collision",message:`Derived field "${o.name}" conflicts with a field already visible on the selected Semaphor source.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source})),Object.entries(o.inputs||{}).forEach(([l,m])=>{const f=Me(m);if(!f)return;const v=y(f,e.intent.source);if(!c.semaphorSourcesReferToSameDataset(v,e.intent.source)){t.push({severity:"error",code:"unsupported_derived_field_source",message:`Derived field "${o.name}" input "${l}" references a different Semaphor source. App-local derived fields must use fields from the query source.`,path:`${s}.inputs.${l}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:v,field:f});return}b(e.catalog,f,e.intent.source)||t.push({severity:"error",code:"missing_field",message:`Derived field "${o.name}" input "${l}" references field "${f.name}", which is not visible on the selected Semaphor source.`,path:`${s}.inputs.${l}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:v,field:f})})}),t}function Ie(e){return be(e.intent).flatMap(({field:r,path:t})=>b(e.catalog,r,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Field "${r.name}" is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.${t}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:y(r,e.intent.source),field:r}])}function qe(e){return("inputs"in e.intent?e.intent.inputs||[]:[]).flatMap((t,i)=>{if(!t.field)return[];const o=y(t.field,e.intent.source);return c.semaphorSourcesReferToSameDataset(o,e.intent.source)?b(e.catalog,t.field,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Input "${t.inputId}" references field "${t.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${i}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:o,field:t.field}]:[{severity:"error",code:"unsupported_input_filter_composition",message:`Input "${t.inputId}" filters a different Semaphor source than the query. Cross-source Data App inputs are not supported yet.`,path:`${e.pathPrefix}.spec.inputs.${i}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:o,field:t.field}]})}function Se(e){if(e.querySpec.spec.queryKind!=="analysis")return[];const r=j(e.querySpec.spec,{pathPrefix:`${e.pathPrefix}.spec`,validateTimezone:e.validateTimezone});return r.ok?[]:r.issues.map(t=>({severity:"error",code:t.code,message:t.message,path:t.path,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source}))}function ke(e){return e.querySpec.spec.queryKind!=="sql"?[]:Q(e.querySpec.spec)?Object.prototype.hasOwnProperty.call(e.querySpec.spec,"parameters")?[{severity:"error",code:"deprecated_sql_parameters",message:"semaphor.sql uses defaultParameters for static SQL param(...) fallback values. The legacy parameters field is not supported.",path:`${e.pathPrefix}.spec.parameters`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id}]:[]:[]}function be(e){return e.kind==="metric"?[...e.metrics.map((r,t)=>({field:r,path:`spec.metrics.${t}`})),...e.primaryMetric?[{field:e.primaryMetric,path:"spec.primaryMetric"}]:[],...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...(e.dimensions||[]).map((r,t)=>({field:r,path:`spec.dimensions.${t}`})),...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="records"?[...e.fields.map((r,t)=>({field:r,path:`spec.fields.${t}`})),...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="inputOptions"?[{field:e.field,path:"spec.field"}]:e.kind==="matrix"?[...e.rows.map((r,t)=>({field:r.field,path:`spec.rows.${t}.field`})),...e.rows.flatMap((r,t)=>{var i;return((i=r.sortBy)==null?void 0:i.by.kind)==="field"?[{field:r.sortBy.by.field,path:`spec.rows.${t}.sortBy.by.field`}]:[]}),...(e.columns||[]).map((r,t)=>({field:r.field,path:`spec.columns.${t}.field`})),...(e.columns||[]).flatMap((r,t)=>{var i;return((i=r.sortBy)==null?void 0:i.by.kind)==="field"?[{field:r.sortBy.by.field,path:`spec.columns.${t}.sortBy.by.field`}]:[]}),...e.values.map((r,t)=>({field:r.field,path:`spec.values.${t}.field`})),...(e.sort||[]).flatMap((r,t)=>r.by.kind==="field"?[{field:r.by.field,path:`spec.sort.${t}.by.field`}]:[]),...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:[]}function Ae(e,r){return e.find(t=>q(t,r))}function b(e,r,t){const i=y(r,t);if(q(e,i))return e.fields.find(o=>_e(o,r)&&q(e,y(o,e.source)))}function E(e){return!("derivedFields"in e)||!Array.isArray(e.derivedFields)?[]:e.derivedFields}function $e(e,r,t){return E(e).map(i=>({name:i.name,label:i.label,role:we(i.resultRole),dataType:i.dataType,source:r.source||t,...i.defaultAggregate?{aggregate:i.defaultAggregate}:{}}))}function we(e){return e==="measure"?"measure":e==="date"?"date":e==="id"?"id":"dimension"}function Me(e){if(!e||typeof e!="object")return;const r=e;return r.field||r.metric||r.dimension}function $(e){return V.normalizeAnalyticsCatalogName(e)}function q(e,r){return[e.source,...e.sourceAliases||[]].some(t=>c.semaphorSourcesReferToSameDataset(t,r))}function y(e,r){return e.source||r}function _e(e,r){return!!(e.name&&r.name&&e.name===r.name)}function w(e,r){return{severity:r.severity,code:e.code||"invalid_analytics_intent",message:e.message,path:e.path?`${r.pathPrefix}.spec.${e.path}`:r.pathPrefix,queryHook:r.queryHook,queryId:r.queryId,intentId:r.intent.id,source:r.intent.source}}function Fe(e,r){const t=K(r);return{ok:t.ok&&e.ok,errors:_([...e.errors,...t.errors]),warnings:_([...e.warnings,...t.warnings]),repairHints:[...e.repairHints,...t.repairHints]}}function K(e){const r=e.filter(i=>i.severity==="error").map(M),t=e.filter(i=>i.severity==="warning").map(M);return{ok:r.length===0,errors:r,warnings:t,repairHints:r.map(i=>{var o,n;return{code:i.code,message:i.message,fieldRole:i.fieldRole,invalidField:(o=i.repairHint)==null?void 0:o.invalidField,recommendedNextStep:((n=i.repairHint)==null?void 0:n.recommendedNextStep)||"Update the Data App SDK query spec to use visible Semaphor source and field refs."}})}}function M(e){var r;return{code:e.code,message:e.message,path:e.path,fieldRole:e.code==="invalid_source_ref"?"source":void 0,repairHint:{code:e.code,message:e.message,invalidField:(r=e.field)==null?void 0:r.name,fieldRole:e.code==="invalid_source_ref"?"source":void 0,recommendedNextStep:e.code==="unsupported_input_filter_composition"?"Use an input field from the same Semaphor source as the query, or split the query into separate source-scoped queries.":"Update the query spec to use a visible Semaphor source and field ref."}}}function _(e){const r=new Set;return e.filter(t=>{const i=`${t.code}:${t.path||""}:${t.message}`;return r.has(i)?!1:(r.add(i),!0)})}function F(e){var t,i;const r=e.diagnostics.filter(o=>o.severity==="error");return{intentId:(t=e.intent)==null?void 0:t.id,status:r.length?"failed":"answered",resultShape:(i=e.intent)==null?void 0:i.kind,intent:e.intent,validation:e.validation,coverage:{answeredObligations:r.length?[]:["query_spec_validation"],missingObligations:r.length?["query_spec_validation"]:[],warnings:e.validation.warnings},missingFields:r.filter(o=>o.code==="missing_field").flatMap(o=>{var n;return(n=o.field)!=null&&n.name?[o.field.name]:[]}),warnings:e.diagnostics.filter(o=>o.severity==="warning").map(o=>o.message),metadata:{validationKind:"data_app_sdk_query_spec"}}}function xe(e,r){return r.id||N(e.spec)}function N(e){if(!e||typeof e!="object"||!("id"in e))return;const r=e.id;return typeof r=="string"&&r.trim()?r:void 0}exports.hasSemaphorInputValue=I;exports.normalizeSemaphorAnalysisQueryOptions=j;exports.normalizeSemaphorInputOptions=ae;exports.toSemaphorActiveInputSnapshots=ne;exports.toSemaphorAnalysisIntent=R;exports.toSemaphorAnalysisQueryOptions=W;exports.toSemaphorInputBinding=D;exports.toSemaphorInputBindings=oe;exports.toSemaphorInputOptionsIntent=T;exports.toSemaphorInputSnapshots=z;exports.toSemaphorInputSpec=k;exports.toSemaphorMatrixIntent=B;exports.toSemaphorMetricIntent=S;exports.toSemaphorRecordsIntent=H;exports.toSemaphorSqlIntent=P;exports.validateSemaphorDataAppQuerySpecs=ue;
|
|
1
|
+
"use strict";const x=require("./validators-jpoYhpHh.js"),V=require("./catalog-field-grounding-8L9I0zdg.js"),c=require("./source-identity-C-xaeE_I.js");function S(e){var t,i;const r=G(e);return{version:1,kind:"metric",id:e.id,label:e.label,source:g(e),metrics:r,primaryMetric:L(e,r),dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,dimensions:(t=e.dimensions)==null?void 0:t.map(o=>a(o,"dimension")),comparison:le(e.comparison),orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:p(e.inputs),limit:e.limit,...(i=e.derivedFields)!=null&&i.length?{derivedFields:e.derivedFields}:{}}}function R(e){var t;return{...S(e),...e.timeWindow?{timeWindow:e.timeWindow}:{},...(t=e.filters)!=null&&t.length?{filters:e.filters}:{},...e.analysis?{analysis:e.analysis}:{}}}function W(e){return{...e.chartTitle?{chartTitle:e.chartTitle}:{},...e.chartType?{chartType:e.chartType}:{},...e.driverMode?{driverMode:e.driverMode}:{},...e.includePopulation!==void 0?{includePopulation:e.includePopulation}:{},...e.calendarContext?{calendarContext:e.calendarContext}:{}}}function L(e,r){if(!e.primaryMetric)return r[0]||{name:"",role:"measure"};const t=a(e.primaryMetric,"measure"),i=Y(t,r),o=i.length===1?i[0]:void 0;return o?C(t,o):t}function G(e){const r=[];for(const t of e.metrics.map(i=>a(i,"measure"))){if(!t.name)continue;const i=r.findIndex(o=>U(o,t));if(i===-1){r.push(t);continue}r[i]=C(r[i],t)}return r}function U(e,r){return c.semaphorFieldRefsMatch(e,r)&&h(e)===h(r)}function J(e,r){return h(r)===h(e)}function X(e,r){return r.name!==e.name||e.source&&!c.semaphorFieldRefsMatch(r,e)?!1:J(e,r)}function Y(e,r){const t=r.filter(i=>X(e,i));return e.aggregate!==void 0,t}function h(e){return(e.aggregate||"SUM").toUpperCase()}function C(e,r){if(e.aggregate&&r.aggregate&&e.aggregate!==r.aggregate)throw new Error(`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${r.aggregate}.`);return{...c.preferSemaphorFieldRefMetadata(e,r),aggregate:e.aggregate||r.aggregate}}function H(e){var t,i;if("sort"in e)throw new Error("semaphor.records supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!de(e))throw new Error("semaphor.records needs at least one field.");const r=Z(e.fields);return{version:1,kind:"records",id:e.id,label:e.label,source:g(e),fields:r,dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,...e.timeWindow?{timeWindow:e.timeWindow}:{},...(t=e.filters)!=null&&t.length?{filters:e.filters}:{},orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:p(e.inputs),limit:e.limit,...e.pagination?{pagination:e.pagination}:{},...(i=e.derivedFields)!=null&&i.length?{derivedFields:e.derivedFields}:{}}}function Z(e){return e.map(r=>{const t=a(r);if(!t.role)throw new Error(`semaphor.records field "${t.name}" needs an explicit role.`);return t})}function T(e){var r;return{version:1,kind:"inputOptions",id:e.id,label:e.label,source:g(e),field:a(e.field,"dimension"),search:e.search,limit:e.limit,...(r=e.derivedFields)!=null&&r.length?{derivedFields:e.derivedFields}:{}}}function P(e){var r;return{version:1,kind:"sql",id:e.id,label:e.label,source:e.source,sql:e.sql,...e.defaultParameters?{defaultParameters:e.defaultParameters}:{},...e.pythonCode?{pythonCode:e.pythonCode}:{},...(r=e.fields)!=null&&r.length?{fields:e.fields.map(t=>a(t))}:{},inputs:p(e.inputs),limit:e.limit,...e.pagination?{pagination:e.pagination}:{},rationale:e.rationale}}function B(e){var r,t;return{version:1,kind:"matrix",id:e.id,label:e.label,source:g(e),rows:e.rows.map(i=>A(i,"dimension")),...e.columns?{columns:e.columns.map(i=>A(i,"dimension"))}:{},values:e.values.map(ee),...(r=e.filters)!=null&&r.length?{filters:e.filters}:{},inputs:p(e.inputs),...e.totals?{totals:e.totals}:{},...(t=e.sort)!=null&&t.length?{sort:e.sort}:{},...e.expansion?{expansion:e.expansion}:{},...e.layout?{layout:e.layout}:{},...e.displayLimits?{displayLimits:e.displayLimits}:{}}}function A(e,r){return re(e)?{...e,field:a(e.field,r)}:{field:a(e,r)}}function ee(e){return te(e)?{...e,field:a(e.field,"measure")}:{field:a(e,"measure"),aggregate:e.aggregate}}function re(e){return"field"in e}function te(e){return"field"in e}function D(e){if("toAnalyticsInput"in e){const n=e.toAnalyticsInput();return{inputId:n.inputId,kind:n.kind,...n.controlRole?{controlRole:n.controlRole}:{},...n.operator?{operator:n.operator}:{},...n.field?{field:n.field}:{}}}if("id"in e){const n=k(e);return{inputId:n.inputId,kind:n.kind,...n.controlRole?{controlRole:n.controlRole}:{},...n.operator?{operator:n.operator}:{},...n.field?{field:n.field}:{}}}const r="kind"in e?e.kind:void 0,t="operator"in e?O(e.operator,e.inputId):void 0,i="controlRole"in e?e.controlRole:"role"in e?e.role:void 0,o=ie(i)?i:void 0;return{inputId:e.inputId,...r?{kind:r}:{},...o?{controlRole:o}:{},...t?{operator:t}:{},...e.field?{field:e.field}:{}}}function ie(e){return e==="grain"||e==="metric"||e==="dimension"||e==="aggregation"||e==="sqlParam"}function oe(e){const r=p(e);return r.length>0?r:void 0}function z(e){return(e||[]).map(se)}function ne(e){return z(e).filter(r=>r.isActive)}function k(e){if(e.kind==="filter"){const r=O(e.operator,e.id);return{inputId:e.id,kind:e.kind,label:e.label,field:a(e.field,"dimension"),operator:r||"in"}}return{inputId:e.id,kind:e.kind,label:e.label,controlRole:e.role}}function ae(e=[]){return e.map(r=>typeof r=="object"?r:{label:String(r),value:r})}function I(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim().length>0:!0}function se(e){if("toAnalyticsInput"in e)return e.toAnalyticsInput();if("kind"in e&&"isActive"in e)return e;if("id"in e){const r=k(e),t=Object.prototype.hasOwnProperty.call(e,"value")?e.value:e.defaultValue;return{inputId:r.inputId,kind:r.kind,label:r.label,...r.field?{field:r.field}:{},...r.operator?{operator:r.operator}:{},...r.controlRole?{controlRole:r.controlRole}:{},value:t,isActive:I(t)}}return{...e,kind:"filter",isActive:I(e.value),value:e.value}}function g(e){return e.source}function de(e){var r;return!!((r=e.fields)!=null&&r.length)}function a(e,r){return{...e,role:e.role||r}}function p(e){return(e||[]).map(D)}function le(e){if(e)return e}function O(e,r){if(e===void 0)return;const t=x.normalizeSemaphorInputOperator(e);if(!t)throw new Error(`useSemaphorInput "${r}" uses unsupported filter operator "${e}".`);return t}function j(e,r={}){const t=r.pathPrefix||"analysisOptions";if(e===void 0)return{ok:!0};if(!e||typeof e!="object"||Array.isArray(e))return u(t,"Data App analysis options must be an object.");const i=e,o={};if(i.chartTitle!==void 0){if(typeof i.chartTitle!="string")return u(`${t}.chartTitle`,'Data App analysis option "chartTitle" must be a string.');o.chartTitle=i.chartTitle}if(i.chartType!==void 0){if(typeof i.chartType!="string")return u(`${t}.chartType`,'Data App analysis option "chartType" must be a string.');o.chartType=i.chartType}if(i.driverMode!==void 0){if(!ce(i.driverMode))return u(`${t}.driverMode`,'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.');o.driverMode=i.driverMode}if(i.includePopulation!==void 0){if(typeof i.includePopulation!="boolean")return u(`${t}.includePopulation`,'Data App analysis option "includePopulation" must be a boolean.');o.includePopulation=i.includePopulation}if(i.calendarContext!==void 0){const n=ye(i.calendarContext,{pathPrefix:`${t}.calendarContext`,validateTimezone:r.validateTimezone});if(!n.ok)return n;o.calendarContext=n.calendarContext}return{ok:!0,analysisOptions:o}}function ue(e){const r=e.queries.map((o,n)=>fe(o,n,{fieldCatalogs:e.fieldCatalogs||[],requireFieldCatalog:!!e.requireFieldCatalog,validateTimezone:e.validateTimezone})),t=r.flatMap(o=>o.diagnostics),i=r.map(o=>o.executionResult);return{ok:t.every(o=>o.severity!=="error"),diagnostics:t,queries:r,intents:r.flatMap(o=>o.intent?[o.intent]:[]),executionResults:i}}function fe(e,r,t){const i=`queries.${r}`;try{const o=pe(e),n=xe(e,o),s=x.validateSemaphorAnalyticsIntent(o),d=[...ke({querySpec:e,queryId:n,intent:o,pathPrefix:i}),...s.errors.map(m=>w(m,{queryHook:e.queryHook,queryId:n,pathPrefix:i,severity:"error",intent:o})),...s.warnings.map(m=>w(m,{queryHook:e.queryHook,queryId:n,pathPrefix:i,severity:"warning",intent:o})),...ge({querySpec:e,queryId:n,intent:o,pathPrefix:i,fieldCatalogs:t.fieldCatalogs,requireFieldCatalog:t.requireFieldCatalog}),...Se({querySpec:e,queryId:n,intent:o,pathPrefix:i,validateTimezone:t.validateTimezone})],l=Fe(s,d);return{queryHook:e.queryHook,queryId:n,intent:o,diagnostics:d,executionResult:F({intent:o,validation:l,diagnostics:d})}}catch(o){const n={severity:"error",code:"invalid_query_spec",message:o instanceof Error?o.message:String(o),path:i,queryHook:e.queryHook,queryId:N(e.spec)},s=K([n]);return{queryHook:e.queryHook,queryId:n.queryId,diagnostics:[n],executionResult:F({validation:s,diagnostics:[n]})}}}function u(e,r){return{ok:!1,issues:[{code:"invalid_analysis_option",message:r,path:e}]}}function Q(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function ce(e){return e==="absolute_delta"||e==="largest_negative"||e==="largest_positive"||e==="positive_and_negative"||e==="all"}function me(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function ye(e,r){var l;if(!e||typeof e!="object"||Array.isArray(e))return u(r.pathPrefix,'Data App analysis option "calendarContext" must be an object.');const t=e,i=t.tz,o=t.weekStart,n=t.anchor,s=n&&typeof n=="object"&&!Array.isArray(n)?n.iso:void 0,d=typeof i=="string"?((l=r.validateTimezone)==null?void 0:l.call(r,i))??i:null;return d?typeof o!="number"||!Number.isInteger(o)||o<0||o>6?u(`${r.pathPrefix}.weekStart`,'Data App analysis option "calendarContext.weekStart" must be an integer from 0 to 6.'):n!=="now"&&!(typeof s=="string"&&me(s))?u(`${r.pathPrefix}.anchor`,'Data App analysis option "calendarContext.anchor" must be "now" or an object with a valid iso string.'):{ok:!0,calendarContext:{tz:d,weekStart:o,anchor:n}}:u(`${r.pathPrefix}.tz`,'Data App analysis option "calendarContext.tz" must be a valid timezone string.')}function pe(e){return he(e.spec)}function he(e){if(!Q(e))throw new Error("useSemaphorQuery spec must be an object.");if(e.queryKind==="metric")return S(e);if(e.queryKind==="analysis")return R(e);if(e.queryKind==="records")return H(e);if(e.queryKind==="sql")return P(e);if(e.queryKind==="matrix")return B(e);if(e.queryKind==="inputOptions")return T(e);throw new Error("useSemaphorQuery spec.queryKind must be metric, analysis, records, inputOptions, sql, or matrix.")}function ge(e){if(e.intent.kind==="sql")return[];if(e.fieldCatalogs.length===0&&!e.requireFieldCatalog)return[];const r=Ae(e.fieldCatalogs,e.intent.source);if(!r)return[{severity:"error",code:"invalid_source_ref",message:`Source ref for ${e.querySpec.queryHook} does not match a visible Semaphor source.`,path:`${e.pathPrefix}.spec.source`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source}];const t=ve({...e,catalog:r}),i={...r,fields:[...r.fields,...$e(e.intent,r,e.intent.source)]};return[...t,...Ie({...e,catalog:i}),...qe({...e,catalog:i})]}function ve(e){const r=E(e.intent);if(r.length===0)return[];const t=[],i=new Set;return r.forEach((o,n)=>{const s=`${e.pathPrefix}.spec.derivedFields.${n}`,d=$(o.name);d&&(i.has(d)&&t.push({severity:"error",code:"duplicate_derived_field",message:`Derived field "${o.name}" is declared more than once.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source}),i.add(d),e.catalog.fields.some(l=>$(l.name)===d)&&t.push({severity:"error",code:"derived_field_name_collision",message:`Derived field "${o.name}" conflicts with a field already visible on the selected Semaphor source.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source})),Object.entries(o.inputs||{}).forEach(([l,m])=>{const f=Me(m);if(!f)return;const v=y(f,e.intent.source);if(!c.semaphorSourcesReferToSameDataset(v,e.intent.source)){t.push({severity:"error",code:"unsupported_derived_field_source",message:`Derived field "${o.name}" input "${l}" references a different Semaphor source. App-local derived fields must use fields from the query source.`,path:`${s}.inputs.${l}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:v,field:f});return}b(e.catalog,f,e.intent.source)||t.push({severity:"error",code:"missing_field",message:`Derived field "${o.name}" input "${l}" references field "${f.name}", which is not visible on the selected Semaphor source.`,path:`${s}.inputs.${l}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:v,field:f})})}),t}function Ie(e){return be(e.intent).flatMap(({field:r,path:t})=>b(e.catalog,r,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Field "${r.name}" is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.${t}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:y(r,e.intent.source),field:r}])}function qe(e){return("inputs"in e.intent?e.intent.inputs||[]:[]).flatMap((t,i)=>{if(!t.field)return[];const o=y(t.field,e.intent.source);return c.semaphorSourcesReferToSameDataset(o,e.intent.source)?b(e.catalog,t.field,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Input "${t.inputId}" references field "${t.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${i}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:o,field:t.field}]:[{severity:"error",code:"unsupported_input_filter_composition",message:`Input "${t.inputId}" filters a different Semaphor source than the query. Cross-source Data App inputs are not supported yet.`,path:`${e.pathPrefix}.spec.inputs.${i}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:o,field:t.field}]})}function Se(e){if(e.querySpec.spec.queryKind!=="analysis")return[];const r=j(e.querySpec.spec,{pathPrefix:`${e.pathPrefix}.spec`,validateTimezone:e.validateTimezone});return r.ok?[]:r.issues.map(t=>({severity:"error",code:t.code,message:t.message,path:t.path,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id,source:e.intent.source}))}function ke(e){return e.querySpec.spec.queryKind!=="sql"?[]:Q(e.querySpec.spec)?Object.prototype.hasOwnProperty.call(e.querySpec.spec,"parameters")?[{severity:"error",code:"deprecated_sql_parameters",message:"semaphor.sql uses defaultParameters for static SQL param(...) fallback values. The legacy parameters field is not supported.",path:`${e.pathPrefix}.spec.parameters`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:e.intent.id}]:[]:[]}function be(e){return e.kind==="metric"?[...e.metrics.map((r,t)=>({field:r,path:`spec.metrics.${t}`})),...e.primaryMetric?[{field:e.primaryMetric,path:"spec.primaryMetric"}]:[],...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...(e.dimensions||[]).map((r,t)=>({field:r,path:`spec.dimensions.${t}`})),...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="records"?[...e.fields.map((r,t)=>({field:r,path:`spec.fields.${t}`})),...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="inputOptions"?[{field:e.field,path:"spec.field"}]:e.kind==="matrix"?[...e.rows.map((r,t)=>({field:r.field,path:`spec.rows.${t}.field`})),...e.rows.flatMap((r,t)=>{var i;return((i=r.sortBy)==null?void 0:i.by.kind)==="field"?[{field:r.sortBy.by.field,path:`spec.rows.${t}.sortBy.by.field`}]:[]}),...(e.columns||[]).map((r,t)=>({field:r.field,path:`spec.columns.${t}.field`})),...(e.columns||[]).flatMap((r,t)=>{var i;return((i=r.sortBy)==null?void 0:i.by.kind)==="field"?[{field:r.sortBy.by.field,path:`spec.columns.${t}.sortBy.by.field`}]:[]}),...e.values.map((r,t)=>({field:r.field,path:`spec.values.${t}.field`})),...(e.sort||[]).flatMap((r,t)=>r.by.kind==="field"?[{field:r.by.field,path:`spec.sort.${t}.by.field`}]:[]),...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:[]}function Ae(e,r){return e.find(t=>q(t,r))}function b(e,r,t){const i=y(r,t);if(q(e,i))return e.fields.find(o=>_e(o,r)&&q(e,y(o,e.source)))}function E(e){return!("derivedFields"in e)||!Array.isArray(e.derivedFields)?[]:e.derivedFields}function $e(e,r,t){return E(e).map(i=>({name:i.name,label:i.label,role:we(i.resultRole),dataType:i.dataType,source:r.source||t,...i.defaultAggregate?{aggregate:i.defaultAggregate}:{}}))}function we(e){return e==="measure"?"measure":e==="date"?"date":e==="id"?"id":"dimension"}function Me(e){if(!e||typeof e!="object")return;const r=e;return r.field||r.metric||r.dimension}function $(e){return V.normalizeAnalyticsCatalogName(e)}function q(e,r){return[e.source,...e.sourceAliases||[]].some(t=>c.semaphorSourcesReferToSameDataset(t,r))}function y(e,r){return e.source||r}function _e(e,r){return!!(e.name&&r.name&&e.name===r.name)}function w(e,r){return{severity:r.severity,code:e.code||"invalid_analytics_intent",message:e.message,path:e.path?`${r.pathPrefix}.spec.${e.path}`:r.pathPrefix,queryHook:r.queryHook,queryId:r.queryId,intentId:r.intent.id,source:r.intent.source}}function Fe(e,r){const t=K(r);return{ok:t.ok&&e.ok,errors:_([...e.errors,...t.errors]),warnings:_([...e.warnings,...t.warnings]),repairHints:[...e.repairHints,...t.repairHints]}}function K(e){const r=e.filter(i=>i.severity==="error").map(M),t=e.filter(i=>i.severity==="warning").map(M);return{ok:r.length===0,errors:r,warnings:t,repairHints:r.map(i=>{var o,n;return{code:i.code,message:i.message,fieldRole:i.fieldRole,invalidField:(o=i.repairHint)==null?void 0:o.invalidField,recommendedNextStep:((n=i.repairHint)==null?void 0:n.recommendedNextStep)||"Update the Data App SDK query spec to use visible Semaphor source and field refs."}})}}function M(e){var r;return{code:e.code,message:e.message,path:e.path,fieldRole:e.code==="invalid_source_ref"?"source":void 0,repairHint:{code:e.code,message:e.message,invalidField:(r=e.field)==null?void 0:r.name,fieldRole:e.code==="invalid_source_ref"?"source":void 0,recommendedNextStep:e.code==="unsupported_input_filter_composition"?"Use an input field from the same Semaphor source as the query, or split the query into separate source-scoped queries.":"Update the query spec to use a visible Semaphor source and field ref."}}}function _(e){const r=new Set;return e.filter(t=>{const i=`${t.code}:${t.path||""}:${t.message}`;return r.has(i)?!1:(r.add(i),!0)})}function F(e){var t,i;const r=e.diagnostics.filter(o=>o.severity==="error");return{intentId:(t=e.intent)==null?void 0:t.id,status:r.length?"failed":"answered",resultShape:(i=e.intent)==null?void 0:i.kind,intent:e.intent,validation:e.validation,coverage:{answeredObligations:r.length?[]:["query_spec_validation"],missingObligations:r.length?["query_spec_validation"]:[],warnings:e.validation.warnings},missingFields:r.filter(o=>o.code==="missing_field").flatMap(o=>{var n;return(n=o.field)!=null&&n.name?[o.field.name]:[]}),warnings:e.diagnostics.filter(o=>o.severity==="warning").map(o=>o.message),metadata:{validationKind:"data_app_sdk_query_spec"}}}function xe(e,r){return r.id||N(e.spec)}function N(e){if(!e||typeof e!="object"||!("id"in e))return;const r=e.id;return typeof r=="string"&&r.trim()?r:void 0}exports.hasSemaphorInputValue=I;exports.normalizeSemaphorAnalysisQueryOptions=j;exports.normalizeSemaphorInputOptions=ae;exports.toSemaphorActiveInputSnapshots=ne;exports.toSemaphorAnalysisIntent=R;exports.toSemaphorAnalysisQueryOptions=W;exports.toSemaphorInputBinding=D;exports.toSemaphorInputBindings=oe;exports.toSemaphorInputOptionsIntent=T;exports.toSemaphorInputSnapshots=z;exports.toSemaphorInputSpec=k;exports.toSemaphorMatrixIntent=B;exports.toSemaphorMetricIntent=S;exports.toSemaphorRecordsIntent=H;exports.toSemaphorSqlIntent=P;exports.validateSemaphorDataAppQuerySpecs=ue;
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-c_0nwsOM.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;
|
package/dist/dashboard/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chunks/contracts-CtB2VONT.js"),N=require("../chunks/source-identity-C-xaeE_I.js"),z=require("../chunks/validators-jpoYhpHh.js"),De=require("../chunks/catalog-field-grounding-BGW0hnB9.js");function _(e){return e&&typeof e=="object"?e:null}function D(e){return typeof e=="string"?e:null}function oe(e){var t,r,n;return!!(e&&typeof e=="object")&&(((t=_(e))==null?void 0:t.kind)==="semantic"||((r=_(e))==null?void 0:r.kind)==="physical"||((n=_(e))==null?void 0:n.kind)==="sql")}function M(e){return oe(e)?e.kind==="semantic"?!!(e.domainId&&e.datasetName):e.kind==="physical"?!!(e.connectionId&&e.tableName):!1:!1}function ve(e){return N.semaphorSourceIdentityKey(e)}function K(e,t){return N.semaphorSourcesReferToSameDataset(e,t)}function se(e,t){return N.preferSemaphorSourceMetadata(e,t)}function R(e){const t=[];for(const r of e){const n=t.findIndex(o=>K(o,r));n===-1?t.push(r):t[n]=se(t[n],r)}return t}function Ce(e){return R(e)[0]}function G(e,t){return e.kind!=="semantic"||e.connectionId||(t==null?void 0:t.kind)!=="semantic"||!N.semaphorSourcesReferToSameDataset(e,t)||!t.connectionId?e:{...e,connectionId:t.connectionId}}function W(e){return M(e)?e:void 0}function ae(e,t){if(!(e.kind!=="semantic"||e.connectionId))return t.find(r=>(r==null?void 0:r.kind)==="semantic"&&N.semaphorSourcesReferToSameDataset(e,r)&&!!r.connectionId)}function S(e,t){const r=W(e==null?void 0:e.source);return r?G(r,t):void 0}function de({explicitSource:e,field:t,defaultSource:r,fallbackSources:n}){const o=[r,...n||[]],a=W(e),i=a?G(a,ae(a,o)):void 0;if(i)return i;if(e!==void 0)return;const d=S(t,r),s=d?G(d,ae(d,o)):void 0;if(s)return s;if((t==null?void 0:t.source)===void 0)return W(r)}function ke(e,t){if(!(e!=null&&e.name)||!(t!=null&&t.name)||e.name!==t.name)return!1;const r=S(e),n=S(t);return!r||!n?!0:K(r,n)}function C(e){var t;return D((t=_(e))==null?void 0:t.kind)}function ce(e){var t,r;return C(e)!=="semantic"?null:((r=D((t=_(e))==null?void 0:t.domainId))==null?void 0:r.trim())||null}function xe(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetName)}function Te(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetId)}function Fe(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.connectionId)}function Re(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.tableName)}function Ne(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.databaseName)||""}function Me(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.schemaName)||""}function le(e){if(e.analyticsIntent&&typeof e.analyticsIntent=="object"&&"source"in e.analyticsIntent)return e.analyticsIntent.source}function ue({datasets:e,requireAtLeastOne:t}){if(t&&e.length<1)return{ok:!1,issue:"invalid_dataset_count"};if(e.length<=1)return{ok:!0};const r=e.map(ce),n=new Set(r.filter(Boolean));return r.some(o=>!o)||n.size!==1?{ok:!1,issue:"invalid_multi_dataset_scope"}:{ok:!0}}function E(e,t){if(!t)return!1;if(t.kind==="semantic"){const r=Te(e);return ce(e)===t.domainId?r&&t.datasetId?r===t.datasetId:xe(e)===t.datasetName:!1}return t.kind==="physical"?Fe(e)===t.connectionId&&Re(e)===t.tableName&&Ne(e)===(t.databaseName||"")&&Me(e)===(t.schemaName||""):!1}function $e(e,t){return e.find(r=>E(r,t))}function p(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function B(e){const t=new Set;for(const r of e){if(t.has(r))return r;t.add(r)}return null}function fe({card:e,datasets:t,errors:r}){if(e.type==="text")return;const n=le(e);if(!n){if(t.length<=1)return;r.push(p("missing_card_analytics_source","Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",e.id));return}t.some(o=>E(o,n))||r.push(p("invalid_card_analytics_source","Dashboard cards with an explicit analytics source must use one of the selected datasets.",e.id))}function P(e){return e.map(t=>t==null?void 0:t.source).filter(t=>!!t)}function H(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function ie(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Oe(e){var r;if(!e)return[];const t=[e.source];return e.kind==="metric"?t.push(...P([...H(e.metrics),e.primaryMetric,e.dateField,...H(e.dimensions),...ie(e.filters).map(n=>n.field)])):e.kind==="records"?t.push(...P([...H(e.fields),e.dateField,(r=e.orderBy)==null?void 0:r.field,...ie(e.filters).map(n=>n.field)])):e.kind==="inputOptions"?t.push(...P([e.field])):e.kind==="sql"&&t.push(...P(e.fields||[])),t}function pe({card:e,datasets:t,errors:r}){if(e.type!=="text"){for(const n of Oe(e.analyticsIntent))if(n&&!t.some(o=>E(o,n))){r.push(p("invalid_card_query_source","Dashboard card query field references must use one of the selected datasets.",e.id));return}}}function he({card:e,errors:t}){if(e.type==="text"||!e.analyticsIntent)return;const r=z.validateSemaphorAnalyticsIntent(e.analyticsIntent);if(!r.ok)for(const n of r.errors)t.push(p(n.code,n.path?`${n.path}: ${n.message}`:n.message,e.id))}function me({datasets:e,errors:t,requireAtLeastOne:r}){const n=ue({datasets:e,requireAtLeastOne:r});if(!n.ok){if(n.issue==="invalid_dataset_count"){t.push(p("invalid_dataset_count","Dashboard authoring requires at least one selected dataset."));return}t.push(p("invalid_multi_dataset_scope","Multi-dataset dashboard authoring is limited to semantic datasets from one domain."))}}function ge(e){var f,g;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_plan","Dashboard plan must be a structured object.")],warnings:[]};const r=e,n=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard plan version must be 1.")),(f=r.title)!=null&&f.trim()||t.push(p("missing_title","Dashboard plan needs a title."));const o=Array.isArray(r.datasets)?r.datasets:[],a=Array.isArray(r.sheets)?r.sheets:[];me({datasets:o,errors:t,requireAtLeastOne:!0}),a.length!==1&&t.push(p("invalid_sheet_count","MVP dashboard authoring creates exactly one dashboard sheet."));const i=a[0];i&&i.kind!=="dashboard"&&t.push(p("invalid_sheet_kind",'Generated sheet must use kind "dashboard".'));const d=(i==null?void 0:i.cards)||[];d.length>v.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS&&t.push(p("too_many_cards",`Generated dashboards can contain at most ${v.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS} cards.`));const s=B(d.map(l=>l.id));s&&t.push(p("duplicate_card_id",`Duplicate generated card id: ${s}.`));const u=B(d.map(l=>l.frameId));u&&t.push(p("duplicate_frame_id",`Duplicate generated frame id: ${u}.`));for(const l of d)(g=l.title)!=null&&g.trim()||t.push(p("missing_card_title","Card title is required.",l.id)),l.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",l.id)),l.type!=="text"&&!l.analyticsIntent&&n.push(p("missing_analytics_intent","Non-text card has no analytics intent and may be skipped by the app layer.",l.id)),fe({card:l,datasets:o,errors:t}),he({card:l,errors:t}),pe({card:l,datasets:o,errors:t});const h=Array.isArray(r.filterInputs)?r.filterInputs:[],I=h.map(l=>l.id),A=B(I);A&&t.push(p("duplicate_input_id",`Duplicate dashboard input id: ${A}.`));const w=h.map(l=>l.variableName).filter(Boolean)||[],y=B(w);y&&t.push(p("duplicate_input_variable",`Duplicate dashboard input variable name: ${y}.`));const c=Array.isArray(r.calculatedFields)?r.calculatedFields:[];for(const l of c)l.scope==="domain"&&l.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${l.name}" is outside MVP.`));return{ok:t.length===0,errors:t,warnings:n}}function be(e){var i;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_change_plan","Dashboard change plan must be a structured object.")],warnings:[]};const r=e,n=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard change plan version must be 1.")),(i=r.dashboardId)!=null&&i.trim()||t.push(p("missing_dashboard_id","Dashboard change plan needs a dashboard id."));const o=Array.isArray(r.datasets)?r.datasets:[],a=Array.isArray(r.operations)?r.operations:[];me({datasets:o,errors:t,requireAtLeastOne:!1});for(const d of a){if(d.kind==="unsupported"){n.push(p("unsupported_operation",d.reason||d.requestedAction));continue}d.kind==="addCard"&&d.card.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",d.card.id)),d.kind==="addCard"&&(fe({card:d.card,datasets:o,errors:t}),he({card:d.card,errors:t}),pe({card:d.card,datasets:o,errors:t})),d.kind==="addCalculatedField"&&d.field.scope==="domain"&&d.field.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${d.field.name}" is outside MVP.`))}return{ok:t.length===0,errors:t,warnings:n}}const Be={lg:48,md:36,sm:24,xs:12,xxs:6};function Pe(e,t){let r=0,n=0,o=0;return e.map(a=>{const i=Math.min(a.w,t);r>0&&r+i>t&&(r=0,n+=o,o=0);const d={i:a.frameId,x:r,y:n,w:i,h:a.h,minW:Math.min(a.minW,t),minH:a.minH,static:!1};return r+=i,o=Math.max(o,a.h),d})}function ze(e){const t=[...e].sort((s,u)=>s.priority-u.priority),r=t.filter(s=>s.role==="kpi"),n=t.filter(s=>s.role==="chart"),o=t.filter(s=>s.role==="table"),a=t.filter(s=>s.role==="text"),i=a.slice(0,1),d=a.slice(i.length);return{kpis:r,introText:i,charts:n,tables:o,supportingText:d}}function Ee(e,t,r){return t==="xxs"||t==="xs"?r:t==="sm"?Math.min(12,r):t==="md"?e<=1||e===2?18:12:e<=1||e===2?24:e===3?16:12}function qe(e,t,r,n){return r==="xxs"||r==="xs"||r==="sm"||r==="md"||t===1||t%2===1&&e===0?n:n/2}function Ve(e){const{item:t,band:r,index:n,bandCount:o,breakpoint:a,columns:i}=e;return r==="kpi"?{...t,band:r,w:Ee(o,a,i),h:15,minW:Math.min(6,i),minH:12}:r==="table"?{...t,band:r,w:i,h:a==="xxs"||a==="xs"?34:38,minW:Math.min(12,i),minH:18}:r==="introText"?{...t,band:r,w:i,h:a==="xxs"||a==="xs"?12:10,minW:Math.min(12,i),minH:8}:r==="supportingText"?{...t,band:r,w:a==="lg"?i/2:i,h:a==="xxs"||a==="xs"?12:10,minW:Math.min(12,i),minH:8}:{...t,band:r,w:qe(n,o,a,i),h:a==="xxs"||a==="xs"?28:30,minW:Math.min(12,i),minH:16}}function T(e,t,r,n){return e.map((o,a)=>Ve({item:o,band:t,index:a,bandCount:e.length,breakpoint:r,columns:n}))}function q(e){const t=ze(e);return Object.fromEntries(v.DASHBOARD_AUTHORING_BREAKPOINTS.map(r=>{const n=Be[r],o=[...T(t.introText,"introText",r,n),...T(t.kpis,"kpi",r,n),...T(t.charts,"chart",r,n),...T(t.tables,"table",r,n),...T(t.supportingText,"supportingText",r,n)];return[r,Pe(o,n)]}))}function He(e){const t=De.normalizeAnalyticsCatalogDataType(e);return t==="datetime"?"date":t==="unknown"?"string":t}function Le(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function je(e){return Le(e)&&typeof e.filterId=="string"&&typeof e.operation=="string"&&Array.isArray(e.values)}function Ge(e){return e.filter(t=>typeof t=="string"||typeof t=="number")}function We(e){return e.filter(t=>t instanceof Date||typeof t=="string")}function X(e,t){if(t===void 0)return;const r=He(e.dataType),n=e.operation||"in";if(je(t))return{...t,filterId:e.id,name:t.name||e.column,valueType:r,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};if(n==="is null"||n==="is not null")return{filterId:e.id,name:e.column,operation:n,valueType:r,values:[],dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};const o=Array.isArray(t)?t:[t],a=r==="date"?We(o):Ge(o);if(a.length!==0&&!((n==="between"||n==="not between")&&a.length<2))return{filterId:e.id,name:e.column,operation:n,valueType:r,values:a,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext}}function Ie(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function Ue(e,t,r){const n=(t||[]).filter(o=>o.scope==="card"&&o.targetCardId===r).map(o=>o.field).filter(Boolean);return n.length===0?e:{...e,calculatedFields:[...e.calculatedFields||[],...n]}}function U(e,t){return Array.from(new Set((e||[]).map(r=>t.get(r)).filter(r=>!!r)))}function Ke(e,t){if((e==null?void 0:e.kind)!=="cards")return e;const r=U(e.cardIds,t);return r.length>0?{...e,cardIds:r}:null}function Xe(e,t){return!e.applyToCardIds&&!e.excludeCardIds?e:{...e,...e.applyToCardIds?{applyToCardIds:U(e.applyToCardIds,t)}:{},...e.excludeCardIds?{excludeCardIds:U(e.excludeCardIds,t)}:{}}}function Je(e,t){const r={},n=[];return{inputs:(e.filterInputs||[]).flatMap((a,i)=>{const d=Ke(a.scope,t);if(d===null)return n.push(Ie("filter_input_scope_empty",`Filter input "${a.label}" was skipped because all scoped cards were skipped during query validation.`)),[];const s=X(a.filter,a.defaultValue);return s&&(r.shared??(r.shared={}),r.shared[a.id]={status:"set",value:{kind:"filter",filterValue:s}}),[{id:a.id,kind:"filter",label:a.label,variableName:a.variableName,scope:d||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:i},exports:["label","value","start","end","range"],filter:Xe(a.filter,t)}]}),warnings:n,defaultInputValues:r.shared&&Object.keys(r.shared).length>0?r:void 0}}function Qe(e){var w,y;const t=ge(e.plan);if(!t.ok)throw new Error(t.errors.map(c=>c.message).join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chunks/contracts-CtB2VONT.js"),N=require("../chunks/source-identity-C-xaeE_I.js"),z=require("../chunks/validators-jpoYhpHh.js"),De=require("../chunks/catalog-field-grounding-8L9I0zdg.js");function _(e){return e&&typeof e=="object"?e:null}function D(e){return typeof e=="string"?e:null}function oe(e){var t,r,n;return!!(e&&typeof e=="object")&&(((t=_(e))==null?void 0:t.kind)==="semantic"||((r=_(e))==null?void 0:r.kind)==="physical"||((n=_(e))==null?void 0:n.kind)==="sql")}function M(e){return oe(e)?e.kind==="semantic"?!!(e.domainId&&e.datasetName):e.kind==="physical"?!!(e.connectionId&&e.tableName):!1:!1}function ve(e){return N.semaphorSourceIdentityKey(e)}function K(e,t){return N.semaphorSourcesReferToSameDataset(e,t)}function se(e,t){return N.preferSemaphorSourceMetadata(e,t)}function R(e){const t=[];for(const r of e){const n=t.findIndex(o=>K(o,r));n===-1?t.push(r):t[n]=se(t[n],r)}return t}function Ce(e){return R(e)[0]}function G(e,t){return e.kind!=="semantic"||e.connectionId||(t==null?void 0:t.kind)!=="semantic"||!N.semaphorSourcesReferToSameDataset(e,t)||!t.connectionId?e:{...e,connectionId:t.connectionId}}function W(e){return M(e)?e:void 0}function ae(e,t){if(!(e.kind!=="semantic"||e.connectionId))return t.find(r=>(r==null?void 0:r.kind)==="semantic"&&N.semaphorSourcesReferToSameDataset(e,r)&&!!r.connectionId)}function S(e,t){const r=W(e==null?void 0:e.source);return r?G(r,t):void 0}function de({explicitSource:e,field:t,defaultSource:r,fallbackSources:n}){const o=[r,...n||[]],a=W(e),i=a?G(a,ae(a,o)):void 0;if(i)return i;if(e!==void 0)return;const d=S(t,r),s=d?G(d,ae(d,o)):void 0;if(s)return s;if((t==null?void 0:t.source)===void 0)return W(r)}function ke(e,t){if(!(e!=null&&e.name)||!(t!=null&&t.name)||e.name!==t.name)return!1;const r=S(e),n=S(t);return!r||!n?!0:K(r,n)}function C(e){var t;return D((t=_(e))==null?void 0:t.kind)}function ce(e){var t,r;return C(e)!=="semantic"?null:((r=D((t=_(e))==null?void 0:t.domainId))==null?void 0:r.trim())||null}function xe(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetName)}function Te(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetId)}function Fe(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.connectionId)}function Re(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.tableName)}function Ne(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.databaseName)||""}function Me(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.schemaName)||""}function le(e){if(e.analyticsIntent&&typeof e.analyticsIntent=="object"&&"source"in e.analyticsIntent)return e.analyticsIntent.source}function ue({datasets:e,requireAtLeastOne:t}){if(t&&e.length<1)return{ok:!1,issue:"invalid_dataset_count"};if(e.length<=1)return{ok:!0};const r=e.map(ce),n=new Set(r.filter(Boolean));return r.some(o=>!o)||n.size!==1?{ok:!1,issue:"invalid_multi_dataset_scope"}:{ok:!0}}function E(e,t){if(!t)return!1;if(t.kind==="semantic"){const r=Te(e);return ce(e)===t.domainId?r&&t.datasetId?r===t.datasetId:xe(e)===t.datasetName:!1}return t.kind==="physical"?Fe(e)===t.connectionId&&Re(e)===t.tableName&&Ne(e)===(t.databaseName||"")&&Me(e)===(t.schemaName||""):!1}function $e(e,t){return e.find(r=>E(r,t))}function p(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function B(e){const t=new Set;for(const r of e){if(t.has(r))return r;t.add(r)}return null}function fe({card:e,datasets:t,errors:r}){if(e.type==="text")return;const n=le(e);if(!n){if(t.length<=1)return;r.push(p("missing_card_analytics_source","Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",e.id));return}t.some(o=>E(o,n))||r.push(p("invalid_card_analytics_source","Dashboard cards with an explicit analytics source must use one of the selected datasets.",e.id))}function P(e){return e.map(t=>t==null?void 0:t.source).filter(t=>!!t)}function H(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function ie(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Oe(e){var r;if(!e)return[];const t=[e.source];return e.kind==="metric"?t.push(...P([...H(e.metrics),e.primaryMetric,e.dateField,...H(e.dimensions),...ie(e.filters).map(n=>n.field)])):e.kind==="records"?t.push(...P([...H(e.fields),e.dateField,(r=e.orderBy)==null?void 0:r.field,...ie(e.filters).map(n=>n.field)])):e.kind==="inputOptions"?t.push(...P([e.field])):e.kind==="sql"&&t.push(...P(e.fields||[])),t}function pe({card:e,datasets:t,errors:r}){if(e.type!=="text"){for(const n of Oe(e.analyticsIntent))if(n&&!t.some(o=>E(o,n))){r.push(p("invalid_card_query_source","Dashboard card query field references must use one of the selected datasets.",e.id));return}}}function he({card:e,errors:t}){if(e.type==="text"||!e.analyticsIntent)return;const r=z.validateSemaphorAnalyticsIntent(e.analyticsIntent);if(!r.ok)for(const n of r.errors)t.push(p(n.code,n.path?`${n.path}: ${n.message}`:n.message,e.id))}function me({datasets:e,errors:t,requireAtLeastOne:r}){const n=ue({datasets:e,requireAtLeastOne:r});if(!n.ok){if(n.issue==="invalid_dataset_count"){t.push(p("invalid_dataset_count","Dashboard authoring requires at least one selected dataset."));return}t.push(p("invalid_multi_dataset_scope","Multi-dataset dashboard authoring is limited to semantic datasets from one domain."))}}function ge(e){var f,g;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_plan","Dashboard plan must be a structured object.")],warnings:[]};const r=e,n=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard plan version must be 1.")),(f=r.title)!=null&&f.trim()||t.push(p("missing_title","Dashboard plan needs a title."));const o=Array.isArray(r.datasets)?r.datasets:[],a=Array.isArray(r.sheets)?r.sheets:[];me({datasets:o,errors:t,requireAtLeastOne:!0}),a.length!==1&&t.push(p("invalid_sheet_count","MVP dashboard authoring creates exactly one dashboard sheet."));const i=a[0];i&&i.kind!=="dashboard"&&t.push(p("invalid_sheet_kind",'Generated sheet must use kind "dashboard".'));const d=(i==null?void 0:i.cards)||[];d.length>v.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS&&t.push(p("too_many_cards",`Generated dashboards can contain at most ${v.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS} cards.`));const s=B(d.map(l=>l.id));s&&t.push(p("duplicate_card_id",`Duplicate generated card id: ${s}.`));const u=B(d.map(l=>l.frameId));u&&t.push(p("duplicate_frame_id",`Duplicate generated frame id: ${u}.`));for(const l of d)(g=l.title)!=null&&g.trim()||t.push(p("missing_card_title","Card title is required.",l.id)),l.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",l.id)),l.type!=="text"&&!l.analyticsIntent&&n.push(p("missing_analytics_intent","Non-text card has no analytics intent and may be skipped by the app layer.",l.id)),fe({card:l,datasets:o,errors:t}),he({card:l,errors:t}),pe({card:l,datasets:o,errors:t});const h=Array.isArray(r.filterInputs)?r.filterInputs:[],I=h.map(l=>l.id),A=B(I);A&&t.push(p("duplicate_input_id",`Duplicate dashboard input id: ${A}.`));const w=h.map(l=>l.variableName).filter(Boolean)||[],y=B(w);y&&t.push(p("duplicate_input_variable",`Duplicate dashboard input variable name: ${y}.`));const c=Array.isArray(r.calculatedFields)?r.calculatedFields:[];for(const l of c)l.scope==="domain"&&l.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${l.name}" is outside MVP.`));return{ok:t.length===0,errors:t,warnings:n}}function be(e){var i;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_change_plan","Dashboard change plan must be a structured object.")],warnings:[]};const r=e,n=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard change plan version must be 1.")),(i=r.dashboardId)!=null&&i.trim()||t.push(p("missing_dashboard_id","Dashboard change plan needs a dashboard id."));const o=Array.isArray(r.datasets)?r.datasets:[],a=Array.isArray(r.operations)?r.operations:[];me({datasets:o,errors:t,requireAtLeastOne:!1});for(const d of a){if(d.kind==="unsupported"){n.push(p("unsupported_operation",d.reason||d.requestedAction));continue}d.kind==="addCard"&&d.card.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",d.card.id)),d.kind==="addCard"&&(fe({card:d.card,datasets:o,errors:t}),he({card:d.card,errors:t}),pe({card:d.card,datasets:o,errors:t})),d.kind==="addCalculatedField"&&d.field.scope==="domain"&&d.field.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${d.field.name}" is outside MVP.`))}return{ok:t.length===0,errors:t,warnings:n}}const Be={lg:48,md:36,sm:24,xs:12,xxs:6};function Pe(e,t){let r=0,n=0,o=0;return e.map(a=>{const i=Math.min(a.w,t);r>0&&r+i>t&&(r=0,n+=o,o=0);const d={i:a.frameId,x:r,y:n,w:i,h:a.h,minW:Math.min(a.minW,t),minH:a.minH,static:!1};return r+=i,o=Math.max(o,a.h),d})}function ze(e){const t=[...e].sort((s,u)=>s.priority-u.priority),r=t.filter(s=>s.role==="kpi"),n=t.filter(s=>s.role==="chart"),o=t.filter(s=>s.role==="table"),a=t.filter(s=>s.role==="text"),i=a.slice(0,1),d=a.slice(i.length);return{kpis:r,introText:i,charts:n,tables:o,supportingText:d}}function Ee(e,t,r){return t==="xxs"||t==="xs"?r:t==="sm"?Math.min(12,r):t==="md"?e<=1||e===2?18:12:e<=1||e===2?24:e===3?16:12}function qe(e,t,r,n){return r==="xxs"||r==="xs"||r==="sm"||r==="md"||t===1||t%2===1&&e===0?n:n/2}function Ve(e){const{item:t,band:r,index:n,bandCount:o,breakpoint:a,columns:i}=e;return r==="kpi"?{...t,band:r,w:Ee(o,a,i),h:15,minW:Math.min(6,i),minH:12}:r==="table"?{...t,band:r,w:i,h:a==="xxs"||a==="xs"?34:38,minW:Math.min(12,i),minH:18}:r==="introText"?{...t,band:r,w:i,h:a==="xxs"||a==="xs"?12:10,minW:Math.min(12,i),minH:8}:r==="supportingText"?{...t,band:r,w:a==="lg"?i/2:i,h:a==="xxs"||a==="xs"?12:10,minW:Math.min(12,i),minH:8}:{...t,band:r,w:qe(n,o,a,i),h:a==="xxs"||a==="xs"?28:30,minW:Math.min(12,i),minH:16}}function T(e,t,r,n){return e.map((o,a)=>Ve({item:o,band:t,index:a,bandCount:e.length,breakpoint:r,columns:n}))}function q(e){const t=ze(e);return Object.fromEntries(v.DASHBOARD_AUTHORING_BREAKPOINTS.map(r=>{const n=Be[r],o=[...T(t.introText,"introText",r,n),...T(t.kpis,"kpi",r,n),...T(t.charts,"chart",r,n),...T(t.tables,"table",r,n),...T(t.supportingText,"supportingText",r,n)];return[r,Pe(o,n)]}))}function He(e){const t=De.normalizeAnalyticsCatalogDataType(e);return t==="datetime"?"date":t==="unknown"?"string":t}function Le(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function je(e){return Le(e)&&typeof e.filterId=="string"&&typeof e.operation=="string"&&Array.isArray(e.values)}function Ge(e){return e.filter(t=>typeof t=="string"||typeof t=="number")}function We(e){return e.filter(t=>t instanceof Date||typeof t=="string")}function X(e,t){if(t===void 0)return;const r=He(e.dataType),n=e.operation||"in";if(je(t))return{...t,filterId:e.id,name:t.name||e.column,valueType:r,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};if(n==="is null"||n==="is not null")return{filterId:e.id,name:e.column,operation:n,valueType:r,values:[],dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};const o=Array.isArray(t)?t:[t],a=r==="date"?We(o):Ge(o);if(a.length!==0&&!((n==="between"||n==="not between")&&a.length<2))return{filterId:e.id,name:e.column,operation:n,valueType:r,values:a,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext}}function Ie(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function Ue(e,t,r){const n=(t||[]).filter(o=>o.scope==="card"&&o.targetCardId===r).map(o=>o.field).filter(Boolean);return n.length===0?e:{...e,calculatedFields:[...e.calculatedFields||[],...n]}}function U(e,t){return Array.from(new Set((e||[]).map(r=>t.get(r)).filter(r=>!!r)))}function Ke(e,t){if((e==null?void 0:e.kind)!=="cards")return e;const r=U(e.cardIds,t);return r.length>0?{...e,cardIds:r}:null}function Xe(e,t){return!e.applyToCardIds&&!e.excludeCardIds?e:{...e,...e.applyToCardIds?{applyToCardIds:U(e.applyToCardIds,t)}:{},...e.excludeCardIds?{excludeCardIds:U(e.excludeCardIds,t)}:{}}}function Je(e,t){const r={},n=[];return{inputs:(e.filterInputs||[]).flatMap((a,i)=>{const d=Ke(a.scope,t);if(d===null)return n.push(Ie("filter_input_scope_empty",`Filter input "${a.label}" was skipped because all scoped cards were skipped during query validation.`)),[];const s=X(a.filter,a.defaultValue);return s&&(r.shared??(r.shared={}),r.shared[a.id]={status:"set",value:{kind:"filter",filterValue:s}}),[{id:a.id,kind:"filter",label:a.label,variableName:a.variableName,scope:d||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:i},exports:["label","value","start","end","range"],filter:Xe(a.filter,t)}]}),warnings:n,defaultInputValues:r.shared&&Object.keys(r.shared).length>0?r:void 0}}function Qe(e){var w,y;const t=ge(e.plan);if(!t.ok)throw new Error(t.errors.map(c=>c.message).join(`
|
|
2
2
|
`)||"Dashboard plan is invalid.");const r=e.plan.sheets[0],n=[...t.warnings],o=[],a=new Map(e.cardArtifacts.map(c=>[c.planCardId,c])),i=new Map(e.cardArtifacts.map(c=>[c.planCardId,c.card.id])),d=[];for(const c of r.cards){const f=a.get(c.id);if(!f){const l=Ie("missing_card_artifact",`Card "${c.title}" was skipped because no generated artifact was supplied.`,c.id);o.push(l);continue}n.push(...f.warnings||[]);const g=Ue(f.card,e.plan.calculatedFields,c.id);d.push({id:c.frameId,cards:[g],activeCardId:g.id})}if(d.length===0)throw new Error("Dashboard plan did not produce any persistable cards.");const{inputs:s,defaultInputValues:u,warnings:h}=Je(e.plan,i);n.push(...h);const I=q(r.cards.filter(c=>d.some(f=>f.id===c.frameId)).map(c=>({frameId:c.frameId,priority:c.priority,role:c.role})));return{dashboard:{id:e.dashboardId,title:e.plan.title,description:e.plan.description||"",sheets:[{id:r.id,kind:"dashboard",title:r.title,description:r.description,frames:d,layouts:I,calculatedFields:(w=e.plan.calculatedFields)==null?void 0:w.filter(c=>c.scope==="sheet"&&c.field).map(c=>c.field)}],calculatedFields:(y=e.plan.calculatedFields)==null?void 0:y.filter(c=>c.scope==="dashboard"&&c.field).map(c=>c.field),inputs:s,...u?{defaultInputValues:u}:{}},warnings:n,skippedOperations:o}}function k(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function Ye(e){return JSON.parse(JSON.stringify(e))}function Ze(e){var t;return(t=e.sheets)==null?void 0:t.find(r=>(r.kind||"dashboard")==="dashboard")}function L(e,t){var r;for(const n of e.sheets||[])for(const o of n.frames||[]){const a=(r=o.cards)==null?void 0:r.find(i=>i.id===t);if(a)return{sheet:n,frame:o,card:a}}return null}function ye(e){var r,n;const t=(n=(r=e.cards)==null?void 0:r[0])==null?void 0:n.type;return t==="kpi"?"kpi":t==="table"||t==="detailTable"||t==="pivotTable"?"table":t==="text"?"text":"chart"}function et(e){var t;return new Map((((t=e.layouts)==null?void 0:t.lg)||[]).map((r,n)=>[r.i,n]))}function _e(e,t=new Map){const r=et(e),n=Math.max(r.size,t.size),o=(e.frames||[]).map((a,i)=>({frameId:a.id,role:ye(a),priority:t.get(a.id)??r.get(a.id)??n+i}));e.layouts=q(o)}function tt(e){return Object.values(e.layouts||{}).some(t=>t.length>0)}function rt(e,t){if(!tt(e)){_e(e);return}const r=q([{frameId:t.id,role:ye(t),priority:0}]);e.layouts??(e.layouts={});for(const[n,o]of Object.entries(r)){const a=e.layouts[n]||[];if(a.some(s=>s.i===t.id))continue;const i=o[0];if(!i)continue;const d=a.reduce((s,u)=>Math.max(s,u.y+u.h),0);e.layouts[n]=[...a,{...i,y:d}]}}function nt(e,t){var n;const r=X(t.filter,t.defaultValue);r&&(e.defaultInputValues??(e.defaultInputValues={}),(n=e.defaultInputValues).shared??(n.shared={}),e.defaultInputValues.shared[t.id]={status:"set",value:{kind:"filter",filterValue:r}})}function at(e){var d;const t=be(e.changePlan);if(!t.ok)throw new Error(t.errors.map(s=>s.message).join(`
|
|
3
3
|
`)||"Dashboard change plan is invalid.");const r=Ye(e.dashboard),n=[...t.warnings],o=[],a=new Map(e.cardArtifacts.map(s=>[s.planCardId,s])),i=Ze(r);if(!i)throw new Error("Dashboard has no editable dashboard sheet.");i.frames??(i.frames=[]);for(const s of e.changePlan.operations)switch(s.kind){case"addCard":{if((i.frames||[]).reduce((A,w)=>{var y;return A+(((y=w.cards)==null?void 0:y.length)||0)},0)>=v.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS){o.push(k("generated_card_limit_reached",`AI refinement is capped at ${v.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS} cards.`,s.card.id));break}const h=a.get(s.card.id);if(!h){o.push(k("missing_card_artifact",`Card "${s.card.title}" was skipped because no generated artifact was supplied.`,s.card.id));break}const I={id:s.card.frameId,cards:[h.card],activeCardId:h.card.id};i.frames.push(I),rt(i,I);break}case"addFilterInput":{r.inputs??(r.inputs=[]);const u={id:s.input.id,kind:"filter",label:s.input.label,variableName:s.input.variableName,scope:s.input.scope||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:r.inputs.length},exports:["label","value","start","end","range"],filter:s.input.filter};r.inputs.push(u),nt(r,s.input);break}case"addCalculatedField":{if(s.field.scope==="dashboard"&&s.field.field)r.calculatedFields??(r.calculatedFields=[]),r.calculatedFields.push(s.field.field);else if(s.field.scope==="sheet"&&s.field.field)i.calculatedFields??(i.calculatedFields=[]),i.calculatedFields.push(s.field.field);else if(s.field.scope==="card"&&s.field.field){const u=s.field.targetCardId?L(r,s.field.targetCardId):null;u?((d=u.card).calculatedFields??(d.calculatedFields=[]),u.card.calculatedFields.push(s.field.field)):o.push(k("missing_calculated_field_target",`Calculated field "${s.field.name}" needs a valid target card.`))}break}case"renameCard":{const u=L(r,s.cardId);if(!u){o.push(k("card_not_found",`Card "${s.cardId}" could not be renamed because it was not found.`,s.cardId));break}u.card.title=s.title,s.description!==void 0&&(u.card.description=s.description);break}case"reorderCards":{const u=new Map;for(let h=0;h<s.cardIds.length;h+=1){const I=s.cardIds[h],A=L(r,I);A&&u.set(A.frame.id,h)}_e(i,u);break}case"reuseCalculatedField":n.push(k("reused_calculated_field",`Calculated field "${s.fieldId}" is reused by reference.`));break;case"unsupported":o.push(k("unsupported_operation",s.reason||s.requestedAction));break}return{dashboard:r,warnings:n,skippedOperations:o}}function b(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function F(e,t){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||t}function Se(e,t){if(!t.has(e))return t.add(e),e;let r=2,n=`${e}-${r}`;for(;t.has(n);)r+=1,n=`${e}-${r}`;return t.add(n),n}function $(e){return!!(e&&typeof e=="object")}function Ae(e){return Array.isArray(e.inputs)?e.inputs.filter(t=>$(t)&&typeof t.id=="string"):[]}function J(e){return Array.isArray(e.sections)?e.sections.filter(t=>$(t)):[]}function Q(e){return Array.isArray(e.views)?e.views.filter(t=>$(t)):[]}function x(e){if(!Array.isArray(e))return[];const t=[];for(const r of e){const n=S(r);n&&t.push(n)}return t}function it(e){var n,o;if(!e)return[];const t=[];if(M(e.source)&&t.push(e.source),e.kind==="metric"){t.push(...x(e.metrics));const a=S(e.dateField);a&&t.push(a),t.push(...x(e.dimensions)),t.push(...x((n=e.filters)==null?void 0:n.map(i=>i.field)))}else if(e.kind==="records"){const a=S(e.dateField);a&&t.push(a),t.push(...x(e.fields)),t.push(...x((o=e.filters)==null?void 0:o.map(i=>i.field)))}else if(e.kind==="inputOptions"){const a=S(e.field);a&&t.push(a)}else e.kind==="sql"&&t.push(...x(e.fields));const r="inputs"in e&&Array.isArray(e.inputs)?e.inputs:[];for(const a of r){const i=S(a.field);i&&t.push(i)}return t}function ot(e){const t=[];for(const r of Ae(e)){const n=S(r.field);n&&t.push(n)}for(const r of J(e))for(const n of Q(r))t.push(...it(n.analytics));return t}function st(e){var r;const t=[];for(const n of J(e))for(const o of Q(n))M((r=o.analytics)==null?void 0:r.source)&&t.push(o.analytics.source);return t}function dt(e,t){const r=R(e).filter(M);if(r.length===0)return t.push(b("missing_materializable_dataset","No semantic or physical source could be converted into the current dashboard authoring dataset reference.")),[];const n=r.every(a=>a.kind==="semantic"),o=Array.from(new Set(r.filter(a=>a.kind==="semantic").map(a=>a.domainId)));return r.length>1&&(!n||o.length!==1)?(t.push(b("multiple_datasets_out_of_scope","The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest.")),[r[0]]):r}function ct(e,t){const r=J(e),n=Ae(e),o=R(ot(e)),a=R(st(e));return{sections:r,inputs:n,sources:o,primarySources:a,defaultSource:a.length===1?a[0]:void 0,datasets:dt(o,t)}}function lt(e){return e&&z.validateSemaphorAnalyticsIntent(e).ok?e:void 0}function ut(e){var t;switch((t=e.presentation)==null?void 0:t.kind){case"kpi":return"kpi";case"lineChart":return"line";case"barChart":return"bar";case"areaChart":return"area";case"table":return"table";case"text":return"text";default:return null}}function ft(e){var t,r,n;return((t=e.presentation)==null?void 0:t.kind)==="kpi"?"kpi":((r=e.presentation)==null?void 0:r.kind)==="table"?"table":((n=e.presentation)==null?void 0:n.kind)==="text"?"text":"chart"}function pt(e){const t=z.normalizeSemaphorInputOperator(e);switch(t){case"not_in":return"not in";case"not_between":return"not between";case"contains":return"like";case"not_contains":return"not like";default:return t||"in"}}function ht(e){return $(e.field)?e.field.dataType==="datetime"?"date":e.field.dataType||"string":"string"}function mt(e){if(!(!e||e.kind!=="physical"))return[e.databaseName,e.schemaName,e.tableName].filter(Boolean).join(".")}function gt(e,t,r,n,o,a){if(e.kind!=="filter")return a.push(b("control_inputs_deferred",`Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`)),null;if(!$(e.field)||typeof e.field.name!="string")return a.push(b("filter_requires_field",`Filter "${e.label||e.id}" needs a field before the dashboard compiler can materialize it.`)),null;const i=de({explicitSource:void 0,field:e.field,defaultSource:t,fallbackSources:r}),d=(i==null?void 0:i.kind)==="semantic"||(i==null?void 0:i.kind)==="physical"?i.connectionId:void 0;if(!d)return a.push(b("filter_requires_connection_id",`Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`)),null;const h={id:`filter-${Se(F(e.id,e.field.name),o)}`,variableName:e.id,connectionId:d,title:e.label,column:e.field.name,dataType:ht(e),qualifiedTableName:mt(i),sql:"",operation:pt(e.operator),type:e.multi===!1?"single":"multiple",location:"dashboard",displayMode:"toolbar",fieldMeta:(i==null?void 0:i.kind)==="semantic"?{name:e.field.name,qualifiedFieldName:e.field.name,dataType:e.field.dataType,role:e.field.role==="measure"?"metric":"groupby"}:void 0,semanticContext:(i==null?void 0:i.kind)==="semantic"?{semanticDomainId:i.domainId,connectionId:i.connectionId}:void 0};return{id:e.id,label:e.label,variableName:e.id,scope:n,filter:h,defaultValue:X(h,e.defaultValue)}}function j(e){const t=[],r=[];for(const n of e.viewIds){const o=e.viewIdToCardId.get(n);o?t.push(o):r.push(n)}return r.length>0&&e.warnings.push(b("input_scope_view_not_found",`Filter "${e.inputLabel}" referenced unknown view ids: ${r.join(", ")}.`)),Array.from(new Set(t))}function bt(e){var n,o;if(!e.protocolScope){const a=Array.from(new Set(e.boundCardIds));return a.length>0&&a.length<e.allCardIds.length?{kind:"cards",cardIds:a}:void 0}if(e.protocolScope.level==="dashboard"){if(!((n=e.protocolScope.excludeViewIds)!=null&&n.length))return;const a=new Set(j({inputLabel:e.inputLabel,viewIds:e.protocolScope.excludeViewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings}));return{kind:"cards",cardIds:e.allCardIds.filter(i=>!a.has(i))}}if(e.protocolScope.level==="view"){const a=j({inputLabel:e.inputLabel,viewIds:e.protocolScope.viewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings});return a.length===0?(e.warnings.push(b("input_scope_has_no_materialized_cards",`Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`)),null):{kind:"cards",cardIds:a}}const t=e.sectionIdToCardIds.get(e.protocolScope.sectionId)||[];if(t.length===0)return e.warnings.push(b("input_scope_section_not_found",`Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`)),null;if(!((o=e.protocolScope.excludeViewIds)!=null&&o.length))return{kind:"cards",cardIds:t};const r=new Set(j({inputLabel:e.inputLabel,viewIds:e.protocolScope.excludeViewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings}));return{kind:"cards",cardIds:t.filter(a=>!r.has(a))}}function It(e){var w,y,c;const t=[],r=z.validateSemaphorDashboardIntent(e);for(const f of r.warnings)t.push(b(f.code,f.message));for(const f of r.errors)t.push(b(f.code,f.message));const n=ct(e,t),o=[],a=new Map,i=new Map,d=new Map,s=new Set,u=new Set;let h=0;for(const[f,g]of n.sections.entries()){const l=typeof g.title=="string"?g.title:`Section ${f+1}`,Y=g.id||F(l,`section-${f+1}`);i.set(Y,[]);for(const[Z,m]of Q(g).entries()){const ee=ut(m),V=F(m.id||`${l}-${m.title||`View ${Z+1}`}`,`card-${f+1}-${Z+1}`);if(!ee){t.push(b("unsupported_presentation",`Dashboard presentation "${((w=m.presentation)==null?void 0:w.kind)||"unknown"}" is not supported by the dashboard authoring adapter.`,`card-${V}`));continue}if(((y=m.analytics)==null?void 0:y.kind)==="sql"){t.push(b("sql_intent_deferred","SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",`card-${V}`));continue}const te=Se(V,s),O=`card-${te}`;m.id&&a.set(m.id,O),(c=i.get(Y))==null||c.push(O);const we=m.analytics&&"inputs"in m.analytics?m.analytics.inputs:void 0;for(const re of we||[]){const ne=d.get(re.inputId)||[];ne.push(O),d.set(re.inputId,ne)}o.push({id:O,frameId:`frame-${te}`,title:m.title,description:m.description,type:ee,role:ft(m),priority:h,section:l,analyticsIntent:lt(m.analytics),text:m.text}),h+=1}}const I=n.inputs.map(f=>{const g=bt({protocolScope:f.scope,inputLabel:f.label,allCardIds:o.map(l=>l.id),boundCardIds:d.get(f.id)||[],viewIdToCardId:a,sectionIdToCardIds:i,warnings:t});return g===null?null:gt(f,n.defaultSource,n.sources,g,u,t)}).filter(f=>!!f);return{plan:{version:1,id:`plan-${F(e.title,"dashboard")}`,title:e.title,description:e.description,datasets:n.datasets,sheets:[{id:`sheet-${F(e.title,"dashboard")}`,title:e.title,description:e.description,kind:"dashboard",cards:o}],filterInputs:I.length?I:void 0,warnings:t.length?t:void 0,unresolvedRequests:r.ok?void 0:r.errors.map(f=>f.message)},warnings:t}}exports.DASHBOARD_AUTHORING_BREAKPOINTS=v.DASHBOARD_AUTHORING_BREAKPOINTS;exports.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS=v.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS;exports.applyDashboardChangePlan=at;exports.compileDashboardFromPlan=Qe;exports.compileResponsiveDashboardLayouts=q;exports.dashboardAuthoringDatasetMatchesSource=E;exports.dashboardAuthoringFieldsReferToSameTarget=ke;exports.dashboardAuthoringSourceFromField=S;exports.dashboardAuthoringSourceKey=ve;exports.dashboardAuthoringSourcesReferToSameDataset=K;exports.dashboardPlanFromSemaphorDashboardIntent=It;exports.findDashboardAuthoringDatasetForSource=$e;exports.getDashboardAuthoringCardSource=le;exports.isMaterializableDashboardAuthoringSource=M;exports.isSemaphorSourceRef=oe;exports.mergeDashboardAuthoringSources=R;exports.preferDashboardAuthoringSourceMetadata=se;exports.preferredDashboardAuthoringSource=Ce;exports.resolveDashboardAuthoringSource=de;exports.validateDashboardAuthoringDatasetScope=ue;exports.validateDashboardChangePlan=be;exports.validateDashboardPlan=ge;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { D as B, a as be } from "../chunks/contracts-CoCOpd_i.js";
|
|
2
2
|
import { s as Ie, a as E, p as ye } from "../chunks/source-identity-Dj3dryN9.js";
|
|
3
3
|
import { c as ae, f as _e, n as we } from "../chunks/validators-CtNmgsvG.js";
|
|
4
|
-
import { c as ve } from "../chunks/catalog-field-grounding-
|
|
4
|
+
import { c as ve } from "../chunks/catalog-field-grounding-BK4BX8sZ.js";
|
|
5
5
|
function _(e) {
|
|
6
6
|
return e && typeof e == "object" ? e : null;
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),kn=require("react-dom/client"),v=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),kn=require("react-dom/client"),v=require("../chunks/index-c_0nwsOM.js"),x=require("../chunks/switch-Jhyl63RF.js"),Ye=require("../data-app-builder-browser-runtime/index.cjs"),Nn=require("../chunks/save-D2O96E5A.js");function Fr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const An=Fr(p),Cn=Fr(kn);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -2,10 +2,10 @@ import { jsx as r, jsxs as c, Fragment as re } from "react/jsx-runtime";
|
|
|
2
2
|
import * as Yn from "react";
|
|
3
3
|
import { useContext as Zn, useState as x, useRef as oe, useMemo as ze, useEffect as W, useCallback as Ot } from "react";
|
|
4
4
|
import * as Xn from "react-dom/client";
|
|
5
|
-
import {
|
|
6
|
-
import { c as $e, B as H, P as it, b as lt, d as dt, a1 as ca, a2 as ua, a3 as pa, a4 as ha, a5 as ma, X as Je, f as me, R as fa, e as Ut } from "../chunks/switch-
|
|
5
|
+
import { ae as ea, af as ta, ag as Ir, ah as jr, ai as zr, aj as ra, ak as Wr, al as Hr, am as Jr, an as Vr, ao as _r, ap as Ur, aq as Gr, ar as na, as as aa, at as oa, au as Ht, av as on, x as Kr, aw as sa, ax as Vt, ay as _t, az as sn, aA as ia, aB as la, aC as da } from "../chunks/index-hhH5F_tQ.js";
|
|
6
|
+
import { c as $e, B as H, P as it, b as lt, d as dt, a1 as ca, a2 as ua, a3 as pa, a4 as ha, a5 as ma, X as Je, f as me, R as fa, e as Ut } from "../chunks/switch-DMPsMpHW.js";
|
|
7
7
|
import { loadSemaphorBrowserRuntime as ot } from "../data-app-builder-browser-runtime/index.js";
|
|
8
|
-
import { S as ga } from "../chunks/save-
|
|
8
|
+
import { S as ga } from "../chunks/save-zNVYH02T.js";
|
|
9
9
|
/**
|
|
10
10
|
* @license lucide-react v0.453.0 - ISC
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../chunks/validation-BHFaWDU-.js"),z=require("../chunks/index-BxM99sFL.js"),p=require("react"),Q=require("react/jsx-runtime"),$=require("../chunks/validators-jpoYhpHh.js");require("../chunks/catalog-field-grounding-BGW0hnB9.js");const L=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"],N=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"];function E(e){if(!e)return{};const t=W(e.executionResult),n=U(e,t),r=J(n);return{...e,...Object.keys(n).length?{resultSets:n}:{},...r?{columns:r.columns,records:r.records,rowCount:r.rowCount}:{}}}function U(e,t){const n=B(e.resultSets);for(const i of L){if(n[i]){n[i]=P(n[i]);continue}const s=F(e[i]);if(!s.length)continue;const a=t.length?t:H(s);n[i]={records:O(s,a),columns:a,rowCount:s.length}}const r=Y(e.executionResult);return r&&r.records.length>0&&!n.records&&(n.records=r),n}function B(e){return Object.fromEntries(Object.entries(e||{}).map(([t,n])=>[t,P(n)]))}function P(e){var t;return{...e,records:O(e.records||[],e.columns||[]),rowCount:e.rowCount??((t=e.records)==null?void 0:t.length)??0}}function J(e){var t;for(const n of N)if((t=e[n])!=null&&t.records.length)return e[n];return Object.values(e).find(n=>n.records.length)||Object.values(e)[0]}function Y(e){const t=e==null?void 0:e.result;if(!(!t||t.kind!=="records"&&t.kind!=="sql"))return{records:O(t.records,t.columns),columns:t.columns,rowCount:t.rowCount??t.records.length}}function W(e){const t=e==null?void 0:e.result;return!t||t.kind!=="records"&&t.kind!=="sql"?[]:t.columns}function F(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object"&&!Array.isArray(t))):[]}function O(e,t){return t.length?e.map(n=>{const r={};return t.forEach((i,s)=>{const a=X(n,{name:i.key,label:i.label,fallbackNames:[i.name,Object.keys(n)[s]]});a!==void 0&&(r[i.key]=a)}),Object.keys(r).length?r:n}):e}function H(e){return Array.from(new Set(e.flatMap(n=>Object.keys(n)))).map(n=>({key:n,name:n,label:n}))}function X(e,t){const n=[t.name,t.label,...t.fallbackNames||[]].filter(r=>!!r);for(const r of n)if(Object.prototype.hasOwnProperty.call(e,r))return e[r]}function G(e){return e}function Z(e){return e}const ee={filter(e){return{...e,kind:"filter"}},control(e){return{...e,kind:"control"}},sqlParam(e){return{...e,kind:"control",role:"sqlParam"}},derivedField(e){return{...e,kind:"derived_field",expressionLanguage:e.expressionLanguage||"semaphor_sql_template"}},metric(e){return{...e,queryKind:"metric"}},analysis(e){return{...e,queryKind:"analysis"}},records(e){return{...e,queryKind:"records"}},inputOptions(e){return{...e,queryKind:"inputOptions"}},sql(e){return{...e,queryKind:"sql"}},matrix(e){return{...e,queryKind:"matrix"}}};function T(){return{executeAnalysis:(e,t,n)=>S(e,t,n??{}).then(E),executeMetric:(e,t)=>S(e,t),executeRecords:(e,t)=>S(e,t),executeInputOptions:(e,t)=>S(e,t),executeSql:(e,t)=>S(e,t),executeMatrix:(e,t)=>S(e,t)}}async function S(e,t,n){if(!t.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const r=await fetch(ne(t),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.token}`},body:JSON.stringify({intent:e,activeInputs:t.activeInputs,...n?{analysisOptions:n}:{},resultShape:e.kind})}),i=await te(r);if(!r.ok||i.error)throw new Error(i.error||`Semaphor Data App execution failed with status ${r.status}.`);return i}async function te(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:re(e,t),details:t}}}function re(e,t){const n=e.statusText?` ${e.statusText}`:"",r=t.replace(/\s+/g," ").trim();return r?`Semaphor Data App execution failed with status ${e.status}${n}: ${r.slice(0,240)}`:`Semaphor Data App execution failed with status ${e.status}${n}.`}function ne(e){const t=oe(e).replace(/\/+$/,"");return t?t.endsWith("/api")?`${t}/v1/data-app/execute`:`${t}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function oe(e){if(e.apiBaseUrl)return e.apiBaseUrl;if(!e.token)return"";try{return z.jwtDecode(e.token).apiServiceUrl||""}catch{return""}}const K=p.createContext({});function V(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function j(){return p.useContext(K)}function ie({token:e,apiBaseUrl:t,executor:n,children:r}){var o;const i=V(),s=((o=i==null?void 0:i.authToken)==null?void 0:o.accessToken)||e,a=(i==null?void 0:i.dataApiBaseUrl)||(i==null?void 0:i.apiBaseUrl)||t,h=p.useMemo(()=>T(),[]),c=n||h,l=p.useMemo(()=>({token:s,apiBaseUrl:a,executor:c}),[a,c,s]);return Q.jsx(K.Provider,{value:l,children:r})}const g={value:null},x={},ue={records:[]},D={options:[]},se={records:[]},k={};function ae(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),n=u.toSemaphorAnalysisQueryOptions(e);try{const r=u.toSemaphorAnalysisIntent(e),i=y(r);return i?{error:i,activeInputs:t,analysisOptions:n,queryKey:m(void 0,t,i,n),idleData:x}:{intent:r,error:null,activeInputs:t,analysisOptions:n,queryKey:m(r,t,void 0,n),idleData:x}}catch(r){const i=f(r);return{error:i,activeInputs:t,analysisOptions:n,queryKey:m(void 0,t,i,n),idleData:x}}}function ce(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs);try{const n=u.toSemaphorMetricIntent(e),r=y(n);return r?{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:g}:{intent:n,error:null,activeInputs:t,queryKey:m(n,t),idleData:g}}catch(n){const r=f(n);return{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:g}}}function le(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),n=ue;try{const r=u.toSemaphorRecordsIntent(e),i=y(r);return i?{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}:{intent:r,error:null,activeInputs:t,queryKey:m(r,t),idleData:n}}catch(r){const i=f(r);return{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}}}function de(e){try{const t=u.toSemaphorInputOptionsIntent(e),n=y(t);return n?{error:n,queryKey:m(void 0,void 0,n),idleData:D}:{intent:t,error:null,queryKey:m(t),idleData:D}}catch(t){const n=f(t);return{error:n,queryKey:m(void 0,void 0,n),idleData:D}}}function pe(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),n=se;try{const r=u.toSemaphorSqlIntent(e),i=y(r);return i?{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}:{intent:r,error:null,activeInputs:t,queryKey:m(r,t),idleData:n}}catch(r){const i=f(r);return{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}}}function me(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs);try{const n=u.toSemaphorMatrixIntent(e),r=y(n);return r?{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:k}:{intent:n,error:null,activeInputs:t,queryKey:m(n,t),idleData:k}}catch(n){const r=f(n);return{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:k}}}function f(e){return e instanceof Error?e:new Error(String(e))}function y(e){const t=$.validateSemaphorAnalyticsIntent(e);if(t.ok)return null;const n=t.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 m(e,t,n,r){return JSON.stringify({intent:e,activeInputs:t,analysisOptions:r,error:n==null?void 0:n.message})}function he(e){const[t,n]=p.useState(e.defaultValue),r=Object.prototype.hasOwnProperty.call(e,"value"),i=r?e.value:t,s=p.useMemo(()=>u.normalizeSemaphorInputOptions(e.options),[e.options]),a=p.useCallback(c=>{var o;const l=c;(o=e.onValueChange)==null||o.call(e,l),r||n(l)},[r,e]),h=p.useCallback(()=>a(void 0),[a]);return p.useMemo(()=>{const c=u.toSemaphorInputSpec(e);return{id:e.id,kind:e.kind,label:e.label,field:c.field,operator:c.operator,controlRole:e.kind==="control"?e.role:void 0,value:i,options:s,isActive:u.hasSemaphorInputValue(i),setValue:a,clear:h,toAnalyticsInput:()=>({inputId:c.inputId,field:c.field,kind:e.kind,label:e.label,value:i,isActive:u.hasSemaphorInputValue(i),operator:c.operator,controlRole:e.kind==="control"?e.role:void 0})}},[h,s,a,e,i])}function fe(e){const[t,n]=p.useState(()=>ve(e));return p.useEffect(()=>{n(r=>{let i=r;for(const s of e)!Object.prototype.hasOwnProperty.call(i,s.id)&&s.defaultValue!==void 0&&(i={...i,[s.id]:s.defaultValue});return i})},[e]),p.useMemo(()=>e.map(r=>{const i=Object.prototype.hasOwnProperty.call(r,"value"),s=i?r.value:t[r.id],a=u.normalizeSemaphorInputOptions(r.options),h=o=>{var d;(d=r.onValueChange)==null||d.call(r,o),i||n(v=>({...v,[r.id]:o}))},c=()=>h(void 0),l=u.toSemaphorInputSpec(r);return{id:r.id,kind:r.kind,label:r.label,field:l.field,operator:l.operator,controlRole:r.kind==="control"?r.role:void 0,value:s,options:a,isActive:u.hasSemaphorInputValue(s),setValue:h,clear:c,toAnalyticsInput:()=>({inputId:l.inputId,field:l.field,kind:r.kind,label:r.label,value:s,isActive:u.hasSemaphorInputValue(s),operator:l.operator,controlRole:r.kind==="control"?r.role:void 0})}}),[e,t])}function Se(e,t={}){const n=p.useMemo(()=>t.inputs?{...e,inputs:t.inputs}:e,[t.inputs,e]),r=p.useMemo(()=>{switch(n.queryKind){case"metric":return{queryKind:n.queryKind,request:ce(n)};case"analysis":return{queryKind:n.queryKind,request:ae(n)};case"records":return{queryKind:n.queryKind,request:le(n)};case"inputOptions":return{queryKind:n.queryKind,request:de(n)};case"sql":return{queryKind:n.queryKind,request:pe(n)};case"matrix":return{queryKind:n.queryKind,request:me(n)};default:return R(n)}},[n]),i=p.useCallback(o=>{var v,q,b,w,C,I,_,A,M;const d=r.request;if(d.intent)switch(r.queryKind){case"metric":return(v=o.executor)==null?void 0:v.executeMetric(d.intent,o);case"analysis":return(b=(q=o.executor)==null?void 0:q.executeAnalysis)==null?void 0:b.call(q,d.intent,o,d.analysisOptions);case"records":return(w=o.executor)==null?void 0:w.executeRecords(d.intent,o);case"inputOptions":return(C=o.executor)==null?void 0:C.executeInputOptions(d.intent,o);case"sql":return(_=(I=o.executor)==null?void 0:I.executeSql)==null?void 0:_.call(I,d.intent,o);case"matrix":return(M=(A=o.executor)==null?void 0:A.executeMatrix)==null?void 0:M.call(A,d.intent,o);default:return R(r)}},[r]),s=ye(r.request.queryKey,i,r.request.idleData,r.request.activeInputs),a=r.request.error?r.request.idleData:s.data,h=r.request.error?"error":s.status,c=!r.request.error&&s.status==="loading",l=r.request.error||s.error;switch(r.queryKind){case"metric":{const o=a;return{id:n.id,intent:r.request.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,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"analysis":{const o=E(a);return{id:n.id,intent:r.request.intent,...o||{},status:h,isLoading:c,error:l}}case"records":{const o=a;return{id:n.id,intent:r.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"inputOptions":{const o=a;return{id:n.id,intent:r.request.intent,options:(o==null?void 0:o.options)||[],executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"sql":{const o=a;return{id:n.id,intent:r.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,output:o==null?void 0:o.output,rowLimitExceeded:o==null?void 0:o.rowLimitExceeded,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"matrix":{const o=a;return{id:n.id,intent:r.request.intent,matrixResult:o==null?void 0:o.matrixResult,grid:o==null?void 0:o.grid,expansion:o==null?void 0:o.expansion,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}default:return R(r)}}function ye(e,t,n,r){const i=j(),s=p.useRef(t),a=p.useRef(r),[h,c]=p.useState({status:"idle",data:n,error:null});return s.current=t,a.current=r,p.useEffect(()=>{let l;try{l=s.current({...i,activeInputs:a.current})}catch(d){c({status:"error",data:n,error:f(d)});return}if(!l){c({status:"idle",data:n,error:null});return}let o=!1;return c(d=>({status:"loading",data:d.data,error:null})),l.then(d=>{o||c({status:"success",data:d,error:null})}).catch(d=>{o||c({status:"error",data:n,error:f(d)})}),()=>{o=!0}},[n,e,i]),h}function ve(e){return Object.fromEntries(e.filter(t=>t.defaultValue!==void 0).map(t=>[t.id,t.defaultValue]))}function R(e){throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`)}exports.hasSemaphorInputValue=u.hasSemaphorInputValue;exports.normalizeSemaphorAnalysisQueryOptions=u.normalizeSemaphorAnalysisQueryOptions;exports.normalizeSemaphorInputOptions=u.normalizeSemaphorInputOptions;exports.toSemaphorActiveInputSnapshots=u.toSemaphorActiveInputSnapshots;exports.toSemaphorAnalysisIntent=u.toSemaphorAnalysisIntent;exports.toSemaphorAnalysisQueryOptions=u.toSemaphorAnalysisQueryOptions;exports.toSemaphorInputBinding=u.toSemaphorInputBinding;exports.toSemaphorInputBindings=u.toSemaphorInputBindings;exports.toSemaphorInputOptionsIntent=u.toSemaphorInputOptionsIntent;exports.toSemaphorInputSnapshots=u.toSemaphorInputSnapshots;exports.toSemaphorInputSpec=u.toSemaphorInputSpec;exports.toSemaphorMatrixIntent=u.toSemaphorMatrixIntent;exports.toSemaphorMetricIntent=u.toSemaphorMetricIntent;exports.toSemaphorRecordsIntent=u.toSemaphorRecordsIntent;exports.toSemaphorSqlIntent=u.toSemaphorSqlIntent;exports.validateSemaphorDataAppQuerySpecs=u.validateSemaphorDataAppQuerySpecs;exports.SemaphorDataAppContext=K;exports.SemaphorDataAppProvider=ie;exports.createSemaphorQueryExecutor=T;exports.defineSemaphorDataApp=G;exports.defineSemaphorInput=Z;exports.normalizeSemaphorAnalysisPayload=E;exports.readWindowRuntime=V;exports.semaphor=ee;exports.useSemaphorDataAppRuntime=j;exports.useSemaphorInput=he;exports.useSemaphorInputs=fe;exports.useSemaphorQuery=Se;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../chunks/validation-BVpqRFar.js"),z=require("../chunks/index-BxM99sFL.js"),p=require("react"),Q=require("react/jsx-runtime"),$=require("../chunks/validators-jpoYhpHh.js");require("../chunks/catalog-field-grounding-8L9I0zdg.js");const L=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"],N=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"];function E(e){if(!e)return{};const t=W(e.executionResult),n=U(e,t),r=J(n);return{...e,...Object.keys(n).length?{resultSets:n}:{},...r?{columns:r.columns,records:r.records,rowCount:r.rowCount}:{}}}function U(e,t){const n=B(e.resultSets);for(const i of L){if(n[i]){n[i]=P(n[i]);continue}const s=F(e[i]);if(!s.length)continue;const a=t.length?t:H(s);n[i]={records:O(s,a),columns:a,rowCount:s.length}}const r=Y(e.executionResult);return r&&r.records.length>0&&!n.records&&(n.records=r),n}function B(e){return Object.fromEntries(Object.entries(e||{}).map(([t,n])=>[t,P(n)]))}function P(e){var t;return{...e,records:O(e.records||[],e.columns||[]),rowCount:e.rowCount??((t=e.records)==null?void 0:t.length)??0}}function J(e){var t;for(const n of N)if((t=e[n])!=null&&t.records.length)return e[n];return Object.values(e).find(n=>n.records.length)||Object.values(e)[0]}function Y(e){const t=e==null?void 0:e.result;if(!(!t||t.kind!=="records"&&t.kind!=="sql"))return{records:O(t.records,t.columns),columns:t.columns,rowCount:t.rowCount??t.records.length}}function W(e){const t=e==null?void 0:e.result;return!t||t.kind!=="records"&&t.kind!=="sql"?[]:t.columns}function F(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object"&&!Array.isArray(t))):[]}function O(e,t){return t.length?e.map(n=>{const r={};return t.forEach((i,s)=>{const a=X(n,{name:i.key,label:i.label,fallbackNames:[i.name,Object.keys(n)[s]]});a!==void 0&&(r[i.key]=a)}),Object.keys(r).length?r:n}):e}function H(e){return Array.from(new Set(e.flatMap(n=>Object.keys(n)))).map(n=>({key:n,name:n,label:n}))}function X(e,t){const n=[t.name,t.label,...t.fallbackNames||[]].filter(r=>!!r);for(const r of n)if(Object.prototype.hasOwnProperty.call(e,r))return e[r]}function G(e){return e}function Z(e){return e}const ee={filter(e){return{...e,kind:"filter"}},control(e){return{...e,kind:"control"}},sqlParam(e){return{...e,kind:"control",role:"sqlParam"}},derivedField(e){return{...e,kind:"derived_field",expressionLanguage:e.expressionLanguage||"semaphor_sql_template"}},metric(e){return{...e,queryKind:"metric"}},analysis(e){return{...e,queryKind:"analysis"}},records(e){return{...e,queryKind:"records"}},inputOptions(e){return{...e,queryKind:"inputOptions"}},sql(e){return{...e,queryKind:"sql"}},matrix(e){return{...e,queryKind:"matrix"}}};function T(){return{executeAnalysis:(e,t,n)=>S(e,t,n??{}).then(E),executeMetric:(e,t)=>S(e,t),executeRecords:(e,t)=>S(e,t),executeInputOptions:(e,t)=>S(e,t),executeSql:(e,t)=>S(e,t),executeMatrix:(e,t)=>S(e,t)}}async function S(e,t,n){if(!t.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const r=await fetch(ne(t),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.token}`},body:JSON.stringify({intent:e,activeInputs:t.activeInputs,...n?{analysisOptions:n}:{},resultShape:e.kind})}),i=await te(r);if(!r.ok||i.error)throw new Error(i.error||`Semaphor Data App execution failed with status ${r.status}.`);return i}async function te(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:re(e,t),details:t}}}function re(e,t){const n=e.statusText?` ${e.statusText}`:"",r=t.replace(/\s+/g," ").trim();return r?`Semaphor Data App execution failed with status ${e.status}${n}: ${r.slice(0,240)}`:`Semaphor Data App execution failed with status ${e.status}${n}.`}function ne(e){const t=oe(e).replace(/\/+$/,"");return t?t.endsWith("/api")?`${t}/v1/data-app/execute`:`${t}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function oe(e){if(e.apiBaseUrl)return e.apiBaseUrl;if(!e.token)return"";try{return z.jwtDecode(e.token).apiServiceUrl||""}catch{return""}}const K=p.createContext({});function V(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function j(){return p.useContext(K)}function ie({token:e,apiBaseUrl:t,executor:n,children:r}){var o;const i=V(),s=((o=i==null?void 0:i.authToken)==null?void 0:o.accessToken)||e,a=(i==null?void 0:i.dataApiBaseUrl)||(i==null?void 0:i.apiBaseUrl)||t,h=p.useMemo(()=>T(),[]),c=n||h,l=p.useMemo(()=>({token:s,apiBaseUrl:a,executor:c}),[a,c,s]);return Q.jsx(K.Provider,{value:l,children:r})}const g={value:null},x={},ue={records:[]},D={options:[]},se={records:[]},k={};function ae(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),n=u.toSemaphorAnalysisQueryOptions(e);try{const r=u.toSemaphorAnalysisIntent(e),i=y(r);return i?{error:i,activeInputs:t,analysisOptions:n,queryKey:m(void 0,t,i,n),idleData:x}:{intent:r,error:null,activeInputs:t,analysisOptions:n,queryKey:m(r,t,void 0,n),idleData:x}}catch(r){const i=f(r);return{error:i,activeInputs:t,analysisOptions:n,queryKey:m(void 0,t,i,n),idleData:x}}}function ce(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs);try{const n=u.toSemaphorMetricIntent(e),r=y(n);return r?{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:g}:{intent:n,error:null,activeInputs:t,queryKey:m(n,t),idleData:g}}catch(n){const r=f(n);return{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:g}}}function le(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),n=ue;try{const r=u.toSemaphorRecordsIntent(e),i=y(r);return i?{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}:{intent:r,error:null,activeInputs:t,queryKey:m(r,t),idleData:n}}catch(r){const i=f(r);return{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}}}function de(e){try{const t=u.toSemaphorInputOptionsIntent(e),n=y(t);return n?{error:n,queryKey:m(void 0,void 0,n),idleData:D}:{intent:t,error:null,queryKey:m(t),idleData:D}}catch(t){const n=f(t);return{error:n,queryKey:m(void 0,void 0,n),idleData:D}}}function pe(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),n=se;try{const r=u.toSemaphorSqlIntent(e),i=y(r);return i?{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}:{intent:r,error:null,activeInputs:t,queryKey:m(r,t),idleData:n}}catch(r){const i=f(r);return{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}}}function me(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs);try{const n=u.toSemaphorMatrixIntent(e),r=y(n);return r?{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:k}:{intent:n,error:null,activeInputs:t,queryKey:m(n,t),idleData:k}}catch(n){const r=f(n);return{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:k}}}function f(e){return e instanceof Error?e:new Error(String(e))}function y(e){const t=$.validateSemaphorAnalyticsIntent(e);if(t.ok)return null;const n=t.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 m(e,t,n,r){return JSON.stringify({intent:e,activeInputs:t,analysisOptions:r,error:n==null?void 0:n.message})}function he(e){const[t,n]=p.useState(e.defaultValue),r=Object.prototype.hasOwnProperty.call(e,"value"),i=r?e.value:t,s=p.useMemo(()=>u.normalizeSemaphorInputOptions(e.options),[e.options]),a=p.useCallback(c=>{var o;const l=c;(o=e.onValueChange)==null||o.call(e,l),r||n(l)},[r,e]),h=p.useCallback(()=>a(void 0),[a]);return p.useMemo(()=>{const c=u.toSemaphorInputSpec(e);return{id:e.id,kind:e.kind,label:e.label,field:c.field,operator:c.operator,controlRole:e.kind==="control"?e.role:void 0,value:i,options:s,isActive:u.hasSemaphorInputValue(i),setValue:a,clear:h,toAnalyticsInput:()=>({inputId:c.inputId,field:c.field,kind:e.kind,label:e.label,value:i,isActive:u.hasSemaphorInputValue(i),operator:c.operator,controlRole:e.kind==="control"?e.role:void 0})}},[h,s,a,e,i])}function fe(e){const[t,n]=p.useState(()=>ve(e));return p.useEffect(()=>{n(r=>{let i=r;for(const s of e)!Object.prototype.hasOwnProperty.call(i,s.id)&&s.defaultValue!==void 0&&(i={...i,[s.id]:s.defaultValue});return i})},[e]),p.useMemo(()=>e.map(r=>{const i=Object.prototype.hasOwnProperty.call(r,"value"),s=i?r.value:t[r.id],a=u.normalizeSemaphorInputOptions(r.options),h=o=>{var d;(d=r.onValueChange)==null||d.call(r,o),i||n(v=>({...v,[r.id]:o}))},c=()=>h(void 0),l=u.toSemaphorInputSpec(r);return{id:r.id,kind:r.kind,label:r.label,field:l.field,operator:l.operator,controlRole:r.kind==="control"?r.role:void 0,value:s,options:a,isActive:u.hasSemaphorInputValue(s),setValue:h,clear:c,toAnalyticsInput:()=>({inputId:l.inputId,field:l.field,kind:r.kind,label:r.label,value:s,isActive:u.hasSemaphorInputValue(s),operator:l.operator,controlRole:r.kind==="control"?r.role:void 0})}}),[e,t])}function Se(e,t={}){const n=p.useMemo(()=>t.inputs?{...e,inputs:t.inputs}:e,[t.inputs,e]),r=p.useMemo(()=>{switch(n.queryKind){case"metric":return{queryKind:n.queryKind,request:ce(n)};case"analysis":return{queryKind:n.queryKind,request:ae(n)};case"records":return{queryKind:n.queryKind,request:le(n)};case"inputOptions":return{queryKind:n.queryKind,request:de(n)};case"sql":return{queryKind:n.queryKind,request:pe(n)};case"matrix":return{queryKind:n.queryKind,request:me(n)};default:return R(n)}},[n]),i=p.useCallback(o=>{var v,q,b,w,C,I,_,A,M;const d=r.request;if(d.intent)switch(r.queryKind){case"metric":return(v=o.executor)==null?void 0:v.executeMetric(d.intent,o);case"analysis":return(b=(q=o.executor)==null?void 0:q.executeAnalysis)==null?void 0:b.call(q,d.intent,o,d.analysisOptions);case"records":return(w=o.executor)==null?void 0:w.executeRecords(d.intent,o);case"inputOptions":return(C=o.executor)==null?void 0:C.executeInputOptions(d.intent,o);case"sql":return(_=(I=o.executor)==null?void 0:I.executeSql)==null?void 0:_.call(I,d.intent,o);case"matrix":return(M=(A=o.executor)==null?void 0:A.executeMatrix)==null?void 0:M.call(A,d.intent,o);default:return R(r)}},[r]),s=ye(r.request.queryKey,i,r.request.idleData,r.request.activeInputs),a=r.request.error?r.request.idleData:s.data,h=r.request.error?"error":s.status,c=!r.request.error&&s.status==="loading",l=r.request.error||s.error;switch(r.queryKind){case"metric":{const o=a;return{id:n.id,intent:r.request.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,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"analysis":{const o=E(a);return{id:n.id,intent:r.request.intent,...o||{},status:h,isLoading:c,error:l}}case"records":{const o=a;return{id:n.id,intent:r.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"inputOptions":{const o=a;return{id:n.id,intent:r.request.intent,options:(o==null?void 0:o.options)||[],executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"sql":{const o=a;return{id:n.id,intent:r.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,output:o==null?void 0:o.output,rowLimitExceeded:o==null?void 0:o.rowLimitExceeded,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}case"matrix":{const o=a;return{id:n.id,intent:r.request.intent,matrixResult:o==null?void 0:o.matrixResult,grid:o==null?void 0:o.grid,expansion:o==null?void 0:o.expansion,executionResult:o==null?void 0:o.executionResult,status:h,isLoading:c,error:l}}default:return R(r)}}function ye(e,t,n,r){const i=j(),s=p.useRef(t),a=p.useRef(r),[h,c]=p.useState({status:"idle",data:n,error:null});return s.current=t,a.current=r,p.useEffect(()=>{let l;try{l=s.current({...i,activeInputs:a.current})}catch(d){c({status:"error",data:n,error:f(d)});return}if(!l){c({status:"idle",data:n,error:null});return}let o=!1;return c(d=>({status:"loading",data:d.data,error:null})),l.then(d=>{o||c({status:"success",data:d,error:null})}).catch(d=>{o||c({status:"error",data:n,error:f(d)})}),()=>{o=!0}},[n,e,i]),h}function ve(e){return Object.fromEntries(e.filter(t=>t.defaultValue!==void 0).map(t=>[t.id,t.defaultValue]))}function R(e){throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`)}exports.hasSemaphorInputValue=u.hasSemaphorInputValue;exports.normalizeSemaphorAnalysisQueryOptions=u.normalizeSemaphorAnalysisQueryOptions;exports.normalizeSemaphorInputOptions=u.normalizeSemaphorInputOptions;exports.toSemaphorActiveInputSnapshots=u.toSemaphorActiveInputSnapshots;exports.toSemaphorAnalysisIntent=u.toSemaphorAnalysisIntent;exports.toSemaphorAnalysisQueryOptions=u.toSemaphorAnalysisQueryOptions;exports.toSemaphorInputBinding=u.toSemaphorInputBinding;exports.toSemaphorInputBindings=u.toSemaphorInputBindings;exports.toSemaphorInputOptionsIntent=u.toSemaphorInputOptionsIntent;exports.toSemaphorInputSnapshots=u.toSemaphorInputSnapshots;exports.toSemaphorInputSpec=u.toSemaphorInputSpec;exports.toSemaphorMatrixIntent=u.toSemaphorMatrixIntent;exports.toSemaphorMetricIntent=u.toSemaphorMetricIntent;exports.toSemaphorRecordsIntent=u.toSemaphorRecordsIntent;exports.toSemaphorSqlIntent=u.toSemaphorSqlIntent;exports.validateSemaphorDataAppQuerySpecs=u.validateSemaphorDataAppQuerySpecs;exports.SemaphorDataAppContext=K;exports.SemaphorDataAppProvider=ie;exports.createSemaphorQueryExecutor=T;exports.defineSemaphorDataApp=G;exports.defineSemaphorInput=Z;exports.normalizeSemaphorAnalysisPayload=E;exports.readWindowRuntime=V;exports.semaphor=ee;exports.useSemaphorDataAppRuntime=j;exports.useSemaphorInput=he;exports.useSemaphorInputs=fe;exports.useSemaphorQuery=Se;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as y, a as M, b as B, c as Q, d as J, e as Y, f as F, g as H, n as V, h as $, i as x } from "../chunks/validation-
|
|
2
|
-
import { m as Me, j as Be, k as Qe, l as Je, v as Ye } from "../chunks/validation-
|
|
1
|
+
import { t as y, a as M, b as B, c as Q, d as J, e as Y, f as F, g as H, n as V, h as $, i as x } from "../chunks/validation-BM3-ShHV.js";
|
|
2
|
+
import { m as Me, j as Be, k as Qe, l as Je, v as Ye } from "../chunks/validation-BM3-ShHV.js";
|
|
3
3
|
import { j as W } from "../chunks/index-CuHybtft.js";
|
|
4
4
|
import { createContext as X, useContext as G, useMemo as m, useState as O, useCallback as K, useEffect as L, useRef as j } from "react";
|
|
5
5
|
import { jsx as Z } from "react/jsx-runtime";
|
|
6
6
|
import { c as ee } from "../chunks/validators-CtNmgsvG.js";
|
|
7
|
-
import "../chunks/catalog-field-grounding-
|
|
7
|
+
import "../chunks/catalog-field-grounding-BK4BX8sZ.js";
|
|
8
8
|
const te = [
|
|
9
9
|
"records",
|
|
10
10
|
"changes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/validators-jpoYhpHh.js");require("../chunks/catalog-field-grounding-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/validators-jpoYhpHh.js");require("../chunks/catalog-field-grounding-8L9I0zdg.js");require("../chunks/source-identity-C-xaeE_I.js");const e=require("../chunks/validation-BVpqRFar.js");exports.normalizeSemaphorAnalysisQueryOptions=e.normalizeSemaphorAnalysisQueryOptions;exports.validateSemaphorDataAppQuerySpecs=e.validateSemaphorDataAppQuerySpecs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunks/validators-CtNmgsvG.js";
|
|
2
|
-
import "../chunks/catalog-field-grounding-
|
|
2
|
+
import "../chunks/catalog-field-grounding-BK4BX8sZ.js";
|
|
3
3
|
import "../chunks/source-identity-Dj3dryN9.js";
|
|
4
|
-
import { m, v as i } from "../chunks/validation-
|
|
4
|
+
import { m, v as i } from "../chunks/validation-BM3-ShHV.js";
|
|
5
5
|
export {
|
|
6
6
|
m as normalizeSemaphorAnalysisQueryOptions,
|
|
7
7
|
i as validateSemaphorDataAppQuerySpecs
|