@cubejs-backend/server-core 1.5.3 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/src/core/CompilerApi.d.ts +139 -101
  2. package/dist/src/core/CompilerApi.d.ts.map +1 -1
  3. package/dist/src/core/CompilerApi.js +74 -35
  4. package/dist/src/core/CompilerApi.js.map +1 -1
  5. package/dist/src/core/DevServer.d.ts.map +1 -1
  6. package/dist/src/core/DevServer.js +5 -4
  7. package/dist/src/core/DevServer.js.map +1 -1
  8. package/dist/src/core/DriverDependencies.d.ts +3 -33
  9. package/dist/src/core/DriverDependencies.d.ts.map +1 -1
  10. package/dist/src/core/DriverDependencies.js +3 -1
  11. package/dist/src/core/DriverDependencies.js.map +1 -1
  12. package/dist/src/core/OptsHandler.d.ts.map +1 -1
  13. package/dist/src/core/OptsHandler.js +4 -10
  14. package/dist/src/core/OptsHandler.js.map +1 -1
  15. package/dist/src/core/OrchestratorApi.d.ts +1 -1
  16. package/dist/src/core/OrchestratorApi.d.ts.map +1 -1
  17. package/dist/src/core/OrchestratorApi.js +1 -3
  18. package/dist/src/core/OrchestratorApi.js.map +1 -1
  19. package/dist/src/core/OrchestratorStorage.d.ts +1 -1
  20. package/dist/src/core/RefreshScheduler.d.ts +10 -2
  21. package/dist/src/core/RefreshScheduler.d.ts.map +1 -1
  22. package/dist/src/core/logger.d.ts +20 -6
  23. package/dist/src/core/logger.d.ts.map +1 -1
  24. package/dist/src/core/logger.js +41 -43
  25. package/dist/src/core/logger.js.map +1 -1
  26. package/dist/src/core/server.d.ts +1 -1
  27. package/dist/src/core/server.js.map +1 -1
  28. package/dist/src/core/types.d.ts +6 -2
  29. package/dist/src/core/types.d.ts.map +1 -1
  30. package/index.js +1 -1
  31. package/package.json +13 -12
  32. package/playground/assets/{index-TfRLuI9Q.js → index-_TYPzt1o.js} +1 -1
  33. package/playground/index.html +1 -1
  34. package/playground/vizard/assets/{index-C388WnHl.js → index-DIson5q4.js} +5 -5
  35. package/playground/vizard/download/react-typescript-antd-table.zip +0 -0
  36. package/playground/vizard/download/react-typescript-chartjs-area+bar+doughnut+line+pie.zip +0 -0
  37. package/playground/vizard/index.html +1 -1
@@ -1,4 +1,4 @@
1
- import{t as k,j as s,L as ye,B as me,A as ve,P as be,D as fe,T as je,a as re,b as I,G as C,F as B,S as M,c as H,d as we,u as ze,e as xe,f as z,g as ke,h as Ae,i as J,R as Ce,k as Ee}from"./uikit-M_i__YCU.js";import{r as p}from"./react-CJahmRYQ.js";import{e as x,m as U}from"./monaco-B_IR9uhL.js";import{D as K,F as te,c as Se}from"./icons-DuVB-IiR.js";import"./other-HgnFgCOO.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))r(t);new MutationObserver(t=>{for(const o of t)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function i(t){const o={};return t.integrity&&(o.integrity=t.integrity),t.referrerPolicy&&(o.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?o.credentials="include":t.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(t){if(t.ep)return;t.ep=!0;const o=i(t);fetch(t.href,o)}})();const Te={"react-typescript-antd-table":{".eslintrc.cjs":{file:{contents:`module.exports = {
1
+ import{t as k,j as s,L as ye,B as me,A as ve,P as be,D as fe,T as je,a as re,b as M,G as C,F as B,S as I,c as H,d as we,u as ze,e as xe,f as z,g as ke,h as Ae,i as J,R as Ce,k as Ee}from"./uikit-M_i__YCU.js";import{r as p}from"./react-CJahmRYQ.js";import{e as x,m as P}from"./monaco-B_IR9uhL.js";import{D as K,F as te,c as Se}from"./icons-DuVB-IiR.js";import"./other-HgnFgCOO.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))r(t);new MutationObserver(t=>{for(const o of t)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function i(t){const o={};return t.integrity&&(o.integrity=t.integrity),t.referrerPolicy&&(o.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?o.credentials="include":t.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(t){if(t.ep)return;t.ep=!0;const o=i(t);fetch(t.href,o)}})();const Te={"react-typescript-antd-table":{".eslintrc.cjs":{file:{contents:`module.exports = {
2
2
  root: true,
3
3
  env: { browser: true, es2020: true },
