@nice2dev/ui-bi 1.0.20 โ†’ 1.0.22

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.
@@ -4,5 +4,5 @@ import { NiceDashboardStudioProps } from './types';
4
4
  /**
5
5
  * NiceDashboardStudio - Dashboard Designer
6
6
  */
7
- export declare function NiceDashboardStudio({ dashboard: initialDashboard, dataSources, onChange, onWidgetAdd, onRefresh, className, }: NiceDashboardStudioProps): React.ReactElement;
7
+ export declare function NiceDashboardStudio({ dashboard: initialDashboard, dataSources, onChange, onWidgetAdd, onRefresh, className, tutorial, }: NiceDashboardStudioProps): React.ReactElement;
8
8
  export default NiceDashboardStudio;
@@ -4,5 +4,5 @@ import { NiceETLBuilderProps } from './types';
4
4
  /**
5
5
  * NiceETLBuilder - Visual ETL Pipeline Builder
6
6
  */
7
- export declare function NiceETLBuilder({ pipeline: initialPipeline, dataSources, onChange, onRun, onSchedule, className, }: NiceETLBuilderProps): React.ReactElement;
7
+ export declare function NiceETLBuilder({ pipeline: initialPipeline, dataSources, onChange, onRun, onSchedule, className, tutorial, }: NiceETLBuilderProps): React.ReactElement;
8
8
  export default NiceETLBuilder;
@@ -4,5 +4,5 @@ import { NiceReportBuilderProps } from './types';
4
4
  /**
5
5
  * NiceReportBuilder - Visual Report Designer
6
6
  */
7
- export declare function NiceReportBuilder({ report: initialReport, dataSources, onChange, onPreview, onExport, className, }: NiceReportBuilderProps): React.ReactElement;
7
+ export declare function NiceReportBuilder({ report: initialReport, dataSources, onChange, onPreview, onExport, className, tutorial, }: NiceReportBuilderProps): React.ReactElement;
8
8
  export default NiceReportBuilder;
