@xpell/xdashboard 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -0
  3. package/dist/index.cjs +1 -0
  4. package/dist/index.js +2844 -0
  5. package/dist/types/index.d.ts +3 -0
  6. package/dist/types/index.d.ts.map +1 -0
  7. package/dist/types/xbadge.d.ts +53 -0
  8. package/dist/types/xbadge.d.ts.map +1 -0
  9. package/dist/types/xcard.d.ts +72 -0
  10. package/dist/types/xcard.d.ts.map +1 -0
  11. package/dist/types/xcomp.d.ts +48 -0
  12. package/dist/types/xcomp.d.ts.map +1 -0
  13. package/dist/types/xdivider.d.ts +40 -0
  14. package/dist/types/xdivider.d.ts.map +1 -0
  15. package/dist/types/xdrawer.d.ts +69 -0
  16. package/dist/types/xdrawer.d.ts.map +1 -0
  17. package/dist/types/xempty.d.ts +51 -0
  18. package/dist/types/xempty.d.ts.map +1 -0
  19. package/dist/types/xfield.d.ts +68 -0
  20. package/dist/types/xfield.d.ts.map +1 -0
  21. package/dist/types/xgrid.d.ts +65 -0
  22. package/dist/types/xgrid.d.ts.map +1 -0
  23. package/dist/types/xigroup.d.ts +40 -0
  24. package/dist/types/xigroup.d.ts.map +1 -0
  25. package/dist/types/xkpicard.d.ts +52 -0
  26. package/dist/types/xkpicard.d.ts.map +1 -0
  27. package/dist/types/xmodal.d.ts +55 -0
  28. package/dist/types/xmodal.d.ts.map +1 -0
  29. package/dist/types/xnavlist.d.ts +52 -0
  30. package/dist/types/xnavlist.d.ts.map +1 -0
  31. package/dist/types/xscroll.d.ts +39 -0
  32. package/dist/types/xscroll.d.ts.map +1 -0
  33. package/dist/types/xsearch.d.ts +47 -0
  34. package/dist/types/xsearch.d.ts.map +1 -0
  35. package/dist/types/xsection.d.ts +40 -0
  36. package/dist/types/xsection.d.ts.map +1 -0
  37. package/dist/types/xselect.d.ts +44 -0
  38. package/dist/types/xselect.d.ts.map +1 -0
  39. package/dist/types/xsidebar.d.ts +81 -0
  40. package/dist/types/xsidebar.d.ts.map +1 -0
  41. package/dist/types/xsimp.d.ts +11 -0
  42. package/dist/types/xsimp.d.ts.map +1 -0
  43. package/dist/types/xspacer.d.ts +25 -0
  44. package/dist/types/xspacer.d.ts.map +1 -0
  45. package/dist/types/xstack.d.ts +51 -0
  46. package/dist/types/xstack.d.ts.map +1 -0
  47. package/dist/types/xtable.d.ts +75 -0
  48. package/dist/types/xtable.d.ts.map +1 -0
  49. package/dist/types/xtest.d.ts +16 -0
  50. package/dist/types/xtest.d.ts.map +1 -0
  51. package/dist/types/xtoast.d.ts +66 -0
  52. package/dist/types/xtoast.d.ts.map +1 -0
  53. package/dist/types/xtoolbar.d.ts +52 -0
  54. package/dist/types/xtoolbar.d.ts.map +1 -0
  55. package/dist/xdashboard.css +1 -0
  56. package/dist/xlogo.png +0 -0
  57. package/package.json +45 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xpell.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # @xpell/xdashboard
