yamchart 0.8.8 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{advisor-IJBW56F5.js → advisor-Z7TKPPBR.js} +10 -10
  2. package/dist/{agent-2DFNL2UB.js → agent-KWKPAYT2.js} +2 -2
  3. package/dist/{chunk-34ZVFILD.js → chunk-AMHCOB4D.js} +4 -4
  4. package/dist/{chunk-5N3FYFBV.js → chunk-CWAWATL4.js} +34 -7
  5. package/dist/chunk-CWAWATL4.js.map +1 -0
  6. package/dist/{chunk-D3ELUYYE.js → chunk-E2QN2M7S.js} +52 -5
  7. package/dist/chunk-E2QN2M7S.js.map +1 -0
  8. package/dist/{chunk-B5ZLCKNF.js → chunk-FZFBBB7K.js} +2 -2
  9. package/dist/{chunk-232AMQ5T.js → chunk-G57J2WQM.js} +4 -4
  10. package/dist/{chunk-77U26A7F.js → chunk-ZA6AOQVZ.js} +4 -4
  11. package/dist/chunk-ZA6AOQVZ.js.map +1 -0
  12. package/dist/{connection-utils-ZLSV5OLQ.js → connection-utils-CTPN7PV3.js} +4 -4
  13. package/dist/{describe-VO4CEYL2.js → describe-4NME6RCB.js} +5 -5
  14. package/dist/{dev-JUA73B6D.js → dev-6QGAB4ZH.js} +316 -29
  15. package/dist/dev-6QGAB4ZH.js.map +1 -0
  16. package/dist/{dist-PINRLZVT.js → dist-4GUE24QV.js} +2 -2
  17. package/dist/{dist-GVNWQXFR.js → dist-7CRX2GIR.js} +2 -2
  18. package/dist/{dist-E2PVGIPT.js → dist-VNX77VV5.js} +4 -2
  19. package/dist/index.js +21 -21
  20. package/dist/public/assets/{EventManagement-DQY1Sic0.js → EventManagement-MMsAkJKj.js} +2 -2
  21. package/dist/public/assets/{ExplorePage-C9M-fQ3Y.js → ExplorePage-BSkSNgLT.js} +1 -1
  22. package/dist/public/assets/{LoginPage-XYLwfbfw.js → LoginPage-vaI1dnyL.js} +1 -1
  23. package/dist/public/assets/PublicViewer-B-OKj2cg.js +1 -0
  24. package/dist/public/assets/{SetupWizard-fle7FC4b.js → SetupWizard-DvlVX2O6.js} +1 -1
  25. package/dist/public/assets/{ShareManagement-b3j4jzn3.js → ShareManagement-ulvPrOAQ.js} +1 -1
  26. package/dist/public/assets/{UserManagement-DwZ-AaqI.js → UserManagement-CvmpNy3o.js} +1 -1
  27. package/dist/public/assets/{index-CRcgti3B.css → index-CfyF2Wf-.css} +1 -1
  28. package/dist/public/assets/index-DD59fsOk.js +195 -0
  29. package/dist/public/assets/{index.es-Bd2YVqtj.js → index.es-BeTaRWIv.js} +1 -1
  30. package/dist/public/assets/{jspdf.es.min-CpRfbJ_H.js → jspdf.es.min-9haD1GSE.js} +3 -3
  31. package/dist/public/index.html +2 -2
  32. package/dist/{query-PXJMSDKR.js → query-Z75RKTHV.js} +4 -4
  33. package/dist/{sample-M24H3M73.js → sample-OIJNXQNC.js} +4 -4
  34. package/dist/{search-UCJS7X5D.js → search-YDCPIDZX.js} +5 -5
  35. package/dist/{source-resolver-RXNB7A64.js → source-resolver-4SUWXUGW.js} +5 -5
  36. package/dist/{sync-warehouse-S75DWVTG.js → sync-warehouse-NZFDS6WK.js} +4 -4
  37. package/dist/{tables-W3M3JDJO.js → tables-WJS2VI4L.js} +5 -5
  38. package/dist/templates/default/CLAUDE.md +1 -1
  39. package/dist/templates/default/docs/yamchart-reference.md +108 -2
  40. package/dist/{test-67AXD5PI.js → test-I4XOF7TZ.js} +5 -17
  41. package/dist/test-I4XOF7TZ.js.map +1 -0
  42. package/package.json +3 -3
  43. package/dist/chunk-5N3FYFBV.js.map +0 -1
  44. package/dist/chunk-77U26A7F.js.map +0 -1
  45. package/dist/chunk-D3ELUYYE.js.map +0 -1
  46. package/dist/dev-JUA73B6D.js.map +0 -1
  47. package/dist/public/assets/PublicViewer-CZJYS0wF.js +0 -1
  48. package/dist/public/assets/index-m_Jm3sB1.js +0 -188
  49. package/dist/test-67AXD5PI.js.map +0 -1
  50. /package/dist/{advisor-IJBW56F5.js.map → advisor-Z7TKPPBR.js.map} +0 -0
  51. /package/dist/{agent-2DFNL2UB.js.map → agent-KWKPAYT2.js.map} +0 -0
  52. /package/dist/{chunk-34ZVFILD.js.map → chunk-AMHCOB4D.js.map} +0 -0
  53. /package/dist/{chunk-B5ZLCKNF.js.map → chunk-FZFBBB7K.js.map} +0 -0
  54. /package/dist/{chunk-232AMQ5T.js.map → chunk-G57J2WQM.js.map} +0 -0
  55. /package/dist/{connection-utils-ZLSV5OLQ.js.map → connection-utils-CTPN7PV3.js.map} +0 -0
  56. /package/dist/{describe-VO4CEYL2.js.map → describe-4NME6RCB.js.map} +0 -0
  57. /package/dist/{dist-E2PVGIPT.js.map → dist-4GUE24QV.js.map} +0 -0
  58. /package/dist/{dist-GVNWQXFR.js.map → dist-7CRX2GIR.js.map} +0 -0
  59. /package/dist/{dist-PINRLZVT.js.map → dist-VNX77VV5.js.map} +0 -0
  60. /package/dist/{query-PXJMSDKR.js.map → query-Z75RKTHV.js.map} +0 -0
  61. /package/dist/{sample-M24H3M73.js.map → sample-OIJNXQNC.js.map} +0 -0
  62. /package/dist/{search-UCJS7X5D.js.map → search-YDCPIDZX.js.map} +0 -0
  63. /package/dist/{source-resolver-RXNB7A64.js.map → source-resolver-4SUWXUGW.js.map} +0 -0
  64. /package/dist/{sync-warehouse-S75DWVTG.js.map → sync-warehouse-NZFDS6WK.js.map} +0 -0
  65. /package/dist/{tables-W3M3JDJO.js.map → tables-WJS2VI4L.js.map} +0 -0