package/dist/index.cjs CHANGED
@@ -1,2 +1,28 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),R={id:"",name:"New Report",dataSource:"",layout:{type:"table",elements:[],pageSize:"A4",orientation:"portrait"},parameters:[],filters:[],sorting:[],grouping:[],calculations:[],formatting:{conditionalFormats:[],alternateRowColors:!0,gridLines:!0}},$=[{type:"table",label:"Table",icon:"๐Ÿ“Š"},{type:"chart",label:"Chart",icon:"๐Ÿ“ˆ"},{type:"text",label:"Text",icon:"๐Ÿ“"},{type:"image",label:"Image",icon:"๐Ÿ–ผ๏ธ"},{type:"shape",label:"Shape",icon:"โฌœ"},{type:"barcode",label:"Barcode",icon:"โ–ฎโ–ฏโ–ฎ"},{type:"qrcode",label:"QR Code",icon:"โŠž"},{type:"subreport",label:"Subreport",icon:"๐Ÿ“‹"},{type:"page-break",label:"Page Break",icon:"๐Ÿ“„"}];function A({report:i,dataSources:n=[],onChange:r,onPreview:o,onExport:c,className:p=""}){const[s,g]=x.useState(i||{...R,id:crypto.randomUUID()}),[a,b]=x.useState(null),[j,h]=x.useState("design"),[_,k]=x.useState(null),[D,T]=x.useState(100),m=x.useCallback(t=>{g(u=>{const v=t(u);return r==null||r(v),v})},[r]),C=x.useCallback((t,u)=>{const v={id:crypto.randomUUID(),type:t,position:{x:u.x,y:u.y,width:200,height:t==="page-break"?20:100},config:V(t),style:{}};m(S=>({...S,layout:{...S.layout,elements:[...S.layout.elements,v]}})),b(v)},[m]),L=x.useCallback((t,u)=>{m(v=>({...v,layout:{...v.layout,elements:v.layout.elements.map(S=>S.id===t?{...S,...u}:S)}})),(a==null?void 0:a.id)===t&&b(v=>v?{...v,...u}:null)},[m,a]),N=x.useCallback(t=>{m(u=>({...u,layout:{...u.layout,elements:u.layout.elements.filter(v=>v.id!==t)}})),b(null)},[m]),w=x.useCallback(t=>{if(t.preventDefault(),!_)return;const u=t.currentTarget.getBoundingClientRect(),v=(t.clientX-u.left)*(100/D),S=(t.clientY-u.top)*(100/D);C(_,{x:v,y:S}),k(null)},[_,C,D]),M=x.useCallback(()=>{o==null||o(s)},[s,o]),E=x.useCallback(t=>{c==null||c(s,t)},[s,c]),d=n.find(t=>t.id===s.dataSource);return e.jsxs("div",{className:`nice-report-builder ${p}`,children:[e.jsxs("div",{className:"nice-report-builder__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:t=>m(u=>({...u,name:t.target.value})),className:"nice-report-builder__name-input"}),e.jsx("div",{className:"nice-report-builder__tabs",children:["design","data","parameters","formatting"].map(t=>e.jsx("button",{className:`nice-report-builder__tab ${j===t?"nice-report-builder__tab--active":""}`,onClick:()=>h(t),children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsxs("div",{className:"nice-report-builder__zoom",children:[e.jsx("button",{onClick:()=>T(t=>Math.max(25,t-25)),children:"โˆ’"}),e.jsxs("span",{children:[D,"%"]}),e.jsx("button",{onClick:()=>T(t=>Math.min(200,t+25)),children:"+"})]}),e.jsxs("div",{className:"nice-report-builder__actions",children:[e.jsx("button",{onClick:M,children:"๐Ÿ‘ Preview"}),e.jsx("button",{onClick:()=>E("pdf"),children:"๐Ÿ“„ PDF"}),e.jsx("button",{onClick:()=>E("excel"),children:"๐Ÿ“Š Excel"})]})]}),e.jsxs("div",{className:"nice-report-builder__main",children:[j==="design"&&e.jsxs("div",{className:"nice-report-builder__palette",children:[e.jsx("h4",{children:"Elements"}),$.map(t=>e.jsxs("div",{className:"nice-report-builder__palette-item",draggable:!0,onDragStart:()=>k(t.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-report-builder__palette-icon",children:t.icon}),e.jsx("span",{children:t.label})]},t.type)),e.jsx("h4",{children:"Data Source"}),e.jsxs("select",{value:s.dataSource,onChange:t=>m(u=>({...u,dataSource:t.target.value})),children:[e.jsx("option",{value:"",children:"Select data source..."}),n.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),(d==null?void 0:d.schema)&&e.jsxs("div",{className:"nice-report-builder__fields",children:[e.jsx("h5",{children:"Fields"}),d.schema.tables.map(t=>e.jsxs("div",{className:"nice-report-builder__table-fields",children:[e.jsx("strong",{children:t.name}),t.columns.map(u=>e.jsxs("div",{className:"nice-report-builder__field",draggable:!0,onDragStart:()=>{},children:[u.name," ",e.jsxs("small",{children:["(",u.type,")"]})]},u.name))]},t.name))]})]}),j==="design"&&e.jsx("div",{className:"nice-report-builder__canvas-container",children:e.jsxs("div",{className:"nice-report-builder__canvas",style:{transform:`scale(${D/100})`,transformOrigin:"top left",width:s.layout.orientation==="landscape"?"297mm":"210mm",height:s.layout.orientation==="landscape"?"210mm":"297mm"},onDragOver:t=>t.preventDefault(),onDrop:w,onClick:()=>b(null),children:[s.layout.elements.map(t=>e.jsx(q,{element:t,isSelected:(a==null?void 0:a.id)===t.id,onSelect:()=>b(t),onUpdate:u=>L(t.id,u),onDelete:()=>N(t.id)},t.id)),s.layout.elements.length===0&&e.jsx("div",{className:"nice-report-builder__canvas-empty",children:"Drag elements here to build your report"})]})}),j==="data"&&e.jsx(W,{report:s,dataSource:d,onChange:t=>m(u=>({...u,query:t}))}),j==="parameters"&&e.jsx(B,{parameters:s.parameters,calculations:s.calculations,onChange:(t,u)=>m(v=>({...v,parameters:t,calculations:u}))}),j==="formatting"&&e.jsx(Y,{formatting:s.formatting,grouping:s.grouping,sorting:s.sorting,onChange:(t,u,v)=>m(S=>({...S,formatting:t,grouping:u,sorting:v}))}),a&&j==="design"&&e.jsx(O,{element:a,dataSource:d,onChange:t=>L(a.id,t),onClose:()=>b(null)})]})]})}function V(i){switch(i){case"table":return{columns:[],showHeader:!0,showFooter:!1};case"chart":return{chartType:"bar",series:[],axes:[]};case"text":return{content:"Text",fontSize:12};case"image":return{src:"",fit:"contain"};case"shape":return{shape:"rectangle",fill:"var(--nice-border, #e0e0e0)",stroke:"var(--nice-text, #333)"};case"barcode":return{format:"CODE128",value:""};case"qrcode":return{value:""};case"subreport":return{reportId:""};case"page-break":return{};default:return{}}}function q({element:i,isSelected:n,onSelect:r,onUpdate:o,onDelete:c}){var T;const[p,s]=x.useState(!1),[g,a]=x.useState(!1),b=m=>{if(m.button!==0)return;m.stopPropagation(),r(),s(!0);const C=m.clientX,L=m.clientY,N={...i.position},w=E=>{const d=E.clientX-C,t=E.clientY-L;o({position:{...N,x:Math.max(0,N.x+d),y:Math.max(0,N.y+t)}})},M=()=>{s(!1),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",M)};window.addEventListener("mousemove",w),window.addEventListener("mouseup",M)},j=(m,C)=>{m.stopPropagation(),a(!0);const L=m.clientX,N=m.clientY,w={...i.position},M=d=>{const t=d.clientX-L,u=d.clientY-N,v={...w};C.includes("e")&&(v.width=Math.max(50,w.width+t)),C.includes("s")&&(v.height=Math.max(30,w.height+u)),C.includes("w")&&(v.x=w.x+t,v.width=Math.max(50,w.width-t)),C.includes("n")&&(v.y=w.y+u,v.height=Math.max(30,w.height-u)),o({position:v})},E=()=>{a(!1),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",E)},h=$.find(m=>m.type===i.type),{padding:_,...k}=i.style??{},D=typeof _=="object"&&_!==null?`${_.top}px ${_.right}px ${_.bottom}px ${_.left}px`:_;return e.jsxs("div",{className:`nice-report-builder__element nice-report-builder__element--${i.type} ${n?"nice-report-builder__element--selected":""}`,style:{left:i.position.x,top:i.position.y,width:i.position.width,height:i.position.height,...k,padding:D},onMouseDown:b,children:[e.jsxs("div",{className:"nice-report-builder__element-content",children:[e.jsx("span",{className:"nice-report-builder__element-icon",children:h==null?void 0:h.icon}),e.jsx("span",{className:"nice-report-builder__element-label",children:((T=i.binding)==null?void 0:T.field)||(h==null?void 0:h.label)})]}),n&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"nice-report-builder__element-delete",onClick:m=>{m.stopPropagation(),c()},children:"ร—"}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--se",onMouseDown:m=>j(m,"se")}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--e",onMouseDown:m=>j(m,"e")}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--s",onMouseDown:m=>j(m,"s")})]})]})}function W({report:i,dataSource:n,onChange:r}){var p,s,g,a;const[o,c]=x.useState("builder");return e.jsxs("div",{className:"nice-report-builder__query-builder",children:[e.jsxs("div",{className:"nice-report-builder__query-tabs",children:[e.jsx("button",{className:o==="builder"?"active":"",onClick:()=>c("builder"),children:"Query Builder"}),e.jsx("button",{className:o==="sql"?"active":"",onClick:()=>c("sql"),children:"SQL"})]}),o==="builder"?e.jsxs("div",{className:"nice-report-builder__visual-query",children:[e.jsx("h4",{children:"Tables"}),(p=n==null?void 0:n.schema)==null?void 0:p.tables.map(b=>{var j,h;return e.jsx("div",{className:"nice-report-builder__query-table",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:((h=(j=i.query)==null?void 0:j.tables)==null?void 0:h.includes(b.name))||!1,onChange:_=>{var D,T;const k=_.target.checked?[...((D=i.query)==null?void 0:D.tables)||[],b.name]:(((T=i.query)==null?void 0:T.tables)||[]).filter(m=>m!==b.name);r({...i.query,type:"builder",tables:k})}}),b.name]})},b.name)}),e.jsx("h4",{children:"Columns"}),e.jsx("div",{className:"nice-report-builder__column-list",children:(g=(s=i.query)==null?void 0:s.tables)==null?void 0:g.map(b=>{var h;const j=(h=n==null?void 0:n.schema)==null?void 0:h.tables.find(_=>_.name===b);return j==null?void 0:j.columns.map(_=>e.jsxs("div",{className:"nice-report-builder__column-item",children:[e.jsx("input",{type:"checkbox"}),e.jsxs("span",{children:[b,".",_.name]}),e.jsxs("select",{children:[e.jsx("option",{value:"",children:"No aggregate"}),e.jsx("option",{value:"sum",children:"SUM"}),e.jsx("option",{value:"avg",children:"AVG"}),e.jsx("option",{value:"count",children:"COUNT"}),e.jsx("option",{value:"min",children:"MIN"}),e.jsx("option",{value:"max",children:"MAX"})]})]},`${b}.${_.name}`))})})]}):e.jsx("div",{className:"nice-report-builder__sql-editor",children:e.jsx("textarea",{value:((a=i.query)==null?void 0:a.text)||"",onChange:b=>r({...i.query,type:"sql",text:b.target.value}),placeholder:"SELECT * FROM table_name",rows:15})})]})}function B({parameters:i,calculations:n,onChange:r}){const o=()=>{const p={id:crypto.randomUUID(),name:"param"+(i.length+1),label:"Parameter "+(i.length+1),type:"text"};r([...i,p],n)},c=()=>{const p={id:crypto.randomUUID(),name:"calc"+(n.length+1),expression:""};r(i,[...n,p])};return e.jsxs("div",{className:"nice-report-builder__parameters-editor",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"nice-report-builder__section-header",children:[e.jsx("h4",{children:"Parameters"}),e.jsx("button",{onClick:o,children:"+ Add"})]}),i.map((p,s)=>e.jsxs("div",{className:"nice-report-builder__param-row",children:[e.jsx("input",{type:"text",value:p.name,placeholder:"Name",onChange:g=>{const a=[...i];a[s]={...p,name:g.target.value},r(a,n)}}),e.jsx("input",{type:"text",value:p.label,placeholder:"Label",onChange:g=>{const a=[...i];a[s]={...p,label:g.target.value},r(a,n)}}),e.jsxs("select",{value:p.type,onChange:g=>{const a=[...i];a[s]={...p,type:g.target.value},r(a,n)},children:[e.jsx("option",{value:"text",children:"Text"}),e.jsx("option",{value:"number",children:"Number"}),e.jsx("option",{value:"date",children:"Date"}),e.jsx("option",{value:"daterange",children:"Date Range"}),e.jsx("option",{value:"select",children:"Select"}),e.jsx("option",{value:"multiselect",children:"Multi-select"})]}),e.jsx("button",{onClick:()=>{r(i.filter(g=>g.id!==p.id),n)},children:"ร—"})]},p.id))]}),e.jsxs("section",{children:[e.jsxs("div",{className:"nice-report-builder__section-header",children:[e.jsx("h4",{children:"Calculated Fields"}),e.jsx("button",{onClick:c,children:"+ Add"})]}),n.map((p,s)=>e.jsxs("div",{className:"nice-report-builder__calc-row",children:[e.jsx("input",{type:"text",value:p.name,placeholder:"Name",onChange:g=>{const a=[...n];a[s]={...p,name:g.target.value},r(i,a)}}),e.jsx("input",{type:"text",value:p.expression,placeholder:"Expression (e.g., [Sales] * [Quantity])",onChange:g=>{const a=[...n];a[s]={...p,expression:g.target.value},r(i,a)}}),e.jsx("button",{onClick:()=>{r(i,n.filter(g=>g.id!==p.id))},children:"ร—"})]},p.id))]})]})}function Y({formatting:i,grouping:n,sorting:r,onChange:o}){return e.jsxs("div",{className:"nice-report-builder__formatting-editor",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"General"}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:i.alternateRowColors,onChange:c=>o({...i,alternateRowColors:c.target.checked},n,r)}),"Alternate row colors"]}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:i.gridLines,onChange:c=>o({...i,gridLines:c.target.checked},n,r)}),"Show grid lines"]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Conditional Formatting"}),e.jsx("button",{onClick:()=>{const c={id:crypto.randomUUID(),condition:{column:"",operator:"gt",value:0},style:{backgroundColor:"#ffcccc"},scope:"cell"};o({...i,conditionalFormats:[...i.conditionalFormats,c]},n,r)},children:"+ Add Rule"}),i.conditionalFormats.map(c=>e.jsxs("div",{className:"nice-report-builder__format-rule",children:[e.jsxs("span",{children:["If column ",c.condition.operator," ",String(c.condition.value)]}),e.jsx("input",{type:"color",value:c.style.backgroundColor||"var(--nice-bg, #fff)",onChange:p=>{o({...i,conditionalFormats:i.conditionalFormats.map(s=>s.id===c.id?{...s,style:{...s.style,backgroundColor:p.target.value}}:s)},n,r)}})]},c.id))]})]})}function O({element:i,dataSource:n,onChange:r,onClose:o}){var c,p,s,g,a,b,j;return e.jsxs("div",{className:"nice-report-builder__properties",children:[e.jsxs("div",{className:"nice-report-builder__properties-header",children:[e.jsxs("h4",{children:[(c=$.find(h=>h.type===i.type))==null?void 0:c.label," Properties"]}),e.jsx("button",{onClick:o,children:"ร—"})]}),e.jsxs("div",{className:"nice-report-builder__properties-content",children:[e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Data Binding"}),e.jsxs("select",{value:((p=i.binding)==null?void 0:p.field)||"",onChange:h=>r({binding:{...i.binding,field:h.target.value}}),children:[e.jsx("option",{value:"",children:"None"}),(s=n==null?void 0:n.schema)==null?void 0:s.tables.flatMap(h=>h.columns.map(_=>e.jsxs("option",{value:`${h.name}.${_.name}`,children:[h.name,".",_.name]},`${h.name}.${_.name}`)))]})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Position"}),e.jsxs("div",{className:"nice-report-builder__position-inputs",children:[e.jsx("input",{type:"number",value:i.position.x,onChange:h=>r({position:{...i.position,x:parseInt(h.target.value,10)||0}}),placeholder:"X"}),e.jsx("input",{type:"number",value:i.position.y,onChange:h=>r({position:{...i.position,y:parseInt(h.target.value,10)||0}}),placeholder:"Y"}),e.jsx("input",{type:"number",value:i.position.width,onChange:h=>r({position:{...i.position,width:parseInt(h.target.value,10)||50}}),placeholder:"W"}),e.jsx("input",{type:"number",value:i.position.height,onChange:h=>r({position:{...i.position,height:parseInt(h.target.value,10)||30}}),placeholder:"H"})]})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Background Color"}),e.jsx("input",{type:"color",value:((g=i.style)==null?void 0:g.backgroundColor)||"var(--nice-bg, #fff)",onChange:h=>r({style:{...i.style,backgroundColor:h.target.value}})})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Border"}),e.jsxs("div",{className:"nice-report-builder__border-inputs",children:[e.jsx("input",{type:"color",value:((a=i.style)==null?void 0:a.borderColor)||"var(--nice-text, #000000)",onChange:h=>r({style:{...i.style,borderColor:h.target.value}})}),e.jsx("input",{type:"number",value:((b=i.style)==null?void 0:b.borderWidth)||0,onChange:h=>r({style:{...i.style,borderWidth:parseInt(h.target.value,10)||0}}),placeholder:"Width",min:0,max:10})]})]}),i.type==="text"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:i.config.content||"",onChange:h=>r({config:{...i.config,content:h.target.value}}),rows:3})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Font Size"}),e.jsx("input",{type:"number",value:((j=i.style)==null?void 0:j.fontSize)||12,onChange:h=>r({style:{...i.style,fontSize:parseInt(h.target.value,10)||12}}),min:8,max:72})]})]}),i.type==="chart"&&e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:i.config.chartType||"bar",onChange:h=>r({config:{...i.config,chartType:h.target.value}}),children:[e.jsx("option",{value:"bar",children:"Bar"}),e.jsx("option",{value:"line",children:"Line"}),e.jsx("option",{value:"pie",children:"Pie"}),e.jsx("option",{value:"area",children:"Area"}),e.jsx("option",{value:"scatter",children:"Scatter"})]})]})]})]})}const X={id:"",name:"New Dashboard",layout:{type:"grid",columns:12,rowHeight:50,gap:8},widgets:[],filters:[]},I=[{type:"chart",label:"Chart",icon:"๐Ÿ“ˆ",category:"Visualization"},{type:"table",label:"Table",icon:"๐Ÿ“Š",category:"Visualization"},{type:"card",label:"KPI Card",icon:"๐ŸŽฏ",category:"Visualization"},{type:"gauge",label:"Gauge",icon:"โฑ๏ธ",category:"Visualization"},{type:"map",label:"Map",icon:"๐Ÿ—บ๏ธ",category:"Visualization"},{type:"treemap",label:"Treemap",icon:"๐ŸŒณ",category:"Visualization"},{type:"funnel",label:"Funnel",icon:"๐Ÿ”ป",category:"Visualization"},{type:"heatmap",label:"Heatmap",icon:"๐ŸŒก๏ธ",category:"Visualization"},{type:"timeline",label:"Timeline",icon:"๐Ÿ“…",category:"Visualization"},{type:"sankey",label:"Sankey",icon:"ใ€ฐ๏ธ",category:"Visualization"},{type:"filter",label:"Filter",icon:"๐Ÿ”",category:"Controls"},{type:"slicer",label:"Slicer",icon:"๐Ÿ“‹",category:"Controls"},{type:"text",label:"Text",icon:"๐Ÿ“",category:"Layout"},{type:"image",label:"Image",icon:"๐Ÿ–ผ๏ธ",category:"Layout"}];function H({dashboard:i,dataSources:n=[],onChange:r,onWidgetAdd:o,onRefresh:c,className:p=""}){const[s,g]=x.useState(i||{...X,id:crypto.randomUUID()}),[a,b]=x.useState(null),[j,h]=x.useState(!0),[_,k]=x.useState(null),[D,T]=x.useState(!0),m=x.useRef(null),C=x.useCallback(d=>{g(t=>{const u=d(t);return r==null||r(u),u})},[r]),L=x.useCallback((d,t)=>{var v;const u={id:crypto.randomUUID(),type:d,title:((v=I.find(S=>S.type===d))==null?void 0:v.label)||d,position:{x:(t==null?void 0:t.x)??0,y:(t==null?void 0:t.y)??G(s.widgets),width:(t==null?void 0:t.width)??Q(d),height:(t==null?void 0:t.height)??K(d)},config:J(d)};C(S=>({...S,widgets:[...S.widgets,u]})),b(u),o==null||o(d)},[s.widgets,C,o]),N=x.useCallback((d,t)=>{C(u=>({...u,widgets:u.widgets.map(v=>v.id===d?{...v,...t}:v)})),(a==null?void 0:a.id)===d&&b(u=>u?{...u,...t}:null)},[C,a]),w=x.useCallback(d=>{C(t=>({...t,widgets:t.widgets.filter(u=>u.id!==d)})),b(null)},[C]),M=x.useCallback(d=>{if(d.preventDefault(),!_||!m.current)return;const t=m.current.getBoundingClientRect(),u=t.width/(s.layout.columns||12),v=Math.floor((d.clientX-t.left)/u),S=Math.floor((d.clientY-t.top)/(s.layout.rowHeight||50));L(_,{x:v,y:S}),k(null)},[_,s.layout,L]),E=x.useCallback(()=>{c==null||c()},[c]);return e.jsxs("div",{className:`nice-dashboard-studio ${p}`,children:[e.jsxs("div",{className:"nice-dashboard-studio__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:d=>C(t=>({...t,name:d.target.value})),className:"nice-dashboard-studio__name-input",disabled:!j}),e.jsxs("div",{className:"nice-dashboard-studio__actions",children:[e.jsx("button",{className:`nice-dashboard-studio__action ${j?"active":""}`,onClick:()=>h(!j),children:j?"โœ๏ธ Editing":"๐Ÿ‘ Viewing"}),e.jsxs("button",{onClick:()=>T(!D),children:["๐Ÿ” Filters ",D?"โ–ฒ":"โ–ผ"]}),e.jsx("button",{onClick:E,children:"๐Ÿ”„ Refresh"}),e.jsx("button",{children:"๐Ÿ“ค Share"}),e.jsx("button",{children:"๐Ÿ’พ Save"})]})]}),D&&s.filters.length>0&&e.jsx("div",{className:"nice-dashboard-studio__filters-bar",children:s.filters.map(d=>e.jsx(ie,{filter:d},d.id))}),e.jsxs("div",{className:"nice-dashboard-studio__main",children:[j&&e.jsxs("div",{className:"nice-dashboard-studio__palette",children:[e.jsx("h4",{children:"Widgets"}),["Visualization","Controls","Layout"].map(d=>e.jsxs("div",{className:"nice-dashboard-studio__category",children:[e.jsx("h5",{children:d}),I.filter(t=>t.category===d).map(t=>e.jsxs("div",{className:"nice-dashboard-studio__palette-item",draggable:!0,onDragStart:()=>k(t.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-dashboard-studio__palette-icon",children:t.icon}),e.jsx("span",{children:t.label})]},t.type))]},d)),e.jsx("h4",{children:"Data Sources"}),n.map(d=>e.jsx("div",{className:"nice-dashboard-studio__datasource",children:e.jsxs("span",{children:["๐Ÿ—„๏ธ ",d.name]})},d.id))]}),e.jsxs("div",{ref:m,className:`nice-dashboard-studio__grid ${j?"nice-dashboard-studio__grid--editing":""}`,style:{"--columns":s.layout.columns||12,"--row-height":`${s.layout.rowHeight||50}px`,"--gap":`${s.layout.gap||8}px`},onDragOver:d=>d.preventDefault(),onDrop:M,onClick:()=>b(null),children:[s.widgets.map(d=>e.jsx(Z,{widget:d,isSelected:(a==null?void 0:a.id)===d.id,isEditing:j,onSelect:()=>b(d),onUpdate:t=>N(d.id,t),onDelete:()=>w(d.id)},d.id)),s.widgets.length===0&&j&&e.jsx("div",{className:"nice-dashboard-studio__empty",children:"Drag widgets from the palette to build your dashboard"})]}),a&&j&&e.jsx(te,{widget:a,dataSources:n,onChange:d=>N(a.id,d),onClose:()=>b(null)})]})]})}function G(i){return i.length===0?0:Math.max(...i.map(n=>n.position.y+n.position.height))}function Q(i){switch(i){case"card":return 3;case"gauge":return 3;case"filter":case"slicer":return 3;case"text":return 4;case"chart":case"table":return 6;case"map":return 8;default:return 4}}function K(i){switch(i){case"card":return 2;case"gauge":return 3;case"filter":case"slicer":return 1;case"text":return 2;case"chart":case"table":return 5;case"map":return 8;default:return 4}}function J(i){switch(i){case"chart":return{chartType:"bar",series:[],axes:[],legend:{show:!0,position:"bottom"}};case"table":return{columns:[],pageSize:10};case"card":return{value:"",label:"",format:"number",icon:"๐Ÿ“Š"};case"gauge":return{value:"0",min:0,max:100,target:75,format:"percent"};case"map":return{type:"choropleth",geoField:"",valueField:""};case"filter":return{field:"",type:"dropdown"};case"slicer":return{field:"",multiSelect:!0};case"text":return{content:"Text content",fontSize:14};case"image":return{src:"",fit:"contain"};default:return{}}}function Z({widget:i,isSelected:n,isEditing:r,onSelect:o,onUpdate:c,onDelete:p}){const s=a=>{if(!r||a.button!==0)return;a.stopPropagation(),o();const b=a.clientX,j=a.clientY,h={...i.position},_=D=>{const T=Math.round((D.clientX-b)/50),m=Math.round((D.clientY-j)/50);c({position:{...h,x:Math.max(0,h.x+T),y:Math.max(0,h.y+m)}})},k=()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",k)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",k)},g=I.find(a=>a.type===i.type);return e.jsxs("div",{className:`nice-dashboard-studio__widget nice-dashboard-studio__widget--${i.type} ${n?"nice-dashboard-studio__widget--selected":""}`,style:{gridColumn:`${i.position.x+1} / span ${i.position.width}`,gridRow:`${i.position.y+1} / span ${i.position.height}`},onMouseDown:s,children:[e.jsxs("div",{className:"nice-dashboard-studio__widget-header",children:[e.jsx("span",{className:"nice-dashboard-studio__widget-icon",children:g==null?void 0:g.icon}),e.jsx("span",{className:"nice-dashboard-studio__widget-title",children:i.title}),r&&e.jsx("button",{className:"nice-dashboard-studio__widget-delete",onClick:a=>{a.stopPropagation(),p()},children:"ร—"})]}),e.jsx("div",{className:"nice-dashboard-studio__widget-content",children:e.jsx(ee,{widget:i})})]})}function ee({widget:i}){switch(i.type){case"card":return e.jsxs("div",{className:"nice-dashboard-studio__card",children:[e.jsx("div",{className:"nice-dashboard-studio__card-value",children:String(i.config.value||"0")}),e.jsx("div",{className:"nice-dashboard-studio__card-label",children:String(i.config.label||"Label")})]});case"gauge":{const n=Number(i.config.value)||0,r=Number(i.config.max)||100,o=n/r*100;return e.jsx("div",{className:"nice-dashboard-studio__gauge",children:e.jsxs("svg",{viewBox:"0 0 100 60",children:[e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-border, #e0e0e0)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-primary, #0066cc)",strokeWidth:"8",strokeDasharray:`${o*1.26} 126`}),e.jsxs("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"16",fontWeight:"bold",children:[n,"%"]})]})})}case"chart":return e.jsxs("div",{className:"nice-dashboard-studio__chart-placeholder",children:[e.jsx("span",{children:"๐Ÿ“Š"}),e.jsxs("span",{children:[String(i.config.chartType||"bar")," chart"]})]});case"table":return e.jsxs("div",{className:"nice-dashboard-studio__table-placeholder",children:[e.jsx("span",{children:"๐Ÿ“‹"}),e.jsx("span",{children:"Data table"})]});case"map":return e.jsxs("div",{className:"nice-dashboard-studio__map-placeholder",children:[e.jsx("span",{children:"๐Ÿ—บ๏ธ"}),e.jsx("span",{children:"Map visualization"})]});case"text":return e.jsx("div",{className:"nice-dashboard-studio__text",style:{fontSize:Number(i.config.fontSize)||14},children:String(i.config.content||"")});default:return e.jsx("div",{className:"nice-dashboard-studio__widget-placeholder",children:i.type})}}function ie({filter:i}){const[n,r]=x.useState(i.defaultValue);switch(i.type){case"dropdown":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:i.label}),e.jsx("select",{value:String(n||""),onChange:o=>r(o.target.value),children:e.jsx("option",{value:"",children:"All"})})]});case"daterange":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:i.label}),e.jsx("input",{type:"date"}),e.jsx("span",{children:"to"}),e.jsx("input",{type:"date"})]});case"slider":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:i.label}),e.jsx("input",{type:"range"})]});default:return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:i.label}),e.jsx("input",{type:"text",value:String(n||""),onChange:o=>r(o.target.value)})]})}}function te({widget:i,dataSources:n,onChange:r,onClose:o}){return e.jsxs("div",{className:"nice-dashboard-studio__properties",children:[e.jsxs("div",{className:"nice-dashboard-studio__properties-header",children:[e.jsx("h4",{children:"Widget Properties"}),e.jsx("button",{onClick:o,children:"ร—"})]}),e.jsxs("div",{className:"nice-dashboard-studio__properties-content",children:[e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Title"}),e.jsx("input",{type:"text",value:i.title||"",onChange:c=>r({title:c.target.value})})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Data Source"}),e.jsxs("select",{value:i.dataSource||"",onChange:c=>r({dataSource:c.target.value}),children:[e.jsx("option",{value:"",children:"Select..."}),n.map(c=>e.jsx("option",{value:c.id,children:c.name},c.id))]})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Size"}),e.jsxs("div",{className:"nice-dashboard-studio__size-inputs",children:[e.jsx("input",{type:"number",value:i.position.width,onChange:c=>r({position:{...i.position,width:parseInt(c.target.value,10)||1}}),min:1,max:12}),e.jsx("span",{children:"ร—"}),e.jsx("input",{type:"number",value:i.position.height,onChange:c=>r({position:{...i.position,height:parseInt(c.target.value,10)||1}}),min:1,max:20})]})]}),i.type==="chart"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:String(i.config.chartType||"bar"),onChange:c=>r({config:{...i.config,chartType:c.target.value}}),children:[e.jsx("option",{value:"bar",children:"Bar"}),e.jsx("option",{value:"line",children:"Line"}),e.jsx("option",{value:"pie",children:"Pie"}),e.jsx("option",{value:"area",children:"Area"}),e.jsx("option",{value:"scatter",children:"Scatter"}),e.jsx("option",{value:"donut",children:"Donut"})]})]}),i.type==="card"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Value Field"}),e.jsx("input",{type:"text",value:String(i.config.value||""),onChange:c=>r({config:{...i.config,value:c.target.value}}),placeholder:"e.g., SUM(Sales)"})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Label"}),e.jsx("input",{type:"text",value:String(i.config.label||""),onChange:c=>r({config:{...i.config,label:c.target.value}})})]})]}),i.type==="text"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:String(i.config.content||""),onChange:c=>r({config:{...i.config,content:c.target.value}}),rows:4})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Refresh Interval (seconds)"}),e.jsx("input",{type:"number",value:i.refreshInterval||0,onChange:c=>r({refreshInterval:parseInt(c.target.value,10)||0}),min:0,placeholder:"0 = manual"})]})]})]})}const se={id:"",name:"New Pipeline",sources:[],transformations:[],destinations:[],version:1},U=[{type:"filter",label:"Filter",icon:"๐Ÿ”"},{type:"map",label:"Map",icon:"๐Ÿ”„"},{type:"aggregate",label:"Aggregate",icon:"โˆ‘"},{type:"join",label:"Join",icon:"๐Ÿ”—"},{type:"union",label:"Union",icon:"โˆช"},{type:"sort",label:"Sort",icon:"โ†•๏ธ"},{type:"deduplicate",label:"Deduplicate",icon:"๐Ÿ”ฒ"},{type:"pivot",label:"Pivot",icon:"โคข"},{type:"unpivot",label:"Unpivot",icon:"โคก"},{type:"split",label:"Split",icon:"โœ‚๏ธ"},{type:"merge",label:"Merge",icon:"๐Ÿ”€"},{type:"lookup",label:"Lookup",icon:"๐Ÿ“–"},{type:"derive",label:"Derive Column",icon:"โž•"},{type:"validate",label:"Validate",icon:"โœ“"},{type:"cleanse",label:"Cleanse",icon:"๐Ÿงน"},{type:"custom",label:"Custom",icon:"ฦ’"}];function ne({pipeline:i,dataSources:n=[],onChange:r,onRun:o,onSchedule:c,className:p=""}){const[s,g]=x.useState(i||{...se,id:crypto.randomUUID()}),[a,b]=x.useState(null),[j,h]=x.useState("design"),[_,k]=x.useState(!1),[D,T]=x.useState([]),[m,C]=x.useState(null),L=x.useRef(null),N=x.useCallback(l=>{g(y=>{const f=l(y);return r==null||r(f),f})},[r]),w=x.useCallback(l=>{var f;const y={id:crypto.randomUUID(),type:l.type,name:l.name,config:l.config,schema:(f=l.schema)==null?void 0:f.tables[0]};N(P=>({...P,sources:[...P.sources,y]}))},[N]),M=x.useCallback((l,y)=>{var P;const f={id:crypto.randomUUID(),type:l,name:((P=U.find(F=>F.type===l))==null?void 0:P.label)||l,input:[],output:crypto.randomUUID(),config:ae(l)};N(F=>({...F,transformations:[...F.transformations,f]})),b({type:"transformation",id:f.id})},[N]),E=x.useCallback(()=>{const l={id:crypto.randomUUID(),type:"database",name:"New Destination",config:{},writeMode:"append"};N(y=>({...y,destinations:[...y.destinations,l]})),b({type:"destination",id:l.id})},[N]),d=x.useCallback((l,y)=>{N(f=>{switch(l){case"source":return{...f,sources:f.sources.filter(P=>P.id!==y)};case"transformation":return{...f,transformations:f.transformations.filter(P=>P.id!==y)};case"destination":return{...f,destinations:f.destinations.filter(P=>P.id!==y)};default:return f}}),b(null)},[N]),t=x.useCallback(async()=>{if(o){k(!0);try{const l=await o(s);T(y=>[l,...y].slice(0,50))}finally{k(!1)}}},[s,o]),u=x.useCallback(l=>{N(y=>({...y,schedule:l})),c==null||c(s,l)},[s,N,c]),v=x.useCallback(l=>{if(l.preventDefault(),!!m){if(m.startsWith("transform:")){const y=m.replace("transform:","");M(y)}C(null)}},[m,M]),S=()=>{if(!a)return null;switch(a.type){case"source":return s.sources.find(l=>l.id===a.id);case"transformation":return s.transformations.find(l=>l.id===a.id);case"destination":return s.destinations.find(l=>l.id===a.id);default:return null}};return e.jsxs("div",{className:`nice-etl-builder ${p}`,children:[e.jsxs("div",{className:"nice-etl-builder__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:l=>N(y=>({...y,name:l.target.value})),className:"nice-etl-builder__name-input"}),e.jsx("div",{className:"nice-etl-builder__tabs",children:["design","code","schedule","history"].map(l=>e.jsx("button",{className:`nice-etl-builder__tab ${j===l?"nice-etl-builder__tab--active":""}`,onClick:()=>h(l),children:l.charAt(0).toUpperCase()+l.slice(1)},l))}),e.jsxs("div",{className:"nice-etl-builder__actions",children:[e.jsx("button",{onClick:t,disabled:_,className:"nice-etl-builder__run-btn",children:_?"โณ Running...":"โ–ถ Run"}),e.jsx("button",{className:"nice-etl-builder__save-btn",children:"๐Ÿ’พ Save"})]})]}),e.jsxs("div",{className:"nice-etl-builder__main",children:[j==="design"&&e.jsxs("div",{className:"nice-etl-builder__palette",children:[e.jsx("h4",{children:"Sources"}),n.map(l=>e.jsxs("div",{className:"nice-etl-builder__palette-item",onClick:()=>w(l),children:[e.jsx("span",{className:"nice-etl-builder__palette-icon",children:"๐Ÿ—„๏ธ"}),e.jsx("span",{children:l.name})]},l.id)),e.jsx("button",{onClick:()=>w({id:"",name:"New Source",type:"database",config:{}}),children:"+ Add Source"}),e.jsx("h4",{children:"Transformations"}),U.map(l=>e.jsxs("div",{className:"nice-etl-builder__palette-item",draggable:!0,onDragStart:()=>C(`transform:${l.type}`),onDragEnd:()=>C(null),children:[e.jsx("span",{className:"nice-etl-builder__palette-icon",children:l.icon}),e.jsx("span",{children:l.label})]},l.type)),e.jsx("h4",{children:"Destinations"}),e.jsx("button",{onClick:E,children:"+ Add Destination"})]}),j==="design"&&e.jsx("div",{ref:L,className:"nice-etl-builder__canvas",onDragOver:l=>l.preventDefault(),onDrop:v,onClick:()=>b(null),children:e.jsxs("div",{className:"nice-etl-builder__flow",children:[e.jsxs("div",{className:"nice-etl-builder__column",children:[e.jsx("h5",{children:"Sources"}),s.sources.map(l=>e.jsx(z,{node:l,nodeType:"source",icon:"๐Ÿ—„๏ธ",isSelected:(a==null?void 0:a.id)===l.id,onSelect:()=>b({type:"source",id:l.id}),onDelete:()=>d("source",l.id)},l.id))]}),e.jsx("div",{className:"nice-etl-builder__arrow",children:"โ†’"}),e.jsxs("div",{className:"nice-etl-builder__column nice-etl-builder__column--transforms",children:[e.jsx("h5",{children:"Transformations"}),s.transformations.map(l=>{const y=U.find(f=>f.type===l.type);return e.jsx(z,{node:l,nodeType:"transformation",icon:(y==null?void 0:y.icon)||"๐Ÿ”„",isSelected:(a==null?void 0:a.id)===l.id,onSelect:()=>b({type:"transformation",id:l.id}),onDelete:()=>d("transformation",l.id)},l.id)}),s.transformations.length===0&&e.jsx("div",{className:"nice-etl-builder__empty-column",children:"Drag transformations here"})]}),e.jsx("div",{className:"nice-etl-builder__arrow",children:"โ†’"}),e.jsxs("div",{className:"nice-etl-builder__column",children:[e.jsx("h5",{children:"Destinations"}),s.destinations.map(l=>e.jsx(z,{node:l,nodeType:"destination",icon:"๐Ÿ“ฅ",isSelected:(a==null?void 0:a.id)===l.id,onSelect:()=>b({type:"destination",id:l.id}),onDelete:()=>d("destination",l.id)},l.id))]})]})}),j==="code"&&e.jsx("div",{className:"nice-etl-builder__code-view",children:e.jsx("pre",{children:JSON.stringify(s,null,2)})}),j==="schedule"&&e.jsx(re,{schedule:s.schedule,monitoring:s.monitoring,onChange:u}),j==="history"&&e.jsx(ce,{runs:D}),a&&j==="design"&&e.jsx(le,{nodeType:a.type,node:S()??null,dataSources:n,onChange:l=>{N(y=>{switch(a.type){case"source":return{...y,sources:y.sources.map(f=>f.id===a.id?{...f,...l}:f)};case"transformation":return{...y,transformations:y.transformations.map(f=>f.id===a.id?{...f,...l}:f)};case"destination":return{...y,destinations:y.destinations.map(f=>f.id===a.id?{...f,...l}:f)};default:return y}})},onClose:()=>b(null)})]})]})}function ae(i){switch(i){case"filter":return{condition:""};case"map":return{mappings:[]};case"aggregate":return{groupBy:[],aggregations:[]};case"join":return{joinType:"inner",leftKey:"",rightKey:""};case"union":return{inputs:[]};case"sort":return{columns:[],directions:[]};case"deduplicate":return{columns:[],keepFirst:!0};case"pivot":return{pivotColumn:"",valueColumn:"",aggregation:"sum"};case"unpivot":return{columns:[],nameColumn:"name",valueColumn:"value"};case"derive":return{name:"",expression:""};case"validate":return{rules:[]};case"cleanse":return{operations:[]};case"custom":return{code:`// Custom transformation
2
- return data;`};default:return{}}}function z({node:i,nodeType:n,icon:r,isSelected:o,onSelect:c,onDelete:p}){return e.jsxs("div",{className:`nice-etl-builder__node nice-etl-builder__node--${n} ${o?"nice-etl-builder__node--selected":""}`,onClick:s=>{s.stopPropagation(),c()},children:[e.jsx("span",{className:"nice-etl-builder__node-icon",children:r}),e.jsx("span",{className:"nice-etl-builder__node-name",children:i.name}),e.jsx("button",{className:"nice-etl-builder__node-delete",onClick:s=>{s.stopPropagation(),p()},children:"ร—"})]})}function le({nodeType:i,node:n,dataSources:r,onChange:o,onClose:c}){var p;return n?e.jsxs("div",{className:"nice-etl-builder__properties",children:[e.jsxs("div",{className:"nice-etl-builder__properties-header",children:[e.jsxs("h4",{children:[i.charAt(0).toUpperCase()+i.slice(1)," Properties"]}),e.jsx("button",{onClick:c,children:"ร—"})]}),e.jsxs("div",{className:"nice-etl-builder__properties-content",children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Name"}),e.jsx("input",{type:"text",value:n.name,onChange:s=>o({name:s.target.value})})]}),i==="source"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsxs("select",{value:n.type,onChange:s=>o({type:s.target.value}),children:[e.jsx("option",{value:"database",children:"Database"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"file",children:"File"}),e.jsx("option",{value:"stream",children:"Stream"})]})]}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:((p=n.incremental)==null?void 0:p.enabled)||!1,onChange:s=>{var g;return o({incremental:{...n.incremental,enabled:s.target.checked,column:((g=n.incremental)==null?void 0:g.column)||""}})}}),"Incremental Load"]})})]}),i==="transformation"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsx("span",{children:n.type})]}),n.type==="filter"&&e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Condition"}),e.jsx("textarea",{value:String(n.config.condition||""),onChange:s=>o({config:{...n.config,condition:s.target.value}}),placeholder:"e.g., age > 18 AND status = 'active'",rows:3})]}),n.type==="derive"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Column Name"}),e.jsx("input",{type:"text",value:String(n.config.name||""),onChange:s=>o({config:{...n.config,name:s.target.value}})})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Expression"}),e.jsx("input",{type:"text",value:String(n.config.expression||""),onChange:s=>o({config:{...n.config,expression:s.target.value}}),placeholder:"e.g., price * quantity"})]})]}),n.type==="custom"&&e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Code"}),e.jsx("textarea",{value:String(n.config.code||""),onChange:s=>o({config:{...n.config,code:s.target.value}}),rows:10,className:"nice-etl-builder__code-input"})]})]}),i==="destination"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsxs("select",{value:n.type,onChange:s=>o({type:s.target.value}),children:[e.jsx("option",{value:"database",children:"Database"}),e.jsx("option",{value:"file",children:"File"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"warehouse",children:"Data Warehouse"})]})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Write Mode"}),e.jsxs("select",{value:n.writeMode,onChange:s=>o({writeMode:s.target.value}),children:[e.jsx("option",{value:"append",children:"Append"}),e.jsx("option",{value:"overwrite",children:"Overwrite"}),e.jsx("option",{value:"upsert",children:"Upsert"}),e.jsx("option",{value:"merge",children:"Merge"})]})]})]})]})]}):e.jsx(e.Fragment,{})}function re({schedule:i,monitoring:n,onChange:r}){const[o,c]=x.useState(i||{enabled:!1});return e.jsxs("div",{className:"nice-etl-builder__schedule-editor",children:[e.jsx("h4",{children:"Schedule Configuration"}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:o.enabled,onChange:p=>{const s={...o,enabled:p.target.checked};c(s),r(s)}}),"Enable scheduled execution"]})}),o.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Cron Expression"}),e.jsx("input",{type:"text",value:o.cron||"",onChange:p=>{const s={...o,cron:p.target.value};c(s)},placeholder:"0 0 * * * (every hour)"}),e.jsx("small",{children:"Format: minute hour day month weekday"})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Timezone"}),e.jsxs("select",{value:o.timezone||"UTC",onChange:p=>{const s={...o,timezone:p.target.value};c(s)},children:[e.jsx("option",{value:"UTC",children:"UTC"}),e.jsx("option",{value:"America/New_York",children:"Eastern Time"}),e.jsx("option",{value:"America/Chicago",children:"Central Time"}),e.jsx("option",{value:"America/Los_Angeles",children:"Pacific Time"}),e.jsx("option",{value:"Europe/London",children:"London"}),e.jsx("option",{value:"Europe/Warsaw",children:"Warsaw"})]})]}),e.jsx("button",{onClick:()=>r(o),children:"Save Schedule"})]}),e.jsx("h4",{children:"Monitoring"}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:(n==null?void 0:n.alertOnFailure)||!1,disabled:!0}),"Alert on failure"]})}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Log Level"}),e.jsxs("select",{value:(n==null?void 0:n.logLevel)||"info",disabled:!0,children:[e.jsx("option",{value:"error",children:"Error"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"debug",children:"Debug"})]})]})]})}function ce({runs:i}){return e.jsxs("div",{className:"nice-etl-builder__history-view",children:[e.jsx("h4",{children:"Run History"}),i.length===0?e.jsx("div",{className:"nice-etl-builder__no-history",children:"No runs yet"}):e.jsxs("table",{className:"nice-etl-builder__history-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Start Time"}),e.jsx("th",{children:"Duration"}),e.jsx("th",{children:"Rows"}),e.jsx("th",{children:"Errors"})]})}),e.jsx("tbody",{children:i.map(n=>e.jsxs("tr",{className:`nice-etl-builder__run nice-etl-builder__run--${n.status}`,children:[e.jsx("td",{children:e.jsxs("span",{className:`nice-etl-builder__status nice-etl-builder__status--${n.status}`,children:[n.status==="success"?"โœ“":n.status==="failed"?"โœ—":"โณ",n.status]})}),e.jsx("td",{children:n.startTime.toLocaleString()}),e.jsx("td",{children:n.endTime?`${Math.round((n.endTime.getTime()-n.startTime.getTime())/1e3)}s`:"-"}),e.jsxs("td",{children:[n.rowsProcessed.toLocaleString()," / ",n.rowsWritten.toLocaleString()]}),e.jsx("td",{children:n.errors.length})]},n.id))})]})]})}exports.NiceDashboardStudio=H;exports.NiceETLBuilder=ne;exports.NiceReportBuilder=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),ee=(r,a)=>a,re=m.createContext(ee);function ae(){return{t:m.useContext(re)}}m.createContext({dir:"ltr",isRTL:!1,flip:r=>r,value:r=>r.ltr});m.createContext(null);m.createContext(null);const ie={radius:"md",shadow:"md",fill:"solid",buttonStyle:"flat",inputStyle:"bordered",cardStyle:"elevated",badgeStyle:"solid",tabStyle:"underline",toggleStyle:"default",tooltipStyle:"dark",modalStyle:"default",tableStyle:"default",menuStyle:"default",animation:"normal",density:"normal"};m.createContext({displayStyle:"default",variantConfig:ie,setDisplayStyle:()=>{}});m.createContext({});m.createContext({direction:"ltr",isRTL:!1,flip:r=>r,flipStyle:(r,a)=>({[r]:a})});m.createContext({permissions:{},getAccessMode:()=>"full"});m.createContext(null);const te=process.env.NODE_ENV==="development";let Y={enabled:te,slowRenderThreshold:16};const X=[],B=new Map,K=new Map;function ne(){X.length=0,B.clear(),K.clear()}function se(r){const a=Y.slowRenderThreshold;return X.filter(i=>i.actualDuration>a)}function z(r){return r<1?`${(r*1e3).toFixed(0)}ฮผs`:r<1e3?`${r.toFixed(2)}ms`:`${(r/1e3).toFixed(2)}s`}function ce(){const r=Array.from(B.values()),a=se(),i=r.reduce((f,p)=>f+p.renderCount,0),o=r.length>0?r.reduce((f,p)=>f+p.avgRenderTime,0)/r.length:0,n=Array.from(K.values());return{stats:r,slowRenders:a,totalRenders:i,avgRenderTime:o,marks:n}}function oe(){const r=ce();console.group("%c[Nice2Dev Performance Report]","color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"),console.log(`Total renders: ${r.totalRenders}`),console.log(`Average render time: ${z(r.avgRenderTime)}`),console.log(`Slow renders: ${r.slowRenders.length}`),console.group("Component Stats"),console.table(r.stats.sort((a,i)=>i.totalRenderTime-a.totalRenderTime).map(a=>({Name:a.componentName,Renders:a.renderCount,"Avg Time":z(a.avgRenderTime),"Max Time":z(a.maxRenderTime),"Total Time":z(a.totalRenderTime),"Slow Renders":a.slowRenderCount}))),console.groupEnd(),r.slowRenders.length>0&&(console.group("Slow Renders (last 10)"),console.table(r.slowRenders.slice(-10).map(a=>({Component:a.componentName,Phase:a.phase,Duration:z(a.actualDuration),Time:new Date(a.timestamp).toLocaleTimeString()}))),console.groupEnd()),r.marks.length>0&&(console.group("Custom Marks"),console.table(r.marks.filter(a=>a.duration).map(a=>({Name:a.name,Duration:z(a.duration)}))),console.groupEnd()),console.groupEnd()}const de=m.memo(({position:r="bottom-right",defaultCollapsed:a=!0})=>{const[i,o]=m.useState(a),[n,f]=m.useState([]),[p,s]=m.useState({used:0,total:0});if(m.useEffect(()=>{const c=()=>{const d=Array.from(B.values());f(d.sort((H,k)=>k.totalRenderTime-H.totalRenderTime).slice(0,10));const v=window.performance;v.memory&&s({used:v.memory.usedJSHeapSize/1024/1024,total:v.memory.totalJSHeapSize/1024/1024})};c();const h=setInterval(c,2e3);return()=>clearInterval(h)},[]),!Y.enabled)return null;const x={position:"fixed",zIndex:99999,...r.includes("top")?{top:8}:{bottom:8},...r.includes("left")?{left:8}:{right:8}};return e.jsxs("div",{style:{...x,background:"var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",color:"var(--bg-primary, #fff)",borderRadius:8,fontSize:11,fontFamily:"Monaco, Consolas, monospace",padding:i?"4px 8px":8,maxWidth:i?"auto":300,maxHeight:i?"auto":400,overflow:"auto"},children:[e.jsxs("div",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:8},onClick:()=>o(c=>!c),children:[e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:"โ—"}),e.jsx("span",{children:"Profiler"}),p.used>0&&e.jsxs("span",{style:{color:p.used>100?"var(--color-warning, #f59e0b)":"var(--text-muted, #64748b)"},children:[p.used.toFixed(0),"MB"]}),e.jsx("span",{style:{marginLeft:"auto",opacity:.5},children:i?"โ–ผ":"โ–ฒ"})]}),!i&&e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{style:{borderBottom:"1px solid var(--border-color, #333)",paddingBottom:4,marginBottom:8},children:e.jsx("strong",{children:"Top Components"})}),n.map(c=>e.jsxs("div",{style:{marginBottom:4,display:"flex",gap:8},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:c.componentName}),e.jsx("span",{style:{color:c.avgRenderTime>16?"var(--color-warning, #f59e0b)":"var(--color-success, #22c55e)"},children:z(c.avgRenderTime)}),e.jsxs("span",{style:{color:"var(--text-muted, #64748b)",minWidth:30,textAlign:"right"},children:["x",c.renderCount]})]},c.componentName)),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[e.jsx("button",{onClick:oe,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Print Report"}),e.jsx("button",{onClick:ne,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Clear"})]})]})]})});de.displayName="ProfilerOverlay";process.env.NODE_ENV;m.createContext(null);const le=m.createContext({enabled:!0,active:!1,run:()=>{}});function fe(){return m.useContext(le)}function O(r,a){if(!r)return null;if(r===!0)return a&&a.length>0?a:null;if(Array.isArray(r))return r.length>0?r:null;const i=r.steps??a;return i&&i.length>0?i:null}function ue(r,a){return r.map(i=>({target:i.target,title:i.titleKey?a(i.titleKey,i.title??""):i.title??"",content:i.contentKey?a(i.contentKey,i.content??""):i.content??"",placement:i.placement,highlightPadding:i.highlightPadding,showArrow:i.showArrow,scrollIntoView:i.scrollIntoView,disableInteraction:i.disableInteraction}))}const V=({steps:r,autoStart:a,label:i,size:o="md",className:n,style:f,"data-testid":p})=>{const{enabled:s,run:x}=fe(),{t:c}=ae();if(!s||!r||r.length===0)return null;const h=i??c("tutorial.startAria","Start tutorial");return e.jsx("button",{type:"button",className:`nice-tutorial-button nice-tutorial-button--${o}`+(n?` ${n}`:""),style:f,"data-testid":p,"aria-label":h,title:h,onClick:()=>x(ue(r,c),{autoStart:a}),children:"?"})},q="nice-tutorial-button-styles";if(typeof document<"u"&&!document.getElementById(q)){const r=document.createElement("style");r.id=q,r.textContent=`
2
+ .nice-tutorial-button {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ border: 1px solid var(--nice-border, #cbd5e1);
7
+ background: var(--nice-bg, #fff);
8
+ color: var(--nice-text-secondary, #475569);
9
+ border-radius: var(--nice-radius-full, 9999px);
10
+ cursor: help;
11
+ font-weight: 700;
12
+ line-height: 1;
13
+ padding: 0;
14
+ transition: background var(--nice-transition, 200ms ease), color var(--nice-transition, 200ms ease), border-color var(--nice-transition, 200ms ease);
15
+ }
16
+ .nice-tutorial-button:hover {
17
+ background: var(--nice-primary, #2563eb);
18
+ border-color: var(--nice-primary, #2563eb);
19
+ color: var(--nice-text-inverse, #fff);
20
+ }
21
+ .nice-tutorial-button:focus-visible {
22
+ outline: none;
23
+ box-shadow: 0 0 0 2px var(--nice-bg, #fff), 0 0 0 4px var(--nice-primary, #2563eb);
24
+ }
25
+ .nice-tutorial-button--sm { width: 16px; height: 16px; font-size: 11px; }
26
+ .nice-tutorial-button--md { width: 20px; height: 20px; font-size: 12px; }
27
+ `,document.head.appendChild(r)}m.createContext(null);m.createContext(null);m.createContext(null);const G={space1:"4px",space2:"8px",space3:"12px",space4:"16px",space5:"20px",space6:"24px",space8:"32px"},J={fontFamily:"'Inter', system-ui, -apple-system, sans-serif",fontSizeXs:"0.75rem",fontSizeSm:"0.8125rem",fontSizeMd:"0.875rem",fontSizeLg:"1rem",fontSizeXl:"1.125rem",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700,lineHeight:1.5},Q={fast:"120ms ease",normal:"200ms ease",slow:"300ms ease"},Z=r=>({color:r,radiusSm:"4px",radiusMd:"6px",radiusLg:"8px",radiusXl:"12px",radiusFull:"9999px"}),pe={sm:"0 1px 2px rgba(0,0,0,0.05)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"},me={sm:"0 1px 2px rgba(0,0,0,0.3)",md:"0 4px 6px -1px rgba(0,0,0,0.4)",lg:"0 10px 15px -3px rgba(0,0,0,0.4)",xl:"0 20px 25px -5px rgba(0,0,0,0.4)"};function l(r,a,i,o,n){return{name:r,darkMode:"light",colors:{...a,surface:a.surface??i.primary,surfaceHover:a.surfaceHover??i.secondary},backgrounds:{...i,elevated:i.elevated??i.primary,inset:i.inset??i.tertiary,canvas:i.canvas??i.primary},text:{...o,inverse:o.inverse??"#ffffff"},borders:Z(n),shadows:pe,spacing:G,typography:J,transitions:Q}}function C(r,a,i,o,n){return{name:r,darkMode:"dark",colors:{...a,surface:a.surface??i.secondary,surfaceHover:a.surfaceHover??i.tertiary},backgrounds:{...i,elevated:i.elevated??i.secondary,inset:i.inset??i.primary,canvas:i.canvas??i.primary},text:{...o,inverse:o.inverse??"#0f172a"},borders:Z(n),shadows:me,spacing:G,typography:J,transitions:Q}}l("Slate",{primary:"#64748b",primaryHover:"#475569",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#1e293b",secondary:"#475569",muted:"#94a3b8"},"#cbd5e1");l("Zinc",{primary:"#71717a",primaryHover:"#52525b",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fafafa",secondary:"#f4f4f5",tertiary:"#e4e4e7",hover:"#e4e4e7"},{primary:"#18181b",secondary:"#3f3f46",muted:"#a1a1aa"},"#d4d4d8");l("Stone",{primary:"#78716c",primaryHover:"#57534e",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#fafaf9",secondary:"#f5f5f4",tertiary:"#e7e5e4",hover:"#e7e5e4"},{primary:"#1c1917",secondary:"#44403c",muted:"#a8a29e"},"#d6d3d1");l("Cool Gray",{primary:"#6b7280",primaryHover:"#4b5563",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},{primary:"#f9fafb",secondary:"#f3f4f6",tertiary:"#e5e7eb",hover:"#e5e7eb"},{primary:"#111827",secondary:"#374151",muted:"#9ca3af"},"#d1d5db");l("Warm Gray",{primary:"#7c7568",primaryHover:"#5c564c",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf9f7",secondary:"#f5f4f0",tertiary:"#e8e6e1",hover:"#e8e6e1"},{primary:"#1f1d19",secondary:"#4a463d",muted:"#a09888"},"#d4d0c8");l("Silver",{primary:"#94a3b8",primaryHover:"#64748b",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#38bdf8"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#334155",secondary:"#64748b",muted:"#94a3b8"},"#cbd5e1");l("Charcoal",{primary:"#374151",primaryHover:"#1f2937",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f9fafb",secondary:"#f3f4f6",tertiary:"#e5e7eb",hover:"#e5e7eb"},{primary:"#111827",secondary:"#374151",muted:"#6b7280"},"#d1d5db");l("Ivory",{primary:"#92876d",primaryHover:"#7a6f55",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fffef7",secondary:"#faf6eb",tertiary:"#f0ead6",hover:"#f0ead6"},{primary:"#2b2517",secondary:"#5c5340",muted:"#9c9280"},"#ddd8c4");l("Rose",{primary:"#e11d48",primaryHover:"#be123c",success:"#16a34a",warning:"#ea580c",error:"#dc2626",info:"#0891b2"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#f43f5e"},"#fda4af");l("Emerald",{primary:"#059669",primaryHover:"#047857",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#34d399"},"#6ee7b7");l("Amber",{primary:"#d97706",primaryHover:"#b45309",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0284c7"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#78350f",muted:"#f59e0b"},"#fcd34d");l("Violet",{primary:"#7c3aed",primaryHover:"#6d28d9",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f5f3ff",secondary:"#ede9fe",tertiary:"#ddd6fe",hover:"#ede9fe"},{primary:"#2e1065",secondary:"#4c1d95",muted:"#a78bfa"},"#c4b5fd");l("Teal",{primary:"#0d9488",primaryHover:"#0f766e",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0fdfa",secondary:"#ccfbf1",tertiary:"#99f6e4",hover:"#ccfbf1"},{primary:"#134e4a",secondary:"#115e59",muted:"#2dd4bf"},"#5eead4");l("Indigo",{primary:"#4f46e5",primaryHover:"#4338ca",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#eef2ff",secondary:"#e0e7ff",tertiary:"#c7d2fe",hover:"#e0e7ff"},{primary:"#1e1b4b",secondary:"#312e81",muted:"#818cf8"},"#a5b4fc");l("Cyan",{primary:"#0891b2",primaryHover:"#0e7490",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#0284c7"},{primary:"#ecfeff",secondary:"#cffafe",tertiary:"#a5f3fc",hover:"#cffafe"},{primary:"#164e63",secondary:"#155e75",muted:"#22d3ee"},"#67e8f9");l("Lime",{primary:"#65a30d",primaryHover:"#4d7c0f",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#f7fee7",secondary:"#ecfccb",tertiary:"#d9f99d",hover:"#ecfccb"},{primary:"#1a2e05",secondary:"#365314",muted:"#84cc16"},"#bef264");l("Pink",{primary:"#db2777",primaryHover:"#be185d",success:"#10b981",warning:"#f59e0b",error:"#dc2626",info:"#06b6d4"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#500724",secondary:"#831843",muted:"#f472b6"},"#f9a8d4");l("Orange",{primary:"#ea580c",primaryHover:"#c2410c",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#7c2d12",muted:"#fb923c"},"#fdba74");l("Fuchsia",{primary:"#c026d3",primaryHover:"#a21caf",success:"#10b981",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fdf4ff",secondary:"#fae8ff",tertiary:"#f5d0fe",hover:"#fae8ff"},{primary:"#4a044e",secondary:"#701a75",muted:"#d946ef"},"#e879f9");l("Sky",{primary:"#0284c7",primaryHover:"#0369a1",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#075985",muted:"#38bdf8"},"#7dd3fc");l("Ruby",{primary:"#be123c",primaryHover:"#9f1239",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#fb7185"},"#fda4af");l("Coral",{primary:"#f97316",primaryHover:"#ea580c",success:"#10b981",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#9a3412",muted:"#fb923c"},"#fdba74");C("Midnight",{primary:"#818cf8",primaryHover:"#6366f1",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#020617",secondary:"#0f172a",tertiary:"#1e293b",hover:"#1e293b"},{primary:"#f1f5f9",secondary:"#94a3b8",muted:"#475569"},"#1e293b");C("Obsidian",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#facc15",error:"#fb7185",info:"#38bdf8"},{primary:"#09090b",secondary:"#18181b",tertiary:"#27272a",hover:"#27272a"},{primary:"#fafafa",secondary:"#a1a1aa",muted:"#52525b"},"#3f3f46");C("Eclipse",{primary:"#c084fc",primaryHover:"#a855f7",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#67e8f9"},{primary:"#0c0a1d",secondary:"#1a1533",tertiary:"#2a2248",hover:"#2a2248"},{primary:"#f5f3ff",secondary:"#a78bfa",muted:"#6d5eac"},"#3b3266");C("Onyx",{primary:"#60a5fa",primaryHover:"#3b82f6",success:"#4ade80",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#000000",secondary:"#0a0a0a",tertiary:"#171717",hover:"#171717"},{primary:"#ffffff",secondary:"#a3a3a3",muted:"#525252"},"#262626");C("Carbon",{primary:"#38bdf8",primaryHover:"#0ea5e9",success:"#4ade80",warning:"#facc15",error:"#f87171",info:"#67e8f9"},{primary:"#161616",secondary:"#262626",tertiary:"#393939",hover:"#393939"},{primary:"#f4f4f4",secondary:"#c6c6c6",muted:"#6f6f6f"},"#525252");C("Cosmos",{primary:"#6366f1",primaryHover:"#4f46e5",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#030712",secondary:"#111827",tertiary:"#1f2937",hover:"#1f2937"},{primary:"#e5e7eb",secondary:"#9ca3af",muted:"#4b5563"},"#374151");C("Nebula",{primary:"#e879f9",primaryHover:"#d946ef",success:"#4ade80",warning:"#fbbf24",error:"#fb7185",info:"#67e8f9"},{primary:"#0d0117",secondary:"#1a0533",tertiary:"#2d0a52",hover:"#2d0a52"},{primary:"#fae8ff",secondary:"#d8b4fe",muted:"#7c3aed"},"#581c87");C("Abyss",{primary:"#22d3ee",primaryHover:"#06b6d4",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#38bdf8"},{primary:"#001219",secondary:"#002a3a",tertiary:"#003e54",hover:"#003e54"},{primary:"#e0f2fe",secondary:"#7dd3fc",muted:"#0369a1"},"#075985");C("Shadow",{primary:"#a3a3a3",primaryHover:"#737373",success:"#4ade80",warning:"#facc15",error:"#f87171",info:"#38bdf8"},{primary:"#171717",secondary:"#1f1f1f",tertiary:"#2a2a2a",hover:"#2a2a2a"},{primary:"#e5e5e5",secondary:"#a3a3a3",muted:"#525252"},"#404040");C("Emerald Dark",{primary:"#34d399",primaryHover:"#10b981",success:"#4ade80",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#022c22",secondary:"#064e3b",tertiary:"#065f46",hover:"#065f46"},{primary:"#ecfdf5",secondary:"#6ee7b7",muted:"#047857"},"#047857");l("Forest",{primary:"#166534",primaryHover:"#14532d",success:"#22c55e",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#052e16",secondary:"#166534",muted:"#4ade80"},"#86efac");l("Ocean",{primary:"#0369a1",primaryHover:"#075985",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#38bdf8"},"#7dd3fc");l("Desert",{primary:"#b45309",primaryHover:"#92400e",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fefce8",secondary:"#fef9c3",tertiary:"#fef08a",hover:"#fef9c3"},{primary:"#422006",secondary:"#713f12",muted:"#ca8a04"},"#fde047");l("Sunset",{primary:"#ea580c",primaryHover:"#c2410c",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#9a3412",muted:"#f97316"},"#fdba74");l("Aurora",{primary:"#0d9488",primaryHover:"#0f766e",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#f0fdfa",secondary:"#ccfbf1",tertiary:"#99f6e4",hover:"#ccfbf1"},{primary:"#134e4a",secondary:"#115e59",muted:"#2dd4bf"},"#5eead4");l("Lavender",{primary:"#7e22ce",primaryHover:"#6b21a8",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#faf5ff",secondary:"#f3e8ff",tertiary:"#e9d5ff",hover:"#f3e8ff"},{primary:"#3b0764",secondary:"#581c87",muted:"#a855f7"},"#d8b4fe");l("Autumn",{primary:"#c2410c",primaryHover:"#9a3412",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fef2f2",secondary:"#fee2e2",tertiary:"#fecaca",hover:"#fee2e2"},{primary:"#450a0a",secondary:"#7f1d1d",muted:"#f87171"},"#fca5a5");l("Spring",{primary:"#16a34a",primaryHover:"#15803d",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#14532d",secondary:"#166534",muted:"#4ade80"},"#86efac");l("Arctic",{primary:"#0ea5e9",primaryHover:"#0284c7",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#7dd3fc"},"#bae6fd");l("Tropical",{primary:"#0d9488",primaryHover:"#0f766e",success:"#16a34a",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#6ee7b7"},"#a7f3d0");l("Pastel Rose",{primary:"#f472b6",primaryHover:"#ec4899",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#831843",secondary:"#9d174d",muted:"#f9a8d4"},"#f9a8d4");l("Pastel Sky",{primary:"#38bdf8",primaryHover:"#0ea5e9",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#075985",secondary:"#0369a1",muted:"#7dd3fc"},"#bae6fd");l("Pastel Mint",{primary:"#34d399",primaryHover:"#10b981",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#065f46",secondary:"#047857",muted:"#6ee7b7"},"#a7f3d0");l("Pastel Peach",{primary:"#fb923c",primaryHover:"#f97316",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#7c2d12",secondary:"#9a3412",muted:"#fdba74"},"#fed7aa");l("Pastel Lavender",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f5f3ff",secondary:"#ede9fe",tertiary:"#ddd6fe",hover:"#ede9fe"},{primary:"#4c1d95",secondary:"#5b21b6",muted:"#c4b5fd"},"#ddd6fe");l("Pastel Lemon",{primary:"#facc15",primaryHover:"#eab308",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fefce8",secondary:"#fef9c3",tertiary:"#fef08a",hover:"#fef9c3"},{primary:"#713f12",secondary:"#854d0e",muted:"#fde047"},"#fef08a");l("Pastel Sage",{primary:"#86efac",primaryHover:"#4ade80",success:"#22c55e",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#166534",secondary:"#15803d",muted:"#86efac"},"#bbf7d0");l("Pastel Coral",{primary:"#fb7185",primaryHover:"#f43f5e",success:"#4ade80",warning:"#fcd34d",error:"#ef4444",info:"#67e8f9"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#881337",secondary:"#9f1239",muted:"#fda4af"},"#fecdd3");l("Banking",{primary:"#1e3a5f",primaryHover:"#152c4a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#0f172a",secondary:"#334155",muted:"#94a3b8"},"#cbd5e1");l("Healthcare",{primary:"#0891b2",primaryHover:"#0e7490",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0fdfa",secondary:"#e0f7fa",tertiary:"#b2ebf2",hover:"#e0f7fa"},{primary:"#134e4a",secondary:"#1a6b6a",muted:"#80cbc4"},"#b2dfdb");l("Legal",{primary:"#1e293b",primaryHover:"#0f172a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#fafaf9",secondary:"#f5f5f4",tertiary:"#e7e5e4",hover:"#e7e5e4"},{primary:"#0f172a",secondary:"#44403c",muted:"#a8a29e"},"#d6d3d1");l("Tech Startup",{primary:"#7c3aed",primaryHover:"#6d28d9",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#faf5ff",secondary:"#f3e8ff",tertiary:"#e9d5ff",hover:"#f3e8ff"},{primary:"#1e1b4b",secondary:"#4c1d95",muted:"#a78bfa"},"#c4b5fd");l("Enterprise",{primary:"#1e40af",primaryHover:"#1e3a8a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#eff6ff",secondary:"#dbeafe",tertiary:"#bfdbfe",hover:"#dbeafe"},{primary:"#1e3a5f",secondary:"#1e40af",muted:"#60a5fa"},"#93c5fd");l("Government",{primary:"#1d4ed8",primaryHover:"#1e40af",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#0f172a",secondary:"#1e293b",muted:"#64748b"},"#cbd5e1");l("Education",{primary:"#059669",primaryHover:"#047857",success:"#16a34a",warning:"#f59e0b",error:"#ef4444",info:"#0891b2"},{primary:"#f0fdf9",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#6ee7b7"},"#a7f3d0");l("Real Estate",{primary:"#92400e",primaryHover:"#78350f",success:"#059669",warning:"#b45309",error:"#dc2626",info:"#0891b2"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#422006",secondary:"#713f12",muted:"#d97706"},"#fcd34d");l("Nord",{primary:"#5e81ac",primaryHover:"#4c6b90",success:"#a3be8c",warning:"#ebcb8b",error:"#bf616a",info:"#88c0d0"},{primary:"#eceff4",secondary:"#e5e9f0",tertiary:"#d8dee9",hover:"#d8dee9"},{primary:"#2e3440",secondary:"#3b4252",muted:"#4c566a"},"#d8dee9");C("Dracula",{primary:"#bd93f9",primaryHover:"#9d79d9",success:"#50fa7b",warning:"#f1fa8c",error:"#ff5555",info:"#8be9fd"},{primary:"#282a36",secondary:"#343746",tertiary:"#44475a",hover:"#44475a"},{primary:"#f8f8f2",secondary:"#c0c0c0",muted:"#6272a4"},"#44475a");l("Solarized Light",{primary:"#268bd2",primaryHover:"#1a6da0",success:"#859900",warning:"#b58900",error:"#dc322f",info:"#2aa198"},{primary:"#fdf6e3",secondary:"#eee8d5",tertiary:"#e0dbc7",hover:"#eee8d5"},{primary:"#073642",secondary:"#586e75",muted:"#93a1a1"},"#eee8d5");C("Solarized Dark",{primary:"#268bd2",primaryHover:"#3d98db",success:"#859900",warning:"#b58900",error:"#dc322f",info:"#2aa198"},{primary:"#002b36",secondary:"#073642",tertiary:"#0a4858",hover:"#073642"},{primary:"#eee8d5",secondary:"#93a1a1",muted:"#586e75"},"#073642");C("Monokai",{primary:"#66d9ef",primaryHover:"#45c0d6",success:"#a6e22e",warning:"#e6db74",error:"#f92672",info:"#66d9ef"},{primary:"#272822",secondary:"#34352e",tertiary:"#3e3d32",hover:"#3e3d32"},{primary:"#f8f8f2",secondary:"#cfcfc2",muted:"#75715e"},"#3e3d32");C("One Dark",{primary:"#61afef",primaryHover:"#4b9ee0",success:"#98c379",warning:"#e5c07b",error:"#e06c75",info:"#56b6c2"},{primary:"#282c34",secondary:"#2c313a",tertiary:"#353b45",hover:"#353b45"},{primary:"#abb2bf",secondary:"#828997",muted:"#545862"},"#3e4452");C("Synthwave",{primary:"#ff7edb",primaryHover:"#e660c2",success:"#72f1b8",warning:"#fede5d",error:"#fe4450",info:"#36f9f6"},{primary:"#241b2f",secondary:"#2d2140",tertiary:"#362a50",hover:"#362a50"},{primary:"#f0e4fc",secondary:"#b4a0cc",muted:"#6c5c84"},"#4a3866");l("Vaporwave",{primary:"#ff71ce",primaryHover:"#e655b5",success:"#78dcca",warning:"#ffb86c",error:"#ff5555",info:"#76e8fc"},{primary:"#fce4f7",secondary:"#e8d0f4",tertiary:"#d4bcf0",hover:"#e8d0f4"},{primary:"#4a1a4e",secondary:"#7b3f7d",muted:"#c080c0"},"#d8a8e8");C("Terminal Green",{primary:"#00ff41",primaryHover:"#00cc34",success:"#00ff41",warning:"#ffff00",error:"#ff0000",info:"#00ffff"},{primary:"#0a0a0a",secondary:"#0d1a0d",tertiary:"#1a2e1a",hover:"#1a2e1a"},{primary:"#00ff41",secondary:"#00cc33",muted:"#008822"},"#003300");l("Sepia",{primary:"#8b6914",primaryHover:"#704f10",success:"#6b8e23",warning:"#cd853f",error:"#b22222",info:"#5f9ea0"},{primary:"#faf0e6",secondary:"#f5e6d3",tertiary:"#eddcc7",hover:"#f5e6d3"},{primary:"#3e2723",secondary:"#5d4037",muted:"#a1887f"},"#d7ccc8");l("Vintage",{primary:"#8d6e63",primaryHover:"#6d4c41",success:"#66bb6a",warning:"#ffb300",error:"#e53935",info:"#29b6f6"},{primary:"#efebe9",secondary:"#d7ccc8",tertiary:"#bcaaa4",hover:"#d7ccc8"},{primary:"#3e2723",secondary:"#5d4037",muted:"#a1887f"},"#bcaaa4");C("Cyberpunk",{primary:"#00f0ff",primaryHover:"#00c8d4",success:"#39ff14",warning:"#ffff00",error:"#ff003c",info:"#bf00ff"},{primary:"#0a0e17",secondary:"#131824",tertiary:"#1c2333",hover:"#1c2333"},{primary:"#e0fbfc",secondary:"#80d4dd",muted:"#3a6b72"},"#1c3a44");C("Neon",{primary:"#ff00ff",primaryHover:"#cc00cc",success:"#00ff00",warning:"#ffff00",error:"#ff0000",info:"#00ffff"},{primary:"#0d0d0d",secondary:"#1a1a1a",tertiary:"#262626",hover:"#262626"},{primary:"#ffffff",secondary:"#cccccc",muted:"#666666"},"#333333");C("Retrowave",{primary:"#f77fbe",primaryHover:"#e462a3",success:"#72f1b8",warning:"#ffe261",error:"#ff4444",info:"#79e8fb"},{primary:"#1b0a2e",secondary:"#261440",tertiary:"#321e52",hover:"#321e52"},{primary:"#ffe6f7",secondary:"#c9a0c9",muted:"#6b4c7a"},"#4a2d66");l("Christmas",{primary:"#c41e3a",primaryHover:"#a01830",success:"#228b22",warning:"#ffd700",error:"#dc2626",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fde8e8",tertiary:"#f8d0d0",hover:"#fde8e8"},{primary:"#3b0a0a",secondary:"#7f1d1d",muted:"#dc6868"},"#e8a0a0");C("Halloween",{primary:"#ff6600",primaryHover:"#e05500",success:"#4ade80",warning:"#fbbf24",error:"#ff0000",info:"#9333ea"},{primary:"#1a0a00",secondary:"#2d1500",tertiary:"#402000",hover:"#402000"},{primary:"#ffedd5",secondary:"#fdba74",muted:"#9a5c28"},"#5c3400");l("Valentine",{primary:"#e11d48",primaryHover:"#be123c",success:"#10b981",warning:"#f59e0b",error:"#dc2626",info:"#ec4899"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#f9a8d4"},"#fda4af");l("Easter",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fef9ff",secondary:"#f3e8ff",tertiary:"#e8d5ff",hover:"#f3e8ff"},{primary:"#581c87",secondary:"#6d28d9",muted:"#c4b5fd"},"#ddd6fe");l("Summer Beach",{primary:"#0ea5e9",primaryHover:"#0284c7",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#7dd3fc"},"#fcd34d");l("Winter Frost",{primary:"#3b82f6",primaryHover:"#2563eb",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#1e3a5f",secondary:"#1e40af",muted:"#93c5fd"},"#bfdbfe");l("Cherry Blossom",{primary:"#ec4899",primaryHover:"#db2777",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#831843",secondary:"#9d174d",muted:"#f9a8d4"},"#fbcfe8");l("Harvest",{primary:"#b45309",primaryHover:"#92400e",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#78350f",muted:"#d97706"},"#fcd34d");l("Japanese Zen",{primary:"#6b7280",primaryHover:"#4b5563",success:"#6b8e23",warning:"#d4a017",error:"#c0392b",info:"#5f9ea0"},{primary:"#faf9f6",secondary:"#f0ece3",tertiary:"#e6e0d4",hover:"#f0ece3"},{primary:"#2c2c2c",secondary:"#5c5c5c",muted:"#a0998a"},"#d5cec0");l("Moroccan",{primary:"#c2410c",primaryHover:"#9a3412",success:"#15803d",warning:"#ca8a04",error:"#b91c1c",info:"#0e7490"},{primary:"#fffbf0",secondary:"#fef3e0",tertiary:"#fde6c4",hover:"#fef3e0"},{primary:"#3a1a00",secondary:"#7c2d12",muted:"#d97706"},"#f5d0a0");l("Scandinavian",{primary:"#4b5563",primaryHover:"#374151",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",hover:"#f3f4f6"},{primary:"#111827",secondary:"#374151",muted:"#9ca3af"},"#e5e7eb");l("Mediterranean",{primary:"#1e40af",primaryHover:"#1e3a8a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#eff6ff",secondary:"#dbeafe",tertiary:"#bfdbfe",hover:"#dbeafe"},{primary:"#1e3a5f",secondary:"#2563eb",muted:"#93c5fd"},"#bfdbfe");l("Chinese New Year",{primary:"#dc2626",primaryHover:"#b91c1c",success:"#16a34a",warning:"#d4a017",error:"#ef4444",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fee2e2",tertiary:"#fecaca",hover:"#fee2e2"},{primary:"#450a0a",secondary:"#991b1b",muted:"#f87171"},"#fca5a5");l("Indian Festive",{primary:"#d97706",primaryHover:"#b45309",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#7c3aed"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#92400e",muted:"#f59e0b"},"#fcd34d");l("Brazilian Carnival",{primary:"#16a34a",primaryHover:"#15803d",success:"#22c55e",warning:"#facc15",error:"#ef4444",info:"#0ea5e9"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#052e16",secondary:"#166534",muted:"#4ade80"},"#86efac");l("African Earth",{primary:"#92400e",primaryHover:"#78350f",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf5f0",secondary:"#f0e6d6",tertiary:"#e6d5bb",hover:"#f0e6d6"},{primary:"#2b1a0e",secondary:"#5c3d1e",muted:"#a08060"},"#d4b896");C("High Contrast Dark",{primary:"#ffff00",primaryHover:"#cccc00",success:"#00ff00",warning:"#ff8c00",error:"#ff0000",info:"#00ffff"},{primary:"#000000",secondary:"#1a1a1a",tertiary:"#333333",hover:"#333333"},{primary:"#ffffff",secondary:"#ffffff",muted:"#cccccc"},"#ffffff");l("Monochrome",{primary:"#404040",primaryHover:"#262626",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fafafa",secondary:"#f0f0f0",tertiary:"#e0e0e0",hover:"#e0e0e0"},{primary:"#1a1a1a",secondary:"#404040",muted:"#808080"},"#c0c0c0");l("Enhanced Contrast",{primary:"#0050b3",primaryHover:"#003d8c",success:"#006400",warning:"#cc7000",error:"#cc0000",info:"#006680"},{primary:"#ffffff",secondary:"#f5f5f5",tertiary:"#ebebeb",hover:"#ebebeb"},{primary:"#000000",secondary:"#1a1a1a",muted:"#595959"},"#8c8c8c");l("Minimalist",{primary:"#18181b",primaryHover:"#27272a",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#3b82f6"},{primary:"#ffffff",secondary:"#fafafa",tertiary:"#f5f5f5",hover:"#f5f5f5"},{primary:"#0a0a0a",secondary:"#404040",muted:"#a3a3a3"},"#e5e5e5");C("Warm Dark",{primary:"#f59e0b",primaryHover:"#d97706",success:"#10b981",warning:"#fbbf24",error:"#f87171",info:"#38bdf8"},{primary:"#1c1917",secondary:"#292524",tertiary:"#44403c",hover:"#44403c"},{primary:"#fafaf9",secondary:"#d6d3d1",muted:"#78716c"},"#57534e");C("Soft Dark",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#34d399",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#1e1e2e",secondary:"#262637",tertiary:"#313147",hover:"#313147"},{primary:"#e8e8f0",secondary:"#a0a0b8",muted:"#5c5c74"},"#3e3e58");l("Coffee",{primary:"#6f4e37",primaryHover:"#5c3d28",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf6f1",secondary:"#f0e8dc",tertiary:"#e6d8c6",hover:"#f0e8dc"},{primary:"#2c1a0e",secondary:"#5c3d28",muted:"#a08868"},"#d4c4a8");l("Wine",{primary:"#7f1d1d",primaryHover:"#641717",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fde8e8",tertiary:"#f8d0d0",hover:"#fde8e8"},{primary:"#3b0a0a",secondary:"#7f1d1d",muted:"#dc6868"},"#e8a0a0");m.createContext(null);const ye=[{target:".nice-report-builder",titleKey:"tutorial.biReportBuilder.intro.title",title:"Report builder",contentKey:"tutorial.biReportBuilder.intro.content",content:"Drag elements from the palette onto the report, bind them to data sources, switch design/preview, then export to PDF or Excel.",placement:"auto"}],be={id:"",name:"New Report",dataSource:"",layout:{type:"table",elements:[],pageSize:"A4",orientation:"portrait"},parameters:[],filters:[],sorting:[],grouping:[],calculations:[],formatting:{conditionalFormats:[],alternateRowColors:!0,gridLines:!0}},W=[{type:"table",label:"Table",icon:"๐Ÿ“Š"},{type:"chart",label:"Chart",icon:"๐Ÿ“ˆ"},{type:"text",label:"Text",icon:"๐Ÿ“"},{type:"image",label:"Image",icon:"๐Ÿ–ผ๏ธ"},{type:"shape",label:"Shape",icon:"โฌœ"},{type:"barcode",label:"Barcode",icon:"โ–ฎโ–ฏโ–ฎ"},{type:"qrcode",label:"QR Code",icon:"โŠž"},{type:"subreport",label:"Subreport",icon:"๐Ÿ“‹"},{type:"page-break",label:"Page Break",icon:"๐Ÿ“„"}];function he({report:r,dataSources:a=[],onChange:i,onPreview:o,onExport:n,className:f="",tutorial:p}){const[s,x]=m.useState(r||{...be,id:crypto.randomUUID()}),[c,h]=m.useState(null),[d,v]=m.useState("design"),[H,k]=m.useState(null),[T,w]=m.useState(100),S=m.useCallback(t=>{x(b=>{const g=t(b);return i==null||i(g),g})},[i]),R=m.useCallback((t,b)=>{const g={id:crypto.randomUUID(),type:t,position:{x:b.x,y:b.y,width:200,height:t==="page-break"?20:100},config:xe(t),style:{}};S(D=>({...D,layout:{...D.layout,elements:[...D.layout.elements,g]}})),h(g)},[S]),E=m.useCallback((t,b)=>{S(g=>({...g,layout:{...g.layout,elements:g.layout.elements.map(D=>D.id===t?{...D,...b}:D)}})),(c==null?void 0:c.id)===t&&h(g=>g?{...g,...b}:null)},[S,c]),N=m.useCallback(t=>{S(b=>({...b,layout:{...b.layout,elements:b.layout.elements.filter(g=>g.id!==t)}})),h(null)},[S]),M=m.useCallback(t=>{if(t.preventDefault(),!H)return;const b=t.currentTarget.getBoundingClientRect(),g=(t.clientX-b.left)*(100/T),D=(t.clientY-b.top)*(100/T);R(H,{x:g,y:D}),k(null)},[H,R,T]),P=m.useCallback(()=>{o==null||o(s)},[s,o]),L=m.useCallback(t=>{n==null||n(s,t)},[s,n]),y=a.find(t=>t.id===s.dataSource);return e.jsxs("div",{className:`nice-report-builder ${f}`,children:[e.jsxs("div",{className:"nice-report-builder__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:t=>S(b=>({...b,name:t.target.value})),className:"nice-report-builder__name-input"}),e.jsx("div",{className:"nice-report-builder__tabs",children:["design","data","parameters","formatting"].map(t=>e.jsx("button",{className:`nice-report-builder__tab ${d===t?"nice-report-builder__tab--active":""}`,onClick:()=>v(t),children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsxs("div",{className:"nice-report-builder__zoom",children:[e.jsx("button",{onClick:()=>w(t=>Math.max(25,t-25)),children:"โˆ’"}),e.jsxs("span",{children:[T,"%"]}),e.jsx("button",{onClick:()=>w(t=>Math.min(200,t+25)),children:"+"})]}),e.jsxs("div",{className:"nice-report-builder__actions",children:[e.jsx("button",{onClick:P,children:"๐Ÿ‘ Preview"}),e.jsx("button",{onClick:()=>L("pdf"),children:"๐Ÿ“„ PDF"}),e.jsx("button",{onClick:()=>L("excel"),children:"๐Ÿ“Š Excel"}),e.jsx(V,{steps:O(p,ye)})]})]}),e.jsxs("div",{className:"nice-report-builder__main",children:[d==="design"&&e.jsxs("div",{className:"nice-report-builder__palette",children:[e.jsx("h4",{children:"Elements"}),W.map(t=>e.jsxs("div",{className:"nice-report-builder__palette-item",draggable:!0,onDragStart:()=>k(t.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-report-builder__palette-icon",children:t.icon}),e.jsx("span",{children:t.label})]},t.type)),e.jsx("h4",{children:"Data Source"}),e.jsxs("select",{value:s.dataSource,onChange:t=>S(b=>({...b,dataSource:t.target.value})),children:[e.jsx("option",{value:"",children:"Select data source..."}),a.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),(y==null?void 0:y.schema)&&e.jsxs("div",{className:"nice-report-builder__fields",children:[e.jsx("h5",{children:"Fields"}),y.schema.tables.map(t=>e.jsxs("div",{className:"nice-report-builder__table-fields",children:[e.jsx("strong",{children:t.name}),t.columns.map(b=>e.jsxs("div",{className:"nice-report-builder__field",draggable:!0,onDragStart:()=>{},children:[b.name," ",e.jsxs("small",{children:["(",b.type,")"]})]},b.name))]},t.name))]})]}),d==="design"&&e.jsx("div",{className:"nice-report-builder__canvas-container",children:e.jsxs("div",{className:"nice-report-builder__canvas",style:{transform:`scale(${T/100})`,transformOrigin:"top left",width:s.layout.orientation==="landscape"?"297mm":"210mm",height:s.layout.orientation==="landscape"?"210mm":"297mm"},onDragOver:t=>t.preventDefault(),onDrop:M,onClick:()=>h(null),children:[s.layout.elements.map(t=>e.jsx(ve,{element:t,isSelected:(c==null?void 0:c.id)===t.id,onSelect:()=>h(t),onUpdate:b=>E(t.id,b),onDelete:()=>N(t.id)},t.id)),s.layout.elements.length===0&&e.jsx("div",{className:"nice-report-builder__canvas-empty",children:"Drag elements here to build your report"})]})}),d==="data"&&e.jsx(ge,{report:s,dataSource:y,onChange:t=>S(b=>({...b,query:t}))}),d==="parameters"&&e.jsx(je,{parameters:s.parameters,calculations:s.calculations,onChange:(t,b)=>S(g=>({...g,parameters:t,calculations:b}))}),d==="formatting"&&e.jsx(_e,{formatting:s.formatting,grouping:s.grouping,sorting:s.sorting,onChange:(t,b,g)=>S(D=>({...D,formatting:t,grouping:b,sorting:g}))}),c&&d==="design"&&e.jsx(we,{element:c,dataSource:y,onChange:t=>E(c.id,t),onClose:()=>h(null)})]})]})}function xe(r){switch(r){case"table":return{columns:[],showHeader:!0,showFooter:!1};case"chart":return{chartType:"bar",series:[],axes:[]};case"text":return{content:"Text",fontSize:12};case"image":return{src:"",fit:"contain"};case"shape":return{shape:"rectangle",fill:"var(--nice-border, #e0e0e0)",stroke:"var(--nice-text, #333)"};case"barcode":return{format:"CODE128",value:""};case"qrcode":return{value:""};case"subreport":return{reportId:""};case"page-break":return{};default:return{}}}function ve({element:r,isSelected:a,onSelect:i,onUpdate:o,onDelete:n}){var T;const[f,p]=m.useState(!1),[s,x]=m.useState(!1),c=w=>{if(w.button!==0)return;w.stopPropagation(),i(),p(!0);const S=w.clientX,R=w.clientY,E={...r.position},N=P=>{const L=P.clientX-S,y=P.clientY-R;o({position:{...E,x:Math.max(0,E.x+L),y:Math.max(0,E.y+y)}})},M=()=>{p(!1),window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",M)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",M)},h=(w,S)=>{w.stopPropagation(),x(!0);const R=w.clientX,E=w.clientY,N={...r.position},M=L=>{const y=L.clientX-R,t=L.clientY-E,b={...N};S.includes("e")&&(b.width=Math.max(50,N.width+y)),S.includes("s")&&(b.height=Math.max(30,N.height+t)),S.includes("w")&&(b.x=N.x+y,b.width=Math.max(50,N.width-y)),S.includes("n")&&(b.y=N.y+t,b.height=Math.max(30,N.height-t)),o({position:b})},P=()=>{x(!1),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",P)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",P)},d=W.find(w=>w.type===r.type),{padding:v,...H}=r.style??{},k=typeof v=="object"&&v!==null?`${v.top}px ${v.right}px ${v.bottom}px ${v.left}px`:v;return e.jsxs("div",{className:`nice-report-builder__element nice-report-builder__element--${r.type} ${a?"nice-report-builder__element--selected":""}`,style:{left:r.position.x,top:r.position.y,width:r.position.width,height:r.position.height,...H,padding:k},onMouseDown:c,children:[e.jsxs("div",{className:"nice-report-builder__element-content",children:[e.jsx("span",{className:"nice-report-builder__element-icon",children:d==null?void 0:d.icon}),e.jsx("span",{className:"nice-report-builder__element-label",children:((T=r.binding)==null?void 0:T.field)||(d==null?void 0:d.label)})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"nice-report-builder__element-delete",onClick:w=>{w.stopPropagation(),n()},children:"ร—"}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--se",onMouseDown:w=>h(w,"se")}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--e",onMouseDown:w=>h(w,"e")}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--s",onMouseDown:w=>h(w,"s")})]})]})}function ge({report:r,dataSource:a,onChange:i}){var f,p,s,x;const[o,n]=m.useState("builder");return e.jsxs("div",{className:"nice-report-builder__query-builder",children:[e.jsxs("div",{className:"nice-report-builder__query-tabs",children:[e.jsx("button",{className:o==="builder"?"active":"",onClick:()=>n("builder"),children:"Query Builder"}),e.jsx("button",{className:o==="sql"?"active":"",onClick:()=>n("sql"),children:"SQL"})]}),o==="builder"?e.jsxs("div",{className:"nice-report-builder__visual-query",children:[e.jsx("h4",{children:"Tables"}),(f=a==null?void 0:a.schema)==null?void 0:f.tables.map(c=>{var h,d;return e.jsx("div",{className:"nice-report-builder__query-table",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:((d=(h=r.query)==null?void 0:h.tables)==null?void 0:d.includes(c.name))||!1,onChange:v=>{var k,T;const H=v.target.checked?[...((k=r.query)==null?void 0:k.tables)||[],c.name]:(((T=r.query)==null?void 0:T.tables)||[]).filter(w=>w!==c.name);i({...r.query,type:"builder",tables:H})}}),c.name]})},c.name)}),e.jsx("h4",{children:"Columns"}),e.jsx("div",{className:"nice-report-builder__column-list",children:(s=(p=r.query)==null?void 0:p.tables)==null?void 0:s.map(c=>{var d;const h=(d=a==null?void 0:a.schema)==null?void 0:d.tables.find(v=>v.name===c);return h==null?void 0:h.columns.map(v=>e.jsxs("div",{className:"nice-report-builder__column-item",children:[e.jsx("input",{type:"checkbox"}),e.jsxs("span",{children:[c,".",v.name]}),e.jsxs("select",{children:[e.jsx("option",{value:"",children:"No aggregate"}),e.jsx("option",{value:"sum",children:"SUM"}),e.jsx("option",{value:"avg",children:"AVG"}),e.jsx("option",{value:"count",children:"COUNT"}),e.jsx("option",{value:"min",children:"MIN"}),e.jsx("option",{value:"max",children:"MAX"})]})]},`${c}.${v.name}`))})})]}):e.jsx("div",{className:"nice-report-builder__sql-editor",children:e.jsx("textarea",{value:((x=r.query)==null?void 0:x.text)||"",onChange:c=>i({...r.query,type:"sql",text:c.target.value}),placeholder:"SELECT * FROM table_name",rows:15})})]})}function je({parameters:r,calculations:a,onChange:i}){const o=()=>{const f={id:crypto.randomUUID(),name:"param"+(r.length+1),label:"Parameter "+(r.length+1),type:"text"};i([...r,f],a)},n=()=>{const f={id:crypto.randomUUID(),name:"calc"+(a.length+1),expression:""};i(r,[...a,f])};return e.jsxs("div",{className:"nice-report-builder__parameters-editor",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"nice-report-builder__section-header",children:[e.jsx("h4",{children:"Parameters"}),e.jsx("button",{onClick:o,children:"+ Add"})]}),r.map((f,p)=>e.jsxs("div",{className:"nice-report-builder__param-row",children:[e.jsx("input",{type:"text",value:f.name,placeholder:"Name",onChange:s=>{const x=[...r];x[p]={...f,name:s.target.value},i(x,a)}}),e.jsx("input",{type:"text",value:f.label,placeholder:"Label",onChange:s=>{const x=[...r];x[p]={...f,label:s.target.value},i(x,a)}}),e.jsxs("select",{value:f.type,onChange:s=>{const x=[...r];x[p]={...f,type:s.target.value},i(x,a)},children:[e.jsx("option",{value:"text",children:"Text"}),e.jsx("option",{value:"number",children:"Number"}),e.jsx("option",{value:"date",children:"Date"}),e.jsx("option",{value:"daterange",children:"Date Range"}),e.jsx("option",{value:"select",children:"Select"}),e.jsx("option",{value:"multiselect",children:"Multi-select"})]}),e.jsx("button",{onClick:()=>{i(r.filter(s=>s.id!==f.id),a)},children:"ร—"})]},f.id))]}),e.jsxs("section",{children:[e.jsxs("div",{className:"nice-report-builder__section-header",children:[e.jsx("h4",{children:"Calculated Fields"}),e.jsx("button",{onClick:n,children:"+ Add"})]}),a.map((f,p)=>e.jsxs("div",{className:"nice-report-builder__calc-row",children:[e.jsx("input",{type:"text",value:f.name,placeholder:"Name",onChange:s=>{const x=[...a];x[p]={...f,name:s.target.value},i(r,x)}}),e.jsx("input",{type:"text",value:f.expression,placeholder:"Expression (e.g., [Sales] * [Quantity])",onChange:s=>{const x=[...a];x[p]={...f,expression:s.target.value},i(r,x)}}),e.jsx("button",{onClick:()=>{i(r,a.filter(s=>s.id!==f.id))},children:"ร—"})]},f.id))]})]})}function _e({formatting:r,grouping:a,sorting:i,onChange:o}){return e.jsxs("div",{className:"nice-report-builder__formatting-editor",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"General"}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:r.alternateRowColors,onChange:n=>o({...r,alternateRowColors:n.target.checked},a,i)}),"Alternate row colors"]}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:r.gridLines,onChange:n=>o({...r,gridLines:n.target.checked},a,i)}),"Show grid lines"]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Conditional Formatting"}),e.jsx("button",{onClick:()=>{const n={id:crypto.randomUUID(),condition:{column:"",operator:"gt",value:0},style:{backgroundColor:"#ffcccc"},scope:"cell"};o({...r,conditionalFormats:[...r.conditionalFormats,n]},a,i)},children:"+ Add Rule"}),r.conditionalFormats.map(n=>e.jsxs("div",{className:"nice-report-builder__format-rule",children:[e.jsxs("span",{children:["If column ",n.condition.operator," ",String(n.condition.value)]}),e.jsx("input",{type:"color",value:n.style.backgroundColor||"var(--nice-bg, #fff)",onChange:f=>{o({...r,conditionalFormats:r.conditionalFormats.map(p=>p.id===n.id?{...p,style:{...p.style,backgroundColor:f.target.value}}:p)},a,i)}})]},n.id))]})]})}function we({element:r,dataSource:a,onChange:i,onClose:o}){var n,f,p,s,x,c,h;return e.jsxs("div",{className:"nice-report-builder__properties",children:[e.jsxs("div",{className:"nice-report-builder__properties-header",children:[e.jsxs("h4",{children:[(n=W.find(d=>d.type===r.type))==null?void 0:n.label," Properties"]}),e.jsx("button",{onClick:o,children:"ร—"})]}),e.jsxs("div",{className:"nice-report-builder__properties-content",children:[e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Data Binding"}),e.jsxs("select",{value:((f=r.binding)==null?void 0:f.field)||"",onChange:d=>i({binding:{...r.binding,field:d.target.value}}),children:[e.jsx("option",{value:"",children:"None"}),(p=a==null?void 0:a.schema)==null?void 0:p.tables.flatMap(d=>d.columns.map(v=>e.jsxs("option",{value:`${d.name}.${v.name}`,children:[d.name,".",v.name]},`${d.name}.${v.name}`)))]})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Position"}),e.jsxs("div",{className:"nice-report-builder__position-inputs",children:[e.jsx("input",{type:"number",value:r.position.x,onChange:d=>i({position:{...r.position,x:parseInt(d.target.value,10)||0}}),placeholder:"X"}),e.jsx("input",{type:"number",value:r.position.y,onChange:d=>i({position:{...r.position,y:parseInt(d.target.value,10)||0}}),placeholder:"Y"}),e.jsx("input",{type:"number",value:r.position.width,onChange:d=>i({position:{...r.position,width:parseInt(d.target.value,10)||50}}),placeholder:"W"}),e.jsx("input",{type:"number",value:r.position.height,onChange:d=>i({position:{...r.position,height:parseInt(d.target.value,10)||30}}),placeholder:"H"})]})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Background Color"}),e.jsx("input",{type:"color",value:((s=r.style)==null?void 0:s.backgroundColor)||"var(--nice-bg, #fff)",onChange:d=>i({style:{...r.style,backgroundColor:d.target.value}})})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Border"}),e.jsxs("div",{className:"nice-report-builder__border-inputs",children:[e.jsx("input",{type:"color",value:((x=r.style)==null?void 0:x.borderColor)||"var(--nice-text, #000000)",onChange:d=>i({style:{...r.style,borderColor:d.target.value}})}),e.jsx("input",{type:"number",value:((c=r.style)==null?void 0:c.borderWidth)||0,onChange:d=>i({style:{...r.style,borderWidth:parseInt(d.target.value,10)||0}}),placeholder:"Width",min:0,max:10})]})]}),r.type==="text"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:r.config.content||"",onChange:d=>i({config:{...r.config,content:d.target.value}}),rows:3})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Font Size"}),e.jsx("input",{type:"number",value:((h=r.style)==null?void 0:h.fontSize)||12,onChange:d=>i({style:{...r.style,fontSize:parseInt(d.target.value,10)||12}}),min:8,max:72})]})]}),r.type==="chart"&&e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:r.config.chartType||"bar",onChange:d=>i({config:{...r.config,chartType:d.target.value}}),children:[e.jsx("option",{value:"bar",children:"Bar"}),e.jsx("option",{value:"line",children:"Line"}),e.jsx("option",{value:"pie",children:"Pie"}),e.jsx("option",{value:"area",children:"Area"}),e.jsx("option",{value:"scatter",children:"Scatter"})]})]})]})]})}const Ne=[{target:".nice-dashboard-studio",titleKey:"tutorial.dashboardStudio.intro.title",title:"Dashboard studio",contentKey:"tutorial.dashboardStudio.intro.content",content:"Drag widgets from the palette onto the grid, bind them to data sources, add filters, then toggle Edit/View, refresh and save.",placement:"auto"}],Se={id:"",name:"New Dashboard",layout:{type:"grid",columns:12,rowHeight:50,gap:8},widgets:[],filters:[]},$=[{type:"chart",label:"Chart",icon:"๐Ÿ“ˆ",category:"Visualization"},{type:"table",label:"Table",icon:"๐Ÿ“Š",category:"Visualization"},{type:"card",label:"KPI Card",icon:"๐ŸŽฏ",category:"Visualization"},{type:"gauge",label:"Gauge",icon:"โฑ๏ธ",category:"Visualization"},{type:"map",label:"Map",icon:"๐Ÿ—บ๏ธ",category:"Visualization"},{type:"treemap",label:"Treemap",icon:"๐ŸŒณ",category:"Visualization"},{type:"funnel",label:"Funnel",icon:"๐Ÿ”ป",category:"Visualization"},{type:"heatmap",label:"Heatmap",icon:"๐ŸŒก๏ธ",category:"Visualization"},{type:"timeline",label:"Timeline",icon:"๐Ÿ“…",category:"Visualization"},{type:"sankey",label:"Sankey",icon:"ใ€ฐ๏ธ",category:"Visualization"},{type:"filter",label:"Filter",icon:"๐Ÿ”",category:"Controls"},{type:"slicer",label:"Slicer",icon:"๐Ÿ“‹",category:"Controls"},{type:"text",label:"Text",icon:"๐Ÿ“",category:"Layout"},{type:"image",label:"Image",icon:"๐Ÿ–ผ๏ธ",category:"Layout"}];function Ce({dashboard:r,dataSources:a=[],onChange:i,onWidgetAdd:o,onRefresh:n,className:f="",tutorial:p}){const[s,x]=m.useState(r||{...Se,id:crypto.randomUUID()}),[c,h]=m.useState(null),[d,v]=m.useState(!0),[H,k]=m.useState(null),[T,w]=m.useState(!0),S=m.useRef(null),R=m.useCallback(y=>{x(t=>{const b=y(t);return i==null||i(b),b})},[i]),E=m.useCallback((y,t)=>{var g;const b={id:crypto.randomUUID(),type:y,title:((g=$.find(D=>D.type===y))==null?void 0:g.label)||y,position:{x:(t==null?void 0:t.x)??0,y:(t==null?void 0:t.y)??ke(s.widgets),width:(t==null?void 0:t.width)??De(y),height:(t==null?void 0:t.height)??He(y)},config:Te(y)};R(D=>({...D,widgets:[...D.widgets,b]})),h(b),o==null||o(y)},[s.widgets,R,o]),N=m.useCallback((y,t)=>{R(b=>({...b,widgets:b.widgets.map(g=>g.id===y?{...g,...t}:g)})),(c==null?void 0:c.id)===y&&h(b=>b?{...b,...t}:null)},[R,c]),M=m.useCallback(y=>{R(t=>({...t,widgets:t.widgets.filter(b=>b.id!==y)})),h(null)},[R]),P=m.useCallback(y=>{if(y.preventDefault(),!H||!S.current)return;const t=S.current.getBoundingClientRect(),b=t.width/(s.layout.columns||12),g=Math.floor((y.clientX-t.left)/b),D=Math.floor((y.clientY-t.top)/(s.layout.rowHeight||50));E(H,{x:g,y:D}),k(null)},[H,s.layout,E]),L=m.useCallback(()=>{n==null||n()},[n]);return e.jsxs("div",{className:`nice-dashboard-studio ${f}`,children:[e.jsxs("div",{className:"nice-dashboard-studio__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:y=>R(t=>({...t,name:y.target.value})),className:"nice-dashboard-studio__name-input",disabled:!d}),e.jsxs("div",{className:"nice-dashboard-studio__actions",children:[e.jsx("button",{className:`nice-dashboard-studio__action ${d?"active":""}`,onClick:()=>v(!d),children:d?"โœ๏ธ Editing":"๐Ÿ‘ Viewing"}),e.jsxs("button",{onClick:()=>w(!T),children:["๐Ÿ” Filters ",T?"โ–ฒ":"โ–ผ"]}),e.jsx("button",{onClick:L,children:"๐Ÿ”„ Refresh"}),e.jsx("button",{children:"๐Ÿ“ค Share"}),e.jsx("button",{children:"๐Ÿ’พ Save"}),e.jsx(V,{steps:O(p,Ne)})]})]}),T&&s.filters.length>0&&e.jsx("div",{className:"nice-dashboard-studio__filters-bar",children:s.filters.map(y=>e.jsx(Me,{filter:y},y.id))}),e.jsxs("div",{className:"nice-dashboard-studio__main",children:[d&&e.jsxs("div",{className:"nice-dashboard-studio__palette",children:[e.jsx("h4",{children:"Widgets"}),["Visualization","Controls","Layout"].map(y=>e.jsxs("div",{className:"nice-dashboard-studio__category",children:[e.jsx("h5",{children:y}),$.filter(t=>t.category===y).map(t=>e.jsxs("div",{className:"nice-dashboard-studio__palette-item",draggable:!0,onDragStart:()=>k(t.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-dashboard-studio__palette-icon",children:t.icon}),e.jsx("span",{children:t.label})]},t.type))]},y)),e.jsx("h4",{children:"Data Sources"}),a.map(y=>e.jsx("div",{className:"nice-dashboard-studio__datasource",children:e.jsxs("span",{children:["๐Ÿ—„๏ธ ",y.name]})},y.id))]}),e.jsxs("div",{ref:S,className:`nice-dashboard-studio__grid ${d?"nice-dashboard-studio__grid--editing":""}`,style:{"--columns":s.layout.columns||12,"--row-height":`${s.layout.rowHeight||50}px`,"--gap":`${s.layout.gap||8}px`},onDragOver:y=>y.preventDefault(),onDrop:P,onClick:()=>h(null),children:[s.widgets.map(y=>e.jsx(Re,{widget:y,isSelected:(c==null?void 0:c.id)===y.id,isEditing:d,onSelect:()=>h(y),onUpdate:t=>N(y.id,t),onDelete:()=>M(y.id)},y.id)),s.widgets.length===0&&d&&e.jsx("div",{className:"nice-dashboard-studio__empty",children:"Drag widgets from the palette to build your dashboard"})]}),c&&d&&e.jsx(Pe,{widget:c,dataSources:a,onChange:y=>N(c.id,y),onClose:()=>h(null)})]})]})}function ke(r){return r.length===0?0:Math.max(...r.map(a=>a.position.y+a.position.height))}function De(r){switch(r){case"card":return 3;case"gauge":return 3;case"filter":case"slicer":return 3;case"text":return 4;case"chart":case"table":return 6;case"map":return 8;default:return 4}}function He(r){switch(r){case"card":return 2;case"gauge":return 3;case"filter":case"slicer":return 1;case"text":return 2;case"chart":case"table":return 5;case"map":return 8;default:return 4}}function Te(r){switch(r){case"chart":return{chartType:"bar",series:[],axes:[],legend:{show:!0,position:"bottom"}};case"table":return{columns:[],pageSize:10};case"card":return{value:"",label:"",format:"number",icon:"๐Ÿ“Š"};case"gauge":return{value:"0",min:0,max:100,target:75,format:"percent"};case"map":return{type:"choropleth",geoField:"",valueField:""};case"filter":return{field:"",type:"dropdown"};case"slicer":return{field:"",multiSelect:!0};case"text":return{content:"Text content",fontSize:14};case"image":return{src:"",fit:"contain"};default:return{}}}function Re({widget:r,isSelected:a,isEditing:i,onSelect:o,onUpdate:n,onDelete:f}){const p=x=>{if(!i||x.button!==0)return;x.stopPropagation(),o();const c=x.clientX,h=x.clientY,d={...r.position},v=k=>{const T=Math.round((k.clientX-c)/50),w=Math.round((k.clientY-h)/50);n({position:{...d,x:Math.max(0,d.x+T),y:Math.max(0,d.y+w)}})},H=()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",v),window.addEventListener("mouseup",H)},s=$.find(x=>x.type===r.type);return e.jsxs("div",{className:`nice-dashboard-studio__widget nice-dashboard-studio__widget--${r.type} ${a?"nice-dashboard-studio__widget--selected":""}`,style:{gridColumn:`${r.position.x+1} / span ${r.position.width}`,gridRow:`${r.position.y+1} / span ${r.position.height}`},onMouseDown:p,children:[e.jsxs("div",{className:"nice-dashboard-studio__widget-header",children:[e.jsx("span",{className:"nice-dashboard-studio__widget-icon",children:s==null?void 0:s.icon}),e.jsx("span",{className:"nice-dashboard-studio__widget-title",children:r.title}),i&&e.jsx("button",{className:"nice-dashboard-studio__widget-delete",onClick:x=>{x.stopPropagation(),f()},children:"ร—"})]}),e.jsx("div",{className:"nice-dashboard-studio__widget-content",children:e.jsx(Ee,{widget:r})})]})}function Ee({widget:r}){switch(r.type){case"card":return e.jsxs("div",{className:"nice-dashboard-studio__card",children:[e.jsx("div",{className:"nice-dashboard-studio__card-value",children:String(r.config.value||"0")}),e.jsx("div",{className:"nice-dashboard-studio__card-label",children:String(r.config.label||"Label")})]});case"gauge":{const a=Number(r.config.value)||0,i=Number(r.config.max)||100,o=a/i*100;return e.jsx("div",{className:"nice-dashboard-studio__gauge",children:e.jsxs("svg",{viewBox:"0 0 100 60",children:[e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-border, #e0e0e0)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-primary, #0066cc)",strokeWidth:"8",strokeDasharray:`${o*1.26} 126`}),e.jsxs("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"16",fontWeight:"bold",children:[a,"%"]})]})})}case"chart":return e.jsxs("div",{className:"nice-dashboard-studio__chart-placeholder",children:[e.jsx("span",{children:"๐Ÿ“Š"}),e.jsxs("span",{children:[String(r.config.chartType||"bar")," chart"]})]});case"table":return e.jsxs("div",{className:"nice-dashboard-studio__table-placeholder",children:[e.jsx("span",{children:"๐Ÿ“‹"}),e.jsx("span",{children:"Data table"})]});case"map":return e.jsxs("div",{className:"nice-dashboard-studio__map-placeholder",children:[e.jsx("span",{children:"๐Ÿ—บ๏ธ"}),e.jsx("span",{children:"Map visualization"})]});case"text":return e.jsx("div",{className:"nice-dashboard-studio__text",style:{fontSize:Number(r.config.fontSize)||14},children:String(r.config.content||"")});default:return e.jsx("div",{className:"nice-dashboard-studio__widget-placeholder",children:r.type})}}function Me({filter:r}){const[a,i]=m.useState(r.defaultValue);switch(r.type){case"dropdown":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:r.label}),e.jsx("select",{value:String(a||""),onChange:o=>i(o.target.value),children:e.jsx("option",{value:"",children:"All"})})]});case"daterange":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:r.label}),e.jsx("input",{type:"date"}),e.jsx("span",{children:"to"}),e.jsx("input",{type:"date"})]});case"slider":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:r.label}),e.jsx("input",{type:"range"})]});default:return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:r.label}),e.jsx("input",{type:"text",value:String(a||""),onChange:o=>i(o.target.value)})]})}}function Pe({widget:r,dataSources:a,onChange:i,onClose:o}){return e.jsxs("div",{className:"nice-dashboard-studio__properties",children:[e.jsxs("div",{className:"nice-dashboard-studio__properties-header",children:[e.jsx("h4",{children:"Widget Properties"}),e.jsx("button",{onClick:o,children:"ร—"})]}),e.jsxs("div",{className:"nice-dashboard-studio__properties-content",children:[e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Title"}),e.jsx("input",{type:"text",value:r.title||"",onChange:n=>i({title:n.target.value})})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Data Source"}),e.jsxs("select",{value:r.dataSource||"",onChange:n=>i({dataSource:n.target.value}),children:[e.jsx("option",{value:"",children:"Select..."}),a.map(n=>e.jsx("option",{value:n.id,children:n.name},n.id))]})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Size"}),e.jsxs("div",{className:"nice-dashboard-studio__size-inputs",children:[e.jsx("input",{type:"number",value:r.position.width,onChange:n=>i({position:{...r.position,width:parseInt(n.target.value,10)||1}}),min:1,max:12}),e.jsx("span",{children:"ร—"}),e.jsx("input",{type:"number",value:r.position.height,onChange:n=>i({position:{...r.position,height:parseInt(n.target.value,10)||1}}),min:1,max:20})]})]}),r.type==="chart"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:String(r.config.chartType||"bar"),onChange:n=>i({config:{...r.config,chartType:n.target.value}}),children:[e.jsx("option",{value:"bar",children:"Bar"}),e.jsx("option",{value:"line",children:"Line"}),e.jsx("option",{value:"pie",children:"Pie"}),e.jsx("option",{value:"area",children:"Area"}),e.jsx("option",{value:"scatter",children:"Scatter"}),e.jsx("option",{value:"donut",children:"Donut"})]})]}),r.type==="card"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Value Field"}),e.jsx("input",{type:"text",value:String(r.config.value||""),onChange:n=>i({config:{...r.config,value:n.target.value}}),placeholder:"e.g., SUM(Sales)"})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Label"}),e.jsx("input",{type:"text",value:String(r.config.label||""),onChange:n=>i({config:{...r.config,label:n.target.value}})})]})]}),r.type==="text"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:String(r.config.content||""),onChange:n=>i({config:{...r.config,content:n.target.value}}),rows:4})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Refresh Interval (seconds)"}),e.jsx("input",{type:"number",value:r.refreshInterval||0,onChange:n=>i({refreshInterval:parseInt(n.target.value,10)||0}),min:0,placeholder:"0 = manual"})]})]})]})}const Le=[{target:".nice-etl-builder",titleKey:"tutorial.etlBuilder.intro.title",title:"ETL builder",contentKey:"tutorial.etlBuilder.intro.content",content:"Wire sources โ†’ transformations โ†’ destinations into a pipeline, switch the views, then run it and save the configuration.",placement:"auto"}],Ie={id:"",name:"New Pipeline",sources:[],transformations:[],destinations:[],version:1},A=[{type:"filter",label:"Filter",icon:"๐Ÿ”"},{type:"map",label:"Map",icon:"๐Ÿ”„"},{type:"aggregate",label:"Aggregate",icon:"โˆ‘"},{type:"join",label:"Join",icon:"๐Ÿ”—"},{type:"union",label:"Union",icon:"โˆช"},{type:"sort",label:"Sort",icon:"โ†•๏ธ"},{type:"deduplicate",label:"Deduplicate",icon:"๐Ÿ”ฒ"},{type:"pivot",label:"Pivot",icon:"โคข"},{type:"unpivot",label:"Unpivot",icon:"โคก"},{type:"split",label:"Split",icon:"โœ‚๏ธ"},{type:"merge",label:"Merge",icon:"๐Ÿ”€"},{type:"lookup",label:"Lookup",icon:"๐Ÿ“–"},{type:"derive",label:"Derive Column",icon:"โž•"},{type:"validate",label:"Validate",icon:"โœ“"},{type:"cleanse",label:"Cleanse",icon:"๐Ÿงน"},{type:"custom",label:"Custom",icon:"ฦ’"}];function ze({pipeline:r,dataSources:a=[],onChange:i,onRun:o,onSchedule:n,className:f="",tutorial:p}){const[s,x]=m.useState(r||{...Ie,id:crypto.randomUUID()}),[c,h]=m.useState(null),[d,v]=m.useState("design"),[H,k]=m.useState(!1),[T,w]=m.useState([]),[S,R]=m.useState(null),E=m.useRef(null),N=m.useCallback(u=>{x(j=>{const _=u(j);return i==null||i(_),_})},[i]),M=m.useCallback(u=>{var _;const j={id:crypto.randomUUID(),type:u.type,name:u.name,config:u.config,schema:(_=u.schema)==null?void 0:_.tables[0]};N(I=>({...I,sources:[...I.sources,j]}))},[N]),P=m.useCallback((u,j)=>{var I;const _={id:crypto.randomUUID(),type:u,name:((I=A.find(F=>F.type===u))==null?void 0:I.label)||u,input:[],output:crypto.randomUUID(),config:Fe(u)};N(F=>({...F,transformations:[...F.transformations,_]})),h({type:"transformation",id:_.id})},[N]),L=m.useCallback(()=>{const u={id:crypto.randomUUID(),type:"database",name:"New Destination",config:{},writeMode:"append"};N(j=>({...j,destinations:[...j.destinations,u]})),h({type:"destination",id:u.id})},[N]),y=m.useCallback((u,j)=>{N(_=>{switch(u){case"source":return{..._,sources:_.sources.filter(I=>I.id!==j)};case"transformation":return{..._,transformations:_.transformations.filter(I=>I.id!==j)};case"destination":return{..._,destinations:_.destinations.filter(I=>I.id!==j)};default:return _}}),h(null)},[N]),t=m.useCallback(async()=>{if(o){k(!0);try{const u=await o(s);w(j=>[u,...j].slice(0,50))}finally{k(!1)}}},[s,o]),b=m.useCallback(u=>{N(j=>({...j,schedule:u})),n==null||n(s,u)},[s,N,n]),g=m.useCallback(u=>{if(u.preventDefault(),!!S){if(S.startsWith("transform:")){const j=S.replace("transform:","");P(j)}R(null)}},[S,P]),D=()=>{if(!c)return null;switch(c.type){case"source":return s.sources.find(u=>u.id===c.id);case"transformation":return s.transformations.find(u=>u.id===c.id);case"destination":return s.destinations.find(u=>u.id===c.id);default:return null}};return e.jsxs("div",{className:`nice-etl-builder ${f}`,children:[e.jsxs("div",{className:"nice-etl-builder__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:u=>N(j=>({...j,name:u.target.value})),className:"nice-etl-builder__name-input"}),e.jsx("div",{className:"nice-etl-builder__tabs",children:["design","code","schedule","history"].map(u=>e.jsx("button",{className:`nice-etl-builder__tab ${d===u?"nice-etl-builder__tab--active":""}`,onClick:()=>v(u),children:u.charAt(0).toUpperCase()+u.slice(1)},u))}),e.jsxs("div",{className:"nice-etl-builder__actions",children:[e.jsx("button",{onClick:t,disabled:H,className:"nice-etl-builder__run-btn",children:H?"โณ Running...":"โ–ถ Run"}),e.jsx("button",{className:"nice-etl-builder__save-btn",children:"๐Ÿ’พ Save"}),e.jsx(V,{steps:O(p,Le)})]})]}),e.jsxs("div",{className:"nice-etl-builder__main",children:[d==="design"&&e.jsxs("div",{className:"nice-etl-builder__palette",children:[e.jsx("h4",{children:"Sources"}),a.map(u=>e.jsxs("div",{className:"nice-etl-builder__palette-item",onClick:()=>M(u),children:[e.jsx("span",{className:"nice-etl-builder__palette-icon",children:"๐Ÿ—„๏ธ"}),e.jsx("span",{children:u.name})]},u.id)),e.jsx("button",{onClick:()=>M({id:"",name:"New Source",type:"database",config:{}}),children:"+ Add Source"}),e.jsx("h4",{children:"Transformations"}),A.map(u=>e.jsxs("div",{className:"nice-etl-builder__palette-item",draggable:!0,onDragStart:()=>R(`transform:${u.type}`),onDragEnd:()=>R(null),children:[e.jsx("span",{className:"nice-etl-builder__palette-icon",children:u.icon}),e.jsx("span",{children:u.label})]},u.type)),e.jsx("h4",{children:"Destinations"}),e.jsx("button",{onClick:L,children:"+ Add Destination"})]}),d==="design"&&e.jsx("div",{ref:E,className:"nice-etl-builder__canvas",onDragOver:u=>u.preventDefault(),onDrop:g,onClick:()=>h(null),children:e.jsxs("div",{className:"nice-etl-builder__flow",children:[e.jsxs("div",{className:"nice-etl-builder__column",children:[e.jsx("h5",{children:"Sources"}),s.sources.map(u=>e.jsx(U,{node:u,nodeType:"source",icon:"๐Ÿ—„๏ธ",isSelected:(c==null?void 0:c.id)===u.id,onSelect:()=>h({type:"source",id:u.id}),onDelete:()=>y("source",u.id)},u.id))]}),e.jsx("div",{className:"nice-etl-builder__arrow",children:"โ†’"}),e.jsxs("div",{className:"nice-etl-builder__column nice-etl-builder__column--transforms",children:[e.jsx("h5",{children:"Transformations"}),s.transformations.map(u=>{const j=A.find(_=>_.type===u.type);return e.jsx(U,{node:u,nodeType:"transformation",icon:(j==null?void 0:j.icon)||"๐Ÿ”„",isSelected:(c==null?void 0:c.id)===u.id,onSelect:()=>h({type:"transformation",id:u.id}),onDelete:()=>y("transformation",u.id)},u.id)}),s.transformations.length===0&&e.jsx("div",{className:"nice-etl-builder__empty-column",children:"Drag transformations here"})]}),e.jsx("div",{className:"nice-etl-builder__arrow",children:"โ†’"}),e.jsxs("div",{className:"nice-etl-builder__column",children:[e.jsx("h5",{children:"Destinations"}),s.destinations.map(u=>e.jsx(U,{node:u,nodeType:"destination",icon:"๐Ÿ“ฅ",isSelected:(c==null?void 0:c.id)===u.id,onSelect:()=>h({type:"destination",id:u.id}),onDelete:()=>y("destination",u.id)},u.id))]})]})}),d==="code"&&e.jsx("div",{className:"nice-etl-builder__code-view",children:e.jsx("pre",{children:JSON.stringify(s,null,2)})}),d==="schedule"&&e.jsx(Ue,{schedule:s.schedule,monitoring:s.monitoring,onChange:b}),d==="history"&&e.jsx($e,{runs:T}),c&&d==="design"&&e.jsx(Ae,{nodeType:c.type,node:D()??null,dataSources:a,onChange:u=>{N(j=>{switch(c.type){case"source":return{...j,sources:j.sources.map(_=>_.id===c.id?{..._,...u}:_)};case"transformation":return{...j,transformations:j.transformations.map(_=>_.id===c.id?{..._,...u}:_)};case"destination":return{...j,destinations:j.destinations.map(_=>_.id===c.id?{..._,...u}:_)};default:return j}})},onClose:()=>h(null)})]})]})}function Fe(r){switch(r){case"filter":return{condition:""};case"map":return{mappings:[]};case"aggregate":return{groupBy:[],aggregations:[]};case"join":return{joinType:"inner",leftKey:"",rightKey:""};case"union":return{inputs:[]};case"sort":return{columns:[],directions:[]};case"deduplicate":return{columns:[],keepFirst:!0};case"pivot":return{pivotColumn:"",valueColumn:"",aggregation:"sum"};case"unpivot":return{columns:[],nameColumn:"name",valueColumn:"value"};case"derive":return{name:"",expression:""};case"validate":return{rules:[]};case"cleanse":return{operations:[]};case"custom":return{code:`// Custom transformation
28
+ return data;`};default:return{}}}function U({node:r,nodeType:a,icon:i,isSelected:o,onSelect:n,onDelete:f}){return e.jsxs("div",{className:`nice-etl-builder__node nice-etl-builder__node--${a} ${o?"nice-etl-builder__node--selected":""}`,onClick:p=>{p.stopPropagation(),n()},children:[e.jsx("span",{className:"nice-etl-builder__node-icon",children:i}),e.jsx("span",{className:"nice-etl-builder__node-name",children:r.name}),e.jsx("button",{className:"nice-etl-builder__node-delete",onClick:p=>{p.stopPropagation(),f()},children:"ร—"})]})}function Ae({nodeType:r,node:a,dataSources:i,onChange:o,onClose:n}){var f;return a?e.jsxs("div",{className:"nice-etl-builder__properties",children:[e.jsxs("div",{className:"nice-etl-builder__properties-header",children:[e.jsxs("h4",{children:[r.charAt(0).toUpperCase()+r.slice(1)," Properties"]}),e.jsx("button",{onClick:n,children:"ร—"})]}),e.jsxs("div",{className:"nice-etl-builder__properties-content",children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Name"}),e.jsx("input",{type:"text",value:a.name,onChange:p=>o({name:p.target.value})})]}),r==="source"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsxs("select",{value:a.type,onChange:p=>o({type:p.target.value}),children:[e.jsx("option",{value:"database",children:"Database"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"file",children:"File"}),e.jsx("option",{value:"stream",children:"Stream"})]})]}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:((f=a.incremental)==null?void 0:f.enabled)||!1,onChange:p=>{var s;return o({incremental:{...a.incremental,enabled:p.target.checked,column:((s=a.incremental)==null?void 0:s.column)||""}})}}),"Incremental Load"]})})]}),r==="transformation"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsx("span",{children:a.type})]}),a.type==="filter"&&e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Condition"}),e.jsx("textarea",{value:String(a.config.condition||""),onChange:p=>o({config:{...a.config,condition:p.target.value}}),placeholder:"e.g., age > 18 AND status = 'active'",rows:3})]}),a.type==="derive"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Column Name"}),e.jsx("input",{type:"text",value:String(a.config.name||""),onChange:p=>o({config:{...a.config,name:p.target.value}})})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Expression"}),e.jsx("input",{type:"text",value:String(a.config.expression||""),onChange:p=>o({config:{...a.config,expression:p.target.value}}),placeholder:"e.g., price * quantity"})]})]}),a.type==="custom"&&e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Code"}),e.jsx("textarea",{value:String(a.config.code||""),onChange:p=>o({config:{...a.config,code:p.target.value}}),rows:10,className:"nice-etl-builder__code-input"})]})]}),r==="destination"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsxs("select",{value:a.type,onChange:p=>o({type:p.target.value}),children:[e.jsx("option",{value:"database",children:"Database"}),e.jsx("option",{value:"file",children:"File"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"warehouse",children:"Data Warehouse"})]})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Write Mode"}),e.jsxs("select",{value:a.writeMode,onChange:p=>o({writeMode:p.target.value}),children:[e.jsx("option",{value:"append",children:"Append"}),e.jsx("option",{value:"overwrite",children:"Overwrite"}),e.jsx("option",{value:"upsert",children:"Upsert"}),e.jsx("option",{value:"merge",children:"Merge"})]})]})]})]})]}):e.jsx(e.Fragment,{})}function Ue({schedule:r,monitoring:a,onChange:i}){const[o,n]=m.useState(r||{enabled:!1});return e.jsxs("div",{className:"nice-etl-builder__schedule-editor",children:[e.jsx("h4",{children:"Schedule Configuration"}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:o.enabled,onChange:f=>{const p={...o,enabled:f.target.checked};n(p),i(p)}}),"Enable scheduled execution"]})}),o.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Cron Expression"}),e.jsx("input",{type:"text",value:o.cron||"",onChange:f=>{const p={...o,cron:f.target.value};n(p)},placeholder:"0 0 * * * (every hour)"}),e.jsx("small",{children:"Format: minute hour day month weekday"})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Timezone"}),e.jsxs("select",{value:o.timezone||"UTC",onChange:f=>{const p={...o,timezone:f.target.value};n(p)},children:[e.jsx("option",{value:"UTC",children:"UTC"}),e.jsx("option",{value:"America/New_York",children:"Eastern Time"}),e.jsx("option",{value:"America/Chicago",children:"Central Time"}),e.jsx("option",{value:"America/Los_Angeles",children:"Pacific Time"}),e.jsx("option",{value:"Europe/London",children:"London"}),e.jsx("option",{value:"Europe/Warsaw",children:"Warsaw"})]})]}),e.jsx("button",{onClick:()=>i(o),children:"Save Schedule"})]}),e.jsx("h4",{children:"Monitoring"}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:(a==null?void 0:a.alertOnFailure)||!1,disabled:!0}),"Alert on failure"]})}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Log Level"}),e.jsxs("select",{value:(a==null?void 0:a.logLevel)||"info",disabled:!0,children:[e.jsx("option",{value:"error",children:"Error"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"debug",children:"Debug"})]})]})]})}function $e({runs:r}){return e.jsxs("div",{className:"nice-etl-builder__history-view",children:[e.jsx("h4",{children:"Run History"}),r.length===0?e.jsx("div",{className:"nice-etl-builder__no-history",children:"No runs yet"}):e.jsxs("table",{className:"nice-etl-builder__history-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Start Time"}),e.jsx("th",{children:"Duration"}),e.jsx("th",{children:"Rows"}),e.jsx("th",{children:"Errors"})]})}),e.jsx("tbody",{children:r.map(a=>e.jsxs("tr",{className:`nice-etl-builder__run nice-etl-builder__run--${a.status}`,children:[e.jsx("td",{children:e.jsxs("span",{className:`nice-etl-builder__status nice-etl-builder__status--${a.status}`,children:[a.status==="success"?"โœ“":a.status==="failed"?"โœ—":"โณ",a.status]})}),e.jsx("td",{children:a.startTime.toLocaleString()}),e.jsx("td",{children:a.endTime?`${Math.round((a.endTime.getTime()-a.startTime.getTime())/1e3)}s`:"-"}),e.jsxs("td",{children:[a.rowsProcessed.toLocaleString()," / ",a.rowsWritten.toLocaleString()]}),e.jsx("td",{children:a.errors.length})]},a.id))})]})]})}const Be={chart:"chart",table:"dataGrid",card:"card",gauge:"gauge",map:"map",text:"text",image:"image",filter:"select",slicer:"select",timeline:"timeline",treemap:"treemap",funnel:"funnel",sankey:"sankey",heatmap:"heatmap"};let Oe=0;const Ve=r=>`${r}-${Date.now().toString(36)}-${(Oe++).toString(36)}`;function We(r){var n;const a=((n=r.layout)==null?void 0:n.columns)??12,i=Array.from(new Set(r.widgets.map(f=>f.dataSource).filter(f=>!!f))),o=r.widgets.map(f=>{var p,s;return{id:f.id,controlType:Be[f.type]??"card",props:{...f.title?{title:f.title}:{},...f.dataSource?{dataSource:f.dataSource}:{},...f.config??{}},colSpan:((p=f.position)==null?void 0:p.width)??4,...(s=f.position)!=null&&s.height?{rowSpan:f.position.height}:{}}});return{id:r.id,name:r.name,version:2,columns:a,dataSources:i.map(f=>({key:f,type:"rest",autoLoad:!0})),rows:[{id:Ve("dash-row"),cells:o}],meta:{description:r.description,tags:["dashboard"]}}}exports.NiceDashboardStudio=Ce;exports.NiceETLBuilder=ze;exports.NiceReportBuilder=he;exports.dashboardToV2=We;
package/dist/index.d.ts CHANGED
@@ -5,4 +5,5 @@
5
5
  export { NiceReportBuilder } from './NiceReportBuilder';
6
6
  export { NiceDashboardStudio } from './NiceDashboardStudio';
7
7
  export { NiceETLBuilder } from './NiceETLBuilder';
8
+ export { dashboardToV2 } from './viewAdapters';
8
9
  export type { DataSource, DataSourceConfig, DataSchema, TableSchema, ColumnSchema, Relationship, Report, ReportQuery, QueryJoin, QueryColumn, QueryCondition, ReportLayout, ReportElement, ReportElementType, DataBinding, ElementStyle, ReportParameter, ReportFilter, ReportSorting, ReportGrouping, CalculatedField, ReportFormatting, ConditionalFormat, DrillDownConfig, DrillDownLevel, Dashboard, DashboardLayout, DashboardWidget, WidgetType, GridPosition, WidgetConfig, ChartType, ChartSeries, ChartAxis, LegendConfig, TableColumn, MapConfig, WidgetInteraction, DashboardFilter, DashboardTheme, SharingConfig, SharedUser, ETLPipeline, ETLSource, ETLTransformation, ETLTransformationType, ETLDestination, ETLSchedule, ETLMonitoring, ETLRun, ETLError, Cube, CubeDimension, CubeMeasure, CubeHierarchy, NiceReportBuilderProps, NiceDashboardStudioProps, NiceETLBuilderProps, NiceCubeBrowserProps, } from './types';