deepspotscreen-sdk 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2804 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class ie{constructor(e,t){this.tokenCache=new Map,this.baseUrl=e.replace(/\/$/,""),this.apiKey=t}async getEmbedToken(e){var o,i,a,f;const t=[e.dashboardId,e.embedType,(o=e.embedLevel)!=null?o:"",(i=e.componentId)!=null?i:"",(a=e.userId)!=null?a:""].join(":"),r=this.tokenCache.get(t);if(r&&r.expiresAt>Date.now()+6e4)return r.token;const s=await this.post("/dashboard-builder/embed-token",{dashboardId:e.dashboardId,embedType:e.embedType,embedLevel:(f=e.embedLevel)!=null?f:"dashboard",componentId:e.componentId,userId:e.userId,tenantId:e.tenantId,expiresIn:3600},{"x-deepspot-api-key":this.apiKey});return this.tokenCache.set(t,{token:s.token,expiresAt:new Date(s.expiresAt).getTime()}),s.token}async getDashboardRender(e,t,r={}){var o;const s=new URLSearchParams({embedType:"dashboard",embedLevel:(o=r.embedLevel)!=null?o:"dashboard"});return r.pageId&&s.set("pageId",r.pageId),r.tabId&&s.set("tabId",r.tabId),r.filters&&Object.entries(r.filters).forEach(([i,a])=>{a!=null&&a!==""&&s.set(`filter[${i}]`,Array.isArray(a)?a.join(","):String(a))}),r.filterOperators&&Object.entries(r.filterOperators).forEach(([i,a])=>{a&&s.set(`filterOp[${i}]`,a)}),r.localFilters&&Object.entries(r.localFilters).forEach(([i,{value:a,operator:f}])=>{const h=Array.isArray(a)?a.join(","):String(a);h&&(s.set(`localFilter[${i}]`,h),f&&s.set(`localFilterOp[${i}]`,f))}),this.get(`/dashboard-builder/embed/${e}/render?${s}`,{"x-embed-token":t})}async getReportRender(e,t,r,s={}){const o=new URLSearchParams({embedType:"report",embedLevel:"report",componentId:t});return s.filters&&Object.entries(s.filters).forEach(([i,a])=>{a!=null&&a!==""&&o.set(`filter[${i}]`,Array.isArray(a)?a.join(","):String(a))}),this.get(`/dashboard-builder/embed/${e}/render?${o}`,{"x-embed-token":r})}async createApiKey(e,t){return this.post("/dashboard-builder/api-keys",e,{Authorization:`Bearer ${t}`})}async listApiKeys(e){return this.get("/dashboard-builder/api-keys",{Authorization:`Bearer ${e}`})}async deleteApiKey(e,t){await this.delete(`/dashboard-builder/api-keys/${e}`,{Authorization:`Bearer ${t}`})}async getTablePage(e,t,r,s,o){return this.get(`/dashboard-builder/embed/${e}/table/${t}/data?page=${r}&pageSize=${s}`,{"x-embed-token":o})}async getFilterOptions(e,t,r){try{const s=await this.get(`/dashboard-builder/embed/${e}/filters/${t}/options`,{"x-embed-token":r});return Array.isArray(s)?s:Array.isArray(s==null?void 0:s.options)?s.options:Array.isArray(s==null?void 0:s.data)?s.data:[]}catch(s){return[]}}clearTokenCache(){this.tokenCache.clear()}async get(e,t={}){const r=await fetch(`${this.baseUrl}${e}`,{method:"GET",headers:{"Content-Type":"application/json",...t}});return this.handleResponse(r)}async post(e,t,r={}){const s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(t)});return this.handleResponse(s)}async delete(e,t={}){const r=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:{"Content-Type":"application/json",...t}});if(!r.ok)throw new Error(`Deepspot SDK: DELETE ${e} failed (${r.status})`)}async handleResponse(e){if(!e.ok){let r=`HTTP ${e.status}`;try{const s=await e.json();r=(s==null?void 0:s.message)||(s==null?void 0:s.error)||r}catch(s){}throw new Error(`Deepspot SDK: ${r}`)}const t=await e.json();return(t==null?void 0:t.data)!==void 0?t.data:t}}class Z{constructor(e){var t,r;this.destroyed=!1,this.refreshTimer=null,this.opts=e,this.filters={...e.activeFilters},this.activePageId=(t=e.activePageId)!=null?t:"",this.activeTabId=(r=e.activeTabId)!=null?r:""}getActiveFilters(){return{...this.filters}}setFilter(e,t){this.filters[e]=t,this.scheduleRefresh()}setFilters(e){Object.assign(this.filters,e),this.scheduleRefresh()}setGlobalFilter(e,t){this.setFilter(e,t)}clearFilters(){this.filters={},this.scheduleRefresh()}goToPage(e){this.opts.embedType==="dashboard"&&(this.activePageId=e,this.opts.renderer.goToPage(e))}goToTab(e,t){this.opts.embedType==="dashboard"&&(this.activePageId=e,this.activeTabId=t,this.opts.renderer.goToTab(e,t))}async refresh(){if(!this.destroyed)try{const e=await this.fetchData();this.opts.renderer.update(e)}catch(e){console.error("Deepspot SDK: refresh failed",e)}}exportPDF(){this.opts.embedType==="dashboard"&&this.opts.renderer.exportPDF()}destroy(){this.destroyed=!0,this.refreshTimer&&clearTimeout(this.refreshTimer),this.opts.renderer.destroy(),this.opts.apiClient.clearTokenCache()}scheduleRefresh(){this.refreshTimer&&clearTimeout(this.refreshTimer),this.refreshTimer=setTimeout(()=>this.refresh(),300)}async fetchData(){const{apiClient:e,dashboardId:t,componentId:r,token:s,embedType:o,embedLevel:i}=this.opts;return o==="report"&&r?e.getReportRender(t,r,s,{filters:this.filters}):e.getDashboardRender(t,s,{embedLevel:i,pageId:this.activePageId||void 0,tabId:this.activeTabId||void 0,filters:this.filters})}}const ae=24,j=10,V=12;class Q{constructor(e,t=0){this.containerWidth=e,this.minY=t}get colWidth(){return this.containerWidth/ae}toPx(e){const t=this.colWidth,r=V/2;return{left:e.x*t+r,top:(e.y-this.minY)*j+r,width:e.w*t-V,height:e.h*j-V}}static totalHeight(e){if(!e.length)return 400;const t=Math.min(...e.map(s=>s.y));return(Math.max(...e.map(s=>s.y+s.h))-t)*j+40}applyStyles(e,t){const r=this.toPx(t);e.style.position="absolute",e.style.left=`${r.left}px`,e.style.top=`${r.top}px`,e.style.width=`${r.width}px`,e.style.height=`${r.height}px`}}let q=null;function de(){return q||(q=Promise.resolve().then(()=>require("./apexcharts.common-DGzslxI3.cjs")).then(P=>P.apexcharts_common)),q}class re{constructor(e){this.chart=null,this.container=e}async render(e,t,r,s){if(!t||t.length===0){this.renderEmpty(e.title);return}const o=this.buildOptions(e,t,r,s);if(!o){this.renderEmpty(e.title);return}this.container.innerHTML=`
2
+ <div class="ds-chart-card">
3
+ <div class="ds-chart-title">${e.title||""}</div>
4
+ <div class="ds-chart-body" id="ds-chart-body-${e.id}"></div>
5
+ </div>
6
+ `;const i=this.container.querySelector(`#ds-chart-body-${e.id}`);if(i)try{this.chart&&this.chart.destroy();const{default:a}=await de();this.chart=new a(i,o),this.chart.render()}catch(a){console.error("[Deepspot SDK] ChartRenderer error:",a),i.innerHTML='<div class="ds-chart-empty">Chart render error</div>'}}async update(e,t,r){if(!this.chart||!t||t.length===0){await this.render(e,t,r);return}const{series:s,categories:o}=this.extractSeriesAndCategories(e,t);try{this.chart.updateOptions({series:s,xaxis:{categories:o},theme:{mode:r}})}catch(i){this.render(e,t,r)}}destroy(){var e;try{(e=this.chart)==null||e.destroy()}catch(t){}this.chart=null}buildOptions(e,t,r,s){const o=e.type;return o==="pie"||o==="donut"?this.buildPieOptions(e,t,r,s):o==="bar"||o==="line"||o==="area"?this.buildCartesianOptions(e,t,r,s):null}buildCartesianOptions(e,t,r,s){var g;const{series:o,categories:i,xAxisLabel:a,yAxisLabel:f,seriesColors:h}=this.extractSeriesAndCategories(e,t),v=e.properties||{},m=["#4f46e5","#10b981","#f59e0b","#ef4444","#3b82f6","#8b5cf6","#ec4899","#14b8a6"];let p;if(h.length>0&&h.length===o.length)p=h;else{const u=v.colors?Object.values(v.colors).filter(Boolean):[];p=u.length>0?u:m}const n=r==="dark";return{chart:{type:e.type==="area"?"area":e.type==="line"?"line":"bar",toolbar:{show:!1},background:"transparent",animations:{enabled:!0,speed:400},fontFamily:"inherit",height:s!=null?s:"100%"},theme:{mode:r},series:o,xaxis:{categories:i,title:{text:a},labels:{rotate:i.length>8?-45:0,style:{colors:n?"#94a3b8":"#6b7280",fontSize:"11px"}},axisBorder:{color:n?"#334155":"#e5e7eb"},axisTicks:{color:n?"#334155":"#e5e7eb"}},yaxis:{title:{text:f},labels:{style:{colors:n?"#94a3b8":"#6b7280",fontSize:"11px"}}},colors:p,legend:{show:o.length>1||((g=v.showLegend)!=null?g:!1),position:"bottom",labels:{colors:n?"#94a3b8":"#6b7280"}},grid:{borderColor:n?"#1e293b":"#f3f4f6",strokeDashArray:4,padding:{bottom:i.length>8?60:10}},tooltip:{theme:r},stroke:{curve:"smooth",width:e.type==="bar"?0:2},fill:e.type==="area"?{type:"gradient",gradient:{shadeIntensity:.5,opacityFrom:.4,opacityTo:0}}:{},dataLabels:{enabled:!1},plotOptions:{bar:{borderRadius:4,distributed:o.length===1}}}}buildPieOptions(e,t,r,s){const o=e.properties||{},i=t.length>0?Object.keys(t[0]):[],a=i[0]||"label",f=i[1]||"value",h=t.map(u=>{var b;return String((b=u[a])!=null?b:"")}),v=t.map(u=>Number(u[f])||0),m=r==="dark",p=["#4f46e5","#10b981","#f59e0b","#ef4444","#3b82f6","#8b5cf6","#ec4899","#14b8a6"],n=o.colors?Object.values(o.colors).filter(Boolean):[],g=n.length>0?n:p;return{chart:{type:e.type,toolbar:{show:!1},background:"transparent",fontFamily:"inherit",height:s!=null?s:"100%"},theme:{mode:r},series:v,labels:h,colors:g,legend:{position:"bottom",labels:{colors:m?"#94a3b8":"#6b7280"}},tooltip:{theme:r},dataLabels:{enabled:h.length<=8},plotOptions:{pie:{donut:{size:e.type==="donut"?"65%":"0%"}}}}}extractSeriesAndCategories(e,t){const r=e.properties||{},s=t.length>0?Object.keys(t[0]):[],o=r.xAxis||s[0]||"x";let i=[];if(r.selectedYAxisColumn)try{const n=typeof r.selectedYAxisColumn=="string"?JSON.parse(r.selectedYAxisColumn):r.selectedYAxisColumn;Array.isArray(n)&&(i=n.map(g=>typeof g=="string"?{column:g}:g))}catch(n){}if(!i.length&&r.yAxis){const n=r.yAxis;i=(Array.isArray(n)?n:[n]).map(u=>({column:String(u)}))}!i.length&&s.length>1&&(i=s.slice(1).map(n=>({column:n})));const a=t.map(n=>{var g;return String((g=n[o])!=null?g:"")}),f=t.length>0?Object.keys(t[0]):[],h=i.map(n=>{const g=f.includes(n.column)?n.column:null,u=g?null:f.find(d=>d.includes(n.column)||n.column.includes(d)),b=!g&&!u?f.find(d=>{var c;return d!==o&&!isNaN(Number((c=t[0])==null?void 0:c[d]))}):null,l=g||u||b||n.column;return{name:n.column,data:t.map(d=>{const c=d[l];return c!=null?Number(c):null})}}),v=i.map(n=>n.color||n.colorHex||"").filter(Boolean),m=r.xAxisLabel||o,p=r.yAxisLabel||(i.length===1?i[0].column:"");return{series:h,categories:a,xAxisLabel:m,yAxisLabel:p,seriesColors:v}}renderEmpty(e){this.container.innerHTML=`
7
+ <div class="ds-chart-card">
8
+ ${e?`<div class="ds-chart-title">${e}</div>`:""}
9
+ <div class="ds-chart-empty">No data available</div>
10
+ </div>
11
+ `}}class se{constructor(){this.columns=[],this.allData=[],this.currentRows=[],this.totalRows=0,this.currentPage=1,this.currentPageSize=10,this.searchTerm="",this.isLoading=!1}render(e,t,r,s){var v;this.container=e,this.component=t,this.fetchPage=s,this.searchTerm="",this.currentPage=1,this.currentPageSize=10;const o=r&&!Array.isArray(r)&&"rows"in r;if(o){const m=r;this.currentRows=m.rows,this.allData=[],this.totalRows=m.total,this.currentPage=m.page,this.currentPageSize=m.pageSize}else this.allData=r||[],this.currentRows=[],this.totalRows=this.allData.length,this.currentPage=1;if(o&&r.rows.length===0&&r.total===0||!o&&this.allData.length===0){e.innerHTML=`
12
+ <div class="ds-table-card">
13
+ <div class="ds-table-header-row">
14
+ <span class="ds-table-dot"></span>
15
+ <div class="ds-table-title">${this.escape(t.title||"")}</div>
16
+ </div>
17
+ <div class="ds-chart-empty">No data available</div>
18
+ </div>
19
+ `;return}const i=o?r.rows[0]:this.allData[0],a=i?Object.keys(i):[],f=((v=t.properties)==null?void 0:v.columns)||[],h=f.length?f.filter(m=>a.includes(m)):[];this.columns=h.length?h:a,this.paint()}paint(){const{rows:e,startNum:t}=this.getPageRows(),r=Math.max(1,Math.ceil(this.totalRows/this.currentPageSize)),s=(this.currentPage-1)*this.currentPageSize+1,o=this.fetchPage?Math.min(s-1+(this.isLoading?this.currentPageSize:e.length),this.totalRows):Math.min(this.currentPage*this.currentPageSize,this.totalRows),i=this.columns.map(p=>`<th>${this.escape(this.formatHeader(p))}</th>`).join(""),a=e.length===0?`<tr><td colspan="${this.columns.length+1}" style="text-align:center;padding:20px;color:#9ca3af">No results found</td></tr>`:e.map((p,n)=>{const g=this.columns.map(u=>{const b=p[u];return`<td title="${this.escape(String(b!=null?b:""))}">${this.escape(this.formatValue(b))}</td>`}).join("");return`<tr><td class="ds-table-sno">${t+n}</td>${g}</tr>`}).join(""),f=this.currentPageSize,h=[10,25,50,100].map(p=>`<option value="${p}"${p===f?" selected":""}>${p}</option>`).join(""),v=this.currentPage<=1,m=this.currentPage>=r;this.container.innerHTML=`
20
+ <div class="ds-table-card">
21
+ <div class="ds-table-header-row">
22
+ <div class="ds-table-title-wrap">
23
+ <span class="ds-table-dot"></span>
24
+ <span class="ds-table-title">${this.escape(this.component.title||"")}</span>
25
+ </div>
26
+ </div>
27
+ <div class="ds-table-scroll">
28
+ <table class="ds-table">
29
+ <thead><tr><th class="ds-table-sno-th">S.No</th>${i}</tr></thead>
30
+ <tbody>${a}</tbody>
31
+ </table>
32
+ </div>
33
+ <div class="ds-table-footer">
34
+ <div class="ds-table-info">
35
+ <span>${s.toLocaleString()}–${o.toLocaleString()} of ${this.totalRows.toLocaleString()}</span>
36
+ <span class="ds-table-rows-label">Rows:</span>
37
+ <select class="ds-table-page-size">${h}</select>
38
+ </div>
39
+ <div class="ds-table-pagination">
40
+ <button class="ds-table-pg-btn" data-action="first" ${v?"disabled":""}>&#171;</button>
41
+ <button class="ds-table-pg-btn" data-action="prev" ${v?"disabled":""}>Previous</button>
42
+ <span class="ds-table-pg-info">Page ${this.currentPage} of ${r}</span>
43
+ <button class="ds-table-pg-btn" data-action="next" ${m?"disabled":""}>Next</button>
44
+ <button class="ds-table-pg-btn" data-action="last" ${m?"disabled":""}>&#187;</button>
45
+ </div>
46
+ </div>
47
+ ${this.isLoading?'<div class="ds-table-loading-overlay"><div class="ds-embed-spinner"></div></div>':""}
48
+ </div>
49
+ `,this.attachEvents()}attachEvents(){const e=this.container.querySelector(".ds-table-search");e==null||e.addEventListener("input",()=>{this.searchTerm=e.value,this.currentPage=1,this.fetchPage||(this.totalRows=this.filteredRows().length,this.paint())});const t=this.container.querySelector(".ds-table-page-size");t==null||t.addEventListener("change",()=>{this.currentPageSize=parseInt(t.value,10),this.currentPage=1,this.fetchPage?this.loadPage(1):(this.totalRows=this.filteredRows().length,this.paint())}),this.container.querySelectorAll("[data-action]").forEach(r=>{r.addEventListener("click",()=>{if(r.disabled)return;const s=Math.max(1,Math.ceil(this.totalRows/this.currentPageSize)),o=r.dataset.action;let i=this.currentPage;o==="first"?i=1:o==="prev"?i=Math.max(1,this.currentPage-1):o==="next"?i=Math.min(s,this.currentPage+1):o==="last"&&(i=s),(i!==this.currentPage||o==="first"||o==="last")&&(this.currentPage=i,this.fetchPage?this.loadPage(i):this.paint())})})}async loadPage(e){if(this.fetchPage){this.isLoading=!0,this.currentPage=e,this.paint();try{const t=await this.fetchPage(e,this.currentPageSize);this.currentRows=t.rows||[],this.totalRows=Number(t.total)||this.currentRows.length,this.currentPage=Number(t.page)||e}catch(t){console.error("[Deepspot SDK] TableRenderer: page fetch failed",t)}finally{this.isLoading=!1,this.paint()}}}getPageRows(){const e=(this.currentPage-1)*this.currentPageSize+1;if(this.fetchPage)return{rows:this.currentRows,startNum:e};const t=this.filteredRows(),r=(this.currentPage-1)*this.currentPageSize;return{rows:t.slice(r,r+this.currentPageSize),startNum:e}}filteredRows(){if(!this.searchTerm)return this.allData;const e=this.searchTerm.toLowerCase();return this.allData.filter(t=>this.columns.some(r=>{var s;return String((s=t[r])!=null?s:"").toLowerCase().includes(e)}))}formatHeader(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}formatValue(e){return e==null?"—":typeof e=="number"?e%1===0?e.toLocaleString():e.toFixed(2):String(e)}escape(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}class oe{render(e,t,r){var g;const s=t.properties||{};let o=null;if(r&&r.length>0){const u=r[0],b=s.metric||Object.keys(u)[0],l=u[b];if(l!==void 0)o=l;else{const d=Object.keys(u).find(c=>c.includes(b)||b.includes(c));o=u[d!=null?d:Object.keys(u)[0]]}}let i;if(o==null)try{const u=(g=s==null?void 0:s.data)==null?void 0:g.dataContent,b=u?typeof u=="string"?JSON.parse(u):u:null;i=b!=null&&b.value?String(b.value):"—"}catch(u){i="—"}else i=this.formatValue(o,s);const a=s.styleConfig||{},f=a.backgroundColor||s.backgroundColor||"",h=a.color||a.textColor||s.textColor||"",v=t.title||"",m=f?`background:${f};border:none;`:"",p=h?`color:${h};`:"",n=h?`color:${h};opacity:0.7;`:"";e.innerHTML=`
50
+ <div class="ds-card"${m?` style="${m}"`:""}>
51
+ <div class="ds-card-label"${n?` style="${n}"`:""}>${v}</div>
52
+ <div class="ds-card-value"${p?` style="${p}"`:""}>${i}</div>
53
+ </div>
54
+ `}formatValue(e,t){if(e==null)return"—";const r=Number(e);if(isNaN(r))return String(e);const s=(t==null?void 0:t.prefix)||(t==null?void 0:t.currencySymbol)||"",o=(t==null?void 0:t.suffix)||"",i=r%1===0?r.toLocaleString():parseFloat(r.toFixed(2)).toLocaleString();return`${s}${i}${o}`}}const ne=[{value:"=",label:"Equals (=)"},{value:"!=",label:"Not Equals (!=)"},{value:"LIKE",label:"Contains"},{value:"NOT LIKE",label:"Not Contains"},{value:"STARTS_WITH",label:"Starts With"},{value:"IN",label:"In (Multiple)"},{value:"NOT IN",label:"Not In"},{value:">",label:"Greater Than (>)"},{value:">=",label:"Greater or Equal (>=)"},{value:"<",label:"Less Than (<)"},{value:"<=",label:"Less or Equal (<=)"},{value:"IS NULL",label:"Is Empty"},{value:"IS NOT NULL",label:"Is Not Empty"}];class le{constructor(e,t){this.filters=[],this.state=new Map,this.activePopoverId=null,this.container=e,this.onFilterChange=t}render(e,t={}){var r,s,o;if(!e||e.length===0){this.container.style.display="none";return}this.container.style.display="",this.filters=e,this.state.clear();for(const i of e){const a=i.applyToField||i.filterId,f=(r=t[i.filterId])!=null?r:t[a],h=f?Array.isArray(f)?f.map(String):[String(f)]:[];this.state.set(i.filterId,{operator:i.filterOperator||"=",tempValues:[...h],activeValues:[...h],options:(o=(s=i.options)==null?void 0:s.map(v=>v))!=null?o:[],loading:!1,search:""})}this.paint()}updateOptions(e,t){const r=this.state.get(e);r&&(r.loading=!1,r.options=t,this.refreshPopoverOpts(e))}setLoading(e,t){const r=this.state.get(e);r&&(r.loading=t,this.refreshPopoverOpts(e))}updateValues(e){for(const[t,r]of Object.entries(e)){const s=this.filters.find(a=>(a.applyToField||a.filterId)===t||a.filterId===t);if(!s)continue;const o=this.state.get(s.filterId);if(!o)continue;const i=r?Array.isArray(r)?r.map(String):[String(r)]:[];o.activeValues=i,o.tempValues=[...i]}this.repaintBadges()}paint(){this.container.innerHTML=`
55
+ <div class="ds-fp-v3">
56
+ <div class="ds-fp-v3-bar" id="ds-fp-v3-bar">
57
+ <span class="ds-fp-v3-label">
58
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
59
+ stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
60
+ <polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>
61
+ </svg>
62
+ Filters:
63
+ </span>
64
+ <div class="ds-fp-v3-badges" id="ds-fp-v3-badges">
65
+ ${this.filters.map(e=>this.renderBadge(e)).join("")}
66
+ </div>
67
+ </div>
68
+ <!-- Popovers rendered per filter -->
69
+ ${this.filters.map(e=>this.renderPopoverHtml(e)).join("")}
70
+ </div>`,this.bindAll(),this.closePopoverOnOutsideClick()}renderBadge(e){return`
71
+ <button type="button"
72
+ class="ds-fp-v3-badge${this.state.get(e.filterId).activeValues.length>0?" ds-fp-v3-badge-active":""}"
73
+ data-filter-id="${this.escAttr(e.filterId)}">
74
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor"
75
+ stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
76
+ <polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>
77
+ </svg>
78
+ ${this.escText(e.label)}
79
+ </button>`}renderPopoverHtml(e){const t=this.state.get(e.filterId);return`
80
+ <div class="ds-fp-v3-pop" id="ds-fp-pop-${this.escAttr(e.filterId)}" style="display:none">
81
+ <div class="ds-fp-v3-pop-hd">
82
+ <span class="ds-fp-v3-pop-title">
83
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
84
+ stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
85
+ <polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>
86
+ </svg>
87
+ Filter
88
+ </span>
89
+ <div class="ds-fp-v3-pop-actions">
90
+ <button type="button" class="ds-fp-v3-pop-icon-btn ds-fp-v3-pop-close-btn"
91
+ data-filter-id="${this.escAttr(e.filterId)}" title="Close">
92
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
93
+ stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
94
+ <line x1="18" y1="6" x2="6" y2="18"/>
95
+ <line x1="6" y1="6" x2="18" y2="18"/>
96
+ </svg>
97
+ </button>
98
+ </div>
99
+ </div>
100
+ <div class="ds-fp-v3-pop-body">
101
+ <div class="ds-fp-v3-field">
102
+ <label class="ds-fp-v3-field-lbl">CONDITION</label>
103
+ <select class="ds-fp-v3-condition" data-filter-id="${this.escAttr(e.filterId)}">
104
+ ${ne.map(r=>`<option value="${this.escAttr(r.value)}"${r.value===t.operator?" selected":""}>${r.label}</option>`).join("")}
105
+ </select>
106
+ </div>
107
+ <div class="ds-fp-v3-field">
108
+ <label class="ds-fp-v3-field-lbl">VALUES</label>
109
+ ${this.renderValuesControl(e,t)}
110
+ </div>
111
+ </div>
112
+ <div class="ds-fp-v3-pop-footer">
113
+ <button type="button" class="ds-fp-v3-clear-btn"
114
+ data-filter-id="${this.escAttr(e.filterId)}">Clear</button>
115
+ <button type="button" class="ds-fp-v3-apply-btn"
116
+ data-filter-id="${this.escAttr(e.filterId)}">Apply Filter</button>
117
+ </div>
118
+ </div>`}renderValuesControl(e,t){var r,s,o;return e.type==="date-range"?`
119
+ <div class="ds-fp-v3-date-range">
120
+ <input type="date" class="ds-fp-v3-date" data-part="from"
121
+ data-filter-id="${this.escAttr(e.filterId)}"
122
+ value="${this.escAttr((r=t.tempValues[0])!=null?r:"")}" placeholder="From"/>
123
+ <span class="ds-fp-v3-date-sep">–</span>
124
+ <input type="date" class="ds-fp-v3-date" data-part="to"
125
+ data-filter-id="${this.escAttr(e.filterId)}"
126
+ value="${this.escAttr((s=t.tempValues[1])!=null?s:"")}" placeholder="To"/>
127
+ </div>`:e.type==="text-input"||e.type==="number-input"?`<input type="${e.type==="number-input"?"number":"text"}"
128
+ class="ds-fp-v3-text-input"
129
+ data-filter-id="${this.escAttr(e.filterId)}"
130
+ value="${this.escAttr((o=t.tempValues[0])!=null?o:"")}"
131
+ placeholder="Enter value…"/>`:this.renderMultiSelectControl(e,t)}renderMultiSelectControl(e,t){const r=t.tempValues.length===0?"":t.tempValues.length===1?this.optLabel(e.filterId,t.tempValues[0]):`${t.tempValues.length} selected`;return`
132
+ <div class="ds-fp-v3-ms-wrap" data-filter-id="${this.escAttr(e.filterId)}">
133
+ <div class="ds-fp-v3-ms-trigger" data-filter-id="${this.escAttr(e.filterId)}">
134
+ <span class="ds-fp-v3-ms-display">${r||"Type to search..."}</span>
135
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
136
+ stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
137
+ <polyline points="6 9 12 15 18 9"/>
138
+ </svg>
139
+ </div>
140
+ <div class="ds-fp-v3-ms-drop" id="ds-fp-drop-${this.escAttr(e.filterId)}" style="display:none">
141
+ <input type="text" class="ds-fp-v3-ms-search"
142
+ data-filter-id="${this.escAttr(e.filterId)}"
143
+ placeholder="Search ${this.escAttr(e.label)}…"
144
+ value="${this.escAttr(t.search)}"/>
145
+ <div class="ds-fp-v3-ms-opts" id="ds-fp-opts-${this.escAttr(e.filterId)}">
146
+ ${this.renderOpts(e.filterId,t)}
147
+ </div>
148
+ </div>
149
+ ${t.tempValues.length>0?`
150
+ <div class="ds-fp-v3-chips" id="ds-fp-chips-${this.escAttr(e.filterId)}">
151
+ ${t.tempValues.map(s=>`
152
+ <span class="ds-fp-v3-chip">
153
+ ${this.escText(this.optLabel(e.filterId,s))}
154
+ <button type="button" class="ds-fp-v3-chip-x"
155
+ data-val="${this.escAttr(s)}"
156
+ data-filter-id="${this.escAttr(e.filterId)}">✕</button>
157
+ </span>`).join("")}
158
+ </div>`:`<div class="ds-fp-v3-chips" id="ds-fp-chips-${this.escAttr(e.filterId)}"></div>`}
159
+ </div>`}renderOpts(e,t){if(t.loading)return'<div class="ds-fp-v3-opts-msg"><span class="ds-dd-spinner"></span> Loading…</div>';const r=t.search.toLowerCase(),s=t.options.filter(o=>(typeof o=="string"?o:o.label).toLowerCase().includes(r));return t.options.length?s.length?s.map(o=>{const i=typeof o=="string"?o:o.value,a=typeof o=="string"?o:o.label,f=t.tempValues.includes(i);return`
160
+ <label class="ds-fp-v3-opt${f?" ds-fp-v3-opt-on":""}" data-val="${this.escAttr(i)}"
161
+ data-filter-id="${this.escAttr(e)}">
162
+ <span class="ds-fp-v3-cb${f?" ds-fp-v3-cb-on":""}">
163
+ ${f?`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"
164
+ stroke-linecap="round" stroke-linejoin="round" width="10" height="10">
165
+ <polyline points="20 6 9 17 4 12"/>
166
+ </svg>`:""}
167
+ </span>
168
+ <span>${this.escText(a)}</span>
169
+ </label>`}).join(""):'<div class="ds-fp-v3-opts-msg">No matches</div>':'<div class="ds-fp-v3-opts-msg">No options yet</div>'}bindAll(){var e;this.container.querySelectorAll(".ds-fp-v3-badge").forEach(t=>{t.addEventListener("click",r=>{r.stopPropagation();const s=t.dataset.filterId;this.togglePopover(s,t)})}),(e=this.container.querySelector("#ds-fp-v3-add"))==null||e.addEventListener("click",t=>{t.stopPropagation();const r=this.filters.find(o=>this.state.get(o.filterId).activeValues.length===0);if(!r)return;const s=this.container.querySelector(`.ds-fp-v3-badge[data-filter-id="${r.filterId}"]`);s&&this.togglePopover(r.filterId,s)}),this.filters.forEach(t=>this.bindPopover(t))}bindPopover(e){var o,i,a,f,h,v,m;const t=this.container.querySelector(`#ds-fp-pop-${e.filterId}`);if(!t)return;const r=this.state.get(e.filterId);(o=t.querySelector(`.ds-fp-v3-condition[data-filter-id="${e.filterId}"]`))==null||o.addEventListener("change",p=>{r.operator=p.target.value}),(i=t.querySelector(`.ds-fp-v3-text-input[data-filter-id="${e.filterId}"]`))==null||i.addEventListener("input",p=>{const n=p.target.value;r.tempValues=n?[n]:[]}),t.querySelectorAll(`.ds-fp-v3-date[data-filter-id="${e.filterId}"]`).forEach(p=>{p.addEventListener("change",()=>{var u,b,l,d;const n=(b=(u=t.querySelector(`[data-part="from"][data-filter-id="${e.filterId}"]`))==null?void 0:u.value)!=null?b:"",g=(d=(l=t.querySelector(`[data-part="to"][data-filter-id="${e.filterId}"]`))==null?void 0:l.value)!=null?d:"";r.tempValues=[n,g]})}),(a=t.querySelector(`.ds-fp-v3-ms-trigger[data-filter-id="${e.filterId}"]`))==null||a.addEventListener("click",p=>{p.stopPropagation();const n=t.querySelector(`#ds-fp-drop-${e.filterId}`);if(n){const g=n.style.display!=="none";if(n.style.display=g?"none":"",!g){const u=n.querySelector(".ds-fp-v3-ms-search");u==null||u.focus()}}});const s=t.querySelector(`.ds-fp-v3-ms-search[data-filter-id="${e.filterId}"]`);s&&s.addEventListener("input",()=>{r.search=s.value,this.repaintOpts(e.filterId)}),this.bindOpts(e.filterId,t),this.bindChips(e.filterId,t),(f=t.querySelector(`.ds-fp-v3-pop-clear-btn[data-filter-id="${e.filterId}"]`))==null||f.addEventListener("click",()=>this.clearFilter(e.filterId)),(h=t.querySelector(`.ds-fp-v3-pop-close-btn[data-filter-id="${e.filterId}"]`))==null||h.addEventListener("click",()=>this.closePopover(e.filterId)),(v=t.querySelector(`.ds-fp-v3-clear-btn[data-filter-id="${e.filterId}"]`))==null||v.addEventListener("click",()=>this.clearFilter(e.filterId)),(m=t.querySelector(`.ds-fp-v3-apply-btn[data-filter-id="${e.filterId}"]`))==null||m.addEventListener("click",()=>this.applyFilter(e.filterId))}bindOpts(e,t){const r=this.state.get(e);t.querySelectorAll(`.ds-fp-v3-opt[data-filter-id="${e}"]`).forEach(s=>{s.addEventListener("click",o=>{var a;o.stopPropagation();const i=(a=s.dataset.val)!=null?a:"";r.tempValues.includes(i)?r.tempValues=r.tempValues.filter(f=>f!==i):r.tempValues=[...r.tempValues,i],this.repaintOpts(e),this.repaintChips(e)})})}bindChips(e,t){const r=this.state.get(e);t.querySelectorAll(`.ds-fp-v3-chip-x[data-filter-id="${e}"]`).forEach(s=>{s.addEventListener("click",o=>{o.stopPropagation(),r.tempValues=r.tempValues.filter(i=>{var a;return i!==((a=s.dataset.val)!=null?a:"")}),this.repaintOpts(e),this.repaintChips(e)})})}togglePopover(e,t){if(this.activePopoverId===e){this.closePopover(e);return}this.activePopoverId&&this.closePopover(this.activePopoverId);const r=this.container.querySelector(`#ds-fp-pop-${e}`);if(!r)return;const s=this.container.getBoundingClientRect(),o=t.getBoundingClientRect();r.style.top=`${o.bottom-s.top+4}px`,r.style.left=`${o.left-s.left}px`,r.style.display="",this.activePopoverId=e;const i=this.state.get(e);i.tempValues=[...i.activeValues],i.search="",this.repaintOpts(e),this.repaintChips(e);const a=r.querySelector(`#ds-fp-drop-${e}`);a&&(a.style.display="none")}closePopover(e){const t=this.container.querySelector(`#ds-fp-pop-${e}`);t&&(t.style.display="none"),this.activePopoverId===e&&(this.activePopoverId=null)}closePopoverOnOutsideClick(){document.addEventListener("mousedown",e=>{if(!this.activePopoverId)return;const t=this.container.querySelector(`#ds-fp-pop-${this.activePopoverId}`),r=this.container.querySelector("#ds-fp-v3-bar");t&&!t.contains(e.target)&&r&&!r.contains(e.target)&&this.closePopover(this.activePopoverId)},{capture:!0})}applyFilter(e){var o;const t=this.state.get(e),r=this.filters.find(i=>i.filterId===e);t.activeValues=[...t.tempValues];let s;r.type==="date-range"?s=t.tempValues.length>=2&&(t.tempValues[0]||t.tempValues[1])?{from:t.tempValues[0],to:t.tempValues[1]}:"":r.type==="multi-select"||t.tempValues.length>1?s=t.tempValues.length>0?[...t.tempValues]:"":s=(o=t.tempValues[0])!=null?o:"",this.repaintBadge(e),this.closePopover(e),this.onFilterChange(e,s,t.operator)}clearFilter(e){const t=this.state.get(e);t.tempValues=[],t.activeValues=[],this.repaintBadge(e),this.repaintOpts(e),this.repaintChips(e),this.closePopover(e),this.onFilterChange(e,"",void 0)}repaintBadge(e){const t=this.state.get(e),r=this.container.querySelector(`.ds-fp-v3-badge[data-filter-id="${e}"]`);r&&(t.activeValues.length>0?r.classList.add("ds-fp-v3-badge-active"):r.classList.remove("ds-fp-v3-badge-active"))}repaintBadges(){this.filters.forEach(e=>this.repaintBadge(e.filterId))}repaintOpts(e){const t=this.state.get(e);if(!t)return;const r=this.container.querySelector(`#ds-fp-opts-${e}`);if(!r)return;r.innerHTML=this.renderOpts(e,t);const s=this.container.querySelector(`#ds-fp-pop-${e}`);s&&this.bindOpts(e,s)}refreshPopoverOpts(e){this.repaintOpts(e);const t=this.state.get(e);if(!t)return;const r=this.container.querySelector(`.ds-fp-v3-ms-trigger[data-filter-id="${e}"] .ds-fp-v3-ms-display`);r&&(r.textContent=t.tempValues.length===0?"Type to search...":t.tempValues.length===1?this.optLabel(e,t.tempValues[0]):`${t.tempValues.length} selected`)}repaintChips(e){const t=this.state.get(e);if(!t)return;const r=this.container.querySelector(`#ds-fp-chips-${e}`);if(!r)return;if(t.tempValues.length===0){r.innerHTML="";const i=this.container.querySelector(`.ds-fp-v3-ms-trigger[data-filter-id="${e}"] .ds-fp-v3-ms-display`);i&&(i.textContent="Type to search...");return}const s=this.filters.find(i=>i.filterId===e);r.innerHTML=t.tempValues.map(i=>`
170
+ <span class="ds-fp-v3-chip">
171
+ ${this.escText(this.optLabel(s.filterId,i))}
172
+ <button type="button" class="ds-fp-v3-chip-x"
173
+ data-val="${this.escAttr(i)}"
174
+ data-filter-id="${this.escAttr(e)}">✕</button>
175
+ </span>`).join(""),this.bindChips(e,r);const o=this.container.querySelector(`.ds-fp-v3-ms-trigger[data-filter-id="${e}"] .ds-fp-v3-ms-display`);o&&(o.textContent=t.tempValues.length===1?this.optLabel(e,t.tempValues[0]):`${t.tempValues.length} selected`)}resetAll(){this.state.forEach(e=>{e.tempValues=[],e.activeValues=[]}),this.repaintBadges(),this.activePopoverId&&this.closePopover(this.activePopoverId),this.onFilterChange("__reset_all__",null)}optLabel(e,t){const r=this.state.get(e);if(!r)return t;const s=r.options.find(o=>(typeof o=="string"?o:o.value)===t);return s?typeof s=="string"?s:s.label:t}escAttr(e){return String(e!=null?e:"").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}escText(e){return String(e!=null?e:"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}const z=class z{constructor(e,t){this.activePageId="",this.activeTabId="",this.activeFilters={},this.activeFilterOperators={},this.activeLocalFilters={},this.chartRenderers=new Map,this.tableRenderer=new se,this.cardRenderer=new oe,this.isLoadingTab=!1,this.tooltipEl=null,this.root=e,this.opts=t,this.activeFilters={...t.initialFilters}}render(e){var t,r;this.renderData=e,this.activePageId=e.activePage,this.activeTabId=e.activeTab,this.buildShell(),this.renderNavigation(),this.renderFilterBar(),this.renderGrid(),(r=(t=this.opts).onReady)==null||r.call(t)}update(e){this.renderData=e,this.activePageId=e.activePage,this.activeTabId=e.activeTab,this.isLoadingTab=!1,this.syncNavHighlight(),this.updateFilterBar(),this.renderGrid()}goToPage(e){const t=this.getTabsForPage(e)[0];t&&this.triggerTabSwitch(e,t.id)}goToTab(e,t){this.triggerTabSwitch(e,t)}destroy(){this.chartRenderers.forEach(e=>e.destroy()),this.chartRenderers.clear(),this.root.innerHTML=""}exportPDF(){var p,n;const e=this.root.querySelector("#ds-grid");if(!e)return;const t=this.root.style.height,r=this.root.style.overflow;this.root.style.height="auto",this.root.style.overflow="visible";const s=this.root.querySelector("#ds-canvas"),o=(p=s==null?void 0:s.style.height)!=null?p:"",i=(n=s==null?void 0:s.style.overflow)!=null?n:"";s&&(s.style.height="auto",s.style.overflow="visible");const a=Array.from(e.querySelectorAll(".ds-table-scroll")),f=a.map(g=>({el:g,overflow:g.style.overflow,maxHeight:g.style.maxHeight,height:g.style.height}));a.forEach(g=>{g.style.overflow="visible",g.style.maxHeight="none",g.style.height="auto"});const h=e.offsetWidth,v=parseInt(e.style.height,10)||e.offsetHeight,m=e.getBoundingClientRect().top+window.scrollY;Promise.resolve().then(()=>require("./html2canvas.esm-EoNFmhrp.cjs")).then(({default:g})=>g(e,{scale:2,useCORS:!0,allowTaint:!0,logging:!1,width:h,height:v,windowWidth:h,windowHeight:v,scrollX:0,scrollY:-m}).then(u=>{this.root.style.height=t,this.root.style.overflow=r,s&&(s.style.height=o,s.style.overflow=i),f.forEach(({el:b,overflow:l,maxHeight:d,height:c})=>{b.style.overflow=l,b.style.maxHeight=d,b.style.height=c}),Promise.resolve().then(()=>require("./jspdf.es.min-D6GjoB2T.cjs")).then(b=>b.jspdf_es_min).then(({jsPDF:b})=>{const l=u.width/2,d=u.height/2,c=new b({orientation:l>=d?"landscape":"portrait",unit:"px",format:[l,d]});c.addImage(u.toDataURL("image/png"),"PNG",0,0,l,d),c.save(`${this.renderData.dashboard.name||"dashboard"}.pdf`)})}))}exportCSV(){this.renderData.components.forEach(e=>{const t=this.renderData.data[e.id];if(!(t!=null&&t.length)||!["table","bar","line","area"].includes(e.type))return;const r=Object.keys(t[0]),s=[r.join(","),...t.map(i=>r.map(a=>{var f;return JSON.stringify((f=i[a])!=null?f:"")}).join(","))].join(`
176
+ `);Object.assign(document.createElement("a"),{href:URL.createObjectURL(new Blob([s],{type:"text/csv"})),download:`${e.title||e.id}.csv`}).click()})}getActiveFilters(){return{...this.activeFilters}}getActiveFilterOperators(){return{...this.activeFilterOperators}}getActiveLocalFilters(){return{...this.activeLocalFilters}}updateFilterValues(e){var t;Object.assign(this.activeFilters,e),(t=this.filterRenderer)==null||t.updateValues(e)}buildShell(){const e=this.opts.embedLevel,t=this.renderData.dashboard.pages,r=e==="dashboard"&&t.length>1,s=e==="page"||e==="dashboard";this.root.innerHTML=`
177
+ ${this.opts.hideExport?"":'<div class="ds-toolbar" id="ds-toolbar"></div>'}
178
+ ${r?'<nav class="ds-page-nav" id="ds-page-nav"></nav>':""}
179
+ ${s?'<nav class="ds-page-nav" id="ds-tab-nav"></nav>':""}
180
+ <div id="ds-filter-container"></div>
181
+ <div class="ds-canvas" id="ds-canvas">
182
+ <div class="ds-grid" id="ds-grid"></div>
183
+ </div>
184
+ <div id="ds-tab-loading" style="display:none;position:absolute;inset:0;
185
+ background:rgba(255,255,255,0.5);align-items:center;justify-content:center;">
186
+ <div class="ds-embed-spinner"></div>
187
+ </div>
188
+ `,this.root.style.position="relative",this.opts.hideExport||this.buildExportToolbar();const o=this.root.querySelector("#ds-filter-container");this.filterRenderer=new le(o,(i,a,f)=>{var b,l,d,c,$,w,k,x,T,y,C;if(i==="__reset_all__"){this.activeFilters={},this.activeFilterOperators={},this.activeLocalFilters={},(l=(b=this.opts).onFilterChange)==null||l.call(b,this.activeFilters),this.opts.onTabSwitch(this.activePageId,this.activeTabId);return}const h=(d=this.renderData.filters)==null?void 0:d.find(I=>I.filterId===i),v=(c=this.renderData.components)==null?void 0:c.find(I=>I.type==="inline-filter"&&I.id===i),m=(h==null?void 0:h.applyToField)||(($=v==null?void 0:v.properties)==null?void 0:$.applyToField)||i,p=(x=(k=h==null?void 0:h.columnMappings)!=null?k:(w=v==null?void 0:v.properties)==null?void 0:w.columnMappings)!=null?x:{},g=((T=h==null?void 0:h.targetComponents)!=null?T:[]).length>0||Object.keys(p).length>0,u=a===""||a===null||a===void 0||Array.isArray(a)&&a.length===0;g?u?delete this.activeLocalFilters[i]:this.activeLocalFilters[i]={value:a,operator:f||"="}:u?(delete this.activeFilters[m],delete this.activeFilterOperators[m]):(this.activeFilters[m]=a,f?this.activeFilterOperators[m]=f:delete this.activeFilterOperators[m]),(C=(y=this.opts).onFilterChange)==null||C.call(y,this.activeFilters),this.opts.onTabSwitch(this.activePageId,this.activeTabId)})}buildExportToolbar(){var t,r;const e=this.root.querySelector("#ds-toolbar");e&&(e.innerHTML=`
189
+ <button class="ds-toolbar-btn" id="ds-btn-pdf">⬇ PDF</button>
190
+ <button class="ds-toolbar-btn" id="ds-btn-csv" style="display:none">⬇ CSV</button>
191
+ `,(t=e.querySelector("#ds-btn-pdf"))==null||t.addEventListener("click",()=>this.exportPDF()),(r=e.querySelector("#ds-btn-csv"))==null||r.addEventListener("click",()=>this.exportCSV()))}renderNavigation(){this.renderPageNav(),this.renderTabNav(this.activePageId)}renderPageNav(){const e=this.root.querySelector("#ds-page-nav");e&&(e.innerHTML=this.renderData.dashboard.pages.map(t=>`
192
+ <button class="ds-page-tab ${t.pageId===this.activePageId?"ds-active":""}"
193
+ data-page-id="${t.pageId}">${t.title}</button>
194
+ `).join(""),e.querySelectorAll(".ds-page-tab").forEach(t=>{t.addEventListener("click",()=>{var s,o;const r=t.dataset.pageId;r===this.activePageId&&!this.isLoadingTab||this.triggerTabSwitch(r,(o=(s=this.getTabsForPage(r)[0])==null?void 0:s.id)!=null?o:"")})}))}renderTabNav(e){const t=this.root.querySelector("#ds-tab-nav");t&&this.buildTabButtons(t,e)}buildTabButtons(e,t){const r=this.getTabsForPage(t);if(r.length<=1){e.style.display="none";return}e.style.display="",e.innerHTML=r.map(s=>`
195
+ <button class="ds-page-tab ${s.id===this.activeTabId?"ds-active":""}"
196
+ data-tab-id="${s.id}" data-page-id="${t}">${s.title}</button>
197
+ `).join(""),e.querySelectorAll(".ds-page-tab").forEach(s=>{s.addEventListener("click",()=>{const o=s.dataset.tabId,i=s.dataset.pageId;o===this.activeTabId&&i===this.activePageId&&!this.isLoadingTab||this.triggerTabSwitch(i,o)})})}triggerTabSwitch(e,t){this.isLoadingTab||!e||!t||(this.isLoadingTab=!0,this.activePageId=e,this.activeTabId=t,this.syncNavHighlight(),this.showTabSpinner(),this.opts.onTabSwitch(e,t))}syncNavHighlight(){this.root.querySelectorAll("#ds-page-nav .ds-page-tab").forEach(t=>{t.classList.toggle("ds-active",t.dataset.pageId===this.activePageId)});const e=this.root.querySelector("#ds-tab-nav");e&&this.buildTabButtons(e,this.activePageId)}renderFilterBar(){this.opts.hideGlobalFilters||(this.filterRenderer.render(this.globalFilters(),this.mergedFilterValues()),this.fetchFilterOptions())}updateFilterBar(){this.opts.hideGlobalFilters||(this.filterRenderer.render(this.globalFilters(),this.mergedFilterValues()),this.fetchFilterOptions())}mergedFilterValues(){const e={...this.activeFilters};for(const[t,{value:r}]of Object.entries(this.activeLocalFilters))e[t]=r;return e}filterIsGlobal(e){var s,o;const t=(this.renderData.components||[]).find(i=>i.type==="inline-filter"&&i.id===e);if(t){const i=((s=t.properties)==null?void 0:s.filter_scope)||((o=t.properties)==null?void 0:o.scope);if(i==="local")return!1;if(i==="global")return!0}const r=(this.renderData.filters||[]).find(i=>i.filterId===e);return!(r!=null&&r.filterLevel)||r.filterLevel==="global"}globalFilters(){return(this.renderData.filters||[]).filter(e=>this.filterIsGlobal(e.filterId))}inlineFiltersAsDefinitions(){return this.opts.hideInlineFilters?[]:(this.renderData.filters||[]).filter(e=>{var t,r;return!this.filterIsGlobal(e.filterId)&&((r=(t=e.targetComponents)==null?void 0:t.length)!=null?r:0)>0}).map(e=>({...e,filterLevel:"component"}))}async fetchFilterOptions(){if(this.opts.onFetchFilterOptions){for(const e of this.globalFilters())if(!(e.type!=="dropdown"&&e.type!=="multi-select")&&!(e.options&&e.options.length>0)){this.filterRenderer.setLoading(e.filterId,!0);try{const t=await this.opts.onFetchFilterOptions(e.filterId);this.filterRenderer.updateOptions(e.filterId,t)}catch(t){this.filterRenderer.setLoading(e.filterId,!1)}}}}renderGrid(){var m;this.hideTabSpinner();const e=this.root.querySelector("#ds-grid");if(!e)return;if(!this.opts.hideBackground){const p=this.root.querySelector("#ds-canvas"),n=this.renderData.dashboard.pages.find(u=>u.pageId===this.activePageId),g=(n==null?void 0:n.backgroundColor)||"";p&&(p.style.background=g),this.root.style.background=g}this.chartRenderers.forEach(p=>p.destroy()),this.chartRenderers.clear();const t=(this.renderData.components||[]).filter(p=>p.type!=="inline-filter");if(!t.length){e.style.height="200px",e.innerHTML='<div class="ds-chart-empty" style="padding-top:80px;">No components on this tab.</div>';return}const r=e.clientWidth||this.root.clientWidth||800,s=t.map(p=>p.position),o=s.length?Math.min(...s.map(p=>p.y)):0,i=new Q(r,o);e.style.height=`${Q.totalHeight(s)}px`,e.innerHTML="";const a=36,f=this.inlineFiltersAsDefinitions(),h=new Map;for(const p of f)for(const n of(m=p.targetComponents)!=null?m:[])h.has(n)||h.set(n,[]),h.get(n).push(p);const v=[];t.forEach(p=>{var d,c,$,w,k;const n=document.createElement("div");if(n.className="ds-component-wrapper",n.dataset.componentId=p.id,i.applyStyles(n,p.position),!this.opts.hideBackground){const x=((c=(d=p.properties)==null?void 0:d.styleConfig)==null?void 0:c.backgroundColor)||(($=p.properties)==null?void 0:$.backgroundColor);x&&(n.style.background=x)}e.appendChild(n);const g=i.toPx(p.position),u=Math.max(50,g.height-a),b=document.createElement("div");b.style.cssText="width:100%;height:100%;",n.appendChild(b);const l=this.getComponentDescription(p);if(l){const x=this.getTooltipEl();n.addEventListener("mouseenter",()=>{x.textContent=l,x.style.display="block";const T=n.getBoundingClientRect(),y=x.offsetHeight||36;window.innerHeight-T.bottom>=y+6?x.style.top=`${T.bottom+4}px`:x.style.top=`${T.top-y-4}px`,x.style.left=`${T.left}px`,x.style.width=`${T.width}px`}),n.addEventListener("mouseleave",()=>{x.style.display="none"})}if(!this.opts.hideInlineFilters){const x=[...(w=h.get(p.id))!=null?w:[],...(k=h.get("__all__"))!=null?k:[]].filter((T,y,C)=>C.findIndex(I=>I.filterId===T.filterId)===y);x.length>0&&this.attachInlineFilterBtn(n,x)}v.push(this.renderComponent(b,p,u).catch(x=>{console.error(`[Deepspot SDK] Failed to render component ${p.id} (${p.type}):`,x),b.innerHTML=`<div style="padding:8px;color:#ef4444;font-size:12px;">⚠ ${p.type} render error</div>`}))}),Promise.all(v).catch(()=>{})}async renderComponent(e,t,r){var i,a,f,h,v,m,p,n,g,u,b,l,d,c,$,w,k,x,T,y,C,I,E,N,M,H,B,K,_,G,U,W,Y,J,X;const s=this.renderData.data[t.id]||[],o=this.opts.theme;switch(t.type){case"bar":case"line":case"pie":case"donut":case"area":case"scatter":case"stacked-bar":{const F=new re(e);await F.render(t,s,o,r),this.chartRenderers.set(t.id,F);break}case"table":{const F=this.opts.onFetchTablePage?(L,A)=>this.opts.onFetchTablePage(t.id,L,A):void 0;this.tableRenderer.render(e,t,s,F);break}case"number-card":this.cardRenderer.render(e,t,s);break;case"text-heading":{if(this.opts.hideText)break;const F=((a=(i=t.properties)==null?void 0:i.data)==null?void 0:a.dataContent)||((f=t.properties)==null?void 0:f.content)||t.title||"",L=((h=t.properties)==null?void 0:h.styleConfig)||{},A=this.scToInlineStyle(L),S=this.opts.hideBackground?{}:this.parseTwColor((m=(v=t.properties)==null?void 0:v.color)!=null?m:""),O=[[S.bg?`background:${S.bg}`:"",S.text?`color:${S.text}`:""].filter(Boolean).join(";"),A].filter(Boolean).join(";");e.innerHTML=`<div class="ds-text-heading" style="${O}">${F}</div>`;break}case"text-subheading":{if(this.opts.hideText)break;const F=((n=(p=t.properties)==null?void 0:p.data)==null?void 0:n.dataContent)||((g=t.properties)==null?void 0:g.content)||t.title||"",L=((u=t.properties)==null?void 0:u.styleConfig)||{},A=this.scToInlineStyle(L),S=this.opts.hideBackground?{}:this.parseTwColor((l=(b=t.properties)==null?void 0:b.color)!=null?l:""),O=[[S.bg?`background:${S.bg}`:"",S.text?`color:${S.text}`:""].filter(Boolean).join(";"),A].filter(Boolean).join(";");e.innerHTML=`<div class="ds-text-subheading" style="${O}">${F}</div>`;break}case"text-body":{if(this.opts.hideText)break;const F=((c=(d=t.properties)==null?void 0:d.data)==null?void 0:c.dataContent)||(($=t.properties)==null?void 0:$.content)||"",L=((w=t.properties)==null?void 0:w.styleConfig)||{},A=this.scToInlineStyle(L),S=this.opts.hideBackground?{}:this.parseTwColor((x=(k=t.properties)==null?void 0:k.color)!=null?x:""),O=[[S.bg?`background:${S.bg}`:"",S.text?`color:${S.text}`:""].filter(Boolean).join(";"),A].filter(Boolean).join(";");e.innerHTML=`<div class="ds-text-body" style="${O}">${F}</div>`;break}case"text-box":{if(this.opts.hideText)break;const F=((y=(T=t.properties)==null?void 0:T.data)==null?void 0:y.dataContent)||((C=t.properties)==null?void 0:C.content)||"",L=((I=t.properties)==null?void 0:I.styleConfig)||{},A=this.scToInlineStyle(L),S=this.opts.hideBackground?{}:this.parseTwColor((N=(E=t.properties)==null?void 0:E.color)!=null?N:""),O=[[S.bg?`background:${S.bg}`:"",S.text?`color:${S.text}`:""].filter(Boolean).join(";"),A].filter(Boolean).join(";");e.innerHTML=`<div class="ds-text-box" style="${O}">${F}</div>`;break}case"text":{if(this.opts.hideText)break;const F=((H=(M=t.properties)==null?void 0:M.data)==null?void 0:H.dataContent)||((B=t.properties)==null?void 0:B.content)||"",L=((K=t.properties)==null?void 0:K.styleConfig)||{},A=this.scToInlineStyle(L),S=this.opts.hideBackground?{}:this.parseTwColor((G=(_=t.properties)==null?void 0:_.color)!=null?G:""),O=[[S.bg?`background:${S.bg}`:"",S.text?`color:${S.text}`:""].filter(Boolean).join(";"),A].filter(Boolean).join(";");e.innerHTML=`<div class="ds-text-body" style="${O}">${F}</div>`;break}case"header":{if(this.opts.hideHeader)break;const F=((W=(U=t.properties)==null?void 0:U.data)==null?void 0:W.dataContent)||((Y=t.properties)==null?void 0:Y.content)||t.title||"",L=((J=t.properties)==null?void 0:J.styleConfig)||{},A=!this.opts.hideBackground&&L.backgroundColor?`background:${L.backgroundColor};`:"",S=L.color?`color:${L.color};`:L.textColor?`color:${L.textColor};`:"";e.innerHTML=`
198
+ <div class="ds-header-component" style="${A}${S}">
199
+ <div class="ds-header-content">${F}</div>
200
+ </div>`;break}case"section":{const F=((X=t.properties)==null?void 0:X.styleConfig)||{},L=!this.opts.hideBackground&&F.backgroundColor?`background:${F.backgroundColor};`:"";e.innerHTML=`
201
+ <div class="ds-section-wrapper" style="${L}">
202
+ ${t.title?`<div class="ds-section-title">${t.title}</div>`:""}
203
+ </div>`;break}}}attachInlineFilterBtn(e,t){var a;e.style.overflow="visible";const r=(a=e.dataset.componentId)!=null?a:"",s=document.createElement("button");s.type="button",s.className="ds-comp-filter-btn",s.title="Filter",s.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
204
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
205
+ <polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>
206
+ </svg>`;const o=document.createElement("div");o.className="ds-comp-filter-pop",o.style.display="none",this.buildInlineFilterPop(o,t,r),s.addEventListener("click",f=>{f.stopPropagation();const h=o.style.display!=="none";document.querySelectorAll(".ds-comp-filter-pop").forEach(v=>{v.style.display="none"}),o.style.display=h?"none":""}),document.addEventListener("mousedown",f=>{e.contains(f.target)||(o.style.display="none")}),(()=>{const f=t.some(h=>{const v=h.applyToField||h.filterId,m=this.activeFilters[v]!==void 0&&this.activeFilters[v]!=="",p=this.activeLocalFilters[h.filterId]!==void 0;return m||p});s.classList.toggle("ds-comp-filter-btn-active",f)})(),e.appendChild(s),e.appendChild(o)}buildInlineFilterPop(e,t,r){var g,u,b;const s=l=>{var $;const d=(this.renderData.components||[]).find(w=>w.type==="inline-filter"&&w.id===l.filterId),c=($=d==null?void 0:d.properties)==null?void 0:$.columnMappings;return(c==null?void 0:c[r])||l.applyToField||l.filterId},o=l=>l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),i=l=>l.replace(/"/g,"&quot;").replace(/'/g,"&#39;"),a=[{value:"=",label:"Equals (=)"},{value:"!=",label:"Not Equals (!=)"},{value:"LIKE",label:"Contains"},{value:"NOT LIKE",label:"Not Contains"},{value:"STARTS_WITH",label:"Starts With"},{value:"IN",label:"In (Multiple)"},{value:"NOT IN",label:"Not In"},{value:">",label:"Greater Than (>)"},{value:">=",label:"Greater or Equal (>=)"},{value:"<",label:"Less Than (<)"},{value:"<=",label:"Less or Equal (<=)"},{value:"IS NULL",label:"Is Empty"},{value:"IS NOT NULL",label:"Is Not Empty"}],f=new Map;for(const l of t){const d=this.activeLocalFilters[l.filterId],c=(g=d==null?void 0:d.value)!=null?g:this.activeFilters[s(l)],$=c?Array.isArray(c)?c.map(String):[String(c)]:[],w=(d==null?void 0:d.operator)||l.filterOperator||"=";f.set(l.filterId,{pendingValues:[...$],operator:w,search:""})}const h=l=>`<select class="ds-fp-op-select">
207
+ ${a.map(d=>`<option value="${i(d.value)}"${d.value===l?" selected":""}>${d.label}</option>`).join("")}
208
+ </select>`,v=(l,d)=>{const c=l.options||[];if(!c.length)return'<div class="ds-fp-opts-msg"><span class="ds-dd-spinner"></span> Loading…</div>';const $=d.search.toLowerCase(),w=c.filter(k=>(typeof k=="string"?k:k.label).toLowerCase().includes($));return w.length?w.map(k=>{const x=typeof k=="string"?k:k.value,T=typeof k=="string"?k:k.label,y=d.pendingValues.includes(x);return`<label class="ds-fp-opt${y?" ds-fp-opt-on":""}" data-val="${i(x)}">
209
+ <span class="ds-fp-cb${y?" ds-fp-cb-on":""}">
210
+ ${y?`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"
211
+ stroke-linecap="round" stroke-linejoin="round">
212
+ <polyline points="20 6 9 17 4 12"/>
213
+ </svg>`:""}
214
+ </span>
215
+ <span class="ds-fp-opt-lbl">${o(T)}</span>
216
+ </label>`}).join(""):'<div class="ds-fp-opts-msg">No matches</div>'},m=l=>{const d=f.get(l.filterId);return`
217
+ <div class="ds-fp-item ds-fp-item-expanded" data-filter-id="${i(l.filterId)}">
218
+ <div class="ds-fp-item-hd">
219
+ <span class="ds-fp-item-name">${o(l.label)}</span>
220
+ <svg class="ds-fp-chevron" style="transform:rotate(180deg)"
221
+ viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
222
+ stroke-linecap="round" stroke-linejoin="round">
223
+ <polyline points="6 9 12 15 18 9"/>
224
+ </svg>
225
+ </div>
226
+ <div class="ds-fp-item-body">
227
+ <div class="ds-fp-op-row">
228
+ <span class="ds-fp-op-lbl">Operator</span>
229
+ ${h(d.operator)}
230
+ </div>
231
+ <div class="ds-fp-ms">
232
+ ${d.pendingValues.length?`<div class="ds-fp-chips-row">
233
+ ${d.pendingValues.map(c=>`<span class="ds-fp-chip">${o(c)}<button type="button" class="ds-fp-chip-x" data-val="${i(c)}">✕</button></span>`).join("")}
234
+ </div>`:""}
235
+ <div class="ds-fp-search-wrap">
236
+ <input type="text" class="ds-fp-ms-search"
237
+ placeholder="Search ${i(l.label)}…"
238
+ value="${i(d.search)}"/>
239
+ <svg class="ds-fp-search-caret" viewBox="0 0 24 24" fill="none" stroke="currentColor"
240
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
241
+ <polyline points="18 15 12 9 6 15"/>
242
+ </svg>
243
+ </div>
244
+ <div class="ds-fp-opts" data-filter-id="${i(l.filterId)}">
245
+ ${v(l,d)}
246
+ </div>
247
+ </div>
248
+ <button type="button" class="ds-fp-apply" data-apply-id="${i(l.filterId)}">✓ Apply Filter</button>
249
+ </div>
250
+ </div>`},p=t.filter(l=>{if(this.activeLocalFilters[l.filterId]!==void 0)return!0;const d=this.activeFilters[s(l)];return d!==void 0&&d!==""&&!(Array.isArray(d)&&d.length===0)}).length;e.innerHTML=`
251
+ <div class="ds-fp-panel ds-fp-panel-pop">
252
+ <div class="ds-fp-panel-hd">
253
+ <div class="ds-fp-panel-title">
254
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
255
+ stroke-linecap="round" stroke-linejoin="round">
256
+ <line x1="3" y1="6" x2="21" y2="6"/>
257
+ <line x1="3" y1="12" x2="21" y2="12"/>
258
+ <line x1="3" y1="18" x2="21" y2="18"/>
259
+ </svg>
260
+ <span>Filters</span>
261
+ </div>
262
+ <button type="button" class="ds-fp-close-btn ds-pop-close">
263
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
264
+ stroke-linecap="round" stroke-linejoin="round">
265
+ <line x1="18" y1="6" x2="6" y2="18"/>
266
+ <line x1="6" y1="6" x2="18" y2="18"/>
267
+ </svg>
268
+ </button>
269
+ </div>
270
+ <div class="ds-fp-reset-section" style="display:${p?"":"none"}">
271
+ <button type="button" class="ds-fp-reset-all ds-pop-reset">
272
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
273
+ stroke-linecap="round" stroke-linejoin="round">
274
+ <polyline points="1 4 1 10 7 10"/>
275
+ <path d="M3.51 15a9 9 0 1 0 .49-3.5"/>
276
+ </svg>
277
+ Reset All Filters
278
+ </button>
279
+ </div>
280
+ <div class="ds-fp-items">
281
+ ${t.map(m).join("")}
282
+ </div>
283
+ </div>`,(u=e.querySelector(".ds-pop-close"))==null||u.addEventListener("click",()=>{e.style.display="none"}),(b=e.querySelector(".ds-pop-reset"))==null||b.addEventListener("click",()=>{var l,d;t.forEach(c=>{delete this.activeLocalFilters[c.filterId]}),(d=(l=this.opts).onFilterChange)==null||d.call(l,this.activeFilters),this.opts.onTabSwitch(this.activePageId,this.activeTabId),e.style.display="none"});const n=(l,d,c)=>{const $=t.find(x=>x.filterId===l),w=d.querySelector(".ds-fp-ms");if(w){let x=w.querySelector(".ds-fp-chips-row");if(c.pendingValues.length){const T=c.pendingValues.map(y=>`<span class="ds-fp-chip">${o(y)}<button type="button" class="ds-fp-chip-x" data-val="${i(y)}">✕</button></span>`).join("");x?x.innerHTML=T:(x=document.createElement("div"),x.className="ds-fp-chips-row",x.innerHTML=T,w.insertBefore(x,w.querySelector(".ds-fp-search-wrap"))),x.querySelectorAll(".ds-fp-chip-x").forEach(y=>{y.addEventListener("click",C=>{C.stopPropagation(),c.pendingValues=c.pendingValues.filter(I=>{var E;return I!==((E=y.dataset.val)!=null?E:"")}),n(l,d,c)})})}else x==null||x.remove()}const k=d.querySelector(`.ds-fp-opts[data-filter-id="${l}"]`);k&&(k.innerHTML=v($,c),k.querySelectorAll(".ds-fp-opt").forEach(x=>{x.addEventListener("click",()=>{var y;const T=(y=x.dataset.val)!=null?y:"";c.pendingValues.includes(T)?c.pendingValues=c.pendingValues.filter(C=>C!==T):c.pendingValues=[...c.pendingValues,T],n(l,d,c)})}))};t.forEach(l=>{var w,k,x,T;const d=f.get(l.filterId),c=e.querySelector(`.ds-fp-item[data-filter-id="${l.filterId}"]`);if(!c)return;(w=c.querySelector(".ds-fp-op-select"))==null||w.addEventListener("change",y=>{d.operator=y.target.value});const $=c.querySelector(".ds-fp-ms-search");$&&($.addEventListener("input",()=>{d.search=$.value,n(l.filterId,c,d)}),(k=c.querySelector(".ds-fp-search-caret"))==null||k.addEventListener("click",()=>{const y=c.querySelector(".ds-fp-opts");y&&(y.style.display=y.style.display==="none"?"":"none")})),c.querySelectorAll(".ds-fp-chip-x").forEach(y=>{y.addEventListener("click",C=>{C.stopPropagation(),d.pendingValues=d.pendingValues.filter(I=>{var E;return I!==((E=y.dataset.val)!=null?E:"")}),n(l.filterId,c,d)})}),c.querySelectorAll(".ds-fp-opt").forEach(y=>{y.addEventListener("click",()=>{var I;const C=(I=y.dataset.val)!=null?I:"";d.pendingValues.includes(C)?d.pendingValues=d.pendingValues.filter(E=>E!==C):d.pendingValues=[...d.pendingValues,C],n(l.filterId,c,d)})}),(x=c.querySelector(`.ds-fp-apply[data-apply-id="${l.filterId}"]`))==null||x.addEventListener("click",()=>{var C,I,E;const y=d.pendingValues.length>1?[...d.pendingValues]:(C=d.pendingValues[0])!=null?C:"";!y||Array.isArray(y)&&!y.length?delete this.activeLocalFilters[l.filterId]:this.activeLocalFilters[l.filterId]={value:y,operator:d.operator||"="},(E=(I=this.opts).onFilterChange)==null||E.call(I,this.activeFilters),this.opts.onTabSwitch(this.activePageId,this.activeTabId),e.style.display="none"}),!((T=l.options)!=null&&T.length)&&this.opts.onFetchFilterOptions&&this.opts.onFetchFilterOptions(l.filterId).then(y=>{c.querySelector(`.ds-fp-opts[data-filter-id="${l.filterId}"]`)&&(l.options=y.map(I=>typeof I=="string"?I:I.value),n(l.filterId,c,d))}).catch(()=>{})})}showTabSpinner(){const e=this.root.querySelector("#ds-tab-loading"),t=this.root.querySelector("#ds-grid");e&&(e.style.display="flex"),t&&(t.style.opacity="0.35")}hideTabSpinner(){const e=this.root.querySelector("#ds-tab-loading"),t=this.root.querySelector("#ds-grid");e&&(e.style.display="none"),t&&(t.style.opacity="1")}scToInlineStyle(e){const t=new Set(["backgroundColor"]),r=s=>s.replace(/([A-Z])/g,"-$1").toLowerCase();return Object.entries(e).filter(([s,o])=>!t.has(s)&&o!=null&&o!=="").map(([s,o])=>`${r(s)}:${o}`).join(";")}parseTwColor(e){if(!e)return{};const t={};for(const r of e.split(/\s+/)){if(!r)continue;if(r==="bg-white"){t.bg="#ffffff";continue}if(r==="bg-black"){t.bg="#000000";continue}if(r==="bg-transparent"){t.bg="transparent";continue}if(r==="text-white"){t.text="#ffffff";continue}if(r==="text-black"){t.text="#000000";continue}const s=/^(bg|text)-([a-z]+)-(\d+)$/.exec(r);if(!s)continue;const o=z.TW_PALETTE[s[2]],i=o==null?void 0:o[Number(s[3])];i&&(s[1]==="bg"&&(t.bg=i),s[1]==="text"&&(t.text=i))}return t}getTooltipEl(){if(!this.tooltipEl){const e=document.createElement("div");e.className="ds-global-tooltip",e.style.display="none",document.body.appendChild(e),this.tooltipEl=e}return this.tooltipEl}getComponentDescription(e){var t,r,s,o;if((t=e.properties)!=null&&t.description)return String(e.properties.description);try{const i=(s=(r=e.properties)==null?void 0:r.data)==null?void 0:s.dataContent;if(i){const a=typeof i=="string"?JSON.parse(i):i;return(a==null?void 0:a.description)||((o=a==null?void 0:a.config)==null?void 0:o.description)||""}}catch(i){}return""}getTabsForPage(e){var t,r;return(r=(t=this.renderData.dashboard.pages.find(s=>s.pageId===e))==null?void 0:t.tabs)!=null?r:[]}};z.TW_PALETTE={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337"}};let D=z;class ce{constructor(e,t){this.chartRenderer=null,this.tableRenderer=new se,this.cardRenderer=new oe,this.root=e,this.theme=t}render(e,t){const r=e.components[0];if(!r){this.root.innerHTML=`<div class="ds-embed-error">
284
+ <div class="ds-embed-error-icon">⚠</div>
285
+ <div>Component not found.</div>
286
+ </div>`;return}const s=e.data[r.id]||[];this.renderComponent(r,s),t==null||t()}update(e){const t=e.components[0];if(!t)return;const r=e.data[t.id]||[];switch(t.type){case"bar":case"line":case"pie":case"donut":case"area":this.chartRenderer?this.chartRenderer.update(t,r,this.theme):this.renderComponent(t,r);break;case"table":this.tableRenderer.render(this.root,t,r);break;case"number-card":this.cardRenderer.render(this.root,t,r);break}}destroy(){var e;(e=this.chartRenderer)==null||e.destroy(),this.chartRenderer=null,this.root.innerHTML=""}renderComponent(e,t){var r;switch(e.type){case"bar":case"line":case"pie":case"donut":case"area":(r=this.chartRenderer)==null||r.destroy(),this.chartRenderer=new re(this.root),this.chartRenderer.render(e,t,this.theme);break;case"table":this.tableRenderer.render(this.root,e,t);break;case"number-card":this.cardRenderer.render(this.root,e,t);break;default:this.root.innerHTML=`<div class="ds-chart-empty">Unsupported component type: ${e.type}</div>`}}}let ee=!1;function pe(){if(!(ee||typeof document=="undefined")){ee=!0;try{const P=`/* ─────────────────────────────────────────────────────────────────────────────
287
+ Deepspot SDK — Base Embed Styles
288
+ Injected once into the host page's <head> by the SDK.
289
+ All selectors are scoped under .ds-embed-* to avoid leaking into host styles.
290
+ ───────────────────────────────────────────────────────────────────────────── */
291
+
292
+ /* ── Reset inside SDK containers ──────────────────────────────────────────── */
293
+ .ds-embed-root *,
294
+ .ds-embed-root *::before,
295
+ .ds-embed-root *::after {
296
+ box-sizing: border-box;
297
+ margin: 0;
298
+ padding: 0;
299
+ }
300
+
301
+ /* ── Root container ────────────────────────────────────────────────────────── */
302
+ .ds-embed-root {
303
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
304
+ Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
305
+ font-size: 14px;
306
+ line-height: 1.5;
307
+ width: 100%;
308
+ height: 100%;
309
+ overflow: auto;
310
+ position: relative;
311
+ /* Default white background — overridden by page backgroundColor from publish page */
312
+ background: #ffffff;
313
+ color: #111827;
314
+ }
315
+
316
+ .ds-embed-root.ds-theme-light {
317
+ /* No forced background — let component styleConfig backgrounds show through */
318
+ color: #111827;
319
+ }
320
+
321
+ .ds-embed-root.ds-theme-dark {
322
+ /* No forced background — let component styleConfig backgrounds show through */
323
+ color: #f1f5f9;
324
+ }
325
+
326
+ /* ── Loading state ─────────────────────────────────────────────────────────── */
327
+ .ds-embed-loading {
328
+ display: flex;
329
+ flex-direction: column;
330
+ align-items: center;
331
+ justify-content: center;
332
+ height: 100%;
333
+ min-height: 200px;
334
+ gap: 12px;
335
+ color: #6b7280;
336
+ }
337
+
338
+ .ds-embed-spinner {
339
+ width: 36px;
340
+ height: 36px;
341
+ border: 3px solid #e5e7eb;
342
+ border-top-color: #6366f1;
343
+ border-radius: 50%;
344
+ animation: ds-spin 0.8s linear infinite;
345
+ }
346
+
347
+ @keyframes ds-spin {
348
+ to { transform: rotate(360deg); }
349
+ }
350
+
351
+ .ds-embed-loading-text {
352
+ font-size: 13px;
353
+ }
354
+
355
+ /* ── Error state ───────────────────────────────────────────────────────────── */
356
+ .ds-embed-error {
357
+ display: flex;
358
+ flex-direction: column;
359
+ align-items: center;
360
+ justify-content: center;
361
+ height: 100%;
362
+ min-height: 200px;
363
+ gap: 8px;
364
+ padding: 24px;
365
+ text-align: center;
366
+ color: #ef4444;
367
+ }
368
+
369
+ .ds-embed-error-icon {
370
+ font-size: 32px;
371
+ }
372
+
373
+ .ds-embed-error-message {
374
+ font-size: 13px;
375
+ color: #6b7280;
376
+ }
377
+
378
+ /* ── Filter bar ────────────────────────────────────────────────────────────── */
379
+ .ds-filter-bar {
380
+ display: flex;
381
+ flex-wrap: wrap;
382
+ align-items: center;
383
+ gap: 10px;
384
+ padding: 10px 16px;
385
+ border-bottom: 1px solid #e5e7eb;
386
+ background: inherit;
387
+ }
388
+
389
+ .ds-theme-dark .ds-filter-bar {
390
+ border-bottom-color: #1e293b;
391
+ }
392
+
393
+ .ds-filter-item {
394
+ display: flex;
395
+ flex-direction: column;
396
+ gap: 4px;
397
+ }
398
+
399
+ .ds-filter-label {
400
+ font-size: 11px;
401
+ font-weight: 600;
402
+ text-transform: uppercase;
403
+ letter-spacing: 0.05em;
404
+ color: #6b7280;
405
+ }
406
+
407
+ .ds-filter-select,
408
+ .ds-filter-input {
409
+ height: 32px;
410
+ padding: 0 10px;
411
+ border: 1px solid #d1d5db;
412
+ border-radius: 6px;
413
+ font-size: 13px;
414
+ background: #ffffff;
415
+ color: #111827;
416
+ cursor: pointer;
417
+ min-width: 130px;
418
+ }
419
+
420
+ .ds-theme-dark .ds-filter-select,
421
+ .ds-theme-dark .ds-filter-input {
422
+ background: #1e293b;
423
+ border-color: #334155;
424
+ color: #f1f5f9;
425
+ }
426
+
427
+ .ds-filter-select:focus,
428
+ .ds-filter-input:focus {
429
+ outline: none;
430
+ border-color: #6366f1;
431
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
432
+ }
433
+
434
+ .ds-date-range-inputs {
435
+ display: flex;
436
+ gap: 6px;
437
+ align-items: center;
438
+ }
439
+
440
+ .ds-date-range-inputs input[type="date"] {
441
+ height: 32px;
442
+ padding: 0 8px;
443
+ border: 1px solid #d1d5db;
444
+ border-radius: 6px;
445
+ font-size: 13px;
446
+ background: #ffffff;
447
+ color: #111827;
448
+ }
449
+
450
+ .ds-theme-dark .ds-date-range-inputs input[type="date"] {
451
+ background: #1e293b;
452
+ border-color: #334155;
453
+ color: #f1f5f9;
454
+ }
455
+
456
+ /* ── Page / Tab navigation ─────────────────────────────────────────────────── */
457
+ .ds-page-nav {
458
+ display: flex;
459
+ gap: 4px;
460
+ padding: 8px 16px 0;
461
+ border-bottom: 1px solid #e5e7eb;
462
+ overflow-x: auto;
463
+ }
464
+
465
+ .ds-theme-dark .ds-page-nav {
466
+ border-bottom-color: #1e293b;
467
+ }
468
+
469
+ .ds-page-tab {
470
+ padding: 6px 16px;
471
+ font-size: 13px;
472
+ font-weight: 500;
473
+ border: none;
474
+ border-bottom: 2px solid transparent;
475
+ background: transparent;
476
+ color: #6b7280;
477
+ cursor: pointer;
478
+ white-space: nowrap;
479
+ transition: color 0.15s, border-color 0.15s;
480
+ }
481
+
482
+ .ds-page-tab:hover {
483
+ color: #111827;
484
+ }
485
+
486
+ .ds-theme-dark .ds-page-tab:hover {
487
+ color: #f1f5f9;
488
+ }
489
+
490
+ .ds-page-tab.ds-active {
491
+ color: #6366f1;
492
+ border-bottom-color: #6366f1;
493
+ }
494
+
495
+ /* ── Grid canvas ───────────────────────────────────────────────────────────── */
496
+ .ds-canvas {
497
+ position: relative;
498
+ width: 100%;
499
+ /* No horizontal padding — grid.clientWidth must equal container width so
500
+ GridLayout.colWidth = containerWidth/24 matches the dashboard builder.
501
+ 16px on each side was shrinking the grid by 32px and misaligning positions. */
502
+ padding: 8px 0 16px;
503
+ overflow-x: hidden;
504
+ }
505
+
506
+ .ds-grid {
507
+ position: relative;
508
+ width: 100%;
509
+ /* Clip absolutely-positioned children to the grid boundary so rounding
510
+ errors or miscalculated widths don't create a horizontal scrollbar. */
511
+ overflow: hidden;
512
+ }
513
+
514
+ .ds-component-wrapper {
515
+ position: absolute;
516
+ /* overflow intentionally not set — individual card components handle their own clipping,
517
+ and tooltip bubbles must be able to overflow the wrapper boundary */
518
+ }
519
+
520
+ /* ── Description tooltip — fixed on body, positioned via JS, never clips content ── */
521
+ .ds-global-tooltip {
522
+ position: fixed;
523
+ z-index: 9999;
524
+ background: rgba(15, 23, 42, 0.92);
525
+ color: #f1f5f9;
526
+ font-size: 12px;
527
+ line-height: 1.6;
528
+ padding: 8px 14px;
529
+ border-radius: 8px;
530
+ white-space: normal;
531
+ pointer-events: none;
532
+ backdrop-filter: blur(4px);
533
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
534
+ max-width: 600px;
535
+ }
536
+
537
+ /* ── Chart component ───────────────────────────────────────────────────────── */
538
+ .ds-chart-card {
539
+ width: 100%;
540
+ height: 100%;
541
+ background: #ffffff;
542
+ border: 1px solid #e5e7eb;
543
+ border-radius: 10px;
544
+ overflow: hidden;
545
+ display: flex;
546
+ flex-direction: column;
547
+ }
548
+
549
+ .ds-theme-dark .ds-chart-card {
550
+ background: #1e293b;
551
+ border-color: #334155;
552
+ }
553
+
554
+ .ds-chart-title {
555
+ padding: 10px 14px 4px;
556
+ font-size: 13px;
557
+ font-weight: 600;
558
+ color: #374151;
559
+ flex-shrink: 0;
560
+ }
561
+
562
+ .ds-theme-dark .ds-chart-title {
563
+ color: #e2e8f0;
564
+ }
565
+
566
+ .ds-chart-body {
567
+ flex: 1;
568
+ min-height: 0;
569
+ }
570
+
571
+ .ds-chart-empty {
572
+ display: flex;
573
+ align-items: center;
574
+ justify-content: center;
575
+ height: 100%;
576
+ color: #9ca3af;
577
+ font-size: 13px;
578
+ }
579
+
580
+ /* ── Table component ───────────────────────────────────────────────────────── */
581
+ .ds-table-card {
582
+ width: 100%;
583
+ height: 100%;
584
+ background: #ffffff;
585
+ border: 1px solid #e5e7eb;
586
+ border-radius: 10px;
587
+ overflow: hidden;
588
+ display: flex;
589
+ flex-direction: column;
590
+ position: relative;
591
+ }
592
+
593
+ .ds-theme-dark .ds-table-card {
594
+ background: #1e293b;
595
+ border-color: #334155;
596
+ }
597
+
598
+ /* ── Table header: dot + title on left, search on right ──────────────────────*/
599
+ .ds-table-header-row {
600
+ display: flex;
601
+ align-items: center;
602
+ justify-content: space-between;
603
+ padding: 10px 14px 8px;
604
+ flex-shrink: 0;
605
+ gap: 8px;
606
+ border-bottom: 1px solid #f3f4f6;
607
+ }
608
+
609
+ .ds-theme-dark .ds-table-header-row {
610
+ border-bottom-color: #334155;
611
+ }
612
+
613
+ .ds-table-title-wrap {
614
+ display: flex;
615
+ align-items: center;
616
+ gap: 6px;
617
+ min-width: 0;
618
+ }
619
+
620
+ .ds-table-dot {
621
+ width: 8px;
622
+ height: 8px;
623
+ border-radius: 50%;
624
+ background: #6366f1;
625
+ flex-shrink: 0;
626
+ }
627
+
628
+ .ds-table-title {
629
+ font-size: 13px;
630
+ font-weight: 600;
631
+ color: #374151;
632
+ white-space: nowrap;
633
+ overflow: hidden;
634
+ text-overflow: ellipsis;
635
+ }
636
+
637
+ .ds-theme-dark .ds-table-title {
638
+ color: #e2e8f0;
639
+ }
640
+
641
+ /* ── Search ──────────────────────────────────────────────────────────────────*/
642
+ .ds-table-search-wrap {
643
+ position: relative;
644
+ flex-shrink: 0;
645
+ }
646
+
647
+ .ds-table-search-icon {
648
+ position: absolute;
649
+ left: 8px;
650
+ top: 50%;
651
+ transform: translateY(-50%);
652
+ width: 14px;
653
+ height: 14px;
654
+ color: #9ca3af;
655
+ pointer-events: none;
656
+ }
657
+
658
+ .ds-table-search {
659
+ height: 30px;
660
+ padding: 0 10px 0 28px;
661
+ border: 1px solid #e5e7eb;
662
+ border-radius: 6px;
663
+ font-size: 12px;
664
+ background: #f9fafb;
665
+ color: #374151;
666
+ width: 180px;
667
+ outline: none;
668
+ transition: border-color 0.15s, box-shadow 0.15s;
669
+ }
670
+
671
+ .ds-table-search:focus {
672
+ border-color: #6366f1;
673
+ box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
674
+ background: #fff;
675
+ }
676
+
677
+ .ds-theme-dark .ds-table-search {
678
+ background: #0f172a;
679
+ border-color: #334155;
680
+ color: #e2e8f0;
681
+ }
682
+
683
+ .ds-theme-dark .ds-table-search:focus {
684
+ background: #1e293b;
685
+ }
686
+
687
+ /* ── Scroll area ─────────────────────────────────────────────────────────────*/
688
+ .ds-table-scroll {
689
+ flex: 1;
690
+ overflow: auto;
691
+ min-height: 0;
692
+ }
693
+
694
+ .ds-table {
695
+ width: 100%;
696
+ border-collapse: collapse;
697
+ font-size: 12px;
698
+ }
699
+
700
+ .ds-table-sno-th {
701
+ width: 48px;
702
+ text-align: center !important;
703
+ }
704
+
705
+ .ds-table-sno {
706
+ text-align: center;
707
+ color: #9ca3af;
708
+ font-size: 11px;
709
+ }
710
+
711
+ .ds-theme-dark .ds-table-sno {
712
+ color: #64748b;
713
+ }
714
+
715
+ .ds-table th {
716
+ position: sticky;
717
+ top: 0;
718
+ padding: 8px 12px;
719
+ text-align: left;
720
+ font-weight: 600;
721
+ font-size: 11px;
722
+ text-transform: uppercase;
723
+ letter-spacing: 0.05em;
724
+ background: #f9fafb;
725
+ color: #6b7280;
726
+ border-bottom: 1px solid #e5e7eb;
727
+ white-space: nowrap;
728
+ }
729
+
730
+ .ds-theme-dark .ds-table th {
731
+ background: #0f172a;
732
+ color: #94a3b8;
733
+ border-bottom-color: #334155;
734
+ }
735
+
736
+ .ds-table td {
737
+ padding: 8px 12px;
738
+ border-bottom: 1px solid #f3f4f6;
739
+ color: #374151;
740
+ max-width: 200px;
741
+ overflow: hidden;
742
+ text-overflow: ellipsis;
743
+ white-space: nowrap;
744
+ }
745
+
746
+ .ds-theme-dark .ds-table td {
747
+ color: #cbd5e1;
748
+ border-bottom-color: #1e293b;
749
+ }
750
+
751
+ .ds-table tr:hover td {
752
+ background: #f9fafb;
753
+ }
754
+
755
+ .ds-theme-dark .ds-table tr:hover td {
756
+ background: #0f172a;
757
+ }
758
+
759
+ /* ── Footer: info + pagination ───────────────────────────────────────────────*/
760
+ .ds-table-footer {
761
+ display: flex;
762
+ align-items: center;
763
+ justify-content: space-between;
764
+ padding: 8px 14px;
765
+ border-top: 1px solid #f3f4f6;
766
+ flex-shrink: 0;
767
+ gap: 8px;
768
+ flex-wrap: wrap;
769
+ }
770
+
771
+ .ds-theme-dark .ds-table-footer {
772
+ border-top-color: #334155;
773
+ }
774
+
775
+ .ds-table-info {
776
+ display: flex;
777
+ align-items: center;
778
+ gap: 8px;
779
+ font-size: 12px;
780
+ color: #6b7280;
781
+ }
782
+
783
+ .ds-theme-dark .ds-table-info {
784
+ color: #94a3b8;
785
+ }
786
+
787
+ .ds-table-rows-label {
788
+ margin-left: 4px;
789
+ }
790
+
791
+ .ds-table-page-size {
792
+ height: 28px;
793
+ padding: 0 6px;
794
+ border: 1px solid #e5e7eb;
795
+ border-radius: 5px;
796
+ font-size: 12px;
797
+ background: #fff;
798
+ color: #374151;
799
+ cursor: pointer;
800
+ outline: none;
801
+ }
802
+
803
+ .ds-theme-dark .ds-table-page-size {
804
+ background: #0f172a;
805
+ border-color: #334155;
806
+ color: #e2e8f0;
807
+ }
808
+
809
+ .ds-table-pagination {
810
+ display: flex;
811
+ align-items: center;
812
+ gap: 6px;
813
+ }
814
+
815
+ .ds-table-pg-btn {
816
+ height: 28px;
817
+ padding: 0 10px;
818
+ border: 1px solid #e5e7eb;
819
+ border-radius: 5px;
820
+ font-size: 12px;
821
+ font-weight: 500;
822
+ background: #fff;
823
+ color: #374151;
824
+ cursor: pointer;
825
+ transition: background 0.12s, border-color 0.12s;
826
+ white-space: nowrap;
827
+ }
828
+
829
+ .ds-table-pg-btn:hover:not(:disabled) {
830
+ background: #f3f4f6;
831
+ border-color: #d1d5db;
832
+ }
833
+
834
+ .ds-table-pg-btn:disabled {
835
+ opacity: 0.4;
836
+ cursor: not-allowed;
837
+ }
838
+
839
+ .ds-theme-dark .ds-table-pg-btn {
840
+ background: #1e293b;
841
+ border-color: #334155;
842
+ color: #e2e8f0;
843
+ }
844
+
845
+ .ds-theme-dark .ds-table-pg-btn:hover:not(:disabled) {
846
+ background: #0f172a;
847
+ }
848
+
849
+ .ds-table-pg-info {
850
+ font-size: 12px;
851
+ color: #6b7280;
852
+ white-space: nowrap;
853
+ }
854
+
855
+ .ds-theme-dark .ds-table-pg-info {
856
+ color: #94a3b8;
857
+ }
858
+
859
+ /* ── Loading overlay while fetching a page ───────────────────────────────────*/
860
+ .ds-table-loading-overlay {
861
+ position: absolute;
862
+ inset: 0;
863
+ background: rgba(255,255,255,0.6);
864
+ display: flex;
865
+ align-items: center;
866
+ justify-content: center;
867
+ border-radius: 10px;
868
+ z-index: 10;
869
+ }
870
+
871
+ .ds-theme-dark .ds-table-loading-overlay {
872
+ background: rgba(30,41,59,0.7);
873
+ }
874
+
875
+ /* ── KPI Number Card ───────────────────────────────────────────────────────── */
876
+ .ds-card {
877
+ width: 100%;
878
+ height: 100%;
879
+ border: 1px solid #e5e7eb;
880
+ border-radius: 10px;
881
+ display: flex;
882
+ flex-direction: column;
883
+ align-items: center;
884
+ justify-content: center;
885
+ padding: 16px;
886
+ text-align: center;
887
+ background: #ffffff;
888
+ }
889
+
890
+ .ds-theme-dark .ds-card {
891
+ background: #1e293b;
892
+ border-color: #334155;
893
+ }
894
+
895
+ .ds-card-label {
896
+ font-size: 12px;
897
+ font-weight: 500;
898
+ color: #6b7280;
899
+ margin-bottom: 6px;
900
+ text-transform: uppercase;
901
+ letter-spacing: 0.05em;
902
+ }
903
+
904
+ .ds-card-value {
905
+ font-size: 32px;
906
+ font-weight: 700;
907
+ color: #111827;
908
+ line-height: 1.1;
909
+ }
910
+
911
+ .ds-theme-dark .ds-card-value {
912
+ color: #f1f5f9;
913
+ }
914
+
915
+ /* ── v2: Text / content components ────────────────────────────────────────── */
916
+
917
+ .ds-text-heading {
918
+ width: 100%;
919
+ height: 100%;
920
+ display: flex;
921
+ flex-direction: column;
922
+ justify-content: center;
923
+ padding: 8px 12px;
924
+ font-size: 20px;
925
+ font-weight: 700;
926
+ color: #111827;
927
+ line-height: 1.3;
928
+ overflow: hidden;
929
+ }
930
+
931
+ .ds-theme-dark .ds-text-heading {
932
+ color: #f1f5f9;
933
+ }
934
+
935
+ .ds-text-subheading {
936
+ width: 100%;
937
+ height: 100%;
938
+ display: flex;
939
+ flex-direction: column;
940
+ justify-content: center;
941
+ padding: 6px 12px;
942
+ font-size: 15px;
943
+ font-weight: 600;
944
+ color: #374151;
945
+ line-height: 1.4;
946
+ overflow: hidden;
947
+ }
948
+
949
+ .ds-theme-dark .ds-text-subheading {
950
+ color: #cbd5e1;
951
+ }
952
+
953
+ .ds-text-body {
954
+ width: 100%;
955
+ height: 100%;
956
+ padding: 8px 12px;
957
+ font-size: 14px;
958
+ color: #374151;
959
+ line-height: 1.6;
960
+ overflow: auto;
961
+ }
962
+
963
+ .ds-theme-dark .ds-text-body {
964
+ color: #94a3b8;
965
+ }
966
+
967
+ .ds-text-box {
968
+ width: 100%;
969
+ height: 100%;
970
+ padding: 10px 14px;
971
+ font-size: 13px;
972
+ color: #374151;
973
+ line-height: 1.6;
974
+ border: 1px solid #e5e7eb;
975
+ border-radius: 8px;
976
+ background: #f9fafb;
977
+ overflow: auto;
978
+ }
979
+
980
+ .ds-theme-dark .ds-text-box {
981
+ color: #cbd5e1;
982
+ border-color: #334155;
983
+ background: #1e293b;
984
+ }
985
+
986
+ /* ── v2: Header component ──────────────────────────────────────────────────── */
987
+
988
+ .ds-header-component {
989
+ width: 100%;
990
+ height: 100%;
991
+ display: flex;
992
+ align-items: center;
993
+ padding: 12px 20px;
994
+ background: #f3f4f6;
995
+ border-bottom: 1px solid #e5e7eb;
996
+ overflow: hidden;
997
+ }
998
+
999
+ .ds-theme-dark .ds-header-component {
1000
+ background: #1e293b;
1001
+ border-bottom-color: #334155;
1002
+ }
1003
+
1004
+ .ds-header-content {
1005
+ font-size: 18px;
1006
+ font-weight: 700;
1007
+ color: #111827;
1008
+ white-space: nowrap;
1009
+ overflow: hidden;
1010
+ text-overflow: ellipsis;
1011
+ }
1012
+
1013
+ .ds-theme-dark .ds-header-content {
1014
+ color: #f1f5f9;
1015
+ }
1016
+
1017
+ /* ── v2: Section container ─────────────────────────────────────────────────── */
1018
+
1019
+ .ds-section-wrapper {
1020
+ width: 100%;
1021
+ height: 100%;
1022
+ border: 1px solid #e5e7eb;
1023
+ border-radius: 10px;
1024
+ background: #f9fafb;
1025
+ overflow: hidden;
1026
+ }
1027
+
1028
+ .ds-theme-dark .ds-section-wrapper {
1029
+ border-color: #334155;
1030
+ background: #1e293b;
1031
+ }
1032
+
1033
+ .ds-section-title {
1034
+ padding: 8px 14px;
1035
+ font-size: 12px;
1036
+ font-weight: 600;
1037
+ text-transform: uppercase;
1038
+ letter-spacing: 0.05em;
1039
+ color: #6b7280;
1040
+ border-bottom: 1px solid #e5e7eb;
1041
+ }
1042
+
1043
+ .ds-theme-dark .ds-section-title {
1044
+ color: #94a3b8;
1045
+ border-bottom-color: #334155;
1046
+ }
1047
+
1048
+ /* ── Filter panel (publish-page style: toggle + collapsible items + Apply) ─── */
1049
+
1050
+ .ds-fp {
1051
+ border-bottom: 1px solid #e5e7eb;
1052
+ background: inherit;
1053
+ }
1054
+
1055
+ .ds-theme-dark .ds-fp {
1056
+ border-bottom-color: #1e293b;
1057
+ }
1058
+
1059
+ /* ── Toggle bar ────────────────────────────────────────────────────────────── */
1060
+ .ds-fp-bar {
1061
+ display: flex;
1062
+ align-items: center;
1063
+ gap: 12px;
1064
+ padding: 8px 16px;
1065
+ }
1066
+
1067
+ /* ── Panel header ──────────────────────────────────────────────────────────── */
1068
+ .ds-fp-panel-hd {
1069
+ display: flex;
1070
+ align-items: center;
1071
+ justify-content: space-between;
1072
+ padding: 14px 16px 12px;
1073
+ border-bottom: 1px solid #e5e7eb;
1074
+ }
1075
+
1076
+ .ds-theme-dark .ds-fp-panel-hd {
1077
+ border-bottom-color: #334155;
1078
+ }
1079
+
1080
+ .ds-fp-panel-title {
1081
+ display: flex;
1082
+ align-items: center;
1083
+ gap: 8px;
1084
+ font-size: 14px;
1085
+ font-weight: 600;
1086
+ color: #111827;
1087
+ }
1088
+
1089
+ .ds-theme-dark .ds-fp-panel-title {
1090
+ color: #f1f5f9;
1091
+ }
1092
+
1093
+ .ds-fp-panel-title svg {
1094
+ width: 16px;
1095
+ height: 16px;
1096
+ color: #6b7280;
1097
+ flex-shrink: 0;
1098
+ }
1099
+
1100
+ .ds-fp-close-btn {
1101
+ width: 28px;
1102
+ height: 28px;
1103
+ display: flex;
1104
+ align-items: center;
1105
+ justify-content: center;
1106
+ border: 1px solid #e5e7eb;
1107
+ border-radius: 6px;
1108
+ background: transparent;
1109
+ color: #6b7280;
1110
+ cursor: pointer;
1111
+ padding: 0;
1112
+ transition: border-color 0.15s, color 0.15s, background 0.15s;
1113
+ flex-shrink: 0;
1114
+ }
1115
+
1116
+ .ds-fp-close-btn svg {
1117
+ width: 14px;
1118
+ height: 14px;
1119
+ }
1120
+
1121
+ .ds-fp-close-btn:hover {
1122
+ border-color: #6366f1;
1123
+ color: #6366f1;
1124
+ background: #eef2ff;
1125
+ }
1126
+
1127
+ .ds-theme-dark .ds-fp-close-btn {
1128
+ border-color: #334155;
1129
+ color: #94a3b8;
1130
+ }
1131
+
1132
+ /* ── Reset All section (inside panel) ─────────────────────────────────────── */
1133
+ .ds-fp-reset-section {
1134
+ padding: 10px 16px;
1135
+ border-bottom: 1px solid #f3f4f6;
1136
+ }
1137
+
1138
+ .ds-theme-dark .ds-fp-reset-section {
1139
+ border-bottom-color: #1e293b;
1140
+ }
1141
+
1142
+ .ds-fp-reset-all {
1143
+ display: inline-flex;
1144
+ align-items: center;
1145
+ gap: 6px;
1146
+ border: none;
1147
+ background: transparent;
1148
+ color: #6366f1;
1149
+ font-size: 13px;
1150
+ font-weight: 500;
1151
+ cursor: pointer;
1152
+ padding: 0;
1153
+ transition: color 0.15s;
1154
+ }
1155
+
1156
+ .ds-fp-reset-all svg {
1157
+ width: 13px;
1158
+ height: 13px;
1159
+ }
1160
+
1161
+ .ds-fp-reset-all:hover {
1162
+ color: #4338ca;
1163
+ }
1164
+
1165
+ .ds-theme-dark .ds-fp-reset-all {
1166
+ color: #818cf8;
1167
+ }
1168
+
1169
+ .ds-fp-toggle {
1170
+ display: flex;
1171
+ align-items: center;
1172
+ gap: 6px;
1173
+ padding: 6px 12px;
1174
+ border: 1px solid #d1d5db;
1175
+ border-radius: 8px;
1176
+ background: #ffffff;
1177
+ color: #374151;
1178
+ font-size: 13px;
1179
+ font-weight: 500;
1180
+ cursor: pointer;
1181
+ transition: border-color 0.15s, background 0.15s;
1182
+ }
1183
+
1184
+ .ds-fp-toggle:hover {
1185
+ border-color: #6366f1;
1186
+ background: #f5f3ff;
1187
+ }
1188
+
1189
+ .ds-theme-dark .ds-fp-toggle {
1190
+ background: #1e293b;
1191
+ border-color: #334155;
1192
+ color: #e2e8f0;
1193
+ }
1194
+
1195
+ .ds-fp-funnel {
1196
+ width: 13px;
1197
+ height: 13px;
1198
+ flex-shrink: 0;
1199
+ }
1200
+
1201
+ .ds-fp-badge {
1202
+ display: inline-flex;
1203
+ align-items: center;
1204
+ justify-content: center;
1205
+ min-width: 18px;
1206
+ height: 18px;
1207
+ padding: 0 5px;
1208
+ border-radius: 9px;
1209
+ background: #6366f1;
1210
+ color: #fff;
1211
+ font-size: 11px;
1212
+ font-weight: 700;
1213
+ line-height: 1;
1214
+ }
1215
+
1216
+ .ds-fp-reset-all {
1217
+ border: none;
1218
+ background: transparent;
1219
+ color: #6366f1;
1220
+ font-size: 12px;
1221
+ font-weight: 500;
1222
+ cursor: pointer;
1223
+ padding: 0;
1224
+ text-decoration: underline;
1225
+ transition: color 0.15s;
1226
+ }
1227
+
1228
+ .ds-fp-reset-all:hover {
1229
+ color: #4338ca;
1230
+ }
1231
+
1232
+ .ds-theme-dark .ds-fp-reset-all {
1233
+ color: #818cf8;
1234
+ }
1235
+
1236
+ /* ── Expandable panel ──────────────────────────────────────────────────────── */
1237
+ .ds-fp-panel {
1238
+ padding: 0 16px 10px;
1239
+ }
1240
+
1241
+ .ds-fp-items {
1242
+ display: flex;
1243
+ flex-direction: column;
1244
+ gap: 4px;
1245
+ }
1246
+
1247
+ /* ── Filter item ───────────────────────────────────────────────────────────── */
1248
+ .ds-fp-item {
1249
+ border: 1px solid #e5e7eb;
1250
+ border-radius: 8px;
1251
+ overflow: hidden;
1252
+ background: #fafafa;
1253
+ }
1254
+
1255
+ .ds-theme-dark .ds-fp-item {
1256
+ border-color: #334155;
1257
+ background: #1e293b;
1258
+ }
1259
+
1260
+ .ds-fp-item-hd {
1261
+ display: flex;
1262
+ align-items: center;
1263
+ gap: 8px;
1264
+ padding: 9px 12px;
1265
+ cursor: pointer;
1266
+ user-select: none;
1267
+ transition: background 0.12s;
1268
+ }
1269
+
1270
+ .ds-fp-item-hd:hover {
1271
+ background: #f0f0ff;
1272
+ }
1273
+
1274
+ .ds-theme-dark .ds-fp-item-hd:hover {
1275
+ background: #0f172a;
1276
+ }
1277
+
1278
+ .ds-fp-item-name {
1279
+ flex: 1;
1280
+ font-size: 13px;
1281
+ font-weight: 600;
1282
+ color: #374151;
1283
+ }
1284
+
1285
+ .ds-theme-dark .ds-fp-item-name {
1286
+ color: #e2e8f0;
1287
+ }
1288
+
1289
+ .ds-fp-val-badge {
1290
+ font-size: 11px;
1291
+ font-weight: 600;
1292
+ padding: 2px 7px;
1293
+ border-radius: 10px;
1294
+ background: #e0e7ff;
1295
+ color: #4338ca;
1296
+ white-space: nowrap;
1297
+ max-width: 120px;
1298
+ overflow: hidden;
1299
+ text-overflow: ellipsis;
1300
+ }
1301
+
1302
+ .ds-theme-dark .ds-fp-val-badge {
1303
+ background: #312e81;
1304
+ color: #a5b4fc;
1305
+ }
1306
+
1307
+ .ds-fp-item-clear {
1308
+ border: none;
1309
+ background: transparent;
1310
+ color: #9ca3af;
1311
+ cursor: pointer;
1312
+ padding: 2px;
1313
+ line-height: 1;
1314
+ flex-shrink: 0;
1315
+ transition: color 0.12s;
1316
+ display: flex;
1317
+ align-items: center;
1318
+ }
1319
+
1320
+ .ds-fp-item-clear svg {
1321
+ width: 13px;
1322
+ height: 13px;
1323
+ }
1324
+
1325
+ .ds-fp-item-clear:hover {
1326
+ color: #6366f1;
1327
+ }
1328
+
1329
+ .ds-fp-chevron {
1330
+ width: 14px;
1331
+ height: 14px;
1332
+ color: #9ca3af;
1333
+ flex-shrink: 0;
1334
+ transition: transform 0.2s ease;
1335
+ }
1336
+
1337
+ /* Indigo border + highlight when expanded */
1338
+ .ds-fp-item-expanded,
1339
+ .ds-fp-item:has(.ds-fp-item-body) {
1340
+ border-color: #6366f1;
1341
+ background: #fafafe;
1342
+ }
1343
+
1344
+ .ds-theme-dark .ds-fp-item-expanded,
1345
+ .ds-theme-dark .ds-fp-item:has(.ds-fp-item-body) {
1346
+ border-color: #6366f1;
1347
+ background: #1e1e3a;
1348
+ }
1349
+
1350
+ /* ── Item body (expanded content) ──────────────────────────────────────────── */
1351
+ .ds-fp-item-body {
1352
+ padding: 4px 12px 12px;
1353
+ display: flex;
1354
+ flex-direction: column;
1355
+ gap: 8px;
1356
+ border-top: 1px solid #e5e7eb;
1357
+ }
1358
+
1359
+ .ds-theme-dark .ds-fp-item-body {
1360
+ border-top-color: #334155;
1361
+ }
1362
+
1363
+ /* ── Operator row ──────────────────────────────────────────────────────────── */
1364
+ .ds-fp-op-row {
1365
+ display: flex;
1366
+ align-items: center;
1367
+ gap: 8px;
1368
+ }
1369
+
1370
+ .ds-fp-op-lbl {
1371
+ font-size: 11px;
1372
+ font-weight: 600;
1373
+ text-transform: uppercase;
1374
+ letter-spacing: 0.04em;
1375
+ color: #9ca3af;
1376
+ white-space: nowrap;
1377
+ flex-shrink: 0;
1378
+ }
1379
+
1380
+ .ds-fp-op-select {
1381
+ flex: 1;
1382
+ height: 30px;
1383
+ padding: 0 8px;
1384
+ border: 1px solid #d1d5db;
1385
+ border-radius: 6px;
1386
+ font-size: 12px;
1387
+ background: #fff;
1388
+ color: #374151;
1389
+ cursor: pointer;
1390
+ outline: none;
1391
+ transition: border-color 0.15s;
1392
+ }
1393
+
1394
+ .ds-fp-op-select:focus {
1395
+ border-color: #6366f1;
1396
+ box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
1397
+ }
1398
+
1399
+ .ds-theme-dark .ds-fp-op-select {
1400
+ background: #0f172a;
1401
+ border-color: #334155;
1402
+ color: #e2e8f0;
1403
+ }
1404
+
1405
+ /* ── Search wrap (input + caret button) ────────────────────────────────────── */
1406
+ .ds-fp-search-wrap {
1407
+ display: flex;
1408
+ align-items: center;
1409
+ border: 1px solid #6366f1;
1410
+ border-radius: 8px;
1411
+ background: #fff;
1412
+ overflow: hidden;
1413
+ transition: box-shadow 0.15s;
1414
+ }
1415
+
1416
+ .ds-fp-search-wrap:focus-within {
1417
+ box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
1418
+ }
1419
+
1420
+ .ds-theme-dark .ds-fp-search-wrap {
1421
+ background: #0f172a;
1422
+ border-color: #6366f1;
1423
+ }
1424
+
1425
+ .ds-fp-ms-search {
1426
+ flex: 1;
1427
+ height: 36px;
1428
+ padding: 0 10px;
1429
+ border: none;
1430
+ outline: none;
1431
+ font-size: 13px;
1432
+ background: transparent;
1433
+ color: #374151;
1434
+ }
1435
+
1436
+ .ds-theme-dark .ds-fp-ms-search {
1437
+ color: #e2e8f0;
1438
+ }
1439
+
1440
+ .ds-fp-ms-search::placeholder {
1441
+ color: #9ca3af;
1442
+ }
1443
+
1444
+ .ds-fp-search-caret {
1445
+ width: 32px;
1446
+ height: 36px;
1447
+ display: flex;
1448
+ align-items: center;
1449
+ justify-content: center;
1450
+ border: none;
1451
+ border-left: 1px solid #e5e7eb;
1452
+ background: transparent;
1453
+ color: #6b7280;
1454
+ cursor: pointer;
1455
+ padding: 0;
1456
+ flex-shrink: 0;
1457
+ transition: color 0.12s, background 0.12s;
1458
+ }
1459
+
1460
+ .ds-fp-search-caret:hover {
1461
+ color: #6366f1;
1462
+ background: #eef2ff;
1463
+ }
1464
+
1465
+ .ds-theme-dark .ds-fp-search-caret {
1466
+ border-left-color: #334155;
1467
+ }
1468
+
1469
+ /* ── Multi-select container ────────────────────────────────────────────────── */
1470
+ .ds-fp-ms {
1471
+ border: 1px solid #e5e7eb;
1472
+ border-radius: 8px;
1473
+ overflow: hidden;
1474
+ }
1475
+
1476
+ .ds-theme-dark .ds-fp-ms {
1477
+ border-color: #334155;
1478
+ }
1479
+
1480
+ /* Chips row (shown above search when values selected) */
1481
+ .ds-fp-chips-row {
1482
+ display: flex;
1483
+ flex-wrap: wrap;
1484
+ align-items: center;
1485
+ gap: 4px;
1486
+ padding: 6px 0 4px;
1487
+ }
1488
+
1489
+ .ds-fp-chip {
1490
+ display: inline-flex;
1491
+ align-items: center;
1492
+ gap: 4px;
1493
+ padding: 2px 8px 2px 8px;
1494
+ border-radius: 12px;
1495
+ background: #e0e7ff;
1496
+ color: #4338ca;
1497
+ font-size: 11px;
1498
+ font-weight: 600;
1499
+ white-space: nowrap;
1500
+ }
1501
+
1502
+ .ds-theme-dark .ds-fp-chip {
1503
+ background: #312e81;
1504
+ color: #a5b4fc;
1505
+ }
1506
+
1507
+ .ds-fp-chip-x {
1508
+ border: none;
1509
+ background: transparent;
1510
+ color: inherit;
1511
+ font-size: 10px;
1512
+ cursor: pointer;
1513
+ padding: 0;
1514
+ line-height: 1;
1515
+ opacity: 0.7;
1516
+ transition: opacity 0.1s;
1517
+ }
1518
+
1519
+ .ds-fp-chip-x:hover {
1520
+ opacity: 1;
1521
+ }
1522
+
1523
+ /* ds-fp-ms-search styles live in .ds-fp-search-wrap above */
1524
+
1525
+ /* Options list */
1526
+ .ds-fp-opts {
1527
+ max-height: 180px;
1528
+ overflow-y: auto;
1529
+ }
1530
+
1531
+ .ds-fp-opt {
1532
+ display: flex;
1533
+ align-items: center;
1534
+ gap: 8px;
1535
+ padding: 7px 10px;
1536
+ cursor: pointer;
1537
+ transition: background 0.1s;
1538
+ user-select: none;
1539
+ }
1540
+
1541
+ .ds-fp-opt:hover {
1542
+ background: #f0f0ff;
1543
+ }
1544
+
1545
+ .ds-theme-dark .ds-fp-opt:hover {
1546
+ background: #1e293b;
1547
+ }
1548
+
1549
+ .ds-fp-opt-on {
1550
+ background: #eef2ff;
1551
+ }
1552
+
1553
+ .ds-theme-dark .ds-fp-opt-on {
1554
+ background: #1e293b;
1555
+ }
1556
+
1557
+ /* Custom checkbox */
1558
+ .ds-fp-cb {
1559
+ width: 16px;
1560
+ height: 16px;
1561
+ border: 2px solid #d1d5db;
1562
+ border-radius: 4px;
1563
+ flex-shrink: 0;
1564
+ display: flex;
1565
+ align-items: center;
1566
+ justify-content: center;
1567
+ transition: border-color 0.1s, background 0.1s;
1568
+ }
1569
+
1570
+ .ds-fp-cb-on {
1571
+ border-color: #6366f1;
1572
+ background: #6366f1;
1573
+ }
1574
+
1575
+ .ds-fp-cb-on svg {
1576
+ width: 10px;
1577
+ height: 10px;
1578
+ stroke: #fff;
1579
+ }
1580
+
1581
+ .ds-fp-opt-lbl {
1582
+ font-size: 12px;
1583
+ color: #374151;
1584
+ flex: 1;
1585
+ overflow: hidden;
1586
+ text-overflow: ellipsis;
1587
+ white-space: nowrap;
1588
+ }
1589
+
1590
+ .ds-theme-dark .ds-fp-opt-lbl {
1591
+ color: #cbd5e1;
1592
+ }
1593
+
1594
+ .ds-fp-opts-msg {
1595
+ display: flex;
1596
+ align-items: center;
1597
+ justify-content: center;
1598
+ gap: 8px;
1599
+ padding: 14px 12px;
1600
+ font-size: 12px;
1601
+ color: #9ca3af;
1602
+ }
1603
+
1604
+ /* ── Apply Filter button ───────────────────────────────────────────────────── */
1605
+ .ds-fp-apply {
1606
+ width: 100%;
1607
+ padding: 9px 16px;
1608
+ border: none;
1609
+ border-radius: 8px;
1610
+ background: linear-gradient(135deg, #16a34a, #15803d);
1611
+ color: #fff;
1612
+ font-size: 13px;
1613
+ font-weight: 600;
1614
+ cursor: pointer;
1615
+ transition: opacity 0.15s, transform 0.1s;
1616
+ letter-spacing: 0.01em;
1617
+ }
1618
+
1619
+ .ds-fp-apply:hover {
1620
+ opacity: 0.9;
1621
+ }
1622
+
1623
+ .ds-fp-apply:active {
1624
+ transform: scale(0.98);
1625
+ }
1626
+
1627
+ /* ── Text / date inputs inside filter body ─────────────────────────────────── */
1628
+ .ds-fp-text-val {
1629
+ width: 100%;
1630
+ height: 34px;
1631
+ padding: 0 10px;
1632
+ border: 1px solid #d1d5db;
1633
+ border-radius: 6px;
1634
+ font-size: 13px;
1635
+ background: #fff;
1636
+ color: #374151;
1637
+ outline: none;
1638
+ transition: border-color 0.15s;
1639
+ }
1640
+
1641
+ .ds-fp-text-val:focus {
1642
+ border-color: #6366f1;
1643
+ box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
1644
+ }
1645
+
1646
+ .ds-theme-dark .ds-fp-text-val {
1647
+ background: #0f172a;
1648
+ border-color: #334155;
1649
+ color: #e2e8f0;
1650
+ }
1651
+
1652
+ .ds-fp-date-range {
1653
+ display: flex;
1654
+ align-items: center;
1655
+ gap: 6px;
1656
+ }
1657
+
1658
+ .ds-fp-date {
1659
+ flex: 1;
1660
+ height: 34px;
1661
+ padding: 0 8px;
1662
+ border: 1px solid #d1d5db;
1663
+ border-radius: 6px;
1664
+ font-size: 12px;
1665
+ background: #fff;
1666
+ color: #374151;
1667
+ outline: none;
1668
+ transition: border-color 0.15s;
1669
+ }
1670
+
1671
+ .ds-fp-date:focus {
1672
+ border-color: #6366f1;
1673
+ }
1674
+
1675
+ .ds-fp-date-sep {
1676
+ color: #9ca3af;
1677
+ font-size: 12px;
1678
+ }
1679
+
1680
+ .ds-theme-dark .ds-fp-date {
1681
+ background: #0f172a;
1682
+ border-color: #334155;
1683
+ color: #e2e8f0;
1684
+ }
1685
+
1686
+ /* ── Component-level inline filter button (funnel icon on chart card) ──────── */
1687
+ .ds-comp-filter-btn {
1688
+ position: absolute;
1689
+ top: 6px;
1690
+ right: 6px;
1691
+ z-index: 10;
1692
+ width: 28px;
1693
+ height: 28px;
1694
+ display: flex;
1695
+ align-items: center;
1696
+ justify-content: center;
1697
+ border: 1px solid #e5e7eb;
1698
+ border-radius: 6px;
1699
+ background: rgba(255,255,255,0.9);
1700
+ color: #6b7280;
1701
+ cursor: pointer;
1702
+ padding: 0;
1703
+ transition: border-color 0.15s, color 0.15s, background 0.15s;
1704
+ backdrop-filter: blur(4px);
1705
+ }
1706
+
1707
+ .ds-comp-filter-btn:hover {
1708
+ border-color: #6366f1;
1709
+ color: #6366f1;
1710
+ background: #fff;
1711
+ }
1712
+
1713
+ .ds-comp-filter-btn-active {
1714
+ border-color: #6366f1;
1715
+ color: #6366f1;
1716
+ background: #eef2ff;
1717
+ }
1718
+
1719
+ .ds-comp-filter-btn svg {
1720
+ width: 13px;
1721
+ height: 13px;
1722
+ }
1723
+
1724
+ .ds-theme-dark .ds-comp-filter-btn {
1725
+ background: rgba(15,23,42,0.85);
1726
+ border-color: #334155;
1727
+ color: #94a3b8;
1728
+ }
1729
+
1730
+ .ds-theme-dark .ds-comp-filter-btn-active {
1731
+ border-color: #6366f1;
1732
+ color: #818cf8;
1733
+ background: #1e293b;
1734
+ }
1735
+
1736
+ /* ── Inline filter popover ─────────────────────────────────────────────────── */
1737
+ .ds-comp-filter-pop {
1738
+ position: absolute;
1739
+ top: 38px;
1740
+ right: 6px;
1741
+ z-index: 9999;
1742
+ }
1743
+
1744
+ /* Visual shell for the inline popover — same look as global filter panel */
1745
+ .ds-fp-panel-pop {
1746
+ width: 300px;
1747
+ max-height: 440px;
1748
+ overflow-y: auto;
1749
+ background: #fff;
1750
+ border: 1px solid #e5e7eb;
1751
+ border-radius: 10px;
1752
+ box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
1753
+ }
1754
+
1755
+ .ds-theme-dark .ds-fp-panel-pop {
1756
+ background: #1e293b;
1757
+ border-color: #334155;
1758
+ box-shadow: 0 8px 24px rgba(0,0,0,0.4);
1759
+ }
1760
+
1761
+ .ds-cpop-inner {
1762
+ display: flex;
1763
+ flex-direction: column;
1764
+ gap: 6px;
1765
+ padding: 10px;
1766
+ }
1767
+
1768
+ .ds-cpop-title {
1769
+ font-size: 11px;
1770
+ font-weight: 700;
1771
+ text-transform: uppercase;
1772
+ letter-spacing: 0.05em;
1773
+ color: #6b7280;
1774
+ padding-bottom: 4px;
1775
+ border-bottom: 1px solid #f3f4f6;
1776
+ }
1777
+
1778
+ .ds-theme-dark .ds-cpop-title {
1779
+ color: #94a3b8;
1780
+ border-bottom-color: #334155;
1781
+ }
1782
+
1783
+ .ds-cpop-label {
1784
+ font-size: 12px;
1785
+ font-weight: 600;
1786
+ color: #374151;
1787
+ margin-bottom: 4px;
1788
+ }
1789
+
1790
+ .ds-theme-dark .ds-cpop-label {
1791
+ color: #e2e8f0;
1792
+ }
1793
+
1794
+ .ds-cpop-opts-wrap {
1795
+ border: 1px solid #e5e7eb;
1796
+ border-radius: 6px;
1797
+ overflow: hidden;
1798
+ margin-bottom: 6px;
1799
+ }
1800
+
1801
+ .ds-theme-dark .ds-cpop-opts-wrap {
1802
+ border-color: #334155;
1803
+ }
1804
+
1805
+ .ds-cpop-opts {
1806
+ max-height: 160px;
1807
+ overflow-y: auto;
1808
+ }
1809
+
1810
+ .ds-cpop-opt {
1811
+ display: flex;
1812
+ align-items: center;
1813
+ gap: 8px;
1814
+ padding: 6px 8px;
1815
+ cursor: pointer;
1816
+ font-size: 12px;
1817
+ color: #374151;
1818
+ transition: background 0.1s;
1819
+ user-select: none;
1820
+ }
1821
+
1822
+ .ds-cpop-opt:hover {
1823
+ background: #f0f0ff;
1824
+ }
1825
+
1826
+ .ds-theme-dark .ds-cpop-opt {
1827
+ color: #cbd5e1;
1828
+ }
1829
+
1830
+ .ds-theme-dark .ds-cpop-opt:hover {
1831
+ background: #0f172a;
1832
+ }
1833
+
1834
+ .ds-cpop-apply {
1835
+ font-size: 12px;
1836
+ padding: 7px 12px;
1837
+ }
1838
+
1839
+ /* ── Custom dropdown filter (matches publish page SelectFilter) ────────────── */
1840
+
1841
+ .ds-custom-dd {
1842
+ position: relative;
1843
+ min-width: 150px;
1844
+ }
1845
+
1846
+ .ds-dd-trigger {
1847
+ width: 100%;
1848
+ height: 34px;
1849
+ padding: 0 10px;
1850
+ display: flex;
1851
+ align-items: center;
1852
+ justify-content: space-between;
1853
+ gap: 6px;
1854
+ background: #ffffff;
1855
+ border: 1px solid #d1d5db;
1856
+ border-radius: 8px;
1857
+ font-size: 13px;
1858
+ color: #111827;
1859
+ cursor: pointer;
1860
+ text-align: left;
1861
+ transition: border-color 0.15s, box-shadow 0.15s;
1862
+ white-space: nowrap;
1863
+ }
1864
+
1865
+ .ds-dd-trigger:hover {
1866
+ border-color: #6366f1;
1867
+ }
1868
+
1869
+ .ds-dd-trigger:focus {
1870
+ outline: none;
1871
+ border-color: #6366f1;
1872
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
1873
+ }
1874
+
1875
+ .ds-theme-dark .ds-dd-trigger {
1876
+ background: #1e293b;
1877
+ border-color: #334155;
1878
+ color: #f1f5f9;
1879
+ }
1880
+
1881
+ .ds-dd-value {
1882
+ flex: 1;
1883
+ overflow: hidden;
1884
+ text-overflow: ellipsis;
1885
+ color: inherit;
1886
+ }
1887
+
1888
+ /* "All" placeholder style */
1889
+ .ds-dd-trigger:not(.ds-dd-has-value) .ds-dd-value {
1890
+ color: #9ca3af;
1891
+ }
1892
+
1893
+ .ds-dd-actions {
1894
+ display: flex;
1895
+ align-items: center;
1896
+ gap: 4px;
1897
+ flex-shrink: 0;
1898
+ }
1899
+
1900
+ .ds-dd-clear {
1901
+ font-size: 11px;
1902
+ color: #9ca3af;
1903
+ cursor: pointer;
1904
+ padding: 0 2px;
1905
+ line-height: 1;
1906
+ }
1907
+
1908
+ .ds-dd-clear:hover {
1909
+ color: #374151;
1910
+ }
1911
+
1912
+ .ds-theme-dark .ds-dd-clear:hover {
1913
+ color: #e2e8f0;
1914
+ }
1915
+
1916
+ .ds-dd-arrow {
1917
+ color: #9ca3af;
1918
+ transition: transform 0.18s ease;
1919
+ display: block;
1920
+ }
1921
+
1922
+ /* ── Dropdown panel ────────────────────────────────────────────────────────── */
1923
+
1924
+ .ds-dd-panel {
1925
+ position: absolute;
1926
+ top: calc(100% + 4px);
1927
+ left: 0;
1928
+ right: 0;
1929
+ min-width: 180px;
1930
+ background: #ffffff;
1931
+ border: 1px solid #e5e7eb;
1932
+ border-radius: 10px;
1933
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
1934
+ z-index: 9999;
1935
+ overflow: hidden;
1936
+ }
1937
+
1938
+ .ds-theme-dark .ds-dd-panel {
1939
+ background: #1e293b;
1940
+ border-color: #334155;
1941
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
1942
+ }
1943
+
1944
+ /* Search row */
1945
+ .ds-dd-search-wrap {
1946
+ padding: 8px 8px 6px;
1947
+ border-bottom: 1px solid #f3f4f6;
1948
+ }
1949
+
1950
+ .ds-theme-dark .ds-dd-search-wrap {
1951
+ border-bottom-color: #334155;
1952
+ }
1953
+
1954
+ .ds-dd-search {
1955
+ width: 100%;
1956
+ height: 30px;
1957
+ padding: 0 10px;
1958
+ border: 1px solid #e5e7eb;
1959
+ border-radius: 6px;
1960
+ font-size: 12px;
1961
+ background: #f9fafb;
1962
+ color: #374151;
1963
+ outline: none;
1964
+ transition: border-color 0.15s, box-shadow 0.15s;
1965
+ }
1966
+
1967
+ .ds-dd-search:focus {
1968
+ border-color: #6366f1;
1969
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
1970
+ background: #fff;
1971
+ }
1972
+
1973
+ .ds-theme-dark .ds-dd-search {
1974
+ background: #0f172a;
1975
+ border-color: #334155;
1976
+ color: #e2e8f0;
1977
+ }
1978
+
1979
+ .ds-theme-dark .ds-dd-search:focus {
1980
+ background: #1e293b;
1981
+ }
1982
+
1983
+ /* Options list */
1984
+ .ds-dd-options {
1985
+ max-height: 200px;
1986
+ overflow-y: auto;
1987
+ }
1988
+
1989
+ .ds-dd-opt {
1990
+ width: 100%;
1991
+ padding: 8px 12px;
1992
+ display: flex;
1993
+ align-items: center;
1994
+ justify-content: space-between;
1995
+ gap: 8px;
1996
+ background: transparent;
1997
+ border: none;
1998
+ font-size: 13px;
1999
+ color: #374151;
2000
+ cursor: pointer;
2001
+ text-align: left;
2002
+ transition: background 0.1s;
2003
+ }
2004
+
2005
+ .ds-dd-opt:hover {
2006
+ background: #eef2ff;
2007
+ }
2008
+
2009
+ .ds-dd-opt-active {
2010
+ background: #eef2ff;
2011
+ color: #4338ca;
2012
+ font-weight: 600;
2013
+ }
2014
+
2015
+ .ds-dd-opt-active:hover {
2016
+ background: #e0e7ff;
2017
+ }
2018
+
2019
+ .ds-theme-dark .ds-dd-opt {
2020
+ color: #cbd5e1;
2021
+ }
2022
+
2023
+ .ds-theme-dark .ds-dd-opt:hover {
2024
+ background: #0f172a;
2025
+ }
2026
+
2027
+ .ds-theme-dark .ds-dd-opt-active {
2028
+ background: #1e293b;
2029
+ color: #818cf8;
2030
+ }
2031
+
2032
+ .ds-dd-opt-text {
2033
+ flex: 1;
2034
+ overflow: hidden;
2035
+ text-overflow: ellipsis;
2036
+ white-space: nowrap;
2037
+ }
2038
+
2039
+ .ds-dd-check {
2040
+ color: #4338ca;
2041
+ flex-shrink: 0;
2042
+ }
2043
+
2044
+ .ds-theme-dark .ds-dd-check {
2045
+ color: #818cf8;
2046
+ }
2047
+
2048
+ /* Empty / loading message */
2049
+ .ds-dd-msg {
2050
+ display: flex;
2051
+ align-items: center;
2052
+ justify-content: center;
2053
+ gap: 8px;
2054
+ padding: 14px 12px;
2055
+ font-size: 12px;
2056
+ color: #9ca3af;
2057
+ }
2058
+
2059
+ .ds-theme-dark .ds-dd-msg {
2060
+ color: #64748b;
2061
+ }
2062
+
2063
+ /* Spinner inside dropdown */
2064
+ .ds-dd-spinner {
2065
+ width: 14px;
2066
+ height: 14px;
2067
+ border: 2px solid #e5e7eb;
2068
+ border-top-color: #6366f1;
2069
+ border-radius: 50%;
2070
+ animation: ds-spin 0.8s linear infinite;
2071
+ flex-shrink: 0;
2072
+ }
2073
+
2074
+ /* ── v2: Inline filter (selection-filter placed in-grid) ───────────────────── */
2075
+
2076
+ .ds-inline-filter {
2077
+ width: 100%;
2078
+ height: 100%;
2079
+ display: flex;
2080
+ flex-direction: column;
2081
+ justify-content: center;
2082
+ gap: 4px;
2083
+ padding: 6px 10px;
2084
+ }
2085
+
2086
+ .ds-inline-filter-select,
2087
+ .ds-inline-filter-input {
2088
+ width: 100%;
2089
+ height: 34px;
2090
+ padding: 0 10px;
2091
+ border: 1px solid #d1d5db;
2092
+ border-radius: 6px;
2093
+ font-size: 13px;
2094
+ background: #ffffff;
2095
+ color: #111827;
2096
+ cursor: pointer;
2097
+ outline: none;
2098
+ transition: border-color 0.15s, box-shadow 0.15s;
2099
+ }
2100
+
2101
+ .ds-inline-filter-select:focus,
2102
+ .ds-inline-filter-input:focus {
2103
+ border-color: #6366f1;
2104
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
2105
+ }
2106
+
2107
+ .ds-theme-dark .ds-inline-filter-select,
2108
+ .ds-theme-dark .ds-inline-filter-input {
2109
+ background: #1e293b;
2110
+ border-color: #334155;
2111
+ color: #f1f5f9;
2112
+ }
2113
+
2114
+ /* ── Export toolbar ────────────────────────────────────────────────────────── */
2115
+ .ds-toolbar {
2116
+ display: flex;
2117
+ justify-content: flex-end;
2118
+ padding: 8px 16px 0;
2119
+ gap: 8px;
2120
+ }
2121
+
2122
+ .ds-toolbar-btn {
2123
+ height: 30px;
2124
+ padding: 0 12px;
2125
+ border: 1px solid #d1d5db;
2126
+ border-radius: 6px;
2127
+ font-size: 12px;
2128
+ font-weight: 500;
2129
+ background: #ffffff;
2130
+ color: #374151;
2131
+ cursor: pointer;
2132
+ display: flex;
2133
+ align-items: center;
2134
+ gap: 5px;
2135
+ transition: background 0.15s, border-color 0.15s;
2136
+ }
2137
+
2138
+ .ds-toolbar-btn:hover {
2139
+ background: #f9fafb;
2140
+ border-color: #9ca3af;
2141
+ }
2142
+
2143
+ .ds-theme-dark .ds-toolbar-btn {
2144
+ background: #1e293b;
2145
+ border-color: #334155;
2146
+ color: #e2e8f0;
2147
+ }
2148
+
2149
+ .ds-theme-dark .ds-toolbar-btn:hover {
2150
+ background: #0f172a;
2151
+ }
2152
+
2153
+ /* ─────────────────────────────────────────────────────────────────────────────
2154
+ v3 Badge-bar filter panel
2155
+ Layout: [⊻ Filters:] [Filter A] [Filter B] [+ Add Filter]
2156
+ Per-filter popovers open below the clicked badge.
2157
+ ───────────────────────────────────────────────────────────────────────────── */
2158
+
2159
+ /* Wrapper — relative so popovers can be absolutely positioned inside */
2160
+ .ds-fp-v3 {
2161
+ position: relative;
2162
+ border-bottom: 1px solid #e5e7eb;
2163
+ background: inherit;
2164
+ }
2165
+
2166
+ .ds-theme-dark .ds-fp-v3 {
2167
+ border-bottom-color: #1e293b;
2168
+ }
2169
+
2170
+ /* ── Horizontal bar ─────────────────────────────────────────────────────────── */
2171
+ .ds-fp-v3-bar {
2172
+ display: flex;
2173
+ align-items: center;
2174
+ flex-wrap: wrap;
2175
+ gap: 6px;
2176
+ padding: 8px 16px;
2177
+ }
2178
+
2179
+ /* "⊻ Filters:" label */
2180
+ .ds-fp-v3-label {
2181
+ display: inline-flex;
2182
+ align-items: center;
2183
+ gap: 5px;
2184
+ font-size: 12px;
2185
+ font-weight: 600;
2186
+ color: #6b7280;
2187
+ letter-spacing: 0.03em;
2188
+ white-space: nowrap;
2189
+ flex-shrink: 0;
2190
+ margin-right: 2px;
2191
+ }
2192
+
2193
+ .ds-fp-v3-label svg {
2194
+ color: #9ca3af;
2195
+ }
2196
+
2197
+ .ds-theme-dark .ds-fp-v3-label {
2198
+ color: #94a3b8;
2199
+ }
2200
+
2201
+ /* Container for all badge pills */
2202
+ .ds-fp-v3-badges {
2203
+ display: flex;
2204
+ flex-wrap: wrap;
2205
+ align-items: center;
2206
+ gap: 6px;
2207
+ }
2208
+
2209
+ /* ── Filter badge pill ──────────────────────────────────────────────────────── */
2210
+ .ds-fp-v3-badge {
2211
+ display: inline-flex;
2212
+ align-items: center;
2213
+ gap: 5px;
2214
+ padding: 4px 12px;
2215
+ border: 1.5px solid #d1d5db;
2216
+ border-radius: 20px;
2217
+ background: #ffffff;
2218
+ color: #374151;
2219
+ font-size: 12px;
2220
+ font-weight: 500;
2221
+ cursor: pointer;
2222
+ white-space: nowrap;
2223
+ transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
2224
+ line-height: 1.4;
2225
+ }
2226
+
2227
+ .ds-fp-v3-badge svg {
2228
+ flex-shrink: 0;
2229
+ color: #9ca3af;
2230
+ transition: color 0.15s;
2231
+ }
2232
+
2233
+ .ds-fp-v3-badge:hover {
2234
+ border-color: #6366f1;
2235
+ background: #f5f3ff;
2236
+ color: #4338ca;
2237
+ }
2238
+
2239
+ .ds-fp-v3-badge:hover svg {
2240
+ color: #6366f1;
2241
+ }
2242
+
2243
+ .ds-theme-dark .ds-fp-v3-badge {
2244
+ background: #1e293b;
2245
+ border-color: #334155;
2246
+ color: #cbd5e1;
2247
+ }
2248
+
2249
+ .ds-theme-dark .ds-fp-v3-badge:hover {
2250
+ border-color: #6366f1;
2251
+ background: #1e1e3a;
2252
+ color: #a5b4fc;
2253
+ }
2254
+
2255
+ /* Active state — green filled pill */
2256
+ .ds-fp-v3-badge-active {
2257
+ border-color: #16a34a;
2258
+ background: #16a34a;
2259
+ color: #ffffff;
2260
+ }
2261
+
2262
+ .ds-fp-v3-badge-active svg {
2263
+ color: rgba(255, 255, 255, 0.8);
2264
+ }
2265
+
2266
+ .ds-fp-v3-badge-active:hover {
2267
+ border-color: #15803d;
2268
+ background: #15803d;
2269
+ color: #ffffff;
2270
+ }
2271
+
2272
+ .ds-fp-v3-badge-active:hover svg {
2273
+ color: rgba(255, 255, 255, 0.9);
2274
+ }
2275
+
2276
+ .ds-theme-dark .ds-fp-v3-badge-active {
2277
+ border-color: #16a34a;
2278
+ background: #16a34a;
2279
+ color: #ffffff;
2280
+ }
2281
+
2282
+ /* "+ Add Filter" ghost button */
2283
+ .ds-fp-v3-add {
2284
+ display: inline-flex;
2285
+ align-items: center;
2286
+ gap: 4px;
2287
+ padding: 4px 12px;
2288
+ border: 1.5px dashed #d1d5db;
2289
+ border-radius: 20px;
2290
+ background: transparent;
2291
+ color: #9ca3af;
2292
+ font-size: 12px;
2293
+ font-weight: 500;
2294
+ cursor: pointer;
2295
+ white-space: nowrap;
2296
+ transition: border-color 0.15s, color 0.15s;
2297
+ line-height: 1.4;
2298
+ }
2299
+
2300
+ .ds-fp-v3-add:hover {
2301
+ border-color: #6366f1;
2302
+ color: #6366f1;
2303
+ }
2304
+
2305
+ .ds-theme-dark .ds-fp-v3-add {
2306
+ border-color: #334155;
2307
+ color: #64748b;
2308
+ }
2309
+
2310
+ .ds-theme-dark .ds-fp-v3-add:hover {
2311
+ border-color: #6366f1;
2312
+ color: #818cf8;
2313
+ }
2314
+
2315
+ /* ── Popover ────────────────────────────────────────────────────────────────── */
2316
+ .ds-fp-v3-pop {
2317
+ position: absolute;
2318
+ z-index: 9999;
2319
+ width: 300px;
2320
+ background: #ffffff;
2321
+ border: 1px solid #e5e7eb;
2322
+ border-radius: 12px;
2323
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
2324
+ overflow: hidden;
2325
+ }
2326
+
2327
+ .ds-theme-dark .ds-fp-v3-pop {
2328
+ background: #1e293b;
2329
+ border-color: #334155;
2330
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
2331
+ }
2332
+
2333
+ /* Popover header */
2334
+ .ds-fp-v3-pop-hd {
2335
+ display: flex;
2336
+ align-items: center;
2337
+ justify-content: space-between;
2338
+ padding: 10px 12px 10px 14px;
2339
+ border-bottom: 1px solid #f3f4f6;
2340
+ background: #fafafa;
2341
+ }
2342
+
2343
+ .ds-theme-dark .ds-fp-v3-pop-hd {
2344
+ background: #0f172a;
2345
+ border-bottom-color: #334155;
2346
+ }
2347
+
2348
+ .ds-fp-v3-pop-title {
2349
+ display: inline-flex;
2350
+ align-items: center;
2351
+ gap: 6px;
2352
+ font-size: 13px;
2353
+ font-weight: 600;
2354
+ color: #374151;
2355
+ }
2356
+
2357
+ .ds-fp-v3-pop-title svg {
2358
+ color: #6b7280;
2359
+ flex-shrink: 0;
2360
+ }
2361
+
2362
+ .ds-theme-dark .ds-fp-v3-pop-title {
2363
+ color: #e2e8f0;
2364
+ }
2365
+
2366
+ .ds-theme-dark .ds-fp-v3-pop-title svg {
2367
+ color: #94a3b8;
2368
+ }
2369
+
2370
+ /* Action icon buttons (trash + close) */
2371
+ .ds-fp-v3-pop-actions {
2372
+ display: flex;
2373
+ align-items: center;
2374
+ gap: 4px;
2375
+ }
2376
+
2377
+ .ds-fp-v3-pop-icon-btn {
2378
+ width: 26px;
2379
+ height: 26px;
2380
+ display: flex;
2381
+ align-items: center;
2382
+ justify-content: center;
2383
+ border: 1px solid #e5e7eb;
2384
+ border-radius: 6px;
2385
+ background: transparent;
2386
+ color: #6b7280;
2387
+ cursor: pointer;
2388
+ padding: 0;
2389
+ transition: border-color 0.15s, color 0.15s, background 0.15s;
2390
+ flex-shrink: 0;
2391
+ }
2392
+
2393
+ .ds-fp-v3-pop-icon-btn:hover {
2394
+ border-color: #6366f1;
2395
+ color: #6366f1;
2396
+ background: #eef2ff;
2397
+ }
2398
+
2399
+ .ds-theme-dark .ds-fp-v3-pop-icon-btn {
2400
+ border-color: #334155;
2401
+ color: #94a3b8;
2402
+ }
2403
+
2404
+ .ds-theme-dark .ds-fp-v3-pop-icon-btn:hover {
2405
+ border-color: #6366f1;
2406
+ color: #818cf8;
2407
+ background: #1e1e3a;
2408
+ }
2409
+
2410
+ /* Popover body */
2411
+ .ds-fp-v3-pop-body {
2412
+ display: flex;
2413
+ flex-direction: column;
2414
+ gap: 10px;
2415
+ padding: 12px 14px;
2416
+ }
2417
+
2418
+ /* Field row (label + control) */
2419
+ .ds-fp-v3-field {
2420
+ display: flex;
2421
+ flex-direction: column;
2422
+ gap: 5px;
2423
+ }
2424
+
2425
+ .ds-fp-v3-field-lbl {
2426
+ font-size: 10px;
2427
+ font-weight: 700;
2428
+ text-transform: uppercase;
2429
+ letter-spacing: 0.06em;
2430
+ color: #9ca3af;
2431
+ }
2432
+
2433
+ .ds-theme-dark .ds-fp-v3-field-lbl {
2434
+ color: #64748b;
2435
+ }
2436
+
2437
+ /* Condition select */
2438
+ .ds-fp-v3-condition {
2439
+ width: 100%;
2440
+ height: 32px;
2441
+ padding: 0 8px;
2442
+ border: 1px solid #d1d5db;
2443
+ border-radius: 7px;
2444
+ font-size: 12px;
2445
+ background: #ffffff;
2446
+ color: #374151;
2447
+ cursor: pointer;
2448
+ outline: none;
2449
+ transition: border-color 0.15s;
2450
+ }
2451
+
2452
+ .ds-fp-v3-condition:focus {
2453
+ border-color: #6366f1;
2454
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
2455
+ }
2456
+
2457
+ .ds-theme-dark .ds-fp-v3-condition {
2458
+ background: #0f172a;
2459
+ border-color: #334155;
2460
+ color: #e2e8f0;
2461
+ }
2462
+
2463
+ /* ── Multi-select widget ────────────────────────────────────────────────────── */
2464
+ .ds-fp-v3-ms-wrap {
2465
+ display: flex;
2466
+ flex-direction: column;
2467
+ gap: 6px;
2468
+ }
2469
+
2470
+ /* Trigger row */
2471
+ .ds-fp-v3-ms-trigger {
2472
+ display: flex;
2473
+ align-items: center;
2474
+ justify-content: space-between;
2475
+ gap: 6px;
2476
+ height: 32px;
2477
+ padding: 0 10px;
2478
+ border: 1px solid #d1d5db;
2479
+ border-radius: 7px;
2480
+ background: #ffffff;
2481
+ cursor: pointer;
2482
+ font-size: 12px;
2483
+ color: #374151;
2484
+ transition: border-color 0.15s;
2485
+ user-select: none;
2486
+ }
2487
+
2488
+ .ds-fp-v3-ms-trigger:hover {
2489
+ border-color: #6366f1;
2490
+ }
2491
+
2492
+ .ds-theme-dark .ds-fp-v3-ms-trigger {
2493
+ background: #0f172a;
2494
+ border-color: #334155;
2495
+ color: #e2e8f0;
2496
+ }
2497
+
2498
+ .ds-fp-v3-ms-display {
2499
+ flex: 1;
2500
+ overflow: hidden;
2501
+ text-overflow: ellipsis;
2502
+ white-space: nowrap;
2503
+ color: inherit;
2504
+ }
2505
+
2506
+ /* When no value selected, show placeholder colour */
2507
+ .ds-fp-v3-ms-trigger:not(.ds-fp-v3-ms-has-value) .ds-fp-v3-ms-display {
2508
+ color: #9ca3af;
2509
+ }
2510
+
2511
+ /* Dropdown panel */
2512
+ .ds-fp-v3-ms-drop {
2513
+ border: 1px solid #e5e7eb;
2514
+ border-radius: 8px;
2515
+ overflow: hidden;
2516
+ background: #ffffff;
2517
+ }
2518
+
2519
+ .ds-theme-dark .ds-fp-v3-ms-drop {
2520
+ background: #0f172a;
2521
+ border-color: #334155;
2522
+ }
2523
+
2524
+ /* Search input inside dropdown */
2525
+ .ds-fp-v3-ms-search {
2526
+ width: 100%;
2527
+ height: 32px;
2528
+ padding: 0 10px;
2529
+ border: none;
2530
+ border-bottom: 1px solid #f3f4f6;
2531
+ outline: none;
2532
+ font-size: 12px;
2533
+ background: #f9fafb;
2534
+ color: #374151;
2535
+ transition: background 0.15s;
2536
+ }
2537
+
2538
+ .ds-fp-v3-ms-search:focus {
2539
+ background: #ffffff;
2540
+ border-bottom-color: #6366f1;
2541
+ }
2542
+
2543
+ .ds-theme-dark .ds-fp-v3-ms-search {
2544
+ background: #0f172a;
2545
+ border-bottom-color: #1e293b;
2546
+ color: #e2e8f0;
2547
+ }
2548
+
2549
+ .ds-fp-v3-ms-search::placeholder {
2550
+ color: #9ca3af;
2551
+ }
2552
+
2553
+ /* Options list */
2554
+ .ds-fp-v3-ms-opts {
2555
+ max-height: 160px;
2556
+ overflow-y: auto;
2557
+ }
2558
+
2559
+ /* Individual option row */
2560
+ .ds-fp-v3-opt {
2561
+ display: flex;
2562
+ align-items: center;
2563
+ gap: 8px;
2564
+ padding: 6px 10px;
2565
+ cursor: pointer;
2566
+ font-size: 12px;
2567
+ color: #374151;
2568
+ transition: background 0.1s;
2569
+ user-select: none;
2570
+ }
2571
+
2572
+ .ds-fp-v3-opt:hover {
2573
+ background: #f0f0ff;
2574
+ }
2575
+
2576
+ .ds-fp-v3-opt-on {
2577
+ background: #eef2ff;
2578
+ }
2579
+
2580
+ .ds-theme-dark .ds-fp-v3-opt {
2581
+ color: #cbd5e1;
2582
+ }
2583
+
2584
+ .ds-theme-dark .ds-fp-v3-opt:hover {
2585
+ background: #1e293b;
2586
+ }
2587
+
2588
+ .ds-theme-dark .ds-fp-v3-opt-on {
2589
+ background: #1e293b;
2590
+ }
2591
+
2592
+ /* Custom checkbox */
2593
+ .ds-fp-v3-cb {
2594
+ width: 15px;
2595
+ height: 15px;
2596
+ border: 2px solid #d1d5db;
2597
+ border-radius: 3px;
2598
+ flex-shrink: 0;
2599
+ display: flex;
2600
+ align-items: center;
2601
+ justify-content: center;
2602
+ transition: border-color 0.1s, background 0.1s;
2603
+ }
2604
+
2605
+ .ds-fp-v3-cb-on {
2606
+ border-color: #6366f1;
2607
+ background: #6366f1;
2608
+ }
2609
+
2610
+ .ds-fp-v3-cb-on svg {
2611
+ stroke: #fff;
2612
+ }
2613
+
2614
+ /* Options empty/loading message */
2615
+ .ds-fp-v3-opts-msg {
2616
+ display: flex;
2617
+ align-items: center;
2618
+ justify-content: center;
2619
+ gap: 8px;
2620
+ padding: 12px;
2621
+ font-size: 12px;
2622
+ color: #9ca3af;
2623
+ }
2624
+
2625
+ /* ── Chips row (selected values) ────────────────────────────────────────────── */
2626
+ .ds-fp-v3-chips {
2627
+ display: flex;
2628
+ flex-wrap: wrap;
2629
+ gap: 4px;
2630
+ }
2631
+
2632
+ .ds-fp-v3-chip {
2633
+ display: inline-flex;
2634
+ align-items: center;
2635
+ gap: 4px;
2636
+ padding: 2px 8px;
2637
+ border-radius: 10px;
2638
+ background: #e0e7ff;
2639
+ color: #4338ca;
2640
+ font-size: 11px;
2641
+ font-weight: 600;
2642
+ white-space: nowrap;
2643
+ }
2644
+
2645
+ .ds-theme-dark .ds-fp-v3-chip {
2646
+ background: #312e81;
2647
+ color: #a5b4fc;
2648
+ }
2649
+
2650
+ .ds-fp-v3-chip-x {
2651
+ border: none;
2652
+ background: transparent;
2653
+ color: inherit;
2654
+ font-size: 10px;
2655
+ cursor: pointer;
2656
+ padding: 0;
2657
+ line-height: 1;
2658
+ opacity: 0.7;
2659
+ transition: opacity 0.1s;
2660
+ }
2661
+
2662
+ .ds-fp-v3-chip-x:hover {
2663
+ opacity: 1;
2664
+ }
2665
+
2666
+ /* ── Popover footer ─────────────────────────────────────────────────────────── */
2667
+ .ds-fp-v3-pop-footer {
2668
+ display: flex;
2669
+ align-items: center;
2670
+ justify-content: flex-end;
2671
+ gap: 8px;
2672
+ padding: 10px 14px;
2673
+ border-top: 1px solid #f3f4f6;
2674
+ background: #fafafa;
2675
+ }
2676
+
2677
+ .ds-theme-dark .ds-fp-v3-pop-footer {
2678
+ background: #0f172a;
2679
+ border-top-color: #334155;
2680
+ }
2681
+
2682
+ .ds-fp-v3-clear-btn {
2683
+ height: 30px;
2684
+ padding: 0 14px;
2685
+ border: 1px solid #d1d5db;
2686
+ border-radius: 7px;
2687
+ background: #ffffff;
2688
+ color: #374151;
2689
+ font-size: 12px;
2690
+ font-weight: 500;
2691
+ cursor: pointer;
2692
+ transition: border-color 0.15s, background 0.15s;
2693
+ }
2694
+
2695
+ .ds-fp-v3-clear-btn:hover {
2696
+ border-color: #9ca3af;
2697
+ background: #f3f4f6;
2698
+ }
2699
+
2700
+ .ds-theme-dark .ds-fp-v3-clear-btn {
2701
+ background: #1e293b;
2702
+ border-color: #334155;
2703
+ color: #e2e8f0;
2704
+ }
2705
+
2706
+ .ds-theme-dark .ds-fp-v3-clear-btn:hover {
2707
+ background: #0f172a;
2708
+ }
2709
+
2710
+ .ds-fp-v3-apply-btn {
2711
+ height: 30px;
2712
+ padding: 0 16px;
2713
+ border: none;
2714
+ border-radius: 7px;
2715
+ background: linear-gradient(135deg, #16a34a, #15803d);
2716
+ color: #ffffff;
2717
+ font-size: 12px;
2718
+ font-weight: 600;
2719
+ cursor: pointer;
2720
+ transition: opacity 0.15s, transform 0.1s;
2721
+ white-space: nowrap;
2722
+ }
2723
+
2724
+ .ds-fp-v3-apply-btn:hover {
2725
+ opacity: 0.9;
2726
+ }
2727
+
2728
+ .ds-fp-v3-apply-btn:active {
2729
+ transform: scale(0.97);
2730
+ }
2731
+
2732
+ /* ── Date range inputs ──────────────────────────────────────────────────────── */
2733
+ .ds-fp-v3-date-range {
2734
+ display: flex;
2735
+ align-items: center;
2736
+ gap: 6px;
2737
+ }
2738
+
2739
+ .ds-fp-v3-date {
2740
+ flex: 1;
2741
+ height: 32px;
2742
+ padding: 0 8px;
2743
+ border: 1px solid #d1d5db;
2744
+ border-radius: 7px;
2745
+ font-size: 12px;
2746
+ background: #ffffff;
2747
+ color: #374151;
2748
+ outline: none;
2749
+ transition: border-color 0.15s;
2750
+ }
2751
+
2752
+ .ds-fp-v3-date:focus {
2753
+ border-color: #6366f1;
2754
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
2755
+ }
2756
+
2757
+ .ds-theme-dark .ds-fp-v3-date {
2758
+ background: #0f172a;
2759
+ border-color: #334155;
2760
+ color: #e2e8f0;
2761
+ }
2762
+
2763
+ .ds-fp-v3-date-sep {
2764
+ color: #9ca3af;
2765
+ font-size: 12px;
2766
+ flex-shrink: 0;
2767
+ }
2768
+
2769
+ /* ── Text / number input ────────────────────────────────────────────────────── */
2770
+ .ds-fp-v3-text-input {
2771
+ width: 100%;
2772
+ height: 32px;
2773
+ padding: 0 10px;
2774
+ border: 1px solid #d1d5db;
2775
+ border-radius: 7px;
2776
+ font-size: 12px;
2777
+ background: #ffffff;
2778
+ color: #374151;
2779
+ outline: none;
2780
+ transition: border-color 0.15s;
2781
+ }
2782
+
2783
+ .ds-fp-v3-text-input:focus {
2784
+ border-color: #6366f1;
2785
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
2786
+ }
2787
+
2788
+ .ds-theme-dark .ds-fp-v3-text-input {
2789
+ background: #0f172a;
2790
+ border-color: #334155;
2791
+ color: #e2e8f0;
2792
+ }
2793
+ `,e=document.createElement("style");e.id="deepspot-sdk-styles",e.textContent=P,document.head.appendChild(e)}catch(P){}}}function te(P){if(typeof P=="string"){const e=document.querySelector(P);if(!e)throw new Error(`Deepspot SDK: container "${P}" not found in DOM`);return e}return P}class fe{constructor(e){if(!e.apiKey)throw new Error("Deepspot SDK: apiKey is required");if(!e.baseUrl)throw new Error("Deepspot SDK: baseUrl is required");this.apiClient=new ie(e.baseUrl,e.apiKey),pe()}async embedDashboard(e){var i,a,f,h,v,m,p,n,g,u;const t=te(e.container),r=(i=e.embedLevel)!=null?i:"dashboard",s=(a=e.theme)!=null?a:"light";t.style.height=e.height||"600px",t.style.display="block";const o=this.createRoot(t,s);this.showLoading(o);try{const b=await this.apiClient.getEmbedToken({dashboardId:e.dashboardId,embedType:"dashboard",embedLevel:r,userId:e.userId,tenantId:e.tenantId}),l=await this.apiClient.getDashboardRender(e.dashboardId,b,{embedLevel:r,pageId:e.pageId,tabId:e.tabId,filters:e.filters||{}});let d;const c=new D(o,{embedLevel:r,theme:s,hideFilters:(f=e.hideGlobalFilters)!=null?f:!1,hideExport:(h=e.hideExport)!=null?h:!1,hideGlobalFilters:(v=e.hideGlobalFilters)!=null?v:!1,hideInlineFilters:(m=e.hideInlineFilters)!=null?m:!1,hideText:(p=e.hideText)!=null?p:!1,hideHeader:(n=e.hideHeader)!=null?n:!1,hideBackground:(g=e.hideBackground)!=null?g:!1,initialFilters:e.filters||{},onFilterChange:e.onFilterChange,onReady:e.onReady,onFetchFilterOptions:$=>this.apiClient.getFilterOptions(e.dashboardId,$,b),onFetchTablePage:($,w,k)=>this.apiClient.getTablePage(e.dashboardId,$,w,k,b),onTabSwitch:async($,w)=>{var k;(k=e.onTabSwitch)==null||k.call(e,$,w);try{const x=await this.apiClient.getDashboardRender(e.dashboardId,b,{embedLevel:r,pageId:$,tabId:w,filters:c.getActiveFilters(),filterOperators:c.getActiveFilterOperators(),localFilters:c.getActiveLocalFilters()});c.update(x)}catch(x){console.error("Deepspot SDK: tab fetch failed",x)}}});return c.render(l),d=new Z({dashboardId:e.dashboardId,token:b,embedType:"dashboard",embedLevel:r,activePageId:l.activePage,activeTabId:l.activeTab,activeFilters:e.filters||{},apiClient:this.apiClient,renderer:c,onFilterChange:e.onFilterChange}),d}catch(b){throw this.showError(o,(b==null?void 0:b.message)||"Failed to load dashboard"),(u=e.onError)==null||u.call(e,(b==null?void 0:b.message)||"Failed to load dashboard"),b}}async embedReport(e){var s;const t=te(e.container);t.style.height=e.height||"400px",t.style.display="block";const r=this.createRoot(t,e.theme||"light");this.showLoading(r);try{const o=await this.apiClient.getEmbedToken({dashboardId:e.dashboardId,embedType:"report",componentId:e.componentId,userId:e.userId,tenantId:e.tenantId}),i=await this.apiClient.getReportRender(e.dashboardId,e.componentId,o,{filters:e.filters||{}}),a=new ce(r,e.theme||"light");return a.render(i,e.onReady),new Z({dashboardId:e.dashboardId,componentId:e.componentId,token:o,embedType:"report",activeFilters:e.filters||{},apiClient:this.apiClient,renderer:a})}catch(o){throw this.showError(r,(o==null?void 0:o.message)||"Failed to load report"),(s=e.onError)==null||s.call(e,(o==null?void 0:o.message)||"Failed to load report"),o}}createRoot(e,t){e.innerHTML="";const r=document.createElement("div");return r.className=`ds-embed-root ds-theme-${t}`,r.style.width="100%",r.style.height="100%",e.appendChild(r),r}showLoading(e){e.innerHTML=`
2794
+ <div class="ds-embed-loading">
2795
+ <div class="ds-embed-spinner"></div>
2796
+ <div class="ds-embed-loading-text">Loading…</div>
2797
+ </div>
2798
+ `}showError(e,t){e.innerHTML=`
2799
+ <div class="ds-embed-error">
2800
+ <div class="ds-embed-error-icon">⚠</div>
2801
+ <div>${t}</div>
2802
+ <div class="ds-embed-error-message">Check your SDK configuration.</div>
2803
+ </div>
2804
+ `}}exports.DeepspotSDK=fe;