2
+
3
+ ![npm](https://img.shields.io/npm/v/@xpell/xdashboard)
4
+ ![downloads](https://img.shields.io/npm/dm/@xpell/xdashboard)
5
+ ![license](https://img.shields.io/npm/l/@xpell/xdashboard)
6
+ ![types](https://img.shields.io/badge/TypeScript-Types-blue)
7
+ ![xpell](https://img.shields.io/badge/Xpell-2%20Alpha-6f42c1)
8
+
9
+ **XDashboard** is an official **dashboard UI component pack** for **Xpell 2 Alpha**, built on top of `@xpell/ui`.
10
+
11
+ It provides dashboard-oriented components and layout primitives for:
12
+
13
+ - Admin panels & internal tools
14
+ - Monitoring & observability UIs
15
+ - Analytics dashboards
16
+ - Builder interfaces (e.g. VIBE)
17
+
18
+ > Xpell is a runtime interpreter for dynamic systems.
19
+ > `@xpell/xdashboard` is a structured UI object pack that composes dashboards using JSON.
20
+
21
+ ---
22
+
23
+ ## ✨ Highlights
24
+
25
+ - **Built for Xpell 2**: works with Nano-Commands + JSON-driven views
26
+ - **UI-only pack**: ships components, not runtime logic
27
+ - **Single CSS output**: predictable bundling (`xdashboard.css`)
28
+ - **ESM + CJS**: modern + compatible builds
29
+ - **Types included**: `.d.ts` declarations in `dist/types`
30
+
31
+ ---
32
+
33
+ ## 📦 Install
34
+
35
+ ```bash
36
+ pnpm add @xpell/xdashboard
37
+ ```
38
+
39
+ Peer dependencies (required by the consumer app):
40
+
41
+ ```bash
42
+ pnpm add @xpell/ui @xpell/core
43
+ ```
44
+
45
+ ---
46
+
47
+ ## 🚀 Quick Start
48
+
49
+ ```ts
50
+ import { _x } from "@xpell/core";
51
+ import { XUI } from "@xpell/ui";
52
+ import { XDashboardPack } from "@xpell/xdashboard";
53
+
54
+ // Optional (recommended): include dashboard styles once
55
+ import "@xpell/xdashboard/xdashboard.css";
56
+
57
+ async function main() {
58
+ _x.verbose = true;
59
+ await _x.start();
60
+
61
+ await _x.loadModule(XUI);
62
+ await _x.loadObjectPack(XDashboardPack);
63
+
64
+ XUI.createPlayer("xplayer");
65
+
66
+ XUI.add({
67
+ _type: "view",
68
+ _id: "dashboard-home",
69
+ _children: [
70
+ {
71
+ _type: "xd-card",
72
+ _title: "Welcome to Xpell 2",
73
+ _content: "Your dashboard is running."
74
+ }
75
+ ]
76
+ });
77
+ }
78
+
79
+ main();
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 🎨 Styles
85
+
86
+ This package outputs a **single CSS file**:
87
+
88
+ ```ts
89
+ import "@xpell/xdashboard/xdashboard.css";
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 🧱 What’s inside?
95
+
96
+ `@xpell/xdashboard` is designed as a **pure UI object pack**:
97
+
98
+ - Extends `@xpell/ui` primitives
99
+ - Adds dashboard-specific components (cards, layouts, widgets, etc.)
100
+ - Follows Nano-Commands v2 contract
101
+ - Contains **no runtime logic** (behavior lives in Xpell runtime/modules)
102
+
103
+ ---
104
+
105
+ ## 🔁 Versioning & Stability
106
+
107
+ Current version: `0.1.0-alpha.1`
108
+
109
+ This package is part of the **Xpell 2 Alpha** release cycle.
110
+
111
+ - Breaking changes may occur while APIs stabilize
112
+ - Once stable, we’ll move toward `beta` and `1.0`
113
+
114
+ ---
115
+
116
+ ## 🧩 Xpell 2 Ecosystem
117
+
118
+ Core packages:
119
+
120
+ - `@xpell/core`
121
+ - `@xpell/ui`
122
+ - `@xpell/node`
123
+ - `@xpell/3d`
124
+ - `@xpell/xdashboard`
125
+
126
+ ---
127
+
128
+ ## 🔗 Links
129
+
130
+ - **Website:** https://xpell.ai
131
+ - **Docs:** (coming soon)
132
+ - **Issues:** (link your GitHub issues page here)
133
+ - **Discussions:** (optional)
134
+
135
+ > Tip: once the repo URL is final, add it to `package.json` (`repository`, `bugs`, `homepage`) for the best npm page.
136
+
137
+ ---
138
+
139
+ ## 🛡️ License
140
+
141
+ MIT
142
+
143
+ ---
144
+
145
+ ## 👤 Author
146
+
147
+ Tamir Fridman
148
+ Xpell 2 Alpha — 2026
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@xpell/ui");class h extends n.XUIObject{static _xtype="stack";__direction="vertical";__gap;__align="stretch";__justify="start";__wrap=!1;__grow=!1;static managedStyles=new Set(["--xstack-gap","align-items","justify-content","flex-wrap","flex"]);constructor(t){const i={_type:h._xtype,class:"xstack",_html_tag:"div"};super(t,i,!0),this.parse(t),this.applyLayout()}normalizeDirection(t){return t==="horizontal"?"horizontal":"vertical"}normalizeAlign(t){return t==="start"||t==="center"||t==="end"||t==="stretch"?t:"stretch"}normalizeJustify(t){return t==="start"||t==="center"||t==="end"||t==="space-between"||t==="space-around"||t==="space-evenly"?t:"start"}normalizeGap(t){if(typeof t=="number"&&Number.isFinite(t))return t}normalizeBoolean(t){return t===!0||t==="true"}mapAlign(t){return t==="start"?"flex-start":t==="end"?"flex-end":t==="center"?"center":"stretch"}mapJustify(t){return t==="start"?"flex-start":t==="end"?"flex-end":t==="center"?"center":t}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||h.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}buildClassName(t){const i=String(this.class||""),e=String(this._class||""),s=this.splitClasses(i).filter(r=>r!=="xstack"&&r!=="xstack--v"&&r!=="xstack--h"),_=["xstack",t==="horizontal"?"xstack--h":"xstack--v",...s,...this.splitClasses(e)];return Array.from(new Set(_.filter(Boolean))).join(" ")}applyLayout(){const t=this.__direction||"vertical",i=this.__align||"stretch",e=this.__justify||"start",s=this.buildClassName(t);this.class=s;const _=this.stripManagedStyles(String(this.style||"")),r=[];_&&r.push(_),typeof this.__gap=="number"&&r.push(`--xstack-gap:${this.__gap}px`),r.push(`align-items:${this.mapAlign(i)}`),r.push(`justify-content:${this.mapJustify(e)}`),this.__wrap&&r.push("flex-wrap:wrap"),this.__grow&&r.push("flex:1 1 auto");const l=r.join("; ");this.style=l}set _direction(t){this.__direction=this.normalizeDirection(t),this.applyLayout()}get _direction(){return this.__direction}set _gap(t){this.__gap=this.normalizeGap(t),this.applyLayout()}get _gap(){return this.__gap}set _align(t){this.__align=this.normalizeAlign(t),this.applyLayout()}get _align(){return this.__align}set _justify(t){this.__justify=this.normalizeJustify(t),this.applyLayout()}get _justify(){return this.__justify}set _wrap(t){this.__wrap=this.normalizeBoolean(t),this.applyLayout()}get _wrap(){return this.__wrap}set _grow(t){this.__grow=this.normalizeBoolean(t),this.applyLayout()}get _grow(){return this.__grow}}class o extends n.XUIObject{static _xtype="scroll";__direction="vertical";__grow=!1;__hide_scrollbar=!1;__max_height;__max_width;static managedStyles=new Set(["overflow","overflow-x","overflow-y","min-height","min-width","flex","max-height","max-width"]);constructor(t){const i={_type:o._xtype,class:"xscroll",_html_tag:"div"};super(t,i,!0),this.parse(t),this.applyLayout()}normalizeDirection(t){return t==="horizontal"||t==="both"?t:"vertical"}normalizeBoolean(t){return t===!0||t==="true"}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||o.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}buildClassName(t,i){const e=String(this.class||""),_=["xscroll",...this.splitClasses(e).filter(r=>r!=="xscroll"&&r!=="xscroll--hide"&&r!=="xscroll--v"&&r!=="xscroll--h"&&r!=="xscroll--both")];return t==="horizontal"?_.push("xscroll--h"):t==="both"?_.push("xscroll--both"):_.push("xscroll--v"),i&&_.push("xscroll--hide"),Array.from(new Set(_.filter(Boolean))).join(" ")}applyLayout(){const t=this.__direction||"vertical",i=this.buildClassName(t,this.__hide_scrollbar);this.class=i;const e=this.stripManagedStyles(String(this.style||"")),s=[];e&&s.push(e),s.push("min-height:0"),s.push("min-width:0"),t==="horizontal"?(s.push("overflow-x:auto"),s.push("overflow-y:hidden")):t==="both"?s.push("overflow:auto"):(s.push("overflow-y:auto"),s.push("overflow-x:hidden")),this.__grow&&s.push("flex:1 1 auto"),this.__max_height&&s.push(`max-height:${this.__max_height}`),this.__max_width&&s.push(`max-width:${this.__max_width}`);const _=s.join("; ");this.style=_}set _direction(t){this.__direction=this.normalizeDirection(t),this.applyLayout()}get _direction(){return this.__direction}set _grow(t){this.__grow=this.normalizeBoolean(t),this.applyLayout()}get _grow(){return this.__grow}set _hide_scrollbar(t){this.__hide_scrollbar=this.normalizeBoolean(t),this.applyLayout()}get _hide_scrollbar(){return this.__hide_scrollbar}set _max_height(t){this.__max_height=t,this.applyLayout()}get _max_height(){return this.__max_height}set _max_width(t){this.__max_width=t,this.applyLayout()}get _max_width(){return this.__max_width}}class d extends n.XUIObject{static _xtype="spacer";__size=16;__direction="vertical";static managedStyles=new Set(["width","height","min-width","min-height"]);constructor(t){const i={_type:d._xtype,class:"xspacer",_html_tag:"div"};super(t,i,!0),this.parse(t),this.applyLayout()}normalizeDirection(t){return t==="horizontal"?"horizontal":"vertical"}normalizeSize(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:16}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||d.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}applyLayout(){const t=this.__size,i=this.__direction,e=this.stripManagedStyles(String(this.style||"")),s=[];e&&s.push(e),i==="horizontal"?(s.push(`width:${t}px`),s.push(`min-width:${t}px`)):(s.push(`height:${t}px`),s.push(`min-height:${t}px`));const _=s.join("; ");this.style=_,this._dom_object&&this._dom_object.setAttribute("style",_)}set _size(t){this.__size=this.normalizeSize(t),this.applyLayout()}get _size(){return this.__size}set _direction(t){this.__direction=this.normalizeDirection(t),this.applyLayout()}get _direction(){return this.__direction}}class c extends n.XUIObject{static _xtype="divider";__orientation="horizontal";__thickness=1;__length;__inset;__muted=!1;static managedStyles=new Set(["--xdivider-thickness","--xdivider-length","--xdivider-inset"]);constructor(t){const i={_type:c._xtype,class:"xdivider",_html_tag:"div"};super(t,i,!0),this.parse(t),this.applyLayout()}normalizeOrientation(t){return t==="vertical"?"vertical":"horizontal"}normalizeThickness(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}normalizeBoolean(t){return t===!0||t==="true"}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||c.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}buildClassName(t,i){const e=String(this.class||""),s=this.splitClasses(e).filter(r=>r!=="xdivider"&&r!=="xdivider--h"&&r!=="xdivider--v"&&r!=="xdivider--muted"),_=["xdivider",t==="vertical"?"xdivider--v":"xdivider--h",...s];return i&&_.push("xdivider--muted"),Array.from(new Set(_.filter(Boolean))).join(" ")}applyLayout(){const t=this.__orientation,i=this.buildClassName(t,this.__muted);this.class=i;const e=this.stripManagedStyles(String(this.style||"")),s=[];e&&s.push(e),s.push(`--xdivider-thickness:${this.__thickness}px`),this.__length&&s.push(`--xdivider-length:${this.__length}`),typeof this.__inset=="number"&&s.push(`--xdivider-inset:${this.__inset}px`);const _=s.join("; ");this.style=_}set _orientation(t){this.__orientation=this.normalizeOrientation(t),this.applyLayout()}get _orientation(){return this.__orientation}set _thickness(t){this.__thickness=this.normalizeThickness(t),this.applyLayout()}get _thickness(){return this.__thickness}set _length(t){this.__length=t,this.applyLayout()}get _length(){return this.__length}set _inset(t){this.__inset=t,this.applyLayout()}get _inset(){return this.__inset}set _muted(t){this.__muted=this.normalizeBoolean(t),this.applyLayout()}get _muted(){return this.__muted}}class p extends n.XUIObject{static _xtype="toolbar";__gap=8;__align="center";__justify="start";__wrap=!1;__sticky=!1;__top=0;__elevated=!1;static managedStyles=new Set(["--xtoolbar-gap","align-items","justify-content","flex-wrap","position","top","z-index"]);constructor(t){const i={_type:p._xtype,class:"xtoolbar",_html_tag:"div"};super(t,i,!0),this.parse(t),this.applyLayout()}normalizeAlign(t){return t==="start"||t==="center"||t==="end"||t==="stretch"?t:"center"}normalizeJustify(t){return t==="start"||t==="center"||t==="end"||t==="space-between"?t:"start"}normalizeGap(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:8}normalizeBoolean(t){return t===!0||t==="true"}mapAlign(t){return t==="start"?"flex-start":t==="end"?"flex-end":t==="center"?"center":"stretch"}mapJustify(t){return t==="start"?"flex-start":t==="end"?"flex-end":t==="center"?"center":t}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||p.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}buildClassName(t){const i=String(this.class||""),s=["xtoolbar",...this.splitClasses(i).filter(_=>_!=="xtoolbar"&&_!=="xtoolbar--elevated")];return t&&s.push("xtoolbar--elevated"),Array.from(new Set(s.filter(Boolean))).join(" ")}applyLayout(){const t=this.buildClassName(this.__elevated);this.class=t;const i=this.stripManagedStyles(String(this.style||"")),e=[];i&&e.push(i),e.push(`--xtoolbar-gap:${this.__gap}px`),e.push(`align-items:${this.mapAlign(this.__align)}`),e.push(`justify-content:${this.mapJustify(this.__justify)}`),this.__wrap&&e.push("flex-wrap:wrap"),this.__sticky&&(e.push("position:sticky"),e.push(`top:${this.__top}px`),e.push("z-index:10"));const s=e.join("; ");this.style=s}set _gap(t){this.__gap=this.normalizeGap(t),this.applyLayout()}get _gap(){return this.__gap}set _align(t){this.__align=this.normalizeAlign(t),this.applyLayout()}get _align(){return this.__align}set _justify(t){this.__justify=this.normalizeJustify(t),this.applyLayout()}get _justify(){return this.__justify}set _wrap(t){this.__wrap=this.normalizeBoolean(t),this.applyLayout()}get _wrap(){return this.__wrap}set _sticky(t){this.__sticky=this.normalizeBoolean(t),this.applyLayout()}get _sticky(){return this.__sticky}set _top(t){this.__top=typeof t=="number"&&Number.isFinite(t)?t:0,this.applyLayout()}get _top(){return this.__top}set _elevated(t){this.__elevated=this.normalizeBoolean(t),this.applyLayout()}get _elevated(){return this.__elevated}}class m extends n.XUIObject{static _xtype="table";__columns=[];__rows;__row_key;__dense=!1;__striped=!1;__hover=!0;__bordered=!0;__empty_text="No data";__ready=!1;__data_inflight=!1;constructor(t){const i={_type:m._xtype,class:"xtable",_html_tag:"div"};super(t,i,!0),this.parse(t),this.applyPropsFromData(),this.applyLayout(),this.buildSkeleton(),this.__ready=!0,this.renderBody()}get tableId(){return this._id+"_table"}get theadId(){return this._id+"_thead"}get tbodyId(){return this._id+"_tbody"}normalizeAlign(t){if(t==="start"||t==="center"||t==="end")return t}normalizeBoolean(t){return t===!0||t==="true"}applyPropsFromData(){const t=this._columns;this.__columns=Array.isArray(t)?t:[],this.__rows=this._rows,this.__row_key=this._row_key!=null?String(this._row_key):void 0,this.__dense=this.normalizeBoolean(this._dense),this.__striped=this.normalizeBoolean(this._striped);const i=this._hover;i===!1||i==="false"?this.__hover=!1:(i===!0||i==="true")&&(this.__hover=!0);const e=this._bordered;e===!1||e==="false"?this.__bordered=!1:(e===!0||e==="true")&&(this.__bordered=!0),this.__empty_text=this._empty_text?String(this._empty_text):"No data"}mapAlign(t){if(t)return t==="start"?"left":t==="end"?"right":"center"}applyLayout(){this.addClass("xtable");const t=["xtable--dense","xtable--striped","xtable--hover","xtable--bordered"],i=[];this.__dense&&i.push("xtable--dense"),this.__striped&&i.push("xtable--striped"),this.__hover&&i.push("xtable--hover"),this.__bordered&&i.push("xtable--bordered"),this.replaceClass(t.join(" "),i.join(" "))}buildSkeleton(){const t={_type:"xhtml",_id:this.tableId,class:"xtable__table",_html_tag:"table",_children:[{_type:"xhtml",_id:this.theadId,class:"xtable__head",_html_tag:"thead"},{_type:"xhtml",_id:this.tbodyId,class:"xtable__body",_html_tag:"tbody"}]};this.append(t),this.buildHeader()}clearChildren(t){if(!t)return;(Array.isArray(t._children)?[...t._children]:[]).forEach(e=>{e&&t.removeChild(e,!0)}),t.dom instanceof HTMLElement&&t.dom.replaceChildren()}getHead(){return n.XUI.getObject(this.theadId)}getBody(){return n.XUI.getObject(this.tbodyId)}buildHeader(){const t=this.getHead();if(!t)return;this.clearChildren(t);const i=n.XUI.create({_type:"xhtml",class:"xtable__row",_html_tag:"tr"});this.__columns.forEach(e=>{const s=this.mapAlign(this.normalizeAlign(e.align)),_=[];e.width&&_.push(`width:${e.width}`),s&&_.push(`text-align:${s}`);const r=_.join("; "),l=n.XUI.create({_type:"xhtml",_html_tag:"th",class:`xtable__th${e.class?" "+e.class:""}`,_text:e.label||e.key,...r?{style:r}:{}});i.append(l)}),t.append(i)}resolveRows(){if(Array.isArray(this.__rows))return this.__rows;if(typeof this.__rows=="string"&&n._xd&&n._xd._o){const t=n._xd._o[this.__rows];return Array.isArray(t)?t:t&&Array.isArray(t.rows)?t.rows:[]}return[]}isXObjectData(t){return t&&typeof t=="object"&&typeof t._type=="string"}setCellText(t,i){if(typeof t.setText=="function"){t.setText(i);return}t._text=i,t.dom instanceof HTMLElement&&(t.dom.textContent=i)}appendCellContent(t,i){if(i instanceof n.XUIObject){t.append(i);return}if(this.isXObjectData(i)){const e=n.XUI.create(i);t.append(e);return}this.setCellText(t,String(i??""))}renderBody(){const t=this.getBody();if(!t)return;this.clearChildren(t);const i=this.resolveRows(),e=this.__columns||[],s=Math.max(1,e.length);if(!i.length){const _=n.XUI.create({_type:"xhtml",_html_tag:"tr",class:"xtable__row xtable__row--empty"}),r=n.XUI.create({_type:"xhtml",_html_tag:"td",class:"xtable__td xtable__empty",colspan:String(s)});this.setCellText(r,this.__empty_text),_.append(r),t.append(_);return}i.forEach((_,r)=>{const l=n.XUI.create({_type:"xhtml",_html_tag:"tr",class:"xtable__row"});this.__row_key&&_&&_[this.__row_key]!=null&&(l["data-key"]=String(_[this.__row_key])),e.forEach(a=>{const O=this.mapAlign(this.normalizeAlign(a.align)),I=[];a.width&&I.push(`width:${a.width}`),O&&I.push(`text-align:${O}`);const U=I.join("; "),B=n.XUI.create({_type:"xhtml",_html_tag:"td",class:`xtable__td${a.class?" "+a.class:""}`,...U?{style:U}:{}}),T=_?_[a.key]:void 0;if(a.render){const $=a.render(T,_,r);this.appendCellContent(B,$)}else this.setCellText(B,String(T??""));l.append(B)}),t.append(l)})}refresh(){this.renderBody()}rebuildHeaderAndBody(){this.__ready&&(this.buildHeader(),this.renderBody())}set _columns(t){this.__columns=Array.isArray(t)?t:[],this.rebuildHeaderAndBody()}get _columns(){return this.__columns}set _rows(t){this.__rows=t,this.__ready&&this.renderBody()}get _rows(){return this.__rows}set _row_key(t){this.__row_key=t}get _row_key(){return this.__row_key}set _dense(t){this.__dense=this.normalizeBoolean(t),this.applyLayout()}get _dense(){return this.__dense}set _striped(t){this.__striped=this.normalizeBoolean(t),this.applyLayout()}get _striped(){return this.__striped}set _hover(t){this.__hover=t===!1?!1:this.normalizeBoolean(t),this.applyLayout()}get _hover(){return this.__hover}set _bordered(t){this.__bordered=t===!1?!1:this.normalizeBoolean(t),this.applyLayout()}get _bordered(){return this.__bordered}set _empty_text(t){this.__empty_text=t||"No data",this.__ready&&this.renderBody()}get _empty_text(){return this.__empty_text}async onData(t){if(this.__data_inflight)return;this.__data_inflight=!0;const i=this.emptyDataSource||this.emptyDataSorce;typeof i=="function"&&i.call(this);const e=this.__rows;if(await super.onData(t),this._on_data!=null)this.__rows!==e&&this.refresh();else{let _=[];Array.isArray(t)?_=t:t&&Array.isArray(t.rows)&&(_=t.rows);const r=this.__rows!==_;this.__rows=_,r&&this.refresh()}this.__data_inflight=!1}}class x extends n.XUIObject{static _xtype="badge";__text="";__variant="default";__size="md";__pill=!0;__dot=!1;__title;__dot_id;__text_id;constructor(t){const i={_type:x._xtype,class:"xbadge",_html_tag:"span"};super(t,i,!0),this.__dot_id=this._id+"_dot",this.__text_id=this._id+"_text",this.parse(t),this.applyProps(),this.buildSkeleton(),this.applyLayout(),this.applyText()}normalizeVariant(t){return t==="success"||t==="warn"||t==="error"||t==="info"?t:"default"}normalizeSize(t){return t==="sm"?"sm":"md"}normalizeBoolean(t){return t===!0||t==="true"}applyProps(){this.__text=this._text?String(this._text):"",this.__variant=this.normalizeVariant(this._variant),this.__size=this.normalizeSize(this._size),this._pill===void 0?this.__pill=!0:this.__pill=this.normalizeBoolean(this._pill),this.__dot=this.normalizeBoolean(this._dot),this.__title=this._title?String(this._title):void 0}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}buildClassName(){const t=String(this.class||""),i=new Set(["xbadge","xbadge--default","xbadge--success","xbadge--warn","xbadge--error","xbadge--info","xbadge--sm","xbadge--md","xbadge--pill","xbadge--dot"]),e=this.splitClasses(t).filter(_=>!i.has(_)),s=["xbadge",`xbadge--${this.__variant}`,`xbadge--${this.__size}`,...e];return this.__pill&&s.push("xbadge--pill"),this.__dot&&s.push("xbadge--dot"),Array.from(new Set(s.filter(Boolean))).join(" ")}buildSkeleton(){const t={_type:"label",_id:this.__dot_id,class:"xbadge__dot"},i={_type:"label",_id:this.__text_id,class:"xbadge__text"};this.append(t),this.append(i)}applyText(){const t=n.XUI.getObject(this.__text_id);t&&(t._text=this.__text)}applyLayout(){const t=this.buildClassName();this.class=t,this._dom_object&&(this._dom_object.className=t),this.__title?this._dom_object&&this._dom_object.setAttribute("title",this.__title):this._dom_object&&this._dom_object.removeAttribute("title")}set _text(t){this.setText(String(t??""))}get _text(){return this.__text}setText(t){this.__text=t,this.applyText()}setVariant(t){this.__variant=this.normalizeVariant(t),this.applyLayout()}setDot(t){this.__dot=this.normalizeBoolean(t),this.applyLayout()}setPill(t){this.__pill=this.normalizeBoolean(t),this.applyLayout()}set _variant(t){this.__variant=this.normalizeVariant(t),this.applyLayout()}get _variant(){return this.__variant}set _size(t){this.__size=this.normalizeSize(t),this.applyLayout()}get _size(){return this.__size}set _pill(t){this.__pill=this.normalizeBoolean(t),this.applyLayout()}get _pill(){return this.__pill}set _dot(t){this.__dot=this.normalizeBoolean(t),this.applyLayout()}get _dot(){return this.__dot}set _title(t){this.__title=t,this.applyLayout()}get _title(){return this.__title}}class b extends n.XUIObject{static _xtype="empty";__size="md";__align="center";__title="";__description="";__icon;__action;__stack_id;__title_id;__desc_id;constructor(t){const i={_type:b._xtype,class:"xempty",_html_tag:"div"};super(t,i,!0),this.__stack_id=this._id+"_stack",this.__title_id=this._id+"_title",this.__desc_id=this._id+"_desc",this.parse(t),this.applyProps(),this.buildSkeleton(),this.applyLayout()}normalizeSize(t){return t==="sm"||t==="lg"?t:"md"}normalizeAlign(t){return t==="start"?"start":"center"}applyProps(){this.__size=this.normalizeSize(this._size),this.__align=this.normalizeAlign(this._align),this.__title=this._title?String(this._title):"",this.__description=this._description?String(this._description):"",this.__icon=this._icon,this.__action=this._action}hasTitle(){return this.__title.trim().length>0}hasDescription(){return this.__description.trim().length>0}buildSkeleton(){const t=[];this.__icon&&t.push(this.__icon),this.hasTitle()&&t.push({_type:"label",_id:this.__title_id,class:"xempty__title",_text:this.__title.trim()}),this.hasDescription()&&t.push({_type:"label",_id:this.__desc_id,class:"xempty__desc",_text:this.__description.trim()}),this.__action&&t.push(this.__action),this.append({_type:"stack",_id:this.__stack_id,class:"xempty__stack",_direction:"vertical",_children:t})}rebuild(){const t=n.XUI.getObject(this.__stack_id);t&&typeof this.removeChild=="function"&&this.removeChild(t,!0),this.buildSkeleton(),this.applyLayout()}updateTitle(){const t=n.XUI.getObject(this.__title_id);this.hasTitle()?t?t._text=this.__title.trim():this.rebuild():t&&this.rebuild()}updateDescription(){const t=n.XUI.getObject(this.__desc_id);this.hasDescription()?t?t._text=this.__description.trim():this.rebuild():t&&this.rebuild()}applyLayout(){this.addClass("xempty");const t=["xempty--sm","xempty--md","xempty--lg","xempty--start","xempty--center"],i=[];i.push(`xempty--${this.__size}`),i.push(`xempty--${this.__align}`),this.replaceClass(t.join(" "),i.join(" "))}set _title(t){this.__title=t?String(t):"",this.updateTitle()}get _title(){return this.__title}set _description(t){this.__description=t?String(t):"",this.updateDescription()}get _description(){return this.__description}set _size(t){this.__size=this.normalizeSize(t),this.applyLayout()}get _size(){return this.__size}set _align(t){this.__align=this.normalizeAlign(t),this.applyLayout()}get _align(){return this.__align}set _icon(t){this.__icon=t,this.rebuild()}get _icon(){return this.__icon}set _action(t){this.__action=t,this.rebuild()}get _action(){return this.__action}}class v extends n.XUIObject{static _xtype="search";__value="";__placeholder="Search...";__size="md";__disabled=!1;__clearable=!0;__icon=!0;__autofocus=!1;__input_id;__icon_id;__input_id_internal;__clear_id;constructor(t){const i={_type:v._xtype,class:"xsearch",_html_tag:"div"};super(t,i,!0),this.__icon_id=this._id+"_icon",this.__input_id_internal=this._id+"_input",this.__clear_id=this._id+"_clear",this.parse(t),this.buildSkeleton(),this.applyProps()}normalizeSize(t){return t==="sm"?"sm":"md"}normalizeBoolean(t,i=!1){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:i}getIcon(){return n.XUI.getObject(this.__icon_id)}getInput(){return n.XUI.getObject(this.__input_id_internal)}getClear(){return n.XUI.getObject(this.__clear_id)}buildSkeleton(){[{_type:"label",_id:this.__icon_id,class:"xsearch__icon",_text:"🔍"},{_type:"input",_id:this.__input_id_internal,class:"xsearch__input",_input_type:"search",_on:{input:(i,e)=>this.handleInput(i,e),change:(i,e)=>this.handleChange(i,e)}},{_type:"button",_id:this.__clear_id,class:"xsearch__clear",_text:"×","aria-label":"Clear",_on_click:()=>this.clear()}].forEach(i=>this.append(i))}applyProps(){this.__value=typeof this._value=="string"?this._value:"",this.__placeholder=this._placeholder?String(this._placeholder):"Search...",this.__size=this.normalizeSize(this._size),this.__disabled=this.normalizeBoolean(this._disabled,!1),this.__clearable=this.normalizeBoolean(this._clearable,!0),this.__icon=this.normalizeBoolean(this._icon,!0),this.__autofocus=this.normalizeBoolean(this._autofocus,!1),this.__input_id=this._input_id?String(this._input_id):void 0,this.addClass("xsearch"),this.replaceClass("xsearch--sm xsearch--md",`xsearch--${this.__size}`),this.__disabled?this.addClass("xsearch--disabled"):this.removeClass("xsearch--disabled");const t=this.getInput();t&&(t._placeholder=this.__placeholder,t._value=this.__value,t._disabled=this.__disabled,t._autofocus=this.__autofocus,this.__input_id&&(t.id=this.__input_id));const i=this.getIcon();i&&(i._visible=this.__icon),this.toggleClear()}toggleClear(){const t=this.getClear();if(!t)return;const i=this.__clearable&&this.__value.length>0&&!this.__disabled;t._visible=i}handleInput(t,i){const e=String(i?.target?.value??t?._value??t?._text??"");this.__value=e,this.toggleClear();const s=this._on_input;s&&this.checkAndRunInternalFunction(s,e,i)}handleChange(t,i){const e=String(i?.target?.value??t?._value??t?._text??"");this.__value=e;const s=this._on_change;s&&this.checkAndRunInternalFunction(s,e,i)}getValue(){return this.__value}setValue(t,i=!1){this.__value=String(t??"");const e=this.getInput();if(e&&(e._value=this.__value),this.toggleClear(),!i){const s=this._on_input;s&&this.checkAndRunInternalFunction(s,this.__value,void 0)}}clear(){this.setValue("",!0);const t=this._on_clear;t&&this.checkAndRunInternalFunction(t);const i=this._on_input;i&&this.checkAndRunInternalFunction(i,this.__value,void 0),this.focus()}focus(){const t=this.getInput();t&&typeof t.focus=="function"&&t.focus()}}class u extends n.XUIObject{static _xtype="igroup";__gap=8;__align="center";__wrap=!1;__dense=!1;__merged=!1;static managedStyles=new Set(["--xigroup-gap","align-items","flex-wrap","display","gap"]);constructor(t){const i={_type:u._xtype,class:"xigroup",_html_tag:"div"};super(t,i,!0),this.parse(t),this.applyLayout()}normalizeAlign(t){return t==="start"||t==="center"||t==="end"||t==="stretch"?t:"center"}normalizeGap(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:8}normalizeBoolean(t){return t===!0||t==="true"}mapAlign(t){return t==="start"?"flex-start":t==="end"?"flex-end":t==="center"?"center":"stretch"}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||u.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}applyLayout(){this.addClass("xigroup");const t=["xigroup--dense","xigroup--merged"],i=[];this.__dense&&i.push("xigroup--dense"),this.__merged&&i.push("xigroup--merged"),this.replaceClass(t.join(" "),i.join(" "));const e=this.stripManagedStyles(String(this.style||"")),s=[];e&&s.push(e),s.push("display:flex"),s.push(`gap:${this.__gap}px`),s.push(`--xigroup-gap:${this.__gap}px`),s.push(`align-items:${this.mapAlign(this.__align)}`),this.__wrap&&s.push("flex-wrap:wrap");const _=s.join("; ");this.style=_}set _gap(t){this.__gap=this.normalizeGap(t),this.applyLayout()}get _gap(){return this.__gap}set _align(t){this.__align=this.normalizeAlign(t),this.applyLayout()}get _align(){return this.__align}set _wrap(t){this.__wrap=this.normalizeBoolean(t),this.applyLayout()}get _wrap(){return this.__wrap}set _dense(t){this.__dense=this.normalizeBoolean(t),this.applyLayout()}get _dense(){return this.__dense}set _merged(t){this.__merged=this.normalizeBoolean(t),this.applyLayout()}get _merged(){return this.__merged}}class w extends n.XUIObject{static _xtype="select";__value="";__placeholder;__options=[];__size="md";__disabled=!1;__name;__select_id;__control_id;constructor(t){const i={_type:w._xtype,class:"xselect",_html_tag:"div"};super(t,i,!0),this.__control_id=this._id+"_control",this.parse(t),this.buildSkeleton(),this.applyProps()}normalizeSize(t){return t==="sm"?"sm":"md"}normalizeBoolean(t,i=!1){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:i}getControl(){return n.XUI.getObject(this.__control_id)}buildSkeleton(){const t={_type:"xhtml",_id:this.__control_id,class:"xselect__control",_html_tag:"select",_on:{change:(i,e)=>this.handleChange(i,e)}};this.append(t)}applyProps(){this.__value=typeof this._value=="string"?this._value:"",this.__placeholder=this._placeholder?String(this._placeholder):void 0,this.__options=Array.isArray(this._options)?this._options:[],this.__size=this.normalizeSize(this._size),this.__disabled=this.normalizeBoolean(this._disabled,!1),this.__name=this._name?String(this._name):void 0,this.__select_id=this._select_id?String(this._select_id):void 0,this.addClass("xselect"),this.replaceClass("xselect--sm xselect--md",`xselect--${this.__size}`),this.__disabled?this.addClass("xselect--disabled"):this.removeClass("xselect--disabled");const t=this.getControl();t&&(this.__name&&(t.name=this.__name),this.__select_id&&(t.id=this.__select_id),t.disabled=this.__disabled,this.setOptions(this.__options,!0),this.setValue(this.__value,!0))}clearOptions(t){(Array.isArray(t._children)?[...t._children]:[]).forEach(e=>{e&&t.removeChild(e,!0)})}buildOption(t,i){const e={_type:"xhtml",_html_tag:"option",_text:t.label,value:t.value};return t.disabled&&(e.disabled=!0),i&&(e.selected=!0),e}setOptions(t,i=!1){this.__options=Array.isArray(t)?t:[];const e=this.getControl();if(!e)return;this.clearOptions(e);const s=typeof this.__value=="string"&&this.__value.length>0;if(this.__placeholder){const _={_type:"xhtml",_html_tag:"option",_text:this.__placeholder,value:"",disabled:!0,hidden:!0,selected:!s};e.append(_)}this.__options.forEach(_=>{const r=_.value===this.__value;e.append(this.buildOption(_,r))}),i||this.setValue(this.__value,!0)}handleChange(t,i){const e=String(i?.target?.value??t?.value??t?._value??"");this.__value=e;const s=this._on_change;s&&this.checkAndRunInternalFunction(s,e,i)}getValue(){return this.__value}setValue(t,i=!1){this.__value=String(t??"");const e=this.getControl();if(e&&(e.value=this.__value),!i){const s=this._on_change;s&&this.checkAndRunInternalFunction(s,this.__value,void 0)}}focus(){const t=globalThis?._xlog??this._xlog;t?.log&&t.log("XSelect.focus requires engine input focus support.")}}class z extends n.XUIObject{static _xtype="field";__size="md";__align="stack";__has_error=!1;__label="";__hint="";__error="";__required=!1;__inline=!1;__control;__initializing=!0;__root_id;__label_id;__required_id;__hint_id;__error_id;__control_wrap_id;__inline_row_id;constructor(t){const i={_type:z._xtype,class:"xfield",_html_tag:"div"};super(t,i,!0),this.__root_id=this._id+"_root",this.__label_id=this._id+"_label",this.__required_id=this._id+"_required",this.__hint_id=this._id+"_hint",this.__error_id=this._id+"_error",this.__control_wrap_id=this._id+"_control_wrap",this.__inline_row_id=this._id+"_inline_row",this.parse(t),this.applyProps(),this.buildSkeleton(),this.applyLayout(),this.__initializing=!1}normalizeSize(t){return t==="sm"?"sm":"md"}normalizeBoolean(t){return t===!0||t==="true"}applyProps(){this.__label=this._label?String(this._label):"",this.__hint=this._hint?String(this._hint):"",this.__error=this._error?String(this._error):"",this.__required=this.normalizeBoolean(this._required),this.__inline=this.normalizeBoolean(this._inline),this.__control=this._control,this.__align=this.__inline?"inline":"stack",this.__size=this.normalizeSize(this._size),this.__has_error=this.hasError()}hasLabel(){return this.__label.trim().length>0}hasHint(){return this.__hint.trim().length>0}hasError(){return this.__error.trim().length>0}buildLabelRow(){const t=[];return this.hasLabel()&&t.push({_type:"label",_id:this.__label_id,class:"xfield__label",_text:this.__label.trim()}),this.__required&&t.push({_type:"label",_id:this.__required_id,class:"xfield__required",_text:"*"}),t.length?{_type:"stack",class:"xfield__label-row",_direction:"horizontal",_gap:6,_children:t}:null}buildControlRow(){return this.__control?{_type:"view",_id:this.__control_wrap_id,class:"xfield__control",_children:[this.__control]}:null}buildMessageRow(){return this.hasError()?{_type:"label",_id:this.__error_id,class:"xfield__error",_text:this.__error.trim()}:this.hasHint()?{_type:"label",_id:this.__hint_id,class:"xfield__hint",_text:this.__hint.trim()}:null}buildSkeleton(){const t=[],i=this.buildLabelRow(),e=this.buildControlRow(),s=this.buildMessageRow();if(this.__inline){const _=[];i&&_.push(i),e&&_.push(e),_.length&&t.push({_type:"stack",_id:this.__inline_row_id,class:"xfield__row xfield__row--inline",_direction:"horizontal",_gap:12,_children:_}),s&&t.push(s)}else i&&t.push(i),e&&t.push(e),s&&t.push(s);this.append({_type:"stack",_id:this.__root_id,class:"xfield__stack",_direction:"vertical",_gap:8,_children:t})}getRoot(){return n.XUI.getObject(this.__root_id)}rebuild(){const t=this.getRoot();t&&typeof this.removeChild=="function"&&this.removeChild(t,!0),this.buildSkeleton(),this.applyLayout()}updateLabelNode(){const t=n.XUI.getObject(this.__label_id);this.hasLabel()?t?t._text=this.__label.trim():this.rebuild():t&&this.rebuild()}updateRequiredNode(){const t=n.XUI.getObject(this.__required_id);this.__required?t||this.rebuild():t&&this.rebuild()}updateHintNode(){if(this.__has_error)return;const t=n.XUI.getObject(this.__hint_id);this.hasHint()?t?t._text=this.__hint.trim():this.rebuild():t&&this.rebuild()}updateErrorNode(){const t=this.hasError(),i=n.XUI.getObject(this.__error_id),e=n.XUI.getObject(this.__hint_id);if(this.__has_error=t,t){if(!i||e){this.rebuild();return}i._text=this.__error.trim()}else{if(i){this.rebuild();return}if(this.hasHint()&&!e){this.rebuild();return}this.updateHintNode()}this.applyLayout()}applyLayout(){this.addClass("xfield"),this.replaceClass("xfield--sm xfield--md",`xfield--${this.__size}`),this.replaceClass("xfield--inline xfield--stack",this.__align==="inline"?"xfield--inline":"xfield--stack"),this.__has_error?this.addClass("xfield--error"):this.removeClass("xfield--error")}set _label(t){this.__label=t?String(t):"",!this.__initializing&&this.updateLabelNode()}set _hint(t){this.__hint=t?String(t):"",!this.__initializing&&this.updateHintNode()}set _error(t){this.__error=t?String(t):"",!this.__initializing&&this.updateErrorNode()}set _required(t){this.__required=this.normalizeBoolean(t),!this.__initializing&&this.updateRequiredNode()}set _inline(t){this.__inline=this.normalizeBoolean(t),this.__align=this.__inline?"inline":"stack",!this.__initializing&&this.rebuild()}set _size(t){this.__size=this.normalizeSize(t),!this.__initializing&&this.applyLayout()}set _control(t){this.__control=t,!this.__initializing&&this.rebuild()}get _label(){return this.__label}get _hint(){return this.__hint}get _error(){return this.__error}get _required(){return this.__required}get _inline(){return this.__inline}get _size(){return this.__size}get _control(){return this.__control}}class f extends n.XUIObject{static _xtype="drawer";__open=!1;__side="right";__width="360px";__title;__closable=!0;__scroll=!0;__elevated=!0;__overlay=!1;__body_children=[];__panel_id;__header_id;__body_id;__scroll_id;__close_id;__title_id;static managedStyles=new Set(["--xdrawer-width"]);constructor(t){const i={_type:f._xtype,class:"xdrawer",_html_tag:"div"};super(t,i,!0),this.__panel_id=this._id+"_panel",this.__header_id=this._id+"_header",this.__body_id=this._id+"_body",this.__scroll_id=this._id+"_scroll",this.__close_id=this._id+"_close",this.__title_id=this._id+"_title",this.parse(t),this.applyProps(),this.__body_children=Array.isArray(this._children)?[...this._children]:[],this._children=[],this.buildSkeleton(this.__body_children),this.applyLayout()}normalizeSide(t){return t==="left"?"left":"right"}normalizeBoolean(t,i=!1){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:i}applyProps(){this.__open=this.normalizeBoolean(this._open,!1),this.__side=this.normalizeSide(this._side),this.__width=this._width?String(this._width):"360px",this.__title=this._title?String(this._title):void 0,this.__closable=this.normalizeBoolean(this._closable,!0),this.__scroll=this.normalizeBoolean(this._scroll,!0),this.__elevated=this.normalizeBoolean(this._elevated,!0),this.__overlay=this.normalizeBoolean(this._overlay,!1)}hasTitle(){return this.__title!==void 0&&this.__title.trim().length>0}buildHeader(){if(!this.hasTitle()&&!this.__closable)return null;const t=[];return this.hasTitle()&&t.push({_type:"label",_id:this.__title_id,class:"xdrawer__title",_text:this.__title?.trim()}),this.__closable&&t.push({_type:"button",_id:this.__close_id,class:"xdrawer__close",_text:"×",_on_click:()=>this.setOpen(!1)}),{_type:"view",_id:this.__header_id,class:"xdrawer__header",_children:t}}buildBody(t){const i=this.__scroll?[{_type:"scroll",_id:this.__scroll_id,class:"xdrawer__scroll",_children:t}]:t;return{_type:"view",_id:this.__body_id,class:"xdrawer__body",_children:i}}buildSkeleton(t){const i=[],e=this.buildHeader();e&&i.push(e),i.push(this.buildBody(t)),this.append({_type:"view",_id:this.__panel_id,class:"xdrawer__panel",_children:i})}rebuild(){const t=n.XUI.getObject(this.__panel_id);t&&typeof this.removeChild=="function"&&this.removeChild(t,!0),this.buildSkeleton(this.__body_children),this.applyLayout()}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||f.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}updateTitle(){const t=n.XUI.getObject(this.__title_id);if(!t)return;const i=this.__title?String(this.__title):"";t._text=i}applyLayout(){this.addClass("xdrawer");const t=["xdrawer--open","xdrawer--left","xdrawer--right","xdrawer--elevated","xdrawer--overlay"],i=[];this.__open&&i.push("xdrawer--open"),i.push(`xdrawer--${this.__side}`),this.__elevated&&i.push("xdrawer--elevated"),this.__overlay&&i.push("xdrawer--overlay"),this.replaceClass(t.join(" "),i.join(" "));const e=this.stripManagedStyles(String(this.style||"")),s=[];e&&s.push(e),this.__width&&s.push(`--xdrawer-width:${this.__width}`);const _=s.join("; ");this.style=_,this.updateTitle()}isOpen(){return this.__open}setOpen(t,i=!1){const e=this.normalizeBoolean(t,!1),s=e!==this.__open;this.__open=e,this.applyLayout(),!(!s||i)&&(this.__open&&this._on_open&&this.checkAndRunInternalFunction(this._on_open),!this.__open&&this._on_close&&this.checkAndRunInternalFunction(this._on_close))}toggle(){this.setOpen(!this.__open)}set _open(t){this.__open=this.normalizeBoolean(t,!1),this.applyLayout()}get _open(){return this.__open}set _side(t){this.__side=this.normalizeSide(t),this.applyLayout()}get _side(){return this.__side}set _width(t){this.__width=t?String(t):"360px",this.applyLayout()}get _width(){return this.__width}set _title(t){const i=this.hasTitle();this.__title=t?String(t):void 0;const e=this.hasTitle();i!==e?this.rebuild():(this.updateTitle(),this.applyLayout())}get _title(){return this.__title}set _closable(t){this.__closable=this.normalizeBoolean(t,!0),this.rebuild()}get _closable(){return this.__closable}set _scroll(t){this.__scroll=this.normalizeBoolean(t,!0),this.rebuild()}get _scroll(){return this.__scroll}set _elevated(t){this.__elevated=this.normalizeBoolean(t,!0),this.applyLayout()}get _elevated(){return this.__elevated}set _overlay(t){this.__overlay=this.normalizeBoolean(t,!1),this.applyLayout()}get _overlay(){return this.__overlay}}class S extends n.XUIObject{static _xtype="navlist";__items=[];__active="";__dense=!1;__dividers=!1;__list_id;constructor(t){const i={_type:S._xtype,class:"xnavlist",_html_tag:"div"};super(t,i,!0),this.__list_id=this._id+"_list",this.parse(t),this.applyProps(),this.applyLayout(),this.buildSkeleton(),this.renderItems()}normalizeBoolean(t){return t===!0||t==="true"}normalizeItems(t){return Array.isArray(t)?t:[]}applyProps(){this.__items=this.normalizeItems(this._items),this.__active=this._active?String(this._active):"",this.__dense=this.normalizeBoolean(this._dense),this.__dividers=this.normalizeBoolean(this._dividers)}buildSkeleton(){this.append({_type:"stack",_id:this.__list_id,class:"xnavlist__list",_direction:"vertical",_gap:4,_children:[]})}getList(){return n.XUI.getObject(this.__list_id)}clearList(t){if(!t)return;(Array.isArray(t._children)?[...t._children]:[]).forEach(e=>{typeof t.removeChild=="function"&&t.removeChild(e,!0)}),t._children=[],t.dom instanceof HTMLElement&&t.dom.replaceChildren()}getItemValue(t){return t._value?String(t._value):t._id?String(t._id):String(t._label)}isActive(t){return t._active===!0?!0:this.getItemValue(t)===this.__active}buildItem(t){const i=t._disabled===!0,e=this.isActive(t),s=["xnavlist__item"];e&&s.push("xnavlist__item--active"),i&&s.push("xnavlist__item--disabled");const _=[];return t._icon&&_.push(t._icon),_.push({_type:"label",class:"xnavlist__label",_text:String(t._label??"")}),t._badge&&_.push({_type:"view",class:"xnavlist__badge",_children:[t._badge]}),{_type:"view",class:s.join(" "),_on_click:()=>{if(i)return;const r=this.getItemValue(t);this.setActive(r,!0),this._on_select&&this.checkAndRunInternalFunction(this._on_select,r,t)},_children:_}}renderItems(){const t=this.getList();t&&(this.clearList(t),this.__items.forEach(i=>{t.append(this.buildItem(i))}))}applyLayout(){this.addClass("xnavlist");const t=["xnavlist--dense","xnavlist--dividers"],i=[];this.__dense&&i.push("xnavlist--dense"),this.__dividers&&i.push("xnavlist--dividers"),this.replaceClass(t.join(" "),i.join(" "))}setActive(t,i=!1){if(this.__active=String(t??""),this.renderItems(),!i&&this._on_select){const e=this.__items.find(s=>this.getItemValue(s)===this.__active);e&&this.checkAndRunInternalFunction(this._on_select,this.__active,e)}}getActive(){return this.__active}setItems(t){this.__items=this.normalizeItems(t),this.renderItems()}set _items(t){this.__items=this.normalizeItems(t),this.renderItems()}get _items(){return this.__items}set _active(t){this.__active=t?String(t):"",this.renderItems()}get _active(){return this.__active}set _dense(t){this.__dense=this.normalizeBoolean(t),this.applyLayout()}get _dense(){return this.__dense}set _dividers(t){this.__dividers=this.normalizeBoolean(t),this.applyLayout()}get _dividers(){return this.__dividers}}class y extends n.XUIObject{static _xtype="sidebar";__side="left";__width="280px";__title;__subtitle;__logo;__actions;__nav;__scroll=!0;__dividers=!0;__footer;__collapsed=!1;__body_children=[];__panel_id;__title_id;__subtitle_id;static managedStyles=new Set(["--xsidebar-width"]);constructor(t){const i={_type:y._xtype,class:"xsidebar",_html_tag:"div"};super(t,i,!0),this.__panel_id=this._id+"_panel",this.__title_id=this._id+"_title",this.__subtitle_id=this._id+"_subtitle",this.__body_children=Array.isArray(t._children)?[...t._children]:[],Array.isArray(t._children)&&(t._children=[]),this.parse(t),this.applyProps(),this.rebuild()}normalizeSide(t){return t==="right"?"right":"left"}normalizeBoolean(t,i=!1){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:i}applyProps(){this.__side=this.normalizeSide(this._side),this.__width=this._width?String(this._width):"280px",this.__title=this._title?String(this._title):void 0,this.__subtitle=this._subtitle?String(this._subtitle):void 0,this.__logo=this._logo,this.__actions=Array.isArray(this._actions)?this._actions:void 0,this.__nav=this._nav,this.__scroll=this.normalizeBoolean(this._scroll,!0),this.__dividers=this.normalizeBoolean(this._dividers,!0),this.__footer=this._footer,this.__collapsed=this.normalizeBoolean(this._collapsed,!1)}hasHeader(){return!!(this.__title&&this.__title.trim().length||this.__subtitle&&this.__subtitle.trim().length||this.__logo||this.__actions&&this.__actions.length)}buildHeader(){if(!this.hasHeader())return[];const t=[];this.__title&&this.__title.trim().length&&t.push({_type:"label",_id:this.__title_id,class:"xsidebar__title",_text:this.__title}),this.__subtitle&&this.__subtitle.trim().length&&t.push({_type:"label",_id:this.__subtitle_id,class:"xsidebar__subtitle",_text:this.__subtitle});const i=[];this.__logo&&i.push(this.__logo),t.length&&i.push({_type:"stack",class:"xsidebar__titles",_direction:"vertical",_gap:2,_children:t});const e={_type:"stack",class:"xsidebar__header-row",_direction:"horizontal",_gap:8,_align:"center",_justify:"space-between",_children:[{_type:"stack",class:"xsidebar__head-left",_direction:"horizontal",_gap:8,_align:"center",_children:i}]};return this.__actions&&this.__actions.length&&e._children.push({_type:"stack",class:"xsidebar__actions",_direction:"horizontal",_gap:6,_align:"center",_children:this.__actions}),[{_type:"view",class:"xsidebar__header",_children:[e]}]}buildBody(t){const i=this.__nav?[this.__nav]:t;return{_type:"view",class:"xsidebar__body",_children:this.__scroll?[{_type:"scroll",class:"xsidebar__scroll",_children:i}]:i}}buildFooter(){return this.__footer?[{_type:"view",class:"xsidebar__footer",_children:[this.__footer]}]:[]}buildSkeleton(t){const i=[],e=this.buildHeader();e.length&&(i.push(...e),this.__dividers&&i.push({_type:"divider",_muted:!0})),i.push(this.buildBody(t));const s=this.buildFooter();s.length&&(this.__dividers&&i.push({_type:"divider",_muted:!0}),i.push(...s)),this.append({_type:"view",_id:this.__panel_id,class:"xsidebar__panel",_children:i})}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}extractBodyChildren(){return this.__nav?[this.__nav]:this.__body_children}rebuild(){const t=this.extractBodyChildren(),i=n.XUI.getObject(this.__panel_id);i&&typeof this.removeChild=="function"&&this.removeChild(i,!0),this.buildSkeleton(t),this.applyLayout()}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||y.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}updateTitles(){const t=n.XUI.getObject(this.__title_id);t&&(t._text=this.__title||"");const i=n.XUI.getObject(this.__subtitle_id);i&&(i._text=this.__subtitle||"")}buildClassName(){const t=String(this.class||""),e=["xsidebar",...this.splitClasses(t).filter(s=>s!=="xsidebar"&&s!=="xsidebar--left"&&s!=="xsidebar--right"&&s!=="xsidebar--collapsed"&&s!=="xsidebar--dividers")];return e.push(`xsidebar--${this.__side}`),this.__collapsed&&e.push("xsidebar--collapsed"),this.__dividers&&e.push("xsidebar--dividers"),Array.from(new Set(e.filter(Boolean))).join(" ")}applyLayout(){const t=this.buildClassName();this.class=t;const i=this.stripManagedStyles(String(this.style||"")),e=[];i&&e.push(i),this.__width&&e.push(`--xsidebar-width:${this.__width}`);const s=e.join("; ");this.style=s,this.updateTitles()}isCollapsed(){return this.__collapsed}setCollapsed(t,i=!1){const e=this.normalizeBoolean(t,!1),s=e!==this.__collapsed;if(this.__collapsed=e,this.applyLayout(),!s||i)return;const _=this._on_toggle;typeof _=="function"&&_(this,this.__collapsed)}toggleCollapsed(){this.setCollapsed(!this.__collapsed)}set _collapsed(t){this.__collapsed=this.normalizeBoolean(t,!1),this.applyLayout()}get _collapsed(){return this.__collapsed}set _side(t){this.__side=this.normalizeSide(t),this.applyLayout()}get _side(){return this.__side}set _width(t){this.__width=t?String(t):"280px",this.applyLayout()}get _width(){return this.__width}set _title(t){const i=this.hasHeader();this.__title=t?String(t):void 0;const e=this.hasHeader();i!==e?this.rebuild():(this.updateTitles(),this.applyLayout())}get _title(){return this.__title}set _subtitle(t){const i=this.hasHeader();this.__subtitle=t?String(t):void 0;const e=this.hasHeader();i!==e?this.rebuild():(this.updateTitles(),this.applyLayout())}get _subtitle(){return this.__subtitle}set _logo(t){this.__logo=t,this.rebuild()}get _logo(){return this.__logo}set _actions(t){this.__actions=Array.isArray(t)?t:void 0,this.rebuild()}get _actions(){return this.__actions}set _nav(t){this.__nav=t,this.rebuild()}get _nav(){return this.__nav}set _scroll(t){this.__scroll=this.normalizeBoolean(t,!0),this.rebuild()}get _scroll(){return this.__scroll}set _dividers(t){this.__dividers=this.normalizeBoolean(t,!0),this.rebuild()}get _dividers(){return this.__dividers}set _footer(t){this.__footer=t,this.rebuild()}get _footer(){return this.__footer}}class g extends n.XUIObject{static _xtype="modal";__open=!1;__title;__subtitle;__size="md";__width;__closable=!0;__close_on_backdrop=!0;__scroll=!0;__actions;__content;__body_children=[];__ready=!1;__backdrop_id;__panel_id;__body_id;static managedStyles=new Set(["--xmodal-width"]);constructor(t){const i={_type:g._xtype,class:"xmodal",_html_tag:"div"};super(t,i,!0),this.__backdrop_id=this._id+"_backdrop",this.__panel_id=this._id+"_panel",this.__body_id=this._id+"_body",this.parse(t),this.applyProps(),this.__content||(this.__body_children=this.captureBodyChildren(t._children)),this._children=[],this.rebuild(),this.__ready=!0}normalizeBoolean(t,i=!1){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:i}normalizeSize(t){return t==="sm"||t==="lg"?t:"md"}applyProps(){this.__open=this.normalizeBoolean(this._open,!1),this.__title=this._title?String(this._title):void 0,this.__subtitle=this._subtitle?String(this._subtitle):void 0,this.__size=this.normalizeSize(this._size),this.__width=this._width?String(this._width):void 0,this.__closable=this.normalizeBoolean(this._closable,!0),this.__close_on_backdrop=this.normalizeBoolean(this._close_on_backdrop,!0),this.__scroll=this.normalizeBoolean(this._scroll,!0),this.__actions=Array.isArray(this._actions)?this._actions:void 0,this.__content=Array.isArray(this._content)?this._content:void 0}buildHeader(){if(!(this.__title||this.__subtitle||this.__closable))return[];const i=[];this.__title&&i.push({_type:"label",class:"xmodal__title",_text:this.__title}),this.__subtitle&&i.push({_type:"label",class:"xmodal__subtitle",_text:this.__subtitle});const e=[];return i.length&&e.push({_type:"stack",class:"xmodal__titles",_direction:"vertical",_gap:2,_children:i}),this.__closable&&e.push({_type:"button",class:"xmodal__close",_text:"×",_on_click:()=>this.close()}),[{_type:"toolbar",class:"xmodal__header",_gap:8,_justify:"space-between",_children:e},{_type:"divider",_muted:!0}]}buildBody(t){const i=this.__content?this.__content:t,e=this.__scroll?[{_type:"scroll",class:"xmodal__scroll",_children:i}]:i;return{_type:"view",_id:this.__body_id,class:"xmodal__body",_children:e}}buildFooter(){return!this.__actions||!this.__actions.length?[]:[{_type:"divider",_muted:!0},{_type:"toolbar",class:"xmodal__footer",_justify:"end",_children:[{_type:"stack",_direction:"horizontal",_gap:8,_align:"center",_children:this.__actions}]}]}buildSkeleton(t){const i={_type:"view",_id:this.__backdrop_id,class:"xmodal__backdrop"};this.__close_on_backdrop&&(i._on_click=()=>this.close());const e=[];e.push(...this.buildHeader()),e.push(this.buildBody(t)),e.push(...this.buildFooter());const s={_type:"view",_id:this.__panel_id,class:"xmodal__panel",_children:[{_type:"view",class:"xmodal__card",_children:e}]};this.append(i),this.append(s)}captureBodyChildren(t){return(Array.isArray(t)?t:[]).filter(e=>e&&e._id!==this.__panel_id&&e._id!==this.__backdrop_id)}rebuild(){const t=n.XUI.getObject(this.__panel_id);t&&typeof this.removeChild=="function"&&this.removeChild(t,!0);const i=n.XUI.getObject(this.__backdrop_id);i&&typeof this.removeChild=="function"&&this.removeChild(i,!0),this.buildSkeleton(this.__body_children),this.applyLayout()}stripManagedStyles(t){if(!t)return"";const i=t.split(";").map(s=>s.trim()).filter(Boolean),e=[];for(const s of i){const _=s.indexOf(":");if(_===-1)continue;const r=s.slice(0,_).trim().toLowerCase(),l=s.slice(_+1).trim();!r||!l||g.managedStyles.has(r)||e.push(`${r}:${l}`)}return e.join("; ")}applyLayout(){this.addClass("xmodal"),this.replaceClass("xmodal--sm xmodal--md xmodal--lg",`xmodal--${this.__size}`),this.replaceClass("xmodal--open",this.__open?"xmodal--open":"");const t=this.stripManagedStyles(String(this.style||"")),i=[];t&&i.push(t),this.__width&&i.push(`--xmodal-width:${this.__width}`);const e=i.join("; ");this.style=e,this.__width&&this.setStyleAttribute("--xmodal-width",this.__width)}async onCreate(){(Array.isArray(this._children)?[...this._children]:[]).forEach(i=>{const e=i?._id;e===this.__panel_id||e===this.__backdrop_id||typeof this.removeChild=="function"&&this.removeChild(i,!0)}),!this.__content&&this.__body_children.length&&!this.__ready&&(this.rebuild(),this.__ready=!0),await super.onCreate()}isOpen(){return this.__open}setOpen(t,i=!1){const e=this.normalizeBoolean(t,!1),s=e!==this.__open;this.__open=e,this.applyLayout(),!(!s||i)&&(this.__open&&this._on_open&&this.checkAndRunInternalFunction(this._on_open),!this.__open&&this._on_close&&this.checkAndRunInternalFunction(this._on_close))}open(){this.setOpen(!0)}close(){this.setOpen(!1)}}class k extends n.XUIObject{static _xtype="toast";__open=!1;__text="";__variant="default";__icon;__actions;__closable=!0;__auto_close_ms;__position="bottom-right";__elapsed=0;__last_tick;__ready=!1;__container_id;__text_id;constructor(t){const i={_type:k._xtype,class:"xtoast",_html_tag:"div"};super(t,i,!0),this.__container_id=this._id+"_container",this.__text_id=this._id+"_text",this.parse(t),this.applyProps(),this.buildSkeleton(),this.applyLayout(),this.__ready=!0}normalizeBoolean(t,i=!1){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:i}normalizeVariant(t){return t==="success"||t==="error"||t==="warn"||t==="info"?t:"default"}normalizePosition(t){return t==="top-right"||t==="top-left"||t==="bottom-left"?t:"bottom-right"}applyProps(){this.__open=this.normalizeBoolean(this._open,!1),this.__text=this._text?String(this._text):"",this.__variant=this.normalizeVariant(this._variant),this.__icon=this._icon,this.__actions=Array.isArray(this._actions)?this._actions:void 0,this.__closable=this.normalizeBoolean(this._closable,!0),this.__auto_close_ms=typeof this._auto_close_ms=="number"?this._auto_close_ms:void 0,this.__position=this.normalizePosition(this._position)}buildSkeleton(){const t=[];this.__icon&&t.push({_type:"view",class:"xtoast__icon",_children:[this.__icon]}),t.push({_type:"label",_id:this.__text_id,class:"xtoast__text",_text:this.__text}),this.__actions&&this.__actions.length&&t.push({_type:"view",class:"xtoast__actions",_children:this.__actions}),this.__closable&&t.push({_type:"button",class:"xtoast__close",_text:"×",_on_click:()=>this.close()}),this.append({_type:"view",_id:this.__container_id,class:"xtoast__container",_children:t})}rebuild(){const t=n.XUI.getObject(this.__container_id);t&&typeof this.removeChild=="function"&&this.removeChild(t,!0),this.buildSkeleton(),this.applyLayout()}applyLayout(){this.addClass("xtoast"),this.replaceClass("xtoast--open",this.__open?"xtoast--open":""),this.replaceClass("xtoast--default xtoast--success xtoast--error xtoast--warn xtoast--info",`xtoast--${this.__variant}`),this.replaceClass("xtoast--top-right xtoast--top-left xtoast--bottom-right xtoast--bottom-left",`xtoast--${this.__position}`)}resetTimer(){this.__elapsed=0,this.__last_tick=void 0}async onFrame(t){if(!this.__open||!this.__auto_close_ms||this.__auto_close_ms<=0)return;await super.onFrame(t);const i=globalThis.performance?.now?globalThis.performance.now():Date.now();if(!this.__last_tick){this.__last_tick=i;return}this.__elapsed+=i-this.__last_tick,this.__last_tick=i,this.__elapsed>=this.__auto_close_ms&&(this.close(),this.__last_tick=void 0)}isOpen(){return this.__open}setOpen(t,i=!1){const e=this.normalizeBoolean(t,!1),s=e!==this.__open;this.__open=e,this.__open&&this.resetTimer(),this.applyLayout(),!(!s||i)&&(this.__open&&this._on_open&&this.checkAndRunInternalFunction(this._on_open),!this.__open&&this._on_close&&this.checkAndRunInternalFunction(this._on_close))}open(){this.setOpen(!0)}close(){this.setOpen(!1)}set _open(t){this.__open=this.normalizeBoolean(t,!1),this.__open&&this.resetTimer(),this.applyLayout()}get _open(){return this.__open}set _text(t){this.__text=t?String(t):"";const i=n.XUI.getObject(this.__text_id);i&&(i._text=this.__text)}get _text(){return this.__text}set _variant(t){this.__variant=this.normalizeVariant(t),this.applyLayout()}get _variant(){return this.__variant}set _position(t){this.__position=this.normalizePosition(t),this.applyLayout()}get _position(){return this.__position}set _icon(t){this.__icon=t,this.__ready&&this.rebuild()}get _icon(){return this.__icon}set _actions(t){this.__actions=Array.isArray(t)?t:void 0,this.__ready&&this.rebuild()}get _actions(){return this.__actions}set _closable(t){this.__closable=this.normalizeBoolean(t,!0),this.__ready&&this.rebuild()}get _closable(){return this.__closable}set _auto_close_ms(t){this.__auto_close_ms=typeof t=="number"?t:void 0,this.__open&&this.resetTimer()}get _auto_close_ms(){return this.__auto_close_ms}}class C extends n.XUIObject{static _xtype="card";__image;__title;__text="";__href;__link_text;__actions;__image_alt;__hide_image=!1;__image_id;__title_id;__text_id;__link_id;__actions_id;__image_placeholder="https://via.placeholder.com/600x200?text=Card";__title_placeholder="Card title";__text_placeholder="Card text...";__href_placeholder="#";__link_text_placeholder="Learn more";__image_alt_placeholder="Card image";constructor(t){const i={_type:C._xtype,class:"xcard",_html_tag:"div"};super(t,i,!0),this.__image_id=this._id+"_image",this.__title_id=this._id+"_title",this.__text_id=this._id+"_text",this.__link_id=this._id+"_link",this.__actions_id=this._id+"_actions",this.parse(t),this.applyProps(),this.buildSkeleton(),this.applyLayout(),this.applyText()}normalizeBoolean(t,i=!1){return t===!0||t==="true"?!0:t===!1||t==="false"?!1:i}applyProps(){this.__image=this._image?String(this._image):void 0,this.__title=this._title?String(this._title):void 0,this.__text=this._text?String(this._text):"",this.__href=this._href?String(this._href):void 0,this.__link_text=this._link_text?String(this._link_text):void 0,this.__actions=Array.isArray(this._actions)?this._actions:void 0,this.__image_alt=this._image_alt?String(this._image_alt):void 0,this.__hide_image=this.normalizeBoolean(this._hide_image,!1)}resolveImage(){const t=this.__image?this.__image.trim():"";return t||this.__image_placeholder}resolveImageAlt(){const t=this.__image_alt?this.__image_alt.trim():"";return t||this.__image_alt_placeholder}resolveTitle(){const t=this.__title?this.__title.trim():"";return t||this.__title_placeholder}resolveText(){const t=this.__text.trim();return t||this.__text_placeholder}resolveHref(){const t=this.__href?this.__href.trim():"";return t||this.__href_placeholder}resolveLinkText(){const t=this.__link_text?this.__link_text.trim():"";return t||this.__link_text_placeholder}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}buildClassName(){const t=String(this.class||""),e=["xcard",...this.splitClasses(t).filter(s=>s!=="xcard"&&s!=="xcard--no-image")];return this.__hide_image&&e.push("xcard--no-image"),Array.from(new Set(e.filter(Boolean))).join(" ")}buildSkeleton(){const t={_type:"view",class:"xcard__inner",_children:[{_type:"image",_id:this.__image_id,class:"xcard__image",_src:this.resolveImage(),_alt:this.resolveImageAlt()},{_type:"view",class:"xcard__body",_children:[{_type:"label",_id:this.__title_id,class:"xcard__title",_text:""},{_type:"label",_id:this.__text_id,class:"xcard__text",_text:""},{_type:"link",_id:this.__link_id,class:"xcard__link dash-btn",_text:"",_href:""},{_type:"view",_id:this.__actions_id,class:"xcard__actions",_children:this.__actions?[...this.__actions]:[]}]}]};this.append(t)}applyLayout(){const t=this.buildClassName();this.class=t}applyText(){this.updateImage(),this.updateTitle(),this.updateText(),this.updateLink(),this.updateActions()}updateImage(){const t=n.XUI.getObject(this.__image_id);t&&(t._src=this.resolveImage(),t._alt=this.resolveImageAlt())}updateTitle(){const t=n.XUI.getObject(this.__title_id);t&&(t._text=this.resolveTitle())}updateText(){const t=n.XUI.getObject(this.__text_id);t&&(t._text=this.resolveText())}updateLink(){const t=n.XUI.getObject(this.__link_id);t&&(t._text=this.resolveLinkText(),t._href=this.resolveHref())}updateActions(){const t=n.XUI.getObject(this.__actions_id);if(!t)return;(Array.isArray(t._children)?[...t._children]:[]).forEach(e=>{e&&t.removeChild(e,!0)}),this.__actions&&this.__actions.length&&this.__actions.forEach(e=>t.append(e))}set _image(t){this.__image=t?String(t):void 0,this.updateImage()}get _image(){return this.__image}set _image_alt(t){this.__image_alt=t?String(t):void 0,this.updateImage()}get _image_alt(){return this.__image_alt}set _title(t){this.__title=t?String(t):void 0,this.updateTitle()}get _title(){return this.__title}set _text(t){this.__text=t?String(t):"",this.updateText()}get _text(){return this.__text}set _href(t){this.__href=t?String(t):void 0,this.updateLink()}get _href(){return this.__href}set _link_text(t){this.__link_text=t?String(t):void 0,this.updateLink()}get _link_text(){return this.__link_text}set _actions(t){this.__actions=Array.isArray(t)?t:void 0,this.updateActions()}get _actions(){return this.__actions}set _hide_image(t){this.__hide_image=this.normalizeBoolean(t,!1),this.applyLayout()}get _hide_image(){return this.__hide_image}}class L extends n.XUIObject{static _xtype="kpi-card";__label="";__value="";__delta="";__delta_state="flat";__icon="";__label_placeholder="KPI";__value_placeholder="—";__delta_placeholder="";__icon_placeholder="";__icon_id;__label_id;__value_id;__delta_id;constructor(t){const i={_type:L._xtype,class:"xkpi-card",_html_tag:"div"};super(t,i,!0),this.__icon_id=this._id+"_icon",this.__label_id=this._id+"_label",this.__value_id=this._id+"_value",this.__delta_id=this._id+"_delta",this.parse(t),this.applyProps(),this.buildSkeleton(),this.applyLayout(),this.applyText()}normalizeState(t){return t==="up"||t==="down"||t==="flat"?t:"flat"}applyProps(){this.__label=this._label?String(this._label):"",this.__value=this._value?String(this._value):"",this.__delta=this._delta?String(this._delta):"",this.__delta_state=this.normalizeState(this._delta_state),this.__icon=this._icon?String(this._icon):""}resolveLabel(){const t=this.__label.trim();return t||this.__label_placeholder}resolveValue(){const t=this.__value.trim();return t||this.__value_placeholder}resolveDelta(){const t=this.__delta.trim();return t||this.__delta_placeholder}resolveIcon(){const t=this.__icon.trim();return t||this.__icon_placeholder}splitClasses(t){return t.split(/\s+/).map(i=>i.trim()).filter(Boolean)}buildClassName(){const t=String(this.class||""),i=this.splitClasses(t).filter(s=>s!=="xkpi-card"&&s!=="xkpi-card--up"&&s!=="xkpi-card--down"&&s!=="xkpi-card--flat"),e=["xkpi-card",`xkpi-card--${this.__delta_state}`,...i];return Array.from(new Set(e.filter(Boolean))).join(" ")}buildSkeleton(){const t={_type:"view",class:"kpi-body",_children:[{_type:"view",class:"kpi-top",_children:[{_type:"label",_id:this.__icon_id,class:"kpi-icon",_text:""},{_type:"label",_id:this.__label_id,class:"kpi-label",_text:""}]},{_type:"label",_id:this.__value_id,class:"kpi-value",_text:""},{_type:"label",_id:this.__delta_id,class:"kpi-delta kpi-delta--flat",_text:""}]};this.append(t)}applyLayout(){const t=this.buildClassName();this.class=t;const i=n.XUI.getObject(this.__delta_id);i&&typeof i.replaceClass=="function"?i.replaceClass("kpi-delta--up kpi-delta--down kpi-delta--flat",`kpi-delta--${this.__delta_state}`):i&&(i.class=`kpi-delta kpi-delta--${this.__delta_state}`)}applyText(){const t=n.XUI.getObject(this.__icon_id);t&&(t._text=this.resolveIcon());const i=n.XUI.getObject(this.__label_id);i&&(i._text=this.resolveLabel());const e=n.XUI.getObject(this.__value_id);e&&(e._text=this.resolveValue());const s=n.XUI.getObject(this.__delta_id);s&&(s._text=this.resolveDelta())}set _label(t){this.__label=t?String(t):"",this.applyText()}get _label(){return this.__label}set _value(t){this.__value=t?String(t):"",this.applyText()}get _value(){return this.__value}set _delta(t){this.__delta=t?String(t):"",this.applyText()}get _delta(){return this.__delta}set _delta_state(t){this.__delta_state=this.normalizeState(t),this.applyLayout()}get _delta_state(){return this.__delta_state}set _icon(t){this.__icon=t?String(t):"",this.applyText()}get _icon(){return this.__icon}}class j extends n.XUIObject{static _xtype="grid";_cols;_gap;_min_col_width;constructor(t){const i={_type:j._xtype,class:"xgrid",_html_tag:"div"};super(t,i,!0),this.parse(t),this._cols&&(this.style=`${this.style||""}; --x-grid-cols:${this._cols}`),this._gap&&(this.style=`${this.style||""}; --x-grid-gap:${this._gap}px`),this._min_col_width&&(this.style=`${this.style||""}; --x-grid-min-col:${this._min_col_width}px`)}}class A extends n.XUIObject{static _xtype="section";__title="";__subtitle="";__actions=[];__body_children=[];__initializing=!0;__container_id;__header_id;__title_id;__subtitle_id;__actions_id;__body_id;constructor(t){const i={_type:A._xtype,class:"xsection",_html_tag:"section"},e=Array.isArray(t._children)?[...t._children]:[];Array.isArray(t._children)&&(t._children=[]),super(t,i,!0),this.__container_id=this._id+"_container",this.__header_id=this._id+"_header",this.__title_id=this._id+"_title",this.__subtitle_id=this._id+"_subtitle",this.__actions_id=this._id+"_actions",this.__body_id=this._id+"_body",this.parse(t),this.applyProps(),this.__body_children=e,this.buildSkeleton(),this.__initializing=!1}normalizeActions(t){return Array.isArray(t)?t:[]}applyProps(){this.__title=this._title?String(this._title):"",this.__subtitle=this._subtitle?String(this._subtitle):"",this.__actions=this.normalizeActions(this._actions)}hasTitle(){return this.__title.trim().length>0}hasSubtitle(){return this.__subtitle.trim().length>0}hasActions(){return this.__actions.length>0}hasHeader(){return this.hasTitle()||this.hasSubtitle()||this.hasActions()}currentHeaderState(){return{title:this.__title.trim(),subtitle:this.__subtitle.trim(),actions:this.__actions}}buildHeader(){if(!this.hasHeader())return null;const t=[];if(this.hasTitle()||this.hasSubtitle()){const i=[];this.hasTitle()&&i.push({_type:"label",_id:this.__title_id,_html_tag:"h2",class:"xsection__title",_text:this.__title.trim()}),this.hasSubtitle()&&i.push({_type:"label",_id:this.__subtitle_id,_html_tag:"p",class:"xsection__subtitle",_text:this.__subtitle.trim()}),t.push({_type:"view",class:"xsection__headings",_children:i})}return this.hasActions()&&t.push({_type:"view",_id:this.__actions_id,class:"xsection__actions",_children:this.__actions}),{_type:"view",_id:this.__header_id,class:"xsection__header",_children:t}}buildSkeleton(){const t=[],i=this.buildHeader();i&&t.push(i),t.push({_type:"view",_id:this.__body_id,class:"xsection__body",_children:this.__body_children}),this.append({_type:"view",_id:this.__container_id,class:"xsection__container",_children:t})}rebuild(){const t=n.XUI.getObject(this.__container_id);t&&typeof this.removeChild=="function"&&this.removeChild(t,!0),this.buildSkeleton()}set _title(t){const i=this.currentHeaderState();if(this.__title=t?String(t):"",this.__initializing)return;const e=this.hasHeader();if((i.title.length>0||i.subtitle.length>0||i.actions.length>0)!==e){this.rebuild();return}const _=n.XUI.getObject(this.__title_id);_?_._text=this.__title.trim():this.hasTitle()&&this.rebuild()}get _title(){return this.__title}set _subtitle(t){const i=this.currentHeaderState();if(this.__subtitle=t?String(t):"",this.__initializing)return;const e=this.hasHeader();if((i.title.length>0||i.subtitle.length>0||i.actions.length>0)!==e){this.rebuild();return}const _=n.XUI.getObject(this.__subtitle_id);_?_._text=this.__subtitle.trim():this.hasSubtitle()&&this.rebuild()}get _subtitle(){return this.__subtitle}set _actions(t){if(this.__initializing){this.__actions=this.normalizeActions(t);return}const i=this.hasHeader(),e=this.normalizeActions(t);this.__actions=e;const s=this.hasHeader();if(i!==s){this.rebuild();return}const _=n.XUI.getObject(this.__actions_id);if(!_){this.hasActions()&&this.rebuild();return}(Array.isArray(_._children)?[..._._children]:[]).forEach(l=>{l&&_.removeChild(l,!0)}),this.__actions.forEach(l=>_.append(l))}get _actions(){return this.__actions}}class X extends n.XObjectPack{static getObjects(){return{[C._xtype]:C,[j._xtype]:j,[S._xtype]:S,[x._xtype]:x,[m._xtype]:m,[g._xtype]:g,[k._xtype]:k,[c._xtype]:c,[h._xtype]:h,[L._xtype]:L,[o._xtype]:o,[d._xtype]:d,[p._xtype]:p,[b._xtype]:b,[u._xtype]:u,[v._xtype]:v,[w._xtype]:w,[z._xtype]:z,[f._xtype]:f,[y._xtype]:y,[A._xtype]:A}}}exports.XDashPack=X;exports.XDashboardPack=X;