@@ -1 +0,0 @@
1
- import{j as e,c as U,b as G,d as q,e as z,f as Y,g as W,h as K,F as X,S as Q,i as J,C as Z,D as ee,k as re,T as te,G as se,W as ae,l as le,H as oe,m as ce,n as ne,o as ie,P as de,p as he,B as xe,L as me,a as ue,q as ye,r as fe}from"./index-m_Jm3sB1.js";import{a as f}from"./echarts-DtOYsfLX.js";function ve({title:s,description:l,loading:r=!1,error:i=null,cached:t,durationMs:o,hasDrillDown:C,onRefresh:a,children:u}){return e.jsxs("div",{className:"chart-container",children:[e.jsxs("div",{className:"flex items-start justify-between p-4 border-b",style:{borderColor:"var(--yc-color-border)"},children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",style:{color:"var(--yc-color-text)"},children:s}),C&&e.jsxs("svg",{className:"w-4 h-4 flex-shrink-0",style:{color:"var(--yc-color-text-muted)"},viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[e.jsx("title",{children:"Right-click to drill down"}),e.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 001.06 0l7.22-7.22v5.69a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75h-7.5a.75.75 0 000 1.5h5.69l-7.22 7.22a.75.75 0 000 1.06z",clipRule:"evenodd"})]})]}),l&&e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:l})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t!==void 0&&e.jsx("span",{className:"text-xs px-2 py-1 rounded",style:t?{backgroundColor:"color-mix(in srgb, var(--yc-color-success) 15%, transparent)",color:"var(--yc-color-success)"}:{backgroundColor:"color-mix(in srgb, var(--yc-color-primary) 15%, transparent)",color:"var(--yc-color-primary)"},children:t?"Cached":"Fresh"}),o!==void 0&&e.jsxs("span",{className:"text-xs",style:{color:"var(--yc-color-text-muted)"},children:[o,"ms"]}),a&&e.jsx("button",{onClick:a,disabled:r,className:"p-1.5 hover:bg-black/5 rounded transition-colors disabled:opacity-50",style:{color:"var(--yc-color-text-muted)"},title:"Refresh",children:e.jsx("svg",{className:U("w-4 h-4",r&&"animate-spin"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),e.jsx("div",{className:"p-4",children:i?e.jsx("div",{className:"flex items-center justify-center h-64",style:{color:"var(--yc-color-danger)"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium",children:"Failed to load chart"}),e.jsx("p",{className:"text-sm mt-1",children:i.message})]})}):u})]})}const ge={day:{label:"Date",format:"%b %d, %Y"},week:{label:"Week Starting",format:"%b %d"},month:{label:"Month",format:"%b '%y"},quarter:{label:"Quarter",format:"quarter"},year:{label:"Year",format:"%Y"}};function je({chartName:s}){const[l,r]=f.useState(!1),i=async()=>{const t=`{{${s}}}`;try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch(o){console.error("Failed to copy:",o)}};return e.jsx("button",{onClick:i,className:"text-sm flex items-center gap-1.5 px-2 py-1 rounded hover:bg-black/5 transition-colors",style:{color:"var(--yc-color-text-secondary)"},title:`Copy {{${s}}} for use in markdown widgets`,children:l?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",style:{color:"var(--yc-color-success)"},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{style:{color:"var(--yc-color-success)"},children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),e.jsx("span",{children:"Copy Reference"})]})})}function L(s,l){if(!l)return s.toLocaleString();const r=l.decimals??0;switch(l.type){case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:l.currency||"USD",minimumFractionDigits:r,maximumFractionDigits:r}).format(s);case"percent":return new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:r,maximumFractionDigits:r}).format(s/100);default:return s.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}}function pe(s,l){const r=s>=0?"+":"";return l==="percent_change"?`${r}${s.toFixed(1)}%`:`${r}${s.toLocaleString()}`}function be({data:s,config:l,title:r,comparison:i}){var j,p,n;if(!(s!=null&&s[0])||!((j=l.value)!=null&&j.field))return e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-muted)"},children:"No data available"});const t=s[0],o=t[l.value.field],C=L(o,l.format);let a=null,u="percent_change",w,k,v;if(i)a=i.change,u=i.changeType,w=i.currentPeriodLabel,k=i.previousPeriodLabel,v=L(i.previousValue,l.format);else if((p=l.comparison)!=null&&p.enabled&&l.comparison.field){const x=t[l.comparison.field];u=l.comparison.type,x&&x!==0&&(u==="percent_change"?a=(o-x)/x*100:a=o-x,v=L(x,l.format))}const h=l.goal,g=h&&h.value!==0?Math.max(0,Math.min(o/h.value*100,100)):null,N=h?o>=h.value?"var(--yc-color-success)":"var(--yc-color-danger)":void 0;return e.jsxs("div",{className:"h-80 flex flex-col items-center justify-center p-8",children:[e.jsxs("div",{className:"text-6xl font-bold tabular-nums",style:{color:"var(--yc-color-text)"},children:[C,l.unit&&e.jsx("span",{className:"text-3xl font-normal ml-2",style:{color:"var(--yc-color-text-muted)"},children:l.unit})]}),w&&e.jsx("div",{className:"text-sm mt-2",style:{color:"var(--yc-color-text-muted)"},children:w}),r&&e.jsx("div",{className:"text-lg mt-3",style:{color:"var(--yc-color-text-secondary)"},children:r}),a!==null&&e.jsxs("div",{className:"mt-4 flex flex-col items-center gap-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-lg font-medium px-3 py-1 rounded",style:a>=0?{backgroundColor:"color-mix(in srgb, var(--yc-color-success) 15%, transparent)",color:"var(--yc-color-success)"}:{backgroundColor:"color-mix(in srgb, var(--yc-color-danger) 15%, transparent)",color:"var(--yc-color-danger)"},children:pe(a,u)}),v&&e.jsxs("span",{className:"text-sm",style:{color:"var(--yc-color-text-muted)"},children:["vs ",v]}),!v&&((n=l.comparison)==null?void 0:n.label)&&e.jsx("span",{className:"text-sm",style:{color:"var(--yc-color-text-muted)"},children:l.comparison.label})]}),k&&e.jsx("div",{className:"text-xs",style:{color:"var(--yc-color-text-muted)"},children:k})]}),h&&g!==null&&e.jsxs("div",{className:"mt-4 w-full max-w-[280px]",children:[h.show_progress&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",style:{color:"var(--yc-color-text-muted)"},children:[e.jsxs("span",{children:[L(o,l.format)," / ",L(h.value,l.format)]}),e.jsxs("span",{children:[g.toFixed(0),"%"]})]}),e.jsx("div",{className:"w-full h-2 rounded-full",style:{backgroundColor:"var(--yc-color-surface-hover)"},children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${g}%`,backgroundColor:N}})})]}),h.label&&e.jsx("div",{className:"text-sm mt-1 text-center",style:{color:"var(--yc-color-text-muted)"},children:h.label})]})]})}function Ce({chartName:s,drillParams:l}){var T,$,V,R,B,E;const{data:r,isLoading:i}=G(s),{data:t,isLoading:o,error:C}=q(s),{data:a}=z(),u=Y(),w=W(c=>c.getEffectiveFilters),k=W(c=>c.setChartFilter),v=K(),h=i||o,g=l==null?void 0:l._from,N=l?Object.fromEntries(Object.entries(l).filter(([c])=>!c.startsWith("_"))):{},j=Object.keys(N).length>0,p=Object.entries(N).map(([c,d])=>`${c}: ${d}`).join(", ");f.useEffect(()=>{if(j)for(const[c,d]of Object.entries(N))k(s,c,d)},[s,j]);const[n,x]=f.useState(null),b=f.useCallback((c,d,y)=>{x({x:y.x,y:y.y,field:c,value:d})},[]),_=f.useCallback(()=>{var D,F;if(!n||!((D=r==null?void 0:r.drillDown)!=null&&D.model))return;const c=r.drillDown,d=c.fields?typeof c.fields=="string"?c.fields:c.fields[0]:c.field??((F=r.chart.x)==null?void 0:F.field)??n.field,y=new URLSearchParams;if(n.allFields)for(const[H,I]of Object.entries(n.allFields))y.set(H,I);else y.set(d,n.value);y.set("_from",s),window.location.hash=`/charts/${s}/detail?${y.toString()}`,x(null)},[n,r,s]),P=f.useCallback(()=>{var D,F;if(!n||!((D=r==null?void 0:r.drillDown)!=null&&D.chart))return;const c=r.drillDown,d=c.fields?typeof c.fields=="string"?c.fields:c.fields[0]:c.field??((F=r.chart.x)==null?void 0:F.field)??n.field,y=new URLSearchParams({[d]:n.value,_from:s});window.location.hash=`/charts/${r.drillDown.chart}?${y.toString()}`,x(null)},[n,r,s]),S=w(s).granularity,m=S?ge[S]:void 0,A=m==null?void 0:m.label,M=m==null?void 0:m.format;if(i)return e.jsxs("div",{className:"chart-container animate-pulse",children:[e.jsx("div",{className:"p-4 border-b",style:{borderColor:"var(--yc-color-border)"},children:e.jsx("div",{className:"h-6 rounded w-48",style:{backgroundColor:"var(--yc-color-surface-hover)"}})}),e.jsx("div",{className:"p-4",children:e.jsx("div",{className:"h-80 rounded",style:{backgroundColor:"var(--yc-color-surface-hover)"}})})]});if(!r)return e.jsxs("div",{className:"chart-container p-8 text-center",style:{color:"var(--yc-color-text-secondary)"},children:["Chart not found: ",s]});const O=()=>{if(!t)return e.jsx("div",{className:"h-80 rounded animate-pulse",style:{backgroundColor:"var(--yc-color-surface-hover)"}});const c=r.chart.type;switch(c){case"line":if(!r.chart.x||!r.chart.y&&!r.chart.series)return e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing axis configuration"});{const d=m?{...r.chart.x,label:A,format:M}:r.chart.x;return e.jsx(me,{data:t.rows,columns:t.columns,xAxis:d,yAxis:r.chart.y,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o,onChartClick:b,goalData:t.goalData})}case"bar":if(!r.chart.x||!r.chart.y&&!r.chart.series)return e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing axis configuration"});{const d=m?{...r.chart.x,label:A,format:M}:r.chart.x;return e.jsx(xe,{data:t.rows,xAxis:d,yAxis:r.chart.y,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o,onChartClick:b,goalData:t.goalData})}case"area":if(!r.chart.x||!r.chart.y&&!r.chart.series)return e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing axis configuration"});{const d=m?{...r.chart.x,label:A,format:M}:r.chart.x;return e.jsx(he,{data:t.rows,xAxis:d,yAxis:r.chart.y,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o,onChartClick:b,goalData:t.goalData})}case"pie":return!r.chart.x||!r.chart.y?e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing pie chart configuration"}):e.jsx(de,{data:t.rows,xAxis:r.chart.x,yAxis:r.chart.y,theme:a==null?void 0:a.theme,loading:o,onChartClick:b});case"donut":return!r.chart.x||!r.chart.y?e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing donut chart configuration"}):e.jsx(ie,{data:t.rows,xAxis:r.chart.x,yAxis:r.chart.y,centerValue:r.chart.centerValue,theme:a==null?void 0:a.theme,loading:o,onChartClick:b});case"scatter":return!r.chart.x||!r.chart.y?e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing axis configuration"}):e.jsx(ne,{data:t.rows,xAxis:r.chart.x,yAxis:r.chart.y,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o});case"combo":if(!r.chart.x)return e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing axis configuration"});{const d=m?{...r.chart.x,label:A,format:M}:r.chart.x;return e.jsx(ce,{data:t.rows,xAxis:d,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o,onChartClick:b,goalData:t.goalData})}case"kpi":return e.jsx(be,{data:t.rows,config:r.chart,title:r.title,comparison:t.comparison});case"heatmap":return!r.chart.x||!r.chart.y?e.jsx("div",{className:"h-80 flex items-center justify-center",style:{color:"var(--yc-color-text-secondary)"},children:"Missing axis configuration"}):e.jsx(oe,{data:t.rows,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o});case"funnel":return e.jsx(le,{data:t.rows,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o});case"waterfall":return e.jsx(ae,{data:t.rows,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o});case"gauge":return e.jsx(se,{data:t.rows,chartConfig:r.chart,theme:a==null?void 0:a.theme,loading:o});case"table":return e.jsx(te,{data:t.rows,columns:t.columns,chartConfig:r.chart,height:"100%",loading:o});default:return e.jsxs("div",{className:"h-80 flex items-center justify-center text-gray-500",children:['Chart type "',c,'" not yet implemented']})}};return e.jsxs("div",{className:"space-y-4",children:[g&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:"var(--yc-color-text-secondary)"},children:[e.jsx("button",{onClick:()=>{window.location.hash=`/charts/${g}`},className:"transition-colors hover:opacity-80",style:{color:"var(--yc-color-primary)"},children:g}),e.jsx("span",{children:"/"}),e.jsx("span",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:r.title}),p&&e.jsxs("span",{style:{color:"var(--yc-color-text-muted)"},children:["(",p,")"]})]}),e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[r.parameters.length>0?e.jsx(X,{parameters:r.parameters,chartName:s}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{chartName:s}),e.jsx(Q,{resourceType:"chart",resourceName:s}),v&&e.jsxs("button",{onClick:()=>J.getState().openPanel({type:"chart",name:s}),className:"text-sm flex items-center gap-1 px-2 py-1 rounded hover:bg-black/5 transition-colors",style:{color:"var(--yc-color-text-secondary)"},title:"Ask AI about this chart",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),"Ask AI"]})]})]}),e.jsx(ve,{title:r.title,description:r.description,loading:h,cached:t==null?void 0:t.meta.cached,durationMs:t==null?void 0:t.meta.durationMs,hasDrillDown:!!((T=r.drillDown)!=null&&T.chart),onRefresh:()=>u(s),children:e.jsx(Z,{isLoading:o,error:C,data:t==null?void 0:t.rows,onRetry:()=>u(s),children:O()})}),j&&t&&e.jsx(ee,{data:t.rows,columns:t.columns,drillDownColumns:($=r.drillDown)==null?void 0:$.columns,filterDisplay:p,chartName:s}),n&&e.jsx(re,{x:n.x,y:n.y,field:n.field,value:n.value,allFields:n.allFields,onViewDetails:(V=r.drillDown)!=null&&V.model?_:void 0,onGoToChart:(R=r.drillDown)!=null&&R.chart?P:void 0,detailModel:(B=r.drillDown)==null?void 0:B.model,targetChart:(E=r.drillDown)==null?void 0:E.chart,onClose:()=>x(null)})]})}function De({parsed:s}){const l=s.params.token,[r,i]=f.useState(null),[t,o]=f.useState(!1);return f.useEffect(()=>{if(!l){i("No share token provided");return}ue.getPublicConfig(l).then(()=>o(!0)).catch(()=>i("This link has expired or been revoked"))},[l]),r?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsx("div",{className:"text-center",children:e.jsx("div",{className:"text-gray-400 text-lg",children:r})})}):t?e.jsx(ye,{value:l??null,children:e.jsxs("div",{className:"min-h-screen",style:{backgroundColor:"var(--yc-color-bg, #f9fafb)"},children:[s.type==="public_chart"?e.jsx("div",{className:"max-w-7xl mx-auto py-6 px-4",children:e.jsx(Ce,{chartName:s.name})}):e.jsx(fe,{dashboardId:s.name,initialTab:s.params.tab}),e.jsx("div",{className:"text-center py-4 text-xs",style:{color:"var(--yc-color-text-muted, #9ca3af)"},children:"Shared via yamchart"})]})}):e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsx("div",{className:"text-gray-500",children:"Loading..."})})}export{De as PublicViewer};