4
4
  extends: [
@@ -4333,9 +4333,9 @@ isomorphic-ws@^4.0.1:
4333
4333
  integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
4334
4334
 
4335
4335
  js-yaml@^4.1.0:
4336
- version "4.1.0"
4337
- resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz"
4338
- integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
4336
+ version "4.1.1"
4337
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.1.tgz#854c292467705b699476e1a2decc0c8a3458806b"
4338
+ integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==
4339
4339
  dependencies:
4340
4340
  argparse "^2.0.1"
4341
4341
 
@@ -4838,4 +4838,4 @@ VITE_CUBE_QUERY=${JSON.stringify(l)}
4838
4838
  VITE_CUBE_PIVOT_CONFIG=${JSON.stringify(a)}
4839
4839
  VITE_CHART_TYPE=${r}
4840
4840
  VITE_CUBE_API_USE_WEBSOCKETS=${i?"true":"false"}
4841
- VITE_CUBE_API_USE_SUBSCRIPTION=${n?"true":"false"}`}},g},[e,r,o,t,n,i,JSON.stringify(l),JSON.stringify(a)])}const Pe={react:{typescript:{antd:"react-typescript-antd-table"}}},Ue={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Oe={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},qe={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Fe={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Re={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Le={table:Pe,area:Ue,bar:Oe,doughnut:qe,line:Fe,pie:Re},Ie={visualization:["line","bar","area","pie","doughnut","table"],framework:["react","angular","vue"],language:["typescript","javascript"],library:["chartjs","antd"]},T=k({as:"img",styles:{display:"block",width:"16px",height:"16px"}}),P=Ie,h=Le,O={line:{name:"Line",type:"visualization",icon:s.jsx(ye,{})},bar:{name:"Bar",type:"visualization",icon:s.jsx(me,{})},area:{name:"Area",type:"visualization",icon:s.jsx(ve,{})},pie:{name:"Pie",type:"visualization",icon:s.jsx(be,{})},doughnut:{name:"Donut",type:"visualization",icon:s.jsx(fe,{})},react:{name:"React",type:"framework",icon:s.jsx(T,{src:"./logos/react.svg"})},typescript:{name:"TypeScript",type:"language",icon:s.jsx(T,{src:"./logos/ts.svg"})},javascript:{name:"JavaScript",type:"language",icon:s.jsx(T,{src:"./logos/js.svg"})},chartjs:{name:"Chart.js",type:"library"},table:{name:"Table",type:"library",icon:s.jsx(je,{})},angular:{name:"Angular",type:"framework",icon:s.jsx(T,{src:"./logos/angular.svg"})},vue:{name:"Vue",type:"framework",icon:s.jsx(T,{src:"./logos/vue.svg"})},antd:{name:"Ant Design",type:"library"}};function Me(e){const{visualization:n,library:i,language:r,framework:t}=e;if(!h[n])throw new Error("Invalid visualization");if(!h[n]?.[t])throw new Error("Invalid framework");if(!h[n]?.[t]?.[r])throw new Error("Invalid language");if(!h[n]?.[t]?.[r]?.[i])throw new Error("Invalid library");return h[n]?.[t]?.[r]?.[i]}const De=p.memo(({color:e})=>s.jsx("div",{style:{display:"grid",width:"16px",height:"16px",color:e?`var(--${e}-color)`:void 0},children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",children:s.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M2.626 2.732a.6.6 0 0 0 0 .849L7.046 8l-4.42 4.42a.6.6 0 0 0 0 .848l.141.141a.6.6 0 0 0 .849 0l4.42-4.42 4.348 4.35a.6.6 0 0 0 .849 0l.141-.142a.6.6 0 0 0 0-.848L9.025 8l4.349-4.349a.6.6 0 0 0 0-.848l-.141-.142a.6.6 0 0 0-.849 0L8.035 7.01 3.616 2.59a.6.6 0 0 0-.849 0l-.141.142Z"})})})),se=p.createContext(void 0),Ve=k({styles:{display:"grid",gridAutoFlow:"column",gap:"1x",placeContent:"start",overflow:"auto",padding:"1x 1x 0 1x",shadow:"inset 0 -1bw 0 #border","--border-color":"rgb(234,234,238)","--light-purple-color":"rgb(243,243,255)"}}),We=k({styles:{position:"relative",display:"grid"}}),Ne=k(re,{styles:{preset:"t3m",display:"grid",flow:"column",gap:"1x",placeContent:"space-between",placeItems:"center start",padding:{"":"1x 1.5x",deletable:"1x 4.5x 1x 1.5x"},cursor:"pointer",border:{"":"none",card:!0},fill:{"":"#white",card:"#light","hovered && card":"#light-purple",active:"#white"},color:{"":"#dark-02",active:"#purple-text","!card & hovered":"#purple"},borderBottom:{"":"none",card:"none"},shadow:{"":"inset 0 -1bw 0 #border",active:"inset 0 -1ow 0 #purple","card & active":"inset 0 -1bw 0 #white"},radius:"top",backgroundClip:"border-box",width:"max 100%",transition:"theme, borderBottom",whiteSpace:"nowrap"}}),Xe=k(re,{"aria-label":"Delete tab",styles:{position:"absolute",top:"1x",right:"1x",display:"grid",placeItems:"center",padding:".5x",cursor:"pointer",fontSize:"12px",fill:{"":"#clean",hovered:"#purple.04"},color:{"":"#dark-03","hovered | pressed":"#purple"},radius:!0,transition:"theme"},children:s.jsx(De,{})});function E(e){const{label:n,activeKey:i,type:r,onChange:t,onDelete:o,children:l}=e,a=r==="card";return s.jsx(se.Provider,{value:{activeKey:i,onChange:t,onDelete:o,type:r},children:s.jsx(Ve,{"aria-label":n??"Tabs",mods:{card:a},children:l})})}function Ge(e){const{title:n,id:i}=e,{activeKey:r,type:t,onChange:o,onDelete:l}=p.useContext(se)||{},a=i===r,g=p.useCallback(()=>{l?.(i)},[l,i]),u=p.useCallback(()=>{o?.(i)},[i]),v=t==="card",c=l&&v;return s.jsxs(We,{children:[s.jsx(Ne,{onPress:u,mods:{active:a,card:v,deletable:c},children:n}),l&&s.jsx(Xe,{onPress:g})]})}E.Tab=Ge;function Be(){const[e,n]=p.useState({width:void 0,height:void 0});return p.useEffect(()=>{function i(){n({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",i),i(),()=>window.removeEventListener("resize",i)},[]),e}function He(e){const n=p.useRef(e);return n.current=e,n}function Je(e){const n=He(e);return p.useCallback((...i)=>n.current(...i),[])}function Y(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}function q(){}var w=function(){return w=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},w.apply(this,arguments)},Ke=function(e,n){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,r=Object.getOwnPropertySymbols(e);t<r.length;t++)n.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(i[r[t]]=e[r[t]]);return i};function N(e){var n=e.width,i=e.height,r=e.value,t=e.defaultValue,o=e.language,l=e.theme,a=e.options,g=e.overrideServices,u=e.editorWillMount,v=e.editorDidMount,c=e.editorWillUnmount,m=e.onChange,d=e.className,A=e.uri,b=p.useRef(null),y=p.useRef(null),D=p.useRef(null),V=p.useRef(null),X=Y(n),G=Y(i),pe=p.useMemo(function(){return{width:X,height:G}},[X,G]),ge=function(){var f=u(U);return f||{}},ce=function(){v(y.current,U),D.current=y.current.onDidChangeModelContent(function(f){V.current||m(y.current.getValue(),f)})},de=function(){c(y.current,U)},he=function(){var f=r!==null?r:t;if(b.current){var ue=w(w({},a),ge()),W=A?.(U),S=W&&x.getModel(W);S?(S.setValue(f),x.setModelLanguage(S,o)):S=x.createModel(f,o,W),y.current=x.create(b.current,w(w(w({model:S},d?{extraEditorClassName:d}:{}),ue),l?{theme:l}:{}),g),ce()}};return p.useEffect(he,[]),p.useEffect(function(){if(y.current){if(r===y.current.getValue())return;var f=y.current.getModel();V.current=!0,y.current.pushUndoStop(),f.pushEditOperations([],[{range:f.getFullModelRange(),text:r}],void 0),y.current.pushUndoStop(),V.current=!1}},[r]),p.useEffect(function(){if(y.current){var f=y.current.getModel();x.setModelLanguage(f,o)}},[o]),p.useEffect(function(){if(y.current){a.model;var f=Ke(a,["model"]);y.current.updateOptions(w(w({},d?{extraEditorClassName:d}:{}),f))}},[d,a]),p.useEffect(function(){y.current&&y.current.layout()},[n,i]),p.useEffect(function(){x.setTheme(l)},[l]),p.useEffect(function(){return function(){y.current&&(de(),y.current.dispose()),D.current&&D.current.dispose()}},[]),p.createElement("div",{ref:b,style:pe,className:"react-monaco-editor-container"})}N.defaultProps={width:"100%",height:"100%",value:null,defaultValue:"",language:"javascript",theme:null,options:{},overrideServices:{},editorWillMount:q,editorDidMount:q,editorWillUnmount:q,onChange:q,className:null};N.displayName="MonacoEditor";const Ye='Menlo, Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace',j="#665DE8",Q="#D3005A",F="#30A666",R="#993388",Z="#141446",_="#828282",Ze="#986801";x.defineTheme("cube",{base:"vs",inherit:!0,colors:{},rules:[{token:"keyword.sql",foreground:j},{token:"number.sql",foreground:Ze},{token:"constant.other.table-name.sql",foreground:j},{token:"string.sql",foreground:F},{token:"comment.js",foreground:_},{token:"comment.yaml",foreground:_},{token:"identifier",foreground:Z},{token:"operators",foreground:F},{token:"number",foreground:F},{token:"number.yaml",foreground:Q},{token:"entity",foreground:F},{token:"keyword",foreground:j},{token:"keyword.json",foreground:j},{token:"string",foreground:Q},{token:"string.key.json",foreground:Q},{token:"string.yaml",foreground:j},{token:"string.value.json",foreground:j},{token:"regexp",foreground:Q},{token:"annotation",foreground:Q},{token:"type",foreground:Z},{token:"constant",foreground:j},{token:"variable",foreground:j},{token:"operator.sql",foreground:j},{token:"delimiter",foreground:R},{token:"operators.yaml",foreground:R},{token:"tag",foreground:R},{token:"key",foreground:R}]});function _e(e){return new Worker("/vizard/assets/editor.worker-DnhKYsI_.js",{name:e?.name})}function $e(e){return new Worker("/vizard/assets/css.worker-CJ81phlL.js",{name:e?.name})}function en(e){return new Worker("/vizard/assets/json.worker-DY5adJme.js",{name:e?.name})}function nn(e){return new Worker("/vizard/assets/ts.worker-VACfgpbU.js",{name:e?.name})}const rn={onmessage:()=>{},postMessage:()=>{},terminate:()=>{},addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1};function tn(){window.MonacoEnvironment||(window.MonacoEnvironment={getWorker(e,n){switch(n){case"editorWorkerService":return new _e;case"css":case"less":case"scss":return new $e;case"javascript":case"typescript":return new nn;case"yml":case"yaml":return rn;case"json":return new en;default:throw new Error(`Unknown Monaco worker label: ${n}`)}}})}function sn(){tn()}function on({content:e}){const n=p.useRef(),i=Be(),r=n.current,t={readOnly:!0,automaticLayout:!0,roundedSelection:!1,scrollBeyondLastLine:!0,fontSize:14,fontFamily:Ye,minimap:{enabled:!1},tabSize:2};p.useEffect(()=>{r&&r.setSelection({endColumn:0,endLineNumber:0,positionColumn:0,positionLineNumber:0,selectionStartColumn:0,selectionStartLineNumber:0,startColumn:0,startLineNumber:0})},[r]),p.useEffect(()=>{r?.layout()},[r,i]),p.useEffect(()=>{r&&n.current&&e!==r.getValue()&&r.setValue(e)},[r,e]);function o(){sn()}return s.jsx(s.Fragment,{children:s.jsx(N,{theme:"cube",options:t,editorWillMount:o,editorDidMount:l=>{n.current=l}})})}function an(e,n,i="text/plain"){const r=new Blob([n],{type:i}),t=window.URL.createObjectURL(r),o=document.createElement("a");o.download=e,o.href=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(t)}const $=k(I,{type:"neutral",size:"small",styles:{placeContent:"start"}});function ie(e){const{files:n,selectedFile:i,prefix:r="",onPress:t}=e,o=Object.keys(n).sort();return s.jsx(s.Fragment,{children:o.map(l=>{const a=r?`${r}/${l}`:l,g=n[l],u="file"in g?g.file.contents:"",v=`${(a.split("/").length-1)*24+11}px`;return"directory"in g?s.jsxs(p.Fragment,{children:[s.jsx($,{isDisabled:!0,fill:"#white",icon:s.jsx(Se,{}),styles:{paddingLeft:v},children:l}),s.jsx(ie,{selectedFile:i,files:g.directory,prefix:a,onPress:t})]},a):s.jsx($,{type:i===a?"secondary":"neutral",icon:s.jsx(te,{}),styles:{paddingLeft:v},onPress:()=>t(a,l,u),children:l},a)})})}function oe(e,n,i=""){const r=Object.keys(e);for(const t of r){const o=e[t];if("directory"in o){const l=oe(o.directory,n,i?`${i}/${t}`:t);if(l)return l}else if(n.includes(t))return{path:t,name:t,contents:o.file.contents}}}function ae(e,n=""){const i=Object.keys(e),r={};for(const t of i){const o=n?`${n}/${t}`:t,l=e[t];"directory"in l?Object.assign(r,ae(l.directory,o)):r[o]=l.file.contents}return r}const ln=["App.tsx"];function pn(e){const{files:n,appName:i}=e,[r,t]=p.useState([]),[o,l]=p.useState(void 0),a=p.useMemo(()=>ae(n),[n]),g=Je((c,m,d)=>{if(!r.find(b=>b.path===c)){const b=[...r];b.push({path:c,name:m,contents:d}),t(b)}l(c)}),u=r.find(c=>c.path===o)?.contents;p.useEffect(()=>{t(c=>{const m=c.filter(d=>d.path in a).map(d=>({...d,contents:a[d.path]}));if(!m.length){const d=oe(n,ln);d&&m.push(d)}return m})},[a]),p.useEffect(()=>{!o&&r.length&&l(r[0].path)},[r]);const v=p.useCallback(()=>{an(".env.local",a[".env.local"])},[n]);return s.jsxs(C,{columns:"300px minmax(1px, 1fr)",placeContent:"stretch",placeItems:"stretch",children:[s.jsxs(B,{border:"right",children:[s.jsx(B,{padding:"1x",styles:{overflow:"auto",styledScrollbar:!0,height:"calc(100vh - 65px - 44px)"},children:s.jsx(M,{flow:"column",gap:"1bw",children:p.useMemo(()=>s.jsx(ie,{selectedFile:o,files:n,onPress:g}),[n,o])})}),s.jsxs(C,{columns:"minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)",gap:"1x",padding:"1x",border:"top",children:[s.jsx(H,{title:"Download the source code as ZIP archive",children:s.jsx(I,{to:`./download/${i}.zip`,type:"primary",size:"small",icon:s.jsx(K,{}),children:"Source"})}),s.jsx(H,{title:"Download .env.local file with credentials",children:s.jsx(I,{onPress:v,type:"primary",size:"small",icon:s.jsx(K,{}),children:"Config"})}),s.jsx(I,{to:"!https://cube.dev/docs/product/workspace/vizard",size:"small",icon:s.jsx(te,{}),children:"Docs"})]})]}),s.jsxs(C,{rows:"min-content 1fr",children:[r.length?s.jsx(E,{type:"card",label:"Files",activeKey:o,onChange:c=>l(c),onDelete:c=>{const m=r.filter(d=>d.path!==c);t(m),o===c&&l(m.length?m[0].path:void 0)},children:r.map(c=>s.jsx(E.Tab,{title:c.name,id:c.path},c.path))}):s.jsx(we,{padding:"2x",preset:"t2m",children:"<- Select a file to see its content"}),o?s.jsx(on,{content:u||""}):null]})]})}const gn=k({as:"iframe",styles:{width:"100%",height:"100%",border:"none"}});function cn(e){const{appName:n,config:i}=e,r=p.useRef(null),t=encodeURIComponent(btoa(JSON.stringify(i))),o=`/vizard/preview/${n}/index.html#${t}`;return p.useEffect(()=>{r?.current&&(r.current.contentWindow?.location.reload(),r.current.src=o)},[o]),s.jsx(gn,{ref:r,src:o})}function le(e){const{visualization:n,framework:i,language:r,library:t}=e;let o,l,a,g;return!n||!h[n]?(o=Object.keys(h)[0],l=Object.keys(h[o]||{})[0],a=Object.keys(h[o]?.[l]||{})[0],g=Object.keys(h[o]?.[l]?.[a]||{})[0],{visualization:o,framework:l,language:a,library:g}):!i||!h[n]?.[i]?(l=Object.keys(h[n]||{})[0],a=Object.keys(h[n]?.[l]||{})[0],g=Object.keys(h[n]?.[l]?.[a]||{})[0],{visualization:n,framework:l,language:a,library:g}):!r||!h[n]?.[i]?.[r]?(a=Object.keys(h[n]?.[i]||{})[0],g=Object.keys(h[n]?.[i]?.[a]||{})[0],{visualization:n,framework:i,language:a,library:g}):!t||!h[n]?.[i]?.[r]?.[t]?(g=Object.keys(h[n]?.[i]?.[r]||{})[0],{visualization:n,framework:i,language:r,library:g}):e}function ee(e){const{visualization:n,framework:i,language:r}=e;return{visualization:P.visualization,framework:P.framework.filter(t=>h[n]?.[t]),language:P.language.filter(t=>h[n]?.[i]?.[t]),library:P.library.filter(t=>h[n]?.[i]?.[r]?.[t])}}function dn(e){const{onChange:n,data:i}=e,[r]=ze(),[t,o]=p.useState(ee(i)),l=p.useCallback(a=>{const{visualization:g,framework:u,language:v,library:c}=a,m={visualization:g,framework:u,language:v,library:c},d=le(m);JSON.stringify(d)!==JSON.stringify(m)&&r.setFieldsValue(d),o(ee(d)),n?.({...d,useWebSockets:a.useWebSockets,useSubscription:a.useSubscription})},[]);return s.jsx(C,{styles:{overflow:"auto",padding:"1x 2x",height:"max 100vh"},children:s.jsxs(xe,{form:r,defaultValues:i,onValuesChange:l,children:[s.jsx(z.Group,{name:"visualization",label:"Visualization",orientation:"horizontal",groupStyles:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",placeContent:"stretch",placeItems:"stretch"},children:P.visualization.map(a=>{const{icon:g,name:u}=O[a];return s.jsx(z.Button,{value:a,styles:{placeSelf:"stretch",placeItems:"stretch",width:"initial"},children:g?s.jsxs(M,{gap:"1x",children:[g,s.jsx("div",{children:u})]}):u},a)})}),s.jsx(z.Group,{name:"framework",label:"Framework",orientation:"horizontal",children:t?.framework.map(a=>{const{icon:g,name:u}=O[a];return s.jsx(z.Button,{value:a,children:g?s.jsxs(M,{gap:"1x",children:[g,s.jsx("div",{children:u})]}):u},a)})}),t?.language?.length&&t.language.length>1?s.jsx(z.ButtonGroup,{name:"language",label:"Language",orientation:"horizontal",children:t?.language.map(a=>{const{icon:g,name:u}=O[a];return s.jsx(z.Button,{value:a,children:g?s.jsxs(M,{gap:"1x",children:[g,s.jsx("div",{children:u})]}):u},a)})}):null,t?.library.length?s.jsx(z.Group,{name:"library",label:"Library",orientation:"horizontal",children:t?.library.map(a=>s.jsx(z.Button,{value:a,children:O[a].name},a))}):s.jsxs(ke,{children:["This combination of options supports no charting library ",s.jsx("u",{children:"yet"}),"."]}),s.jsx(Ae,{}),s.jsx(J,{name:"useWebSockets",children:"Use WebSockets"}),s.jsx(J,{name:"useSubscription",children:"Use Subscription"})]})})}var L={BASE_URL:"/vizard/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const ne={...le({visualization:"line"}),useWebSockets:!1,useSubscription:!1};location.hash||(location.hash=encodeURIComponent(btoa(JSON.stringify({apiUrl:L.VITE_CUBE_API_URL||"",apiToken:L.VITE_CUBE_API_TOKEN||"",query:JSON.parse(L.VITE_CUBE_QUERY||"{}"),pivotConfig:JSON.parse(L.VITE_CUBE_PIVOT_CONFIG||"{}")}))));function hn(){let e;try{e=JSON.parse(atob(decodeURIComponent(location.hash.slice(1))))}catch{throw new Error("Invalid params")}const{apiUrl:n,apiToken:i,query:r,pivotConfig:t}=e,[o,l]=p.useState("code"),[a,g]=p.useState(ne),[u,v]=p.useState(!0);p.useEffect(()=>{v(!1)},[]);const c=Me({visualization:a.visualization,library:a.library,language:a.language,framework:a.framework}),m={apiUrl:n,apiToken:i,query:r,pivotConfig:t,chartType:a.visualization,useWebSockets:a.useWebSockets,useSubscription:a.useSubscription},d=Qe({appName:c,apiUrl:n,apiToken:i,query:r,pivotConfig:t,chartType:a.visualization,useWebSockets:a.useWebSockets,useSubscription:a.useSubscription}),A=p.useCallback(b=>{g(b)},[]);return u?null:s.jsxs(Ce,{publicUrl:"/vizard",styles:{display:"grid",gridTemplateColumns:"1fr 300px",width:"100vw",height:"100vh"},children:[s.jsxs(C,{styles:{width:"100%",height:"max 100vh",gridAutoFlow:"column",gridColumns:"1fr",gridRows:"auto 1fr",border:"right"},children:[s.jsx(C,{children:s.jsxs(E,{activeKey:o,onChange:b=>l(b),children:[s.jsx(E.Tab,{id:"code",title:"Code"}),s.jsx(E.Tab,{id:"preview",title:"Preview"})]})}),o==="code"?s.jsx(pn,{appName:c,files:d}):null,o==="preview"?s.jsx(cn,{appName:c,config:m}):null]}),s.jsx(dn,{apiUrl:n,apiToken:i,query:r,data:ne,onChange:A})]})}Ee.createRoot(document.getElementById("root")).render(s.jsx(hn,{}));
4841
+ VITE_CUBE_API_USE_SUBSCRIPTION=${n?"true":"false"}`}},g},[e,r,o,t,n,i,JSON.stringify(l),JSON.stringify(a)])}const Oe={react:{typescript:{antd:"react-typescript-antd-table"}}},Pe={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Ue={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},qe={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Fe={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Re={react:{typescript:{chartjs:"react-typescript-chartjs-area+bar+doughnut+line+pie"}}},Le={table:Oe,area:Pe,bar:Ue,doughnut:qe,line:Fe,pie:Re},Me={visualization:["line","bar","area","pie","doughnut","table"],framework:["react","angular","vue"],language:["typescript","javascript"],library:["chartjs","antd"]},T=k({as:"img",styles:{display:"block",width:"16px",height:"16px"}}),O=Me,h=Le,U={line:{name:"Line",type:"visualization",icon:s.jsx(ye,{})},bar:{name:"Bar",type:"visualization",icon:s.jsx(me,{})},area:{name:"Area",type:"visualization",icon:s.jsx(ve,{})},pie:{name:"Pie",type:"visualization",icon:s.jsx(be,{})},doughnut:{name:"Donut",type:"visualization",icon:s.jsx(fe,{})},react:{name:"React",type:"framework",icon:s.jsx(T,{src:"./logos/react.svg"})},typescript:{name:"TypeScript",type:"language",icon:s.jsx(T,{src:"./logos/ts.svg"})},javascript:{name:"JavaScript",type:"language",icon:s.jsx(T,{src:"./logos/js.svg"})},chartjs:{name:"Chart.js",type:"library"},table:{name:"Table",type:"library",icon:s.jsx(je,{})},angular:{name:"Angular",type:"framework",icon:s.jsx(T,{src:"./logos/angular.svg"})},vue:{name:"Vue",type:"framework",icon:s.jsx(T,{src:"./logos/vue.svg"})},antd:{name:"Ant Design",type:"library"}};function Ie(e){const{visualization:n,library:i,language:r,framework:t}=e;if(!h[n])throw new Error("Invalid visualization");if(!h[n]?.[t])throw new Error("Invalid framework");if(!h[n]?.[t]?.[r])throw new Error("Invalid language");if(!h[n]?.[t]?.[r]?.[i])throw new Error("Invalid library");return h[n]?.[t]?.[r]?.[i]}const De=p.memo(({color:e})=>s.jsx("div",{style:{display:"grid",width:"16px",height:"16px",color:e?`var(--${e}-color)`:void 0},children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",children:s.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M2.626 2.732a.6.6 0 0 0 0 .849L7.046 8l-4.42 4.42a.6.6 0 0 0 0 .848l.141.141a.6.6 0 0 0 .849 0l4.42-4.42 4.348 4.35a.6.6 0 0 0 .849 0l.141-.142a.6.6 0 0 0 0-.848L9.025 8l4.349-4.349a.6.6 0 0 0 0-.848l-.141-.142a.6.6 0 0 0-.849 0L8.035 7.01 3.616 2.59a.6.6 0 0 0-.849 0l-.141.142Z"})})})),se=p.createContext(void 0),Ve=k({styles:{display:"grid",gridAutoFlow:"column",gap:"1x",placeContent:"start",overflow:"auto",padding:"1x 1x 0 1x",shadow:"inset 0 -1bw 0 #border","--border-color":"rgb(234,234,238)","--light-purple-color":"rgb(243,243,255)"}}),We=k({styles:{position:"relative",display:"grid"}}),Ne=k(re,{styles:{preset:"t3m",display:"grid",flow:"column",gap:"1x",placeContent:"space-between",placeItems:"center start",padding:{"":"1x 1.5x",deletable:"1x 4.5x 1x 1.5x"},cursor:"pointer",border:{"":"none",card:!0},fill:{"":"#white",card:"#light","hovered && card":"#light-purple",active:"#white"},color:{"":"#dark-02",active:"#purple-text","!card & hovered":"#purple"},borderBottom:{"":"none",card:"none"},shadow:{"":"inset 0 -1bw 0 #border",active:"inset 0 -1ow 0 #purple","card & active":"inset 0 -1bw 0 #white"},radius:"top",backgroundClip:"border-box",width:"max 100%",transition:"theme, borderBottom",whiteSpace:"nowrap"}}),Xe=k(re,{"aria-label":"Delete tab",styles:{position:"absolute",top:"1x",right:"1x",display:"grid",placeItems:"center",padding:".5x",cursor:"pointer",fontSize:"12px",fill:{"":"#clean",hovered:"#purple.04"},color:{"":"#dark-03","hovered | pressed":"#purple"},radius:!0,transition:"theme"},children:s.jsx(De,{})});function E(e){const{label:n,activeKey:i,type:r,onChange:t,onDelete:o,children:l}=e,a=r==="card";return s.jsx(se.Provider,{value:{activeKey:i,onChange:t,onDelete:o,type:r},children:s.jsx(Ve,{"aria-label":n??"Tabs",mods:{card:a},children:l})})}function Ge(e){const{title:n,id:i}=e,{activeKey:r,type:t,onChange:o,onDelete:l}=p.useContext(se)||{},a=i===r,g=p.useCallback(()=>{l?.(i)},[l,i]),u=p.useCallback(()=>{o?.(i)},[i]),v=t==="card",c=l&&v;return s.jsxs(We,{children:[s.jsx(Ne,{onPress:u,mods:{active:a,card:v,deletable:c},children:n}),l&&s.jsx(Xe,{onPress:g})]})}E.Tab=Ge;function Be(){const[e,n]=p.useState({width:void 0,height:void 0});return p.useEffect(()=>{function i(){n({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",i),i(),()=>window.removeEventListener("resize",i)},[]),e}function He(e){const n=p.useRef(e);return n.current=e,n}function Je(e){const n=He(e);return p.useCallback((...i)=>n.current(...i),[])}function Y(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}function q(){}var w=function(){return w=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},w.apply(this,arguments)},Ke=function(e,n){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,r=Object.getOwnPropertySymbols(e);t<r.length;t++)n.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(i[r[t]]=e[r[t]]);return i};function N(e){var n=e.width,i=e.height,r=e.value,t=e.defaultValue,o=e.language,l=e.theme,a=e.options,g=e.overrideServices,u=e.editorWillMount,v=e.editorDidMount,c=e.editorWillUnmount,m=e.onChange,d=e.className,A=e.uri,b=p.useRef(null),y=p.useRef(null),D=p.useRef(null),V=p.useRef(null),X=Y(n),G=Y(i),pe=p.useMemo(function(){return{width:X,height:G}},[X,G]),ge=function(){var f=u(P);return f||{}},ce=function(){v(y.current,P),D.current=y.current.onDidChangeModelContent(function(f){V.current||m(y.current.getValue(),f)})},de=function(){c(y.current,P)},he=function(){var f=r!==null?r:t;if(b.current){var ue=w(w({},a),ge()),W=A?.(P),S=W&&x.getModel(W);S?(S.setValue(f),x.setModelLanguage(S,o)):S=x.createModel(f,o,W),y.current=x.create(b.current,w(w(w({model:S},d?{extraEditorClassName:d}:{}),ue),l?{theme:l}:{}),g),ce()}};return p.useEffect(he,[]),p.useEffect(function(){if(y.current){if(r===y.current.getValue())return;var f=y.current.getModel();V.current=!0,y.current.pushUndoStop(),f.pushEditOperations([],[{range:f.getFullModelRange(),text:r}],void 0),y.current.pushUndoStop(),V.current=!1}},[r]),p.useEffect(function(){if(y.current){var f=y.current.getModel();x.setModelLanguage(f,o)}},[o]),p.useEffect(function(){if(y.current){a.model;var f=Ke(a,["model"]);y.current.updateOptions(w(w({},d?{extraEditorClassName:d}:{}),f))}},[d,a]),p.useEffect(function(){y.current&&y.current.layout()},[n,i]),p.useEffect(function(){x.setTheme(l)},[l]),p.useEffect(function(){return function(){y.current&&(de(),y.current.dispose()),D.current&&D.current.dispose()}},[]),p.createElement("div",{ref:b,style:pe,className:"react-monaco-editor-container"})}N.defaultProps={width:"100%",height:"100%",value:null,defaultValue:"",language:"javascript",theme:null,options:{},overrideServices:{},editorWillMount:q,editorDidMount:q,editorWillUnmount:q,onChange:q,className:null};N.displayName="MonacoEditor";const Ye='Menlo, Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace',j="#665DE8",Q="#D3005A",F="#30A666",R="#993388",Z="#141446",_="#828282",Ze="#986801";x.defineTheme("cube",{base:"vs",inherit:!0,colors:{},rules:[{token:"keyword.sql",foreground:j},{token:"number.sql",foreground:Ze},{token:"constant.other.table-name.sql",foreground:j},{token:"string.sql",foreground:F},{token:"comment.js",foreground:_},{token:"comment.yaml",foreground:_},{token:"identifier",foreground:Z},{token:"operators",foreground:F},{token:"number",foreground:F},{token:"number.yaml",foreground:Q},{token:"entity",foreground:F},{token:"keyword",foreground:j},{token:"keyword.json",foreground:j},{token:"string",foreground:Q},{token:"string.key.json",foreground:Q},{token:"string.yaml",foreground:j},{token:"string.value.json",foreground:j},{token:"regexp",foreground:Q},{token:"annotation",foreground:Q},{token:"type",foreground:Z},{token:"constant",foreground:j},{token:"variable",foreground:j},{token:"operator.sql",foreground:j},{token:"delimiter",foreground:R},{token:"operators.yaml",foreground:R},{token:"tag",foreground:R},{token:"key",foreground:R}]});function _e(e){return new Worker("/vizard/assets/editor.worker-DnhKYsI_.js",{name:e?.name})}function $e(e){return new Worker("/vizard/assets/css.worker-CJ81phlL.js",{name:e?.name})}function en(e){return new Worker("/vizard/assets/json.worker-DY5adJme.js",{name:e?.name})}function nn(e){return new Worker("/vizard/assets/ts.worker-VACfgpbU.js",{name:e?.name})}const rn={onmessage:()=>{},postMessage:()=>{},terminate:()=>{},addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1};function tn(){window.MonacoEnvironment||(window.MonacoEnvironment={getWorker(e,n){switch(n){case"editorWorkerService":return new _e;case"css":case"less":case"scss":return new $e;case"javascript":case"typescript":return new nn;case"yml":case"yaml":return rn;case"json":return new en;default:throw new Error(`Unknown Monaco worker label: ${n}`)}}})}function sn(){tn()}function on({content:e}){const n=p.useRef(),i=Be(),r=n.current,t={readOnly:!0,automaticLayout:!0,roundedSelection:!1,scrollBeyondLastLine:!0,fontSize:14,fontFamily:Ye,minimap:{enabled:!1},tabSize:2};p.useEffect(()=>{r&&r.setSelection({endColumn:0,endLineNumber:0,positionColumn:0,positionLineNumber:0,selectionStartColumn:0,selectionStartLineNumber:0,startColumn:0,startLineNumber:0})},[r]),p.useEffect(()=>{r?.layout()},[r,i]),p.useEffect(()=>{r&&n.current&&e!==r.getValue()&&r.setValue(e)},[r,e]);function o(){sn()}return s.jsx(s.Fragment,{children:s.jsx(N,{theme:"cube",options:t,editorWillMount:o,editorDidMount:l=>{n.current=l}})})}function an(e,n,i="text/plain"){const r=new Blob([n],{type:i}),t=window.URL.createObjectURL(r),o=document.createElement("a");o.download=e,o.href=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(t)}const $=k(M,{type:"neutral",size:"small",styles:{placeContent:"start"}});function ie(e){const{files:n,selectedFile:i,prefix:r="",onPress:t}=e,o=Object.keys(n).sort();return s.jsx(s.Fragment,{children:o.map(l=>{const a=r?`${r}/${l}`:l,g=n[l],u="file"in g?g.file.contents:"",v=`${(a.split("/").length-1)*24+11}px`;return"directory"in g?s.jsxs(p.Fragment,{children:[s.jsx($,{isDisabled:!0,fill:"#white",icon:s.jsx(Se,{}),styles:{paddingLeft:v},children:l}),s.jsx(ie,{selectedFile:i,files:g.directory,prefix:a,onPress:t})]},a):s.jsx($,{type:i===a?"secondary":"neutral",icon:s.jsx(te,{}),styles:{paddingLeft:v},onPress:()=>t(a,l,u),children:l},a)})})}function oe(e,n,i=""){const r=Object.keys(e);for(const t of r){const o=e[t];if("directory"in o){const l=oe(o.directory,n,i?`${i}/${t}`:t);if(l)return l}else if(n.includes(t))return{path:t,name:t,contents:o.file.contents}}}function ae(e,n=""){const i=Object.keys(e),r={};for(const t of i){const o=n?`${n}/${t}`:t,l=e[t];"directory"in l?Object.assign(r,ae(l.directory,o)):r[o]=l.file.contents}return r}const ln=["App.tsx"];function pn(e){const{files:n,appName:i}=e,[r,t]=p.useState([]),[o,l]=p.useState(void 0),a=p.useMemo(()=>ae(n),[n]),g=Je((c,m,d)=>{if(!r.find(b=>b.path===c)){const b=[...r];b.push({path:c,name:m,contents:d}),t(b)}l(c)}),u=r.find(c=>c.path===o)?.contents;p.useEffect(()=>{t(c=>{const m=c.filter(d=>d.path in a).map(d=>({...d,contents:a[d.path]}));if(!m.length){const d=oe(n,ln);d&&m.push(d)}return m})},[a]),p.useEffect(()=>{!o&&r.length&&l(r[0].path)},[r]);const v=p.useCallback(()=>{an(".env.local",a[".env.local"])},[n]);return s.jsxs(C,{columns:"300px minmax(1px, 1fr)",placeContent:"stretch",placeItems:"stretch",children:[s.jsxs(B,{border:"right",children:[s.jsx(B,{padding:"1x",styles:{overflow:"auto",styledScrollbar:!0,height:"calc(100vh - 65px - 44px)"},children:s.jsx(I,{flow:"column",gap:"1bw",children:p.useMemo(()=>s.jsx(ie,{selectedFile:o,files:n,onPress:g}),[n,o])})}),s.jsxs(C,{columns:"minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)",gap:"1x",padding:"1x",border:"top",children:[s.jsx(H,{title:"Download the source code as ZIP archive",children:s.jsx(M,{to:`./download/${i}.zip`,type:"primary",size:"small",icon:s.jsx(K,{}),children:"Source"})}),s.jsx(H,{title:"Download .env.local file with credentials",children:s.jsx(M,{onPress:v,type:"primary",size:"small",icon:s.jsx(K,{}),children:"Config"})}),s.jsx(M,{to:"!https://cube.dev/docs/product/workspace/vizard",size:"small",icon:s.jsx(te,{}),children:"Docs"})]})]}),s.jsxs(C,{rows:"min-content 1fr",children:[r.length?s.jsx(E,{type:"card",label:"Files",activeKey:o,onChange:c=>l(c),onDelete:c=>{const m=r.filter(d=>d.path!==c);t(m),o===c&&l(m.length?m[0].path:void 0)},children:r.map(c=>s.jsx(E.Tab,{title:c.name,id:c.path},c.path))}):s.jsx(we,{padding:"2x",preset:"t2m",children:"<- Select a file to see its content"}),o?s.jsx(on,{content:u||""}):null]})]})}const gn=k({as:"iframe",styles:{width:"100%",height:"100%",border:"none"}});function cn(e){const{appName:n,config:i}=e,r=p.useRef(null),t=encodeURIComponent(btoa(JSON.stringify(i))),o=`/vizard/preview/${n}/index.html#${t}`;return p.useEffect(()=>{r?.current&&(r.current.contentWindow?.location.reload(),r.current.src=o)},[o]),s.jsx(gn,{ref:r,src:o})}function le(e){const{visualization:n,framework:i,language:r,library:t}=e;let o,l,a,g;return!n||!h[n]?(o=Object.keys(h)[0],l=Object.keys(h[o]||{})[0],a=Object.keys(h[o]?.[l]||{})[0],g=Object.keys(h[o]?.[l]?.[a]||{})[0],{visualization:o,framework:l,language:a,library:g}):!i||!h[n]?.[i]?(l=Object.keys(h[n]||{})[0],a=Object.keys(h[n]?.[l]||{})[0],g=Object.keys(h[n]?.[l]?.[a]||{})[0],{visualization:n,framework:l,language:a,library:g}):!r||!h[n]?.[i]?.[r]?(a=Object.keys(h[n]?.[i]||{})[0],g=Object.keys(h[n]?.[i]?.[a]||{})[0],{visualization:n,framework:i,language:a,library:g}):!t||!h[n]?.[i]?.[r]?.[t]?(g=Object.keys(h[n]?.[i]?.[r]||{})[0],{visualization:n,framework:i,language:r,library:g}):e}function ee(e){const{visualization:n,framework:i,language:r}=e;return{visualization:O.visualization,framework:O.framework.filter(t=>h[n]?.[t]),language:O.language.filter(t=>h[n]?.[i]?.[t]),library:O.library.filter(t=>h[n]?.[i]?.[r]?.[t])}}function dn(e){const{onChange:n,data:i}=e,[r]=ze(),[t,o]=p.useState(ee(i)),l=p.useCallback(a=>{const{visualization:g,framework:u,language:v,library:c}=a,m={visualization:g,framework:u,language:v,library:c},d=le(m);JSON.stringify(d)!==JSON.stringify(m)&&r.setFieldsValue(d),o(ee(d)),n?.({...d,useWebSockets:a.useWebSockets,useSubscription:a.useSubscription})},[]);return s.jsx(C,{styles:{overflow:"auto",padding:"1x 2x",height:"max 100vh"},children:s.jsxs(xe,{form:r,defaultValues:i,onValuesChange:l,children:[s.jsx(z.Group,{name:"visualization",label:"Visualization",orientation:"horizontal",groupStyles:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",placeContent:"stretch",placeItems:"stretch"},children:O.visualization.map(a=>{const{icon:g,name:u}=U[a];return s.jsx(z.Button,{value:a,styles:{placeSelf:"stretch",placeItems:"stretch",width:"initial"},children:g?s.jsxs(I,{gap:"1x",children:[g,s.jsx("div",{children:u})]}):u},a)})}),s.jsx(z.Group,{name:"framework",label:"Framework",orientation:"horizontal",children:t?.framework.map(a=>{const{icon:g,name:u}=U[a];return s.jsx(z.Button,{value:a,children:g?s.jsxs(I,{gap:"1x",children:[g,s.jsx("div",{children:u})]}):u},a)})}),t?.language?.length&&t.language.length>1?s.jsx(z.ButtonGroup,{name:"language",label:"Language",orientation:"horizontal",children:t?.language.map(a=>{const{icon:g,name:u}=U[a];return s.jsx(z.Button,{value:a,children:g?s.jsxs(I,{gap:"1x",children:[g,s.jsx("div",{children:u})]}):u},a)})}):null,t?.library.length?s.jsx(z.Group,{name:"library",label:"Library",orientation:"horizontal",children:t?.library.map(a=>s.jsx(z.Button,{value:a,children:U[a].name},a))}):s.jsxs(ke,{children:["This combination of options supports no charting library ",s.jsx("u",{children:"yet"}),"."]}),s.jsx(Ae,{}),s.jsx(J,{name:"useWebSockets",children:"Use WebSockets"}),s.jsx(J,{name:"useSubscription",children:"Use Subscription"})]})})}var L={BASE_URL:"/vizard/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const ne={...le({visualization:"line"}),useWebSockets:!1,useSubscription:!1};location.hash||(location.hash=encodeURIComponent(btoa(JSON.stringify({apiUrl:L.VITE_CUBE_API_URL||"",apiToken:L.VITE_CUBE_API_TOKEN||"",query:JSON.parse(L.VITE_CUBE_QUERY||"{}"),pivotConfig:JSON.parse(L.VITE_CUBE_PIVOT_CONFIG||"{}")}))));function hn(){let e;try{e=JSON.parse(atob(decodeURIComponent(location.hash.slice(1))))}catch{throw new Error("Invalid params")}const{apiUrl:n,apiToken:i,query:r,pivotConfig:t}=e,[o,l]=p.useState("code"),[a,g]=p.useState(ne),[u,v]=p.useState(!0);p.useEffect(()=>{v(!1)},[]);const c=Ie({visualization:a.visualization,library:a.library,language:a.language,framework:a.framework}),m={apiUrl:n,apiToken:i,query:r,pivotConfig:t,chartType:a.visualization,useWebSockets:a.useWebSockets,useSubscription:a.useSubscription},d=Qe({appName:c,apiUrl:n,apiToken:i,query:r,pivotConfig:t,chartType:a.visualization,useWebSockets:a.useWebSockets,useSubscription:a.useSubscription}),A=p.useCallback(b=>{g(b)},[]);return u?null:s.jsxs(Ce,{publicUrl:"/vizard",styles:{display:"grid",gridTemplateColumns:"1fr 300px",width:"100vw",height:"100vh"},children:[s.jsxs(C,{styles:{width:"100%",height:"max 100vh",gridAutoFlow:"column",gridColumns:"1fr",gridRows:"auto 1fr",border:"right"},children:[s.jsx(C,{children:s.jsxs(E,{activeKey:o,onChange:b=>l(b),children:[s.jsx(E.Tab,{id:"code",title:"Code"}),s.jsx(E.Tab,{id:"preview",title:"Preview"})]})}),o==="code"?s.jsx(pn,{appName:c,files:d}):null,o==="preview"?s.jsx(cn,{appName:c,config:m}):null]}),s.jsx(dn,{apiUrl:n,apiToken:i,query:r,data:ne,onChange:A})]})}Ee.createRoot(document.getElementById("root")).render(s.jsx(hn,{}));
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" href="/vizard/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Vizard</title>
8
- <script type="module" crossorigin src="/vizard/assets/index-C388WnHl.js"></script>
8
+ <script type="module" crossorigin src="/vizard/assets/index-DIson5q4.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/vizard/assets/react-CJahmRYQ.js">
10
10
  <link rel="modulepreload" crossorigin href="/vizard/assets/other-HgnFgCOO.js">
11
11
  <link rel="modulepreload" crossorigin href="/vizard/assets/icons-DuVB-IiR.js">