@nice2dev/ui 1.0.5 → 1.0.8
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/README.md +253 -207
- package/dist/NiceAPIFlow.doc-DnQLPUie.js +30 -0
- package/dist/NiceAPIFlow.doc-Dx4qw1lm.cjs +6 -0
- package/dist/NiceBranchManager.doc-BXjiENlD.cjs +6 -0
- package/dist/NiceBranchManager.doc-xLB82YwU.js +30 -0
- package/dist/NiceButton-B5RXLDwI.cjs +1 -0
- package/dist/NiceButton-CDiS45Ya.cjs +1 -0
- package/dist/NiceButton-D9l39Rs7.js +595 -0
- package/dist/NiceButton-DmTHNHet.js +450 -0
- package/dist/NiceCodeTemplate.doc-BWxTE4C_.cjs +6 -0
- package/dist/NiceCodeTemplate.doc-CA2U5F-v.js +30 -0
- package/dist/NiceDataBranchGraph.doc-CkitupWc.js +29 -0
- package/dist/NiceDataBranchGraph.doc-DDUgipqH.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B0ODKOs4.js +30 -0
- package/dist/NiceDataBranchManager.doc-CC5o8ihs.cjs +6 -0
- package/dist/NiceDataConflictResolver.doc-CdzScNie.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-V8vxYAeo.js +29 -0
- package/dist/NiceDataDiffViewer.doc-CR14Bq3A.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-w2I2QjhX.js +30 -0
- package/dist/NiceDataMapper.doc-C7jSyHRM.js +30 -0
- package/dist/NiceDataMapper.doc-DXjQHz87.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-CV32WC_w.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-DtuYb3nx.js +30 -0
- package/dist/NiceDataSnapshot.doc-CFLkY3ry.js +30 -0
- package/dist/NiceDataSnapshot.doc-CpZyQ17u.cjs +6 -0
- package/dist/NiceErrorBoundary-BAeqfoSc.cjs +1 -0
- package/dist/NiceErrorBoundary-D1hh5GGe.js +732 -0
- package/dist/NiceErrorBoundary-Dta4TGee.cjs +1 -0
- package/dist/NiceErrorBoundary-niMx1aSJ.js +837 -0
- package/dist/NiceEventOrchestrator.doc-C4SJfIDV.js +30 -0
- package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +6 -0
- package/dist/NiceGitBlame.doc-BG3_K9_0.cjs +6 -0
- package/dist/NiceGitBlame.doc-DrJABEat.js +30 -0
- package/dist/NiceGitConflictResolver.doc-BK7hAfz6.js +30 -0
- package/dist/NiceGitConflictResolver.doc-CgroGM9_.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BAwgcY_3.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BXKJeP-E.js +30 -0
- package/dist/NiceGitGraph.doc-B-WtGuzn.cjs +5 -0
- package/dist/NiceGitGraph.doc-DxnDPCgC.js +29 -0
- package/dist/NiceGitHooks.doc-BrEizvMp.js +29 -0
- package/dist/NiceGitHooks.doc-C4EdV5zj.cjs +5 -0
- package/dist/NiceMergeRequestBuilder.doc-C5p8mYuh.cjs +6 -0
- package/dist/NiceMergeRequestBuilder.doc-Ct9RCmU8.js +30 -0
- package/dist/NiceModuleLifecyclePanel-BapdidD6.js +4776 -0
- package/dist/NiceModuleLifecyclePanel-Brg1RLwi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CsFsm534.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5053 -0
- package/dist/NicePinCodeInput-4q8yULuo.js +13359 -0
- package/dist/NicePinCodeInput-CrMfdxxc.js +15287 -0
- package/dist/NicePinCodeInput-D0aF9MK8.cjs +692 -0
- package/dist/NicePinCodeInput-eD2q8nGa.cjs +692 -0
- package/dist/NicePinCodeInput.css +1 -0
- package/dist/NicePipelineEditor.doc-0eGt8zbX.cjs +5 -0
- package/dist/NicePipelineEditor.doc-DTmaOebn.js +29 -0
- package/dist/NicePipelineMonitor.doc-67CmsRcf.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-mSMdhuG8.js +29 -0
- package/dist/NiceSavedQueryPanel-BZNvqSQW.cjs +596 -0
- package/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6190 -0
- package/dist/NiceSavedQueryPanel-DUw8plYP.js +5666 -0
- package/dist/NiceSavedQueryPanel-xpk09zy1.cjs +596 -0
- package/dist/NiceSavedQueryPanel.css +1 -0
- package/dist/NiceStateDesigner.doc-B36u0hNU.js +29 -0
- package/dist/NiceStateDesigner.doc-MPmvNHSx.cjs +5 -0
- package/dist/NiceStockChart-CHlOnWzN.cjs +287 -0
- package/dist/NiceStockChart-Cpmv9_Cc.js +2341 -0
- package/dist/NiceStockChart.css +1 -0
- package/dist/NiceTestBuilder.doc-BFInj8GJ.js +30 -0
- package/dist/NiceTestBuilder.doc-CB03U_uR.cjs +6 -0
- package/dist/NiceToggle-C1UKGXmJ.js +209 -0
- package/dist/NiceToggle-CaY1u82g.js +277 -0
- package/dist/NiceToggle-DFJFQv_Z.cjs +1 -0
- package/dist/NiceToggle-lVi-ETi0.cjs +1 -0
- package/dist/NiceWindow-D1awkyFl.js +1636 -0
- package/dist/NiceWindow-IdHAcP70.cjs +1 -0
- package/dist/NiceWindow-SiCaREbq.js +1408 -0
- package/dist/NiceWindow-yARTUJsg.cjs +1 -0
- package/dist/charts-Bx_kNBsE.js +4280 -0
- package/dist/charts-DECVsCHX.cjs +754 -0
- package/dist/charts.cjs +1 -0
- package/dist/charts.css +1 -0
- package/dist/charts.d.ts +1043 -0
- package/dist/charts.mjs +23 -0
- package/dist/core-BZBTsGWN.cjs +96 -0
- package/dist/core-BpghV7Ls.js +17555 -0
- package/dist/core-CfXsl755.js +16305 -0
- package/dist/core-DGJSUW64.cjs +96 -0
- package/dist/data-branching-De4ExX-S.cjs +1 -0
- package/dist/data-branching-DiRfob1f.js +6071 -0
- package/dist/data-branching.cjs +1 -0
- package/dist/data-branching.d.ts +401 -0
- package/dist/data-branching.mjs +9 -0
- package/dist/data.cjs +1 -0
- package/dist/data.d.ts +2003 -0
- package/dist/data.mjs +21 -0
- package/dist/devops-BnYinjkT.cjs +17 -0
- package/dist/devops-Ckh57eti.js +7198 -0
- package/dist/devops.cjs +1 -0
- package/dist/devops.d.ts +758 -0
- package/dist/devops.mjs +12 -0
- package/dist/editors.cjs +1 -0
- package/dist/editors.d.ts +2728 -0
- package/dist/editors.mjs +66 -0
- package/dist/feedback.cjs +1 -0
- package/dist/feedback.d.ts +339 -0
- package/dist/feedback.mjs +16 -0
- package/dist/index-C853adw1.cjs +6199 -0
- package/dist/index-CBIZ6mTQ.cjs +5734 -0
- package/dist/index-CIl98Vbm.js +72951 -0
- package/dist/index-CNwVELPJ.js +62857 -0
- package/dist/index-CUx_-gKK.cjs +1 -0
- package/dist/index-x8mRM4Jc.js +17 -0
- package/dist/index.cjs +1 -7866
- package/dist/index.css +1 -0
- package/dist/index.d.ts +4888 -180
- package/dist/index.mjs +1021 -105889
- package/dist/lazy.cjs +1 -0
- package/dist/lazy.d.ts +1880 -0
- package/dist/lazy.mjs +98 -0
- package/dist/navigation.cjs +1 -0
- package/dist/navigation.d.ts +1862 -0
- package/dist/navigation.mjs +576 -0
- package/dist/no-code-BCuadkm4.cjs +332 -0
- package/dist/no-code-TL7PyulA.js +7005 -0
- package/dist/no-code.cjs +1 -0
- package/dist/no-code.d.ts +870 -0
- package/dist/no-code.mjs +13 -0
- package/dist/overlays.cjs +1 -0
- package/dist/overlays.d.ts +706 -0
- package/dist/overlays.mjs +482 -0
- package/package.json +51 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.nice-data-grid-ai{--ai-primary: #6366f1;--ai-primary-light: #818cf8;--ai-bg: #f8fafc;--ai-border: #e2e8f0;--ai-text: #334155;--ai-text-muted: #64748b;--ai-success: #22c55e;--ai-panel-bg: #ffffff;display:flex;flex-direction:column;border-radius:8px;overflow:hidden;border:1px solid var(--ai-border);background:var(--ai-panel-bg)}[data-theme=dark] .nice-data-grid-ai,.nice-data-grid-ai.dark{--ai-primary: #818cf8;--ai-primary-light: #a5b4fc;--ai-bg: #1e293b;--ai-border: #334155;--ai-text: #e2e8f0;--ai-text-muted: #94a3b8;--ai-success: #4ade80;--ai-panel-bg: #0f172a}.nice-data-grid-ai__search-bar{display:flex;align-items:center;gap:12px;padding:12px 16px;background:linear-gradient(135deg,#6366f1,#8b5cf6)}.nice-data-grid-ai__search-left{display:flex;align-items:center}.nice-data-grid-ai__badge{display:inline-flex;align-items:center;justify-content:center;padding:3px 10px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--ai-primary);background:#fff;border-radius:4px}.nice-data-grid-ai__search-form{flex:1;display:flex;gap:8px}.nice-data-grid-ai__input-wrapper{flex:1;position:relative;display:flex;align-items:center}.nice-data-grid-ai__search-icon{position:absolute;left:12px;font-size:14px;pointer-events:none}.nice-data-grid-ai__input{width:100%;padding:10px 36px 10px 38px;font-size:14px;color:var(--ai-text);background:#fff;border:none;border-radius:6px;outline:none;transition:box-shadow .15s ease}.nice-data-grid-ai__input:focus{box-shadow:0 0 0 3px #ffffff4d}.nice-data-grid-ai__input::placeholder{color:var(--ai-text-muted)}.nice-data-grid-ai__loading-spinner{position:absolute;right:40px;width:16px;height:16px;border:2px solid var(--ai-border);border-top-color:var(--ai-primary);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.nice-data-grid-ai__clear-input{position:absolute;right:10px;display:flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;font-size:12px;color:var(--ai-text-muted);background:transparent;border:none;border-radius:50%;cursor:pointer;transition:all .15s ease}.nice-data-grid-ai__clear-input:hover{color:var(--ai-text);background:var(--ai-bg)}.nice-data-grid-ai__search-btn{padding:10px 20px;font-size:14px;font-weight:500;color:var(--ai-primary);background:#fff;border:none;border-radius:6px;cursor:pointer;transition:all .15s ease;white-space:nowrap}.nice-data-grid-ai__search-btn:hover:not(:disabled){background:#f1f5f9}.nice-data-grid-ai__search-btn:disabled{opacity:.6;cursor:not-allowed}.nice-data-grid-ai__insights-btn{padding:10px 16px;font-size:13px;font-weight:500;color:#fff;background:#ffffff26;border:1px solid rgba(255,255,255,.25);border-radius:6px;cursor:pointer;transition:all .15s ease;white-space:nowrap}.nice-data-grid-ai__insights-btn:hover:not(:disabled){background:#ffffff40}.nice-data-grid-ai__insights-btn:disabled{opacity:.5;cursor:not-allowed}.nice-data-grid-ai__examples{display:flex;align-items:center;gap:12px;padding:8px 16px;background:var(--ai-bg);border-bottom:1px solid var(--ai-border);flex-wrap:wrap}.nice-data-grid-ai__examples-label{font-size:12px;color:var(--ai-text-muted);white-space:nowrap}.nice-data-grid-ai__examples-list{display:flex;gap:8px;flex-wrap:wrap}.nice-data-grid-ai__example{padding:4px 10px;font-size:12px;font-style:italic;color:var(--ai-primary);background:transparent;border:1px dashed var(--ai-border);border-radius:4px;cursor:pointer;transition:all .15s ease}.nice-data-grid-ai__example:hover{color:#fff;background:var(--ai-primary);border-color:var(--ai-primary);border-style:solid}.nice-data-grid-ai__active-filter{display:flex;align-items:center;gap:12px;padding:10px 16px;background:#6366f114;border-bottom:1px solid var(--ai-border);flex-wrap:wrap}.nice-data-grid-ai__filter-info{display:flex;align-items:center;gap:8px}.nice-data-grid-ai__filter-icon{font-size:14px}.nice-data-grid-ai__filter-query{font-size:13px;font-weight:500;color:var(--ai-primary)}.nice-data-grid-ai__filter-count{font-size:12px;color:var(--ai-text-muted)}.nice-data-grid-ai__filter-badges{display:flex;gap:6px;flex-wrap:wrap}.nice-data-grid-ai__filter-badge{padding:3px 8px;font-size:11px;font-family:Fira Code,monospace;color:var(--ai-text);background:var(--ai-bg);border:1px solid var(--ai-border);border-radius:3px}.nice-data-grid-ai__clear-filter{margin-left:auto;padding:4px 10px;font-size:12px;color:var(--ai-text-muted);background:transparent;border:1px solid var(--ai-border);border-radius:4px;cursor:pointer;transition:all .15s ease}.nice-data-grid-ai__clear-filter:hover{color:#ef4444;border-color:#ef4444}.nice-data-grid-ai__grid-wrapper{flex:1;min-height:200px}.nice-data-grid-ai__insights-panel{position:fixed;top:20%;right:20px;width:360px;max-height:60vh;background:var(--ai-panel-bg);border-radius:12px;box-shadow:0 20px 40px #0003;display:flex;flex-direction:column;z-index:1000;animation:slideIn .2s ease-out}@keyframes slideIn{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}.nice-data-grid-ai__insights-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;background:var(--ai-bg);border-bottom:1px solid var(--ai-border);border-radius:12px 12px 0 0}.nice-data-grid-ai__insights-header h4{margin:0;font-size:15px;font-weight:600;color:var(--ai-text)}.nice-data-grid-ai__insights-close{display:flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;font-size:14px;color:var(--ai-text-muted);background:transparent;border:none;border-radius:6px;cursor:pointer;transition:all .15s ease}.nice-data-grid-ai__insights-close:hover{color:var(--ai-text);background:var(--ai-border)}.nice-data-grid-ai__insights-body{flex:1;overflow-y:auto;padding:16px}.nice-data-grid-ai__insights-loading{display:flex;align-items:center;justify-content:center;padding:32px;color:var(--ai-primary);font-size:14px}.nice-data-grid-ai__insights-loading:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;border:2px solid var(--ai-border);border-top-color:var(--ai-primary);border-radius:50%;animation:spin .8s linear infinite}.nice-data-grid-ai__insights-list{margin:0;padding:0;list-style:none}.nice-data-grid-ai__insight{display:flex;align-items:flex-start;gap:10px;padding:12px 0;font-size:14px;line-height:1.5;color:var(--ai-text);border-bottom:1px solid var(--ai-border)}.nice-data-grid-ai__insight:last-child{border-bottom:none}.nice-data-grid-ai__insight-bullet{color:var(--ai-primary);font-weight:700}.nice-data-grid-ai__insights-empty{text-align:center;padding:24px;color:var(--ai-text-muted);font-size:14px}.nice-data-grid-ai__insights-footer{padding:12px 16px;border-top:1px solid var(--ai-border)}.nice-data-grid-ai__refresh-insights{width:100%;padding:10px;font-size:13px;font-weight:500;color:var(--ai-primary);background:transparent;border:1px solid var(--ai-border);border-radius:6px;cursor:pointer;transition:all .15s ease}.nice-data-grid-ai__refresh-insights:hover:not(:disabled){background:var(--ai-bg);border-color:var(--ai-primary)}.nice-data-grid-ai__refresh-insights:disabled{opacity:.5;cursor:not-allowed}@media(max-width:768px){.nice-data-grid-ai__search-bar{flex-wrap:wrap}.nice-data-grid-ai__search-form{width:100%;order:1;margin-top:8px}.nice-data-grid-ai__insights-panel{position:fixed;inset:auto 0 0;width:100%;max-height:50vh;border-radius:12px 12px 0 0}}@media(max-width:480px){.nice-data-grid-ai__search-form{flex-direction:column}.nice-data-grid-ai__search-btn{width:100%}.nice-data-grid-ai__examples{flex-direction:column;align-items:flex-start}.nice-data-grid-ai__examples-list{width:100%}}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const e = "https://nice2dev.com/schemas/component-doc-v1.json", t = "NiceStateDesigner", n = "Visual state machine designer with states, transitions, and guards.", i = "no-code", a = "1.0.7", s = "stable", c = [{ name: "machine", type: "StateMachine", required: !0, description: "State machine definition" }, { name: "onChange", type: "(machine: StateMachine) => void", description: "Machine change callback" }, { name: "currentState", type: "string", description: "Current active state" }, { name: "onTransition", type: "(from: string, to: string, event: string) => void", description: "Transition callback" }], o = [{ title: "State Designer", description: "Design state machines visually", code: `<NiceStateDesigner
|
|
2
|
+
machine={orderStateMachine}
|
|
3
|
+
onChange={handleMachineChange}
|
|
4
|
+
currentState="pending"
|
|
5
|
+
/>` }], r = { role: "application", ariaLabel: "State machine designer" }, d = ["NiceWorkflowDesigner", "NiceEventOrchestrator"], h = {
|
|
6
|
+
$schema: e,
|
|
7
|
+
name: t,
|
|
8
|
+
description: n,
|
|
9
|
+
category: i,
|
|
10
|
+
since: a,
|
|
11
|
+
status: s,
|
|
12
|
+
props: c,
|
|
13
|
+
examples: o,
|
|
14
|
+
accessibility: r,
|
|
15
|
+
seeAlso: d
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
e as $schema,
|
|
19
|
+
r as accessibility,
|
|
20
|
+
i as category,
|
|
21
|
+
h as default,
|
|
22
|
+
n as description,
|
|
23
|
+
o as examples,
|
|
24
|
+
t as name,
|
|
25
|
+
c as props,
|
|
26
|
+
d as seeAlso,
|
|
27
|
+
a as since,
|
|
28
|
+
s as status
|
|
29
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceStateDesigner",n="Visual state machine designer with states, transitions, and guards.",i="no-code",a="1.0.7",s="stable",c=[{name:"machine",type:"StateMachine",required:!0,description:"State machine definition"},{name:"onChange",type:"(machine: StateMachine) => void",description:"Machine change callback"},{name:"currentState",type:"string",description:"Current active state"},{name:"onTransition",type:"(from: string, to: string, event: string) => void",description:"Transition callback"}],o=[{title:"State Designer",description:"Design state machines visually",code:`<NiceStateDesigner
|
|
2
|
+
machine={orderStateMachine}
|
|
3
|
+
onChange={handleMachineChange}
|
|
4
|
+
currentState="pending"
|
|
5
|
+
/>`}],r={role:"application",ariaLabel:"State machine designer"},d=["NiceWorkflowDesigner","NiceEventOrchestrator"],l={$schema:e,name:t,description:n,category:i,since:a,status:s,props:c,examples:o,accessibility:r,seeAlso:d};exports.$schema=e;exports.accessibility=r;exports.category=i;exports.default=l;exports.description=n;exports.examples=o;exports.name=t;exports.props=c;exports.seeAlso=d;exports.since=a;exports.status=s;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),N=require("react"),ge=require("./core-DGJSUW64.cjs"),ze=require("./index-CUx_-gKK.cjs"),ye=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16"],_e=({series:t,categories:c,width:d=600,height:s=400,title:r,showLegend:f=!0,showGrid:i=!0,yAxisLabel:x,xAxisLabel:S,stacked:l,zoomable:v,crosshair:u,annotations:w,legendInteractive:y,onDataPointClick:m,exportable:a,className:o,style:h})=>{const k=N.useRef(null),[_,C]=N.useState(new Set),[M,A]=N.useState(null),[p,D]=N.useState(null),[g,z]=N.useState(!1),R=N.useRef(null),W=N.useMemo(()=>t.filter(j=>!_.has(j.name)),[t,_]),Z=N.useCallback(j=>{y&&C(F=>{const Y=new Set(F);return Y.has(j)?Y.delete(j):Y.add(j),Y})},[y]),P={top:r?40:20,right:20,bottom:S?60:40,left:x?60:50},L=d-P.left-P.right,q=s-P.top-P.bottom,G=W[0]?.data.length??t[0]?.data.length??0,X=p?.start??0,K=p?.end??G,ee=K-X,le=N.useMemo(()=>W.map(j=>({...j,data:j.data.slice(X,K)})),[W,X,K]),te=N.useMemo(()=>c?.slice(X,K),[c,X,K]),{minY:I,maxY:O,yTicks:ne}=N.useMemo(()=>{let j;if(l){j=[];for(let b=0;b<ee;b++)j.push(le.reduce((V,se)=>V+(se.data[b]||0),0))}else j=le.flatMap(b=>b.data);j.length===0&&(j=[0]);const F=Math.min(0,...j),Y=Math.max(0,...j),re=Y-F||1,ce=Math.pow(10,Math.floor(Math.log10(re)))||1,n=Math.floor(F/ce)*ce,$=Math.ceil(Y/ce)*ce,T=[];for(let b=n;b<=$;b+=ce)T.push(Math.round(b*1e6)/1e6);return T.length<2&&T.push($),{minY:n,maxY:$,yTicks:T}},[le,ee,l]),E=j=>q-(j-I)/(O-I||1)*q,U=j=>(j+.5)/ee*L,he=ee>0?L/ee/(l?1.5:Math.max(W.length,1)*1.5):20,xe=N.useCallback(j=>{if(!v)return;j.preventDefault();const F=p??{start:0,end:G},Y=F.end-F.start,re=(F.start+F.end)/2,ce=j.deltaY>0?1.2:.8,n=Math.max(2,Math.min(G,Math.round(Y*ce))),$=Math.max(0,Math.round(re-n/2)),T=Math.min(G,$+n);D({start:$,end:T})},[v,p,G]),me=N.useCallback(j=>{v&&(z(!0),R.current={x:j.clientX,range:p??{start:0,end:G}})},[v,p,G]),B=N.useCallback(j=>{const F=k.current?.getBoundingClientRect();if(F&&A({x:j.clientX-F.left-P.left,y:j.clientY-F.top-P.top}),g&&R.current&&v){const Y=j.clientX-R.current.x,re=L/ee,ce=-Math.round(Y/re),n=R.current.range,$=n.end-n.start;let T=n.start+ce;T<0&&(T=0),T+$>G&&(T=G-$),D({start:T,end:T+$})}},[g,v,L,ee,G,P.left,P.top]),H=N.useCallback(()=>{z(!1),R.current=null},[]),J=N.useCallback(()=>{A(null),z(!1),R.current=null},[]),ue=N.useCallback(()=>{const j=k.current;if(!j)return;const F=new XMLSerializer().serializeToString(j),Y=document.createElement("canvas");Y.width=d,Y.height=s+(f?30:0);const re=Y.getContext("2d");if(!re)return;const ce=new Image;ce.onload=()=>{re.fillStyle="#fff",re.fillRect(0,0,Y.width,Y.height),re.drawImage(ce,0,0);const n=document.createElement("a");n.download="chart.png",n.href=Y.toDataURL("image/png"),n.click()},ce.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(F)},[d,s,f]);return e.jsxs("div",{className:`nice-chart ${o||""}`,style:h,children:[a&&e.jsx("button",{type:"button",className:"nice-chart__export-btn",onClick:ue,title:"Export PNG",children:"📷"}),e.jsxs("svg",{ref:k,width:d,height:s+(f?30:0),className:"nice-chart__svg",onWheel:xe,onMouseDown:me,onMouseMove:B,onMouseUp:H,onMouseLeave:J,children:[e.jsxs("g",{transform:`translate(${P.left},${P.top})`,children:[r&&e.jsx("text",{x:L/2,y:-10,textAnchor:"middle",className:"nice-chart__title",children:r}),i&&ne.map(j=>e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:E(j),x2:L,y2:E(j),className:"nice-chart__grid-line"}),e.jsx("text",{x:-8,y:E(j)+4,textAnchor:"end",className:"nice-chart__axis-label",children:j})]},j)),te&&te.map((j,F)=>e.jsx("text",{x:U(F),y:q+20,textAnchor:"middle",className:"nice-chart__axis-label",children:j},F)),x&&e.jsx("text",{x:-P.left+14,y:q/2,textAnchor:"middle",transform:`rotate(-90, -${P.left-14}, ${q/2})`,className:"nice-chart__axis-title",children:x}),S&&e.jsx("text",{x:L/2,y:q+45,textAnchor:"middle",className:"nice-chart__axis-title",children:S}),e.jsx("line",{x1:0,y1:0,x2:0,y2:q,className:"nice-chart__axis"}),e.jsx("line",{x1:0,y1:q,x2:L,y2:q,className:"nice-chart__axis"}),w?.map((j,F)=>{if(j.type==="line"){const Y=E(j.value);return e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:Y,x2:L,y2:Y,stroke:j.color||"#ef4444",strokeWidth:1.5,strokeDasharray:j.dash||"6,3"}),j.label&&e.jsx("text",{x:L+4,y:Y+4,className:"nice-chart__annotation-label",fill:j.color||"#ef4444",children:j.label})]},F)}return e.jsx("text",{x:U(j.value),y:-4,textAnchor:"middle",className:"nice-chart__annotation-label",fill:j.color||"#6b7280",children:j.label},F)}),u&&M&&M.x>=0&&M.x<=L&&M.y>=0&&M.y<=q&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:M.x,y1:0,x2:M.x,y2:q,stroke:"#9ca3af",strokeWidth:1,strokeDasharray:"4,2"}),e.jsx("line",{x1:0,y1:M.y,x2:L,y2:M.y,stroke:"#9ca3af",strokeWidth:1,strokeDasharray:"4,2"})]}),le.map((j,F)=>{const Y=j.color||ye[F%ye.length],re=j.type||"bar";if(re==="bar")return e.jsx("g",{children:j.data.map((n,$)=>{let T,b;if(l){const se=le.slice(0,F).reduce((de,ae)=>de+(ae.data[$]||0),0);T=E(se+n),b=E(se)-T}else T=E(Math.max(0,n)),b=Math.abs(E(n)-E(0));const V=l?U($)-he/2:U($)-le.length*he/2+F*he;return e.jsx("rect",{x:V,y:T,width:he*.9,height:Math.max(0,b),fill:Y,rx:2,style:m?{cursor:"pointer"}:void 0,onClick:m?()=>m(j.name,X+$,n):void 0,children:e.jsx("title",{children:`${j.name}: ${n}`})},$)})},j.name);const ce=j.data.map((n,$)=>`${U($)},${E(n)}`);return e.jsxs("g",{children:[re==="area"&&e.jsx("polygon",{points:`${U(0)},${E(0)} ${ce.join(" ")} ${U(ee-1)},${E(0)}`,fill:Y,opacity:.15}),e.jsx("polyline",{points:ce.join(" "),fill:"none",stroke:Y,strokeWidth:2}),j.data.map((n,$)=>e.jsx("circle",{cx:U($),cy:E(n),r:3,fill:Y,style:m?{cursor:"pointer"}:void 0,onClick:m?()=>m(j.name,X+$,n):void 0,children:e.jsx("title",{children:`${j.name}: ${n}`})},$))]},j.name)})]}),f&&e.jsx("g",{transform:`translate(${P.left}, ${s})`,children:t.map((j,F)=>{const Y=F*120,re=_.has(j.name);return e.jsxs("g",{transform:`translate(${Y}, 10)`,style:y?{cursor:"pointer"}:void 0,onClick:()=>Z(j.name),opacity:re?.35:1,children:[e.jsx("rect",{width:12,height:12,rx:2,fill:j.color||ye[F%ye.length]}),e.jsx("text",{x:16,y:10,className:"nice-chart__legend-text",style:re?{textDecoration:"line-through"}:void 0,children:j.name})]},j.name)})})]})]})},Be=Object.freeze(Object.defineProperty({__proto__:null,NiceChart:_e},Symbol.toStringTag,{value:"Module"}));function Le(t){if(!t.length)return{categories:[],numericFields:[],sampleValues:{}};const c=t[0],d=[],s={};let r=null;for(const[i,x]of Object.entries(c))typeof x=="number"?(d.push(i),s[i]=t.map(S=>Number(S[i])||0)):!r&&(typeof x=="string"||x instanceof Date)&&(r=i);return{categories:r?t.map(i=>String(i[r]||"")):t.map((i,x)=>`Item ${x+1}`),numericFields:d,sampleValues:s}}function Oe(t,c){const{categories:d,numericFields:s,sampleValues:r}=Le(t);return{series:s.map((i,x)=>({name:i.replace(/([A-Z])/g," $1").replace(/^./,S=>S.toUpperCase()).trim(),data:r[i],type:c==="area"?"area":c==="line"?"line":"bar"})),categories:d}}const We=N.forwardRef(function(c,d){const{rawData:s,enableAI:r=!0,aiModel:f,enableAutoType:i=!0,enableInsights:x=!0,dataDescription:S,onChartSuggestion:l,onInsights:v,showAIToolbar:u=!0,showInsightsOnLoad:w=!1,series:y,categories:m,...a}=c,[o,h]=N.useState("bar"),[k,_]=N.useState(null),[C,M]=N.useState([]),[A,p]=N.useState(w),[D,g]=N.useState(null),{t:z}=ze.Na(),R=ge.useNiceAI(),{suggestChartType:W,generateInsights:Z,isLoading:P}=ge.useChartSuggestion(),L=r&&R.isConfigured,{series:q,categories:G}=s?Oe(s,D||o):{series:y||[],categories:m},X=N.useCallback(async()=>{if(!L||!i)return{type:"bar",reason:"Default",config:{}};const I=s||(y?.length?y.flatMap(O=>O.data.map((ne,E)=>({[O.name]:ne,index:E}))):[]);try{const O=await W(I,S),ne={type:O.type,reason:O.reason,config:O.config};return _(ne),h(ne.type),l?.(ne),ne}catch{return{type:"bar",reason:"Default fallback",config:{}}}},[L,i,s,y,S,W,l]),K=N.useCallback(async()=>{if(!L||!x)return[];const I=s||(y?.length?y.flatMap(O=>O.data.map((ne,E)=>({[O.name]:ne,category:m?.[E]||E}))):[]);try{const O=await Z(I,D||o);return M(O),v?.(O),O}catch{return[]}},[L,x,s,y,m,o,D,Z,v]),ee=N.useCallback(()=>D||o,[D,o]);N.useEffect(()=>{L&&i&&(s?.length||y?.length)&&X()},[L,i,s,y]),N.useImperativeHandle(d,()=>({getSuggestion:X,generateInsights:K,getCurrentType:ee}));const le=[{type:"bar",icon:"📊",label:"Bar"},{type:"line",icon:"📈",label:"Line"},{type:"area",icon:"🏔️",label:"Area"},{type:"pie",icon:"🥧",label:"Pie"},{type:"donut",icon:"🍩",label:"Donut"},{type:"scatter",icon:"⭐",label:"Scatter"}],te=D||o;return e.jsxs("div",{className:"nice-chart-ai","data-testid":c["data-testid"],children:[u&&L&&e.jsxs("div",{className:"nice-chart-ai__toolbar",children:[e.jsxs("div",{className:"nice-chart-ai__toolbar-left",children:[e.jsx("span",{className:"nice-chart-ai__badge",children:"AI"}),k&&e.jsxs("div",{className:"nice-chart-ai__suggestion",children:[e.jsx("span",{className:"nice-chart-ai__suggestion-icon",children:"💡"}),e.jsxs("span",{className:"nice-chart-ai__suggestion-text",children:[z("chartAI.suggestedType","Suggested:")," ",k.type]}),e.jsxs("span",{className:"nice-chart-ai__suggestion-reason",title:k.reason,children:["(",k.reason,")"]})]}),P&&e.jsx("span",{className:"nice-chart-ai__loading",children:z("chartAI.analyzing","Analyzing...")})]}),e.jsx("div",{className:"nice-chart-ai__toolbar-center",children:e.jsx("div",{className:"nice-chart-ai__type-selector",children:le.filter(I=>["bar","line","area"].includes(I.type)).map(({type:I,icon:O,label:ne})=>e.jsx("button",{type:"button",className:`nice-chart-ai__type-btn ${te===I?"nice-chart-ai__type-btn--active":""}`,onClick:()=>g(I),title:ne,children:O},I))})}),e.jsxs("div",{className:"nice-chart-ai__toolbar-right",children:[e.jsxs("button",{type:"button",className:"nice-chart-ai__auto-btn",onClick:()=>X(),disabled:P,title:z("chartAI.autoDetect","Auto-detect best chart type"),children:["🔮 ",z("chartAI.auto","Auto")]}),x&&e.jsxs("button",{type:"button",className:"nice-chart-ai__insights-btn",onClick:()=>{C.length||K(),p(!A)},disabled:P,title:z("chartAI.showInsights","Show data insights"),children:["💡 ",z("chartAI.insights","Insights")]})]})]}),e.jsx("div",{className:"nice-chart-ai__chart-wrapper",children:e.jsx(_e,{series:q,categories:G,...a})}),A&&C.length>0&&e.jsxs("div",{className:"nice-chart-ai__insights",children:[e.jsxs("div",{className:"nice-chart-ai__insights-header",children:[e.jsxs("h4",{children:["💡 ",z("chartAI.dataInsights","Data Insights")]}),e.jsx("button",{type:"button",className:"nice-chart-ai__insights-close",onClick:()=>p(!1),children:"✕"})]}),e.jsx("ul",{className:"nice-chart-ai__insights-list",children:C.map((I,O)=>e.jsxs("li",{className:"nice-chart-ai__insight",children:[e.jsx("span",{className:"nice-chart-ai__insight-icon",children:"•"}),I]},O))}),e.jsx("div",{className:"nice-chart-ai__insights-footer",children:e.jsxs("button",{type:"button",className:"nice-chart-ai__refresh",onClick:()=>K(),disabled:P,children:["🔄 ",z("chartAI.refresh","Refresh")]})})]}),A&&P&&e.jsx("div",{className:"nice-chart-ai__insights nice-chart-ai__insights--loading",children:e.jsxs("div",{className:"nice-chart-ai__loading-content",children:[e.jsx("span",{className:"nice-chart-ai__spinner"}),z("chartAI.generatingInsights","Generating insights...")]})})]})});function Pe(t,c){const d=t?typeof t=="number"?new Date(t):new Date(t):new Date,s=S=>S.toString().padStart(2,"0"),r=s(d.getHours()),f=s(d.getMinutes()),i=s(d.getSeconds()),x=d.getMilliseconds().toString().padStart(3,"0");switch(c){case"HH:mm:ss":return`${r}:${f}:${i}`;case"HH:mm":return`${r}:${f}`;case"mm:ss":return`${f}:${i}`;case"ss.SSS":return`${i}.${x}`;case"ISO":return d.toISOString();default:return`${r}:${f}:${i}`}}function $e(t){if(t.length===0)return null;const c=Math.min(...t),d=Math.max(...t),s=t.reduce((f,i)=>f+i,0)/t.length,r=t[t.length-1];return{min:c,max:d,avg:s,current:r,count:t.length}}const we=N.forwardRef(({series:t,maxPoints:c=100,slidingWindow:d=!0,refreshRate:s=16,dataSource:r,width:f=600,height:i=400,title:x,showLegend:S=!0,showGrid:l=!0,yAxisLabel:v,xAxisLabel:u,stacked:w,zoomable:y,crosshair:m,annotations:a=[],legendInteractive:o,onDataPointClick:h,exportable:k,showControls:_=!0,showStatus:C=!0,initialPaused:M=!1,onDataReceived:A,onDataDropped:p,timeFormat:D="HH:mm:ss",showStats:g,thresholds:z=[],className:R,style:W},Z)=>{const[P,L]=N.useState(()=>{const B=new Map;for(const H of t)B.set(H.name,H.initialData?.slice()??[]);return B}),[q,G]=N.useState([]),[X,K]=N.useState(M),[ee,le]=N.useState(!1),te=N.useRef([]),I=N.useRef(Date.now()),O=N.useRef(null),ne=N.useCallback(()=>{const B=te.current;B.length!==0&&(te.current=[],L(H=>{const J=new Map(H);for(const ue of B){const j=J.get(ue.series);if(!j)continue;const F=[...j,ue.value];if(d&&F.length>c){const Y=F.length-c;p?.(Y,ue.series),F.splice(0,Y)}J.set(ue.series,F)}return J}),B.length>0&&G(H=>{const J=[...H];for(const ue of B){const j=ue.category??Pe(ue.timestamp,D);J.push(j)}return d&&J.length>c&&J.splice(0,J.length-c),J}))},[d,c,D,p]),E=N.useCallback(()=>{const B=Date.now();B-I.current>=s&&(ne(),I.current=B),O.current=requestAnimationFrame(E)},[s,ne]);N.useEffect(()=>(X||(O.current=requestAnimationFrame(E)),()=>{O.current!==null&&(cancelAnimationFrame(O.current),O.current=null)}),[X,E]);const U=N.useCallback(B=>{if(X)return;const H="points"in B?B.points:[B];for(const J of H)P.has(J.series)&&(te.current.push(J),A?.(J))},[X,P,A]);N.useEffect(()=>{if(!r)return;const B=r.subscribe(U);let H;return r.onStatusChange?H=r.onStatusChange(le):le(!0),r.fetchHistory&&r.fetchHistory(c).then(J=>{for(const ue of J)te.current.push(ue);ne()}),()=>{B(),H?.()}},[r,U,c,ne]);const he=N.useMemo(()=>t.map(B=>({name:B.name,color:B.color,type:B.type,data:P.get(B.name)??[]})),[t,P]),xe=N.useMemo(()=>{const B=[...a];for(const H of z)B.push({type:"line",value:H.value,color:H.color,label:H.label,dash:H.style==="dashed"?"5,5":H.style==="dotted"?"2,2":void 0});return B},[a,z]);N.useImperativeHandle(Z,()=>({pause(){K(!0)},resume(){K(!1)},isPaused(){return X},clear(){L(B=>{const H=new Map(B);for(const J of H.keys())H.set(J,[]);return H}),G([]),te.current=[]},addPoint(B){U(B)},addPoints(B){U({points:B})},getData(B){return P.get(B)??[]},getCategories(){return q},exportData(){return{series:he,categories:q}},getStats(B){const H=P.get(B);return H?$e(H):null}}),[X,P,q,he,U]);const me=N.useMemo(()=>{if(!g)return null;const B={};for(const[H,J]of P)B[H]=$e(J);return B},[g,P]);return e.jsxs("div",{className:R,style:{position:"relative",...W},children:[C&&e.jsxs("div",{style:{position:"absolute",top:8,right:8,display:"flex",alignItems:"center",gap:4,fontSize:12,color:ee?"#22c55e":"#ef4444",zIndex:10},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:ee?"#22c55e":"#ef4444"}}),ee?"Live":"Disconnected"]}),_&&e.jsx("div",{style:{position:"absolute",top:8,left:8,display:"flex",gap:4,zIndex:10},children:e.jsx("button",{onClick:()=>K(B=>!B),style:{padding:"4px 8px",fontSize:12,border:"1px solid #ddd",borderRadius:4,background:X?"#fef3c7":"#fff",cursor:"pointer"},title:X?"Resume":"Pause",children:X?"▶":"⏸"})}),g&&me&&e.jsx("div",{style:{position:"absolute",bottom:50,right:8,background:"rgba(255,255,255,0.9)",border:"1px solid #ddd",borderRadius:4,padding:8,fontSize:11,zIndex:10},children:Object.entries(me).map(([B,H])=>H?e.jsxs("div",{style:{marginBottom:4},children:[e.jsx("strong",{children:B}),e.jsxs("div",{children:["Min: ",H.min.toFixed(2)," | Max: ",H.max.toFixed(2)]}),e.jsxs("div",{children:["Avg: ",H.avg.toFixed(2)," | Now: ",H.current.toFixed(2)]})]},B):null)}),e.jsx(_e,{series:he,categories:q,width:f,height:i,title:x,showLegend:S,showGrid:l,yAxisLabel:v,xAxisLabel:u,stacked:w,zoomable:y,crosshair:m,annotations:xe,legendInteractive:o,onDataPointClick:h,exportable:k})]})});we.displayName="NiceLiveChart";function He(t){const{hubConnection:c,eventName:d="DataPoint",subscribeMethod:s="SubscribeToMetrics",historyMethod:r="GetMetricHistory",metricName:f}=t;return{subscribe(i){const x=S=>{i(S)};return c.on(d,x),c.state==="Connected"&&c.invoke(s,f).catch(()=>{}),()=>{c.off(d,x)}},async fetchHistory(i){try{return await c.invoke(r,f,i)}catch{return[]}},onStatusChange(i){const x=()=>i(c.state==="Connected");return c.onclose(()=>i(!1)),c.onreconnected(()=>i(!0)),x(),()=>{}}}}function Ee(t){const{url:c,autoReconnect:d=!0,reconnectDelay:s=3e3,parseMessage:r=v=>JSON.parse(v)}=t;let f=null,i=null,x=null,S=null;const l=()=>{f=new WebSocket(c),f.onopen=()=>{i?.(!0)},f.onclose=()=>{i?.(!1),d&&(S=setTimeout(l,s))},f.onerror=()=>{f?.close()},f.onmessage=v=>{try{const u=r(v.data);u&&x&&x(u)}catch{}}};return{subscribe(v){return x=v,l(),()=>{x=null,S&&clearTimeout(S),f?.close(),f=null}},onStatusChange(v){return i=v,()=>{i=null}}}}function Fe(t){const{seriesNames:c,interval:d=1e3,generateValue:s=()=>Math.random()*100}=t;let r=null,f=0;return{subscribe(i){return r=setInterval(()=>{for(const x of c)i({series:x,value:s(x,f),timestamp:Date.now()});f++},d),()=>{r&&clearInterval(r)}},onStatusChange(i){return i(!0),()=>{}}}}const ie=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16"],Ye=({data:t,width:c=400,height:d=400,innerRadius:s=0,title:r,showLegend:f=!0,showLabels:i=!0,className:x,style:S})=>{const l=c/2,v=(d-(f?30:0))/2+(r?10:0),u=Math.min(l,v)-40,w=t.reduce((a,o)=>a+o.value,0);let y=-Math.PI/2;const m=t.map((a,o)=>{const h=a.value/(w||1)*Math.PI*2,k=y;y+=h;const _=y,C=(k+_)/2,M=l+u*Math.cos(k),A=v+u*Math.sin(k),p=l+u*Math.cos(_),D=v+u*Math.sin(_),g=h>Math.PI?1:0,z=a.color||ie[o%ie.length];let R;if(s>0){const L=l+s*Math.cos(k),q=v+s*Math.sin(k),G=l+s*Math.cos(_),X=v+s*Math.sin(_);R=`M${M},${A} A${u},${u} 0 ${g},1 ${p},${D} L${G},${X} A${s},${s} 0 ${g},0 ${L},${q} Z`}else R=`M${l},${v} L${M},${A} A${u},${u} 0 ${g},1 ${p},${D} Z`;const W=l+u*.7*Math.cos(C),Z=v+u*.7*Math.sin(C),P=w>0?Math.round(a.value/w*100):0;return{...a,path:R,labelX:W,labelY:Z,pct:P,color:z}});return e.jsx("div",{className:`nice-piechart ${x||""}`,style:S,children:e.jsxs("svg",{width:c,height:d,className:"nice-piechart__svg",children:[r&&e.jsx("text",{x:l,y:20,textAnchor:"middle",className:"nice-chart__title",children:r}),m.map((a,o)=>e.jsxs("g",{children:[e.jsx("path",{d:a.path,fill:a.color,stroke:"var(--bg-primary, #fff)",strokeWidth:2,children:e.jsx("title",{children:`${a.label}: ${a.value} (${a.pct}%)`})}),i&&a.pct>=5&&e.jsxs("text",{x:a.labelX,y:a.labelY,textAnchor:"middle",dominantBaseline:"middle",className:"nice-piechart__label",children:[a.pct,"%"]})]},o)),f&&e.jsx("g",{transform:`translate(10, ${d-25})`,children:t.map((a,o)=>e.jsxs("g",{transform:`translate(${o*100}, 0)`,children:[e.jsx("rect",{width:10,height:10,rx:2,fill:a.color||ie[o%ie.length]}),e.jsx("text",{x:14,y:9,className:"nice-chart__legend-text",children:a.label})]},o))})]})})},Ve=({series:t,categories:c,width:d=400,height:s=400,maxValue:r,title:f,showLegend:i=!0,className:x,style:S})=>{const l=d/2,v=(s-(i?30:0))/2+(f?10:0),u=Math.min(l,v)-40,w=c.length,y=r??Math.max(...t.flatMap(h=>h.data),1),m=Math.PI*2/w,a=5,o=(h,k)=>{const _=h*m-Math.PI/2,C=k/y*u;return{x:l+C*Math.cos(_),y:v+C*Math.sin(_)}};return e.jsx("div",{className:`nice-polarchart ${x||""}`,style:S,children:e.jsxs("svg",{width:d,height:s,className:"nice-polarchart__svg",children:[f&&e.jsx("text",{x:l,y:20,textAnchor:"middle",className:"nice-chart__title",children:f}),Array.from({length:a},(h,k)=>{const _=u*((k+1)/a);return e.jsx("circle",{cx:l,cy:v,r:_,fill:"none",stroke:"var(--border-color, #ddd)",strokeWidth:.5},k)}),c.map((h,k)=>{const _=o(k,y),C=o(k,y*1.12);return e.jsxs("g",{children:[e.jsx("line",{x1:l,y1:v,x2:_.x,y2:_.y,stroke:"var(--border-color, #ddd)",strokeWidth:.5}),e.jsx("text",{x:C.x,y:C.y,textAnchor:"middle",dominantBaseline:"middle",className:"nice-chart__axis-label",children:h})]},k)}),t.map((h,k)=>{const _=h.color||ie[k%ie.length],C=h.data.map((M,A)=>{const p=o(A,M);return`${p.x},${p.y}`}).join(" ");return e.jsxs("g",{children:[e.jsx("polygon",{points:C,fill:h.fill!==!1?_:"none",fillOpacity:.15,stroke:_,strokeWidth:2}),h.data.map((M,A)=>{const p=o(A,M);return e.jsx("circle",{cx:p.x,cy:p.y,r:3,fill:_,children:e.jsx("title",{children:`${h.name} - ${c[A]}: ${M}`})},A)})]},h.name)}),i&&e.jsx("g",{transform:`translate(10, ${s-25})`,children:t.map((h,k)=>e.jsxs("g",{transform:`translate(${k*100}, 0)`,children:[e.jsx("rect",{width:10,height:10,rx:2,fill:h.color||ie[k%ie.length]}),e.jsx("text",{x:14,y:9,className:"nice-chart__legend-text",children:h.name})]},k))})]})})},Xe=({value:t,min:c=0,max:d=100,width:s=200,height:r=200,startAngle:f=225,endAngle:i=-45,color:x="#3b82f6",trackColor:S,label:l,formatValue:v,ranges:u,className:w,style:y})=>{const m=s/2,a=r/2,o=Math.min(m,a)-20,h=Math.max(0,Math.min(1,(t-c)/(d-c||1))),k=g=>g*Math.PI/180,_=(f-i+360)%360||360,C=g=>({x:m+o*Math.cos(k(g)),y:a-o*Math.sin(k(g))}),M=(g,z)=>{const R=C(g),W=C(z),P=(g-z+360)%360>180?1:0;return`M${R.x},${R.y} A${o},${o} 0 ${P},1 ${W.x},${W.y}`},A=f-h*_,p=C(A);let D=x;if(u){for(const g of u)if(t>=g.start&&t<=g.end){D=g.color;break}}return e.jsx("div",{className:`nice-gauge nice-gauge--circular ${w||""}`,style:y,children:e.jsxs("svg",{width:s,height:r,children:[e.jsx("path",{d:M(f,i),fill:"none",stroke:S||"var(--border-color, #e2e8f0)",strokeWidth:12,strokeLinecap:"round"}),h>0&&e.jsx("path",{d:M(f,A),fill:"none",stroke:D,strokeWidth:12,strokeLinecap:"round"}),e.jsx("line",{x1:m,y1:a,x2:p.x,y2:p.y,stroke:"var(--text-primary, #333)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("circle",{cx:m,cy:a,r:4,fill:"var(--text-primary, #333)"}),e.jsx("text",{x:m,y:a+o*.35,textAnchor:"middle",className:"nice-gauge__value",children:v?v(t):t}),l&&e.jsx("text",{x:m,y:a+o*.55,textAnchor:"middle",className:"nice-gauge__label",children:l})]})})},Ge=({value:t,min:c=0,max:d=100,width:s=300,height:r=60,orientation:f="horizontal",color:i="#3b82f6",label:x,formatValue:S,ranges:l,showTicks:v=!0,tickCount:u=5,className:w,style:y})=>{const m=f==="horizontal",a=m?s-40:r-40,o=Math.max(0,Math.min(1,(t-c)/(d-c||1))),h=10;let k=i;if(l){for(const C of l)if(t>=C.start&&t<=C.end){k=C.color;break}}const _=Array.from({length:u},(C,M)=>c+(d-c)*(M/(u-1)));return m?e.jsx("div",{className:`nice-gauge nice-gauge--linear ${w||""}`,style:y,children:e.jsxs("svg",{width:s,height:r,children:[x&&e.jsx("text",{x:s/2,y:14,textAnchor:"middle",className:"nice-gauge__label",children:x}),e.jsx("rect",{x:20,y:r/2-h/2,width:a,height:h,rx:5,fill:"var(--border-color, #e2e8f0)"}),e.jsx("rect",{x:20,y:r/2-h/2,width:a*o,height:h,rx:5,fill:k}),e.jsx("polygon",{points:`${20+a*o},${r/2-h/2-2} ${20+a*o-5},${r/2-h/2-10} ${20+a*o+5},${r/2-h/2-10}`,fill:"var(--text-primary, #333)"}),e.jsx("text",{x:20+a*o,y:r/2-h/2-12,textAnchor:"middle",className:"nice-gauge__value",style:{fontSize:11},children:S?S(t):t}),v&&_.map((C,M)=>{const A=20+(C-c)/(d-c)*a;return e.jsx("text",{x:A,y:r/2+h/2+14,textAnchor:"middle",className:"nice-gauge__tick",children:C},M)})]})}):e.jsx("div",{className:`nice-gauge nice-gauge--linear nice-gauge--vertical ${w||""}`,style:y,children:e.jsxs("svg",{width:s,height:r,children:[e.jsx("rect",{x:s/2-h/2,y:20,width:h,height:a,rx:5,fill:"var(--border-color, #e2e8f0)"}),e.jsx("rect",{x:s/2-h/2,y:20+a*(1-o),width:h,height:a*o,rx:5,fill:k}),e.jsx("text",{x:s/2,y:14,textAnchor:"middle",className:"nice-gauge__value",children:S?S(t):t}),x&&e.jsx("text",{x:s/2,y:r-4,textAnchor:"middle",className:"nice-gauge__label",children:x})]})})},Ze=({items:t,min:c=0,max:d=100,width:s=300,height:r=300,startAngle:f=225,endAngle:i=-45,formatValue:x,title:S,className:l,style:v})=>{const u=s/2,w=r/2,y=Math.min(u,w)-30,m=Math.min(20,y/(t.length+1)),a=4,o=_=>_*Math.PI/180,h=(f-i+360)%360||360,k=(_,C,M)=>{const A=u+_*Math.cos(o(C)),p=w-_*Math.sin(o(C)),D=u+_*Math.cos(o(M)),g=w-_*Math.sin(o(M)),z=(C-M+360)%360;return`M${A},${p} A${_},${_} 0 ${z>180?1:0},1 ${D},${g}`};return e.jsx("div",{className:`nice-bargauge ${l||""}`,style:v,children:e.jsxs("svg",{width:s,height:r,children:[S&&e.jsx("text",{x:u,y:20,textAnchor:"middle",className:"nice-chart__title",children:S}),t.map((_,C)=>{const M=y-C*(m+a),A=Math.max(0,Math.min(1,(_.value-c)/(d-c||1))),p=f-A*h,D=_.color||ie[C%ie.length];return e.jsxs("g",{children:[e.jsx("path",{d:k(M,f,i),fill:"none",stroke:"var(--border-color, #e2e8f0)",strokeWidth:m,strokeLinecap:"round"}),A>0&&e.jsx("path",{d:k(M,f,p),fill:"none",stroke:D,strokeWidth:m,strokeLinecap:"round"})]},C)}),e.jsx("g",{children:t.map((_,C)=>e.jsxs("text",{x:u,y:w-((t.length-1)/2-C)*16,textAnchor:"middle",dominantBaseline:"middle",className:"nice-gauge__value",style:{fontSize:12},children:[_.label?`${_.label}: `:"",x?x(_.value):_.value]},C))})]})})},qe=({data:t,width:c=120,height:d=30,type:s="line",color:r="#3b82f6",showMinMax:f,showLastPoint:i=!0,className:x,style:S})=>{if(t.length===0)return null;const l=2,v=Math.min(...t),u=Math.max(...t),w=u-v||1,y=c-l*2,m=d-l*2,a=M=>l+M/(t.length-1||1)*y,o=M=>l+m-(M-v)/w*m;if(s==="bar"){const M=Math.max(1,y/t.length-1);return e.jsx("svg",{width:c,height:d,className:`nice-sparkline ${x||""}`,style:S,children:t.map((A,p)=>e.jsx("rect",{x:l+p/t.length*y,y:o(A),width:M,height:m-(o(A)-l),fill:r,rx:1},p))})}const h=t.map((M,A)=>`${a(A)},${o(M)}`).join(" "),k=t.indexOf(v),_=t.indexOf(u),C=t.length-1;return e.jsxs("svg",{width:c,height:d,className:`nice-sparkline ${x||""}`,style:S,children:[s==="area"&&e.jsx("polygon",{points:`${a(0)},${l+m} ${h} ${a(C)},${l+m}`,fill:r,opacity:.15}),e.jsx("polyline",{points:h,fill:"none",stroke:r,strokeWidth:1.5}),f&&e.jsx("circle",{cx:a(k),cy:o(v),r:2,fill:"#ef4444"}),f&&e.jsx("circle",{cx:a(_),cy:o(u),r:2,fill:"#22c55e"}),i&&e.jsx("circle",{cx:a(C),cy:o(t[C]),r:2,fill:r})]})},Ue=({value:t,target:c,min:d=0,max:s=100,width:r=200,height:f=30,color:i="#3b82f6",targetColor:x="#ef4444",className:S,style:l})=>{const u=r-8,w=f-8,y=Math.max(0,Math.min(1,(t-d)/(s-d||1))),m=c!=null?Math.max(0,Math.min(1,(c-d)/(s-d||1))):null;return e.jsxs("svg",{width:r,height:f,className:`nice-bullet ${S||""}`,style:l,children:[e.jsx("rect",{x:4,y:4,width:u,height:w,rx:3,fill:"var(--border-color, #e2e8f0)"}),e.jsx("rect",{x:4,y:4+w*.2,width:u*y,height:w*.6,rx:2,fill:i}),m!=null&&e.jsx("line",{x1:4+u*m,y1:6,x2:4+u*m,y2:4+w-2,stroke:x,strokeWidth:2})]})},Je=({data:t,width:c=400,height:d=300,inverted:s,showLabels:r=!0,showValues:f=!0,title:i,className:x,style:S})=>{const l={top:i?30:10,bottom:10,x:40},v=c-l.x*2,u=d-l.top-l.bottom,w=s?[...t].reverse():t,y=Math.max(...w.map(a=>a.value),1),m=u/w.length;return e.jsx("div",{className:`nice-funnel ${x||""}`,style:S,children:e.jsxs("svg",{width:c,height:d,children:[i&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:i}),w.map((a,o)=>{const h=a.value/y*v,k=o<w.length-1?w[o+1].value/y*v:h*.3,_=l.top+o*m,C=_+m,M=c/2,A=`${M-h/2},${_} ${M+h/2},${_} ${M+k/2},${C} ${M-k/2},${C}`,p=a.color||ie[o%ie.length];return e.jsxs("g",{children:[e.jsx("polygon",{points:A,fill:p,stroke:"var(--bg-primary, #fff)",strokeWidth:1,children:e.jsx("title",{children:`${a.label}: ${a.value}`})}),r&&e.jsx("text",{x:M,y:_+m/2-(f?4:0),textAnchor:"middle",dominantBaseline:"middle",className:"nice-funnel__label",children:a.label}),f&&e.jsx("text",{x:M,y:_+m/2+10,textAnchor:"middle",dominantBaseline:"middle",className:"nice-funnel__value",children:a.value})]},o)})]})})},Se=({nodes:t,links:c,width:d=600,height:s=400,nodeWidth:r=20,nodePadding:f=10,title:i,className:x,style:S})=>{const l={top:i?40:20,bottom:20,left:20,right:20},v=d-l.left-l.right,u=s-l.top-l.bottom,w=new Set(c.map(g=>g.source)),y=new Set(c.map(g=>g.target)),m=t.filter(g=>w.has(g.id)&&!y.has(g.id)),a=t.filter(g=>y.has(g.id)),o=t.filter(g=>w.has(g.id)&&y.has(g.id)),h=[m,...o.length?[o]:[],a].filter(g=>g.length>0),k=h.length,_=new Map;t.forEach(g=>{const z=c.filter(W=>W.source===g.id).reduce((W,Z)=>W+Z.value,0),R=c.filter(W=>W.target===g.id).reduce((W,Z)=>W+Z.value,0);_.set(g.id,Math.max(z,R))});const C=h.map(g=>g.reduce((z,R)=>z+(_.get(R.id)||0),0)+(g.length-1)*f),M=Math.max(...C,1),A=new Map;h.forEach((g,z)=>{const R=l.left+z/(k-1||1)*(v-r);let W=0;g.forEach(Z=>{const P=(_.get(Z.id)||0)/M*u;A.set(Z.id,{x:R,y:l.top+W,h:P}),W+=P+f})});const p=new Map,D=new Map;return t.forEach(g=>{p.set(g.id,0),D.set(g.id,0)}),e.jsx("div",{className:`nice-sankey ${x||""}`,style:S,children:e.jsxs("svg",{width:d,height:s,children:[i&&e.jsx("text",{x:d/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:i}),c.map((g,z)=>{const R=A.get(g.source),W=A.get(g.target);if(!R||!W)return null;const Z=p.get(g.source)||0,P=D.get(g.target)||0,L=g.value/M*u;p.set(g.source,Z+L),D.set(g.target,P+L);const q=R.x+r,G=R.y+Z,X=W.x,K=W.y+P,ee=(q+X)/2,te=t.find(I=>I.id===g.source)?.color||ie[z%ie.length];return e.jsx("path",{d:`M${q},${G} C${ee},${G} ${ee},${K} ${X},${K} L${X},${K+L} C${ee},${K+L} ${ee},${G+L} ${q},${G+L} Z`,fill:te,fillOpacity:.3,stroke:te,strokeOpacity:.5,strokeWidth:.5,children:e.jsx("title",{children:`${g.source} → ${g.target}: ${g.value}`})},z)}),t.map((g,z)=>{const R=A.get(g.id);if(!R)return null;const W=g.color||ie[z%ie.length];return e.jsxs("g",{children:[e.jsx("rect",{x:R.x,y:R.y,width:r,height:Math.max(R.h,2),fill:W,rx:2}),e.jsx("text",{x:R.x<v/2?R.x+r+4:R.x-4,y:R.y+R.h/2,textAnchor:R.x<v/2?"start":"end",dominantBaseline:"middle",className:"nice-chart__legend-text",children:g.label})]},g.id)})]})})},Qe=Object.freeze(Object.defineProperty({__proto__:null,NiceSankey:Se},Symbol.toStringTag,{value:"Module"})),Ke=({data:t,min:c,max:d,start:s,end:r,onChange:f,width:i=500,height:x=100,step:S=1,formatValue:l,chartColor:v="#3b82f6",className:u,style:w})=>{const y={top:10,bottom:30,left:10,right:10},m=i-y.left-y.right,a=x-y.top-y.bottom,o=A=>y.left+(A-c)/(d-c||1)*m,h=A=>{const p=Math.max(0,Math.min(1,(A-y.left)/m)),D=c+p*(d-c);return Math.round(D/S)*S},k=(A,p)=>{p.preventDefault();const D=p.target.closest("svg");if(!D)return;const g=R=>{const W=D.getBoundingClientRect(),Z=h(R.clientX-W.left);A==="start"?f(Math.min(Z,r),r):f(s,Math.max(Z,s))},z=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",z)};document.addEventListener("pointermove",g),document.addEventListener("pointerup",z)},_=t?Math.min(...t):0,M=(t?Math.max(...t):1)-_||1;return e.jsx("div",{className:`nice-rangeselector ${u||""}`,style:w,children:e.jsxs("svg",{width:i,height:x,children:[t&&t.length>1&&e.jsx("polygon",{points:`${y.left},${y.top+a} ${t.map((A,p)=>`${y.left+p/(t.length-1)*m},${y.top+a-(A-_)/M*a}`).join(" ")} ${y.left+m},${y.top+a}`,fill:v,opacity:.15}),e.jsx("rect",{x:o(s),y:y.top,width:o(r)-o(s),height:a,fill:v,opacity:.1}),e.jsx("rect",{x:y.left,y:y.top,width:o(s)-y.left,height:a,fill:"var(--bg-secondary, #f5f5f5)",opacity:.6}),e.jsx("rect",{x:o(r),y:y.top,width:y.left+m-o(r),height:a,fill:"var(--bg-secondary, #f5f5f5)",opacity:.6}),e.jsx("rect",{x:o(s)-4,y:y.top,width:8,height:a,fill:v,rx:2,cursor:"ew-resize",onPointerDown:A=>k("start",A)}),e.jsx("rect",{x:o(r)-4,y:y.top,width:8,height:a,fill:v,rx:2,cursor:"ew-resize",onPointerDown:A=>k("end",A)}),e.jsx("text",{x:o(s),y:y.top+a+18,textAnchor:"middle",className:"nice-chart__axis-label",children:l?l(s):s}),e.jsx("text",{x:o(r),y:y.top+a+18,textAnchor:"middle",className:"nice-chart__axis-label",children:l?l(r):r})]})})},Ce=({regions:t,width:c=600,height:d=400,viewBox:s="0 0 1000 600",colorRange:r=["#dbeafe","#1d4ed8"],maxValue:f,onRegionClick:i,selectedRegionId:x,title:S,showTooltip:l=!0,className:v,style:u})=>{const w=f??Math.max(...t.map(m=>m.value??0),1),y=m=>{const a=g=>[parseInt(g.slice(1,3),16),parseInt(g.slice(3,5),16),parseInt(g.slice(5,7),16)],[o,h,k]=a(r[0]),[_,C,M]=a(r[1]),A=Math.round(o+(_-o)*m),p=Math.round(h+(C-h)*m),D=Math.round(k+(M-k)*m);return`rgb(${A},${p},${D})`};return e.jsxs("div",{className:`nice-vectormap ${v||""}`,style:u,children:[S&&e.jsx("div",{className:"nice-vectormap__title",children:S}),e.jsx("svg",{width:c,height:d,viewBox:s,children:t.map(m=>{const a=m.value!=null?Math.max(0,Math.min(1,m.value/w)):0,o=m.value!=null?y(a):"var(--bg-tertiary, #e5e7eb)",h=m.id===x;return e.jsx("path",{d:m.path,fill:o,stroke:h?"var(--color-primary, #3b82f6)":"var(--border-color, #d1d5db)",strokeWidth:h?2:.5,cursor:i?"pointer":void 0,onClick:()=>i?.(m),children:l&&e.jsx("title",{children:`${m.name}${m.value!=null?`: ${m.value}`:""}`})},m.id)})})]})},et=Object.freeze(Object.defineProperty({__proto__:null,NiceVectorMap:Ce},Symbol.toStringTag,{value:"Module"})),tt=`
|
|
2
|
+
.nice-forecast-chart {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
6
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
7
|
+
border-radius: 0.5rem;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.nice-forecast-chart__header {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
padding: 0.75rem 1rem;
|
|
16
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nice-forecast-chart__title {
|
|
20
|
+
font-size: 1rem;
|
|
21
|
+
font-weight: 600;
|
|
22
|
+
color: var(--nice-text-primary);
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nice-forecast-chart__actions {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: 0.5rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nice-forecast-chart__btn {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
width: 2rem;
|
|
36
|
+
height: 2rem;
|
|
37
|
+
font-size: 1rem;
|
|
38
|
+
border-radius: 0.375rem;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
transition: all 0.15s ease;
|
|
41
|
+
border: 1px solid var(--nice-border-color, #d1d5db);
|
|
42
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
43
|
+
color: var(--nice-text-secondary);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.nice-forecast-chart__btn:hover {
|
|
47
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
48
|
+
color: var(--nice-text-primary);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nice-forecast-chart__btn:disabled {
|
|
52
|
+
opacity: 0.5;
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nice-forecast-chart__container {
|
|
57
|
+
position: relative;
|
|
58
|
+
width: 100%;
|
|
59
|
+
padding: 1rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.nice-forecast-chart__svg {
|
|
63
|
+
width: 100%;
|
|
64
|
+
overflow: visible;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.nice-forecast-chart__grid-line {
|
|
68
|
+
stroke: var(--nice-border-divider, #f3f4f6);
|
|
69
|
+
stroke-width: 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.nice-forecast-chart__axis-line {
|
|
73
|
+
stroke: var(--nice-border-color, #e5e7eb);
|
|
74
|
+
stroke-width: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.nice-forecast-chart__axis-label {
|
|
78
|
+
font-size: 0.6875rem;
|
|
79
|
+
fill: var(--nice-text-secondary);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.nice-forecast-chart__axis-title {
|
|
83
|
+
font-size: 0.75rem;
|
|
84
|
+
font-weight: 500;
|
|
85
|
+
fill: var(--nice-text-primary);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.nice-forecast-chart__historical-line {
|
|
89
|
+
fill: none;
|
|
90
|
+
stroke-width: 2;
|
|
91
|
+
stroke-linecap: round;
|
|
92
|
+
stroke-linejoin: round;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.nice-forecast-chart__forecast-line {
|
|
96
|
+
fill: none;
|
|
97
|
+
stroke-width: 2;
|
|
98
|
+
stroke-linecap: round;
|
|
99
|
+
stroke-linejoin: round;
|
|
100
|
+
stroke-dasharray: 6, 4;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.nice-forecast-chart__confidence-band {
|
|
104
|
+
opacity: 0.2;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.nice-forecast-chart__forecast-region {
|
|
108
|
+
fill: var(--nice-bg-secondary, #f9fafb);
|
|
109
|
+
opacity: 0.5;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.nice-forecast-chart__point {
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
transition: r 0.15s ease;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.nice-forecast-chart__point:hover {
|
|
118
|
+
r: 6;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.nice-forecast-chart__annotation-line {
|
|
122
|
+
stroke-dasharray: 4, 2;
|
|
123
|
+
stroke-width: 1;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.nice-forecast-chart__annotation-marker {
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
transition: transform 0.15s ease;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.nice-forecast-chart__annotation-marker:hover {
|
|
132
|
+
transform: scale(1.2);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.nice-forecast-chart__reference-line {
|
|
136
|
+
stroke-width: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nice-forecast-chart__reference-label {
|
|
140
|
+
font-size: 0.625rem;
|
|
141
|
+
fill: var(--nice-text-secondary);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.nice-forecast-chart__cash-runway {
|
|
145
|
+
pointer-events: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.nice-forecast-chart__cash-runway-line {
|
|
149
|
+
stroke: #ef4444;
|
|
150
|
+
stroke-width: 2;
|
|
151
|
+
stroke-dasharray: 8, 4;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.nice-forecast-chart__cash-runway-label-bg {
|
|
155
|
+
fill: #ef4444;
|
|
156
|
+
rx: 4;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.nice-forecast-chart__cash-runway-label {
|
|
160
|
+
font-size: 0.6875rem;
|
|
161
|
+
font-weight: 600;
|
|
162
|
+
fill: #ffffff;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.nice-forecast-chart__cash-runway-date {
|
|
166
|
+
font-size: 0.625rem;
|
|
167
|
+
fill: #ef4444;
|
|
168
|
+
font-weight: 500;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.nice-forecast-chart__tooltip {
|
|
172
|
+
position: absolute;
|
|
173
|
+
pointer-events: none;
|
|
174
|
+
z-index: 100;
|
|
175
|
+
padding: 0.75rem;
|
|
176
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
177
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
178
|
+
border-radius: 0.5rem;
|
|
179
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
180
|
+
font-size: 0.8125rem;
|
|
181
|
+
max-width: 250px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.nice-forecast-chart__tooltip-date {
|
|
185
|
+
font-weight: 600;
|
|
186
|
+
color: var(--nice-text-primary);
|
|
187
|
+
margin-bottom: 0.5rem;
|
|
188
|
+
padding-bottom: 0.5rem;
|
|
189
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.nice-forecast-chart__tooltip-item {
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
gap: 0.5rem;
|
|
196
|
+
margin-bottom: 0.25rem;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.nice-forecast-chart__tooltip-color {
|
|
200
|
+
width: 10px;
|
|
201
|
+
height: 10px;
|
|
202
|
+
border-radius: 2px;
|
|
203
|
+
flex-shrink: 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.nice-forecast-chart__tooltip-label {
|
|
207
|
+
color: var(--nice-text-secondary);
|
|
208
|
+
flex: 1;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.nice-forecast-chart__tooltip-value {
|
|
212
|
+
font-weight: 600;
|
|
213
|
+
color: var(--nice-text-primary);
|
|
214
|
+
font-variant-numeric: tabular-nums;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.nice-forecast-chart__tooltip-confidence {
|
|
218
|
+
font-size: 0.75rem;
|
|
219
|
+
color: var(--nice-text-tertiary);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.nice-forecast-chart__legend {
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-wrap: wrap;
|
|
225
|
+
gap: 1rem;
|
|
226
|
+
padding: 0.75rem 1rem;
|
|
227
|
+
border-top: 1px solid var(--nice-border-color, #e5e7eb);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.nice-forecast-chart__legend-item {
|
|
231
|
+
display: flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: 0.375rem;
|
|
234
|
+
font-size: 0.8125rem;
|
|
235
|
+
color: var(--nice-text-secondary);
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
user-select: none;
|
|
238
|
+
transition: opacity 0.15s ease;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.nice-forecast-chart__legend-item:hover {
|
|
242
|
+
color: var(--nice-text-primary);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.nice-forecast-chart__legend-item--hidden {
|
|
246
|
+
opacity: 0.4;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.nice-forecast-chart__legend-color {
|
|
250
|
+
width: 16px;
|
|
251
|
+
height: 3px;
|
|
252
|
+
border-radius: 1px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.nice-forecast-chart__legend-color--dashed {
|
|
256
|
+
background: repeating-linear-gradient(
|
|
257
|
+
90deg,
|
|
258
|
+
currentColor,
|
|
259
|
+
currentColor 4px,
|
|
260
|
+
transparent 4px,
|
|
261
|
+
transparent 6px
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.nice-forecast-chart__empty {
|
|
266
|
+
display: flex;
|
|
267
|
+
align-items: center;
|
|
268
|
+
justify-content: center;
|
|
269
|
+
height: 300px;
|
|
270
|
+
color: var(--nice-text-secondary);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* Dark mode */
|
|
274
|
+
.dark .nice-forecast-chart {
|
|
275
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
276
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.dark .nice-forecast-chart__tooltip {
|
|
280
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
281
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.dark .nice-forecast-chart__forecast-region {
|
|
285
|
+
fill: var(--nice-bg-secondary-dark, #1f2937);
|
|
286
|
+
}
|
|
287
|
+
`,ke=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];function oe(t){return t instanceof Date?t:new Date(t)}function Me(t,c="pl-PL"){return t.toLocaleDateString(c,{year:"numeric",month:"short",day:"numeric"})}function be(t,c="pl-PL"){return new Intl.NumberFormat(c,{minimumFractionDigits:0,maximumFractionDigits:2}).format(t)}const nt=N.forwardRef(function(c,d){const{scenarios:s,annotations:r=[],referenceLines:f=[],forecastStartDate:i,cashRunway:x,xAxis:S,yAxis:l,confidenceBands:v=[{level:95,color:"#3b82f6",opacity:.15}],tooltip:u,legend:w={enabled:!0,position:"bottom",interactive:!0},height:y=350,showForecastRegion:m=!0,lineWidth:a=2,showPoints:o=!1,pointRadius:h=4,enableZoom:k=!1,animationDuration:_=300,responsive:C=!0,onPointClick:M,onAnnotationClick:A,onScenarioToggle:p,onViewportChange:D,size:g="medium",disabled:z=!1,labels:R={},locale:W="pl-PL",className:Z,style:P}=c,[L,q]=N.useState(()=>s.map((n,$)=>({...n,color:n.color??ke[$%ke.length],visible:n.visible!==!1}))),[G,X]=N.useState(null),[K,ee]=N.useState({x:0,y:0}),le=N.useRef(null),te=N.useRef(null),I={top:20,right:30,bottom:40,left:60},[O,ne]=N.useState({width:600,height:typeof y=="number"?y:350});N.useEffect(()=>{if(!C||!le.current)return;const n=new ResizeObserver($=>{for(const T of $)ne(b=>({width:T.contentRect.width,height:b.height}))});return n.observe(le.current),()=>n.disconnect()},[C]),N.useEffect(()=>{const n="nice-forecast-chart-styles";if(!document.getElementById(n)){const $=document.createElement("style");$.id=n,$.textContent=tt,document.head.appendChild($)}},[]);const{xScale:E,yScale:U,allDates:he,minY:xe,maxY:me}=N.useMemo(()=>{const $=L.filter(Q=>Q.visible!==!1).flatMap(Q=>Q.data);if($.length===0)return{xScale:()=>0,yScale:()=>0,allDates:[],minY:0,maxY:100};const T=$.map(Q=>oe(Q.date).getTime()),b=Math.min(...T),V=Math.max(...T),se=$.flatMap(Q=>[Q.value,Q.forecast,Q.lowerBound,Q.upperBound]).filter(Q=>Q!=null),de=l?.min??Math.min(...se)*.95,ae=l?.max??Math.max(...se)*1.05,fe=O.width-I.left-I.right,pe=O.height-I.top-I.bottom,ve=Q=>{const Ne=typeof Q=="number"?Q:Q.getTime();return I.left+(Ne-b)/(V-b)*fe},je=Q=>I.top+pe-(Q-de)/(ae-de)*pe,Re=[...new Set(T)].sort((Q,Ne)=>Q-Ne).map(Q=>new Date(Q));return{xScale:ve,yScale:je,allDates:Re,minY:de,maxY:ae}},[L,O,I,l]),B=i?oe(i):null,H=N.useMemo(()=>{if(!x?.enabled)return null;const n=x.threshold??0,$=x.scenarioId?L.find(b=>b.id===x.scenarioId&&b.visible!==!1):L.find(b=>b.visible!==!1);if(!$)return null;const T=$.data.sort((b,V)=>oe(b.date).getTime()-oe(V.date).getTime());for(let b=1;b<T.length;b++){const V=T[b-1],se=T[b],de=V.forecast??V.value,ae=se.forecast??se.value;if(de!=null&&ae!=null&&de>n&&ae<=n){const fe=(de-n)/(de-ae),pe=oe(V.date).getTime(),ve=oe(se.date).getTime(),je=pe+fe*(ve-pe);return new Date(je)}}return null},[x,L]),J=N.useCallback((n,$)=>{const T=n.filter(b=>b[$]!=null).map(b=>({x:E(oe(b.date)),y:U(b[$])}));return T.length===0?"":`M ${T.map(b=>`${b.x},${b.y}`).join(" L ")}`},[E,U]),ue=N.useCallback(n=>{const $=n.filter(V=>V.lowerBound!=null&&V.upperBound!=null);if($.length===0)return"";const T=$.map(V=>({x:E(oe(V.date)),y:U(V.upperBound)})),b=$.map(V=>({x:E(oe(V.date)),y:U(V.lowerBound)})).reverse();return`M ${T.map(V=>`${V.x},${V.y}`).join(" L ")} L ${b.map(V=>`${V.x},${V.y}`).join(" L ")} Z`},[E,U]),j=N.useCallback(n=>{if(!te.current||u?.enabled===!1)return;const $=te.current.getBoundingClientRect(),T=n.clientX-$.left;n.clientY-$.top;let b=null,V=1/0;for(const se of he){const de=E(se),ae=Math.abs(de-T);ae<V&&(V=ae,b=se)}if(b&&V<50){const se=L.filter(ae=>ae.visible!==!1).map(ae=>{const fe=ae.data.find(pe=>oe(pe.date).getTime()===b.getTime());return{scenario:ae,value:fe?.value,forecast:fe?.forecast,lowerBound:fe?.lowerBound,upperBound:fe?.upperBound}}),de=r.filter(ae=>Math.abs(oe(ae.date).getTime()-b.getTime())<864e5);X({date:b,values:se,annotations:de}),ee({x:n.clientX-$.left+10,y:n.clientY-$.top-10})}else X(null)},[E,he,L,r,u]),F=N.useCallback(n=>{if(!w.interactive)return;q(T=>T.map(b=>b.id===n?{...b,visible:!b.visible}:b));const $=L.find(T=>T.id===n);$&&p?.(n,!$.visible)},[w.interactive,L,p]);N.useImperativeHandle(d,()=>({getScenarios:()=>L,updateScenario:(n,$)=>{q(T=>T.map(b=>b.id===n?{...b,data:$}:b))},toggleScenario:F,setZoomRange:()=>{},resetZoom:()=>{},exportImage:n=>{if(!te.current)return null;const $=te.current,b=new XMLSerializer().serializeToString($);return`data:image/svg+xml;base64,${btoa(b)}`},getDataAtDate:n=>{const $=L.filter(T=>T.visible!==!1).map(T=>{const b=T.data.find(V=>oe(V.date).getTime()===n.getTime());return{scenario:T,value:b?.value,forecast:b?.forecast,lowerBound:b?.lowerBound,upperBound:b?.upperBound}});return{date:n,values:$,annotations:r.filter(T=>oe(T.date).getTime()===n.getTime())}}}),[L,r,F]),O.width-I.left-I.right;const Y=O.height-I.top-I.bottom,re=N.useMemo(()=>{const n=l?.tickCount??5,$=[],T=(me-xe)/(n-1);for(let b=0;b<n;b++)$.push(xe+T*b);return $},[xe,me,l?.tickCount]),ce=N.useMemo(()=>{const n=S?.tickCount??6;if(he.length===0)return[];const $=Math.max(1,Math.floor(he.length/(n-1)));return he.filter((T,b)=>b%$===0||b===he.length-1)},[he,S?.tickCount]);return L.length===0||L.every(n=>n.data.length===0)?e.jsx("div",{className:`nice-forecast-chart ${Z??""}`,style:P,children:e.jsx("div",{className:"nice-forecast-chart__empty",children:R.noData??"No data available"})}):e.jsxs("div",{className:`nice-forecast-chart ${Z??""}`,style:{...P,height:y},children:[e.jsxs("div",{ref:le,className:"nice-forecast-chart__container",children:[e.jsxs("svg",{ref:te,className:"nice-forecast-chart__svg",width:O.width,height:O.height,onMouseMove:j,onMouseLeave:()=>X(null),children:[l?.showGrid!==!1&&re.map(n=>e.jsx("line",{className:"nice-forecast-chart__grid-line",x1:I.left,x2:O.width-I.right,y1:U(n),y2:U(n)},n)),m&&B&&e.jsx("rect",{className:"nice-forecast-chart__forecast-region",x:E(B),y:I.top,width:O.width-I.right-E(B),height:Y}),f.map(n=>e.jsxs("g",{children:[e.jsx("line",{className:"nice-forecast-chart__reference-line",x1:I.left,x2:O.width-I.right,y1:U(n.value),y2:U(n.value),stroke:n.color??"#9ca3af",strokeDasharray:n.dashArray??"4,2"}),n.label&&e.jsx("text",{className:"nice-forecast-chart__reference-label",x:O.width-I.right-4,y:U(n.value)-4,textAnchor:"end",children:n.label})]},n.id)),H&&x?.enabled&&e.jsxs("g",{className:"nice-forecast-chart__cash-runway",children:[e.jsx("line",{className:"nice-forecast-chart__cash-runway-line",x1:E(H),x2:E(H),y1:I.top,y2:O.height-I.bottom,stroke:x.color??"#ef4444"}),x.showLabel!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("rect",{className:"nice-forecast-chart__cash-runway-label-bg",x:E(H)-60,y:I.top-2,width:120,height:x.showDate!==!1?32:20,fill:x.color??"#ef4444",rx:4}),e.jsx("text",{className:"nice-forecast-chart__cash-runway-label",x:E(H),y:I.top+12,textAnchor:"middle",fill:"#ffffff",children:x.label??R.cashRunsOut??"💰 Cash runs out"}),x.showDate!==!1&&e.jsx("text",{className:"nice-forecast-chart__cash-runway-label",x:E(H),y:I.top+26,textAnchor:"middle",fill:"#ffffff",style:{fontSize:"0.625rem",opacity:.9},children:Me(H,W)})]})]}),L.filter(n=>n.visible!==!1&&n.showConfidenceBand).map(n=>e.jsx("path",{className:"nice-forecast-chart__confidence-band",d:ue(n.data),fill:n.color},`band-${n.id}`)),L.filter(n=>n.visible!==!1).map(n=>{const $=B?n.data.filter(b=>oe(b.date)<B):n.data.filter(b=>b.value!=null),T=B?n.data.filter(b=>oe(b.date)>=B):n.data.filter(b=>b.forecast!=null);return e.jsxs("g",{children:[e.jsx("path",{className:"nice-forecast-chart__historical-line",d:J($,"value"),stroke:n.color,strokeWidth:a}),e.jsx("path",{className:"nice-forecast-chart__forecast-line",d:J(T,B?"value":"forecast"),stroke:n.color,strokeWidth:a}),T.length>0&&n.data.some(b=>b.forecast!=null)&&e.jsx("path",{className:"nice-forecast-chart__forecast-line",d:J(n.data,"forecast"),stroke:n.color,strokeWidth:a}),o&&n.data.map((b,V)=>{const se=b.value??b.forecast;return se==null?null:e.jsx("circle",{className:"nice-forecast-chart__point",cx:E(oe(b.date)),cy:U(se),r:h,fill:n.color,onClick:()=>M?.(b,n)},V)})]},n.id)}),r.map(n=>{const $=E(oe(n.date));return e.jsxs("g",{className:"nice-forecast-chart__annotation-marker",onClick:()=>A?.(n),children:[n.showLine!==!1&&e.jsx("line",{className:"nice-forecast-chart__annotation-line",x1:$,x2:$,y1:I.top,y2:O.height-I.bottom,stroke:n.color??"#9ca3af"}),e.jsx("circle",{cx:$,cy:I.top+10,r:8,fill:n.color??"#9ca3af"}),e.jsx("text",{x:$,y:I.top+14,textAnchor:"middle",fill:"white",fontSize:"10",children:n.icon??"!"})]},n.id)}),e.jsx("line",{className:"nice-forecast-chart__axis-line",x1:I.left,x2:I.left,y1:I.top,y2:O.height-I.bottom}),e.jsx("line",{className:"nice-forecast-chart__axis-line",x1:I.left,x2:O.width-I.right,y1:O.height-I.bottom,y2:O.height-I.bottom}),re.map(n=>e.jsx("text",{className:"nice-forecast-chart__axis-label",x:I.left-8,y:U(n)+4,textAnchor:"end",children:l?.format?l.format(n):be(n,W)},n)),ce.map(n=>e.jsx("text",{className:"nice-forecast-chart__axis-label",x:E(n),y:O.height-I.bottom+16,textAnchor:"middle",children:S?.format?S.format(n):Me(n,W)},n.getTime())),l?.title&&e.jsx("text",{className:"nice-forecast-chart__axis-title",x:15,y:O.height/2,textAnchor:"middle",transform:`rotate(-90, 15, ${O.height/2})`,children:l.title})]}),G&&e.jsxs("div",{className:"nice-forecast-chart__tooltip",style:{left:K.x,top:K.y},children:[e.jsx("div",{className:"nice-forecast-chart__tooltip-date",children:Me(G.date,W)}),G.values.map(n=>{const $=n.value??n.forecast;return $==null?null:e.jsxs("div",{className:"nice-forecast-chart__tooltip-item",children:[e.jsx("span",{className:"nice-forecast-chart__tooltip-color",style:{background:n.scenario.color}}),e.jsx("span",{className:"nice-forecast-chart__tooltip-label",children:n.scenario.name}),e.jsx("span",{className:"nice-forecast-chart__tooltip-value",children:be($,W)})]},n.scenario.id)}),G.values.some(n=>n.lowerBound!=null)&&e.jsxs("div",{className:"nice-forecast-chart__tooltip-confidence",children:[R.confidence??"CI",":"," ",be(G.values[0]?.lowerBound??0,W)," –"," ",be(G.values[0]?.upperBound??0,W)]})]})]}),w.enabled&&e.jsx("div",{className:"nice-forecast-chart__legend",children:L.map(n=>e.jsxs("div",{className:`nice-forecast-chart__legend-item ${n.visible===!1?"nice-forecast-chart__legend-item--hidden":""}`,onClick:()=>F(n.id),children:[e.jsx("span",{className:`nice-forecast-chart__legend-color ${n.isBase?"":"nice-forecast-chart__legend-color--dashed"}`,style:{background:n.color}}),n.name]},n.id))})]})}),Ae=N.forwardRef(({data:t,renderNode:c,selectable:d,selectedKey:s,onSelect:r,direction:f="top-down",collapsible:i=!0,className:x,style:S,id:l},v)=>{const u=ge.useControlId(l),[w,y]=N.useState(new Set),m=N.useCallback(h=>{y(k=>{const _=new Set(k);return _.has(h)?_.delete(h):_.add(h),_})},[]),a=N.useCallback(h=>{d&&r?.(h)},[d,r]),o=N.useCallback(h=>{const k=w.has(h.key),_=h.children&&h.children.length>0;return e.jsxs("li",{className:"nice-org-chart__item",children:[e.jsxs("div",{className:`nice-org-chart__node${s===h.key?" nice-org-chart__node--selected":""}`,onClick:()=>a(h.key),role:d?"button":void 0,children:[c?c(h):e.jsx("span",{children:h.label}),i&&_&&e.jsx("button",{type:"button",className:"nice-org-chart__toggle",onClick:C=>{C.stopPropagation(),m(h.key)},"aria-label":k?"Expand":"Collapse",children:k?"+":"−"})]}),_&&!k&&e.jsx("ul",{className:"nice-org-chart__children",children:h.children.map(C=>o(C))})]},h.key)},[w,s,c,d,i,a,m]);return e.jsx("div",{ref:v,id:u,className:`nice-org-chart nice-org-chart--${f} ${x||""}`,style:S,children:e.jsx("ul",{className:"nice-org-chart__root",children:o(t)})})});Ae.displayName="NiceOrganizationChart";function rt(t,c,d){const s=y=>{const m=y.replace("#","");return[parseInt(m.slice(0,2),16),parseInt(m.slice(2,4),16),parseInt(m.slice(4,6),16)]},[r,f,i]=s(t),[x,S,l]=s(c),v=Math.round(r+(x-r)*d),u=Math.round(f+(S-f)*d),w=Math.round(i+(l-i)*d);return`rgb(${v},${u},${w})`}const Ie=N.forwardRef(({data:t,xLabels:c,yLabels:d,colors:s=["#e0f2fe","#1d4ed8"],onCellClick:r,cellSize:f=40,showValues:i=!0,className:x,style:S,id:l},v)=>{const u=ge.useControlId(l),{minVal:w,maxVal:y}=N.useMemo(()=>{let a=1/0,o=-1/0;for(const h of t)for(const k of h)k<a&&(a=k),k>o&&(o=k);return{minVal:a,maxVal:o}},[t]),m=N.useCallback(a=>y===w?.5:(a-w)/(y-w),[w,y]);return e.jsx("div",{ref:v,id:u,className:`nice-heatmap ${x||""}`,style:S,children:e.jsxs("table",{className:"nice-heatmap__table",children:[c&&e.jsx("thead",{children:e.jsxs("tr",{children:[d&&e.jsx("th",{}),c.map((a,o)=>e.jsx("th",{className:"nice-heatmap__header",children:a},o))]})}),e.jsx("tbody",{children:t.map((a,o)=>e.jsxs("tr",{children:[d&&e.jsx("th",{className:"nice-heatmap__row-label",children:d[o]}),a.map((h,k)=>e.jsx("td",{className:"nice-heatmap__cell",style:{background:rt(s[0],s[1],m(h)),width:f,height:f,textAlign:"center",color:m(h)>.6?"#fff":"#333",cursor:r?"pointer":void 0},onClick:()=>r?.(o,k,h),title:String(h),children:i?h:""},k))]},o))})]})})});Ie.displayName="NiceHeatMap";function st(t,c){const d=t.reduce((l,v)=>l+v.value,0);if(d===0||t.length===0)return[];const s=[];let{x:r,y:f,w:i,h:x}=c;const S=[...t].sort((l,v)=>v.value-l.value);for(const l of S){const v=l.value/d;if(i>=x){const u=i*v;s.push({x:r,y:f,w:u,h:x,node:l}),r+=u,i-=u}else{const u=x*v;s.push({x:r,y:f,w:i,h:u,node:l}),f+=u,x-=u}}return s}const ct=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#84cc16"],De=N.forwardRef(({data:t,width:c=600,height:d=400,onNodeClick:s,colors:r=ct,className:f,style:i,id:x},S)=>{const l=ge.useControlId(x),v=N.useMemo(()=>{const u=t.children??[t];return st(u,{x:0,y:0,w:c,h:d})},[t,c,d]);return e.jsx("div",{ref:S,id:l,className:`nice-treemap ${f||""}`,style:i,children:e.jsx("svg",{width:c,height:d,className:"nice-treemap__svg",children:v.map((u,w)=>e.jsxs("g",{onClick:()=>s?.(u.node),style:{cursor:s?"pointer":void 0},children:[e.jsx("rect",{x:u.x,y:u.y,width:Math.max(u.w-1,0),height:Math.max(u.h-1,0),fill:u.node.color??r[w%r.length],rx:2}),u.w>40&&u.h>20&&e.jsx("text",{x:u.x+u.w/2,y:u.y+u.h/2,textAnchor:"middle",dominantBaseline:"central",fill:"#fff",fontSize:Math.min(12,u.w/6),className:"nice-treemap__label",children:u.node.label})]},u.node.key))})})});De.displayName="NiceTreeMap";const Te=N.forwardRef(({data:t,type:c="candlestick",showVolume:d=!0,width:s=800,height:r=400,bullColor:f="#22c55e",bearColor:i="#ef4444",className:x,style:S,id:l},v)=>{const u=ge.useControlId(l),w={top:20,right:20,bottom:d?80:30,left:60},y=s-w.left-w.right,m=d?50:0,a=r-w.top-w.bottom-m,{minP:o,maxP:h,maxVol:k}=N.useMemo(()=>{let p=1/0,D=-1/0,g=0;for(const z of t)z.low<p&&(p=z.low),z.high>D&&(D=z.high),z.volume&&z.volume>g&&(g=z.volume);return{minP:p,maxP:D,maxVol:g}},[t]),_=Math.max(1,y/t.length*.7),C=p=>w.left+(p+.5)*(y/t.length),M=p=>w.top+a-(p-o)/(h-o||1)*a,A=p=>r-w.bottom-m+m*(1-p/(k||1));return e.jsx("div",{ref:v,id:u,className:`nice-stock-chart ${x||""}`,style:S,children:e.jsxs("svg",{width:s,height:r,className:"nice-stock-chart__svg",children:[[0,.25,.5,.75,1].map(p=>{const D=o+p*(h-o);return e.jsxs("g",{children:[e.jsx("line",{x1:w.left,x2:s-w.right,y1:M(D),y2:M(D),stroke:"#e5e7eb",strokeDasharray:"2,2"}),e.jsx("text",{x:w.left-4,y:M(D)+4,textAnchor:"end",fontSize:10,fill:"#888",children:D.toFixed(2)})]},p)}),c==="line"?e.jsx("polyline",{points:t.map((p,D)=>`${C(D)},${M(p.close)}`).join(" "),fill:"none",stroke:f,strokeWidth:1.5}):t.map((p,D)=>{const g=p.close>=p.open,z=g?f:i,R=C(D);if(c==="ohlc")return e.jsxs("g",{children:[e.jsx("line",{x1:R,x2:R,y1:M(p.high),y2:M(p.low),stroke:z,strokeWidth:1}),e.jsx("line",{x1:R-_/2,x2:R,y1:M(p.open),y2:M(p.open),stroke:z,strokeWidth:1.5}),e.jsx("line",{x1:R,x2:R+_/2,y1:M(p.close),y2:M(p.close),stroke:z,strokeWidth:1.5})]},D);const W=M(Math.max(p.open,p.close)),Z=M(Math.min(p.open,p.close));return e.jsxs("g",{children:[e.jsx("line",{x1:R,x2:R,y1:M(p.high),y2:M(p.low),stroke:z,strokeWidth:1}),e.jsx("rect",{x:R-_/2,y:W,width:_,height:Math.max(Z-W,1),fill:g?"transparent":z,stroke:z,strokeWidth:1})]},D)}),d&&t.map((p,D)=>{if(!p.volume)return null;const g=p.close>=p.open;return e.jsx("rect",{x:C(D)-_/2,y:A(p.volume),width:_,height:r-w.bottom-A(p.volume),fill:g?f:i,opacity:.3},`v${D}`)}),t.map((p,D)=>D%Math.max(1,Math.floor(t.length/8))!==0?null:e.jsx("text",{x:C(D),y:r-w.bottom+m+14,textAnchor:"middle",fontSize:9,fill:"#888",children:p.date},`l${D}`))]})})});Te.displayName="NiceStockChart";exports.CHART_COLORS=ie;exports.NiceBarGauge=Ze;exports.NiceBullet=Ue;exports.NiceChart=_e;exports.NiceChart$1=Be;exports.NiceChartAI=We;exports.NiceCircularGauge=Xe;exports.NiceForecastChart=nt;exports.NiceFunnel=Je;exports.NiceHeatMap=Ie;exports.NiceLinearGauge=Ge;exports.NiceLiveChart=we;exports.NiceOrganizationChart=Ae;exports.NicePieChart=Ye;exports.NicePolarChart=Ve;exports.NiceRangeSelector=Ke;exports.NiceSankey=Se;exports.NiceSankey$1=Qe;exports.NiceSparkline=qe;exports.NiceStockChart=Te;exports.NiceTreeMap=De;exports.NiceVectorMap=Ce;exports.NiceVectorMap$1=et;exports.createMockLiveChartSource=Fe;exports.createSignalRLiveChartSource=He;exports.createWebSocketLiveChartSource=Ee;
|