jsswift 1.0.51 → 1.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI.md +14 -3
- package/dist/documentions/AI.md +14 -3
- package/dist/documentions/components/table.md +20 -1
- package/dist/documentions/examples/crud.md +14 -1
- package/dist/documentions/knowledge-map.json +1 -1
- package/dist/jsswift.js +2 -2
- package/dist/jsswift.min.js +1 -1
- package/dist/min-jsswift.js +1 -1
- package/package.json +1 -1
package/AI.md
CHANGED
|
@@ -10,6 +10,17 @@ If a required API is absent here, consult `knowledge-map.json` to find its exact
|
|
|
10
10
|
|
|
11
11
|
The installed package exposes this same guide as `AI.md` at its root and through `jsswift/AI.md`. `package.json` includes `jsswiftDocumentation` discovery paths. Do not inspect runtime bundles to discover documented APIs.
|
|
12
12
|
|
|
13
|
+
## Choose one starting route
|
|
14
|
+
|
|
15
|
+
| Task | First read | Stop condition |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Small page with the six components below | This guide | Implement the supported subset without opening component contracts. |
|
|
18
|
+
| Product CRUD with validation, persistence and focus | [CRUD example](examples/crud.md) | Reuse the example; do not also concatenate Input, Select, Dialog and Table contracts. |
|
|
19
|
+
| One missing prop or callback | Map → exact document, or selective MCP read | Read only the needed section; do not search the runtime bundle. |
|
|
20
|
+
| Custom appearance | Supported props below, then one relevant contract | Keep component styles; add CSS for page layout and task-specific visuals. |
|
|
21
|
+
|
|
22
|
+
The map locates a contract; it does not replace it. Avoid reading all of `ui/common-props.md` just to confirm examples already covered here. Structural helpers used below (`div`, `p`, `span`, `strong`) do not require a separate HTML/SVG guide. Read that guide only for additional helper behavior.
|
|
23
|
+
|
|
13
24
|
## Import, create, mount
|
|
14
25
|
|
|
15
26
|
Provide `<div id="app"></div>` in HTML and a module entrypoint. With Vite:
|
|
@@ -51,7 +62,7 @@ const table = _.Table({
|
|
|
51
62
|
{ key: 'name', label: 'Nome', render: (row, { value }) => _.strong(value) },
|
|
52
63
|
{ key: 'price', label: 'Prezzo', format: value => `${value} EUR` }
|
|
53
64
|
],
|
|
54
|
-
pagination: false, hideFooter: true, minTableWidth: 700
|
|
65
|
+
pagination: false, hideFooter: true, hideStatus: true, minTableWidth: 700
|
|
55
66
|
});
|
|
56
67
|
const page = _.Page({}, _.Card({ title: 'Prodotti' }, edit, table));
|
|
57
68
|
_.mount('#app', page);
|
|
@@ -76,7 +87,7 @@ Dialog returns an API object, not a node to mount: `open(overrides?)`, `close()`
|
|
|
76
87
|
|
|
77
88
|
## Existing CSS and optional assets
|
|
78
89
|
|
|
79
|
-
The UI stylesheet includes component styles, theme variables, and responsive rules. Start with native components. Prefer documented `color`, `dense`, `padding`, `radius`, `shadow`, and breakpoint props to overrides of internal `.cms-*` classes. Read [common props](ui/common-props.md)
|
|
90
|
+
The UI stylesheet includes component styles, theme variables, and responsive rules. Start with native components. Prefer documented `color`, `dense`, `padding`, `radius`, `shadow`, and breakpoint props to overrides of internal `.cms-*` classes. Read [common props](ui/common-props.md) only for an additional inherited prop; component-specific definitions take precedence. Use custom CSS for remaining page requirements.
|
|
80
91
|
|
|
81
92
|
System fonts are the default. Import `jsswift/css/fonts-nunito.css`, `jsswift/css/fonts-material.css`, or `jsswift/tabler` only when required; Material Symbols loads a remote Google font. See [setup](getting-started.md).
|
|
82
93
|
|
|
@@ -98,7 +109,7 @@ For a complete application flow, read [the compact CRUD example](examples/crud.m
|
|
|
98
109
|
|
|
99
110
|
Check whether browser tooling and server permissions are available before launching checks. Run Git commands only in a Git worktree; for example test `git rev-parse --is-inside-work-tree` before requesting a diff. Keep build, pure-logic tests and server startup results separate. An HTTP response confirms a reachable server, not that your startup command succeeded or that browser interactions work. Report environment failures separately from application failures. Test the implemented functions rather than rebuilding equivalent data inside an assertion.
|
|
100
111
|
|
|
101
|
-
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus separately from validation focus and return focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
112
|
+
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus after the deferred autofocus has run, separately from validation focus and return focus. Record each check separately: initial field, Tab/Shift+Tab containment, Escape, and return to the current trigger. A focus-trap result does not prove initial focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
102
113
|
|
|
103
114
|
## Focus CSS and targeted reads
|
|
104
115
|
|
package/dist/documentions/AI.md
CHANGED
|
@@ -10,6 +10,17 @@ If a required API is absent here, consult `knowledge-map.json` to find its exact
|
|
|
10
10
|
|
|
11
11
|
The installed package exposes this same guide as `AI.md` at its root and through `jsswift/AI.md`. `package.json` includes `jsswiftDocumentation` discovery paths. Do not inspect runtime bundles to discover documented APIs.
|
|
12
12
|
|
|
13
|
+
## Choose one starting route
|
|
14
|
+
|
|
15
|
+
| Task | First read | Stop condition |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Small page with the six components below | This guide | Implement the supported subset without opening component contracts. |
|
|
18
|
+
| Product CRUD with validation, persistence and focus | [CRUD example](examples/crud.md) | Reuse the example; do not also concatenate Input, Select, Dialog and Table contracts. |
|
|
19
|
+
| One missing prop or callback | Map → exact document, or selective MCP read | Read only the needed section; do not search the runtime bundle. |
|
|
20
|
+
| Custom appearance | Supported props below, then one relevant contract | Keep component styles; add CSS for page layout and task-specific visuals. |
|
|
21
|
+
|
|
22
|
+
The map locates a contract; it does not replace it. Avoid reading all of `ui/common-props.md` just to confirm examples already covered here. Structural helpers used below (`div`, `p`, `span`, `strong`) do not require a separate HTML/SVG guide. Read that guide only for additional helper behavior.
|
|
23
|
+
|
|
13
24
|
## Import, create, mount
|
|
14
25
|
|
|
15
26
|
Provide `<div id="app"></div>` in HTML and a module entrypoint. With Vite:
|
|
@@ -51,7 +62,7 @@ const table = _.Table({
|
|
|
51
62
|
{ key: 'name', label: 'Nome', render: (row, { value }) => _.strong(value) },
|
|
52
63
|
{ key: 'price', label: 'Prezzo', format: value => `${value} EUR` }
|
|
53
64
|
],
|
|
54
|
-
pagination: false, hideFooter: true, minTableWidth: 700
|
|
65
|
+
pagination: false, hideFooter: true, hideStatus: true, minTableWidth: 700
|
|
55
66
|
});
|
|
56
67
|
const page = _.Page({}, _.Card({ title: 'Prodotti' }, edit, table));
|
|
57
68
|
_.mount('#app', page);
|
|
@@ -76,7 +87,7 @@ Dialog returns an API object, not a node to mount: `open(overrides?)`, `close()`
|
|
|
76
87
|
|
|
77
88
|
## Existing CSS and optional assets
|
|
78
89
|
|
|
79
|
-
The UI stylesheet includes component styles, theme variables, and responsive rules. Start with native components. Prefer documented `color`, `dense`, `padding`, `radius`, `shadow`, and breakpoint props to overrides of internal `.cms-*` classes. Read [common props](ui/common-props.md)
|
|
90
|
+
The UI stylesheet includes component styles, theme variables, and responsive rules. Start with native components. Prefer documented `color`, `dense`, `padding`, `radius`, `shadow`, and breakpoint props to overrides of internal `.cms-*` classes. Read [common props](ui/common-props.md) only for an additional inherited prop; component-specific definitions take precedence. Use custom CSS for remaining page requirements.
|
|
80
91
|
|
|
81
92
|
System fonts are the default. Import `jsswift/css/fonts-nunito.css`, `jsswift/css/fonts-material.css`, or `jsswift/tabler` only when required; Material Symbols loads a remote Google font. See [setup](getting-started.md).
|
|
82
93
|
|
|
@@ -98,7 +109,7 @@ For a complete application flow, read [the compact CRUD example](examples/crud.m
|
|
|
98
109
|
|
|
99
110
|
Check whether browser tooling and server permissions are available before launching checks. Run Git commands only in a Git worktree; for example test `git rev-parse --is-inside-work-tree` before requesting a diff. Keep build, pure-logic tests and server startup results separate. An HTTP response confirms a reachable server, not that your startup command succeeded or that browser interactions work. Report environment failures separately from application failures. Test the implemented functions rather than rebuilding equivalent data inside an assertion.
|
|
100
111
|
|
|
101
|
-
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus separately from validation focus and return focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
112
|
+
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus after the deferred autofocus has run, separately from validation focus and return focus. Record each check separately: initial field, Tab/Shift+Tab containment, Escape, and return to the current trigger. A focus-trap result does not prove initial focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
102
113
|
|
|
103
114
|
## Focus CSS and targeted reads
|
|
104
115
|
|
|
@@ -37,6 +37,7 @@ Exact JSswift UI contract. Shared definitions listed in `commonProps` are in [co
|
|
|
37
37
|
"minTableWidth": {"type": "string|number", "description": "Component configuration for \"minTableWidth\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
38
38
|
"stickyHeader": {"type": "boolean", "description": "Keeps the header region sticky during scroll.", "default": null, "values": null, "category": "general"},
|
|
39
39
|
"hideHeader": {"type": "boolean", "description": "Component configuration for \"hideHeader\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
40
|
+
"hideStatus": {"type": "boolean", "description": "Hides the entire status row, including row count, filter/sort indicators and custom status content. Independent of toolbar, column headings and footer. Evaluated at creation.", "default": false, "values": null, "category": "layout"},
|
|
40
41
|
"hideFooter": {"type": "boolean", "description": "Component configuration for \"hideFooter\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
41
42
|
"dense": {"type": "boolean", "description": "Uses compact spacing and sizing.", "default": false, "values": null, "category": "layout"},
|
|
42
43
|
"striped": {"type": "boolean", "description": "Applies striped row styling.", "default": null, "values": null, "category": "general"},
|
|
@@ -96,4 +97,22 @@ Use the documented visibility and column style props before hiding or restyling
|
|
|
96
97
|
|
|
97
98
|
For application-owned filtering/paging, pass the already filtered page as `rows`, set `pagination: false` and `hideFooter: true`. `minTableWidth` keeps columns readable in a horizontally scrollable container. Provide counters and pager buttons outside Table.
|
|
98
99
|
|
|
99
|
-
`toolbarStart`, `toolbar` and `toolbarEnd` add content to the optional toolbar. The built-in row-count status is a separate region and remains visible even with `hideFooter: true`; it counts the rows supplied to Table, not the full application inventory.
|
|
100
|
+
`toolbarStart`, `toolbar` and `toolbarEnd` add content to the optional toolbar. The built-in row-count status is a separate region and remains visible even with `hideFooter: true`; it counts the rows supplied to Table, not the full application inventory. Use `hideStatus: true` to hide the entire status region, including custom status content. Do not confuse `hideHeader` (column headings) with the toolbar/status. Table has its own Card wrapper; nesting it in another Card may produce an additional frame. Customize using supported props and theme values first.
|
|
101
|
+
|
|
102
|
+
## Compose without duplicating the frame
|
|
103
|
+
|
|
104
|
+
Table already returns a Card. For a catalogue, mount it in a structural `_.div`, rather than wrapping it in another Card. Use `radius`, `shadow`, `padding` and `dense` before overriding internal classes. Keep toolbar content inside Table when it belongs to the table; keep application filters outside when they affect other parts of the page.
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
const table = _.Table({
|
|
108
|
+
rows: products, rowKey: 'id',
|
|
109
|
+
columns: [{key: 'name', label: 'Nome'}],
|
|
110
|
+
toolbarStart: _.strong('Prodotti'),
|
|
111
|
+
minTableWidth: 600, shadow: 'none', radius: '12px'
|
|
112
|
+
});
|
|
113
|
+
_.mount('#app', _.div({style: {minWidth: 0}}, table));
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For external paging, the status count describes the supplied page (for example, “5 righe”); an external total describes all filtered results. Choose whether both pieces of information are useful. `status` adds content; it does not replace or hide the built-in count. `hideFooter` only hides the footer. Do not use `hideHeader` to remove the status row. Use `hideStatus: true` to hide that row when the application supplies its own summary. It does not hide the toolbar, column headings or footer.
|
|
117
|
+
|
|
118
|
+
A grey surface or gradient is not a focus indicator. Inspect the Card/theme surface separately from `:focus-visible`; do not remove keyboard indicators to change a background. Custom table-cell styling is application CSS, and should remain scoped to an application class.
|
|
@@ -50,7 +50,7 @@ const filter = _.Select({label:'Filtro categoria',options:[{value:'',label:'Tutt
|
|
|
50
50
|
function render() {
|
|
51
51
|
const found = rows.filter(r => r.name.toLowerCase().includes(query.trim().toLowerCase()) && (!category || r.category === category));
|
|
52
52
|
const pages = Math.max(1,Math.ceil(found.length/5)); page = Math.min(page,pages);
|
|
53
|
-
host.replaceChildren(_.Table({rows:found.slice((page-1)*5,page*5),rowKey:'id',pagination:false,hideFooter:true,minTableWidth:600,
|
|
53
|
+
host.replaceChildren(_.Table({rows:found.slice((page-1)*5,page*5),rowKey:'id',pagination:false,hideFooter:true,hideStatus:true,minTableWidth:600,
|
|
54
54
|
columns:[{key:'name',label:'Nome'},{key:'category',label:'Categoria'},{key:'price',label:'Prezzo',format:value => priceFormat.format(value)},{key:'quantity',label:'Quantità'},
|
|
55
55
|
{key:'actions',label:'Azioni',render:r => _.Button({id:`edit-${r.id}`,onClick:() => edit(r)},'Modifica')}] }));
|
|
56
56
|
pager.replaceChildren(_.span(`${found.length} prodotti — pagina ${page}/${pages}`),
|
|
@@ -63,3 +63,16 @@ _.mount('#app', _.div({style:{minWidth:0}}, add, search, filter, host, pager, no
|
|
|
63
63
|
Application validation remains explicit. `error` marks the control invalid; rendered field messages are associated automatically. Use `ariaDescribedBy` for additional application-owned descriptions. This example does not provide delete, server synchronization or a complete visual design.
|
|
64
64
|
|
|
65
65
|
Performance: the currency formatter is reused. This small example rebuilds its table for clarity; profile larger datasets before changing rendering strategy. `onOpen` focuses the name field and automatic focus respects that choice.
|
|
66
|
+
|
|
67
|
+
## Verification checklist
|
|
68
|
+
|
|
69
|
+
Build success alone does not verify this flow. In a browser, record these results separately:
|
|
70
|
+
|
|
71
|
+
- Open the editor and, after deferred autofocus, check that the name control is active.
|
|
72
|
+
- Change the category, save, reopen, and reload: check the displayed value and persisted category.
|
|
73
|
+
- Reject blank fields, negative price and fractional quantity; check `aria-invalid` and the field error referenced by `aria-describedby`.
|
|
74
|
+
- Use Tab and Shift+Tab at both dialog boundaries, Escape to close, and check focus returns to the current trigger after rendering.
|
|
75
|
+
- Add and edit, reload, then search, filter and paginate; check persistence and page reset.
|
|
76
|
+
- At a narrow viewport, check page overflow and table scrolling. Measure contrast separately; screenshots alone do not establish contrast compliance.
|
|
77
|
+
|
|
78
|
+
The example uses public field APIs and rod values. If a browser is unavailable, report these interactions as unverified rather than deriving them from pure-logic assertions.
|
package/dist/jsswift.js
CHANGED
|
@@ -21199,7 +21199,7 @@ transition: width 200ms ease;
|
|
|
21199
21199
|
"actions", "actionsLabel", "emptyText", "loadingText", "onRowClick", "onRowDblClick",
|
|
21200
21200
|
"tableClass", "tableStyle", "cardClass", "dense", "striped", "hover", "stickyHeader",
|
|
21201
21201
|
"toolbar", "toolbarStart", "toolbarEnd", "caption", "footer", "status", "rowClass", "rowAttrs",
|
|
21202
|
-
"minTableWidth", "hideHeader", "hideFooter", "slots", "body"
|
|
21202
|
+
"minTableWidth", "hideHeader", "hideFooter", "hideStatus", "slots", "body"
|
|
21203
21203
|
]);
|
|
21204
21204
|
wrapProps.class = uiClass(["cms-table-card", props.class, props.cardClass]);
|
|
21205
21205
|
if (props.dense != null) wrapProps.dense = props.dense;
|
|
@@ -21262,7 +21262,7 @@ transition: width 200ms ease;
|
|
|
21262
21262
|
statusSort,
|
|
21263
21263
|
...statusExtraNodes
|
|
21264
21264
|
);
|
|
21265
|
-
shell.appendChild(status);
|
|
21265
|
+
if (props.hideStatus !== true) shell.appendChild(status);
|
|
21266
21266
|
|
|
21267
21267
|
const captionNodes = renderSlotToArray(slots, "caption", {}, props.caption);
|
|
21268
21268
|
if (captionNodes.length) shell.appendChild(_.div({ class: "cms-table-caption" }, ...captionNodes));
|
package/dist/jsswift.min.js
CHANGED
|
@@ -31,4 +31,4 @@ background: var(--cms-primary);
|
|
|
31
31
|
transition: width 200ms ease;
|
|
32
32
|
`,s.appendChild(i);const c=document.createElement("div");c.style.cssText="display:flex; gap: 12px; align-items:center; width: 100%;",c.appendChild(e),c.appendChild(n),t.appendChild(c),t.appendChild(s),fn.appendChild(t),document.body.appendChild(fn);const w=document.createElement("style");return w.textContent=`
|
|
33
33
|
@keyframes cmsSpin { to { transform: rotate(360deg); } }
|
|
34
|
-
`,document.head.appendChild(w),fn._textNode=n,fn._spinner=e,fn._progressWrap=s,fn._progressBar=i,fn._progressActive=!1,fn}function ri(t,e){if(typeof t=="object"&&t!==null)return{...t};const n=e&&typeof e=="object"?e:{};return typeof e=="string"&&(t==null||typeof t=="number")?{...n,message:e}:{...n,message:t}}function ai(t,e){const n=e==="progress";t._spinner.style.display=n?"none":"",t._progressWrap.style.display=n?"block":"none",t._mode=e}bt.loading.show=function(t="Loading...",e={}){const n=li(),s=ri(t,e);Bs++,n._progressActive=!1,n._textNode.textContent=s.message||"Loading...",ai(n,"spinner"),s.spinner===!1&&(n._spinner.style.display="none"),n.style.display="flex"},bt.loading.hide=function(){fn&&(Bs=Math.max(0,Bs-1),Bs===0&&(fn.style.display="none",fn._progressActive=!1))},bt.loading.progress=function(t=0,e={}){var c;const n=li();typeof t=="object"&&t!==null&&(e=t,t=(c=t.value)!=null?c:0);const s=ri(null,e);n._progressActive||(Bs++,n._progressActive=!0);const i=Math.max(0,Math.min(100,Number(t!=null?t:0)));n._textNode.textContent=s.message||"Loading...",n._progressBar.style.width=i+"%",ai(n,"progress"),n.style.display="flex"},bt.loading.wrap=async function(t,e){bt.loading.show(t);try{return await e()}finally{bt.loading.hide()}};function el(t){return typeof t=="function"?t():t||[]}function Fo(t,e){if(!(t==null||e==null))return typeof e!="string"||e.indexOf(".")<0?t==null?void 0:t[e]:e.split(".").reduce((n,s)=>n==null?n:n[s],t)}function tl(t,e){return t==null&&e==null?0:t==null?-1:e==null?1:typeof t=="number"&&typeof e=="number"?t-e:String(t).localeCompare(String(e),void 0,{numeric:!0,sensitivity:"base"})}function nl(t){const e=el(t);return Array.isArray(e)?e:[]}function ci(t){var e,n,s,i;return(i=(s=(n=(e=t==null?void 0:t.label)!=null?e:t==null?void 0:t.title)!=null?n:t==null?void 0:t.header)!=null?s:t==null?void 0:t.key)!=null?i:""}function Do(t,e){var n,s;return(s=(n=t==null?void 0:t.sortKey)!=null?n:t==null?void 0:t.key)!=null?s:`__col_${e}`}function ui(t,e){return t.find((n,s)=>Do(n,s)===e||(n==null?void 0:n.key)===e)||null}function So(t,e,n){return t?typeof t.get=="function"?t.get(e,{row:e,rowIndex:n,col:t}):typeof t.value=="function"?t.value(e,{row:e,rowIndex:n,col:t}):typeof t.key=="string"?Fo(e,t.key):t.key!=null?e==null?void 0:e[t.key]:e:e}function Co(t,e){return typeof t=="function"?t(e)||{}:t||{}}function xo(t){if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.map(xo).filter(Boolean).join(" ");if(typeof Node!="undefined"&&t instanceof Node)return t.textContent||"";if(typeof t=="object"){if(typeof t.textContent=="string")return t.textContent;try{return JSON.stringify(t)}catch(e){return""}}return String(t)}function sl(t,e){const s=(Array.isArray(t)?t:e).map(i=>Number(i)).filter(i=>Number.isFinite(i)&&i>0);return s.length?Array.from(new Set(s)):e}function ol(t,e,n,s){const i=s.searchBy||s.searchPredicate;if(typeof i=="function")return!!i(t,{query:n,columns:e});const c=String(n||"").trim().toLowerCase().split(/\s+/).filter(Boolean);if(!c.length)return!0;const w=Array.isArray(s.searchKeys)&&s.searchKeys.length?s.searchKeys:e.filter(b=>(b==null?void 0:b.searchable)!==!1).map(b=>{var O;return(O=b==null?void 0:b.searchKey)!=null?O:b==null?void 0:b.key}).filter(Boolean),d=[];if(w.length)for(const b of w)if(typeof b=="function")d.push(xo(b(t)));else{const O=e.find(C=>(C==null?void 0:C.key)===b||(C==null?void 0:C.searchKey)===b);d.push(xo(O?So(O,t,-1):Fo(t,b)))}else d.push(xo(t));const r=d.join(" ").toLowerCase();return c.every(b=>r.includes(b))}Ne.Table=(...t)=>{var He,ae,$e,Ee;const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=Array.isArray(e.columns)?e.columns:[],c=sl(e.pageSizeOptions,[5,10,20,50]),w=Number((ae=(He=e.pageSize)!=null?He:c[0])!=null?ae:10)||10,d=Array.from(new Set([...c,w])).sort((De,Ie)=>De-Ie),r=e.initialSort||(e.sortBy?{key:e.sortBy,dir:e.sortDir==="desc"?"desc":"asc"}:null),b=e.searchable===!0||typeof e.searchable=="string"||e.searchPlaceholder!=null||e.search!=null||e.query!=null||!!e.searchModel||!!e.queryModel||Array.isArray(e.searchKeys)||typeof e.searchBy=="function"||typeof e.searchPredicate=="function",O=en(e.searchModel||e.queryModel,"UI.Table:query"),[C,v]=bt.reactive.signal(Math.max(1,Number(e.page||1)||1)),[T,le]=bt.reactive.signal(w),[Z,he]=bt.reactive.signal(r),[H,W]=bt.reactive.signal(String((Ee=O?O.get():($e=e.search)!=null?$e:e.query)!=null?Ee:"")),se=De=>{const Ie=String(De!=null?De:"");W(Ie),O&&O.set(Ie),v(1)},X=De=>{const Ie=Number(De)||w;le(Ie),v(1)},de=(De,Ie)=>{const qe=Do(De,Ie),Be=Z();!Be||Be.key!==qe&&Be.key!==(De==null?void 0:De.key)?he({key:qe,dir:"asc"}):Be.dir==="asc"?he({key:qe,dir:"desc"}):he(null),v(1)};let _e=null;O&&O.watch(De=>{const Ie=String(De!=null?De:"");W(Ie),_e&&_e.value!==Ie&&(_e.value=Ie),v(1)},"UI.Table:queryWatch");const be=JSswift.omit(e,["columns","rows","rowKey","loading","page","pageSize","pageSizeOptions","pagination","initialSort","sortBy","sortDir","search","query","searchable","searchPlaceholder","searchKeys","searchBy","searchPredicate","searchModel","queryModel","filter","actions","actionsLabel","emptyText","loadingText","onRowClick","onRowDblClick","tableClass","tableStyle","cardClass","dense","striped","hover","stickyHeader","toolbar","toolbarStart","toolbarEnd","caption","footer","status","rowClass","rowAttrs","minTableWidth","hideHeader","hideFooter","slots","body"]);be.class=te(["cms-table-card",e.class,e.cardClass]),e.dense!=null&&(be.dense=e.dense);const me=_.div({class:"cms-table-shell"}),fe=J(s,"default",{},n);fe.length&&me.appendChild(_.div({class:"cms-table-lead"},...fe));const ce=J(s,"toolbarStart",{},e.toolbarStart),$=J(s,"toolbar",{},e.toolbar),re=J(s,"toolbarEnd",{},e.toolbarEnd),oe=_.div({class:"cms-table-toolbar"}),Se=_.div({class:"cms-table-toolbar-main"}),F=_.div({class:"cms-table-toolbar-side"});ce.forEach(De=>Se.appendChild(De)),$.forEach(De=>Se.appendChild(De));const p=J(s,"search",{query:H(),getQuery:H,setQuery:se},null);if(p.length)p.forEach(De=>F.appendChild(De));else if(b){_e=_.input({type:"search",class:"cms-input",placeholder:typeof e.searchable=="string"?e.searchable:e.searchPlaceholder||"Cerca nella tabella",value:String(H()||"")}),_e.addEventListener("input",()=>se(_e.value));const De=Ne.Btn({class:"cms-table-search-clear",outline:!0,onClick:()=>{_e&&(_e.value=""),se("")}},"Reset");F.appendChild(_.div({class:"cms-singularity cms-table-search"},_.span({class:"cms-table-search-icon","aria-hidden":"true"},"\u2315"),_e,De))}re.forEach(De=>F.appendChild(De)),(Se.childNodes.length||F.childNodes.length)&&(oe.appendChild(Se),oe.appendChild(F),me.appendChild(oe));const f=_.div({class:"cms-singularity cms-table-chip"},""),h=_.div({class:"cms-singularity cms-table-chip"},""),B=_.div({class:"cms-singularity cms-table-chip"},""),ie=J(s,"status",{},e.status),a=_.div({class:"cms-table-status"},f,h,B,...ie);me.appendChild(a);const x=J(s,"caption",{},e.caption);x.length&&me.appendChild(_.div({class:"cms-table-caption"},...x));const g=_.thead(),P=_.tbody(),q=!!e.actions||!!s.actions,Q=te(["cms-table",ye(e.dense,"dense"),ye(e.striped,"striped"),ye(e.hover!==!1,"hover"),ye(e.stickyHeader!==!1,"sticky-head"),e.tableClass]),ve={...e.tableStyle||{}};e.minTableWidth!=null&&(ve["--cms-table-min-width"]=yt(e.minTableWidth));const E=_.table({class:Q,style:ve},g,P),m=_.div({class:"cms-singularity cms-table-wrap"},E);me.appendChild(m);const N=_.div({class:"cms-singularity cms-table-chip"},""),I=_.div({class:"cms-singularity cms-table-chip"},""),K=Ne.Btn({outline:!0,onClick:()=>v(Math.max(1,C()-1))},"\u2039"),ke=Ne.Btn({outline:!0,onClick:()=>v(C()+1)},"\u203A"),Oe=_.div({class:"cms-singularity cms-table-chip"},""),Te=_.select({class:"cms-input cms-table-size-select"},...d.map(De=>xs({value:String(De)},String(De))));Te.value=String(T()),Te.addEventListener("change",()=>X(Te.value));const U=J(s,"footer",{},e.footer),j=_.div({class:"cms-table-foot"},_.div({class:"cms-table-foot-main"},N,I,_.label({class:"cms-table-size"},_.span("Righe"),Te)),_.div({class:"cms-table-foot-extra"},...U,_.div({class:"cms-table-pager"},K,Oe,ke)));e.hideFooter!==!0&&me.appendChild(j);const ne=()=>{if(g.innerHTML="",e.hideHeader)return;const De=_.tr();if(i.forEach((Ie,qe)=>{var xe,Ue;const Be={col:Ie,colIndex:qe,sort:Z()},z={...Co(Ie==null?void 0:Ie.style,{...Be,header:!0}),...Co((xe=Ie==null?void 0:Ie.headerStyle)!=null?xe:Ie==null?void 0:Ie.thStyle,{...Be,header:!0})};(Ie==null?void 0:Ie.width)!=null&&(z.width=yt(Ie.width)),(Ie==null?void 0:Ie.minWidth)!=null&&(z.minWidth=yt(Ie.minWidth)),(Ie==null?void 0:Ie.maxWidth)!=null&&(z.maxWidth=yt(Ie.maxWidth)),Ie!=null&&Ie.align&&(z.textAlign=Ie.align);let Pe=J(Ie==null?void 0:Ie.slots,"header",Be,null);if(!Pe.length){const et=typeof(Ie==null?void 0:Ie.header)=="function"?Ie.header(Be):(Ue=Ie==null?void 0:Ie.header)!=null?Ue:ci(Ie);Pe=J(s,"header",Be,et)}const M=Z(),k=Do(Ie,qe),S=(Ie==null?void 0:Ie.sortable)!==!1&&((Ie==null?void 0:Ie.key)!=null||typeof(Ie==null?void 0:Ie.get)=="function"||typeof(Ie==null?void 0:Ie.compare)=="function"),u=!!M&&(M.key===k||M.key===(Ie==null?void 0:Ie.key)),A=_.th({class:te(["cms-table-head-cell",ye(Ie==null?void 0:Ie.nowrap,"is-nowrap"),ye(S,"cms-table-sortable"),ye(u,"is-sorted"),Ie==null?void 0:Ie.headerClass]),style:z});S?A.appendChild(_.button({type:"button",class:"cms-table-head-button",onClick:()=>de(Ie,qe)},_.span({class:"cms-table-head-label"},...Pe),_.span({class:"cms-table-head-arrow","aria-hidden":"true"},u?M.dir==="asc"?"\u2191":"\u2193":"\u2195"))):Pe.forEach(et=>A.appendChild(et)),De.appendChild(A)}),q){const Ie=J(s,"actionsHeader",{},e.actionsLabel||"Azioni");De.appendChild(_.th({class:"cms-table-head-cell cms-table-head-actions",style:{textAlign:"right"}},...Ie))}g.appendChild(De)},Ve=(De,Ie)=>{const qe={columns:i,count:i.length},Be=J(s,De,qe,Ie),z=String(i.length+(q?1:0));P.appendChild(_.tr(_.td({colSpan:z,class:"cms-table-state"},...Be)))};return bt.reactive.effect(()=>{const De=nl(e.rows),Ie=String(H()||"").trim(),qe=Z(),Be=typeof e.loading=="function"?!!e.loading():!!e.loading,z=e.pagination!==!1;if(ne(),P.innerHTML="",_e&&_e.value!==H()&&(_e.value=H()),Te.value!==String(T())&&(Te.value=String(T())),Be){f.textContent="Caricamento in corso",h.style.display="none",B.style.display="none",N.textContent="Loading\u2026",I.textContent="",Oe.textContent="Pagina 1",K.disabled=!0,ke.disabled=!0,Ve("loading",e.loadingText||"Loading...");return}let Pe=De.slice();const M=Pe.length;if(typeof e.filter=="function"&&(Pe=Pe.filter((G,Ge)=>e.filter(G,{row:G,index:Ge,query:Ie,rows:De,columns:i}))),Ie&&(Pe=Pe.filter(G=>ol(G,i,Ie,e))),qe){const G=ui(i,qe.key);G&&Pe.sort((Ge,lt)=>{const tt=So(G,Ge,-1),dt=So(G,lt,-1),St=typeof G.compare=="function"?G.compare(tt,dt,Ge,lt):tl(tt,dt);return qe.dir==="asc"?St:-St})}const k=Pe.length,S=Math.max(1,Number(T())||w),u=z?Math.max(1,Math.ceil(k/S)):1,A=z?Math.min(C(),u):1;A!==C()&&v(A);const xe=z?(A-1)*S:0,Ue=z?xe+S:k,et=Pe.slice(xe,Ue);if(f.textContent=k===M?`${k} righe`:`${k} di ${M} righe`,h.textContent=Ie?`Ricerca: ${Ie}`:"",h.style.display=Ie?"":"none",qe){const G=ui(i,qe.key);B.textContent=G?`Ordine: ${ci(G)} ${qe.dir==="asc"?"\u2191":"\u2193"}`:"",B.style.display=G?"":"none"}else B.style.display="none";if(N.textContent=k?`${xe+1}-${Math.min(Ue,k)} di ${k}`:"0 risultati",I.textContent=k!==M?`Dataset totale ${M}`:`Page size ${S}`,Oe.textContent=z?`Pagina ${A} / ${u}`:"Tutte le righe",K.disabled=!z||A<=1,ke.disabled=!z||A>=u,Te.disabled=!z,Te.parentNode.style.display=z?"":"none",et.length===0){Ve("empty",e.emptyText||"Nessun dato");return}for(let G=0;G<et.length;G++){const Ge=et[G],lt=xe+G,tt={row:Ge,rowIndex:lt,pageIndex:G},dt=typeof e.rowAttrs=="function"?e.rowAttrs(Ge,tt)||{}:e.rowAttrs||{},St=typeof e.rowClass=="function"?e.rowClass(Ge,tt):e.rowClass,It=!!(e.onRowClick||e.onRowDblClick),Rt=_.tr({...dt,class:te(["cms-table-row",St,dt.class,ye(It,"is-clickable")])});if(e.rowKey){const st=typeof e.rowKey=="function"?e.rowKey(Ge,tt):Fo(Ge,e.rowKey);st!=null&&(Rt.dataset.key=String(st))}const Pt=st=>{const wt=st==null?void 0:st.target;return!!(wt&&wt.closest&&wt.closest("button, a, input, select, textarea, label, [data-table-action]"))};if(e.onRowClick&&Rt.addEventListener("click",st=>{Pt(st)||e.onRowClick(Ge,tt,st)}),e.onRowDblClick&&Rt.addEventListener("dblclick",st=>{Pt(st)||e.onRowDblClick(Ge,tt,st)}),i.forEach((st,wt)=>{var Qt,an;const Ft=So(st,Ge,lt),Dt={...tt,col:st,colIndex:wt,value:Ft},Yt={...Co(st==null?void 0:st.style,Dt),...Co((Qt=st==null?void 0:st.cellStyle)!=null?Qt:st==null?void 0:st.tdStyle,Dt)};st!=null&&st.align&&(Yt.textAlign=st.align),(st==null?void 0:st.width)!=null&&(Yt.width=yt(st.width)),(st==null?void 0:st.minWidth)!=null&&(Yt.minWidth=yt(st.minWidth)),(st==null?void 0:st.maxWidth)!=null&&(Yt.maxWidth=yt(st.maxWidth));const Xt=typeof(st==null?void 0:st.cellClass)=="function"?st.cellClass(Ge,Dt):(st==null?void 0:st.cellClass)||(st==null?void 0:st.class),on=_.td({class:te(["cms-table-cell",Xt,ye(st==null?void 0:st.nowrap,"is-nowrap")]),style:Yt});let jt=J(st==null?void 0:st.slots,"cell",Dt,null);if(!jt.length){const mn=typeof(st==null?void 0:st.render)=="function"?st.render(Ge,Dt):typeof(st==null?void 0:st.format)=="function"?st.format(Ft,Ge,Dt):Ft,Gt=mn==null?(an=st==null?void 0:st.emptyText)!=null?an:"":mn;jt=J(s,"cell",Dt,Gt)}jt.length||(jt=[""]),jt.forEach(mn=>on.appendChild(mn)),Rt.appendChild(on)}),q){const st={...tt},wt=typeof e.actions=="function"?e.actions(Ge,tt):e.actions;let Ft=J(s,"actions",st,wt);Ft.length||(Ft=J(null,"default",st,wt)),Rt.appendChild(_.td({class:"cms-table-cell cms-table-cell-actions",style:{textAlign:"right"}},_.div({class:"cms-table-actions"},...Ft)))}P.appendChild(Rt)}},"UI.Table:render"),be.body=me,Ne.Card(be)},Ne.Menu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(m,N)=>Object.prototype.hasOwnProperty.call(m||{},N),T=(m,N)=>typeof m=="function"?m(N):m,le=m=>String(m||"").split(/\s+/).filter(Boolean),Z=m=>m&&typeof m=="object"&&!m.nodeType&&!Array.isArray(m)&&!(m instanceof Function),he=m=>!!m&&typeof m=="object"&&(m.nodeType===1||typeof m.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(m,N,I)=>{if(!m)return;const K=m[N]||[];K.length&&m.classList.remove(...K);const ke=(I||[]).filter(Boolean);ke.length&&m.classList.add(...ke),m[N]=ke},se=(m,N,I,K=ke=>ke)=>{if(m){if(I==null||I===""){m.style.removeProperty(N);return}m.style.setProperty(N,K(I))}},X=()=>w||{},de=m=>{var I;const N=String(o((I=m.state)!=null?I:m.color)||"").toLowerCase();return i.includes(N)?N:""},_e=m=>{const N=String(o(m.size)||"").toLowerCase();return c.includes(N)?N:""},be=m=>{var N,I;return String(o((I=(N=m.placement)!=null?N:m.position)!=null?I:"bottom-start"))},me=()=>{var I;const m=o((I=X().delay)!=null?I:X().showDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):0},fe=()=>{const m=o(X().hideDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):80},ce=(m=null)=>{var I,K,ke;if(m)return m;const N=X();return r||o((ke=(K=(I=N.anchorEl)!=null?I:N.triggerEl)!=null?K:N.target)!=null?ke:N.anchor)||null},$=m=>{if(m==null||m===!0)return new Set(["click"]);if(m===!1)return new Set(["manual"]);const N=Array.isArray(m)?m:String(m).split(/[\s,|/]+/),I=new Set;return N.forEach(K=>{const ke=String(K||"").trim().toLowerCase();ke&&(ke==="mouseenter"||ke==="mouseover"?I.add("hover"):ke==="blur"||ke==="focusin"?I.add("focus"):ke==="tap"?I.add("click"):I.add(ke))}),I.size?I:new Set(["manual"])},re=(m,N)=>{var ke,Oe,Te;let I=null,K=null;if(he(m))I=m,Z(N)&&(K=N);else if(Z(m)){K=m;const U=(Te=(Oe=(ke=m.anchorEl)!=null?ke:m.triggerEl)!=null?Oe:m.target)!=null?Te:m.anchor;he(U)&&(I=U)}else m!=null&&(I=m);return{anchorEl:I,nextProps:K}},oe=(m=d==null?void 0:d.panel)=>{var N;return Array.from(((N=m==null?void 0:m.querySelectorAll)==null?void 0:N.call(m,"[data-menu-item]:not([disabled]):not([tabindex='-1']), .cms-menu-item:not([disabled]):not([tabindex='-1']), [role='menuitem']:not([disabled]):not([tabindex='-1']), a[href]:not([tabindex='-1']), button:not([disabled]):not([tabindex='-1'])"))||[]).filter(I=>I.offsetParent!==null&&I.getAttribute("aria-hidden")!=="true")},Se=()=>{o(X().autoFocus)!==!1&&setTimeout(()=>{const m=oe();if(!m.length)return;(m.find(I=>I.classList.contains("is-active")||I.classList.contains("is-selected")||I.classList.contains("is-checked"))||m[0]).focus()},0)},F=(m,N,I="sm")=>{const K=T(m,N);return K==null?[]:typeof K=="string"?[Ne.Icon({name:K,size:I})]:Vs(K,{...N,as:"icon"})},p=(m,N)=>{var xe,Ue,et,G,Ge,lt,tt,dt,St,It,Rt,Pt,st;const I=T(m,N);if(I==null||I===!1)return[];if(Array.isArray(I))return I.flatMap((wt,Ft)=>p(wt,{...N,index:Ft}));if(typeof I=="function")return p(I(N),N);if(I!=null&&I.nodeType)return[I];if(typeof I=="string"||typeof I=="number")return p({label:I},N);if(!Z(I))return Vs(I,{...N,as:"item"});const K=String((Ue=(xe=I.type)!=null?xe:I.kind)!=null?Ue:"").toLowerCase();if(K==="separator"||K==="divider"||I.separator===!0||I.divider===!0)return[_.div({class:"cms-menu-divider",role:"separator"})];const ke=(et=I.items)!=null?et:I.children;if((K==="group"||K==="section"||Array.isArray(ke))&&ke!=null){const wt={...N,item:I},Ft=J(s,"groupLabel",wt,T((G=I.label)!=null?G:I.title,wt)),Dt=p(ke,wt);return Dt.length?[_.div({class:te(["cms-menu-group",I.class])},Ft.length?_.div({class:"cms-menu-group-label"},...Ft):null,_.div({class:"cms-menu-group-items"},...Dt))]:[]}const Oe={...N,item:I,close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:X()},Te=!!o(I.disabled),U=I.checked==null?null:!!o(I.checked),j=!!o((Ge=I.active)!=null?Ge:I.selected),ne=de(I),Ve=o(I.href),He=o(I.to),ae=v(I,"closeOnSelect")?!!o(I.closeOnSelect):I.keepOpen===!0?!1:X().closeOnSelect!==!1,$e=I.role||(U!=null?"menuitemcheckbox":"menuitem"),Ee=F(I.icon,Oe),De=F((lt=I.iconRight)!=null?lt:I.endIcon,Oe),Ie=J(s,"itemTitle",Oe,T((tt=I.title)!=null?tt:I.label,Oe)),qe=J(s,"itemSubtitle",Oe,T((dt=I.subtitle)!=null?dt:I.description,Oe)),Be=J(s,"itemShortcut",Oe,T(I.shortcut,Oe)),z=J(s,"itemBadge",Oe,T(I.badge,Oe)),Pe=J(s,"item",Oe,T((It=(St=I.content)!=null?St:I.body)!=null?It:I.render,Oe)),M=[...z,...Be,...U===!0&&!De.length&&!z.length?[_.span({class:"cms-menu-entry-check"},Ne.Icon({name:I.checkedIcon||"check",size:"sm"}))]:[],...De],S={class:te(["cms-menu-entry","cms-menu-item",ne?`cms-state-${ne}`:"",ye(j,"is-active"),ye(U===!0,"is-checked"),ye(Te,"is-disabled"),I.class]),role:$e,tabIndex:Te?-1:(Rt=I.tabIndex)!=null?Rt:-1,"data-menu-item":!0,"data-menu-select":ae?"true":"false","data-menu-close":I.close===!0?"true":null,"data-menu-keep-open":ae?null:"true","aria-disabled":Te?"true":null,"aria-checked":U==null?null:String(U),title:(st=(Pt=I.titleAttr)!=null?Pt:I.tooltip)!=null?st:null,type:Ve?null:"button",href:Ve||null,target:I.target||null,rel:I.rel||(I.target==="_blank"?"noopener noreferrer":null),onClick:wt=>{var Dt,Yt,Xt,on;if(Te){wt.preventDefault(),wt.stopPropagation();return}(Yt=(Dt=X()).onItemClick)==null||Yt.call(Dt,I,Oe,wt);const Ft=(Xt=I.onClick)==null?void 0:Xt.call(I,Oe,wt);wt.defaultPrevented||(He&&((on=JSswift.router)!=null&&on.navigate)&&(wt.preventDefault(),JSswift.router.navigate(He)),Ft!==!1&&ae&&ie())}};I.attrs&&typeof I.attrs=="object"&&Object.assign(S,I.attrs);const u=Ve?_.a:_.button,A=Pe.length?Pe:[Ie.length?_.div({class:"cms-menu-entry-title"},...Ie):null,qe.length?_.div({class:"cms-menu-entry-subtitle"},...qe):null].filter(Boolean);return[u(S,Ee.length?_.span({class:"cms-menu-entry-icon"},...Ee):null,_.span({class:"cms-menu-entry-main"},...A),M.length?_.span({class:"cms-menu-entry-aside"},...M):null)]},f=()=>{var Ie,qe,Be,z,Pe,M,k;const m=X(),N={close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:m},I=F(m.icon,N,m.iconSize||"md"),K=J(s,"eyebrow",N,T(m.eyebrow,N)),ke=J(s,"title",N,T((qe=(Ie=m.title)!=null?Ie:m.heading)!=null?qe:m.label,N)),Oe=J(s,"subtitle",N,T((Be=m.subtitle)!=null?Be:m.description,N)),Te=J(s,"before",N,T(m.before,N)),U=J(s,"header",N,T(m.header,N)),j=J(s,"after",N,T(m.after,N)),ne=J(s,"footer",N,T(m.footer,N)),Ve=J(s,"status",N,T(m.status,N));let He=(z=m.content)!=null?z:m.body;He==null&&n&&n.length&&(He=n);let ae=J(s,"content",N,T(He,N));ae.length||(ae=J(s,"body",N,T(He,N))),ae.length||(ae=J(s,"default",N,T(He,N)));const $e=p((M=(Pe=m.items)!=null?Pe:m.actionsList)!=null?M:m.entries,N),Ee=$e.length?[]:J(s,"empty",N,T((k=m.empty)!=null?k:m.emptyText,N));let De=null;return U.length?De=_.div({class:te(["cms-menu-head","cms-menu-head-custom",m.headerClass])},...U):(I.length||K.length||ke.length||Oe.length)&&(De=_.div({class:te(["cms-menu-head",m.headerClass])},I.length?_.div({class:"cms-menu-head-icon"},...I):null,_.div({class:"cms-menu-head-main"},K.length?_.div({class:"cms-menu-eyebrow"},...K):null,ke.length?_.div({class:"cms-menu-title"},...ke):null,Oe.length?_.div({class:"cms-menu-subtitle"},...Oe):null))),_.div({class:te(["cms-menu","cms-menu-shell",ye(m.dense,"dense"),ye($e.length>0,"has-items"),ye(ne.length>0||Ve.length>0,"has-footer"),m.class]),style:m.style||{},role:m.role||"menu","aria-label":m.ariaLabel||null},Te.length?_.div({class:"cms-menu-before"},...Te):null,De,ae.length?_.div({class:te(["cms-menu-content",m.contentClass])},...ae):null,$e.length?_.div({class:te(["cms-menu-items",m.itemsClass])},...$e):null,!$e.length&&Ee.length?_.div({class:"cms-menu-empty"},...Ee):null,j.length?_.div({class:"cms-menu-after"},...j):null,Ve.length||ne.length?_.div({class:te(["cms-menu-footer",m.footerClass])},Ve.length?_.div({class:"cms-menu-status"},...Ve):null,ne.length?_.div({class:"cms-menu-footer-actions"},...ne):null):null)},h=m=>{var ke;if(!(m!=null&&m.panel))return;const N=X(),I=de(N),K=_e(N);W(m.panel,"_menuClassTokens",["cms-menu-panel","cms-clear-set","cms-singularity",K?`cms-menu-${K}`:"",I?`cms-state-${I}`:"",o(N.outline)?"outline":"",...le(N.panelClass)]),W(m.overlay,"_menuOverlayClassTokens",[...le(N.overlayClass)]),m.panel.dataset.placement=be(N),se(m.panel,"--cms-menu-width",o(N.width),yt),se(m.panel,"--cms-menu-min-width",o(N.minWidth),yt),se(m.panel,"--cms-menu-max-width",o(N.maxWidth),yt),se(m.panel,"--cms-menu-max-height",o(N.maxHeight),yt),se(m.panel,"--cms-menu-body-max-height",o((ke=N.bodyMaxHeight)!=null?ke:N.contentMaxHeight),yt),N.panelStyle&&Object.assign(m.panel.style,N.panelStyle),Nt(m.panel,N)},B=()=>{d!=null&&d.panel&&d.panel.replaceChildren(f())},ie=()=>{if(H(),!d)return;const m=d;d=null,ks(m,()=>JSswift.overlay.close(m.id))},a=(m={})=>{var N,I,K,ke;if(m&&typeof m=="object"&&(w={...w,...m}),d){const Oe=X();h(d),B(),(ke=d.reposition)==null||ke.call(d,{anchorEl:d._anchorEl,placement:be(Oe),offsetX:(N=Oe.offsetX)!=null?N:0,offsetY:(K=(I=Oe.offsetY)!=null?I:Oe.offset)!=null?K:8}),Se()}return E},x=(m=null,N=null)=>{var De,Ie,qe,Be,z,Pe,M,k,S,u,A,xe,Ue,et,G,Ge;H();const{anchorEl:I,nextProps:K}=re(m,N);K&&(w={...w,...K});const ke=X(),Oe=ce(I);if(!Oe||o(ke.disabled))return null;if(d&&d._anchorEl===Oe){const lt=X();return h(d),B(),(Be=d.reposition)==null||Be.call(d,{anchorEl:d._anchorEl,placement:be(lt),offsetX:(De=lt.offsetX)!=null?De:0,offsetY:(qe=(Ie=lt.offsetY)!=null?Ie:lt.offset)!=null?qe:8}),Se(),d}d&&ie(),b=document.activeElement;let Te=null;if(d=JSswift.overlay.open(()=>f(),{type:"menu",anchorEl:Oe,placement:be(ke),offsetX:(z=ke.offsetX)!=null?z:0,offsetY:(M=(Pe=ke.offsetY)!=null?Pe:ke.offset)!=null?M:8,backdrop:ke.backdrop===!0,lockScroll:ke.lockScroll===!0,trapFocus:ke.trapFocus===!0,autoFocus:!1,closeOnOutside:ke.closeOnOutside!==!1,closeOnBackdrop:(k=ke.closeOnBackdrop)!=null?k:ke.backdrop===!0,closeOnEsc:ke.closeOnEsc!==!1,className:qt(["cms-menu-panel"]),onClose:()=>{var lt,tt,dt;(lt=Te==null?void 0:Te._menuCleanup)==null||lt.call(Te),(dt=(tt=X()).onClose)==null||dt.call(tt,Te),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const U=d;Te=U,U._anchorEl=Oe;const j=()=>{clearTimeout(C),C=null},ne=()=>{P()},Ve=lt=>{const tt=lt.target;if(!tt||!tt.closest)return;if(tt.closest("[data-menu-close]")){ie();return}if(X().closeOnSelect===!1)return;const dt=tt.closest("[data-menu-item], [data-menu-select], .cms-menu-item, [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], a[href], button:not([disabled])");dt&&(dt.closest("[data-menu-keep-open]")||dt.getAttribute("data-menu-select")!=="false"&&ie())},He=lt=>{if(lt.key==="Escape"){lt.preventDefault(),ie();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(lt.key))return;const tt=oe(U.panel);if(!tt.length)return;lt.preventDefault();const dt=tt.indexOf(document.activeElement);if(lt.key==="Home"){tt[0].focus();return}if(lt.key==="End"){tt[tt.length-1].focus();return}const St=lt.key==="ArrowDown"?1:-1,It=dt<0?St>0?0:tt.length-1:(dt+St+tt.length)%tt.length;tt[It].focus()};U.panel.addEventListener("click",Ve),U.panel.addEventListener("keydown",He);const ae=$((u=(S=ke.trigger)!=null?S:ke.triggers)!=null?u:v(ke,"open")?"manual":null),$e=ae.has("hover"),Ee=ae.has("focus");return($e||Ee)&&(U.panel.addEventListener("mouseenter",j),U.panel.addEventListener("mouseleave",ne),U.panel.addEventListener("focusin",j),U.panel.addEventListener("focusout",ne)),U._menuCleanup=()=>{var lt,tt,dt,St,It,Rt;(lt=U.panel)==null||lt.removeEventListener("click",Ve),(tt=U.panel)==null||tt.removeEventListener("keydown",He),(dt=U.panel)==null||dt.removeEventListener("mouseenter",j),(St=U.panel)==null||St.removeEventListener("mouseleave",ne),(It=U.panel)==null||It.removeEventListener("focusin",j),(Rt=U.panel)==null||Rt.removeEventListener("focusout",ne)},h(U),(et=U.reposition)==null||et.call(U,{anchorEl:Oe,placement:be(ke),offsetX:(A=ke.offsetX)!=null?A:0,offsetY:(Ue=(xe=ke.offsetY)!=null?xe:ke.offset)!=null?Ue:8}),_s(U),(Ge=(G=X()).onOpen)==null||Ge.call(G,U),Se(),U},g=(m,N=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>x(m,N),me())},P=(m=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),m){ie();return}C=setTimeout(()=>ie(),fe())}},q=(m=null,N=null)=>Q()?(ie(),null):x(m,N),Q=()=>!!d,E={open:x,close:ie,show:g,hide:P,toggle:q,update:a,bind:m=>{var ne,Ve;if(!m)return()=>{};r=m;const N=X(),I=$((Ve=(ne=N.trigger)!=null?ne:N.triggers)!=null?Ve:v(N,"open")?"manual":null),K=I.has("hover"),ke=I.has("focus"),Oe=I.has("click"),Te=I.has("manual")||!K&&!ke&&!Oe,U=[],j=()=>{H(),U.forEach(He=>He()),r===m&&(r=null)};if(v(N,"open"))return Ye(N.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?x(r):P(!0))},"UI.Menu:open"):N.open===!0?x(m):N.open===!1&&P(!0),j;if(Te||o(N.disabled))return j;if(K){const He=()=>g(m),ae=()=>P();m.addEventListener("mouseenter",He),m.addEventListener("mouseleave",ae),U.push(()=>{m.removeEventListener("mouseenter",He),m.removeEventListener("mouseleave",ae)})}if(ke){const He=()=>g(m),ae=()=>P();m.addEventListener("focus",He),m.addEventListener("blur",ae),U.push(()=>{m.removeEventListener("focus",He),m.removeEventListener("blur",ae)})}if(Oe){const He=ae=>{var $e,Ee;(Ee=($e=X()).onTriggerClick)==null||Ee.call($e,ae),!ae.defaultPrevented&&q(m)};m.addEventListener("click",He),U.push(()=>m.removeEventListener("click",He))}return j},isOpen:Q,entry:()=>d,props:()=>({...w})};return E},Ne.Popover=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(E,m)=>Object.prototype.hasOwnProperty.call(E||{},m),T=(E,m)=>typeof E=="function"?E(m):E,le=E=>String(E||"").split(/\s+/).filter(Boolean),Z=E=>E&&typeof E=="object"&&!E.nodeType&&!Array.isArray(E)&&!(E instanceof Function),he=E=>!!E&&typeof E=="object"&&(E.nodeType===1||typeof E.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(E,m,N)=>{if(!E)return;const I=E[m]||[];I.length&&E.classList.remove(...I);const K=(N||[]).filter(Boolean);K.length&&E.classList.add(...K),E[m]=K},se=(E,m,N,I=K=>K)=>{if(E){if(N==null||N===""){E.style.removeProperty(m);return}E.style.setProperty(m,I(N))}},X=()=>w,de=E=>{var N;const m=o((N=E.state)!=null?N:E.color);return m?i.includes(m)?m:String(m):""},_e=E=>{const m=o(E.size);return typeof m=="string"&&c.includes(m)?m:""},be=E=>{var N,I,K;const m=String(o((K=(I=(N=E.actionsAlign)!=null?N:E.footerAlign)!=null?I:E.alignActions)!=null?K:"end")).toLowerCase();return["start","left"].includes(m)?"start":["center","middle"].includes(m)?"center":["between","space-between"].includes(m)?"between":["stretch","full"].includes(m)?"stretch":"end"},me=E=>{var m,N;return String(o((N=(m=E.placement)!=null?m:E.position)!=null?N:"bottom-start"))},fe=(E,m)=>{const N=o(E);if(N==null||N==="")return m;const I=Number(N);return Number.isFinite(I)?I:m},ce=()=>fe(X().delay,0),$=()=>fe(X().hideDelay,120),re=E=>{var N,I;return((I=(N=E.closable)!=null?N:E.dismissible)!=null?I:E.closeButton)===!0},oe=(E=null)=>{var N,I,K;if(E)return E;const m=X();return r||o((K=(I=(N=m.anchorEl)!=null?N:m.triggerEl)!=null?I:m.target)!=null?K:m.anchor)||null},Se=E=>{if(E==null||E===!0)return new Set(["click"]);if(E===!1)return new Set(["manual"]);const m=Array.isArray(E)?E:String(E).split(/[\s,|/]+/),N=new Set;return m.forEach(I=>{const K=String(I||"").trim().toLowerCase();K&&(K==="mouseenter"||K==="mouseover"?N.add("hover"):K==="blur"||K==="focusin"?N.add("focus"):K==="tap"?N.add("click"):N.add(K))}),N.size?N:new Set(["manual"])},F=(E,m)=>{var K,ke,Oe;let N=null,I=null;if(he(E))N=E,Z(m)&&(I=m);else if(Z(E)){I=E;const Te=(Oe=(ke=(K=E.anchorEl)!=null?K:E.triggerEl)!=null?ke:E.target)!=null?Oe:E.anchor;he(Te)&&(N=Te)}else E!=null&&(N=E);return{anchorEl:N,nextProps:I}},p=()=>{var Ee,De,Ie,qe,Be,z,Pe,M,k;const E=X(),m={close:B,dismiss:B,open:a,toggle:P,update:ie,isOpen:q,entry:()=>d,anchorEl:oe(),props:E},N=E.icon!=null?typeof E.icon=="string"?Ne.Icon({name:E.icon,size:E.iconSize||"md"}):JSswift.ui.slot(E.icon,{as:"icon"}):null,I=J(s,"eyebrow",m,T(E.eyebrow,m)),K=J(s,"title",m,T((De=(Ee=E.title)!=null?Ee:E.heading)!=null?De:E.label,m)),ke=J(s,"subtitle",m,T((Ie=E.subtitle)!=null?Ie:E.description,m)),Oe=J(s,"icon",m,N),Te=J(s,"header",m,T((Be=(qe=E.headerContent)!=null?qe:E.head)!=null?Be:E.header,m)),U=re(E)?J(s,"close",m,Ne.Btn({class:"cms-dialog-close",size:"sm",outline:!0,"aria-label":E.closeLabel||"Chiudi popover","data-popover-close":!0},Ne.Icon({name:E.closeIcon||"close",size:"sm"}))):[];let j=(M=(Pe=(z=E.content)!=null?z:E.body)!=null?Pe:E.message)!=null?M:E.text;j==null&&n&&n.length&&(j=n);let ne=J(s,"content",m,T(j,m));ne.length||(ne=J(s,"body",m,T(j,m))),ne.length||(ne=J(s,"default",m,T(j,m)));const Ve=T((k=E.footer)!=null?k:E.actions,m);let He=J(s,"footer",m,Ve);He.length||(He=J(s,"actions",m,Ve));let ae=null;Te.length?ae=_.div({class:"cms-dialog-head cms-dialog-head-custom"},...Te):(I.length||K.length||ke.length||Oe.length||U.length)&&(ae=_.div({class:"cms-dialog-head"},Oe.length?_.div({class:"cms-dialog-icon"},...Oe):null,_.div({class:"cms-dialog-head-main"},I.length?_.div({class:"cms-dialog-eyebrow"},...I):null,K.length?_.div({class:"cms-dialog-title"},...K):null,ke.length?_.div({class:"cms-dialog-subtitle"},...ke):null),U.length?_.div({class:"cms-dialog-close-wrap"},...U):null));const $e=[];return ae&&$e.push(ae),ne.length&&$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])},...ne)),He.length&&$e.push(_.div({class:te(["cms-dialog-actions",`is-${be(E)}`,ye(E.stackActions,"is-stacked"),E.actionsClass,E.footerClass])},...He)),$e.length||$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])})),_.div({class:te(["cms-dialog-shell","cms-popover-shell",ye(!!ae,"has-head"),ye(He.length>0,"has-footer"),ye(E.divider!==!1,"with-divider")])},...$e)},f=E=>{var K;if(!(E!=null&&E.panel))return;const m=X(),N=de(m),I=_e(m);W(E.panel,"_popoverClassTokens",["cms-dialog","cms-popover","cms-singularity","cms-clear-set",I?`cms-dialog-${I}`:"",N,N?`cms-state-${N}`:"",o(m.scrollable)?"scrollable":"",o(m.stickyHeader)?"sticky-head":"",o(m.stickyActions)?"sticky-actions":"",o(m.borderless)?"borderless":"",...le(m.class),...le(m.panelClass)]),W(E.overlay,"_popoverOverlayClassTokens",[...le(m.overlayClass)]),E.panel.dataset.placement=me(m),se(E.panel,"--cms-dialog-width",o(m.width),yt),se(E.panel,"--cms-dialog-min-width",o(m.minWidth),yt),se(E.panel,"--cms-dialog-max-width",o(m.maxWidth),yt),se(E.panel,"--cms-dialog-max-height",o(m.maxHeight),yt),se(E.panel,"--cms-dialog-body-max-height",o((K=m.bodyMaxHeight)!=null?K:m.contentMaxHeight),yt),m.style&&Object.assign(E.panel.style,m.style),Nt(E.panel,m),E.panel.setAttribute("role",m.role||"dialog"),E.panel.setAttribute("aria-modal",m.modal===!0?"true":"false"),m.ariaLabel?E.panel.setAttribute("aria-label",m.ariaLabel):E.panel.removeAttribute("aria-label")},h=()=>{d!=null&&d.panel&&d.panel.replaceChildren(p())},B=()=>{if(H(),!d)return;const E=d;d=null,ks(E,()=>JSswift.overlay.close(E.id))},ie=(E={})=>(E&&typeof E=="object"&&(w={...w,...E}),d&&(f(d),h()),ve),a=(E=null,m=null)=>{var $e,Ee,De,Ie,qe,Be,z,Pe;H();const{anchorEl:N,nextProps:I}=F(E,m);I&&(w={...w,...I});const K=X(),ke=oe(N);if(!ke||o(K.disabled))return null;if(d&&d._anchorEl===ke)return f(d),h(),d;d&&B(),b=document.activeElement;const Oe=Se((Ee=($e=K.trigger)!=null?$e:K.triggers)!=null?Ee:v(K,"open")?"manual":null),Te=Oe.has("hover"),U=Oe.has("focus");let j=null;if(d=JSswift.overlay.open(()=>p(),{type:"popover",anchorEl:ke,placement:me(K),offsetX:(De=K.offsetX)!=null?De:0,offsetY:(qe=(Ie=K.offsetY)!=null?Ie:K.offset)!=null?qe:10,backdrop:K.backdrop===!0,lockScroll:K.lockScroll===!0,trapFocus:K.trapFocus===!0,autoFocus:K.autoFocus===!0,closeOnOutside:K.closeOnOutside!==!1,closeOnBackdrop:(Be=K.closeOnBackdrop)!=null?Be:K.backdrop===!0,closeOnEsc:K.closeOnEsc!==!1,className:qt(["cms-dialog","cms-popover"]),onClose:()=>{var M,k,S;(M=j==null?void 0:j._popoverCleanup)==null||M.call(j),(S=(k=X()).onClose)==null||S.call(k,j),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const ne=d;j=ne,ne._anchorEl=ke;const Ve=()=>{clearTimeout(C),C=null},He=()=>{!Te&&!U||g()},ae=M=>{const k=M.target;if(!(!k||!k.closest)){if(k.closest("[data-popover-close]")||k.closest("[data-dialog-close]")){B();return}X().closeOnSelect===!0&&k.closest("[data-popover-select]")&&B()}};return ne.panel.addEventListener("click",ae),(Te||U)&&(ne.panel.addEventListener("mouseenter",Ve),ne.panel.addEventListener("mouseleave",He),ne.panel.addEventListener("focusin",Ve),ne.panel.addEventListener("focusout",He)),ne._popoverCleanup=()=>{var M,k,S,u,A;(M=ne.panel)==null||M.removeEventListener("click",ae),(k=ne.panel)==null||k.removeEventListener("mouseenter",Ve),(S=ne.panel)==null||S.removeEventListener("mouseleave",He),(u=ne.panel)==null||u.removeEventListener("focusin",Ve),(A=ne.panel)==null||A.removeEventListener("focusout",He)},f(ne),_s(ne),(Pe=(z=X()).onOpen)==null||Pe.call(z,ne),ne},x=(E,m=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>a(E,m),ce())},g=(E=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),E){B();return}C=setTimeout(()=>B(),$())}},P=(E=null,m=null)=>q()?(B(),null):a(E,m),q=()=>!!d,ve={open:a,close:B,show:x,hide:g,toggle:P,update:ie,bind:E=>{var j,ne;if(!E)return()=>{};r=E;const m=X(),N=Se((ne=(j=m.trigger)!=null?j:m.triggers)!=null?ne:v(m,"open")?"manual":null),I=N.has("hover"),K=N.has("focus"),ke=N.has("click"),Oe=N.has("manual")||!I&&!K&&!ke,Te=[],U=()=>{H(),Te.forEach(Ve=>Ve()),r===E&&(r=null)};if(v(m,"open"))return Ye(m.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?a(r):g(!0))},"UI.Popover:open"):m.open===!0?a(E):m.open===!1&&g(!0),U;if(Oe||o(m.disabled))return U;if(I){const Ve=()=>x(E),He=()=>g();E.addEventListener("mouseenter",Ve),E.addEventListener("mouseleave",He),Te.push(()=>{E.removeEventListener("mouseenter",Ve),E.removeEventListener("mouseleave",He)})}if(K){const Ve=()=>x(E),He=()=>g();E.addEventListener("focus",Ve),E.addEventListener("blur",He),Te.push(()=>{E.removeEventListener("focus",Ve),E.removeEventListener("blur",He)})}if(ke){const Ve=He=>{var ae,$e;($e=(ae=X()).onTriggerClick)==null||$e.call(ae,He),!He.defaultPrevented&&P(E)};E.addEventListener("click",Ve),Te.push(()=>E.removeEventListener("click",Ve))}return U},isOpen:q,entry:()=>d,props:()=>({...w})};return ve},Ne.ContextMenu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t);let s={...e},i=null,c=null,w=null;const d=h=>h&&typeof h=="object"&&!h.nodeType&&!Array.isArray(h)&&!(h instanceof Function),r=h=>!!h&&typeof h=="object"&&(h.nodeType===1||typeof h.getBoundingClientRect=="function"),b=h=>!!h&&typeof h=="object"&&("clientX"in h||"type"in h||"target"in h||"currentTarget"in h),O=h=>!!h&&Number.isFinite(Number(h.x))&&Number.isFinite(Number(h.y)),C=()=>s,v=(h,B)=>{const ie=Number(h),a=Number(B);return!Number.isFinite(ie)||!Number.isFinite(a)?null:{x:ie,y:a}},T=h=>h?{_cmsContextPoint:h,getBoundingClientRect:()=>({top:h.y,bottom:h.y,left:h.x,right:h.x,width:0,height:0})}:null,le=h=>{if(!r(h))return null;const B=h.getBoundingClientRect();return v(B.left+Math.min(B.width/2,24),B.top+Math.min(B.height/2,24))},Z=h=>{var B,ie,a,x;return o((x=(a=(ie=(B=h==null?void 0:h.anchorEl)!=null?B:h==null?void 0:h.triggerEl)!=null?ie:h==null?void 0:h.target)!=null?a:h==null?void 0:h.anchor)!=null?x:null)},he=(h,B=null)=>{if(!h)return le(B||w);const ie=v(h.clientX,h.clientY);if(ie)return ie;const a=Z({anchorEl:B||h.currentTarget||h.target||w});return le(a)},H=(h={})=>{if(!d(h))return{};const B={...h};return delete B.event,delete B.point,delete B.x,delete B.y,B},W=()=>{var B,ie,a;const h=C();return{...h,trigger:"manual",placement:h.placement||"bottom-start",offsetX:(B=h.offsetX)!=null?B:0,offsetY:(a=(ie=h.offsetY)!=null?ie:h.offset)!=null?a:4,closeOnOutside:h.closeOnOutside!==!1,closeOnEsc:h.closeOnEsc!==!1,role:h.role||"menu",ariaLabel:h.ariaLabel||h.title||"Context menu",class:te(["cms-context-menu-shell",h.class]),panelClass:te(["cms-context-menu-panel",h.panelClass])}},se=Ne.Menu(W(),...n),X=(h=null,B=null,ie=null)=>{let a=null,x=null,g=null;if(b(h))a=he(h,w),g=d(B)?H(B):null;else if(typeof h=="number"||typeof B=="number")a=v(h,B),g=d(ie)?H(ie):null;else if(O(h))a=v(h.x,h.y),g=d(B)?H(B):null;else if(r(h))x=h,g=d(B)?H(B):null;else if(d(h)){const P=O(h.point)?h.point:O(h)?h:null,q=Z(h),Q=h.event;a=P?v(P.x,P.y):he(Q,q||w),x=q&&r(q)?q:null,g={...H(h),...d(B)?H(B):{}}}else i&&(a={...i});return{point:a,anchor:x,nextProps:g}},de=(h,B=null)=>{c=h||c,i=B||h&&h._cmsContextPoint||i},_e=(h=null)=>{d(h)&&Object.keys(h).length&&(s={...s,...h})},be=(h=null,B=null)=>{if(B)return T(B);if(h&&r(h))return h;const ie=Z(C());return r(ie)?ie:i?T(i):r(c)?c:r(w)?w:null},me=(h=null,B=null,ie=null)=>{const{point:a,anchor:x,nextProps:g}=X(h,B,ie);_e(g);const P=be(x,a);return P?(de(P,a),se.open(P,W())):null},fe=(h,B,ie=null)=>me(h,B,ie),ce=(h,B=null)=>me(h,B),$=()=>(se.close(),f),re=(h=!0)=>(h===!1?se.hide(!1):se.close(),f),oe=(h=null,B=null,ie=null)=>me(h,B,ie),Se=(h=null,B=null,ie=null)=>se.isOpen()?($(),null):me(h,B,ie),F=(h={})=>(_e(H(h)),se.update(W()),f),f={open:me,openAt:fe,openFromEvent:ce,show:oe,hide:re,close:$,toggle:Se,update:F,bind:(h,B=null)=>{if(!h)return()=>{};const ie=d(B)?H(B):null,a=g=>{var q,Q;w=h,g.preventDefault(),!(((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))&&me({event:g,anchorEl:h},ie)},x=g=>{var q,Q;g.key!=="ContextMenu"&&!(g.shiftKey&&g.key==="F10")||(w=h,g.preventDefault(),((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))||me({event:g,anchorEl:h},ie)};return h.addEventListener("contextmenu",a),h.addEventListener("keydown",x),()=>{h.removeEventListener("contextmenu",a),h.removeEventListener("keydown",x)}},isOpen:se.isOpen,entry:se.entry,props:()=>({...s})};return f}})(JSswift);
|
|
34
|
+
`,document.head.appendChild(w),fn._textNode=n,fn._spinner=e,fn._progressWrap=s,fn._progressBar=i,fn._progressActive=!1,fn}function ri(t,e){if(typeof t=="object"&&t!==null)return{...t};const n=e&&typeof e=="object"?e:{};return typeof e=="string"&&(t==null||typeof t=="number")?{...n,message:e}:{...n,message:t}}function ai(t,e){const n=e==="progress";t._spinner.style.display=n?"none":"",t._progressWrap.style.display=n?"block":"none",t._mode=e}bt.loading.show=function(t="Loading...",e={}){const n=li(),s=ri(t,e);Bs++,n._progressActive=!1,n._textNode.textContent=s.message||"Loading...",ai(n,"spinner"),s.spinner===!1&&(n._spinner.style.display="none"),n.style.display="flex"},bt.loading.hide=function(){fn&&(Bs=Math.max(0,Bs-1),Bs===0&&(fn.style.display="none",fn._progressActive=!1))},bt.loading.progress=function(t=0,e={}){var c;const n=li();typeof t=="object"&&t!==null&&(e=t,t=(c=t.value)!=null?c:0);const s=ri(null,e);n._progressActive||(Bs++,n._progressActive=!0);const i=Math.max(0,Math.min(100,Number(t!=null?t:0)));n._textNode.textContent=s.message||"Loading...",n._progressBar.style.width=i+"%",ai(n,"progress"),n.style.display="flex"},bt.loading.wrap=async function(t,e){bt.loading.show(t);try{return await e()}finally{bt.loading.hide()}};function el(t){return typeof t=="function"?t():t||[]}function Fo(t,e){if(!(t==null||e==null))return typeof e!="string"||e.indexOf(".")<0?t==null?void 0:t[e]:e.split(".").reduce((n,s)=>n==null?n:n[s],t)}function tl(t,e){return t==null&&e==null?0:t==null?-1:e==null?1:typeof t=="number"&&typeof e=="number"?t-e:String(t).localeCompare(String(e),void 0,{numeric:!0,sensitivity:"base"})}function nl(t){const e=el(t);return Array.isArray(e)?e:[]}function ci(t){var e,n,s,i;return(i=(s=(n=(e=t==null?void 0:t.label)!=null?e:t==null?void 0:t.title)!=null?n:t==null?void 0:t.header)!=null?s:t==null?void 0:t.key)!=null?i:""}function Do(t,e){var n,s;return(s=(n=t==null?void 0:t.sortKey)!=null?n:t==null?void 0:t.key)!=null?s:`__col_${e}`}function ui(t,e){return t.find((n,s)=>Do(n,s)===e||(n==null?void 0:n.key)===e)||null}function So(t,e,n){return t?typeof t.get=="function"?t.get(e,{row:e,rowIndex:n,col:t}):typeof t.value=="function"?t.value(e,{row:e,rowIndex:n,col:t}):typeof t.key=="string"?Fo(e,t.key):t.key!=null?e==null?void 0:e[t.key]:e:e}function Co(t,e){return typeof t=="function"?t(e)||{}:t||{}}function xo(t){if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.map(xo).filter(Boolean).join(" ");if(typeof Node!="undefined"&&t instanceof Node)return t.textContent||"";if(typeof t=="object"){if(typeof t.textContent=="string")return t.textContent;try{return JSON.stringify(t)}catch(e){return""}}return String(t)}function sl(t,e){const s=(Array.isArray(t)?t:e).map(i=>Number(i)).filter(i=>Number.isFinite(i)&&i>0);return s.length?Array.from(new Set(s)):e}function ol(t,e,n,s){const i=s.searchBy||s.searchPredicate;if(typeof i=="function")return!!i(t,{query:n,columns:e});const c=String(n||"").trim().toLowerCase().split(/\s+/).filter(Boolean);if(!c.length)return!0;const w=Array.isArray(s.searchKeys)&&s.searchKeys.length?s.searchKeys:e.filter(b=>(b==null?void 0:b.searchable)!==!1).map(b=>{var O;return(O=b==null?void 0:b.searchKey)!=null?O:b==null?void 0:b.key}).filter(Boolean),d=[];if(w.length)for(const b of w)if(typeof b=="function")d.push(xo(b(t)));else{const O=e.find(C=>(C==null?void 0:C.key)===b||(C==null?void 0:C.searchKey)===b);d.push(xo(O?So(O,t,-1):Fo(t,b)))}else d.push(xo(t));const r=d.join(" ").toLowerCase();return c.every(b=>r.includes(b))}Ne.Table=(...t)=>{var He,ae,$e,Ee;const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=Array.isArray(e.columns)?e.columns:[],c=sl(e.pageSizeOptions,[5,10,20,50]),w=Number((ae=(He=e.pageSize)!=null?He:c[0])!=null?ae:10)||10,d=Array.from(new Set([...c,w])).sort((De,Ie)=>De-Ie),r=e.initialSort||(e.sortBy?{key:e.sortBy,dir:e.sortDir==="desc"?"desc":"asc"}:null),b=e.searchable===!0||typeof e.searchable=="string"||e.searchPlaceholder!=null||e.search!=null||e.query!=null||!!e.searchModel||!!e.queryModel||Array.isArray(e.searchKeys)||typeof e.searchBy=="function"||typeof e.searchPredicate=="function",O=en(e.searchModel||e.queryModel,"UI.Table:query"),[C,v]=bt.reactive.signal(Math.max(1,Number(e.page||1)||1)),[T,le]=bt.reactive.signal(w),[Z,he]=bt.reactive.signal(r),[H,W]=bt.reactive.signal(String((Ee=O?O.get():($e=e.search)!=null?$e:e.query)!=null?Ee:"")),se=De=>{const Ie=String(De!=null?De:"");W(Ie),O&&O.set(Ie),v(1)},X=De=>{const Ie=Number(De)||w;le(Ie),v(1)},de=(De,Ie)=>{const qe=Do(De,Ie),Be=Z();!Be||Be.key!==qe&&Be.key!==(De==null?void 0:De.key)?he({key:qe,dir:"asc"}):Be.dir==="asc"?he({key:qe,dir:"desc"}):he(null),v(1)};let _e=null;O&&O.watch(De=>{const Ie=String(De!=null?De:"");W(Ie),_e&&_e.value!==Ie&&(_e.value=Ie),v(1)},"UI.Table:queryWatch");const be=JSswift.omit(e,["columns","rows","rowKey","loading","page","pageSize","pageSizeOptions","pagination","initialSort","sortBy","sortDir","search","query","searchable","searchPlaceholder","searchKeys","searchBy","searchPredicate","searchModel","queryModel","filter","actions","actionsLabel","emptyText","loadingText","onRowClick","onRowDblClick","tableClass","tableStyle","cardClass","dense","striped","hover","stickyHeader","toolbar","toolbarStart","toolbarEnd","caption","footer","status","rowClass","rowAttrs","minTableWidth","hideHeader","hideFooter","hideStatus","slots","body"]);be.class=te(["cms-table-card",e.class,e.cardClass]),e.dense!=null&&(be.dense=e.dense);const me=_.div({class:"cms-table-shell"}),fe=J(s,"default",{},n);fe.length&&me.appendChild(_.div({class:"cms-table-lead"},...fe));const ce=J(s,"toolbarStart",{},e.toolbarStart),$=J(s,"toolbar",{},e.toolbar),re=J(s,"toolbarEnd",{},e.toolbarEnd),oe=_.div({class:"cms-table-toolbar"}),Se=_.div({class:"cms-table-toolbar-main"}),F=_.div({class:"cms-table-toolbar-side"});ce.forEach(De=>Se.appendChild(De)),$.forEach(De=>Se.appendChild(De));const p=J(s,"search",{query:H(),getQuery:H,setQuery:se},null);if(p.length)p.forEach(De=>F.appendChild(De));else if(b){_e=_.input({type:"search",class:"cms-input",placeholder:typeof e.searchable=="string"?e.searchable:e.searchPlaceholder||"Cerca nella tabella",value:String(H()||"")}),_e.addEventListener("input",()=>se(_e.value));const De=Ne.Btn({class:"cms-table-search-clear",outline:!0,onClick:()=>{_e&&(_e.value=""),se("")}},"Reset");F.appendChild(_.div({class:"cms-singularity cms-table-search"},_.span({class:"cms-table-search-icon","aria-hidden":"true"},"\u2315"),_e,De))}re.forEach(De=>F.appendChild(De)),(Se.childNodes.length||F.childNodes.length)&&(oe.appendChild(Se),oe.appendChild(F),me.appendChild(oe));const f=_.div({class:"cms-singularity cms-table-chip"},""),h=_.div({class:"cms-singularity cms-table-chip"},""),B=_.div({class:"cms-singularity cms-table-chip"},""),ie=J(s,"status",{},e.status),a=_.div({class:"cms-table-status"},f,h,B,...ie);e.hideStatus!==!0&&me.appendChild(a);const x=J(s,"caption",{},e.caption);x.length&&me.appendChild(_.div({class:"cms-table-caption"},...x));const g=_.thead(),P=_.tbody(),q=!!e.actions||!!s.actions,Q=te(["cms-table",ye(e.dense,"dense"),ye(e.striped,"striped"),ye(e.hover!==!1,"hover"),ye(e.stickyHeader!==!1,"sticky-head"),e.tableClass]),ve={...e.tableStyle||{}};e.minTableWidth!=null&&(ve["--cms-table-min-width"]=yt(e.minTableWidth));const E=_.table({class:Q,style:ve},g,P),m=_.div({class:"cms-singularity cms-table-wrap"},E);me.appendChild(m);const N=_.div({class:"cms-singularity cms-table-chip"},""),I=_.div({class:"cms-singularity cms-table-chip"},""),K=Ne.Btn({outline:!0,onClick:()=>v(Math.max(1,C()-1))},"\u2039"),ke=Ne.Btn({outline:!0,onClick:()=>v(C()+1)},"\u203A"),Oe=_.div({class:"cms-singularity cms-table-chip"},""),Te=_.select({class:"cms-input cms-table-size-select"},...d.map(De=>xs({value:String(De)},String(De))));Te.value=String(T()),Te.addEventListener("change",()=>X(Te.value));const U=J(s,"footer",{},e.footer),j=_.div({class:"cms-table-foot"},_.div({class:"cms-table-foot-main"},N,I,_.label({class:"cms-table-size"},_.span("Righe"),Te)),_.div({class:"cms-table-foot-extra"},...U,_.div({class:"cms-table-pager"},K,Oe,ke)));e.hideFooter!==!0&&me.appendChild(j);const ne=()=>{if(g.innerHTML="",e.hideHeader)return;const De=_.tr();if(i.forEach((Ie,qe)=>{var xe,Ue;const Be={col:Ie,colIndex:qe,sort:Z()},z={...Co(Ie==null?void 0:Ie.style,{...Be,header:!0}),...Co((xe=Ie==null?void 0:Ie.headerStyle)!=null?xe:Ie==null?void 0:Ie.thStyle,{...Be,header:!0})};(Ie==null?void 0:Ie.width)!=null&&(z.width=yt(Ie.width)),(Ie==null?void 0:Ie.minWidth)!=null&&(z.minWidth=yt(Ie.minWidth)),(Ie==null?void 0:Ie.maxWidth)!=null&&(z.maxWidth=yt(Ie.maxWidth)),Ie!=null&&Ie.align&&(z.textAlign=Ie.align);let Pe=J(Ie==null?void 0:Ie.slots,"header",Be,null);if(!Pe.length){const et=typeof(Ie==null?void 0:Ie.header)=="function"?Ie.header(Be):(Ue=Ie==null?void 0:Ie.header)!=null?Ue:ci(Ie);Pe=J(s,"header",Be,et)}const M=Z(),k=Do(Ie,qe),S=(Ie==null?void 0:Ie.sortable)!==!1&&((Ie==null?void 0:Ie.key)!=null||typeof(Ie==null?void 0:Ie.get)=="function"||typeof(Ie==null?void 0:Ie.compare)=="function"),u=!!M&&(M.key===k||M.key===(Ie==null?void 0:Ie.key)),A=_.th({class:te(["cms-table-head-cell",ye(Ie==null?void 0:Ie.nowrap,"is-nowrap"),ye(S,"cms-table-sortable"),ye(u,"is-sorted"),Ie==null?void 0:Ie.headerClass]),style:z});S?A.appendChild(_.button({type:"button",class:"cms-table-head-button",onClick:()=>de(Ie,qe)},_.span({class:"cms-table-head-label"},...Pe),_.span({class:"cms-table-head-arrow","aria-hidden":"true"},u?M.dir==="asc"?"\u2191":"\u2193":"\u2195"))):Pe.forEach(et=>A.appendChild(et)),De.appendChild(A)}),q){const Ie=J(s,"actionsHeader",{},e.actionsLabel||"Azioni");De.appendChild(_.th({class:"cms-table-head-cell cms-table-head-actions",style:{textAlign:"right"}},...Ie))}g.appendChild(De)},Ve=(De,Ie)=>{const qe={columns:i,count:i.length},Be=J(s,De,qe,Ie),z=String(i.length+(q?1:0));P.appendChild(_.tr(_.td({colSpan:z,class:"cms-table-state"},...Be)))};return bt.reactive.effect(()=>{const De=nl(e.rows),Ie=String(H()||"").trim(),qe=Z(),Be=typeof e.loading=="function"?!!e.loading():!!e.loading,z=e.pagination!==!1;if(ne(),P.innerHTML="",_e&&_e.value!==H()&&(_e.value=H()),Te.value!==String(T())&&(Te.value=String(T())),Be){f.textContent="Caricamento in corso",h.style.display="none",B.style.display="none",N.textContent="Loading\u2026",I.textContent="",Oe.textContent="Pagina 1",K.disabled=!0,ke.disabled=!0,Ve("loading",e.loadingText||"Loading...");return}let Pe=De.slice();const M=Pe.length;if(typeof e.filter=="function"&&(Pe=Pe.filter((G,Ge)=>e.filter(G,{row:G,index:Ge,query:Ie,rows:De,columns:i}))),Ie&&(Pe=Pe.filter(G=>ol(G,i,Ie,e))),qe){const G=ui(i,qe.key);G&&Pe.sort((Ge,lt)=>{const tt=So(G,Ge,-1),dt=So(G,lt,-1),St=typeof G.compare=="function"?G.compare(tt,dt,Ge,lt):tl(tt,dt);return qe.dir==="asc"?St:-St})}const k=Pe.length,S=Math.max(1,Number(T())||w),u=z?Math.max(1,Math.ceil(k/S)):1,A=z?Math.min(C(),u):1;A!==C()&&v(A);const xe=z?(A-1)*S:0,Ue=z?xe+S:k,et=Pe.slice(xe,Ue);if(f.textContent=k===M?`${k} righe`:`${k} di ${M} righe`,h.textContent=Ie?`Ricerca: ${Ie}`:"",h.style.display=Ie?"":"none",qe){const G=ui(i,qe.key);B.textContent=G?`Ordine: ${ci(G)} ${qe.dir==="asc"?"\u2191":"\u2193"}`:"",B.style.display=G?"":"none"}else B.style.display="none";if(N.textContent=k?`${xe+1}-${Math.min(Ue,k)} di ${k}`:"0 risultati",I.textContent=k!==M?`Dataset totale ${M}`:`Page size ${S}`,Oe.textContent=z?`Pagina ${A} / ${u}`:"Tutte le righe",K.disabled=!z||A<=1,ke.disabled=!z||A>=u,Te.disabled=!z,Te.parentNode.style.display=z?"":"none",et.length===0){Ve("empty",e.emptyText||"Nessun dato");return}for(let G=0;G<et.length;G++){const Ge=et[G],lt=xe+G,tt={row:Ge,rowIndex:lt,pageIndex:G},dt=typeof e.rowAttrs=="function"?e.rowAttrs(Ge,tt)||{}:e.rowAttrs||{},St=typeof e.rowClass=="function"?e.rowClass(Ge,tt):e.rowClass,It=!!(e.onRowClick||e.onRowDblClick),Rt=_.tr({...dt,class:te(["cms-table-row",St,dt.class,ye(It,"is-clickable")])});if(e.rowKey){const st=typeof e.rowKey=="function"?e.rowKey(Ge,tt):Fo(Ge,e.rowKey);st!=null&&(Rt.dataset.key=String(st))}const Pt=st=>{const wt=st==null?void 0:st.target;return!!(wt&&wt.closest&&wt.closest("button, a, input, select, textarea, label, [data-table-action]"))};if(e.onRowClick&&Rt.addEventListener("click",st=>{Pt(st)||e.onRowClick(Ge,tt,st)}),e.onRowDblClick&&Rt.addEventListener("dblclick",st=>{Pt(st)||e.onRowDblClick(Ge,tt,st)}),i.forEach((st,wt)=>{var Qt,an;const Ft=So(st,Ge,lt),Dt={...tt,col:st,colIndex:wt,value:Ft},Yt={...Co(st==null?void 0:st.style,Dt),...Co((Qt=st==null?void 0:st.cellStyle)!=null?Qt:st==null?void 0:st.tdStyle,Dt)};st!=null&&st.align&&(Yt.textAlign=st.align),(st==null?void 0:st.width)!=null&&(Yt.width=yt(st.width)),(st==null?void 0:st.minWidth)!=null&&(Yt.minWidth=yt(st.minWidth)),(st==null?void 0:st.maxWidth)!=null&&(Yt.maxWidth=yt(st.maxWidth));const Xt=typeof(st==null?void 0:st.cellClass)=="function"?st.cellClass(Ge,Dt):(st==null?void 0:st.cellClass)||(st==null?void 0:st.class),on=_.td({class:te(["cms-table-cell",Xt,ye(st==null?void 0:st.nowrap,"is-nowrap")]),style:Yt});let jt=J(st==null?void 0:st.slots,"cell",Dt,null);if(!jt.length){const mn=typeof(st==null?void 0:st.render)=="function"?st.render(Ge,Dt):typeof(st==null?void 0:st.format)=="function"?st.format(Ft,Ge,Dt):Ft,Gt=mn==null?(an=st==null?void 0:st.emptyText)!=null?an:"":mn;jt=J(s,"cell",Dt,Gt)}jt.length||(jt=[""]),jt.forEach(mn=>on.appendChild(mn)),Rt.appendChild(on)}),q){const st={...tt},wt=typeof e.actions=="function"?e.actions(Ge,tt):e.actions;let Ft=J(s,"actions",st,wt);Ft.length||(Ft=J(null,"default",st,wt)),Rt.appendChild(_.td({class:"cms-table-cell cms-table-cell-actions",style:{textAlign:"right"}},_.div({class:"cms-table-actions"},...Ft)))}P.appendChild(Rt)}},"UI.Table:render"),be.body=me,Ne.Card(be)},Ne.Menu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(m,N)=>Object.prototype.hasOwnProperty.call(m||{},N),T=(m,N)=>typeof m=="function"?m(N):m,le=m=>String(m||"").split(/\s+/).filter(Boolean),Z=m=>m&&typeof m=="object"&&!m.nodeType&&!Array.isArray(m)&&!(m instanceof Function),he=m=>!!m&&typeof m=="object"&&(m.nodeType===1||typeof m.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(m,N,I)=>{if(!m)return;const K=m[N]||[];K.length&&m.classList.remove(...K);const ke=(I||[]).filter(Boolean);ke.length&&m.classList.add(...ke),m[N]=ke},se=(m,N,I,K=ke=>ke)=>{if(m){if(I==null||I===""){m.style.removeProperty(N);return}m.style.setProperty(N,K(I))}},X=()=>w||{},de=m=>{var I;const N=String(o((I=m.state)!=null?I:m.color)||"").toLowerCase();return i.includes(N)?N:""},_e=m=>{const N=String(o(m.size)||"").toLowerCase();return c.includes(N)?N:""},be=m=>{var N,I;return String(o((I=(N=m.placement)!=null?N:m.position)!=null?I:"bottom-start"))},me=()=>{var I;const m=o((I=X().delay)!=null?I:X().showDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):0},fe=()=>{const m=o(X().hideDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):80},ce=(m=null)=>{var I,K,ke;if(m)return m;const N=X();return r||o((ke=(K=(I=N.anchorEl)!=null?I:N.triggerEl)!=null?K:N.target)!=null?ke:N.anchor)||null},$=m=>{if(m==null||m===!0)return new Set(["click"]);if(m===!1)return new Set(["manual"]);const N=Array.isArray(m)?m:String(m).split(/[\s,|/]+/),I=new Set;return N.forEach(K=>{const ke=String(K||"").trim().toLowerCase();ke&&(ke==="mouseenter"||ke==="mouseover"?I.add("hover"):ke==="blur"||ke==="focusin"?I.add("focus"):ke==="tap"?I.add("click"):I.add(ke))}),I.size?I:new Set(["manual"])},re=(m,N)=>{var ke,Oe,Te;let I=null,K=null;if(he(m))I=m,Z(N)&&(K=N);else if(Z(m)){K=m;const U=(Te=(Oe=(ke=m.anchorEl)!=null?ke:m.triggerEl)!=null?Oe:m.target)!=null?Te:m.anchor;he(U)&&(I=U)}else m!=null&&(I=m);return{anchorEl:I,nextProps:K}},oe=(m=d==null?void 0:d.panel)=>{var N;return Array.from(((N=m==null?void 0:m.querySelectorAll)==null?void 0:N.call(m,"[data-menu-item]:not([disabled]):not([tabindex='-1']), .cms-menu-item:not([disabled]):not([tabindex='-1']), [role='menuitem']:not([disabled]):not([tabindex='-1']), a[href]:not([tabindex='-1']), button:not([disabled]):not([tabindex='-1'])"))||[]).filter(I=>I.offsetParent!==null&&I.getAttribute("aria-hidden")!=="true")},Se=()=>{o(X().autoFocus)!==!1&&setTimeout(()=>{const m=oe();if(!m.length)return;(m.find(I=>I.classList.contains("is-active")||I.classList.contains("is-selected")||I.classList.contains("is-checked"))||m[0]).focus()},0)},F=(m,N,I="sm")=>{const K=T(m,N);return K==null?[]:typeof K=="string"?[Ne.Icon({name:K,size:I})]:Vs(K,{...N,as:"icon"})},p=(m,N)=>{var xe,Ue,et,G,Ge,lt,tt,dt,St,It,Rt,Pt,st;const I=T(m,N);if(I==null||I===!1)return[];if(Array.isArray(I))return I.flatMap((wt,Ft)=>p(wt,{...N,index:Ft}));if(typeof I=="function")return p(I(N),N);if(I!=null&&I.nodeType)return[I];if(typeof I=="string"||typeof I=="number")return p({label:I},N);if(!Z(I))return Vs(I,{...N,as:"item"});const K=String((Ue=(xe=I.type)!=null?xe:I.kind)!=null?Ue:"").toLowerCase();if(K==="separator"||K==="divider"||I.separator===!0||I.divider===!0)return[_.div({class:"cms-menu-divider",role:"separator"})];const ke=(et=I.items)!=null?et:I.children;if((K==="group"||K==="section"||Array.isArray(ke))&&ke!=null){const wt={...N,item:I},Ft=J(s,"groupLabel",wt,T((G=I.label)!=null?G:I.title,wt)),Dt=p(ke,wt);return Dt.length?[_.div({class:te(["cms-menu-group",I.class])},Ft.length?_.div({class:"cms-menu-group-label"},...Ft):null,_.div({class:"cms-menu-group-items"},...Dt))]:[]}const Oe={...N,item:I,close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:X()},Te=!!o(I.disabled),U=I.checked==null?null:!!o(I.checked),j=!!o((Ge=I.active)!=null?Ge:I.selected),ne=de(I),Ve=o(I.href),He=o(I.to),ae=v(I,"closeOnSelect")?!!o(I.closeOnSelect):I.keepOpen===!0?!1:X().closeOnSelect!==!1,$e=I.role||(U!=null?"menuitemcheckbox":"menuitem"),Ee=F(I.icon,Oe),De=F((lt=I.iconRight)!=null?lt:I.endIcon,Oe),Ie=J(s,"itemTitle",Oe,T((tt=I.title)!=null?tt:I.label,Oe)),qe=J(s,"itemSubtitle",Oe,T((dt=I.subtitle)!=null?dt:I.description,Oe)),Be=J(s,"itemShortcut",Oe,T(I.shortcut,Oe)),z=J(s,"itemBadge",Oe,T(I.badge,Oe)),Pe=J(s,"item",Oe,T((It=(St=I.content)!=null?St:I.body)!=null?It:I.render,Oe)),M=[...z,...Be,...U===!0&&!De.length&&!z.length?[_.span({class:"cms-menu-entry-check"},Ne.Icon({name:I.checkedIcon||"check",size:"sm"}))]:[],...De],S={class:te(["cms-menu-entry","cms-menu-item",ne?`cms-state-${ne}`:"",ye(j,"is-active"),ye(U===!0,"is-checked"),ye(Te,"is-disabled"),I.class]),role:$e,tabIndex:Te?-1:(Rt=I.tabIndex)!=null?Rt:-1,"data-menu-item":!0,"data-menu-select":ae?"true":"false","data-menu-close":I.close===!0?"true":null,"data-menu-keep-open":ae?null:"true","aria-disabled":Te?"true":null,"aria-checked":U==null?null:String(U),title:(st=(Pt=I.titleAttr)!=null?Pt:I.tooltip)!=null?st:null,type:Ve?null:"button",href:Ve||null,target:I.target||null,rel:I.rel||(I.target==="_blank"?"noopener noreferrer":null),onClick:wt=>{var Dt,Yt,Xt,on;if(Te){wt.preventDefault(),wt.stopPropagation();return}(Yt=(Dt=X()).onItemClick)==null||Yt.call(Dt,I,Oe,wt);const Ft=(Xt=I.onClick)==null?void 0:Xt.call(I,Oe,wt);wt.defaultPrevented||(He&&((on=JSswift.router)!=null&&on.navigate)&&(wt.preventDefault(),JSswift.router.navigate(He)),Ft!==!1&&ae&&ie())}};I.attrs&&typeof I.attrs=="object"&&Object.assign(S,I.attrs);const u=Ve?_.a:_.button,A=Pe.length?Pe:[Ie.length?_.div({class:"cms-menu-entry-title"},...Ie):null,qe.length?_.div({class:"cms-menu-entry-subtitle"},...qe):null].filter(Boolean);return[u(S,Ee.length?_.span({class:"cms-menu-entry-icon"},...Ee):null,_.span({class:"cms-menu-entry-main"},...A),M.length?_.span({class:"cms-menu-entry-aside"},...M):null)]},f=()=>{var Ie,qe,Be,z,Pe,M,k;const m=X(),N={close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:m},I=F(m.icon,N,m.iconSize||"md"),K=J(s,"eyebrow",N,T(m.eyebrow,N)),ke=J(s,"title",N,T((qe=(Ie=m.title)!=null?Ie:m.heading)!=null?qe:m.label,N)),Oe=J(s,"subtitle",N,T((Be=m.subtitle)!=null?Be:m.description,N)),Te=J(s,"before",N,T(m.before,N)),U=J(s,"header",N,T(m.header,N)),j=J(s,"after",N,T(m.after,N)),ne=J(s,"footer",N,T(m.footer,N)),Ve=J(s,"status",N,T(m.status,N));let He=(z=m.content)!=null?z:m.body;He==null&&n&&n.length&&(He=n);let ae=J(s,"content",N,T(He,N));ae.length||(ae=J(s,"body",N,T(He,N))),ae.length||(ae=J(s,"default",N,T(He,N)));const $e=p((M=(Pe=m.items)!=null?Pe:m.actionsList)!=null?M:m.entries,N),Ee=$e.length?[]:J(s,"empty",N,T((k=m.empty)!=null?k:m.emptyText,N));let De=null;return U.length?De=_.div({class:te(["cms-menu-head","cms-menu-head-custom",m.headerClass])},...U):(I.length||K.length||ke.length||Oe.length)&&(De=_.div({class:te(["cms-menu-head",m.headerClass])},I.length?_.div({class:"cms-menu-head-icon"},...I):null,_.div({class:"cms-menu-head-main"},K.length?_.div({class:"cms-menu-eyebrow"},...K):null,ke.length?_.div({class:"cms-menu-title"},...ke):null,Oe.length?_.div({class:"cms-menu-subtitle"},...Oe):null))),_.div({class:te(["cms-menu","cms-menu-shell",ye(m.dense,"dense"),ye($e.length>0,"has-items"),ye(ne.length>0||Ve.length>0,"has-footer"),m.class]),style:m.style||{},role:m.role||"menu","aria-label":m.ariaLabel||null},Te.length?_.div({class:"cms-menu-before"},...Te):null,De,ae.length?_.div({class:te(["cms-menu-content",m.contentClass])},...ae):null,$e.length?_.div({class:te(["cms-menu-items",m.itemsClass])},...$e):null,!$e.length&&Ee.length?_.div({class:"cms-menu-empty"},...Ee):null,j.length?_.div({class:"cms-menu-after"},...j):null,Ve.length||ne.length?_.div({class:te(["cms-menu-footer",m.footerClass])},Ve.length?_.div({class:"cms-menu-status"},...Ve):null,ne.length?_.div({class:"cms-menu-footer-actions"},...ne):null):null)},h=m=>{var ke;if(!(m!=null&&m.panel))return;const N=X(),I=de(N),K=_e(N);W(m.panel,"_menuClassTokens",["cms-menu-panel","cms-clear-set","cms-singularity",K?`cms-menu-${K}`:"",I?`cms-state-${I}`:"",o(N.outline)?"outline":"",...le(N.panelClass)]),W(m.overlay,"_menuOverlayClassTokens",[...le(N.overlayClass)]),m.panel.dataset.placement=be(N),se(m.panel,"--cms-menu-width",o(N.width),yt),se(m.panel,"--cms-menu-min-width",o(N.minWidth),yt),se(m.panel,"--cms-menu-max-width",o(N.maxWidth),yt),se(m.panel,"--cms-menu-max-height",o(N.maxHeight),yt),se(m.panel,"--cms-menu-body-max-height",o((ke=N.bodyMaxHeight)!=null?ke:N.contentMaxHeight),yt),N.panelStyle&&Object.assign(m.panel.style,N.panelStyle),Nt(m.panel,N)},B=()=>{d!=null&&d.panel&&d.panel.replaceChildren(f())},ie=()=>{if(H(),!d)return;const m=d;d=null,ks(m,()=>JSswift.overlay.close(m.id))},a=(m={})=>{var N,I,K,ke;if(m&&typeof m=="object"&&(w={...w,...m}),d){const Oe=X();h(d),B(),(ke=d.reposition)==null||ke.call(d,{anchorEl:d._anchorEl,placement:be(Oe),offsetX:(N=Oe.offsetX)!=null?N:0,offsetY:(K=(I=Oe.offsetY)!=null?I:Oe.offset)!=null?K:8}),Se()}return E},x=(m=null,N=null)=>{var De,Ie,qe,Be,z,Pe,M,k,S,u,A,xe,Ue,et,G,Ge;H();const{anchorEl:I,nextProps:K}=re(m,N);K&&(w={...w,...K});const ke=X(),Oe=ce(I);if(!Oe||o(ke.disabled))return null;if(d&&d._anchorEl===Oe){const lt=X();return h(d),B(),(Be=d.reposition)==null||Be.call(d,{anchorEl:d._anchorEl,placement:be(lt),offsetX:(De=lt.offsetX)!=null?De:0,offsetY:(qe=(Ie=lt.offsetY)!=null?Ie:lt.offset)!=null?qe:8}),Se(),d}d&&ie(),b=document.activeElement;let Te=null;if(d=JSswift.overlay.open(()=>f(),{type:"menu",anchorEl:Oe,placement:be(ke),offsetX:(z=ke.offsetX)!=null?z:0,offsetY:(M=(Pe=ke.offsetY)!=null?Pe:ke.offset)!=null?M:8,backdrop:ke.backdrop===!0,lockScroll:ke.lockScroll===!0,trapFocus:ke.trapFocus===!0,autoFocus:!1,closeOnOutside:ke.closeOnOutside!==!1,closeOnBackdrop:(k=ke.closeOnBackdrop)!=null?k:ke.backdrop===!0,closeOnEsc:ke.closeOnEsc!==!1,className:qt(["cms-menu-panel"]),onClose:()=>{var lt,tt,dt;(lt=Te==null?void 0:Te._menuCleanup)==null||lt.call(Te),(dt=(tt=X()).onClose)==null||dt.call(tt,Te),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const U=d;Te=U,U._anchorEl=Oe;const j=()=>{clearTimeout(C),C=null},ne=()=>{P()},Ve=lt=>{const tt=lt.target;if(!tt||!tt.closest)return;if(tt.closest("[data-menu-close]")){ie();return}if(X().closeOnSelect===!1)return;const dt=tt.closest("[data-menu-item], [data-menu-select], .cms-menu-item, [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], a[href], button:not([disabled])");dt&&(dt.closest("[data-menu-keep-open]")||dt.getAttribute("data-menu-select")!=="false"&&ie())},He=lt=>{if(lt.key==="Escape"){lt.preventDefault(),ie();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(lt.key))return;const tt=oe(U.panel);if(!tt.length)return;lt.preventDefault();const dt=tt.indexOf(document.activeElement);if(lt.key==="Home"){tt[0].focus();return}if(lt.key==="End"){tt[tt.length-1].focus();return}const St=lt.key==="ArrowDown"?1:-1,It=dt<0?St>0?0:tt.length-1:(dt+St+tt.length)%tt.length;tt[It].focus()};U.panel.addEventListener("click",Ve),U.panel.addEventListener("keydown",He);const ae=$((u=(S=ke.trigger)!=null?S:ke.triggers)!=null?u:v(ke,"open")?"manual":null),$e=ae.has("hover"),Ee=ae.has("focus");return($e||Ee)&&(U.panel.addEventListener("mouseenter",j),U.panel.addEventListener("mouseleave",ne),U.panel.addEventListener("focusin",j),U.panel.addEventListener("focusout",ne)),U._menuCleanup=()=>{var lt,tt,dt,St,It,Rt;(lt=U.panel)==null||lt.removeEventListener("click",Ve),(tt=U.panel)==null||tt.removeEventListener("keydown",He),(dt=U.panel)==null||dt.removeEventListener("mouseenter",j),(St=U.panel)==null||St.removeEventListener("mouseleave",ne),(It=U.panel)==null||It.removeEventListener("focusin",j),(Rt=U.panel)==null||Rt.removeEventListener("focusout",ne)},h(U),(et=U.reposition)==null||et.call(U,{anchorEl:Oe,placement:be(ke),offsetX:(A=ke.offsetX)!=null?A:0,offsetY:(Ue=(xe=ke.offsetY)!=null?xe:ke.offset)!=null?Ue:8}),_s(U),(Ge=(G=X()).onOpen)==null||Ge.call(G,U),Se(),U},g=(m,N=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>x(m,N),me())},P=(m=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),m){ie();return}C=setTimeout(()=>ie(),fe())}},q=(m=null,N=null)=>Q()?(ie(),null):x(m,N),Q=()=>!!d,E={open:x,close:ie,show:g,hide:P,toggle:q,update:a,bind:m=>{var ne,Ve;if(!m)return()=>{};r=m;const N=X(),I=$((Ve=(ne=N.trigger)!=null?ne:N.triggers)!=null?Ve:v(N,"open")?"manual":null),K=I.has("hover"),ke=I.has("focus"),Oe=I.has("click"),Te=I.has("manual")||!K&&!ke&&!Oe,U=[],j=()=>{H(),U.forEach(He=>He()),r===m&&(r=null)};if(v(N,"open"))return Ye(N.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?x(r):P(!0))},"UI.Menu:open"):N.open===!0?x(m):N.open===!1&&P(!0),j;if(Te||o(N.disabled))return j;if(K){const He=()=>g(m),ae=()=>P();m.addEventListener("mouseenter",He),m.addEventListener("mouseleave",ae),U.push(()=>{m.removeEventListener("mouseenter",He),m.removeEventListener("mouseleave",ae)})}if(ke){const He=()=>g(m),ae=()=>P();m.addEventListener("focus",He),m.addEventListener("blur",ae),U.push(()=>{m.removeEventListener("focus",He),m.removeEventListener("blur",ae)})}if(Oe){const He=ae=>{var $e,Ee;(Ee=($e=X()).onTriggerClick)==null||Ee.call($e,ae),!ae.defaultPrevented&&q(m)};m.addEventListener("click",He),U.push(()=>m.removeEventListener("click",He))}return j},isOpen:Q,entry:()=>d,props:()=>({...w})};return E},Ne.Popover=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(E,m)=>Object.prototype.hasOwnProperty.call(E||{},m),T=(E,m)=>typeof E=="function"?E(m):E,le=E=>String(E||"").split(/\s+/).filter(Boolean),Z=E=>E&&typeof E=="object"&&!E.nodeType&&!Array.isArray(E)&&!(E instanceof Function),he=E=>!!E&&typeof E=="object"&&(E.nodeType===1||typeof E.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(E,m,N)=>{if(!E)return;const I=E[m]||[];I.length&&E.classList.remove(...I);const K=(N||[]).filter(Boolean);K.length&&E.classList.add(...K),E[m]=K},se=(E,m,N,I=K=>K)=>{if(E){if(N==null||N===""){E.style.removeProperty(m);return}E.style.setProperty(m,I(N))}},X=()=>w,de=E=>{var N;const m=o((N=E.state)!=null?N:E.color);return m?i.includes(m)?m:String(m):""},_e=E=>{const m=o(E.size);return typeof m=="string"&&c.includes(m)?m:""},be=E=>{var N,I,K;const m=String(o((K=(I=(N=E.actionsAlign)!=null?N:E.footerAlign)!=null?I:E.alignActions)!=null?K:"end")).toLowerCase();return["start","left"].includes(m)?"start":["center","middle"].includes(m)?"center":["between","space-between"].includes(m)?"between":["stretch","full"].includes(m)?"stretch":"end"},me=E=>{var m,N;return String(o((N=(m=E.placement)!=null?m:E.position)!=null?N:"bottom-start"))},fe=(E,m)=>{const N=o(E);if(N==null||N==="")return m;const I=Number(N);return Number.isFinite(I)?I:m},ce=()=>fe(X().delay,0),$=()=>fe(X().hideDelay,120),re=E=>{var N,I;return((I=(N=E.closable)!=null?N:E.dismissible)!=null?I:E.closeButton)===!0},oe=(E=null)=>{var N,I,K;if(E)return E;const m=X();return r||o((K=(I=(N=m.anchorEl)!=null?N:m.triggerEl)!=null?I:m.target)!=null?K:m.anchor)||null},Se=E=>{if(E==null||E===!0)return new Set(["click"]);if(E===!1)return new Set(["manual"]);const m=Array.isArray(E)?E:String(E).split(/[\s,|/]+/),N=new Set;return m.forEach(I=>{const K=String(I||"").trim().toLowerCase();K&&(K==="mouseenter"||K==="mouseover"?N.add("hover"):K==="blur"||K==="focusin"?N.add("focus"):K==="tap"?N.add("click"):N.add(K))}),N.size?N:new Set(["manual"])},F=(E,m)=>{var K,ke,Oe;let N=null,I=null;if(he(E))N=E,Z(m)&&(I=m);else if(Z(E)){I=E;const Te=(Oe=(ke=(K=E.anchorEl)!=null?K:E.triggerEl)!=null?ke:E.target)!=null?Oe:E.anchor;he(Te)&&(N=Te)}else E!=null&&(N=E);return{anchorEl:N,nextProps:I}},p=()=>{var Ee,De,Ie,qe,Be,z,Pe,M,k;const E=X(),m={close:B,dismiss:B,open:a,toggle:P,update:ie,isOpen:q,entry:()=>d,anchorEl:oe(),props:E},N=E.icon!=null?typeof E.icon=="string"?Ne.Icon({name:E.icon,size:E.iconSize||"md"}):JSswift.ui.slot(E.icon,{as:"icon"}):null,I=J(s,"eyebrow",m,T(E.eyebrow,m)),K=J(s,"title",m,T((De=(Ee=E.title)!=null?Ee:E.heading)!=null?De:E.label,m)),ke=J(s,"subtitle",m,T((Ie=E.subtitle)!=null?Ie:E.description,m)),Oe=J(s,"icon",m,N),Te=J(s,"header",m,T((Be=(qe=E.headerContent)!=null?qe:E.head)!=null?Be:E.header,m)),U=re(E)?J(s,"close",m,Ne.Btn({class:"cms-dialog-close",size:"sm",outline:!0,"aria-label":E.closeLabel||"Chiudi popover","data-popover-close":!0},Ne.Icon({name:E.closeIcon||"close",size:"sm"}))):[];let j=(M=(Pe=(z=E.content)!=null?z:E.body)!=null?Pe:E.message)!=null?M:E.text;j==null&&n&&n.length&&(j=n);let ne=J(s,"content",m,T(j,m));ne.length||(ne=J(s,"body",m,T(j,m))),ne.length||(ne=J(s,"default",m,T(j,m)));const Ve=T((k=E.footer)!=null?k:E.actions,m);let He=J(s,"footer",m,Ve);He.length||(He=J(s,"actions",m,Ve));let ae=null;Te.length?ae=_.div({class:"cms-dialog-head cms-dialog-head-custom"},...Te):(I.length||K.length||ke.length||Oe.length||U.length)&&(ae=_.div({class:"cms-dialog-head"},Oe.length?_.div({class:"cms-dialog-icon"},...Oe):null,_.div({class:"cms-dialog-head-main"},I.length?_.div({class:"cms-dialog-eyebrow"},...I):null,K.length?_.div({class:"cms-dialog-title"},...K):null,ke.length?_.div({class:"cms-dialog-subtitle"},...ke):null),U.length?_.div({class:"cms-dialog-close-wrap"},...U):null));const $e=[];return ae&&$e.push(ae),ne.length&&$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])},...ne)),He.length&&$e.push(_.div({class:te(["cms-dialog-actions",`is-${be(E)}`,ye(E.stackActions,"is-stacked"),E.actionsClass,E.footerClass])},...He)),$e.length||$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])})),_.div({class:te(["cms-dialog-shell","cms-popover-shell",ye(!!ae,"has-head"),ye(He.length>0,"has-footer"),ye(E.divider!==!1,"with-divider")])},...$e)},f=E=>{var K;if(!(E!=null&&E.panel))return;const m=X(),N=de(m),I=_e(m);W(E.panel,"_popoverClassTokens",["cms-dialog","cms-popover","cms-singularity","cms-clear-set",I?`cms-dialog-${I}`:"",N,N?`cms-state-${N}`:"",o(m.scrollable)?"scrollable":"",o(m.stickyHeader)?"sticky-head":"",o(m.stickyActions)?"sticky-actions":"",o(m.borderless)?"borderless":"",...le(m.class),...le(m.panelClass)]),W(E.overlay,"_popoverOverlayClassTokens",[...le(m.overlayClass)]),E.panel.dataset.placement=me(m),se(E.panel,"--cms-dialog-width",o(m.width),yt),se(E.panel,"--cms-dialog-min-width",o(m.minWidth),yt),se(E.panel,"--cms-dialog-max-width",o(m.maxWidth),yt),se(E.panel,"--cms-dialog-max-height",o(m.maxHeight),yt),se(E.panel,"--cms-dialog-body-max-height",o((K=m.bodyMaxHeight)!=null?K:m.contentMaxHeight),yt),m.style&&Object.assign(E.panel.style,m.style),Nt(E.panel,m),E.panel.setAttribute("role",m.role||"dialog"),E.panel.setAttribute("aria-modal",m.modal===!0?"true":"false"),m.ariaLabel?E.panel.setAttribute("aria-label",m.ariaLabel):E.panel.removeAttribute("aria-label")},h=()=>{d!=null&&d.panel&&d.panel.replaceChildren(p())},B=()=>{if(H(),!d)return;const E=d;d=null,ks(E,()=>JSswift.overlay.close(E.id))},ie=(E={})=>(E&&typeof E=="object"&&(w={...w,...E}),d&&(f(d),h()),ve),a=(E=null,m=null)=>{var $e,Ee,De,Ie,qe,Be,z,Pe;H();const{anchorEl:N,nextProps:I}=F(E,m);I&&(w={...w,...I});const K=X(),ke=oe(N);if(!ke||o(K.disabled))return null;if(d&&d._anchorEl===ke)return f(d),h(),d;d&&B(),b=document.activeElement;const Oe=Se((Ee=($e=K.trigger)!=null?$e:K.triggers)!=null?Ee:v(K,"open")?"manual":null),Te=Oe.has("hover"),U=Oe.has("focus");let j=null;if(d=JSswift.overlay.open(()=>p(),{type:"popover",anchorEl:ke,placement:me(K),offsetX:(De=K.offsetX)!=null?De:0,offsetY:(qe=(Ie=K.offsetY)!=null?Ie:K.offset)!=null?qe:10,backdrop:K.backdrop===!0,lockScroll:K.lockScroll===!0,trapFocus:K.trapFocus===!0,autoFocus:K.autoFocus===!0,closeOnOutside:K.closeOnOutside!==!1,closeOnBackdrop:(Be=K.closeOnBackdrop)!=null?Be:K.backdrop===!0,closeOnEsc:K.closeOnEsc!==!1,className:qt(["cms-dialog","cms-popover"]),onClose:()=>{var M,k,S;(M=j==null?void 0:j._popoverCleanup)==null||M.call(j),(S=(k=X()).onClose)==null||S.call(k,j),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const ne=d;j=ne,ne._anchorEl=ke;const Ve=()=>{clearTimeout(C),C=null},He=()=>{!Te&&!U||g()},ae=M=>{const k=M.target;if(!(!k||!k.closest)){if(k.closest("[data-popover-close]")||k.closest("[data-dialog-close]")){B();return}X().closeOnSelect===!0&&k.closest("[data-popover-select]")&&B()}};return ne.panel.addEventListener("click",ae),(Te||U)&&(ne.panel.addEventListener("mouseenter",Ve),ne.panel.addEventListener("mouseleave",He),ne.panel.addEventListener("focusin",Ve),ne.panel.addEventListener("focusout",He)),ne._popoverCleanup=()=>{var M,k,S,u,A;(M=ne.panel)==null||M.removeEventListener("click",ae),(k=ne.panel)==null||k.removeEventListener("mouseenter",Ve),(S=ne.panel)==null||S.removeEventListener("mouseleave",He),(u=ne.panel)==null||u.removeEventListener("focusin",Ve),(A=ne.panel)==null||A.removeEventListener("focusout",He)},f(ne),_s(ne),(Pe=(z=X()).onOpen)==null||Pe.call(z,ne),ne},x=(E,m=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>a(E,m),ce())},g=(E=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),E){B();return}C=setTimeout(()=>B(),$())}},P=(E=null,m=null)=>q()?(B(),null):a(E,m),q=()=>!!d,ve={open:a,close:B,show:x,hide:g,toggle:P,update:ie,bind:E=>{var j,ne;if(!E)return()=>{};r=E;const m=X(),N=Se((ne=(j=m.trigger)!=null?j:m.triggers)!=null?ne:v(m,"open")?"manual":null),I=N.has("hover"),K=N.has("focus"),ke=N.has("click"),Oe=N.has("manual")||!I&&!K&&!ke,Te=[],U=()=>{H(),Te.forEach(Ve=>Ve()),r===E&&(r=null)};if(v(m,"open"))return Ye(m.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?a(r):g(!0))},"UI.Popover:open"):m.open===!0?a(E):m.open===!1&&g(!0),U;if(Oe||o(m.disabled))return U;if(I){const Ve=()=>x(E),He=()=>g();E.addEventListener("mouseenter",Ve),E.addEventListener("mouseleave",He),Te.push(()=>{E.removeEventListener("mouseenter",Ve),E.removeEventListener("mouseleave",He)})}if(K){const Ve=()=>x(E),He=()=>g();E.addEventListener("focus",Ve),E.addEventListener("blur",He),Te.push(()=>{E.removeEventListener("focus",Ve),E.removeEventListener("blur",He)})}if(ke){const Ve=He=>{var ae,$e;($e=(ae=X()).onTriggerClick)==null||$e.call(ae,He),!He.defaultPrevented&&P(E)};E.addEventListener("click",Ve),Te.push(()=>E.removeEventListener("click",Ve))}return U},isOpen:q,entry:()=>d,props:()=>({...w})};return ve},Ne.ContextMenu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t);let s={...e},i=null,c=null,w=null;const d=h=>h&&typeof h=="object"&&!h.nodeType&&!Array.isArray(h)&&!(h instanceof Function),r=h=>!!h&&typeof h=="object"&&(h.nodeType===1||typeof h.getBoundingClientRect=="function"),b=h=>!!h&&typeof h=="object"&&("clientX"in h||"type"in h||"target"in h||"currentTarget"in h),O=h=>!!h&&Number.isFinite(Number(h.x))&&Number.isFinite(Number(h.y)),C=()=>s,v=(h,B)=>{const ie=Number(h),a=Number(B);return!Number.isFinite(ie)||!Number.isFinite(a)?null:{x:ie,y:a}},T=h=>h?{_cmsContextPoint:h,getBoundingClientRect:()=>({top:h.y,bottom:h.y,left:h.x,right:h.x,width:0,height:0})}:null,le=h=>{if(!r(h))return null;const B=h.getBoundingClientRect();return v(B.left+Math.min(B.width/2,24),B.top+Math.min(B.height/2,24))},Z=h=>{var B,ie,a,x;return o((x=(a=(ie=(B=h==null?void 0:h.anchorEl)!=null?B:h==null?void 0:h.triggerEl)!=null?ie:h==null?void 0:h.target)!=null?a:h==null?void 0:h.anchor)!=null?x:null)},he=(h,B=null)=>{if(!h)return le(B||w);const ie=v(h.clientX,h.clientY);if(ie)return ie;const a=Z({anchorEl:B||h.currentTarget||h.target||w});return le(a)},H=(h={})=>{if(!d(h))return{};const B={...h};return delete B.event,delete B.point,delete B.x,delete B.y,B},W=()=>{var B,ie,a;const h=C();return{...h,trigger:"manual",placement:h.placement||"bottom-start",offsetX:(B=h.offsetX)!=null?B:0,offsetY:(a=(ie=h.offsetY)!=null?ie:h.offset)!=null?a:4,closeOnOutside:h.closeOnOutside!==!1,closeOnEsc:h.closeOnEsc!==!1,role:h.role||"menu",ariaLabel:h.ariaLabel||h.title||"Context menu",class:te(["cms-context-menu-shell",h.class]),panelClass:te(["cms-context-menu-panel",h.panelClass])}},se=Ne.Menu(W(),...n),X=(h=null,B=null,ie=null)=>{let a=null,x=null,g=null;if(b(h))a=he(h,w),g=d(B)?H(B):null;else if(typeof h=="number"||typeof B=="number")a=v(h,B),g=d(ie)?H(ie):null;else if(O(h))a=v(h.x,h.y),g=d(B)?H(B):null;else if(r(h))x=h,g=d(B)?H(B):null;else if(d(h)){const P=O(h.point)?h.point:O(h)?h:null,q=Z(h),Q=h.event;a=P?v(P.x,P.y):he(Q,q||w),x=q&&r(q)?q:null,g={...H(h),...d(B)?H(B):{}}}else i&&(a={...i});return{point:a,anchor:x,nextProps:g}},de=(h,B=null)=>{c=h||c,i=B||h&&h._cmsContextPoint||i},_e=(h=null)=>{d(h)&&Object.keys(h).length&&(s={...s,...h})},be=(h=null,B=null)=>{if(B)return T(B);if(h&&r(h))return h;const ie=Z(C());return r(ie)?ie:i?T(i):r(c)?c:r(w)?w:null},me=(h=null,B=null,ie=null)=>{const{point:a,anchor:x,nextProps:g}=X(h,B,ie);_e(g);const P=be(x,a);return P?(de(P,a),se.open(P,W())):null},fe=(h,B,ie=null)=>me(h,B,ie),ce=(h,B=null)=>me(h,B),$=()=>(se.close(),f),re=(h=!0)=>(h===!1?se.hide(!1):se.close(),f),oe=(h=null,B=null,ie=null)=>me(h,B,ie),Se=(h=null,B=null,ie=null)=>se.isOpen()?($(),null):me(h,B,ie),F=(h={})=>(_e(H(h)),se.update(W()),f),f={open:me,openAt:fe,openFromEvent:ce,show:oe,hide:re,close:$,toggle:Se,update:F,bind:(h,B=null)=>{if(!h)return()=>{};const ie=d(B)?H(B):null,a=g=>{var q,Q;w=h,g.preventDefault(),!(((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))&&me({event:g,anchorEl:h},ie)},x=g=>{var q,Q;g.key!=="ContextMenu"&&!(g.shiftKey&&g.key==="F10")||(w=h,g.preventDefault(),((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))||me({event:g,anchorEl:h},ie)};return h.addEventListener("contextmenu",a),h.addEventListener("keydown",x),()=>{h.removeEventListener("contextmenu",a),h.removeEventListener("keydown",x)}},isOpen:se.isOpen,entry:se.entry,props:()=>({...s})};return f}})(JSswift);
|
package/dist/min-jsswift.js
CHANGED
|
@@ -31,4 +31,4 @@ background: var(--cms-primary);
|
|
|
31
31
|
transition: width 200ms ease;
|
|
32
32
|
`,s.appendChild(i);const c=document.createElement("div");c.style.cssText="display:flex; gap: 12px; align-items:center; width: 100%;",c.appendChild(e),c.appendChild(n),t.appendChild(c),t.appendChild(s),fn.appendChild(t),document.body.appendChild(fn);const w=document.createElement("style");return w.textContent=`
|
|
33
33
|
@keyframes cmsSpin { to { transform: rotate(360deg); } }
|
|
34
|
-
`,document.head.appendChild(w),fn._textNode=n,fn._spinner=e,fn._progressWrap=s,fn._progressBar=i,fn._progressActive=!1,fn}function ri(t,e){if(typeof t=="object"&&t!==null)return{...t};const n=e&&typeof e=="object"?e:{};return typeof e=="string"&&(t==null||typeof t=="number")?{...n,message:e}:{...n,message:t}}function ai(t,e){const n=e==="progress";t._spinner.style.display=n?"none":"",t._progressWrap.style.display=n?"block":"none",t._mode=e}bt.loading.show=function(t="Loading...",e={}){const n=li(),s=ri(t,e);Bs++,n._progressActive=!1,n._textNode.textContent=s.message||"Loading...",ai(n,"spinner"),s.spinner===!1&&(n._spinner.style.display="none"),n.style.display="flex"},bt.loading.hide=function(){fn&&(Bs=Math.max(0,Bs-1),Bs===0&&(fn.style.display="none",fn._progressActive=!1))},bt.loading.progress=function(t=0,e={}){var c;const n=li();typeof t=="object"&&t!==null&&(e=t,t=(c=t.value)!=null?c:0);const s=ri(null,e);n._progressActive||(Bs++,n._progressActive=!0);const i=Math.max(0,Math.min(100,Number(t!=null?t:0)));n._textNode.textContent=s.message||"Loading...",n._progressBar.style.width=i+"%",ai(n,"progress"),n.style.display="flex"},bt.loading.wrap=async function(t,e){bt.loading.show(t);try{return await e()}finally{bt.loading.hide()}};function el(t){return typeof t=="function"?t():t||[]}function Fo(t,e){if(!(t==null||e==null))return typeof e!="string"||e.indexOf(".")<0?t==null?void 0:t[e]:e.split(".").reduce((n,s)=>n==null?n:n[s],t)}function tl(t,e){return t==null&&e==null?0:t==null?-1:e==null?1:typeof t=="number"&&typeof e=="number"?t-e:String(t).localeCompare(String(e),void 0,{numeric:!0,sensitivity:"base"})}function nl(t){const e=el(t);return Array.isArray(e)?e:[]}function ci(t){var e,n,s,i;return(i=(s=(n=(e=t==null?void 0:t.label)!=null?e:t==null?void 0:t.title)!=null?n:t==null?void 0:t.header)!=null?s:t==null?void 0:t.key)!=null?i:""}function Do(t,e){var n,s;return(s=(n=t==null?void 0:t.sortKey)!=null?n:t==null?void 0:t.key)!=null?s:`__col_${e}`}function ui(t,e){return t.find((n,s)=>Do(n,s)===e||(n==null?void 0:n.key)===e)||null}function So(t,e,n){return t?typeof t.get=="function"?t.get(e,{row:e,rowIndex:n,col:t}):typeof t.value=="function"?t.value(e,{row:e,rowIndex:n,col:t}):typeof t.key=="string"?Fo(e,t.key):t.key!=null?e==null?void 0:e[t.key]:e:e}function Co(t,e){return typeof t=="function"?t(e)||{}:t||{}}function xo(t){if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.map(xo).filter(Boolean).join(" ");if(typeof Node!="undefined"&&t instanceof Node)return t.textContent||"";if(typeof t=="object"){if(typeof t.textContent=="string")return t.textContent;try{return JSON.stringify(t)}catch(e){return""}}return String(t)}function sl(t,e){const s=(Array.isArray(t)?t:e).map(i=>Number(i)).filter(i=>Number.isFinite(i)&&i>0);return s.length?Array.from(new Set(s)):e}function ol(t,e,n,s){const i=s.searchBy||s.searchPredicate;if(typeof i=="function")return!!i(t,{query:n,columns:e});const c=String(n||"").trim().toLowerCase().split(/\s+/).filter(Boolean);if(!c.length)return!0;const w=Array.isArray(s.searchKeys)&&s.searchKeys.length?s.searchKeys:e.filter(b=>(b==null?void 0:b.searchable)!==!1).map(b=>{var O;return(O=b==null?void 0:b.searchKey)!=null?O:b==null?void 0:b.key}).filter(Boolean),d=[];if(w.length)for(const b of w)if(typeof b=="function")d.push(xo(b(t)));else{const O=e.find(C=>(C==null?void 0:C.key)===b||(C==null?void 0:C.searchKey)===b);d.push(xo(O?So(O,t,-1):Fo(t,b)))}else d.push(xo(t));const r=d.join(" ").toLowerCase();return c.every(b=>r.includes(b))}Ne.Table=(...t)=>{var He,ae,$e,Ee;const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=Array.isArray(e.columns)?e.columns:[],c=sl(e.pageSizeOptions,[5,10,20,50]),w=Number((ae=(He=e.pageSize)!=null?He:c[0])!=null?ae:10)||10,d=Array.from(new Set([...c,w])).sort((De,Ie)=>De-Ie),r=e.initialSort||(e.sortBy?{key:e.sortBy,dir:e.sortDir==="desc"?"desc":"asc"}:null),b=e.searchable===!0||typeof e.searchable=="string"||e.searchPlaceholder!=null||e.search!=null||e.query!=null||!!e.searchModel||!!e.queryModel||Array.isArray(e.searchKeys)||typeof e.searchBy=="function"||typeof e.searchPredicate=="function",O=en(e.searchModel||e.queryModel,"UI.Table:query"),[C,v]=bt.reactive.signal(Math.max(1,Number(e.page||1)||1)),[T,le]=bt.reactive.signal(w),[Z,he]=bt.reactive.signal(r),[H,W]=bt.reactive.signal(String((Ee=O?O.get():($e=e.search)!=null?$e:e.query)!=null?Ee:"")),se=De=>{const Ie=String(De!=null?De:"");W(Ie),O&&O.set(Ie),v(1)},X=De=>{const Ie=Number(De)||w;le(Ie),v(1)},de=(De,Ie)=>{const qe=Do(De,Ie),Be=Z();!Be||Be.key!==qe&&Be.key!==(De==null?void 0:De.key)?he({key:qe,dir:"asc"}):Be.dir==="asc"?he({key:qe,dir:"desc"}):he(null),v(1)};let _e=null;O&&O.watch(De=>{const Ie=String(De!=null?De:"");W(Ie),_e&&_e.value!==Ie&&(_e.value=Ie),v(1)},"UI.Table:queryWatch");const be=JSswift.omit(e,["columns","rows","rowKey","loading","page","pageSize","pageSizeOptions","pagination","initialSort","sortBy","sortDir","search","query","searchable","searchPlaceholder","searchKeys","searchBy","searchPredicate","searchModel","queryModel","filter","actions","actionsLabel","emptyText","loadingText","onRowClick","onRowDblClick","tableClass","tableStyle","cardClass","dense","striped","hover","stickyHeader","toolbar","toolbarStart","toolbarEnd","caption","footer","status","rowClass","rowAttrs","minTableWidth","hideHeader","hideFooter","slots","body"]);be.class=te(["cms-table-card",e.class,e.cardClass]),e.dense!=null&&(be.dense=e.dense);const me=_.div({class:"cms-table-shell"}),fe=J(s,"default",{},n);fe.length&&me.appendChild(_.div({class:"cms-table-lead"},...fe));const ce=J(s,"toolbarStart",{},e.toolbarStart),$=J(s,"toolbar",{},e.toolbar),re=J(s,"toolbarEnd",{},e.toolbarEnd),oe=_.div({class:"cms-table-toolbar"}),Se=_.div({class:"cms-table-toolbar-main"}),F=_.div({class:"cms-table-toolbar-side"});ce.forEach(De=>Se.appendChild(De)),$.forEach(De=>Se.appendChild(De));const p=J(s,"search",{query:H(),getQuery:H,setQuery:se},null);if(p.length)p.forEach(De=>F.appendChild(De));else if(b){_e=_.input({type:"search",class:"cms-input",placeholder:typeof e.searchable=="string"?e.searchable:e.searchPlaceholder||"Cerca nella tabella",value:String(H()||"")}),_e.addEventListener("input",()=>se(_e.value));const De=Ne.Btn({class:"cms-table-search-clear",outline:!0,onClick:()=>{_e&&(_e.value=""),se("")}},"Reset");F.appendChild(_.div({class:"cms-singularity cms-table-search"},_.span({class:"cms-table-search-icon","aria-hidden":"true"},"\u2315"),_e,De))}re.forEach(De=>F.appendChild(De)),(Se.childNodes.length||F.childNodes.length)&&(oe.appendChild(Se),oe.appendChild(F),me.appendChild(oe));const f=_.div({class:"cms-singularity cms-table-chip"},""),h=_.div({class:"cms-singularity cms-table-chip"},""),B=_.div({class:"cms-singularity cms-table-chip"},""),ie=J(s,"status",{},e.status),a=_.div({class:"cms-table-status"},f,h,B,...ie);me.appendChild(a);const x=J(s,"caption",{},e.caption);x.length&&me.appendChild(_.div({class:"cms-table-caption"},...x));const g=_.thead(),P=_.tbody(),q=!!e.actions||!!s.actions,Q=te(["cms-table",ye(e.dense,"dense"),ye(e.striped,"striped"),ye(e.hover!==!1,"hover"),ye(e.stickyHeader!==!1,"sticky-head"),e.tableClass]),ve={...e.tableStyle||{}};e.minTableWidth!=null&&(ve["--cms-table-min-width"]=yt(e.minTableWidth));const E=_.table({class:Q,style:ve},g,P),m=_.div({class:"cms-singularity cms-table-wrap"},E);me.appendChild(m);const N=_.div({class:"cms-singularity cms-table-chip"},""),I=_.div({class:"cms-singularity cms-table-chip"},""),K=Ne.Btn({outline:!0,onClick:()=>v(Math.max(1,C()-1))},"\u2039"),ke=Ne.Btn({outline:!0,onClick:()=>v(C()+1)},"\u203A"),Oe=_.div({class:"cms-singularity cms-table-chip"},""),Te=_.select({class:"cms-input cms-table-size-select"},...d.map(De=>xs({value:String(De)},String(De))));Te.value=String(T()),Te.addEventListener("change",()=>X(Te.value));const U=J(s,"footer",{},e.footer),j=_.div({class:"cms-table-foot"},_.div({class:"cms-table-foot-main"},N,I,_.label({class:"cms-table-size"},_.span("Righe"),Te)),_.div({class:"cms-table-foot-extra"},...U,_.div({class:"cms-table-pager"},K,Oe,ke)));e.hideFooter!==!0&&me.appendChild(j);const ne=()=>{if(g.innerHTML="",e.hideHeader)return;const De=_.tr();if(i.forEach((Ie,qe)=>{var xe,Ue;const Be={col:Ie,colIndex:qe,sort:Z()},z={...Co(Ie==null?void 0:Ie.style,{...Be,header:!0}),...Co((xe=Ie==null?void 0:Ie.headerStyle)!=null?xe:Ie==null?void 0:Ie.thStyle,{...Be,header:!0})};(Ie==null?void 0:Ie.width)!=null&&(z.width=yt(Ie.width)),(Ie==null?void 0:Ie.minWidth)!=null&&(z.minWidth=yt(Ie.minWidth)),(Ie==null?void 0:Ie.maxWidth)!=null&&(z.maxWidth=yt(Ie.maxWidth)),Ie!=null&&Ie.align&&(z.textAlign=Ie.align);let Pe=J(Ie==null?void 0:Ie.slots,"header",Be,null);if(!Pe.length){const et=typeof(Ie==null?void 0:Ie.header)=="function"?Ie.header(Be):(Ue=Ie==null?void 0:Ie.header)!=null?Ue:ci(Ie);Pe=J(s,"header",Be,et)}const M=Z(),k=Do(Ie,qe),S=(Ie==null?void 0:Ie.sortable)!==!1&&((Ie==null?void 0:Ie.key)!=null||typeof(Ie==null?void 0:Ie.get)=="function"||typeof(Ie==null?void 0:Ie.compare)=="function"),u=!!M&&(M.key===k||M.key===(Ie==null?void 0:Ie.key)),A=_.th({class:te(["cms-table-head-cell",ye(Ie==null?void 0:Ie.nowrap,"is-nowrap"),ye(S,"cms-table-sortable"),ye(u,"is-sorted"),Ie==null?void 0:Ie.headerClass]),style:z});S?A.appendChild(_.button({type:"button",class:"cms-table-head-button",onClick:()=>de(Ie,qe)},_.span({class:"cms-table-head-label"},...Pe),_.span({class:"cms-table-head-arrow","aria-hidden":"true"},u?M.dir==="asc"?"\u2191":"\u2193":"\u2195"))):Pe.forEach(et=>A.appendChild(et)),De.appendChild(A)}),q){const Ie=J(s,"actionsHeader",{},e.actionsLabel||"Azioni");De.appendChild(_.th({class:"cms-table-head-cell cms-table-head-actions",style:{textAlign:"right"}},...Ie))}g.appendChild(De)},Ve=(De,Ie)=>{const qe={columns:i,count:i.length},Be=J(s,De,qe,Ie),z=String(i.length+(q?1:0));P.appendChild(_.tr(_.td({colSpan:z,class:"cms-table-state"},...Be)))};return bt.reactive.effect(()=>{const De=nl(e.rows),Ie=String(H()||"").trim(),qe=Z(),Be=typeof e.loading=="function"?!!e.loading():!!e.loading,z=e.pagination!==!1;if(ne(),P.innerHTML="",_e&&_e.value!==H()&&(_e.value=H()),Te.value!==String(T())&&(Te.value=String(T())),Be){f.textContent="Caricamento in corso",h.style.display="none",B.style.display="none",N.textContent="Loading\u2026",I.textContent="",Oe.textContent="Pagina 1",K.disabled=!0,ke.disabled=!0,Ve("loading",e.loadingText||"Loading...");return}let Pe=De.slice();const M=Pe.length;if(typeof e.filter=="function"&&(Pe=Pe.filter((G,Ge)=>e.filter(G,{row:G,index:Ge,query:Ie,rows:De,columns:i}))),Ie&&(Pe=Pe.filter(G=>ol(G,i,Ie,e))),qe){const G=ui(i,qe.key);G&&Pe.sort((Ge,lt)=>{const tt=So(G,Ge,-1),dt=So(G,lt,-1),St=typeof G.compare=="function"?G.compare(tt,dt,Ge,lt):tl(tt,dt);return qe.dir==="asc"?St:-St})}const k=Pe.length,S=Math.max(1,Number(T())||w),u=z?Math.max(1,Math.ceil(k/S)):1,A=z?Math.min(C(),u):1;A!==C()&&v(A);const xe=z?(A-1)*S:0,Ue=z?xe+S:k,et=Pe.slice(xe,Ue);if(f.textContent=k===M?`${k} righe`:`${k} di ${M} righe`,h.textContent=Ie?`Ricerca: ${Ie}`:"",h.style.display=Ie?"":"none",qe){const G=ui(i,qe.key);B.textContent=G?`Ordine: ${ci(G)} ${qe.dir==="asc"?"\u2191":"\u2193"}`:"",B.style.display=G?"":"none"}else B.style.display="none";if(N.textContent=k?`${xe+1}-${Math.min(Ue,k)} di ${k}`:"0 risultati",I.textContent=k!==M?`Dataset totale ${M}`:`Page size ${S}`,Oe.textContent=z?`Pagina ${A} / ${u}`:"Tutte le righe",K.disabled=!z||A<=1,ke.disabled=!z||A>=u,Te.disabled=!z,Te.parentNode.style.display=z?"":"none",et.length===0){Ve("empty",e.emptyText||"Nessun dato");return}for(let G=0;G<et.length;G++){const Ge=et[G],lt=xe+G,tt={row:Ge,rowIndex:lt,pageIndex:G},dt=typeof e.rowAttrs=="function"?e.rowAttrs(Ge,tt)||{}:e.rowAttrs||{},St=typeof e.rowClass=="function"?e.rowClass(Ge,tt):e.rowClass,It=!!(e.onRowClick||e.onRowDblClick),Rt=_.tr({...dt,class:te(["cms-table-row",St,dt.class,ye(It,"is-clickable")])});if(e.rowKey){const st=typeof e.rowKey=="function"?e.rowKey(Ge,tt):Fo(Ge,e.rowKey);st!=null&&(Rt.dataset.key=String(st))}const Pt=st=>{const wt=st==null?void 0:st.target;return!!(wt&&wt.closest&&wt.closest("button, a, input, select, textarea, label, [data-table-action]"))};if(e.onRowClick&&Rt.addEventListener("click",st=>{Pt(st)||e.onRowClick(Ge,tt,st)}),e.onRowDblClick&&Rt.addEventListener("dblclick",st=>{Pt(st)||e.onRowDblClick(Ge,tt,st)}),i.forEach((st,wt)=>{var Qt,an;const Ft=So(st,Ge,lt),Dt={...tt,col:st,colIndex:wt,value:Ft},Yt={...Co(st==null?void 0:st.style,Dt),...Co((Qt=st==null?void 0:st.cellStyle)!=null?Qt:st==null?void 0:st.tdStyle,Dt)};st!=null&&st.align&&(Yt.textAlign=st.align),(st==null?void 0:st.width)!=null&&(Yt.width=yt(st.width)),(st==null?void 0:st.minWidth)!=null&&(Yt.minWidth=yt(st.minWidth)),(st==null?void 0:st.maxWidth)!=null&&(Yt.maxWidth=yt(st.maxWidth));const Xt=typeof(st==null?void 0:st.cellClass)=="function"?st.cellClass(Ge,Dt):(st==null?void 0:st.cellClass)||(st==null?void 0:st.class),on=_.td({class:te(["cms-table-cell",Xt,ye(st==null?void 0:st.nowrap,"is-nowrap")]),style:Yt});let jt=J(st==null?void 0:st.slots,"cell",Dt,null);if(!jt.length){const mn=typeof(st==null?void 0:st.render)=="function"?st.render(Ge,Dt):typeof(st==null?void 0:st.format)=="function"?st.format(Ft,Ge,Dt):Ft,Gt=mn==null?(an=st==null?void 0:st.emptyText)!=null?an:"":mn;jt=J(s,"cell",Dt,Gt)}jt.length||(jt=[""]),jt.forEach(mn=>on.appendChild(mn)),Rt.appendChild(on)}),q){const st={...tt},wt=typeof e.actions=="function"?e.actions(Ge,tt):e.actions;let Ft=J(s,"actions",st,wt);Ft.length||(Ft=J(null,"default",st,wt)),Rt.appendChild(_.td({class:"cms-table-cell cms-table-cell-actions",style:{textAlign:"right"}},_.div({class:"cms-table-actions"},...Ft)))}P.appendChild(Rt)}},"UI.Table:render"),be.body=me,Ne.Card(be)},Ne.Menu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(m,N)=>Object.prototype.hasOwnProperty.call(m||{},N),T=(m,N)=>typeof m=="function"?m(N):m,le=m=>String(m||"").split(/\s+/).filter(Boolean),Z=m=>m&&typeof m=="object"&&!m.nodeType&&!Array.isArray(m)&&!(m instanceof Function),he=m=>!!m&&typeof m=="object"&&(m.nodeType===1||typeof m.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(m,N,I)=>{if(!m)return;const K=m[N]||[];K.length&&m.classList.remove(...K);const ke=(I||[]).filter(Boolean);ke.length&&m.classList.add(...ke),m[N]=ke},se=(m,N,I,K=ke=>ke)=>{if(m){if(I==null||I===""){m.style.removeProperty(N);return}m.style.setProperty(N,K(I))}},X=()=>w||{},de=m=>{var I;const N=String(o((I=m.state)!=null?I:m.color)||"").toLowerCase();return i.includes(N)?N:""},_e=m=>{const N=String(o(m.size)||"").toLowerCase();return c.includes(N)?N:""},be=m=>{var N,I;return String(o((I=(N=m.placement)!=null?N:m.position)!=null?I:"bottom-start"))},me=()=>{var I;const m=o((I=X().delay)!=null?I:X().showDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):0},fe=()=>{const m=o(X().hideDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):80},ce=(m=null)=>{var I,K,ke;if(m)return m;const N=X();return r||o((ke=(K=(I=N.anchorEl)!=null?I:N.triggerEl)!=null?K:N.target)!=null?ke:N.anchor)||null},$=m=>{if(m==null||m===!0)return new Set(["click"]);if(m===!1)return new Set(["manual"]);const N=Array.isArray(m)?m:String(m).split(/[\s,|/]+/),I=new Set;return N.forEach(K=>{const ke=String(K||"").trim().toLowerCase();ke&&(ke==="mouseenter"||ke==="mouseover"?I.add("hover"):ke==="blur"||ke==="focusin"?I.add("focus"):ke==="tap"?I.add("click"):I.add(ke))}),I.size?I:new Set(["manual"])},re=(m,N)=>{var ke,Oe,Te;let I=null,K=null;if(he(m))I=m,Z(N)&&(K=N);else if(Z(m)){K=m;const U=(Te=(Oe=(ke=m.anchorEl)!=null?ke:m.triggerEl)!=null?Oe:m.target)!=null?Te:m.anchor;he(U)&&(I=U)}else m!=null&&(I=m);return{anchorEl:I,nextProps:K}},oe=(m=d==null?void 0:d.panel)=>{var N;return Array.from(((N=m==null?void 0:m.querySelectorAll)==null?void 0:N.call(m,"[data-menu-item]:not([disabled]):not([tabindex='-1']), .cms-menu-item:not([disabled]):not([tabindex='-1']), [role='menuitem']:not([disabled]):not([tabindex='-1']), a[href]:not([tabindex='-1']), button:not([disabled]):not([tabindex='-1'])"))||[]).filter(I=>I.offsetParent!==null&&I.getAttribute("aria-hidden")!=="true")},Se=()=>{o(X().autoFocus)!==!1&&setTimeout(()=>{const m=oe();if(!m.length)return;(m.find(I=>I.classList.contains("is-active")||I.classList.contains("is-selected")||I.classList.contains("is-checked"))||m[0]).focus()},0)},F=(m,N,I="sm")=>{const K=T(m,N);return K==null?[]:typeof K=="string"?[Ne.Icon({name:K,size:I})]:Vs(K,{...N,as:"icon"})},p=(m,N)=>{var xe,Ue,et,G,Ge,lt,tt,dt,St,It,Rt,Pt,st;const I=T(m,N);if(I==null||I===!1)return[];if(Array.isArray(I))return I.flatMap((wt,Ft)=>p(wt,{...N,index:Ft}));if(typeof I=="function")return p(I(N),N);if(I!=null&&I.nodeType)return[I];if(typeof I=="string"||typeof I=="number")return p({label:I},N);if(!Z(I))return Vs(I,{...N,as:"item"});const K=String((Ue=(xe=I.type)!=null?xe:I.kind)!=null?Ue:"").toLowerCase();if(K==="separator"||K==="divider"||I.separator===!0||I.divider===!0)return[_.div({class:"cms-menu-divider",role:"separator"})];const ke=(et=I.items)!=null?et:I.children;if((K==="group"||K==="section"||Array.isArray(ke))&&ke!=null){const wt={...N,item:I},Ft=J(s,"groupLabel",wt,T((G=I.label)!=null?G:I.title,wt)),Dt=p(ke,wt);return Dt.length?[_.div({class:te(["cms-menu-group",I.class])},Ft.length?_.div({class:"cms-menu-group-label"},...Ft):null,_.div({class:"cms-menu-group-items"},...Dt))]:[]}const Oe={...N,item:I,close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:X()},Te=!!o(I.disabled),U=I.checked==null?null:!!o(I.checked),j=!!o((Ge=I.active)!=null?Ge:I.selected),ne=de(I),Ve=o(I.href),He=o(I.to),ae=v(I,"closeOnSelect")?!!o(I.closeOnSelect):I.keepOpen===!0?!1:X().closeOnSelect!==!1,$e=I.role||(U!=null?"menuitemcheckbox":"menuitem"),Ee=F(I.icon,Oe),De=F((lt=I.iconRight)!=null?lt:I.endIcon,Oe),Ie=J(s,"itemTitle",Oe,T((tt=I.title)!=null?tt:I.label,Oe)),qe=J(s,"itemSubtitle",Oe,T((dt=I.subtitle)!=null?dt:I.description,Oe)),Be=J(s,"itemShortcut",Oe,T(I.shortcut,Oe)),z=J(s,"itemBadge",Oe,T(I.badge,Oe)),Pe=J(s,"item",Oe,T((It=(St=I.content)!=null?St:I.body)!=null?It:I.render,Oe)),M=[...z,...Be,...U===!0&&!De.length&&!z.length?[_.span({class:"cms-menu-entry-check"},Ne.Icon({name:I.checkedIcon||"check",size:"sm"}))]:[],...De],S={class:te(["cms-menu-entry","cms-menu-item",ne?`cms-state-${ne}`:"",ye(j,"is-active"),ye(U===!0,"is-checked"),ye(Te,"is-disabled"),I.class]),role:$e,tabIndex:Te?-1:(Rt=I.tabIndex)!=null?Rt:-1,"data-menu-item":!0,"data-menu-select":ae?"true":"false","data-menu-close":I.close===!0?"true":null,"data-menu-keep-open":ae?null:"true","aria-disabled":Te?"true":null,"aria-checked":U==null?null:String(U),title:(st=(Pt=I.titleAttr)!=null?Pt:I.tooltip)!=null?st:null,type:Ve?null:"button",href:Ve||null,target:I.target||null,rel:I.rel||(I.target==="_blank"?"noopener noreferrer":null),onClick:wt=>{var Dt,Yt,Xt,on;if(Te){wt.preventDefault(),wt.stopPropagation();return}(Yt=(Dt=X()).onItemClick)==null||Yt.call(Dt,I,Oe,wt);const Ft=(Xt=I.onClick)==null?void 0:Xt.call(I,Oe,wt);wt.defaultPrevented||(He&&((on=JSswift.router)!=null&&on.navigate)&&(wt.preventDefault(),JSswift.router.navigate(He)),Ft!==!1&&ae&&ie())}};I.attrs&&typeof I.attrs=="object"&&Object.assign(S,I.attrs);const u=Ve?_.a:_.button,A=Pe.length?Pe:[Ie.length?_.div({class:"cms-menu-entry-title"},...Ie):null,qe.length?_.div({class:"cms-menu-entry-subtitle"},...qe):null].filter(Boolean);return[u(S,Ee.length?_.span({class:"cms-menu-entry-icon"},...Ee):null,_.span({class:"cms-menu-entry-main"},...A),M.length?_.span({class:"cms-menu-entry-aside"},...M):null)]},f=()=>{var Ie,qe,Be,z,Pe,M,k;const m=X(),N={close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:m},I=F(m.icon,N,m.iconSize||"md"),K=J(s,"eyebrow",N,T(m.eyebrow,N)),ke=J(s,"title",N,T((qe=(Ie=m.title)!=null?Ie:m.heading)!=null?qe:m.label,N)),Oe=J(s,"subtitle",N,T((Be=m.subtitle)!=null?Be:m.description,N)),Te=J(s,"before",N,T(m.before,N)),U=J(s,"header",N,T(m.header,N)),j=J(s,"after",N,T(m.after,N)),ne=J(s,"footer",N,T(m.footer,N)),Ve=J(s,"status",N,T(m.status,N));let He=(z=m.content)!=null?z:m.body;He==null&&n&&n.length&&(He=n);let ae=J(s,"content",N,T(He,N));ae.length||(ae=J(s,"body",N,T(He,N))),ae.length||(ae=J(s,"default",N,T(He,N)));const $e=p((M=(Pe=m.items)!=null?Pe:m.actionsList)!=null?M:m.entries,N),Ee=$e.length?[]:J(s,"empty",N,T((k=m.empty)!=null?k:m.emptyText,N));let De=null;return U.length?De=_.div({class:te(["cms-menu-head","cms-menu-head-custom",m.headerClass])},...U):(I.length||K.length||ke.length||Oe.length)&&(De=_.div({class:te(["cms-menu-head",m.headerClass])},I.length?_.div({class:"cms-menu-head-icon"},...I):null,_.div({class:"cms-menu-head-main"},K.length?_.div({class:"cms-menu-eyebrow"},...K):null,ke.length?_.div({class:"cms-menu-title"},...ke):null,Oe.length?_.div({class:"cms-menu-subtitle"},...Oe):null))),_.div({class:te(["cms-menu","cms-menu-shell",ye(m.dense,"dense"),ye($e.length>0,"has-items"),ye(ne.length>0||Ve.length>0,"has-footer"),m.class]),style:m.style||{},role:m.role||"menu","aria-label":m.ariaLabel||null},Te.length?_.div({class:"cms-menu-before"},...Te):null,De,ae.length?_.div({class:te(["cms-menu-content",m.contentClass])},...ae):null,$e.length?_.div({class:te(["cms-menu-items",m.itemsClass])},...$e):null,!$e.length&&Ee.length?_.div({class:"cms-menu-empty"},...Ee):null,j.length?_.div({class:"cms-menu-after"},...j):null,Ve.length||ne.length?_.div({class:te(["cms-menu-footer",m.footerClass])},Ve.length?_.div({class:"cms-menu-status"},...Ve):null,ne.length?_.div({class:"cms-menu-footer-actions"},...ne):null):null)},h=m=>{var ke;if(!(m!=null&&m.panel))return;const N=X(),I=de(N),K=_e(N);W(m.panel,"_menuClassTokens",["cms-menu-panel","cms-clear-set","cms-singularity",K?`cms-menu-${K}`:"",I?`cms-state-${I}`:"",o(N.outline)?"outline":"",...le(N.panelClass)]),W(m.overlay,"_menuOverlayClassTokens",[...le(N.overlayClass)]),m.panel.dataset.placement=be(N),se(m.panel,"--cms-menu-width",o(N.width),yt),se(m.panel,"--cms-menu-min-width",o(N.minWidth),yt),se(m.panel,"--cms-menu-max-width",o(N.maxWidth),yt),se(m.panel,"--cms-menu-max-height",o(N.maxHeight),yt),se(m.panel,"--cms-menu-body-max-height",o((ke=N.bodyMaxHeight)!=null?ke:N.contentMaxHeight),yt),N.panelStyle&&Object.assign(m.panel.style,N.panelStyle),Nt(m.panel,N)},B=()=>{d!=null&&d.panel&&d.panel.replaceChildren(f())},ie=()=>{if(H(),!d)return;const m=d;d=null,ks(m,()=>JSswift.overlay.close(m.id))},a=(m={})=>{var N,I,K,ke;if(m&&typeof m=="object"&&(w={...w,...m}),d){const Oe=X();h(d),B(),(ke=d.reposition)==null||ke.call(d,{anchorEl:d._anchorEl,placement:be(Oe),offsetX:(N=Oe.offsetX)!=null?N:0,offsetY:(K=(I=Oe.offsetY)!=null?I:Oe.offset)!=null?K:8}),Se()}return E},x=(m=null,N=null)=>{var De,Ie,qe,Be,z,Pe,M,k,S,u,A,xe,Ue,et,G,Ge;H();const{anchorEl:I,nextProps:K}=re(m,N);K&&(w={...w,...K});const ke=X(),Oe=ce(I);if(!Oe||o(ke.disabled))return null;if(d&&d._anchorEl===Oe){const lt=X();return h(d),B(),(Be=d.reposition)==null||Be.call(d,{anchorEl:d._anchorEl,placement:be(lt),offsetX:(De=lt.offsetX)!=null?De:0,offsetY:(qe=(Ie=lt.offsetY)!=null?Ie:lt.offset)!=null?qe:8}),Se(),d}d&&ie(),b=document.activeElement;let Te=null;if(d=JSswift.overlay.open(()=>f(),{type:"menu",anchorEl:Oe,placement:be(ke),offsetX:(z=ke.offsetX)!=null?z:0,offsetY:(M=(Pe=ke.offsetY)!=null?Pe:ke.offset)!=null?M:8,backdrop:ke.backdrop===!0,lockScroll:ke.lockScroll===!0,trapFocus:ke.trapFocus===!0,autoFocus:!1,closeOnOutside:ke.closeOnOutside!==!1,closeOnBackdrop:(k=ke.closeOnBackdrop)!=null?k:ke.backdrop===!0,closeOnEsc:ke.closeOnEsc!==!1,className:qt(["cms-menu-panel"]),onClose:()=>{var lt,tt,dt;(lt=Te==null?void 0:Te._menuCleanup)==null||lt.call(Te),(dt=(tt=X()).onClose)==null||dt.call(tt,Te),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const U=d;Te=U,U._anchorEl=Oe;const j=()=>{clearTimeout(C),C=null},ne=()=>{P()},Ve=lt=>{const tt=lt.target;if(!tt||!tt.closest)return;if(tt.closest("[data-menu-close]")){ie();return}if(X().closeOnSelect===!1)return;const dt=tt.closest("[data-menu-item], [data-menu-select], .cms-menu-item, [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], a[href], button:not([disabled])");dt&&(dt.closest("[data-menu-keep-open]")||dt.getAttribute("data-menu-select")!=="false"&&ie())},He=lt=>{if(lt.key==="Escape"){lt.preventDefault(),ie();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(lt.key))return;const tt=oe(U.panel);if(!tt.length)return;lt.preventDefault();const dt=tt.indexOf(document.activeElement);if(lt.key==="Home"){tt[0].focus();return}if(lt.key==="End"){tt[tt.length-1].focus();return}const St=lt.key==="ArrowDown"?1:-1,It=dt<0?St>0?0:tt.length-1:(dt+St+tt.length)%tt.length;tt[It].focus()};U.panel.addEventListener("click",Ve),U.panel.addEventListener("keydown",He);const ae=$((u=(S=ke.trigger)!=null?S:ke.triggers)!=null?u:v(ke,"open")?"manual":null),$e=ae.has("hover"),Ee=ae.has("focus");return($e||Ee)&&(U.panel.addEventListener("mouseenter",j),U.panel.addEventListener("mouseleave",ne),U.panel.addEventListener("focusin",j),U.panel.addEventListener("focusout",ne)),U._menuCleanup=()=>{var lt,tt,dt,St,It,Rt;(lt=U.panel)==null||lt.removeEventListener("click",Ve),(tt=U.panel)==null||tt.removeEventListener("keydown",He),(dt=U.panel)==null||dt.removeEventListener("mouseenter",j),(St=U.panel)==null||St.removeEventListener("mouseleave",ne),(It=U.panel)==null||It.removeEventListener("focusin",j),(Rt=U.panel)==null||Rt.removeEventListener("focusout",ne)},h(U),(et=U.reposition)==null||et.call(U,{anchorEl:Oe,placement:be(ke),offsetX:(A=ke.offsetX)!=null?A:0,offsetY:(Ue=(xe=ke.offsetY)!=null?xe:ke.offset)!=null?Ue:8}),_s(U),(Ge=(G=X()).onOpen)==null||Ge.call(G,U),Se(),U},g=(m,N=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>x(m,N),me())},P=(m=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),m){ie();return}C=setTimeout(()=>ie(),fe())}},q=(m=null,N=null)=>Q()?(ie(),null):x(m,N),Q=()=>!!d,E={open:x,close:ie,show:g,hide:P,toggle:q,update:a,bind:m=>{var ne,Ve;if(!m)return()=>{};r=m;const N=X(),I=$((Ve=(ne=N.trigger)!=null?ne:N.triggers)!=null?Ve:v(N,"open")?"manual":null),K=I.has("hover"),ke=I.has("focus"),Oe=I.has("click"),Te=I.has("manual")||!K&&!ke&&!Oe,U=[],j=()=>{H(),U.forEach(He=>He()),r===m&&(r=null)};if(v(N,"open"))return Ye(N.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?x(r):P(!0))},"UI.Menu:open"):N.open===!0?x(m):N.open===!1&&P(!0),j;if(Te||o(N.disabled))return j;if(K){const He=()=>g(m),ae=()=>P();m.addEventListener("mouseenter",He),m.addEventListener("mouseleave",ae),U.push(()=>{m.removeEventListener("mouseenter",He),m.removeEventListener("mouseleave",ae)})}if(ke){const He=()=>g(m),ae=()=>P();m.addEventListener("focus",He),m.addEventListener("blur",ae),U.push(()=>{m.removeEventListener("focus",He),m.removeEventListener("blur",ae)})}if(Oe){const He=ae=>{var $e,Ee;(Ee=($e=X()).onTriggerClick)==null||Ee.call($e,ae),!ae.defaultPrevented&&q(m)};m.addEventListener("click",He),U.push(()=>m.removeEventListener("click",He))}return j},isOpen:Q,entry:()=>d,props:()=>({...w})};return E},Ne.Popover=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(E,m)=>Object.prototype.hasOwnProperty.call(E||{},m),T=(E,m)=>typeof E=="function"?E(m):E,le=E=>String(E||"").split(/\s+/).filter(Boolean),Z=E=>E&&typeof E=="object"&&!E.nodeType&&!Array.isArray(E)&&!(E instanceof Function),he=E=>!!E&&typeof E=="object"&&(E.nodeType===1||typeof E.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(E,m,N)=>{if(!E)return;const I=E[m]||[];I.length&&E.classList.remove(...I);const K=(N||[]).filter(Boolean);K.length&&E.classList.add(...K),E[m]=K},se=(E,m,N,I=K=>K)=>{if(E){if(N==null||N===""){E.style.removeProperty(m);return}E.style.setProperty(m,I(N))}},X=()=>w,de=E=>{var N;const m=o((N=E.state)!=null?N:E.color);return m?i.includes(m)?m:String(m):""},_e=E=>{const m=o(E.size);return typeof m=="string"&&c.includes(m)?m:""},be=E=>{var N,I,K;const m=String(o((K=(I=(N=E.actionsAlign)!=null?N:E.footerAlign)!=null?I:E.alignActions)!=null?K:"end")).toLowerCase();return["start","left"].includes(m)?"start":["center","middle"].includes(m)?"center":["between","space-between"].includes(m)?"between":["stretch","full"].includes(m)?"stretch":"end"},me=E=>{var m,N;return String(o((N=(m=E.placement)!=null?m:E.position)!=null?N:"bottom-start"))},fe=(E,m)=>{const N=o(E);if(N==null||N==="")return m;const I=Number(N);return Number.isFinite(I)?I:m},ce=()=>fe(X().delay,0),$=()=>fe(X().hideDelay,120),re=E=>{var N,I;return((I=(N=E.closable)!=null?N:E.dismissible)!=null?I:E.closeButton)===!0},oe=(E=null)=>{var N,I,K;if(E)return E;const m=X();return r||o((K=(I=(N=m.anchorEl)!=null?N:m.triggerEl)!=null?I:m.target)!=null?K:m.anchor)||null},Se=E=>{if(E==null||E===!0)return new Set(["click"]);if(E===!1)return new Set(["manual"]);const m=Array.isArray(E)?E:String(E).split(/[\s,|/]+/),N=new Set;return m.forEach(I=>{const K=String(I||"").trim().toLowerCase();K&&(K==="mouseenter"||K==="mouseover"?N.add("hover"):K==="blur"||K==="focusin"?N.add("focus"):K==="tap"?N.add("click"):N.add(K))}),N.size?N:new Set(["manual"])},F=(E,m)=>{var K,ke,Oe;let N=null,I=null;if(he(E))N=E,Z(m)&&(I=m);else if(Z(E)){I=E;const Te=(Oe=(ke=(K=E.anchorEl)!=null?K:E.triggerEl)!=null?ke:E.target)!=null?Oe:E.anchor;he(Te)&&(N=Te)}else E!=null&&(N=E);return{anchorEl:N,nextProps:I}},p=()=>{var Ee,De,Ie,qe,Be,z,Pe,M,k;const E=X(),m={close:B,dismiss:B,open:a,toggle:P,update:ie,isOpen:q,entry:()=>d,anchorEl:oe(),props:E},N=E.icon!=null?typeof E.icon=="string"?Ne.Icon({name:E.icon,size:E.iconSize||"md"}):JSswift.ui.slot(E.icon,{as:"icon"}):null,I=J(s,"eyebrow",m,T(E.eyebrow,m)),K=J(s,"title",m,T((De=(Ee=E.title)!=null?Ee:E.heading)!=null?De:E.label,m)),ke=J(s,"subtitle",m,T((Ie=E.subtitle)!=null?Ie:E.description,m)),Oe=J(s,"icon",m,N),Te=J(s,"header",m,T((Be=(qe=E.headerContent)!=null?qe:E.head)!=null?Be:E.header,m)),U=re(E)?J(s,"close",m,Ne.Btn({class:"cms-dialog-close",size:"sm",outline:!0,"aria-label":E.closeLabel||"Chiudi popover","data-popover-close":!0},Ne.Icon({name:E.closeIcon||"close",size:"sm"}))):[];let j=(M=(Pe=(z=E.content)!=null?z:E.body)!=null?Pe:E.message)!=null?M:E.text;j==null&&n&&n.length&&(j=n);let ne=J(s,"content",m,T(j,m));ne.length||(ne=J(s,"body",m,T(j,m))),ne.length||(ne=J(s,"default",m,T(j,m)));const Ve=T((k=E.footer)!=null?k:E.actions,m);let He=J(s,"footer",m,Ve);He.length||(He=J(s,"actions",m,Ve));let ae=null;Te.length?ae=_.div({class:"cms-dialog-head cms-dialog-head-custom"},...Te):(I.length||K.length||ke.length||Oe.length||U.length)&&(ae=_.div({class:"cms-dialog-head"},Oe.length?_.div({class:"cms-dialog-icon"},...Oe):null,_.div({class:"cms-dialog-head-main"},I.length?_.div({class:"cms-dialog-eyebrow"},...I):null,K.length?_.div({class:"cms-dialog-title"},...K):null,ke.length?_.div({class:"cms-dialog-subtitle"},...ke):null),U.length?_.div({class:"cms-dialog-close-wrap"},...U):null));const $e=[];return ae&&$e.push(ae),ne.length&&$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])},...ne)),He.length&&$e.push(_.div({class:te(["cms-dialog-actions",`is-${be(E)}`,ye(E.stackActions,"is-stacked"),E.actionsClass,E.footerClass])},...He)),$e.length||$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])})),_.div({class:te(["cms-dialog-shell","cms-popover-shell",ye(!!ae,"has-head"),ye(He.length>0,"has-footer"),ye(E.divider!==!1,"with-divider")])},...$e)},f=E=>{var K;if(!(E!=null&&E.panel))return;const m=X(),N=de(m),I=_e(m);W(E.panel,"_popoverClassTokens",["cms-dialog","cms-popover","cms-singularity","cms-clear-set",I?`cms-dialog-${I}`:"",N,N?`cms-state-${N}`:"",o(m.scrollable)?"scrollable":"",o(m.stickyHeader)?"sticky-head":"",o(m.stickyActions)?"sticky-actions":"",o(m.borderless)?"borderless":"",...le(m.class),...le(m.panelClass)]),W(E.overlay,"_popoverOverlayClassTokens",[...le(m.overlayClass)]),E.panel.dataset.placement=me(m),se(E.panel,"--cms-dialog-width",o(m.width),yt),se(E.panel,"--cms-dialog-min-width",o(m.minWidth),yt),se(E.panel,"--cms-dialog-max-width",o(m.maxWidth),yt),se(E.panel,"--cms-dialog-max-height",o(m.maxHeight),yt),se(E.panel,"--cms-dialog-body-max-height",o((K=m.bodyMaxHeight)!=null?K:m.contentMaxHeight),yt),m.style&&Object.assign(E.panel.style,m.style),Nt(E.panel,m),E.panel.setAttribute("role",m.role||"dialog"),E.panel.setAttribute("aria-modal",m.modal===!0?"true":"false"),m.ariaLabel?E.panel.setAttribute("aria-label",m.ariaLabel):E.panel.removeAttribute("aria-label")},h=()=>{d!=null&&d.panel&&d.panel.replaceChildren(p())},B=()=>{if(H(),!d)return;const E=d;d=null,ks(E,()=>JSswift.overlay.close(E.id))},ie=(E={})=>(E&&typeof E=="object"&&(w={...w,...E}),d&&(f(d),h()),ve),a=(E=null,m=null)=>{var $e,Ee,De,Ie,qe,Be,z,Pe;H();const{anchorEl:N,nextProps:I}=F(E,m);I&&(w={...w,...I});const K=X(),ke=oe(N);if(!ke||o(K.disabled))return null;if(d&&d._anchorEl===ke)return f(d),h(),d;d&&B(),b=document.activeElement;const Oe=Se((Ee=($e=K.trigger)!=null?$e:K.triggers)!=null?Ee:v(K,"open")?"manual":null),Te=Oe.has("hover"),U=Oe.has("focus");let j=null;if(d=JSswift.overlay.open(()=>p(),{type:"popover",anchorEl:ke,placement:me(K),offsetX:(De=K.offsetX)!=null?De:0,offsetY:(qe=(Ie=K.offsetY)!=null?Ie:K.offset)!=null?qe:10,backdrop:K.backdrop===!0,lockScroll:K.lockScroll===!0,trapFocus:K.trapFocus===!0,autoFocus:K.autoFocus===!0,closeOnOutside:K.closeOnOutside!==!1,closeOnBackdrop:(Be=K.closeOnBackdrop)!=null?Be:K.backdrop===!0,closeOnEsc:K.closeOnEsc!==!1,className:qt(["cms-dialog","cms-popover"]),onClose:()=>{var M,k,S;(M=j==null?void 0:j._popoverCleanup)==null||M.call(j),(S=(k=X()).onClose)==null||S.call(k,j),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const ne=d;j=ne,ne._anchorEl=ke;const Ve=()=>{clearTimeout(C),C=null},He=()=>{!Te&&!U||g()},ae=M=>{const k=M.target;if(!(!k||!k.closest)){if(k.closest("[data-popover-close]")||k.closest("[data-dialog-close]")){B();return}X().closeOnSelect===!0&&k.closest("[data-popover-select]")&&B()}};return ne.panel.addEventListener("click",ae),(Te||U)&&(ne.panel.addEventListener("mouseenter",Ve),ne.panel.addEventListener("mouseleave",He),ne.panel.addEventListener("focusin",Ve),ne.panel.addEventListener("focusout",He)),ne._popoverCleanup=()=>{var M,k,S,u,A;(M=ne.panel)==null||M.removeEventListener("click",ae),(k=ne.panel)==null||k.removeEventListener("mouseenter",Ve),(S=ne.panel)==null||S.removeEventListener("mouseleave",He),(u=ne.panel)==null||u.removeEventListener("focusin",Ve),(A=ne.panel)==null||A.removeEventListener("focusout",He)},f(ne),_s(ne),(Pe=(z=X()).onOpen)==null||Pe.call(z,ne),ne},x=(E,m=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>a(E,m),ce())},g=(E=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),E){B();return}C=setTimeout(()=>B(),$())}},P=(E=null,m=null)=>q()?(B(),null):a(E,m),q=()=>!!d,ve={open:a,close:B,show:x,hide:g,toggle:P,update:ie,bind:E=>{var j,ne;if(!E)return()=>{};r=E;const m=X(),N=Se((ne=(j=m.trigger)!=null?j:m.triggers)!=null?ne:v(m,"open")?"manual":null),I=N.has("hover"),K=N.has("focus"),ke=N.has("click"),Oe=N.has("manual")||!I&&!K&&!ke,Te=[],U=()=>{H(),Te.forEach(Ve=>Ve()),r===E&&(r=null)};if(v(m,"open"))return Ye(m.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?a(r):g(!0))},"UI.Popover:open"):m.open===!0?a(E):m.open===!1&&g(!0),U;if(Oe||o(m.disabled))return U;if(I){const Ve=()=>x(E),He=()=>g();E.addEventListener("mouseenter",Ve),E.addEventListener("mouseleave",He),Te.push(()=>{E.removeEventListener("mouseenter",Ve),E.removeEventListener("mouseleave",He)})}if(K){const Ve=()=>x(E),He=()=>g();E.addEventListener("focus",Ve),E.addEventListener("blur",He),Te.push(()=>{E.removeEventListener("focus",Ve),E.removeEventListener("blur",He)})}if(ke){const Ve=He=>{var ae,$e;($e=(ae=X()).onTriggerClick)==null||$e.call(ae,He),!He.defaultPrevented&&P(E)};E.addEventListener("click",Ve),Te.push(()=>E.removeEventListener("click",Ve))}return U},isOpen:q,entry:()=>d,props:()=>({...w})};return ve},Ne.ContextMenu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t);let s={...e},i=null,c=null,w=null;const d=h=>h&&typeof h=="object"&&!h.nodeType&&!Array.isArray(h)&&!(h instanceof Function),r=h=>!!h&&typeof h=="object"&&(h.nodeType===1||typeof h.getBoundingClientRect=="function"),b=h=>!!h&&typeof h=="object"&&("clientX"in h||"type"in h||"target"in h||"currentTarget"in h),O=h=>!!h&&Number.isFinite(Number(h.x))&&Number.isFinite(Number(h.y)),C=()=>s,v=(h,B)=>{const ie=Number(h),a=Number(B);return!Number.isFinite(ie)||!Number.isFinite(a)?null:{x:ie,y:a}},T=h=>h?{_cmsContextPoint:h,getBoundingClientRect:()=>({top:h.y,bottom:h.y,left:h.x,right:h.x,width:0,height:0})}:null,le=h=>{if(!r(h))return null;const B=h.getBoundingClientRect();return v(B.left+Math.min(B.width/2,24),B.top+Math.min(B.height/2,24))},Z=h=>{var B,ie,a,x;return o((x=(a=(ie=(B=h==null?void 0:h.anchorEl)!=null?B:h==null?void 0:h.triggerEl)!=null?ie:h==null?void 0:h.target)!=null?a:h==null?void 0:h.anchor)!=null?x:null)},he=(h,B=null)=>{if(!h)return le(B||w);const ie=v(h.clientX,h.clientY);if(ie)return ie;const a=Z({anchorEl:B||h.currentTarget||h.target||w});return le(a)},H=(h={})=>{if(!d(h))return{};const B={...h};return delete B.event,delete B.point,delete B.x,delete B.y,B},W=()=>{var B,ie,a;const h=C();return{...h,trigger:"manual",placement:h.placement||"bottom-start",offsetX:(B=h.offsetX)!=null?B:0,offsetY:(a=(ie=h.offsetY)!=null?ie:h.offset)!=null?a:4,closeOnOutside:h.closeOnOutside!==!1,closeOnEsc:h.closeOnEsc!==!1,role:h.role||"menu",ariaLabel:h.ariaLabel||h.title||"Context menu",class:te(["cms-context-menu-shell",h.class]),panelClass:te(["cms-context-menu-panel",h.panelClass])}},se=Ne.Menu(W(),...n),X=(h=null,B=null,ie=null)=>{let a=null,x=null,g=null;if(b(h))a=he(h,w),g=d(B)?H(B):null;else if(typeof h=="number"||typeof B=="number")a=v(h,B),g=d(ie)?H(ie):null;else if(O(h))a=v(h.x,h.y),g=d(B)?H(B):null;else if(r(h))x=h,g=d(B)?H(B):null;else if(d(h)){const P=O(h.point)?h.point:O(h)?h:null,q=Z(h),Q=h.event;a=P?v(P.x,P.y):he(Q,q||w),x=q&&r(q)?q:null,g={...H(h),...d(B)?H(B):{}}}else i&&(a={...i});return{point:a,anchor:x,nextProps:g}},de=(h,B=null)=>{c=h||c,i=B||h&&h._cmsContextPoint||i},_e=(h=null)=>{d(h)&&Object.keys(h).length&&(s={...s,...h})},be=(h=null,B=null)=>{if(B)return T(B);if(h&&r(h))return h;const ie=Z(C());return r(ie)?ie:i?T(i):r(c)?c:r(w)?w:null},me=(h=null,B=null,ie=null)=>{const{point:a,anchor:x,nextProps:g}=X(h,B,ie);_e(g);const P=be(x,a);return P?(de(P,a),se.open(P,W())):null},fe=(h,B,ie=null)=>me(h,B,ie),ce=(h,B=null)=>me(h,B),$=()=>(se.close(),f),re=(h=!0)=>(h===!1?se.hide(!1):se.close(),f),oe=(h=null,B=null,ie=null)=>me(h,B,ie),Se=(h=null,B=null,ie=null)=>se.isOpen()?($(),null):me(h,B,ie),F=(h={})=>(_e(H(h)),se.update(W()),f),f={open:me,openAt:fe,openFromEvent:ce,show:oe,hide:re,close:$,toggle:Se,update:F,bind:(h,B=null)=>{if(!h)return()=>{};const ie=d(B)?H(B):null,a=g=>{var q,Q;w=h,g.preventDefault(),!(((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))&&me({event:g,anchorEl:h},ie)},x=g=>{var q,Q;g.key!=="ContextMenu"&&!(g.shiftKey&&g.key==="F10")||(w=h,g.preventDefault(),((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))||me({event:g,anchorEl:h},ie)};return h.addEventListener("contextmenu",a),h.addEventListener("keydown",x),()=>{h.removeEventListener("contextmenu",a),h.removeEventListener("keydown",x)}},isOpen:se.isOpen,entry:se.entry,props:()=>({...s})};return f}})(JSswift);
|
|
34
|
+
`,document.head.appendChild(w),fn._textNode=n,fn._spinner=e,fn._progressWrap=s,fn._progressBar=i,fn._progressActive=!1,fn}function ri(t,e){if(typeof t=="object"&&t!==null)return{...t};const n=e&&typeof e=="object"?e:{};return typeof e=="string"&&(t==null||typeof t=="number")?{...n,message:e}:{...n,message:t}}function ai(t,e){const n=e==="progress";t._spinner.style.display=n?"none":"",t._progressWrap.style.display=n?"block":"none",t._mode=e}bt.loading.show=function(t="Loading...",e={}){const n=li(),s=ri(t,e);Bs++,n._progressActive=!1,n._textNode.textContent=s.message||"Loading...",ai(n,"spinner"),s.spinner===!1&&(n._spinner.style.display="none"),n.style.display="flex"},bt.loading.hide=function(){fn&&(Bs=Math.max(0,Bs-1),Bs===0&&(fn.style.display="none",fn._progressActive=!1))},bt.loading.progress=function(t=0,e={}){var c;const n=li();typeof t=="object"&&t!==null&&(e=t,t=(c=t.value)!=null?c:0);const s=ri(null,e);n._progressActive||(Bs++,n._progressActive=!0);const i=Math.max(0,Math.min(100,Number(t!=null?t:0)));n._textNode.textContent=s.message||"Loading...",n._progressBar.style.width=i+"%",ai(n,"progress"),n.style.display="flex"},bt.loading.wrap=async function(t,e){bt.loading.show(t);try{return await e()}finally{bt.loading.hide()}};function el(t){return typeof t=="function"?t():t||[]}function Fo(t,e){if(!(t==null||e==null))return typeof e!="string"||e.indexOf(".")<0?t==null?void 0:t[e]:e.split(".").reduce((n,s)=>n==null?n:n[s],t)}function tl(t,e){return t==null&&e==null?0:t==null?-1:e==null?1:typeof t=="number"&&typeof e=="number"?t-e:String(t).localeCompare(String(e),void 0,{numeric:!0,sensitivity:"base"})}function nl(t){const e=el(t);return Array.isArray(e)?e:[]}function ci(t){var e,n,s,i;return(i=(s=(n=(e=t==null?void 0:t.label)!=null?e:t==null?void 0:t.title)!=null?n:t==null?void 0:t.header)!=null?s:t==null?void 0:t.key)!=null?i:""}function Do(t,e){var n,s;return(s=(n=t==null?void 0:t.sortKey)!=null?n:t==null?void 0:t.key)!=null?s:`__col_${e}`}function ui(t,e){return t.find((n,s)=>Do(n,s)===e||(n==null?void 0:n.key)===e)||null}function So(t,e,n){return t?typeof t.get=="function"?t.get(e,{row:e,rowIndex:n,col:t}):typeof t.value=="function"?t.value(e,{row:e,rowIndex:n,col:t}):typeof t.key=="string"?Fo(e,t.key):t.key!=null?e==null?void 0:e[t.key]:e:e}function Co(t,e){return typeof t=="function"?t(e)||{}:t||{}}function xo(t){if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.map(xo).filter(Boolean).join(" ");if(typeof Node!="undefined"&&t instanceof Node)return t.textContent||"";if(typeof t=="object"){if(typeof t.textContent=="string")return t.textContent;try{return JSON.stringify(t)}catch(e){return""}}return String(t)}function sl(t,e){const s=(Array.isArray(t)?t:e).map(i=>Number(i)).filter(i=>Number.isFinite(i)&&i>0);return s.length?Array.from(new Set(s)):e}function ol(t,e,n,s){const i=s.searchBy||s.searchPredicate;if(typeof i=="function")return!!i(t,{query:n,columns:e});const c=String(n||"").trim().toLowerCase().split(/\s+/).filter(Boolean);if(!c.length)return!0;const w=Array.isArray(s.searchKeys)&&s.searchKeys.length?s.searchKeys:e.filter(b=>(b==null?void 0:b.searchable)!==!1).map(b=>{var O;return(O=b==null?void 0:b.searchKey)!=null?O:b==null?void 0:b.key}).filter(Boolean),d=[];if(w.length)for(const b of w)if(typeof b=="function")d.push(xo(b(t)));else{const O=e.find(C=>(C==null?void 0:C.key)===b||(C==null?void 0:C.searchKey)===b);d.push(xo(O?So(O,t,-1):Fo(t,b)))}else d.push(xo(t));const r=d.join(" ").toLowerCase();return c.every(b=>r.includes(b))}Ne.Table=(...t)=>{var He,ae,$e,Ee;const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=Array.isArray(e.columns)?e.columns:[],c=sl(e.pageSizeOptions,[5,10,20,50]),w=Number((ae=(He=e.pageSize)!=null?He:c[0])!=null?ae:10)||10,d=Array.from(new Set([...c,w])).sort((De,Ie)=>De-Ie),r=e.initialSort||(e.sortBy?{key:e.sortBy,dir:e.sortDir==="desc"?"desc":"asc"}:null),b=e.searchable===!0||typeof e.searchable=="string"||e.searchPlaceholder!=null||e.search!=null||e.query!=null||!!e.searchModel||!!e.queryModel||Array.isArray(e.searchKeys)||typeof e.searchBy=="function"||typeof e.searchPredicate=="function",O=en(e.searchModel||e.queryModel,"UI.Table:query"),[C,v]=bt.reactive.signal(Math.max(1,Number(e.page||1)||1)),[T,le]=bt.reactive.signal(w),[Z,he]=bt.reactive.signal(r),[H,W]=bt.reactive.signal(String((Ee=O?O.get():($e=e.search)!=null?$e:e.query)!=null?Ee:"")),se=De=>{const Ie=String(De!=null?De:"");W(Ie),O&&O.set(Ie),v(1)},X=De=>{const Ie=Number(De)||w;le(Ie),v(1)},de=(De,Ie)=>{const qe=Do(De,Ie),Be=Z();!Be||Be.key!==qe&&Be.key!==(De==null?void 0:De.key)?he({key:qe,dir:"asc"}):Be.dir==="asc"?he({key:qe,dir:"desc"}):he(null),v(1)};let _e=null;O&&O.watch(De=>{const Ie=String(De!=null?De:"");W(Ie),_e&&_e.value!==Ie&&(_e.value=Ie),v(1)},"UI.Table:queryWatch");const be=JSswift.omit(e,["columns","rows","rowKey","loading","page","pageSize","pageSizeOptions","pagination","initialSort","sortBy","sortDir","search","query","searchable","searchPlaceholder","searchKeys","searchBy","searchPredicate","searchModel","queryModel","filter","actions","actionsLabel","emptyText","loadingText","onRowClick","onRowDblClick","tableClass","tableStyle","cardClass","dense","striped","hover","stickyHeader","toolbar","toolbarStart","toolbarEnd","caption","footer","status","rowClass","rowAttrs","minTableWidth","hideHeader","hideFooter","hideStatus","slots","body"]);be.class=te(["cms-table-card",e.class,e.cardClass]),e.dense!=null&&(be.dense=e.dense);const me=_.div({class:"cms-table-shell"}),fe=J(s,"default",{},n);fe.length&&me.appendChild(_.div({class:"cms-table-lead"},...fe));const ce=J(s,"toolbarStart",{},e.toolbarStart),$=J(s,"toolbar",{},e.toolbar),re=J(s,"toolbarEnd",{},e.toolbarEnd),oe=_.div({class:"cms-table-toolbar"}),Se=_.div({class:"cms-table-toolbar-main"}),F=_.div({class:"cms-table-toolbar-side"});ce.forEach(De=>Se.appendChild(De)),$.forEach(De=>Se.appendChild(De));const p=J(s,"search",{query:H(),getQuery:H,setQuery:se},null);if(p.length)p.forEach(De=>F.appendChild(De));else if(b){_e=_.input({type:"search",class:"cms-input",placeholder:typeof e.searchable=="string"?e.searchable:e.searchPlaceholder||"Cerca nella tabella",value:String(H()||"")}),_e.addEventListener("input",()=>se(_e.value));const De=Ne.Btn({class:"cms-table-search-clear",outline:!0,onClick:()=>{_e&&(_e.value=""),se("")}},"Reset");F.appendChild(_.div({class:"cms-singularity cms-table-search"},_.span({class:"cms-table-search-icon","aria-hidden":"true"},"\u2315"),_e,De))}re.forEach(De=>F.appendChild(De)),(Se.childNodes.length||F.childNodes.length)&&(oe.appendChild(Se),oe.appendChild(F),me.appendChild(oe));const f=_.div({class:"cms-singularity cms-table-chip"},""),h=_.div({class:"cms-singularity cms-table-chip"},""),B=_.div({class:"cms-singularity cms-table-chip"},""),ie=J(s,"status",{},e.status),a=_.div({class:"cms-table-status"},f,h,B,...ie);e.hideStatus!==!0&&me.appendChild(a);const x=J(s,"caption",{},e.caption);x.length&&me.appendChild(_.div({class:"cms-table-caption"},...x));const g=_.thead(),P=_.tbody(),q=!!e.actions||!!s.actions,Q=te(["cms-table",ye(e.dense,"dense"),ye(e.striped,"striped"),ye(e.hover!==!1,"hover"),ye(e.stickyHeader!==!1,"sticky-head"),e.tableClass]),ve={...e.tableStyle||{}};e.minTableWidth!=null&&(ve["--cms-table-min-width"]=yt(e.minTableWidth));const E=_.table({class:Q,style:ve},g,P),m=_.div({class:"cms-singularity cms-table-wrap"},E);me.appendChild(m);const N=_.div({class:"cms-singularity cms-table-chip"},""),I=_.div({class:"cms-singularity cms-table-chip"},""),K=Ne.Btn({outline:!0,onClick:()=>v(Math.max(1,C()-1))},"\u2039"),ke=Ne.Btn({outline:!0,onClick:()=>v(C()+1)},"\u203A"),Oe=_.div({class:"cms-singularity cms-table-chip"},""),Te=_.select({class:"cms-input cms-table-size-select"},...d.map(De=>xs({value:String(De)},String(De))));Te.value=String(T()),Te.addEventListener("change",()=>X(Te.value));const U=J(s,"footer",{},e.footer),j=_.div({class:"cms-table-foot"},_.div({class:"cms-table-foot-main"},N,I,_.label({class:"cms-table-size"},_.span("Righe"),Te)),_.div({class:"cms-table-foot-extra"},...U,_.div({class:"cms-table-pager"},K,Oe,ke)));e.hideFooter!==!0&&me.appendChild(j);const ne=()=>{if(g.innerHTML="",e.hideHeader)return;const De=_.tr();if(i.forEach((Ie,qe)=>{var xe,Ue;const Be={col:Ie,colIndex:qe,sort:Z()},z={...Co(Ie==null?void 0:Ie.style,{...Be,header:!0}),...Co((xe=Ie==null?void 0:Ie.headerStyle)!=null?xe:Ie==null?void 0:Ie.thStyle,{...Be,header:!0})};(Ie==null?void 0:Ie.width)!=null&&(z.width=yt(Ie.width)),(Ie==null?void 0:Ie.minWidth)!=null&&(z.minWidth=yt(Ie.minWidth)),(Ie==null?void 0:Ie.maxWidth)!=null&&(z.maxWidth=yt(Ie.maxWidth)),Ie!=null&&Ie.align&&(z.textAlign=Ie.align);let Pe=J(Ie==null?void 0:Ie.slots,"header",Be,null);if(!Pe.length){const et=typeof(Ie==null?void 0:Ie.header)=="function"?Ie.header(Be):(Ue=Ie==null?void 0:Ie.header)!=null?Ue:ci(Ie);Pe=J(s,"header",Be,et)}const M=Z(),k=Do(Ie,qe),S=(Ie==null?void 0:Ie.sortable)!==!1&&((Ie==null?void 0:Ie.key)!=null||typeof(Ie==null?void 0:Ie.get)=="function"||typeof(Ie==null?void 0:Ie.compare)=="function"),u=!!M&&(M.key===k||M.key===(Ie==null?void 0:Ie.key)),A=_.th({class:te(["cms-table-head-cell",ye(Ie==null?void 0:Ie.nowrap,"is-nowrap"),ye(S,"cms-table-sortable"),ye(u,"is-sorted"),Ie==null?void 0:Ie.headerClass]),style:z});S?A.appendChild(_.button({type:"button",class:"cms-table-head-button",onClick:()=>de(Ie,qe)},_.span({class:"cms-table-head-label"},...Pe),_.span({class:"cms-table-head-arrow","aria-hidden":"true"},u?M.dir==="asc"?"\u2191":"\u2193":"\u2195"))):Pe.forEach(et=>A.appendChild(et)),De.appendChild(A)}),q){const Ie=J(s,"actionsHeader",{},e.actionsLabel||"Azioni");De.appendChild(_.th({class:"cms-table-head-cell cms-table-head-actions",style:{textAlign:"right"}},...Ie))}g.appendChild(De)},Ve=(De,Ie)=>{const qe={columns:i,count:i.length},Be=J(s,De,qe,Ie),z=String(i.length+(q?1:0));P.appendChild(_.tr(_.td({colSpan:z,class:"cms-table-state"},...Be)))};return bt.reactive.effect(()=>{const De=nl(e.rows),Ie=String(H()||"").trim(),qe=Z(),Be=typeof e.loading=="function"?!!e.loading():!!e.loading,z=e.pagination!==!1;if(ne(),P.innerHTML="",_e&&_e.value!==H()&&(_e.value=H()),Te.value!==String(T())&&(Te.value=String(T())),Be){f.textContent="Caricamento in corso",h.style.display="none",B.style.display="none",N.textContent="Loading\u2026",I.textContent="",Oe.textContent="Pagina 1",K.disabled=!0,ke.disabled=!0,Ve("loading",e.loadingText||"Loading...");return}let Pe=De.slice();const M=Pe.length;if(typeof e.filter=="function"&&(Pe=Pe.filter((G,Ge)=>e.filter(G,{row:G,index:Ge,query:Ie,rows:De,columns:i}))),Ie&&(Pe=Pe.filter(G=>ol(G,i,Ie,e))),qe){const G=ui(i,qe.key);G&&Pe.sort((Ge,lt)=>{const tt=So(G,Ge,-1),dt=So(G,lt,-1),St=typeof G.compare=="function"?G.compare(tt,dt,Ge,lt):tl(tt,dt);return qe.dir==="asc"?St:-St})}const k=Pe.length,S=Math.max(1,Number(T())||w),u=z?Math.max(1,Math.ceil(k/S)):1,A=z?Math.min(C(),u):1;A!==C()&&v(A);const xe=z?(A-1)*S:0,Ue=z?xe+S:k,et=Pe.slice(xe,Ue);if(f.textContent=k===M?`${k} righe`:`${k} di ${M} righe`,h.textContent=Ie?`Ricerca: ${Ie}`:"",h.style.display=Ie?"":"none",qe){const G=ui(i,qe.key);B.textContent=G?`Ordine: ${ci(G)} ${qe.dir==="asc"?"\u2191":"\u2193"}`:"",B.style.display=G?"":"none"}else B.style.display="none";if(N.textContent=k?`${xe+1}-${Math.min(Ue,k)} di ${k}`:"0 risultati",I.textContent=k!==M?`Dataset totale ${M}`:`Page size ${S}`,Oe.textContent=z?`Pagina ${A} / ${u}`:"Tutte le righe",K.disabled=!z||A<=1,ke.disabled=!z||A>=u,Te.disabled=!z,Te.parentNode.style.display=z?"":"none",et.length===0){Ve("empty",e.emptyText||"Nessun dato");return}for(let G=0;G<et.length;G++){const Ge=et[G],lt=xe+G,tt={row:Ge,rowIndex:lt,pageIndex:G},dt=typeof e.rowAttrs=="function"?e.rowAttrs(Ge,tt)||{}:e.rowAttrs||{},St=typeof e.rowClass=="function"?e.rowClass(Ge,tt):e.rowClass,It=!!(e.onRowClick||e.onRowDblClick),Rt=_.tr({...dt,class:te(["cms-table-row",St,dt.class,ye(It,"is-clickable")])});if(e.rowKey){const st=typeof e.rowKey=="function"?e.rowKey(Ge,tt):Fo(Ge,e.rowKey);st!=null&&(Rt.dataset.key=String(st))}const Pt=st=>{const wt=st==null?void 0:st.target;return!!(wt&&wt.closest&&wt.closest("button, a, input, select, textarea, label, [data-table-action]"))};if(e.onRowClick&&Rt.addEventListener("click",st=>{Pt(st)||e.onRowClick(Ge,tt,st)}),e.onRowDblClick&&Rt.addEventListener("dblclick",st=>{Pt(st)||e.onRowDblClick(Ge,tt,st)}),i.forEach((st,wt)=>{var Qt,an;const Ft=So(st,Ge,lt),Dt={...tt,col:st,colIndex:wt,value:Ft},Yt={...Co(st==null?void 0:st.style,Dt),...Co((Qt=st==null?void 0:st.cellStyle)!=null?Qt:st==null?void 0:st.tdStyle,Dt)};st!=null&&st.align&&(Yt.textAlign=st.align),(st==null?void 0:st.width)!=null&&(Yt.width=yt(st.width)),(st==null?void 0:st.minWidth)!=null&&(Yt.minWidth=yt(st.minWidth)),(st==null?void 0:st.maxWidth)!=null&&(Yt.maxWidth=yt(st.maxWidth));const Xt=typeof(st==null?void 0:st.cellClass)=="function"?st.cellClass(Ge,Dt):(st==null?void 0:st.cellClass)||(st==null?void 0:st.class),on=_.td({class:te(["cms-table-cell",Xt,ye(st==null?void 0:st.nowrap,"is-nowrap")]),style:Yt});let jt=J(st==null?void 0:st.slots,"cell",Dt,null);if(!jt.length){const mn=typeof(st==null?void 0:st.render)=="function"?st.render(Ge,Dt):typeof(st==null?void 0:st.format)=="function"?st.format(Ft,Ge,Dt):Ft,Gt=mn==null?(an=st==null?void 0:st.emptyText)!=null?an:"":mn;jt=J(s,"cell",Dt,Gt)}jt.length||(jt=[""]),jt.forEach(mn=>on.appendChild(mn)),Rt.appendChild(on)}),q){const st={...tt},wt=typeof e.actions=="function"?e.actions(Ge,tt):e.actions;let Ft=J(s,"actions",st,wt);Ft.length||(Ft=J(null,"default",st,wt)),Rt.appendChild(_.td({class:"cms-table-cell cms-table-cell-actions",style:{textAlign:"right"}},_.div({class:"cms-table-actions"},...Ft)))}P.appendChild(Rt)}},"UI.Table:render"),be.body=me,Ne.Card(be)},Ne.Menu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(m,N)=>Object.prototype.hasOwnProperty.call(m||{},N),T=(m,N)=>typeof m=="function"?m(N):m,le=m=>String(m||"").split(/\s+/).filter(Boolean),Z=m=>m&&typeof m=="object"&&!m.nodeType&&!Array.isArray(m)&&!(m instanceof Function),he=m=>!!m&&typeof m=="object"&&(m.nodeType===1||typeof m.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(m,N,I)=>{if(!m)return;const K=m[N]||[];K.length&&m.classList.remove(...K);const ke=(I||[]).filter(Boolean);ke.length&&m.classList.add(...ke),m[N]=ke},se=(m,N,I,K=ke=>ke)=>{if(m){if(I==null||I===""){m.style.removeProperty(N);return}m.style.setProperty(N,K(I))}},X=()=>w||{},de=m=>{var I;const N=String(o((I=m.state)!=null?I:m.color)||"").toLowerCase();return i.includes(N)?N:""},_e=m=>{const N=String(o(m.size)||"").toLowerCase();return c.includes(N)?N:""},be=m=>{var N,I;return String(o((I=(N=m.placement)!=null?N:m.position)!=null?I:"bottom-start"))},me=()=>{var I;const m=o((I=X().delay)!=null?I:X().showDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):0},fe=()=>{const m=o(X().hideDelay),N=Number(m);return Number.isFinite(N)?Math.max(0,N):80},ce=(m=null)=>{var I,K,ke;if(m)return m;const N=X();return r||o((ke=(K=(I=N.anchorEl)!=null?I:N.triggerEl)!=null?K:N.target)!=null?ke:N.anchor)||null},$=m=>{if(m==null||m===!0)return new Set(["click"]);if(m===!1)return new Set(["manual"]);const N=Array.isArray(m)?m:String(m).split(/[\s,|/]+/),I=new Set;return N.forEach(K=>{const ke=String(K||"").trim().toLowerCase();ke&&(ke==="mouseenter"||ke==="mouseover"?I.add("hover"):ke==="blur"||ke==="focusin"?I.add("focus"):ke==="tap"?I.add("click"):I.add(ke))}),I.size?I:new Set(["manual"])},re=(m,N)=>{var ke,Oe,Te;let I=null,K=null;if(he(m))I=m,Z(N)&&(K=N);else if(Z(m)){K=m;const U=(Te=(Oe=(ke=m.anchorEl)!=null?ke:m.triggerEl)!=null?Oe:m.target)!=null?Te:m.anchor;he(U)&&(I=U)}else m!=null&&(I=m);return{anchorEl:I,nextProps:K}},oe=(m=d==null?void 0:d.panel)=>{var N;return Array.from(((N=m==null?void 0:m.querySelectorAll)==null?void 0:N.call(m,"[data-menu-item]:not([disabled]):not([tabindex='-1']), .cms-menu-item:not([disabled]):not([tabindex='-1']), [role='menuitem']:not([disabled]):not([tabindex='-1']), a[href]:not([tabindex='-1']), button:not([disabled]):not([tabindex='-1'])"))||[]).filter(I=>I.offsetParent!==null&&I.getAttribute("aria-hidden")!=="true")},Se=()=>{o(X().autoFocus)!==!1&&setTimeout(()=>{const m=oe();if(!m.length)return;(m.find(I=>I.classList.contains("is-active")||I.classList.contains("is-selected")||I.classList.contains("is-checked"))||m[0]).focus()},0)},F=(m,N,I="sm")=>{const K=T(m,N);return K==null?[]:typeof K=="string"?[Ne.Icon({name:K,size:I})]:Vs(K,{...N,as:"icon"})},p=(m,N)=>{var xe,Ue,et,G,Ge,lt,tt,dt,St,It,Rt,Pt,st;const I=T(m,N);if(I==null||I===!1)return[];if(Array.isArray(I))return I.flatMap((wt,Ft)=>p(wt,{...N,index:Ft}));if(typeof I=="function")return p(I(N),N);if(I!=null&&I.nodeType)return[I];if(typeof I=="string"||typeof I=="number")return p({label:I},N);if(!Z(I))return Vs(I,{...N,as:"item"});const K=String((Ue=(xe=I.type)!=null?xe:I.kind)!=null?Ue:"").toLowerCase();if(K==="separator"||K==="divider"||I.separator===!0||I.divider===!0)return[_.div({class:"cms-menu-divider",role:"separator"})];const ke=(et=I.items)!=null?et:I.children;if((K==="group"||K==="section"||Array.isArray(ke))&&ke!=null){const wt={...N,item:I},Ft=J(s,"groupLabel",wt,T((G=I.label)!=null?G:I.title,wt)),Dt=p(ke,wt);return Dt.length?[_.div({class:te(["cms-menu-group",I.class])},Ft.length?_.div({class:"cms-menu-group-label"},...Ft):null,_.div({class:"cms-menu-group-items"},...Dt))]:[]}const Oe={...N,item:I,close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:X()},Te=!!o(I.disabled),U=I.checked==null?null:!!o(I.checked),j=!!o((Ge=I.active)!=null?Ge:I.selected),ne=de(I),Ve=o(I.href),He=o(I.to),ae=v(I,"closeOnSelect")?!!o(I.closeOnSelect):I.keepOpen===!0?!1:X().closeOnSelect!==!1,$e=I.role||(U!=null?"menuitemcheckbox":"menuitem"),Ee=F(I.icon,Oe),De=F((lt=I.iconRight)!=null?lt:I.endIcon,Oe),Ie=J(s,"itemTitle",Oe,T((tt=I.title)!=null?tt:I.label,Oe)),qe=J(s,"itemSubtitle",Oe,T((dt=I.subtitle)!=null?dt:I.description,Oe)),Be=J(s,"itemShortcut",Oe,T(I.shortcut,Oe)),z=J(s,"itemBadge",Oe,T(I.badge,Oe)),Pe=J(s,"item",Oe,T((It=(St=I.content)!=null?St:I.body)!=null?It:I.render,Oe)),M=[...z,...Be,...U===!0&&!De.length&&!z.length?[_.span({class:"cms-menu-entry-check"},Ne.Icon({name:I.checkedIcon||"check",size:"sm"}))]:[],...De],S={class:te(["cms-menu-entry","cms-menu-item",ne?`cms-state-${ne}`:"",ye(j,"is-active"),ye(U===!0,"is-checked"),ye(Te,"is-disabled"),I.class]),role:$e,tabIndex:Te?-1:(Rt=I.tabIndex)!=null?Rt:-1,"data-menu-item":!0,"data-menu-select":ae?"true":"false","data-menu-close":I.close===!0?"true":null,"data-menu-keep-open":ae?null:"true","aria-disabled":Te?"true":null,"aria-checked":U==null?null:String(U),title:(st=(Pt=I.titleAttr)!=null?Pt:I.tooltip)!=null?st:null,type:Ve?null:"button",href:Ve||null,target:I.target||null,rel:I.rel||(I.target==="_blank"?"noopener noreferrer":null),onClick:wt=>{var Dt,Yt,Xt,on;if(Te){wt.preventDefault(),wt.stopPropagation();return}(Yt=(Dt=X()).onItemClick)==null||Yt.call(Dt,I,Oe,wt);const Ft=(Xt=I.onClick)==null?void 0:Xt.call(I,Oe,wt);wt.defaultPrevented||(He&&((on=JSswift.router)!=null&&on.navigate)&&(wt.preventDefault(),JSswift.router.navigate(He)),Ft!==!1&&ae&&ie())}};I.attrs&&typeof I.attrs=="object"&&Object.assign(S,I.attrs);const u=Ve?_.a:_.button,A=Pe.length?Pe:[Ie.length?_.div({class:"cms-menu-entry-title"},...Ie):null,qe.length?_.div({class:"cms-menu-entry-subtitle"},...qe):null].filter(Boolean);return[u(S,Ee.length?_.span({class:"cms-menu-entry-icon"},...Ee):null,_.span({class:"cms-menu-entry-main"},...A),M.length?_.span({class:"cms-menu-entry-aside"},...M):null)]},f=()=>{var Ie,qe,Be,z,Pe,M,k;const m=X(),N={close:ie,dismiss:ie,open:x,toggle:q,update:a,isOpen:Q,entry:()=>d,anchorEl:ce(),props:m},I=F(m.icon,N,m.iconSize||"md"),K=J(s,"eyebrow",N,T(m.eyebrow,N)),ke=J(s,"title",N,T((qe=(Ie=m.title)!=null?Ie:m.heading)!=null?qe:m.label,N)),Oe=J(s,"subtitle",N,T((Be=m.subtitle)!=null?Be:m.description,N)),Te=J(s,"before",N,T(m.before,N)),U=J(s,"header",N,T(m.header,N)),j=J(s,"after",N,T(m.after,N)),ne=J(s,"footer",N,T(m.footer,N)),Ve=J(s,"status",N,T(m.status,N));let He=(z=m.content)!=null?z:m.body;He==null&&n&&n.length&&(He=n);let ae=J(s,"content",N,T(He,N));ae.length||(ae=J(s,"body",N,T(He,N))),ae.length||(ae=J(s,"default",N,T(He,N)));const $e=p((M=(Pe=m.items)!=null?Pe:m.actionsList)!=null?M:m.entries,N),Ee=$e.length?[]:J(s,"empty",N,T((k=m.empty)!=null?k:m.emptyText,N));let De=null;return U.length?De=_.div({class:te(["cms-menu-head","cms-menu-head-custom",m.headerClass])},...U):(I.length||K.length||ke.length||Oe.length)&&(De=_.div({class:te(["cms-menu-head",m.headerClass])},I.length?_.div({class:"cms-menu-head-icon"},...I):null,_.div({class:"cms-menu-head-main"},K.length?_.div({class:"cms-menu-eyebrow"},...K):null,ke.length?_.div({class:"cms-menu-title"},...ke):null,Oe.length?_.div({class:"cms-menu-subtitle"},...Oe):null))),_.div({class:te(["cms-menu","cms-menu-shell",ye(m.dense,"dense"),ye($e.length>0,"has-items"),ye(ne.length>0||Ve.length>0,"has-footer"),m.class]),style:m.style||{},role:m.role||"menu","aria-label":m.ariaLabel||null},Te.length?_.div({class:"cms-menu-before"},...Te):null,De,ae.length?_.div({class:te(["cms-menu-content",m.contentClass])},...ae):null,$e.length?_.div({class:te(["cms-menu-items",m.itemsClass])},...$e):null,!$e.length&&Ee.length?_.div({class:"cms-menu-empty"},...Ee):null,j.length?_.div({class:"cms-menu-after"},...j):null,Ve.length||ne.length?_.div({class:te(["cms-menu-footer",m.footerClass])},Ve.length?_.div({class:"cms-menu-status"},...Ve):null,ne.length?_.div({class:"cms-menu-footer-actions"},...ne):null):null)},h=m=>{var ke;if(!(m!=null&&m.panel))return;const N=X(),I=de(N),K=_e(N);W(m.panel,"_menuClassTokens",["cms-menu-panel","cms-clear-set","cms-singularity",K?`cms-menu-${K}`:"",I?`cms-state-${I}`:"",o(N.outline)?"outline":"",...le(N.panelClass)]),W(m.overlay,"_menuOverlayClassTokens",[...le(N.overlayClass)]),m.panel.dataset.placement=be(N),se(m.panel,"--cms-menu-width",o(N.width),yt),se(m.panel,"--cms-menu-min-width",o(N.minWidth),yt),se(m.panel,"--cms-menu-max-width",o(N.maxWidth),yt),se(m.panel,"--cms-menu-max-height",o(N.maxHeight),yt),se(m.panel,"--cms-menu-body-max-height",o((ke=N.bodyMaxHeight)!=null?ke:N.contentMaxHeight),yt),N.panelStyle&&Object.assign(m.panel.style,N.panelStyle),Nt(m.panel,N)},B=()=>{d!=null&&d.panel&&d.panel.replaceChildren(f())},ie=()=>{if(H(),!d)return;const m=d;d=null,ks(m,()=>JSswift.overlay.close(m.id))},a=(m={})=>{var N,I,K,ke;if(m&&typeof m=="object"&&(w={...w,...m}),d){const Oe=X();h(d),B(),(ke=d.reposition)==null||ke.call(d,{anchorEl:d._anchorEl,placement:be(Oe),offsetX:(N=Oe.offsetX)!=null?N:0,offsetY:(K=(I=Oe.offsetY)!=null?I:Oe.offset)!=null?K:8}),Se()}return E},x=(m=null,N=null)=>{var De,Ie,qe,Be,z,Pe,M,k,S,u,A,xe,Ue,et,G,Ge;H();const{anchorEl:I,nextProps:K}=re(m,N);K&&(w={...w,...K});const ke=X(),Oe=ce(I);if(!Oe||o(ke.disabled))return null;if(d&&d._anchorEl===Oe){const lt=X();return h(d),B(),(Be=d.reposition)==null||Be.call(d,{anchorEl:d._anchorEl,placement:be(lt),offsetX:(De=lt.offsetX)!=null?De:0,offsetY:(qe=(Ie=lt.offsetY)!=null?Ie:lt.offset)!=null?qe:8}),Se(),d}d&&ie(),b=document.activeElement;let Te=null;if(d=JSswift.overlay.open(()=>f(),{type:"menu",anchorEl:Oe,placement:be(ke),offsetX:(z=ke.offsetX)!=null?z:0,offsetY:(M=(Pe=ke.offsetY)!=null?Pe:ke.offset)!=null?M:8,backdrop:ke.backdrop===!0,lockScroll:ke.lockScroll===!0,trapFocus:ke.trapFocus===!0,autoFocus:!1,closeOnOutside:ke.closeOnOutside!==!1,closeOnBackdrop:(k=ke.closeOnBackdrop)!=null?k:ke.backdrop===!0,closeOnEsc:ke.closeOnEsc!==!1,className:qt(["cms-menu-panel"]),onClose:()=>{var lt,tt,dt;(lt=Te==null?void 0:Te._menuCleanup)==null||lt.call(Te),(dt=(tt=X()).onClose)==null||dt.call(tt,Te),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const U=d;Te=U,U._anchorEl=Oe;const j=()=>{clearTimeout(C),C=null},ne=()=>{P()},Ve=lt=>{const tt=lt.target;if(!tt||!tt.closest)return;if(tt.closest("[data-menu-close]")){ie();return}if(X().closeOnSelect===!1)return;const dt=tt.closest("[data-menu-item], [data-menu-select], .cms-menu-item, [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], a[href], button:not([disabled])");dt&&(dt.closest("[data-menu-keep-open]")||dt.getAttribute("data-menu-select")!=="false"&&ie())},He=lt=>{if(lt.key==="Escape"){lt.preventDefault(),ie();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(lt.key))return;const tt=oe(U.panel);if(!tt.length)return;lt.preventDefault();const dt=tt.indexOf(document.activeElement);if(lt.key==="Home"){tt[0].focus();return}if(lt.key==="End"){tt[tt.length-1].focus();return}const St=lt.key==="ArrowDown"?1:-1,It=dt<0?St>0?0:tt.length-1:(dt+St+tt.length)%tt.length;tt[It].focus()};U.panel.addEventListener("click",Ve),U.panel.addEventListener("keydown",He);const ae=$((u=(S=ke.trigger)!=null?S:ke.triggers)!=null?u:v(ke,"open")?"manual":null),$e=ae.has("hover"),Ee=ae.has("focus");return($e||Ee)&&(U.panel.addEventListener("mouseenter",j),U.panel.addEventListener("mouseleave",ne),U.panel.addEventListener("focusin",j),U.panel.addEventListener("focusout",ne)),U._menuCleanup=()=>{var lt,tt,dt,St,It,Rt;(lt=U.panel)==null||lt.removeEventListener("click",Ve),(tt=U.panel)==null||tt.removeEventListener("keydown",He),(dt=U.panel)==null||dt.removeEventListener("mouseenter",j),(St=U.panel)==null||St.removeEventListener("mouseleave",ne),(It=U.panel)==null||It.removeEventListener("focusin",j),(Rt=U.panel)==null||Rt.removeEventListener("focusout",ne)},h(U),(et=U.reposition)==null||et.call(U,{anchorEl:Oe,placement:be(ke),offsetX:(A=ke.offsetX)!=null?A:0,offsetY:(Ue=(xe=ke.offsetY)!=null?xe:ke.offset)!=null?Ue:8}),_s(U),(Ge=(G=X()).onOpen)==null||Ge.call(G,U),Se(),U},g=(m,N=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>x(m,N),me())},P=(m=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),m){ie();return}C=setTimeout(()=>ie(),fe())}},q=(m=null,N=null)=>Q()?(ie(),null):x(m,N),Q=()=>!!d,E={open:x,close:ie,show:g,hide:P,toggle:q,update:a,bind:m=>{var ne,Ve;if(!m)return()=>{};r=m;const N=X(),I=$((Ve=(ne=N.trigger)!=null?ne:N.triggers)!=null?Ve:v(N,"open")?"manual":null),K=I.has("hover"),ke=I.has("focus"),Oe=I.has("click"),Te=I.has("manual")||!K&&!ke&&!Oe,U=[],j=()=>{H(),U.forEach(He=>He()),r===m&&(r=null)};if(v(N,"open"))return Ye(N.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?x(r):P(!0))},"UI.Menu:open"):N.open===!0?x(m):N.open===!1&&P(!0),j;if(Te||o(N.disabled))return j;if(K){const He=()=>g(m),ae=()=>P();m.addEventListener("mouseenter",He),m.addEventListener("mouseleave",ae),U.push(()=>{m.removeEventListener("mouseenter",He),m.removeEventListener("mouseleave",ae)})}if(ke){const He=()=>g(m),ae=()=>P();m.addEventListener("focus",He),m.addEventListener("blur",ae),U.push(()=>{m.removeEventListener("focus",He),m.removeEventListener("blur",ae)})}if(Oe){const He=ae=>{var $e,Ee;(Ee=($e=X()).onTriggerClick)==null||Ee.call($e,ae),!ae.defaultPrevented&&q(m)};m.addEventListener("click",He),U.push(()=>m.removeEventListener("click",He))}return j},isOpen:Q,entry:()=>d,props:()=>({...w})};return E},Ne.Popover=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t),s=e.slots||{},i=["primary","secondary","warning","danger","success","info","light","dark"],c=["xs","sm","md","lg","xl"];let w={...e},d=null,r=null,b=null,O=null,C=null;const v=(E,m)=>Object.prototype.hasOwnProperty.call(E||{},m),T=(E,m)=>typeof E=="function"?E(m):E,le=E=>String(E||"").split(/\s+/).filter(Boolean),Z=E=>E&&typeof E=="object"&&!E.nodeType&&!Array.isArray(E)&&!(E instanceof Function),he=E=>!!E&&typeof E=="object"&&(E.nodeType===1||typeof E.getBoundingClientRect=="function"),H=()=>{clearTimeout(O),clearTimeout(C),O=null,C=null},W=(E,m,N)=>{if(!E)return;const I=E[m]||[];I.length&&E.classList.remove(...I);const K=(N||[]).filter(Boolean);K.length&&E.classList.add(...K),E[m]=K},se=(E,m,N,I=K=>K)=>{if(E){if(N==null||N===""){E.style.removeProperty(m);return}E.style.setProperty(m,I(N))}},X=()=>w,de=E=>{var N;const m=o((N=E.state)!=null?N:E.color);return m?i.includes(m)?m:String(m):""},_e=E=>{const m=o(E.size);return typeof m=="string"&&c.includes(m)?m:""},be=E=>{var N,I,K;const m=String(o((K=(I=(N=E.actionsAlign)!=null?N:E.footerAlign)!=null?I:E.alignActions)!=null?K:"end")).toLowerCase();return["start","left"].includes(m)?"start":["center","middle"].includes(m)?"center":["between","space-between"].includes(m)?"between":["stretch","full"].includes(m)?"stretch":"end"},me=E=>{var m,N;return String(o((N=(m=E.placement)!=null?m:E.position)!=null?N:"bottom-start"))},fe=(E,m)=>{const N=o(E);if(N==null||N==="")return m;const I=Number(N);return Number.isFinite(I)?I:m},ce=()=>fe(X().delay,0),$=()=>fe(X().hideDelay,120),re=E=>{var N,I;return((I=(N=E.closable)!=null?N:E.dismissible)!=null?I:E.closeButton)===!0},oe=(E=null)=>{var N,I,K;if(E)return E;const m=X();return r||o((K=(I=(N=m.anchorEl)!=null?N:m.triggerEl)!=null?I:m.target)!=null?K:m.anchor)||null},Se=E=>{if(E==null||E===!0)return new Set(["click"]);if(E===!1)return new Set(["manual"]);const m=Array.isArray(E)?E:String(E).split(/[\s,|/]+/),N=new Set;return m.forEach(I=>{const K=String(I||"").trim().toLowerCase();K&&(K==="mouseenter"||K==="mouseover"?N.add("hover"):K==="blur"||K==="focusin"?N.add("focus"):K==="tap"?N.add("click"):N.add(K))}),N.size?N:new Set(["manual"])},F=(E,m)=>{var K,ke,Oe;let N=null,I=null;if(he(E))N=E,Z(m)&&(I=m);else if(Z(E)){I=E;const Te=(Oe=(ke=(K=E.anchorEl)!=null?K:E.triggerEl)!=null?ke:E.target)!=null?Oe:E.anchor;he(Te)&&(N=Te)}else E!=null&&(N=E);return{anchorEl:N,nextProps:I}},p=()=>{var Ee,De,Ie,qe,Be,z,Pe,M,k;const E=X(),m={close:B,dismiss:B,open:a,toggle:P,update:ie,isOpen:q,entry:()=>d,anchorEl:oe(),props:E},N=E.icon!=null?typeof E.icon=="string"?Ne.Icon({name:E.icon,size:E.iconSize||"md"}):JSswift.ui.slot(E.icon,{as:"icon"}):null,I=J(s,"eyebrow",m,T(E.eyebrow,m)),K=J(s,"title",m,T((De=(Ee=E.title)!=null?Ee:E.heading)!=null?De:E.label,m)),ke=J(s,"subtitle",m,T((Ie=E.subtitle)!=null?Ie:E.description,m)),Oe=J(s,"icon",m,N),Te=J(s,"header",m,T((Be=(qe=E.headerContent)!=null?qe:E.head)!=null?Be:E.header,m)),U=re(E)?J(s,"close",m,Ne.Btn({class:"cms-dialog-close",size:"sm",outline:!0,"aria-label":E.closeLabel||"Chiudi popover","data-popover-close":!0},Ne.Icon({name:E.closeIcon||"close",size:"sm"}))):[];let j=(M=(Pe=(z=E.content)!=null?z:E.body)!=null?Pe:E.message)!=null?M:E.text;j==null&&n&&n.length&&(j=n);let ne=J(s,"content",m,T(j,m));ne.length||(ne=J(s,"body",m,T(j,m))),ne.length||(ne=J(s,"default",m,T(j,m)));const Ve=T((k=E.footer)!=null?k:E.actions,m);let He=J(s,"footer",m,Ve);He.length||(He=J(s,"actions",m,Ve));let ae=null;Te.length?ae=_.div({class:"cms-dialog-head cms-dialog-head-custom"},...Te):(I.length||K.length||ke.length||Oe.length||U.length)&&(ae=_.div({class:"cms-dialog-head"},Oe.length?_.div({class:"cms-dialog-icon"},...Oe):null,_.div({class:"cms-dialog-head-main"},I.length?_.div({class:"cms-dialog-eyebrow"},...I):null,K.length?_.div({class:"cms-dialog-title"},...K):null,ke.length?_.div({class:"cms-dialog-subtitle"},...ke):null),U.length?_.div({class:"cms-dialog-close-wrap"},...U):null));const $e=[];return ae&&$e.push(ae),ne.length&&$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])},...ne)),He.length&&$e.push(_.div({class:te(["cms-dialog-actions",`is-${be(E)}`,ye(E.stackActions,"is-stacked"),E.actionsClass,E.footerClass])},...He)),$e.length||$e.push(_.div({class:te(["cms-dialog-body",E.bodyClass])})),_.div({class:te(["cms-dialog-shell","cms-popover-shell",ye(!!ae,"has-head"),ye(He.length>0,"has-footer"),ye(E.divider!==!1,"with-divider")])},...$e)},f=E=>{var K;if(!(E!=null&&E.panel))return;const m=X(),N=de(m),I=_e(m);W(E.panel,"_popoverClassTokens",["cms-dialog","cms-popover","cms-singularity","cms-clear-set",I?`cms-dialog-${I}`:"",N,N?`cms-state-${N}`:"",o(m.scrollable)?"scrollable":"",o(m.stickyHeader)?"sticky-head":"",o(m.stickyActions)?"sticky-actions":"",o(m.borderless)?"borderless":"",...le(m.class),...le(m.panelClass)]),W(E.overlay,"_popoverOverlayClassTokens",[...le(m.overlayClass)]),E.panel.dataset.placement=me(m),se(E.panel,"--cms-dialog-width",o(m.width),yt),se(E.panel,"--cms-dialog-min-width",o(m.minWidth),yt),se(E.panel,"--cms-dialog-max-width",o(m.maxWidth),yt),se(E.panel,"--cms-dialog-max-height",o(m.maxHeight),yt),se(E.panel,"--cms-dialog-body-max-height",o((K=m.bodyMaxHeight)!=null?K:m.contentMaxHeight),yt),m.style&&Object.assign(E.panel.style,m.style),Nt(E.panel,m),E.panel.setAttribute("role",m.role||"dialog"),E.panel.setAttribute("aria-modal",m.modal===!0?"true":"false"),m.ariaLabel?E.panel.setAttribute("aria-label",m.ariaLabel):E.panel.removeAttribute("aria-label")},h=()=>{d!=null&&d.panel&&d.panel.replaceChildren(p())},B=()=>{if(H(),!d)return;const E=d;d=null,ks(E,()=>JSswift.overlay.close(E.id))},ie=(E={})=>(E&&typeof E=="object"&&(w={...w,...E}),d&&(f(d),h()),ve),a=(E=null,m=null)=>{var $e,Ee,De,Ie,qe,Be,z,Pe;H();const{anchorEl:N,nextProps:I}=F(E,m);I&&(w={...w,...I});const K=X(),ke=oe(N);if(!ke||o(K.disabled))return null;if(d&&d._anchorEl===ke)return f(d),h(),d;d&&B(),b=document.activeElement;const Oe=Se((Ee=($e=K.trigger)!=null?$e:K.triggers)!=null?Ee:v(K,"open")?"manual":null),Te=Oe.has("hover"),U=Oe.has("focus");let j=null;if(d=JSswift.overlay.open(()=>p(),{type:"popover",anchorEl:ke,placement:me(K),offsetX:(De=K.offsetX)!=null?De:0,offsetY:(qe=(Ie=K.offsetY)!=null?Ie:K.offset)!=null?qe:10,backdrop:K.backdrop===!0,lockScroll:K.lockScroll===!0,trapFocus:K.trapFocus===!0,autoFocus:K.autoFocus===!0,closeOnOutside:K.closeOnOutside!==!1,closeOnBackdrop:(Be=K.closeOnBackdrop)!=null?Be:K.backdrop===!0,closeOnEsc:K.closeOnEsc!==!1,className:qt(["cms-dialog","cms-popover"]),onClose:()=>{var M,k,S;(M=j==null?void 0:j._popoverCleanup)==null||M.call(j),(S=(k=X()).onClose)==null||S.call(k,j),X().returnFocus!==!1&&b&&typeof b.focus=="function"&&setTimeout(()=>b.focus(),0)}}),!(d!=null&&d.panel))return d;const ne=d;j=ne,ne._anchorEl=ke;const Ve=()=>{clearTimeout(C),C=null},He=()=>{!Te&&!U||g()},ae=M=>{const k=M.target;if(!(!k||!k.closest)){if(k.closest("[data-popover-close]")||k.closest("[data-dialog-close]")){B();return}X().closeOnSelect===!0&&k.closest("[data-popover-select]")&&B()}};return ne.panel.addEventListener("click",ae),(Te||U)&&(ne.panel.addEventListener("mouseenter",Ve),ne.panel.addEventListener("mouseleave",He),ne.panel.addEventListener("focusin",Ve),ne.panel.addEventListener("focusout",He)),ne._popoverCleanup=()=>{var M,k,S,u,A;(M=ne.panel)==null||M.removeEventListener("click",ae),(k=ne.panel)==null||k.removeEventListener("mouseenter",Ve),(S=ne.panel)==null||S.removeEventListener("mouseleave",He),(u=ne.panel)==null||u.removeEventListener("focusin",Ve),(A=ne.panel)==null||A.removeEventListener("focusout",He)},f(ne),_s(ne),(Pe=(z=X()).onOpen)==null||Pe.call(z,ne),ne},x=(E,m=null)=>{clearTimeout(C),C=null,clearTimeout(O),O=setTimeout(()=>a(E,m),ce())},g=(E=!1)=>{if(clearTimeout(O),O=null,!!d){if(clearTimeout(C),E){B();return}C=setTimeout(()=>B(),$())}},P=(E=null,m=null)=>q()?(B(),null):a(E,m),q=()=>!!d,ve={open:a,close:B,show:x,hide:g,toggle:P,update:ie,bind:E=>{var j,ne;if(!E)return()=>{};r=E;const m=X(),N=Se((ne=(j=m.trigger)!=null?j:m.triggers)!=null?ne:v(m,"open")?"manual":null),I=N.has("hover"),K=N.has("focus"),ke=N.has("click"),Oe=N.has("manual")||!I&&!K&&!ke,Te=[],U=()=>{H(),Te.forEach(Ve=>Ve()),r===E&&(r=null)};if(v(m,"open"))return Ye(m.open)?JSswift.reactive.effect(()=>{r&&(o(X().open)?a(r):g(!0))},"UI.Popover:open"):m.open===!0?a(E):m.open===!1&&g(!0),U;if(Oe||o(m.disabled))return U;if(I){const Ve=()=>x(E),He=()=>g();E.addEventListener("mouseenter",Ve),E.addEventListener("mouseleave",He),Te.push(()=>{E.removeEventListener("mouseenter",Ve),E.removeEventListener("mouseleave",He)})}if(K){const Ve=()=>x(E),He=()=>g();E.addEventListener("focus",Ve),E.addEventListener("blur",He),Te.push(()=>{E.removeEventListener("focus",Ve),E.removeEventListener("blur",He)})}if(ke){const Ve=He=>{var ae,$e;($e=(ae=X()).onTriggerClick)==null||$e.call(ae,He),!He.defaultPrevented&&P(E)};E.addEventListener("click",Ve),Te.push(()=>E.removeEventListener("click",Ve))}return U},isOpen:q,entry:()=>d,props:()=>({...w})};return ve},Ne.ContextMenu=(...t)=>{const{props:e,children:n}=JSswift.uiNormalizeArgs(t);let s={...e},i=null,c=null,w=null;const d=h=>h&&typeof h=="object"&&!h.nodeType&&!Array.isArray(h)&&!(h instanceof Function),r=h=>!!h&&typeof h=="object"&&(h.nodeType===1||typeof h.getBoundingClientRect=="function"),b=h=>!!h&&typeof h=="object"&&("clientX"in h||"type"in h||"target"in h||"currentTarget"in h),O=h=>!!h&&Number.isFinite(Number(h.x))&&Number.isFinite(Number(h.y)),C=()=>s,v=(h,B)=>{const ie=Number(h),a=Number(B);return!Number.isFinite(ie)||!Number.isFinite(a)?null:{x:ie,y:a}},T=h=>h?{_cmsContextPoint:h,getBoundingClientRect:()=>({top:h.y,bottom:h.y,left:h.x,right:h.x,width:0,height:0})}:null,le=h=>{if(!r(h))return null;const B=h.getBoundingClientRect();return v(B.left+Math.min(B.width/2,24),B.top+Math.min(B.height/2,24))},Z=h=>{var B,ie,a,x;return o((x=(a=(ie=(B=h==null?void 0:h.anchorEl)!=null?B:h==null?void 0:h.triggerEl)!=null?ie:h==null?void 0:h.target)!=null?a:h==null?void 0:h.anchor)!=null?x:null)},he=(h,B=null)=>{if(!h)return le(B||w);const ie=v(h.clientX,h.clientY);if(ie)return ie;const a=Z({anchorEl:B||h.currentTarget||h.target||w});return le(a)},H=(h={})=>{if(!d(h))return{};const B={...h};return delete B.event,delete B.point,delete B.x,delete B.y,B},W=()=>{var B,ie,a;const h=C();return{...h,trigger:"manual",placement:h.placement||"bottom-start",offsetX:(B=h.offsetX)!=null?B:0,offsetY:(a=(ie=h.offsetY)!=null?ie:h.offset)!=null?a:4,closeOnOutside:h.closeOnOutside!==!1,closeOnEsc:h.closeOnEsc!==!1,role:h.role||"menu",ariaLabel:h.ariaLabel||h.title||"Context menu",class:te(["cms-context-menu-shell",h.class]),panelClass:te(["cms-context-menu-panel",h.panelClass])}},se=Ne.Menu(W(),...n),X=(h=null,B=null,ie=null)=>{let a=null,x=null,g=null;if(b(h))a=he(h,w),g=d(B)?H(B):null;else if(typeof h=="number"||typeof B=="number")a=v(h,B),g=d(ie)?H(ie):null;else if(O(h))a=v(h.x,h.y),g=d(B)?H(B):null;else if(r(h))x=h,g=d(B)?H(B):null;else if(d(h)){const P=O(h.point)?h.point:O(h)?h:null,q=Z(h),Q=h.event;a=P?v(P.x,P.y):he(Q,q||w),x=q&&r(q)?q:null,g={...H(h),...d(B)?H(B):{}}}else i&&(a={...i});return{point:a,anchor:x,nextProps:g}},de=(h,B=null)=>{c=h||c,i=B||h&&h._cmsContextPoint||i},_e=(h=null)=>{d(h)&&Object.keys(h).length&&(s={...s,...h})},be=(h=null,B=null)=>{if(B)return T(B);if(h&&r(h))return h;const ie=Z(C());return r(ie)?ie:i?T(i):r(c)?c:r(w)?w:null},me=(h=null,B=null,ie=null)=>{const{point:a,anchor:x,nextProps:g}=X(h,B,ie);_e(g);const P=be(x,a);return P?(de(P,a),se.open(P,W())):null},fe=(h,B,ie=null)=>me(h,B,ie),ce=(h,B=null)=>me(h,B),$=()=>(se.close(),f),re=(h=!0)=>(h===!1?se.hide(!1):se.close(),f),oe=(h=null,B=null,ie=null)=>me(h,B,ie),Se=(h=null,B=null,ie=null)=>se.isOpen()?($(),null):me(h,B,ie),F=(h={})=>(_e(H(h)),se.update(W()),f),f={open:me,openAt:fe,openFromEvent:ce,show:oe,hide:re,close:$,toggle:Se,update:F,bind:(h,B=null)=>{if(!h)return()=>{};const ie=d(B)?H(B):null,a=g=>{var q,Q;w=h,g.preventDefault(),!(((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))&&me({event:g,anchorEl:h},ie)},x=g=>{var q,Q;g.key!=="ContextMenu"&&!(g.shiftKey&&g.key==="F10")||(w=h,g.preventDefault(),((Q=(q=C()).onTrigger)==null?void 0:Q.call(q,g,{element:h,open:me,close:$,update:F}))===!1||o(C().disabled))||me({event:g,anchorEl:h},ie)};return h.addEventListener("contextmenu",a),h.addEventListener("keydown",x),()=>{h.removeEventListener("contextmenu",a),h.removeEventListener("keydown",x)}},isOpen:se.isOpen,entry:se.entry,props:()=>({...s})};return f}})(JSswift);
|