@skill-map/cli 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- -- Kernel initial migration. Provisions the 11 kernel tables per
1
+ -- Kernel initial migration. Provisions the kernel tables per
2
2
  -- spec/db-schema.md. Up-only. Wrapped in BEGIN / COMMIT by the runner.
3
3
 
4
4
  -- --- Scan zone -------------------------------------------------------------
@@ -9,9 +9,14 @@ CREATE TABLE scan_nodes (
9
9
  provider TEXT NOT NULL,
10
10
  title TEXT,
11
11
  description TEXT,
12
+ -- `stability` is sourced from sidecar `annotations.stability`. NULL when
13
+ -- no sidecar accompanies the node or the field is omitted.
12
14
  stability TEXT,
13
- version TEXT,
14
- author TEXT,
15
+ -- `version` is a monotonic counter sourced from sidecar
16
+ -- `annotations.version` (Decision #125). Pre-9.6.2 it was a semver
17
+ -- string from `frontmatter.metadata.version`; this is greenfield —
18
+ -- no auto-conversion path.
19
+ version INTEGER,
15
20
  frontmatter_json TEXT NOT NULL,
16
21
  body_hash TEXT NOT NULL,
17
22
  frontmatter_hash TEXT NOT NULL,
@@ -25,6 +30,25 @@ CREATE TABLE scan_nodes (
25
30
  links_in_count INTEGER NOT NULL DEFAULT 0,
26
31
  external_refs_count INTEGER NOT NULL DEFAULT 0,
27
32
  scanned_at INTEGER NOT NULL,
33
+ -- Sidecar denormalisation (Step 9.6.2 — Decision #3, option (a)):
34
+ -- - `sidecar_present` — 1 when a co-located `.sm` file accompanies
35
+ -- this node, 0 otherwise.
36
+ -- - `sidecar_status` — fresh / stale-body / stale-frontmatter /
37
+ -- stale-both. NULL when no sidecar is present.
38
+ -- - `annotations_json` — JSON-encoded `annotations:` block from the
39
+ -- parsed sidecar (typed surface declared by
40
+ -- `spec/schemas/annotations.schema.json`). NULL when no sidecar
41
+ -- or the block is empty.
42
+ -- - `sidecar_root_json` — JSON-encoded full parsed YAML root of the
43
+ -- `.sm` file (every reserved block + plugin `<plugin-id>:`
44
+ -- namespaces). NULL when no sidecar accompanies the node, or
45
+ -- when parsing/validation failed (R15). Duplicates the
46
+ -- `annotations:` sub-block by design — pre-R15 readers of
47
+ -- `annotations_json` keep working unchanged.
48
+ sidecar_present INTEGER NOT NULL DEFAULT 0,
49
+ sidecar_status TEXT,
50
+ annotations_json TEXT,
51
+ sidecar_root_json TEXT,
28
52
  -- `kind` is open-by-design (Provider-declared string; the built-in
29
53
  -- Claude Provider emits `skill` / `agent` / `command` / `hook` /
30
54
  -- `note`, but external Providers may declare their own — see
@@ -35,6 +59,7 @@ CREATE TABLE scan_nodes (
35
59
  CREATE INDEX ix_scan_nodes_kind ON scan_nodes(kind);
36
60
  CREATE INDEX ix_scan_nodes_provider ON scan_nodes(provider);
37
61
  CREATE INDEX ix_scan_nodes_body_hash ON scan_nodes(body_hash);
62
+ CREATE INDEX ix_scan_nodes_sidecar_status ON scan_nodes(sidecar_status);
38
63
 
39
64
  CREATE TABLE scan_links (
40
65
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -163,6 +188,26 @@ CREATE TABLE state_plugin_kvs (
163
188
  );
164
189
  CREATE INDEX ix_state_plugin_kvs_plugin_id ON state_plugin_kvs(plugin_id);
165
190
 
191
+ -- Per-node "favorite" flag persisted per user (single-user local DB).
192
+ -- Zone `state_` because favorites are user-authored preference and must
193
+ -- survive `sm scan` truncation and `sm db reset` (which drops only
194
+ -- `scan_*`). Absence of a row means "not favorited".
195
+ --
196
+ -- `node_path` is FK-semantic to `scan_nodes.path`. The rename heuristic
197
+ -- (`migrateNodeFks` in src/kernel/adapters/sqlite/history.ts) MUST migrate
198
+ -- rows here when a path is renamed, same protocol as the other state_*
199
+ -- tables. Simple PK update — no composite key, no collision shape.
200
+ --
201
+ -- The BFF's `/api/nodes` route loads the full set of paths once per
202
+ -- request (typical favorite count is small) and decorates the in-memory
203
+ -- node list with a derived `isFavorite` boolean by Set membership. No
204
+ -- SQL JOIN against `scan_nodes` is required.
205
+
206
+ CREATE TABLE state_node_favorites (
207
+ node_path TEXT PRIMARY KEY,
208
+ favorited_at INTEGER NOT NULL
209
+ );
210
+
166
211
  -- --- Config zone -----------------------------------------------------------
167
212
 
168
213
  CREATE TABLE config_plugins (
@@ -195,9 +240,7 @@ CREATE TABLE config_schema_versions (
195
240
  -- `stats` fields (filesWalked / filesSkipped / durationMs) instead of a
196
241
  -- synthetic envelope. Single-row table (CHECK id = 1); replaced atomically
197
242
  -- with the rest of the scan_* zone on every `sm scan` via
198
- -- `persistScanResult`. Originally landed at Step 5.1 as migration 002 and
199
- -- folded back into the initial migration pre-1.0 (no released DBs to migrate
200
- -- forward).
243
+ -- `persistScanResult`.
201
244
 
202
245
  CREATE TABLE scan_meta (
203
246
  id INTEGER PRIMARY KEY,
@@ -238,12 +281,12 @@ CREATE INDEX ix_scan_extractor_runs_extractor ON scan_extractor_runs(extractor_i
238
281
  -- --- Universal enrichment layer --------------------------------------------
239
282
  -- Phase 4 / A.8 — stores `ctx.enrichNode(partial)` outputs separately from
240
283
  -- the author-supplied frontmatter (which remains immutable from Extractors).
241
- -- Layer separation is universal: deterministic and probabilistic Extractors
242
- -- both write here. Only probabilistic enrichments need stale tracking
243
- -- (`is_probabilistic = 1`); when a node body changes between scans, those
244
- -- rows are flagged `stale = 1` (NOT deleted, preserving the LLM cost).
245
- -- Deterministic enrichments regenerate via the A.9 fine-grained cache and
246
- -- simply pisar the prior row via PRIMARY KEY conflict on the next scan.
284
+ -- Extractors are deterministic-only; rows regenerate via the A.9 fine-grained
285
+ -- cache and simply overwrite the prior row via PRIMARY KEY conflict on the
286
+ -- next scan. The `stale` and `is_probabilistic` columns are persisted but
287
+ -- inert in this revision (always 0); they are reserved for the future
288
+ -- Action-issued probabilistic enrichment revision (queued LLM jobs that
289
+ -- must preserve paid output across body changes).
247
290
  --
248
291
  -- Read-side `node.merged` view (helper `mergeNodeWithEnrichments`):
249
292
  -- author frontmatter + non-stale enrichments ordered by enriched_at ASC,
@@ -265,3 +308,70 @@ CREATE TABLE node_enrichments (
265
308
  );
266
309
  CREATE INDEX ix_node_enrichments_node ON node_enrichments(node_path);
267
310
  CREATE INDEX ix_node_enrichments_stale ON node_enrichments(stale);
311
+
312
+ -- --- View contribution layer ----------------------------------------------
313
+ -- Phase 3 / View contribution system. Per-node typed data emitted by
314
+ -- extractors via `ctx.emitContribution(id, payload)` (and rules via
315
+ -- `ctx.emitScopeContribution(id, payload)` for scope-level contracts).
316
+ -- Belongs to the `scan_*` family — cleared on every scan and repopulated
317
+ -- by emissions; NOT analogous to the plugin-private `state_plugin_kvs`
318
+ -- (which the plugin manages).
319
+ --
320
+ -- See `spec/architecture.md` § View contribution system → Persistence
321
+ -- and `ROADMAP.md` § UI contribution system → Persistence for the
322
+ -- normative contract. The kernel publishes the closed catalog of
323
+ -- contracts at `spec/schemas/view-contracts.schema.json#/$defs/ContractName`;
324
+ -- payloads are AJV-validated at emit time against the per-contract
325
+ -- schemas in `$defs/payloads/<contract>` before reaching this table.
326
+ --
327
+ -- PK on `(plugin_id, extension_id, node_path, contribution_id)` so
328
+ -- re-emission of the same contribution for the same node REPLACES the
329
+ -- prior row. The qualified id mirrors the kernel's
330
+ -- `<pluginId>/<extensionId>/<contributionId>` identity.
331
+ --
332
+ -- Index on `node_path` for the inspector lazy-fetch path
333
+ -- (`GET /api/contributions/:pluginId/:contributionId?path=...`) and for
334
+ -- the rename heuristic (when a `.md` is renamed, the kernel migrates
335
+ -- `node_path` here alongside `scan_links` etc.). Without the index,
336
+ -- those reads scan the whole table; with it, they hit a B-tree.
337
+
338
+ CREATE TABLE scan_contributions (
339
+ plugin_id TEXT NOT NULL,
340
+ extension_id TEXT NOT NULL,
341
+ node_path TEXT NOT NULL,
342
+ contribution_id TEXT NOT NULL,
343
+ -- Closed enum surfaced for fast filtering / debugging — the value
344
+ -- mirrors `view-contracts.schema.json#/$defs/ContractName`. Kept open
345
+ -- at the SQL layer (no CHECK) by design: catalog evolution ships as
346
+ -- a kernel + spec change with `sm plugins upgrade` migration; a hard
347
+ -- CHECK here would force a DDL migration on every catalog rename
348
+ -- and conflict with the upgrade verb's autonomy.
349
+ contract TEXT NOT NULL,
350
+ -- JSON-serialized payload, already validated against the contract's
351
+ -- payload schema at emit time. Kept opaque at the SQL layer; readers
352
+ -- (BFF, rules) parse on demand.
353
+ payload_json TEXT NOT NULL,
354
+ emitted_at INTEGER NOT NULL,
355
+ PRIMARY KEY (plugin_id, extension_id, node_path, contribution_id)
356
+ );
357
+
358
+ CREATE INDEX ix_scan_contributions_node_path ON scan_contributions(node_path);
359
+ CREATE INDEX ix_scan_contributions_plugin_id ON scan_contributions(plugin_id);
360
+
361
+ -- scan_node_tags: dual-source tag system (Phase 2 — `tags` decision).
362
+ -- One row per (node_path, tag, source) triple. Projected at persist
363
+ -- time from `frontmatter.tags` (source='author') and
364
+ -- `sidecar.annotations.tags` (source='user'). Drives `sm list --tag`
365
+ -- and the UI's tag-faceted search; the (tag) index keeps lookups
366
+ -- O(log n). The same tag string MAY appear under both sources for the
367
+ -- same node (the PK accepts the pair); search returns the node once
368
+ -- via DISTINCT, the UI renders both chips with their attribution.
369
+ CREATE TABLE scan_node_tags (
370
+ node_path TEXT NOT NULL,
371
+ tag TEXT NOT NULL,
372
+ source TEXT NOT NULL,
373
+ PRIMARY KEY (node_path, tag, source),
374
+ CONSTRAINT ck_scan_node_tags_source CHECK (source IN ('author','user'))
375
+ );
376
+ CREATE INDEX ix_scan_node_tags_tag ON scan_node_tags(tag);
377
+ CREATE INDEX ix_scan_node_tags_node_path ON scan_node_tags(node_path);
@@ -0,0 +1,7 @@
1
+ var ft=Object.defineProperty,ve=Object.getOwnPropertySymbols,pt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable,be=(e,t,n)=>t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t)=>{for(var n in t||(t={}))pt.call(t,n)&&be(e,n,t[n]);if(ve)for(var n of ve(t))ht.call(t,n)&&be(e,n,t[n]);return e};function W(e){return e==null||e===""||Array.isArray(e)&&e.length===0||!(e instanceof Date)&&typeof e=="object"&&Object.keys(e).length===0}function oe(e,t,n=new WeakSet){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object"||n.has(e)||n.has(t))return!1;n.add(e).add(t);let r=Array.isArray(e),i=Array.isArray(t),l,o,s;if(r&&i){if(o=e.length,o!=t.length)return!1;for(l=o;l--!==0;)if(!oe(e[l],t[l],n))return!1;return!0}if(r!=i)return!1;let a=e instanceof Date,u=t instanceof Date;if(a!=u)return!1;if(a&&u)return e.getTime()==t.getTime();let d=e instanceof RegExp,p=t instanceof RegExp;if(d!=p)return!1;if(d&&p)return e.toString()==t.toString();let c=Object.keys(e);if(o=c.length,o!==Object.keys(t).length)return!1;for(l=o;l--!==0;)if(!Object.prototype.hasOwnProperty.call(t,c[l]))return!1;for(l=o;l--!==0;)if(s=c[l],!oe(e[s],t[s],n))return!1;return!0}function gt(e,t){return oe(e,t)}function xe(e){return typeof e=="function"&&"call"in e&&"apply"in e}function h(e){return!W(e)}function Se(e,t){if(!e||!t)return null;try{let n=e[t];if(h(n))return n}catch{}if(Object.keys(e).length){if(xe(t))return t(e);if(t.indexOf(".")===-1)return e[t];{let n=t.split("."),r=e;for(let i=0,l=n.length;i<l;++i){if(r==null)return null;r=r[n[i]]}return r}}return null}function yt(e,t,n){return n?Se(e,n)===Se(t,n):gt(e,t)}function Bt(e,t){if(e!=null&&t&&t.length){for(let n of t)if(yt(e,n))return!0}return!1}function C(e,t=!0){return e instanceof Object&&e.constructor===Object&&(t||Object.keys(e).length!==0)}function Ce(e={},t={}){let n=mt({},e);return Object.keys(t).forEach(r=>{let i=r;C(t[i])&&i in e&&C(e[i])?n[i]=Ce(e[i],t[i]):n[i]=t[i]}),n}function N(...e){return e.reduce((t,n,r)=>r===0?n:Ce(t,n),{})}function It(e,t){let n=-1;if(h(e))try{n=e.findLastIndex(t)}catch{n=e.lastIndexOf([...e].reverse().find(t))}return n}function $(e,...t){return xe(e)?e(...t):e}function O(e,t=!0){return typeof e=="string"&&(t||e!=="")}function we(e){return O(e)?e.replace(/(-|_)/g,"").toLowerCase():e}function le(e,t="",n={}){let r=we(t).split("."),i=r.shift();if(i){if(C(e)){let l=Object.keys(e).find(o=>we(o)===i)||"";return le($(e[l],n),r.join("."),n)}return}return $(e,n)}function Ee(e,t=!0){return Array.isArray(e)&&(t||e.length!==0)}function Mt(e){return e instanceof Date}function ne(e){return h(e)&&!isNaN(e)}function Ht(e=""){return h(e)&&e.length===1&&!!e.match(/\S| /)}function w(e,t){if(t){let n=t.test(e);return t.lastIndex=0,n}return!1}function se(...e){return N(...e)}function ae(e){return e&&e.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," ").replace(/ ([{:}]) /g,"$1").replace(/([;,]) /g,"$1").replace(/ !/g,"!").replace(/: /g,":").trim()}function Ut(e){if(e&&/[\xC0-\xFF\u0100-\u017E]/.test(e)){let t={A:/[\xC0-\xC5\u0100\u0102\u0104]/g,AE:/[\xC6]/g,C:/[\xC7\u0106\u0108\u010A\u010C]/g,D:/[\xD0\u010E\u0110]/g,E:/[\xC8-\xCB\u0112\u0114\u0116\u0118\u011A]/g,G:/[\u011C\u011E\u0120\u0122]/g,H:/[\u0124\u0126]/g,I:/[\xCC-\xCF\u0128\u012A\u012C\u012E\u0130]/g,IJ:/[\u0132]/g,J:/[\u0134]/g,K:/[\u0136]/g,L:/[\u0139\u013B\u013D\u013F\u0141]/g,N:/[\xD1\u0143\u0145\u0147\u014A]/g,O:/[\xD2-\xD6\xD8\u014C\u014E\u0150]/g,OE:/[\u0152]/g,R:/[\u0154\u0156\u0158]/g,S:/[\u015A\u015C\u015E\u0160]/g,T:/[\u0162\u0164\u0166]/g,U:/[\xD9-\xDC\u0168\u016A\u016C\u016E\u0170\u0172]/g,W:/[\u0174]/g,Y:/[\xDD\u0176\u0178]/g,Z:/[\u0179\u017B\u017D]/g,a:/[\xE0-\xE5\u0101\u0103\u0105]/g,ae:/[\xE6]/g,c:/[\xE7\u0107\u0109\u010B\u010D]/g,d:/[\u010F\u0111]/g,e:/[\xE8-\xEB\u0113\u0115\u0117\u0119\u011B]/g,g:/[\u011D\u011F\u0121\u0123]/g,i:/[\xEC-\xEF\u0129\u012B\u012D\u012F\u0131]/g,ij:/[\u0133]/g,j:/[\u0135]/g,k:/[\u0137,\u0138]/g,l:/[\u013A\u013C\u013E\u0140\u0142]/g,n:/[\xF1\u0144\u0146\u0148\u014B]/g,p:/[\xFE]/g,o:/[\xF2-\xF6\xF8\u014D\u014F\u0151]/g,oe:/[\u0153]/g,r:/[\u0155\u0157\u0159]/g,s:/[\u015B\u015D\u015F\u0161]/g,t:/[\u0163\u0165\u0167]/g,u:/[\xF9-\xFC\u0169\u016B\u016D\u016F\u0171\u0173]/g,w:/[\u0175]/g,y:/[\xFD\xFF\u0177]/g,z:/[\u017A\u017C\u017E]/g};for(let n in t)e=e.replace(t[n],n)}return e}function re(e){return O(e)?e.replace(/(_)/g,"-").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase():e}function Kt(e){return e==="auto"?0:typeof e=="number"?e:Number(e.replace(/[^\d.]/g,"").replace(",","."))*1e3}function $e(){let e=new Map;return{on(t,n){let r=e.get(t);return r?r.push(n):r=[n],e.set(t,r),this},off(t,n){let r=e.get(t);return r&&r.splice(r.indexOf(n)>>>0,1),this},emit(t,n){let r=e.get(t);r&&r.forEach(i=>{i(n)})},clear(){e.clear()}}}function vt(e,t){return e?e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className):!1}function Oe(e,t){if(e&&t){let n=r=>{vt(e,r)||(e.classList?e.classList.add(r):e.className+=" "+r)};[t].flat().filter(Boolean).forEach(r=>r.split(" ").forEach(n))}}function bt(){return window.innerWidth-document.documentElement.offsetWidth}function Xt(e){typeof e=="string"?Oe(document.body,e||"p-overflow-hidden"):(e!=null&&e.variableName&&document.body.style.setProperty(e.variableName,bt()+"px"),Oe(document.body,e?.className||"p-overflow-hidden"))}function ke(e,t){if(e&&t){let n=r=>{e.classList?e.classList.remove(r):e.className=e.className.replace(new RegExp("(^|\\b)"+r.split(" ").join("|")+"(\\b|$)","gi")," ")};[t].flat().filter(Boolean).forEach(r=>r.split(" ").forEach(n))}}function Zt(e){typeof e=="string"?ke(document.body,e||"p-overflow-hidden"):(e!=null&&e.variableName&&document.body.style.removeProperty(e.variableName),ke(document.body,e?.className||"p-overflow-hidden"))}function ue(e){for(let t of document?.styleSheets)try{for(let n of t?.cssRules)for(let r of n?.style)if(e.test(r))return{name:r,value:n.style.getPropertyValue(r).trim()}}catch{}return null}function Ae(e){let t={width:0,height:0};if(e){let[n,r]=[e.style.visibility,e.style.display],i=e.getBoundingClientRect();e.style.visibility="hidden",e.style.display="block",t.width=i.width||e.offsetWidth,t.height=i.height||e.offsetHeight,e.style.display=r,e.style.visibility=n}return t}function Ne(){let e=window,t=document,n=t.documentElement,r=t.getElementsByTagName("body")[0],i=e.innerWidth||n.clientWidth||r.clientWidth,l=e.innerHeight||n.clientHeight||r.clientHeight;return{width:i,height:l}}function de(e){return e?Math.abs(e.scrollLeft):0}function St(){let e=document.documentElement;return(window.pageXOffset||de(e))-(e.clientLeft||0)}function wt(){let e=document.documentElement;return(window.pageYOffset||e.scrollTop)-(e.clientTop||0)}function xt(e){return e?getComputedStyle(e).direction==="rtl":!1}function Gt(e,t,n=!0){var r,i,l,o;if(e){let s=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:Ae(e),a=s.height,u=s.width,d=t.offsetHeight,p=t.offsetWidth,c=t.getBoundingClientRect(),f=wt(),g=St(),v=Ne(),y,b,S="top";c.top+d+a>v.height?(y=c.top+f-a,S="bottom",y<0&&(y=f)):y=d+c.top+f,c.left+u>v.width?b=Math.max(0,c.left+g+p-u):b=c.left+g,xt(e)?e.style.insetInlineEnd=b+"px":e.style.insetInlineStart=b+"px",e.style.top=y+"px",e.style.transformOrigin=S,n&&(e.style.marginTop=S==="bottom"?`calc(${(i=(r=ue(/-anchor-gutter$/))==null?void 0:r.value)!=null?i:"2px"} * -1)`:(o=(l=ue(/-anchor-gutter$/))==null?void 0:l.value)!=null?o:"")}}function Yt(e,t){e&&(typeof t=="string"?e.style.cssText=t:Object.entries(t||{}).forEach(([n,r])=>e.style[n]=r))}function Jt(e,t){if(e instanceof HTMLElement){let n=e.offsetWidth;if(t){let r=getComputedStyle(e);n+=parseFloat(r.marginLeft)+parseFloat(r.marginRight)}return n}return 0}function Qt(e,t,n=!0,r=void 0){var i;if(e){let l=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:Ae(e),o=t.offsetHeight,s=t.getBoundingClientRect(),a=Ne(),u,d,p=r??"top";if(!r&&s.top+o+l.height>a.height?(u=-1*l.height,p="bottom",s.top+u<0&&(u=-1*s.top)):u=o,l.width>a.width?d=s.left*-1:s.left+l.width>a.width?d=(s.left+l.width-a.width)*-1:d=0,e.style.top=u+"px",e.style.insetInlineStart=d+"px",e.style.transformOrigin=p,n){let c=(i=ue(/-anchor-gutter$/))==null?void 0:i.value;e.style.marginTop=p==="bottom"?`calc(${c??"2px"} * -1)`:c??""}}}function Pe(e){if(e){let t=e.parentNode;return t&&t instanceof ShadowRoot&&t.host&&(t=t.host),t}return null}function Ct(e){return!!(e!==null&&typeof e<"u"&&e.nodeName&&Pe(e))}function T(e){return typeof Element<"u"?e instanceof Element:e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.nodeName=="string"}function je(e){let t=e;return e&&typeof e=="object"&&(Object.hasOwn(e,"current")?t=e.current:Object.hasOwn(e,"el")&&(Object.hasOwn(e.el,"nativeElement")?t=e.el.nativeElement:t=e.el)),T(t)?t:void 0}function Et(e,t){var n,r,i;if(e)switch(e){case"document":return document;case"window":return window;case"body":return document.body;case"@next":return t?.nextElementSibling;case"@prev":return t?.previousElementSibling;case"@first":return t?.firstElementChild;case"@last":return t?.lastElementChild;case"@child":return(n=t?.children)==null?void 0:n[0];case"@parent":return t?.parentElement;case"@grandparent":return(r=t?.parentElement)==null?void 0:r.parentElement;default:{if(typeof e=="string"){let s=e.match(/^@child\[(\d+)]/);return s?((i=t?.children)==null?void 0:i[parseInt(s[1],10)])||null:document.querySelector(e)||null}let l=(s=>typeof s=="function"&&"call"in s&&"apply"in s)(e)?e():e,o=je(l);return Ct(o)?o:l?.nodeType===9?l:void 0}}}function en(e,t){let n=Et(e,t);if(n)n.appendChild(t);else throw new Error("Cannot append "+t+" to "+e)}function Te(e,t={}){if(T(e)){let n=(r,i)=>{var l,o;let s=(l=e?.$attrs)!=null&&l[r]?[(o=e?.$attrs)==null?void 0:o[r]]:[];return[i].flat().reduce((a,u)=>{if(u!=null){let d=typeof u;if(d==="string"||d==="number")a.push(u);else if(d==="object"){let p=Array.isArray(u)?n(r,u):Object.entries(u).map(([c,f])=>r==="style"&&(f||f===0)?`${c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${f}`:f?c:void 0);a=p.length?a.concat(p.filter(c=>!!c)):a}}return a},s)};Object.entries(t).forEach(([r,i])=>{if(i!=null){let l=r.match(/^on(.+)/);l?e.addEventListener(l[1].toLowerCase(),i):r==="p-bind"||r==="pBind"?Te(e,i):(i=r==="class"?[...new Set(n("class",i))].join(" ").trim():r==="style"?n("style",i).join(";").trim():i,(e.$attrs=e.$attrs||{})&&(e.$attrs[r]=i),e.setAttribute(r,i))}})}}function tn(e,t={},...n){if(e){let r=document.createElement(e);return Te(r,t),r.append(...n),r}}function Le(e,t={}){return e?`<style${Object.entries(t).reduce((n,[r,i])=>n+` ${r}="${i}"`,"")}>${e}</style>`:""}function nn(e,t){if(e){e.style.opacity="0";let n=+new Date,r="0",i=function(){r=`${+e.style.opacity+(new Date().getTime()-n)/t}`,e.style.opacity=r,n=+new Date,+r<1&&("requestAnimationFrame"in window?requestAnimationFrame(i):setTimeout(i,16))};i()}}function $t(e,t){return T(e)?Array.from(e.querySelectorAll(t)):[]}function rn(e,t){return T(e)?e.matches(t)?e:e.querySelector(t):null}function on(e,t){e&&document.activeElement!==e&&e.focus(t)}function ln(e,t){if(T(e)){let n=e.getAttribute(t);return isNaN(n)?n==="true"||n==="false"?n==="true":n:+n}}function _e(e,t=""){let n=$t(e,`button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
2
+ [href]:not([tabindex = "-1"]):not([style*="display:none"]):not([hidden])${t},
3
+ input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
4
+ select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
5
+ textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
6
+ [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
7
+ [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t}`),r=[];for(let i of n)getComputedStyle(i).display!="none"&&getComputedStyle(i).visibility!="hidden"&&r.push(i);return r}function sn(e,t){let n=_e(e,t);return n.length>0?n[0]:null}function an(e){if(e){let t=e.offsetHeight,n=getComputedStyle(e);return t-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),t}return 0}function un(e){var t;if(e){let n=(t=Pe(e))==null?void 0:t.childNodes,r=0;if(n)for(let i=0;i<n.length;i++){if(n[i]===e)return r;n[i].nodeType===1&&r++}}return-1}function dn(e,t){let n=_e(e,t);return n.length>0?n[n.length-1]:null}function cn(e){if(e){let t=e.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||de(document.documentElement)||de(document.body)||0)}}return{top:"auto",left:"auto"}}function Ot(e,t){if(e){let n=e.offsetHeight;if(t){let r=getComputedStyle(e);n+=parseFloat(r.marginTop)+parseFloat(r.marginBottom)}return n}return 0}function fn(){if(window.getSelection)return window.getSelection().toString();if(document.getSelection)return document.getSelection().toString()}function pn(e){if(e){let t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth),t}return 0}function hn(e){if(e){let t=e.nodeName,n=e.parentElement&&e.parentElement.nodeName;return t==="INPUT"||t==="TEXTAREA"||t==="BUTTON"||t==="A"||n==="INPUT"||n==="TEXTAREA"||n==="BUTTON"||n==="A"||!!e.closest(".p-button, .p-checkbox, .p-radiobutton")}return!1}function mn(e){return!!(e&&e.offsetParent!=null)}function gn(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function yn(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function vn(){return new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(e)})})}function bn(e){var t;e&&("remove"in Element.prototype?e.remove():(t=e.parentNode)==null||t.removeChild(e))}function Sn(e,t){let n=je(e);if(n)n.removeChild(t);else throw new Error("Cannot remove "+t+" from "+e)}function wn(e,t){let n=getComputedStyle(e).getPropertyValue("borderTopWidth"),r=n?parseFloat(n):0,i=getComputedStyle(e).getPropertyValue("paddingTop"),l=i?parseFloat(i):0,o=e.getBoundingClientRect(),s=t.getBoundingClientRect().top+document.body.scrollTop-(o.top+document.body.scrollTop)-r-l,a=e.scrollTop,u=e.clientHeight,d=Ot(t);s<0?e.scrollTop=a+s:s+d>u&&(e.scrollTop=a+s-u+d)}function xn(e,t="",n){T(e)&&n!==null&&n!==void 0&&e.setAttribute(t,n)}function Cn(e,t,n=null,r){var i;t&&((i=e?.style)==null||i.setProperty(t,n,r))}var kt=Object.defineProperty,At=Object.defineProperties,Nt=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,Fe=(e,t,n)=>t in e?kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))Be.call(t,n)&&Fe(e,n,t[n]);if(ie)for(var n of ie(t))Ie.call(t,n)&&Fe(e,n,t[n]);return e},j=(e,t)=>At(e,Nt(t)),k=(e,t)=>{var n={};for(var r in e)Be.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ie)for(var r of ie(e))t.indexOf(r)<0&&Ie.call(e,r)&&(n[r]=e[r]);return n};function On(...e){return N(...e)}var Pt=$e(),P=Pt,A=/{([^}]*)}/g,Me=/(\d+\s+[\+\-\*\/]\s+\d+)/g,He=/var\([^)]+\)/g;function Re(e){return O(e)?e.replace(/[A-Z]/g,(t,n)=>n===0?t:"."+t.toLowerCase()).toLowerCase():e}function Pn(e,t){Ee(e)?e.push(...t||[]):C(e)&&Object.assign(e,t)}function jt(e){return C(e)&&e.hasOwnProperty("$value")&&e.hasOwnProperty("$type")?e.$value:e}function jn(e,t=""){return["opacity","z-index","line-height","font-weight","flex","flex-grow","flex-shrink","order"].some(n=>t.endsWith(n))?e:`${e}`.trim().split(" ").map(n=>ne(n)?`${n}px`:n).join(" ")}function Tt(e){return e.replaceAll(/ /g,"").replace(/[^\w]/g,"-")}function ce(e="",t=""){return Tt(`${O(e,!1)&&O(t,!1)?`${e}-`:e}${t}`)}function Ue(e="",t=""){return`--${ce(e,t)}`}function Lt(e=""){let t=(e.match(/{/g)||[]).length,n=(e.match(/}/g)||[]).length;return(t+n)%2!==0}function Ke(e,t="",n="",r=[],i){if(O(e)){let l=e.trim();if(Lt(l))return;if(w(l,A)){let o=l.replaceAll(A,s=>{let a=s.replace(/{|}/g,"").split(".").filter(u=>!r.some(d=>w(u,d)));return`var(${Ue(n,re(a.join("-")))}${h(i)?`, ${i}`:""})`});return w(o.replace(He,"0"),Me)?`calc(${o})`:o}return l}else if(ne(e))return e}function Tn(e={},t){if(O(t)){let n=t.trim();return w(n,A)?n.replaceAll(A,r=>le(e,r.replace(/{|}/g,""))):n}else if(ne(t))return t}function _t(e,t,n){O(t,!1)&&e.push(`${t}:${n};`)}function L(e,t){return e?`${e}{${t}}`:""}function qe(e,t){if(e.indexOf("dt(")===-1)return e;function n(o,s){let a=[],u=0,d="",p=null,c=0;for(;u<=o.length;){let f=o[u];if((f==='"'||f==="'"||f==="`")&&o[u-1]!=="\\"&&(p=p===f?null:f),!p&&(f==="("&&c++,f===")"&&c--,(f===","||u===o.length)&&c===0)){let g=d.trim();g.startsWith("dt(")?a.push(qe(g,s)):a.push(r(g)),d="",u++;continue}f!==void 0&&(d+=f),u++}return a}function r(o){let s=o[0];if((s==='"'||s==="'"||s==="`")&&o[o.length-1]===s)return o.slice(1,-1);let a=Number(o);return isNaN(a)?o:a}let i=[],l=[];for(let o=0;o<e.length;o++)if(e[o]==="d"&&e.slice(o,o+3)==="dt(")l.push(o),o+=2;else if(e[o]===")"&&l.length>0){let s=l.pop();l.length===0&&i.push([s,o])}if(!i.length)return e;for(let o=i.length-1;o>=0;o--){let[s,a]=i[o],u=e.slice(s+3,a),d=n(u,t),p=t(...d);e=e.slice(0,s)+p+e.slice(a+1)}return e}function Ve(e){return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e}function We(e){let t=parseInt(e.substring(1),16),n=t>>16&255,r=t>>8&255,i=t&255;return{r:n,g:r,b:i}}function Ft(e,t,n){return`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}var ze=(e,t,n)=>{e=Ve(e),t=Ve(t);let r=(n/100*2-1+1)/2,i=1-r,l=We(e),o=We(t),s=Math.round(l.r*r+o.r*i),a=Math.round(l.g*r+o.g*i),u=Math.round(l.b*r+o.b*i);return Ft(s,a,u)},Rt=(e,t)=>ze("#000000",e,t),Vt=(e,t)=>ze("#ffffff",e,t),De=[50,100,200,300,400,500,600,700,800,900,950],Fn=e=>{if(w(e,A)){let t=e.replace(/{|}/g,"");return De.reduce((n,r)=>(n[r]=`{${t}.${r}}`,n),{})}return typeof e=="string"?De.reduce((t,n,r)=>(t[n]=r<=5?Vt(e,(5-r)*19):Rt(e,(r-5)*15),t),{}):e},Wn=e=>{var t;let n=x.getTheme(),r=fe(n,e,void 0,"variable"),i=(t=r?.match(/--[\w-]+/g))==null?void 0:t[0],l=fe(n,e,void 0,"value");return{name:i,variable:r,value:l}},D=(...e)=>fe(x.getTheme(),...e),fe=(e={},t,n,r)=>{if(t){let{variable:i,options:l}=x.defaults||{},{prefix:o,transform:s}=e?.options||l||{},a=w(t,A)?t:`{${t}}`;return r==="value"||W(r)&&s==="strict"?x.getTokenValue(t):Ke(a,void 0,o,[i.excludedKeyRegex],n)}return""};function Dn(e,...t){if(e instanceof Array){let n=e.reduce((r,i,l)=>{var o;return r+i+((o=$(t[l],{dt:D}))!=null?o:"")},"");return qe(n,D)}return $(e,{dt:D})}var pe=(e={})=>{let{preset:t,options:n}=e;return{preset(r){return t=t?se(t,r):r,this},options(r){return n=n?m(m({},n),r):r,this},primaryPalette(r){let{semantic:i}=t||{};return t=j(m({},t),{semantic:j(m({},i),{primary:r})}),this},surfacePalette(r){var i,l;let{semantic:o}=t||{},s=r&&Object.hasOwn(r,"light")?r.light:r,a=r&&Object.hasOwn(r,"dark")?r.dark:r,u={colorScheme:{light:m(m({},(i=o?.colorScheme)==null?void 0:i.light),!!s&&{surface:s}),dark:m(m({},(l=o?.colorScheme)==null?void 0:l.dark),!!a&&{surface:a})}};return t=j(m({},t),{semantic:m(m({},o),u)}),this},define({useDefaultPreset:r=!1,useDefaultOptions:i=!1}={}){return{preset:r?x.getPreset():t,options:i?x.getOptions():n}},update({mergePresets:r=!0,mergeOptions:i=!0}={}){let l={preset:r?se(x.getPreset(),t):t,options:i?m(m({},x.getOptions()),n):n};return x.setTheme(l),l},use(r){let i=this.define(r);return x.setTheme(i),i}}};function Wt(e,t={}){let n=x.defaults.variable,{prefix:r=n.prefix,selector:i=n.selector,excludedKeyRegex:l=n.excludedKeyRegex}=t,o=[],s=[],a=[{node:e,path:r}];for(;a.length;){let{node:d,path:p}=a.pop();for(let c in d){let f=d[c],g=jt(f),v=w(c,l)?ce(p):ce(p,re(c));if(C(g))a.push({node:g,path:v});else{let y=Ue(v),b=Ke(g,v,r,[l]);_t(s,y,b);let S=v;r&&S.startsWith(r+"-")&&(S=S.slice(r.length+1)),o.push(S.replace(/-/g,"."))}}}let u=s.join("");return{value:s,tokens:o,declarations:u,css:L(i,u)}}var E={regex:{rules:{class:{pattern:/^\.([a-zA-Z][\w-]*)$/,resolve(e){return{type:"class",selector:e,matched:this.pattern.test(e.trim())}}},attr:{pattern:/^\[(.*)\]$/,resolve(e){return{type:"attr",selector:`:root${e},:host${e}`,matched:this.pattern.test(e.trim())}}},media:{pattern:/^@media (.*)$/,resolve(e){return{type:"media",selector:e,matched:this.pattern.test(e.trim())}}},system:{pattern:/^system$/,resolve(e){return{type:"system",selector:"@media (prefers-color-scheme: dark)",matched:this.pattern.test(e.trim())}}},custom:{resolve(e){return{type:"custom",selector:e,matched:!0}}}},resolve(e){let t=Object.keys(this.rules).filter(n=>n!=="custom").map(n=>this.rules[n]);return[e].flat().map(n=>{var r;return(r=t.map(i=>i.resolve(n)).find(i=>i.matched))!=null?r:this.rules.custom.resolve(n)})}},_toVariables(e,t){return Wt(e,{prefix:t?.prefix})},getCommon({name:e="",theme:t={},params:n,set:r,defaults:i}){var l,o,s,a,u,d,p;let{preset:c,options:f}=t,g,v,y,b,S,_,B;if(h(c)&&f.transform!=="strict"){let{primitive:I,semantic:M,extend:H}=c,F=M||{},{colorScheme:U}=F,K=k(F,["colorScheme"]),q=H||{},{colorScheme:z}=q,R=k(q,["colorScheme"]),V=U||{},{dark:X}=V,Z=k(V,["dark"]),G=z||{},{dark:Y}=G,J=k(G,["dark"]),Q=h(I)?this._toVariables({primitive:I},f):{},ee=h(K)?this._toVariables({semantic:K},f):{},te=h(Z)?this._toVariables({light:Z},f):{},he=h(X)?this._toVariables({dark:X},f):{},me=h(R)?this._toVariables({semantic:R},f):{},ge=h(J)?this._toVariables({light:J},f):{},ye=h(Y)?this._toVariables({dark:Y},f):{},[Xe,Ze]=[(l=Q.declarations)!=null?l:"",Q.tokens],[Ge,Ye]=[(o=ee.declarations)!=null?o:"",ee.tokens||[]],[Je,Qe]=[(s=te.declarations)!=null?s:"",te.tokens||[]],[et,tt]=[(a=he.declarations)!=null?a:"",he.tokens||[]],[nt,rt]=[(u=me.declarations)!=null?u:"",me.tokens||[]],[it,ot]=[(d=ge.declarations)!=null?d:"",ge.tokens||[]],[lt,st]=[(p=ye.declarations)!=null?p:"",ye.tokens||[]];g=this.transformCSS(e,Xe,"light","variable",f,r,i),v=Ze;let at=this.transformCSS(e,`${Ge}${Je}`,"light","variable",f,r,i),ut=this.transformCSS(e,`${et}`,"dark","variable",f,r,i);y=`${at}${ut}`,b=[...new Set([...Ye,...Qe,...tt])];let dt=this.transformCSS(e,`${nt}${it}color-scheme:light`,"light","variable",f,r,i),ct=this.transformCSS(e,`${lt}color-scheme:dark`,"dark","variable",f,r,i);S=`${dt}${ct}`,_=[...new Set([...rt,...ot,...st])],B=$(c.css,{dt:D})}return{primitive:{css:g,tokens:v},semantic:{css:y,tokens:b},global:{css:S,tokens:_},style:B}},getPreset({name:e="",preset:t={},options:n,params:r,set:i,defaults:l,selector:o}){var s,a,u;let d,p,c;if(h(t)&&n.transform!=="strict"){let f=e.replace("-directive",""),g=t,{colorScheme:v,extend:y,css:b}=g,S=k(g,["colorScheme","extend","css"]),_=y||{},{colorScheme:B}=_,I=k(_,["colorScheme"]),M=v||{},{dark:H}=M,F=k(M,["dark"]),U=B||{},{dark:K}=U,q=k(U,["dark"]),z=h(S)?this._toVariables({[f]:m(m({},S),I)},n):{},R=h(F)?this._toVariables({[f]:m(m({},F),q)},n):{},V=h(H)?this._toVariables({[f]:m(m({},H),K)},n):{},[X,Z]=[(s=z.declarations)!=null?s:"",z.tokens||[]],[G,Y]=[(a=R.declarations)!=null?a:"",R.tokens||[]],[J,Q]=[(u=V.declarations)!=null?u:"",V.tokens||[]],ee=this.transformCSS(f,`${X}${G}`,"light","variable",n,i,l,o),te=this.transformCSS(f,J,"dark","variable",n,i,l,o);d=`${ee}${te}`,p=[...new Set([...Z,...Y,...Q])],c=$(b,{dt:D})}return{css:d,tokens:p,style:c}},getPresetC({name:e="",theme:t={},params:n,set:r,defaults:i}){var l;let{preset:o,options:s}=t,a=(l=o?.components)==null?void 0:l[e];return this.getPreset({name:e,preset:a,options:s,params:n,set:r,defaults:i})},getPresetD({name:e="",theme:t={},params:n,set:r,defaults:i}){var l,o;let s=e.replace("-directive",""),{preset:a,options:u}=t,d=((l=a?.components)==null?void 0:l[s])||((o=a?.directives)==null?void 0:o[s]);return this.getPreset({name:s,preset:d,options:u,params:n,set:r,defaults:i})},applyDarkColorScheme(e){return!(e.darkModeSelector==="none"||e.darkModeSelector===!1)},getColorSchemeOption(e,t){var n;return this.applyDarkColorScheme(e)?this.regex.resolve(e.darkModeSelector===!0?t.options.darkModeSelector:(n=e.darkModeSelector)!=null?n:t.options.darkModeSelector):[]},getLayerOrder(e,t={},n,r){let{cssLayer:i}=t;return i?`@layer ${$(i.order||i.name||"primeui",n)}`:""},getCommonStyleSheet({name:e="",theme:t={},params:n,props:r={},set:i,defaults:l}){let o=this.getCommon({name:e,theme:t,params:n,set:i,defaults:l}),s=Object.entries(r).reduce((a,[u,d])=>a.push(`${u}="${d}"`)&&a,[]).join(" ");return Object.entries(o||{}).reduce((a,[u,d])=>{if(C(d)&&Object.hasOwn(d,"css")){let p=ae(d.css),c=`${u}-variables`;a.push(`<style type="text/css" data-primevue-style-id="${c}" ${s}>${p}</style>`)}return a},[]).join("")},getStyleSheet({name:e="",theme:t={},params:n,props:r={},set:i,defaults:l}){var o;let s={name:e,theme:t,params:n,set:i,defaults:l},a=(o=e.includes("-directive")?this.getPresetD(s):this.getPresetC(s))==null?void 0:o.css,u=Object.entries(r).reduce((d,[p,c])=>d.push(`${p}="${c}"`)&&d,[]).join(" ");return a?`<style type="text/css" data-primevue-style-id="${e}-variables" ${u}>${ae(a)}</style>`:""},createTokens(e={},t,n="",r="",i={}){let l=function(s,a={},u=[]){if(u.includes(this.path))return console.warn(`Circular reference detected at ${this.path}`),{colorScheme:s,path:this.path,paths:a,value:void 0};u.push(this.path),a.name=this.path,a.binding||(a.binding={});let d=this.value;if(typeof this.value=="string"&&A.test(this.value)){let p=this.value.trim().replace(A,c=>{var f;let g=c.slice(1,-1),v=this.tokens[g];if(!v)return console.warn(`Token not found for path: ${g}`),"__UNRESOLVED__";let y=v.computed(s,a,u);return Array.isArray(y)&&y.length===2?`light-dark(${y[0].value},${y[1].value})`:(f=y?.value)!=null?f:"__UNRESOLVED__"});d=Me.test(p.replace(He,"0"))?`calc(${p})`:p}return W(a.binding)&&delete a.binding,u.pop(),{colorScheme:s,path:this.path,paths:a,value:d.includes("__UNRESOLVED__")?void 0:d}},o=(s,a,u)=>{Object.entries(s).forEach(([d,p])=>{let c=w(d,t.variable.excludedKeyRegex)?a:a?`${a}.${Re(d)}`:Re(d),f=u?`${u}.${d}`:d;C(p)?o(p,c,f):(i[c]||(i[c]={paths:[],computed:(g,v={},y=[])=>{if(i[c].paths.length===1)return i[c].paths[0].computed(i[c].paths[0].scheme,v.binding,y);if(g&&g!=="none")for(let b=0;b<i[c].paths.length;b++){let S=i[c].paths[b];if(S.scheme===g)return S.computed(g,v.binding,y)}return i[c].paths.map(b=>b.computed(b.scheme,v[b.scheme],y))}}),i[c].paths.push({path:f,value:p,scheme:f.includes("colorScheme.light")?"light":f.includes("colorScheme.dark")?"dark":"none",computed:l,tokens:i}))})};return o(e,n,r),i},getTokenValue(e,t,n){var r;let i=(s=>s.split(".").filter(a=>!w(a.toLowerCase(),n.variable.excludedKeyRegex)).join("."))(t),l=t.includes("colorScheme.light")?"light":t.includes("colorScheme.dark")?"dark":void 0,o=[(r=e[i])==null?void 0:r.computed(l)].flat().filter(s=>s);return o.length===1?o[0].value:o.reduce((s={},a)=>{let u=a,{colorScheme:d}=u,p=k(u,["colorScheme"]);return s[d]=p,s},void 0)},getSelectorRule(e,t,n,r){return n==="class"||n==="attr"?L(h(t)?`${e}${t},${e} ${t}`:e,r):L(e,L(t??":root,:host",r))},transformCSS(e,t,n,r,i={},l,o,s){if(h(t)){let{cssLayer:a}=i;if(r!=="style"){let u=this.getColorSchemeOption(i,o);t=n==="dark"?u.reduce((d,{type:p,selector:c})=>(h(c)&&(d+=c.includes("[CSS]")?c.replace("[CSS]",t):this.getSelectorRule(c,s,p,t)),d),""):L(s??":root,:host",t)}if(a){let u={name:"primeui",order:"primeui"};C(a)&&(u.name=$(a.name,{name:e,type:r})),h(u.name)&&(t=L(`@layer ${u.name}`,t),l?.layerNames(u.name))}return t}return""}},x={defaults:{variable:{prefix:"p",selector:":root,:host",excludedKeyRegex:/^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi},options:{prefix:"p",darkModeSelector:"system",cssLayer:!1}},_theme:void 0,_layerNames:new Set,_loadedStyleNames:new Set,_loadingStyles:new Set,_tokens:{},update(e={}){let{theme:t}=e;t&&(this._theme=j(m({},t),{options:m(m({},this.defaults.options),t.options)}),this._tokens=E.createTokens(this.preset,this.defaults),this.clearLoadedStyleNames())},get theme(){return this._theme},get preset(){var e;return((e=this.theme)==null?void 0:e.preset)||{}},get options(){var e;return((e=this.theme)==null?void 0:e.options)||{}},get tokens(){return this._tokens},getTheme(){return this.theme},setTheme(e){this.update({theme:e}),P.emit("theme:change",e)},getPreset(){return this.preset},setPreset(e){this._theme=j(m({},this.theme),{preset:e}),this._tokens=E.createTokens(e,this.defaults),this.clearLoadedStyleNames(),P.emit("preset:change",e),P.emit("theme:change",this.theme)},getOptions(){return this.options},setOptions(e){this._theme=j(m({},this.theme),{options:e}),this.clearLoadedStyleNames(),P.emit("options:change",e),P.emit("theme:change",this.theme)},getLayerNames(){return[...this._layerNames]},setLayerNames(e){this._layerNames.add(e)},getLoadedStyleNames(){return this._loadedStyleNames},isStyleNameLoaded(e){return this._loadedStyleNames.has(e)},setLoadedStyleName(e){this._loadedStyleNames.add(e)},deleteLoadedStyleName(e){this._loadedStyleNames.delete(e)},clearLoadedStyleNames(){this._loadedStyleNames.clear()},getTokenValue(e){return E.getTokenValue(this.tokens,e,this.defaults)},getCommon(e="",t){return E.getCommon({name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getComponent(e="",t){let n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return E.getPresetC(n)},getDirective(e="",t){let n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return E.getPresetD(n)},getCustomPreset(e="",t,n,r){let i={name:e,preset:t,options:this.options,selector:n,params:r,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return E.getPreset(i)},getLayerOrderCSS(e=""){return E.getLayerOrder(e,this.options,{names:this.getLayerNames()},this.defaults)},transformCSS(e="",t,n="style",r){return E.transformCSS(e,t,r,n,this.options,{layerNames:this.setLayerNames.bind(this)},this.defaults)},getCommonStyleSheet(e="",t,n={}){return E.getCommonStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getStyleSheet(e,t,n={}){return E.getStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},onStyleMounted(e){this._loadingStyles.add(e)},onStyleUpdated(e){this._loadingStyles.add(e)},onStyleLoaded(e,{name:t}){this._loadingStyles.size&&(this._loadingStyles.delete(t),P.emit(`theme:${t}:load`,e),!this._loadingStyles.size&&P.emit("theme:load"))}};function Mn(...e){let t=N(x.getPreset(),...e);return x.setPreset(t),t}function Hn(e){return pe().primaryPalette(e).update().preset}function Un(e){return pe().surfacePalette(e).update().preset}function qn(...e){let t=N(...e);return x.setPreset(t),t}function zn(e){return pe(e).update({mergePresets:!1})}var Dt=class{constructor({attrs:e}={}){this._styles=new Map,this._attrs=e||{}}get(e){return this._styles.get(e)}has(e){return this._styles.has(e)}delete(e){this._styles.delete(e)}clear(){this._styles.clear()}add(e,t){if(h(t)){let n={name:e,css:t,attrs:this._attrs,markup:Le(t,this._attrs)};this._styles.set(e,j(m({},n),{element:this.createStyleElement(n)}))}}update(){}getStyles(){return this._styles}getAllCSS(){return[...this._styles.values()].map(e=>e.css).filter(String)}getAllMarkup(){return[...this._styles.values()].map(e=>e.markup).filter(String)}getAllElements(){return[...this._styles.values()].map(e=>e.element)}createStyleElement(e={}){}},Zn=Dt;export{vt as a,Oe as b,Xt as c,ke as d,Zt as e,ue as f,Ae as g,Ne as h,St as i,wt as j,Gt as k,Yt as l,Jt as m,Qt as n,Et as o,en as p,Te as q,tn as r,nn as s,$t as t,rn as u,on as v,ln as w,_e as x,sn as y,an as z,un as A,dn as B,cn as C,Ot as D,fn as E,pn as F,hn as G,mn as H,gn as I,yn as J,vn as K,bn as L,Sn as M,wn as N,xn as O,Cn as P,W as Q,gt as R,xe as S,h as T,Se as U,yt as V,Bt as W,It as X,$ as Y,O as Z,we as _,le as $,Ee as aa,Mt as ba,Ht as ca,ae as da,Ut as ea,Kt as fa,On as ga,P as ha,A as ia,Me as ja,He as ka,Re as la,Pn as ma,jt as na,jn as oa,Tt as pa,ce as qa,Ue as ra,Lt as sa,Ke as ta,Tn as ua,_t as va,L as wa,qe as xa,ze as ya,Rt as za,Vt as Aa,Fn as Ba,Wn as Ca,D as Da,fe as Ea,Dn as Fa,pe as Ga,Wt as Ha,E as Ia,x as Ja,Mn as Ka,Hn as La,Un as Ma,qn as Na,zn as Oa,Zn as Pa};