@enigmax/dashboard 0.1.110 → 0.1.112
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/assets/index.html +89 -46
- package/assets/lib/enigma-primitives.js +2 -0
- package/package.json +1 -1
package/assets/index.html
CHANGED
|
@@ -651,12 +651,15 @@
|
|
|
651
651
|
.modal-back[hidden] { display: none; }
|
|
652
652
|
.modal-back.pal-back { align-items: flex-start; padding-top: 12vh; }
|
|
653
653
|
.modal.pal { max-width: 520px; padding: 12px; }
|
|
654
|
+
/* WebKit's own clear cross, on every search field. Where we want one we draw it
|
|
655
|
+
ourselves, so the platform's is a second cross for WebKit users only. */
|
|
656
|
+
input[type="search"]::-webkit-search-cancel-button,
|
|
657
|
+
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
|
|
654
658
|
.pal-input {
|
|
655
659
|
width: 100%; background: transparent; color: var(--text); border: none; border-bottom: 1px solid var(--border);
|
|
656
660
|
padding: 8px 6px 12px; font-size: 14px; font-family: var(--mono);
|
|
657
661
|
}
|
|
658
662
|
.pal-input:focus { outline: none; }
|
|
659
|
-
.pal-input::-webkit-search-cancel-button { display: none; }
|
|
660
663
|
.pal-list { max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; margin-top: 8px; }
|
|
661
664
|
.pal-gt {
|
|
662
665
|
font-family: var(--mono); font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.4px;
|
|
@@ -671,7 +674,7 @@
|
|
|
671
674
|
.pal-row .pal-hint { margin-left: auto; font-family: var(--mono); font-size: 11px; opacity: .6; }
|
|
672
675
|
.pal-row.sel { background: var(--surface2); color: var(--text); }
|
|
673
676
|
.pal-row.sel .tab-ic { opacity: 1; color: var(--accent); }
|
|
674
|
-
.pal-empty { padding: 18px 8px; color: var(--muted); font-size: 13px; }
|
|
677
|
+
.pal-empty { padding: 18px 8px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
|
|
675
678
|
.pal-foot {
|
|
676
679
|
display: flex; gap: 14px; padding: 10px 8px 2px; border-top: 1px solid var(--border-soft);
|
|
677
680
|
font-family: var(--mono); font-size: 10.5px; color: var(--muted); opacity: .7;
|
|
@@ -2469,6 +2472,11 @@ export {
|
|
|
2469
2472
|
};
|
|
2470
2473
|
</script>
|
|
2471
2474
|
<script src="/lib/chart.min.js"></script>
|
|
2475
|
+
<!-- The framework-agnostic half of @enigmax/primitives, vendored beside Chart.js by
|
|
2476
|
+
scripts/sync-primitives.mjs. The dashboard writes its own DOM; what it takes from
|
|
2477
|
+
the package is the search engine, the keyboard arithmetic, the grouping and the
|
|
2478
|
+
history - all of which it used to hand-roll. -->
|
|
2479
|
+
<script src="/lib/enigma-primitives.js"></script>
|
|
2472
2480
|
<script>
|
|
2473
2481
|
const POLL_MS = 5000;
|
|
2474
2482
|
const DAY = 86400000;
|
|
@@ -4267,7 +4275,7 @@ export {
|
|
|
4267
4275
|
|
|
4268
4276
|
// --- accounts & profiles subpage (mirrors the TUI hub over /api/accounts) ---
|
|
4269
4277
|
let accountsLoaded = false;
|
|
4270
|
-
let accTools = [], accAccounts = [], accProfiles = [], accPresets = [], accSessionSources = [];
|
|
4278
|
+
let accTools = [], accAccounts = [], accProfiles = [], accPresets = [], accSessionSources = [], accReserved = [];
|
|
4271
4279
|
// Real-time name validator mirroring the server (accounts.ts validateAccountName + the
|
|
4272
4280
|
// duplicate checks), so the modal blocks an invalid or already-used name as the user types.
|
|
4273
4281
|
// `taken` = names already in scope (per-tool for accounts, global for profiles); `current`
|
|
@@ -4276,6 +4284,7 @@ export {
|
|
|
4276
4284
|
return (v) => {
|
|
4277
4285
|
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/.test(v)) return "Use letters, digits, '.', '_' or '-' (max 64).";
|
|
4278
4286
|
if (v === "default") return "'default' is a reserved name.";
|
|
4287
|
+
if (accReserved.indexOf(v.toLowerCase()) !== -1) return "'" + v + "' is an enigma command, so it cannot name an account or profile.";
|
|
4279
4288
|
if (v !== current && taken.indexOf(v) !== -1) return "That name is already in use.";
|
|
4280
4289
|
return null;
|
|
4281
4290
|
};
|
|
@@ -4344,7 +4353,7 @@ export {
|
|
|
4344
4353
|
function renderAccounts(d) {
|
|
4345
4354
|
d = d || {};
|
|
4346
4355
|
const accounts = d.accounts || [], profiles = d.profiles || [], tools = d.tools || [];
|
|
4347
|
-
accTools = tools; accAccounts = accounts; accProfiles = profiles; accPresets = d.presets || []; accSessionSources = d.sessionSources || [];
|
|
4356
|
+
accTools = tools; accAccounts = accounts; accProfiles = profiles; accPresets = d.presets || []; accSessionSources = d.sessionSources || []; accReserved = d.reservedNames || [];
|
|
4348
4357
|
$("accountsBody").innerHTML = accounts.length ? accounts.map(accountRow).join("") : '<div class="empty" style="padding:20px 0">No accounts.</div>';
|
|
4349
4358
|
$("profilesBody").innerHTML = profiles.length ? profiles.map((p) => profileRow(p, tools, accounts)).join("")
|
|
4350
4359
|
: '<div class="empty" style="padding:20px 0">No profiles yet. Add one to pin an account per tool.</div>';
|
|
@@ -4620,7 +4629,7 @@ export {
|
|
|
4620
4629
|
: "";
|
|
4621
4630
|
return '<div class="gate-run"><div class="gate-run-h">'
|
|
4622
4631
|
+ '<span class="gate-run-b">' + esc(r.branch) + "</span>"
|
|
4623
|
-
+ '<span class="cstatus ' + (r.status === "completed" ? "ok" : r.status === "running" ? "orange" : r.status === "failed" ? "bad" : "") + '"><span class="cdot"></span>' + esc(r.status) + (r.awaitingAgent ? " · parked" : "") + "</span>"
|
|
4632
|
+
+ '<span class="cstatus ' + (r.status === "completed" ? "ok" : r.status === "running" ? "orange" : r.status === "failed" ? "bad" : "") + '"><span class="cdot"></span>' + esc(r.status) + (r.blockedReason ? " · needs you: " + esc(r.blockedReason) : r.awaitingAgent ? " · parked" : "") + "</span>"
|
|
4624
4633
|
+ '<span class="gate-run-meta">' + esc(r.headSha) + pr + "</span>"
|
|
4625
4634
|
+ '<span style="flex:1"></span>' + stop
|
|
4626
4635
|
+ "</div>" + '<div class="gate-steps">' + steps + "</div>"
|
|
@@ -5052,30 +5061,41 @@ export {
|
|
|
5052
5061
|
// Palette"). enigma: the dashboard is a single dependency-free HTML file served over
|
|
5053
5062
|
// loopback, so the ~20-line matcher below stands in for fuse.js - upgrade to fuse.js
|
|
5054
5063
|
// if this page ever gains a build step.
|
|
5064
|
+
// Guarded rather than destructured outright: this page is ONE script, so a missing
|
|
5065
|
+
// vendored file would throw here and take every panel below it with it - which is
|
|
5066
|
+
// exactly how the README's preview render came out with "-" in every card. Only the
|
|
5067
|
+
// four things called at MODULE scope need a stand-in; the rest are called from
|
|
5068
|
+
// handlers, where a failure is contained to the palette that is already degraded.
|
|
5069
|
+
const primitives = window.EnigmaPrimitives || {};
|
|
5070
|
+
const { moveActive, groupRows, isPaletteShortcut } = primitives;
|
|
5071
|
+
const subsequenceMatcher = primitives.subsequenceMatcher || (() => undefined);
|
|
5072
|
+
// The empty state quotes what was typed, and what was typed is arbitrary: a pasted
|
|
5073
|
+
// string with no spaces in it has no break opportunity, so it runs out of the panel.
|
|
5074
|
+
const shortenQuery = primitives.shortenQuery || ((value) => value);
|
|
5075
|
+
const createSearch = primitives.createSearch || (() => ({ setItems() {}, search() {}, searchNow() {}, update() {}, destroy() {} }));
|
|
5076
|
+
const createRecentStore = primitives.createRecentStore || (() => ({ list: () => [], remember: () => [], forget: () => [], clear() {} }));
|
|
5077
|
+
const shortcutLabel = primitives.shortcutLabel || ((key) => "Ctrl " + key);
|
|
5055
5078
|
const palBack = $("palBack"), palInput = $("palInput"), palList = $("palList");
|
|
5056
|
-
const IS_MAC = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
5057
5079
|
let palItems = [], palSel = 0, palReturnFocus = null;
|
|
5058
|
-
$("palHint").textContent =
|
|
5080
|
+
$("palHint").textContent = shortcutLabel("K");
|
|
5059
5081
|
|
|
5060
5082
|
/**
|
|
5061
|
-
*
|
|
5062
|
-
*
|
|
5063
|
-
*
|
|
5083
|
+
* The palette's engine, from @enigmax/primitives: subsequence ranking (so "qgate"
|
|
5084
|
+
* finds "Quality gate" and "plyg" finds "Playground"), the debounce and the
|
|
5085
|
+
* cancellation. The scorer this replaced is the one the package now ships, so the
|
|
5086
|
+
* dashboard and every other consumer rank the same way.
|
|
5064
5087
|
*/
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
score += 10 + run * 6 + (wordStart ? 8 : 0) - Math.min(at - from, 6);
|
|
5075
|
-
from = at + 1;
|
|
5088
|
+
const palRecents = createRecentStore({ key: "enigma:dashboard:palette", limit: 5 });
|
|
5089
|
+
const palSearch = createSearch({
|
|
5090
|
+
keys: ["name", "kind"],
|
|
5091
|
+
matcher: subsequenceMatcher(["name", "kind"]),
|
|
5092
|
+
debounce: 0,
|
|
5093
|
+
onResults: (matches) => {
|
|
5094
|
+
palItems = matches.map((match) => match.item);
|
|
5095
|
+
palSel = 0;
|
|
5096
|
+
palPaint();
|
|
5076
5097
|
}
|
|
5077
|
-
|
|
5078
|
-
}
|
|
5098
|
+
});
|
|
5079
5099
|
|
|
5080
5100
|
/** Built from the live DOM on every open, so it can never drift from the rail or the scopes. */
|
|
5081
5101
|
function palIndex() {
|
|
@@ -5105,36 +5125,59 @@ export {
|
|
|
5105
5125
|
|
|
5106
5126
|
function palRender(query) {
|
|
5107
5127
|
const q = query.trim();
|
|
5108
|
-
const
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
.
|
|
5113
|
-
|
|
5114
|
-
|
|
5128
|
+
const index = palIndex();
|
|
5129
|
+
palSearch.setItems(index);
|
|
5130
|
+
if (!q) {
|
|
5131
|
+
// An empty query opens on what was run before, which is the shortcut on the
|
|
5132
|
+
// second visit. Anything no longer in the index is dropped rather than shown
|
|
5133
|
+
// as a row that goes nowhere.
|
|
5134
|
+
const remembered = palRecents.list()
|
|
5135
|
+
.map((entry) => index.find((item) => item.kind + "::" + item.name === entry.term))
|
|
5136
|
+
.filter(Boolean)
|
|
5137
|
+
.map((item) => ({ ...item, kind: "Recent" }));
|
|
5138
|
+
palItems = remembered.concat(index);
|
|
5139
|
+
palSel = 0;
|
|
5140
|
+
palPaint();
|
|
5141
|
+
return;
|
|
5142
|
+
}
|
|
5143
|
+
palSearch.searchNow(q);
|
|
5144
|
+
}
|
|
5145
|
+
|
|
5146
|
+
/** Draws whatever is in `palItems`, grouped. The selection is applied by palMove. */
|
|
5147
|
+
function palPaint() {
|
|
5115
5148
|
if (!palItems.length) {
|
|
5116
|
-
palList.innerHTML = '<div class="pal-empty">No view or project matches "' + esc(
|
|
5149
|
+
palList.innerHTML = '<div class="pal-empty">No view or project matches "' + esc(shortenQuery(palInput.value)) + '".</div>';
|
|
5117
5150
|
palInput.removeAttribute("aria-activedescendant");
|
|
5118
5151
|
return;
|
|
5119
5152
|
}
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
+
|
|
5128
|
-
+
|
|
5129
|
-
|
|
5130
|
-
|
|
5153
|
+
// Grouped for the headings, but each row carries its FLAT index, so the arrows
|
|
5154
|
+
// run straight through a group boundary.
|
|
5155
|
+
const heading = (kind) => (kind === "View" ? "Views" : kind === "Recent" ? "Recent" : "Switch scope");
|
|
5156
|
+
palList.innerHTML = groupRows(palItems, (item) => item.kind).map((group) => (
|
|
5157
|
+
'<div class="pal-gt">' + esc(heading(group.label)) + "</div>"
|
|
5158
|
+
+ group.rows.map(({ row, position }) =>
|
|
5159
|
+
'<div class="pal-row" role="option" id="pal-o' + position + '"'
|
|
5160
|
+
+ ' aria-selected="false" data-i="' + position + '">'
|
|
5161
|
+
+ row.icon
|
|
5162
|
+
+ '<span class="pal-name">' + esc(row.name) + "</span>"
|
|
5163
|
+
+ (row.group ? '<span class="pal-hint">' + esc(row.group) + "</span>"
|
|
5164
|
+
: (row.hint ? '<span class="pal-hint">' + esc(row.hint) + "</span>" : ""))
|
|
5165
|
+
+ "</div>").join("")
|
|
5166
|
+
)).join("");
|
|
5131
5167
|
palMove(0);
|
|
5132
5168
|
}
|
|
5133
5169
|
|
|
5170
|
+
/**
|
|
5171
|
+
* Where the highlight lands. A key name goes through the package's own arithmetic -
|
|
5172
|
+
* it wraps, which in a short list is what the arrow keys are expected to do - and a
|
|
5173
|
+
* number is the pointer landing on a row directly.
|
|
5174
|
+
*/
|
|
5134
5175
|
function palMove(next) {
|
|
5135
5176
|
if (!palItems.length) return;
|
|
5136
5177
|
const rows = palList.querySelectorAll(".pal-row");
|
|
5137
|
-
palSel =
|
|
5178
|
+
palSel = typeof next === "string"
|
|
5179
|
+
? moveActive(palSel, palItems.length, next)
|
|
5180
|
+
: (next + palItems.length) % palItems.length;
|
|
5138
5181
|
rows.forEach((r, i) => {
|
|
5139
5182
|
const on = i === palSel;
|
|
5140
5183
|
r.classList.toggle("sel", on);
|
|
@@ -5163,6 +5206,7 @@ export {
|
|
|
5163
5206
|
function palRun() {
|
|
5164
5207
|
const it = palItems[palSel];
|
|
5165
5208
|
if (!it) return;
|
|
5209
|
+
palRecents.remember({ term: it.kind + "::" + it.name, label: it.name });
|
|
5166
5210
|
palClose();
|
|
5167
5211
|
setNav(false);
|
|
5168
5212
|
it.run();
|
|
@@ -5175,8 +5219,7 @@ export {
|
|
|
5175
5219
|
palBack.addEventListener("mousedown", (e) => { if (e.target === palBack) palClose(); });
|
|
5176
5220
|
// Focus stays inside: the dialog holds one input and a list driven from it.
|
|
5177
5221
|
palBack.addEventListener("keydown", (e) => {
|
|
5178
|
-
if (e.key === "ArrowDown") { e.preventDefault(); palMove(
|
|
5179
|
-
else if (e.key === "ArrowUp") { e.preventDefault(); palMove(palSel - 1); }
|
|
5222
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End") { e.preventDefault(); palMove(e.key); }
|
|
5180
5223
|
else if (e.key === "Enter") { e.preventDefault(); palRun(); }
|
|
5181
5224
|
// Escape closes the topmost surface only: the drawer behind it stays open.
|
|
5182
5225
|
else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); palClose(); }
|
|
@@ -5184,7 +5227,7 @@ export {
|
|
|
5184
5227
|
});
|
|
5185
5228
|
document.addEventListener("keydown", (e) => {
|
|
5186
5229
|
// Ctrl+K is the browser's own search-bar shortcut, so it has to be taken explicitly.
|
|
5187
|
-
if (
|
|
5230
|
+
if (!isPaletteShortcut(e) || e.altKey) return;
|
|
5188
5231
|
e.preventDefault();
|
|
5189
5232
|
if (palBack.hidden) palOpen(); else palClose();
|
|
5190
5233
|
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* @enigmax/primitives core, vendored by scripts/sync-primitives.mjs. Do not edit. */
|
|
2
|
+
"use strict";var EnigmaPrimitives=(()=>{var Ee=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Dn=Object.getOwnPropertyNames;var Fn=Object.prototype.hasOwnProperty;var Hn=(e,t)=>{for(var n in t)Ee(e,n,{get:t[n],enumerable:!0})},Un=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Dn(t))!Fn.call(e,i)&&i!==n&&Ee(e,i,{get:()=>t[i],enumerable:!(o=Nn(t,i))||o.enumerable});return e};var _n=e=>Un(Ee({},"__esModule",{value:!0}),e);var Fo={};Hn(Fo,{CLIPBOARD_PREFIX:()=>W,CONTEXT_MENU_SEARCH_KEYS:()=>$e,DEFAULT_SELECTION_SHORTCUTS:()=>Ke,FLAG_CDN:()=>De,FLAG_RATIO:()=>Fe,FLIGHT_MS:()=>ge,IDENTITY:()=>Qt,INPUT_ICON_PATHS:()=>J,SEEK_JUMP:()=>ye,SEEK_STEP:()=>be,SELECT_SEARCH_KEYS:()=>pe,SERVER_NETWORK_STATE:()=>ke,SPEEDS:()=>X,TYPEAHEAD_MS:()=>qe,VOLUME_STEP:()=>ve,ZOOM_DOUBLE:()=>tn,ZOOM_LIMITS:()=>he,ZOOM_STEP:()=>en,activeCaption:()=>Cn,bufferedAhead:()=>bn,captionTracks:()=>Tn,clampPan:()=>rn,clampScale:()=>ze,clipboardAction:()=>jt,clipboardEntries:()=>Yt,clipboardHasText:()=>Gt,colorEquals:()=>ut,commandFor:()=>vn,configureFlags:()=>vt,createButton:()=>tt,createContextMenu:()=>zt,createInput:()=>Xe,createMarquee:()=>je,createNetworkMonitor:()=>mt,createNotifications:()=>dt,createRecentStore:()=>It,createSearch:()=>ee,createSelect:()=>qt,createSelection:()=>Xt,dataUrlToBlob:()=>Ze,downloadFile:()=>cn,ensureZone:()=>Re,estimatePasswordStrength:()=>at,filenameFrom:()=>Ve,fittedSize:()=>sn,flagAttributes:()=>Lt,flagConfig:()=>wt,flagName:()=>He,flagSrc:()=>Ue,flagView:()=>_e,flightFrom:()=>fn,flightMs:()=>dn,formatColor:()=>ct,formatTime:()=>pn,fractionAt:()=>hn,fullscreenElement:()=>Ge,generatePassword:()=>st,groupRows:()=>Ot,hslToRgb:()=>Ae,hsvToRgb:()=>Ie,iconMarkup:()=>Q,inspectClipboardTarget:()=>Zt,isAction:()=>V,isApplePlatform:()=>ae,isPaletteShortcut:()=>Rt,isTypingTarget:()=>wn,matchesShortcut:()=>me,moveActive:()=>At,nextIndex:()=>ln,nextSpeed:()=>yn,normalizeDate:()=>Pe,normalizeFlagCode:()=>ie,openInNewTab:()=>un,parseColor:()=>lt,parseDuration:()=>Ne,parseShortcut:()=>fe,performClipboardAction:()=>Wt,pinchDistance:()=>an,prefersReducedMotion:()=>mn,progress:()=>gn,promptRemote:()=>An,recentKey:()=>ne,relativeTimeAttributes:()=>ht,relativeTimeView:()=>gt,resetFlagConfig:()=>St,rgbToHsl:()=>Oe,rgbToHsv:()=>Le,shortcutLabel:()=>kt,shortcutList:()=>le,shortcutText:()=>Ft,shortcutTokens:()=>Be,shortenQuery:()=>et,showCaption:()=>Ln,sourceType:()=>Mn,subsequenceMatcher:()=>Qe,supportsPip:()=>xn,supportsRemote:()=>In,toHex:()=>Ce,toggleFullscreen:()=>Sn,togglePip:()=>En,typeaheadStep:()=>oe,watchRemote:()=>On,wheelFactor:()=>nn,zoomAt:()=>on});var Bn={speed:60,reverse:!1,vertical:!1,draggable:!0,hover:"off",decay:.12,manageStyles:!0,copies:"clone"},qn=24;function je(e,t,n={}){let o={...Bn,...n},i=0,r=Math.max(2,t.children.length),s=0,a=0,l=!1,h=!1,p=!1,b=0,I=0,C=!1,R=null,H=0,D=0,E=0,k=0,O=!1,y=0,T=typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null,w=T?.matches??!1;function f(v){let F=o.hover??"off";return F==="off"?v:F==="pause"?0:typeof F=="number"?v*F:(v<0?-1:1)*Math.abs(F.speed)}function x(){if(w||h)return 0;let v=o.reverse?-o.speed:o.speed;return O?f(v):v}function N(v){return o.vertical?v.offsetHeight:v.offsetWidth}function P(v){return o.vertical?v.offsetTop:v.offsetLeft}function q(){o.manageStyles&&(e.style.overflow="hidden",e.style.touchAction=o.vertical?"pan-x":"pan-y",e.style.userSelect="none",e.style.webkitUserSelect="none",t.style.willChange="transform")}function L(){let v=o.vertical?0:-s,F=o.vertical?-s:0;t.style.transform=`translate3d(${v}px, ${F}px, 0)`}function d(){let v=t.children[0],F=t.children[1];if(!v)return 0;if(F){let B=P(F)-P(v);if(B>0)return B}return N(v)}function m(v){return v<=0?2:Math.min(qn,Math.max(2,Math.ceil(N(e)/v)+1))}function S(v){let F=t.children[0];if(F){for(;t.children.length>v;)t.removeChild(t.lastElementChild);for(;t.children.length<v;){let B=F.cloneNode(!0);B.setAttribute("aria-hidden","true"),B.dataset.enigmaMarqueeCopy=String(t.children.length),t.appendChild(B)}}}function c(){if(p)return;let v=o.copies==="clone";v&&t.children.length<2&&S(2);let F=d(),B=m(F);v&&t.children.length!==B&&(S(B),F=d(),B=m(F));let xe=F!==i||B!==r;i=F,B!==r&&(r=B,o.onCopyCountChange?.(B)),i>0&&(s=u(s)),L(),xe&&o.onMeasure?.(i,r),M()}function u(v){return i<=0?v:(v%i+i)%i}function g(v){if(b=0,p)return;let F=Math.min((v-I)/1e3,.05);if(I=v,C||(a+=(x()-a)*(1-Math.pow(o.decay,F)),s=u(s+a*F)),L(),!C&&Math.abs(a)<.01&&Math.abs(x())<.01){a=0,l=!1;return}b=requestAnimationFrame(g)}function M(){p||l||(l=!0,I=performance.now(),b=requestAnimationFrame(g))}function A(v){return o.vertical?v.clientY:v.clientX}function U(v){v.pointerType!=="mouse"&&ce(),!(!o.draggable||v.button>0||R!==null)&&(R=v.pointerId,C=!0,H=A(v),D=H,E=v.timeStamp,k=0,e.dataset.dragging="true",window.addEventListener("pointermove",_),window.addEventListener("pointerup",K),window.addEventListener("pointercancel",K),M())}function _(v){if(v.pointerId!==R)return;let F=A(v),B=F-H;H=F;let xe=Math.max((v.timeStamp-E)/1e3,.001);E=v.timeStamp,k=Math.max(k,Math.abs(F-D)),s=u(s-B);let Pn=-B/xe;a=a*.6+Pn*(1-.6)}function K(v){v.pointerId===R&&(R=null,C=!1,delete e.dataset.dragging,window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",K),window.removeEventListener("pointercancel",K),v.timeStamp-E>90&&(a=0),M())}function Z(v){k<=6||(v.preventDefault(),v.stopPropagation())}function we(v){k>6||o.onItemClick?.(v)}function re(v){if(v.pointerType!=="mouse"){ce();return}Date.now()-y<1e3||(O=!0,e.dataset.hovering="true",M())}function G(){O=!1,delete e.dataset.hovering,M()}function ce(){y=Date.now(),O&&(O=!1,delete e.dataset.hovering,M())}function Ye(v){w=v.matches,e.dataset.reducedMotion=String(w),M()}let Se=typeof ResizeObserver=="function"?new ResizeObserver(()=>c()):null;function kn(){var F;q(),e.dataset.enigmaMarquee="",e.dataset.reducedMotion=String(w),t.dataset.enigmaMarqueeTrack="";for(let B of Array.from(t.children))(F=B.dataset).enigmaMarqueeCopy??(F.enigmaMarqueeCopy="0");e.addEventListener("pointerdown",U),e.addEventListener("pointerenter",re),e.addEventListener("pointerleave",G),e.addEventListener("touchstart",ce,{passive:!0}),e.addEventListener("click",Z,!0),e.addEventListener("click",we),T?.addEventListener("change",Ye),Se?.observe(e);let v=t.children[0];v&&Se?.observe(v),c(),document.fonts?.ready.then(()=>c()),Rn()}function Rn(){for(let v of t.querySelectorAll("img")){if(v.complete)continue;let F=()=>{v.removeEventListener("load",F),v.removeEventListener("error",F),p||c()};v.addEventListener("load",F),v.addEventListener("error",F)}}return kn(),{get offset(){return s},get period(){return i},get copyCount(){return r},get dragging(){return C},get reducedMotion(){return w},update(v){let F=v.vertical!==void 0||v.manageStyles!==void 0;o={...o,...v},F&&q(),c()},measure:c,pause(){h=!0,M()},resume(){h=!1,M()},destroy(){p=!0,b&&cancelAnimationFrame(b),Se?.disconnect(),T?.removeEventListener("change",Ye),e.removeEventListener("pointerdown",U),e.removeEventListener("pointerenter",re),e.removeEventListener("pointerleave",G),e.removeEventListener("touchstart",ce),e.removeEventListener("click",Z,!0),e.removeEventListener("click",we),window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",K),window.removeEventListener("pointercancel",K)}}}var J={eye:["M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z","M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"],eyeOff:["M10.6 5.2A9.8 9.8 0 0 1 12 5c6.5 0 10 7 10 7a17.6 17.6 0 0 1-3.2 4.2M6.2 6.2A17.7 17.7 0 0 0 2 12s3.5 7 10 7a9.6 9.6 0 0 0 4.2-.9","m2 2 20 20","M9.9 9.9a3 3 0 0 0 4.2 4.2"],generate:["m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9Z","M19 15l.8 2.2 2.2.8-2.2.8-.8 2.2-.8-2.2-2.2-.8 2.2-.8Z"],clear:["m6 6 12 12","m18 6-12 12"],search:["M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14Z","m20 20-4.2-4.2"]};function Q(e){return`<svg viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e.map(n=>`<path d="${n}"/>`).join("")}</svg>`}var $n=Q(J.eye),Kn=Q(J.eyeOff);function We(e,t){return typeof e=="function"?e(t):e}function zn(e,t){typeof t=="string"?e.innerHTML=t:e.replaceChildren(t)}function Xe(e,t={}){let n={...t},o=!1,i=!1,r=null,s=!n.container,a=n.container??document.createElement("span"),l=new Map;function h(){return{input:e,revealed:o,locked:e.disabled||e.readOnly}}function p(){return typeof n.reveal=="object"?n.reveal:{}}function b(){let w=p();return{name:"reveal",label:f=>f.revealed?w.hideLabel??"Hide password":w.showLabel??"Show password",icon:f=>f.revealed?w.hideIcon??Kn:w.showIcon??$n,pressed:f=>f.revealed,onSelect:()=>R(!o)}}function I(){return e.type==="password"||o&&e.dataset.enigmaInputReveal==="on"}function C(){let w=n.actions??[];return[...n.reveal!==!1&&I()&&!w.some(N=>N.name==="reveal")?[b()]:[],...w]}function R(w){if(!I()&&w)return;let f=H();o=w,e.type=w?"text":"password",e.dataset.enigmaInputReveal=w?"on":"off",E(),f&&(D(f),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,!i&&document.activeElement===e&&D(f)},0)),n.onRevealChange?.(w)}function H(){if(document.activeElement!==e)return null;try{let{selectionStart:w,selectionEnd:f}=e;return w===null||f===null?null:[w,f]}catch{return null}}function D(w){try{e.setSelectionRange(w[0],w[1])}catch{}}function E(){if(i)return;let w=H(),f=h(),x=C(),N=new Set;for(let P of x){N.add(P.name);let q=P.visible?P.visible(f):!0,L=l.get(P.name);if(L||(L=document.createElement("button"),L.type="button",L.dataset.enigmaInputAction=P.name,l.set(P.name,L),a.append(L)),!q){L.remove(),l.delete(P.name);continue}L.isConnected||a.append(L);let d=We(P.label,f);L.setAttribute("aria-label",d),L.title=d,L.disabled=f.locked,P.pressed?L.setAttribute("aria-pressed",String(P.pressed(f))):L.removeAttribute("aria-pressed"),zn(L,We(P.icon,f))}for(let[P,q]of[...l])N.has(P)||(q.remove(),l.delete(P));if(a.hidden=l.size===0,w)try{e.setSelectionRange(w[0],w[1])}catch{}}function k(w){w.target?.closest("[data-enigma-input-action]")&&w.preventDefault()}function O(w){let f=w.target?.closest("[data-enigma-input-action]");if(!f)return;let x=C().find(N=>N.name===f.dataset.enigmaInputAction);x&&(w.preventDefault(),x.onSelect(h()))}let y=typeof MutationObserver=="function"?new MutationObserver(()=>{!I()&&o&&(o=!1),E()}):null;function T(){e.dataset.enigmaInput="",a.dataset.enigmaInputActions="",a.dataset.position=n.position??"end",s&&!a.isConnected&&((n.position??"end")==="start"?e.before(a):e.after(a)),a.addEventListener("mousedown",k),a.addEventListener("click",O),y?.observe(e,{attributes:!0,attributeFilter:["type","disabled","readonly"]}),E()}return T(),{get revealed(){return o},reveal(w){R(w??!o)},refresh:E,update(w){let f=w.position!==void 0&&w.position!==n.position;n={...n,...w},f&&s&&(a.dataset.position=n.position??"end",n.position==="start"?e.before(a):e.after(a)),E()},destroy(){i=!0,r!==null&&clearTimeout(r),y?.disconnect(),a.removeEventListener("mousedown",k),a.removeEventListener("click",O);for(let w of l.values())w.remove();l.clear(),s&&a.remove(),delete e.dataset.enigmaInput,delete e.dataset.enigmaInputReveal,o&&(e.type="password")}}}function ue(e){return e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase()}function Je(e,t){let n=e;for(let o of t.split(".")){if(n==null||typeof n!="object")return"";n=n[o]}return n==null?"":String(n)}function Vn(e,t,n){let o=ue(e),i=[];for(let r of t){let s=n.length?n:[""],a=null;for(let l=0;l<s.length;l++){let h=s[l],p=ue(h?Je(r,h):String(r)),b=p.indexOf(o);if(b<0)continue;let I=p===o?0:(b+1)/(p.length+1)+l*.01;(!a||I<a.score)&&(a={item:r,score:I,key:h||void 0})}a&&i.push(a)}return i.sort((r,s)=>r.score-s.score)}function Qe(e=[]){return(t,n)=>{let o=ue(t),i=[];for(let r of n){let s=e.length?e:[""],a=null;for(let l of s){let h=ue(l?Je(r,l):String(r)),p=Zn(o,h);if(p<0)continue;let b=-p;(!a||b<a.score)&&(a={item:r,score:b,key:l||void 0})}a&&i.push(a)}return i.sort((r,s)=>r.score-s.score)}}function Zn(e,t){if(!e)return 0;let n=0,o=0,i=0;for(let r=0;r<e.length;r++){let s=t.indexOf(e[r],n);if(s===-1)return-1;i=r>0&&s===n?i+1:0;let a=s===0||/[^a-z0-9]/.test(t[s-1]);o+=10+i*6+(a?8:0)-Math.min(s-n,6),n=s+1}return o}function et(e,t=32){let n=e.trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}\u2026`}function ee(e={}){let t={...e},n=t.items??[],o="",i=[],r=null,s=null,a=!1,l=new Set;function h(){s=null,!(t.matcher||!t.fuse)&&(s=new t.fuse(n,{keys:t.keys??[],includeScore:!0,includeMatches:!0,threshold:.4,...t.fuseOptions}))}function p(C){let R=C.trim(),H=t.minLength??1,D;return R.length<H?D=(t.empty??"none")==="all"?n.map(E=>({item:E,score:0})):[]:t.matcher?D=t.matcher(R,n):s?D=s.search(R).map(E=>({item:E.item,score:E.score??0,key:E.matches?.[0]?.key})):D=Vn(R,n,t.keys??[]),t.limit!=null?D.slice(0,t.limit):D}function b(C){o=C,i=p(C),t.onResults?.(i,o);for(let R of l)R(i,o);return i}function I(){r!==null&&(clearTimeout(r),r=null)}return h(),{get query(){return o},get results(){return i},search(C){if(a)return;I();let R=t.debounce??120;if(R<=0){b(C);return}r=setTimeout(()=>{r=null,b(C)},R)},searchNow(C){return I(),b(C)},setItems(C){n=C,h(),o&&b(o)},update(C){t={...t,...C},C.items&&(n=C.items),h(),o&&b(o)},attach(C){let R=()=>this.search(C.value),H=D=>{D.key!=="Escape"||!C.value||(D.stopPropagation(),C.value="",this.searchNow(""))};return C.addEventListener("input",R),C.addEventListener("keydown",H),C.dataset.enigmaSearch="",C.value&&this.searchNow(C.value),()=>{C.removeEventListener("input",R),C.removeEventListener("keydown",H),delete C.dataset.enigmaSearch}},subscribe(C){return l.add(C),()=>{l.delete(C)}},destroy(){a=!0,I(),l.clear(),s=null}}}function Me(e){if(!e.key||typeof window>"u")return null;try{let t=e.storage==="local"?window.localStorage:window.sessionStorage,n="__enigma_probe__";return t.setItem(n,"1"),t.removeItem(n),t}catch{return null}}function te(e){return e==null?null:typeof e=="number"?{ms:e}:e}function Gn(e){let t=e;if(!t)return!1;let n=t.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"||t.isContentEditable===!0}function tt(e={}){let t={...e},n=!!t.loading,o=0,i=null,r=!1,s=new Set,a=()=>{let E=te(t.cooldown);return E?.key?`enigma:cooldown:${E.key}`:null};function l(){let E=te(t.cooldown);if(!E)return;let k=Me(E),O=a();if(!k||!O)return;let y=Number(k.getItem(O));Number.isFinite(y)&&y>Date.now()&&(o=y)}function h(){return Math.max(0,o-Date.now())}function p(){let E=!!t.disabled,k=h();return{element:t.href?"a":"button",available:!E&&!n&&k===0,loading:n,disabled:E,cooldown:k,shortcut:t.shortcut??null}}function b(){let E=p();t.onChange?.(E);for(let k of s)k(E)}function I(){i!==null&&(clearInterval(i),i=null)}function C(){i!==null||h()===0||(i=setInterval(()=>{if(h()>0){b();return}I(),b()},100))}function R(){let E=te(t.cooldown);if(!E||E.ms<=0)return;o=Date.now()+E.ms;let k=Me(E),O=a();if(k&&O)try{k.setItem(O,String(o))}catch{}C()}async function H(E){if(r||!p().available)return;let k=t.onPress?.(E);if(k instanceof Promise){n=!0,b();try{await k}finally{n=!1,R(),b()}return}R(),b()}function D(E){!t.shortcut||Gn(E.target)||E.ctrlKey||E.metaKey||E.altKey||E.shiftKey||E.key.toLowerCase()===t.shortcut.toLowerCase()&&p().available&&(E.preventDefault(),H(E))}return typeof window<"u"&&(l(),C(),window.addEventListener("keydown",D)),{get state(){return p()},press:H,update(E){let k=JSON.stringify(te(t.cooldown));t={...t,...E},E.loading!==void 0&&(n=!!E.loading),JSON.stringify(te(t.cooldown))!==k&&l(),b()},reset(){o=0,I();let E=te(t.cooldown),k=a();E&&k&&Me(E)?.removeItem(k),b()},subscribe(E){return s.add(E),()=>{s.delete(E)}},destroy(){r=!0,I(),s.clear(),typeof window<"u"&&window.removeEventListener("keydown",D)}}}var Yn="abcdefghijklmnopqrstuvwxyz",jn="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Wn="0123456789",rt="!@#$%^&*()-_=+[]{};:,.?",Xn="Il1O0";function it(e){let t=globalThis.crypto?.getRandomValues?.bind(globalThis.crypto);if(!t)throw new Error("Generating a password needs crypto.getRandomValues, which browsers only expose over HTTPS (or on localhost).");let n=Math.floor(2**32/e)*e,o=new Uint32Array(1),i;do t(o),i=o[0];while(i>=n);return i%e}function nt(e){return e[it(e.length)]}function Jn(e){let{lowercase:t=!0,uppercase:n=!0,digits:o=!0,symbols:i=!0,excludeAmbiguous:r=!1,exclude:s=""}=e,a=new Set([...r?Xn:"",...s]),l=h=>[...h].filter(p=>!a.has(p)).join("");return[t?l(Yn):"",n?l(jn):"",o?l(Wn):"",i?l(rt):""].filter(Boolean)}function Qn(e){for(let t=e.length-1;t>0;t--){let n=it(t+1);[e[t],e[n]]=[e[n],e[t]]}return e}function st(e={}){let{length:t=20,requireEachClass:n=!0}=e,o=Jn(e);if(!o.length)throw new Error("generatePassword: every character class was excluded.");if(t<1)throw new Error("generatePassword: length must be at least 1.");if(n&&t<o.length)throw new Error(`generatePassword: length ${t} cannot hold one character from each of the ${o.length} classes requested.`);let i=o.join(""),r=n?o.map(nt):[],s=Array.from({length:t-r.length},()=>nt(i));return Qn([...r,...s]).join("")}var ot=new Set(["password","passwd","123456","12345678","123456789","1234567890","qwerty","qwertyuiop","abc123","111111","123123","admin","letmein","welcome","monkey","dragon","sunshine","iloveyou","princess","football","baseball","master","shadow","superman","batman","trustno1","hello","freedom","whatever","starwars","changeme","secret","login","root","toor","test","guest","azerty","1q2w3e4r","zaq12wsx"]),eo=["abcdefghijklmnopqrstuvwxyz","0123456789","qwertyuiop","asdfghjkl","zxcvbnm"];function Te(e){let t=0;return/[a-z]/.test(e)&&(t+=26),/[A-Z]/.test(e)&&(t+=26),/\d/.test(e)&&(t+=10),/[^\w\s]|_/.test(e)&&(t+=rt.length),/\s/.test(e)&&(t+=1),t||1}function to(e){let t=1,n=1;for(let o=1;o<e.length;o++)n=e[o]===e[o-1]?n+1:1,t=Math.max(t,n);return t}function no(e){let t=e.toLowerCase(),n=0;for(let o of eo){let i=[...o].reverse().join("");for(let r of[o,i])for(let s=0;s<r.length;s++)for(let a=r.length;a>s+n;a--)if(t.includes(r.slice(s,a))){n=Math.max(n,a-s);break}}return n}function oo(e){return e.toLowerCase().replace(/^[^a-z]+/,"").replace(/[^a-z]+$/,"").replace(/[0!@$]/g,t=>({0:"o","!":"i","@":"a",$:"s"})[t]??t)}function at(e,t={}){if(!e)return{score:0,bits:0,warnings:[],empty:!0};let n=[],o=e.length*Math.log2(Te(e)),i=oo(e);(ot.has(e.toLowerCase())||ot.has(i))&&(o=Math.min(o,8),n.push("This is one of the most common passwords there is."));for(let l of t.userInputs??[]){let h=l.trim().toLowerCase();if(!(h.length<4||!e.toLowerCase().includes(h))){o=Math.min(o,16),n.push("It contains something you already typed on this form.");break}}let r=to(e);r>=3&&(o-=(r-2)*Math.log2(Te(e)),n.push("A character repeats several times in a row."));let s=no(e);return s>=4&&(o-=s*Math.log2(Te(e))*.75,n.push("Part of it runs straight along the keyboard or the alphabet.")),e.length<8&&n.push("Short passwords fall to a brute force whatever they contain."),o=Math.max(0,Math.round(o)),{score:o<28?0:o<40?1:o<60?2:o<80?3:4,bits:o,warnings:n,empty:!1}}function z(e,t,n){return e<t?t:e>n?n:e}function Y(e){return Number.isFinite(e)?z(e,0,1):1}function $(e){return Math.round(z(e,0,255))}function de(e,t){let n=e.trim(),o=Number.parseFloat(n);return Number.isFinite(o)?n.endsWith("%")?o/100*t:o:Number.NaN}function ro(e){return e.split(/[\s,/]+/).map(t=>t.trim()).filter(Boolean)}function lt(e){let t=e.trim().toLowerCase();if(!t)return null;if(t==="transparent")return{r:0,g:0,b:0,a:0};let n=/^#?([0-9a-f]+)$/.exec(t);if(n)return io(n[1]);let o=/^(rgba?|hsla?)\(([^)]*)\)$/.exec(t);if(!o)return null;let i=ro(o[2]);if(i.length<3||i.length>4)return null;let r=i.length===4?Y(de(i[3],1)):1;if(o[1].startsWith("rgb")){let h=i.slice(0,3).map(p=>de(p,255));return h.some(p=>!Number.isFinite(p))?null:{r:$(h[0]),g:$(h[1]),b:$(h[2]),a:r}}let s=Number.parseFloat(i[0]),a=de(i[1],1),l=de(i[2],1);return!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(l)?null:Ae({h:s,s:z(a,0,1),l:z(l,0,1),a:r})}function io(e){let t=e.length;if(t!==3&&t!==4&&t!==6&&t!==8)return null;let n=t<=4,o=r=>{let s=n?e[r].repeat(2):e.slice(r*2,r*2+2);return Number.parseInt(s,16)},i=t===4||t===8?o(3)/255:1;return{r:o(0),g:o(1),b:o(2),a:Y(i)}}function Ce(e,t={}){let n=r=>$(r).toString(16).padStart(2,"0"),o=Y(e.a),i=t.alpha&&o<1?n(Math.round(o*255)):"";return`#${n(e.r)}${n(e.g)}${n(e.b)}${i}`}function ct(e,t="hex",n={}){let o=Y(e.a),i=!n.alpha||o>=1,r=Number.parseFloat(o.toFixed(3));if(t==="hex")return Ce(e,n);if(t==="rgb"){let l=`${$(e.r)}, ${$(e.g)}, ${$(e.b)}`;return i?`rgb(${l})`:`rgba(${l}, ${r})`}let s=Oe(e),a=`${Math.round(s.h)}, ${Math.round(s.s*100)}%, ${Math.round(s.l*100)}%`;return i?`hsl(${a})`:`hsla(${a}, ${r})`}function Le(e,t=0){let n=z(e.r,0,255)/255,o=z(e.g,0,255)/255,i=z(e.b,0,255)/255,r=Math.max(n,o,i),s=r-Math.min(n,o,i),a=t;return s>0&&(r===n?a=(o-i)/s%6:r===o?a=(i-n)/s+2:a=(n-o)/s+4,a*=60,a<0&&(a+=360)),{h:a,s:r===0?0:s/r,v:r,a:Y(e.a)}}function Ie(e){let t=(e.h%360+360)%360,n=z(e.s,0,1),o=z(e.v,0,1),i=o*n,r=i*(1-Math.abs(t/60%2-1)),s=o-i,[a,l,h]=t<60?[i,r,0]:t<120?[r,i,0]:t<180?[0,i,r]:t<240?[0,r,i]:t<300?[r,0,i]:[i,0,r];return{r:$((a+s)*255),g:$((l+s)*255),b:$((h+s)*255),a:Y(e.a)}}function Oe(e,t=0){let n=Le(e,t),o=n.v*(1-n.s/2),i=o===0||o===1?0:(n.v-o)/Math.min(o,1-o);return{h:n.h,s:z(i,0,1),l:o,a:n.a}}function Ae(e){let t=z(e.s,0,1),n=z(e.l,0,1),o=n+t*Math.min(n,1-n);return Ie({h:e.h,s:o===0?0:2*(1-n/o),v:o,a:e.a})}function ut(e,t){return!e||!t?e===t:$(e.r)===$(t.r)&&$(e.g)===$(t.g)&&$(e.b)===$(t.b)&&Math.round(Y(e.a)*255)===Math.round(Y(t.a)*255)}function dt(e={}){let t=typeof document>"u"?null:document,n=e.max??4,o=e.duration??5e3,i=new Set([...e.stickyTones??["error"],"loading"]),r=[],s=!1,a=0,l=new Set,h=new Map;function p(){let y=Object.freeze([...r]);for(let T of l)T(y)}function b(y){let T=h.get(y);T?.handle&&clearTimeout(T.handle),h.delete(y)}function I(y,T){if(!Number.isFinite(T)||T<=0)return;let w=s?null:setTimeout(()=>C(y),T);h.set(y,{handle:w,remaining:T,startedAt:Date.now()})}function C(y){let T=r.filter(w=>w.id!==y);T.length!==r.length&&(r=T,b(y),p())}function R(y){let T=y.tone??"info",w=y.duration??(i.has(T)?1/0:o),f=y.key?r.find(P=>P.key===y.key):void 0,x=f?.id??`n${++a}`,N={id:x,key:y.key,title:y.title,body:y.body,tone:T,duration:w,action:y.action,data:y.data,createdAt:Date.now()};if(r=f?r.map(P=>P.id===x?N:P):[...r,N],r.length>n){let P=r.find(q=>Number.isFinite(q.duration)&&q.id!==x);P?(r=r.filter(q=>q.id!==P.id),b(P.id)):r=r.slice(r.length-n)}return b(x),I(x,w),p(),x}let H=()=>{t&&(t.hidden?O.pause():O.resume())};function D(y,T){let w=r.find(N=>N.id===y);if(!w)return;let f=T.tone??w.tone,x=T.duration??(T.tone?i.has(f)?1/0:o:w.duration);r=r.map(N=>N.id===y?{...w,...T,tone:f,duration:x}:N),b(y),I(y,x),p()}function E(y,T){let w=typeof y=="function"?y(T):y;return typeof w=="string"?{title:w}:w}async function k(y,T){let w=typeof T.loading=="string"?{title:T.loading}:T.loading,f=w.key??`p${++a}`;R({...w,key:f,tone:"loading"});try{let x=await y;return R({...E(T.success,x),key:f,tone:"success"}),x}catch(x){throw R({...E(T.error,x),key:f,tone:"error"}),x}}let O={get items(){return Object.freeze([...r])},notify:R,update:D,promise:k,dismiss:C,dismissAll(){for(let y of r)b(y.id);r=[],p()},pause(){if(!s){s=!0;for(let[y,T]of h)T.handle&&(clearTimeout(T.handle),h.set(y,{handle:null,remaining:Math.max(T.remaining-(Date.now()-T.startedAt),0),startedAt:Date.now()}))}},resume(){if(s){s=!1;for(let[y,T]of[...h])b(y),I(y,T.remaining)}},subscribe(y){return l.add(y),()=>{l.delete(y)}},destroy(){for(let y of r)b(y.id);r=[],l.clear(),t?.removeEventListener("visibilitychange",H)}};return t?.addEventListener("visibilitychange",H),O}var ke={online:!0,downlink:null,downlinkMax:null,effectiveType:null,rtt:null,saveData:null,type:null,recovered:!1,slow:!1};function ft(){if(typeof navigator>"u")return null;let e=navigator;return e.connection??e.mozConnection??e.webkitConnection??null}function so(e,t){for(let n of Object.keys(e))if(e[n]!==t[n])return!1;return!0}function mt(){if(typeof window>"u")return{get state(){return ke},subscribe(){return()=>{}},destroy(){}};let e=new Set,t=!1,n=o();function o(){let s=ft(),a=navigator.onLine,l=s?.effectiveType??null,h=s?.saveData??null;return{online:a,downlink:s?.downlink??null,downlinkMax:s?.downlinkMax??null,effectiveType:l,rtt:s?.rtt??null,saveData:h,type:s?.type??null,recovered:a&&t,slow:h===!0||l==="2g"||l==="slow-2g"}}function i(){navigator.onLine||(t=!0);let s=o();if(!so(n,s)){n=s;for(let a of e)a(n)}}let r=ft();return window.addEventListener("online",i,{passive:!0}),window.addEventListener("offline",i,{passive:!0}),r?.addEventListener("change",i,{passive:!0}),{get state(){return n},subscribe(s){return e.add(s),()=>{e.delete(s)}},destroy(){e.clear(),window.removeEventListener("online",i),window.removeEventListener("offline",i),r?.removeEventListener("change",i)}}}var ao=/([zZ]|[+-]\d{2}:?\d{2})$/,lo=/^\d{4}-\d{2}-\d{2}$/,co=/\d{2}:\d{2}/,uo=/^([+-])?P(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/;function Re(e){let t=e.trim();if(!t||lo.test(t)||ao.test(t))return t;let n=t.replace(" ","T");return co.test(n)?`${n}Z`:n}function Pe(e){if(e==null)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number")return Number.isFinite(e)?new Date(e):null;let t=new Date(Re(e));return Number.isNaN(t.getTime())?null:t}function Ne(e){let t=uo.exec(e.trim());if(!t)return 0;let[,n,o,i,r,s,a,l,h]=t,p=I=>I?Number(I):0,b=p(o)*31536e6+p(i)*2592e6+p(r)*6048e5+p(s)*864e5+p(a)*36e5+p(l)*6e4+p(h)*1e3;return n==="-"?-b:b}function fo(e){let{second:t,minute:n,hour:o,weekday:i,day:r,month:s,year:a,timeZone:l,timeZoneName:h}=e,p={timeZone:l,timeZoneName:h,second:t,minute:n,hour:o,weekday:i,day:r,month:s,year:a};for(let b of Object.keys(p))p[b]===void 0&&delete p[b];return p}function pt(e,t,n){try{return new Intl.DateTimeFormat(t,n).format(e)}catch{return e.toISOString()}}function gt(e,t={},n=new Date){let o=Pe(e);if(!o)return{date:null,iso:"",label:"",exact:"",beyondThreshold:!1,absoluteOnly:!1};let{locale:i,threshold:r="P30D",prefix:s="on",numericBeyondThreshold:a=!1}=t,h=Math.abs(o.getTime()-n.getTime())>Ne(r),p=a&&h,b=p?{day:"numeric",month:"numeric",year:"numeric",timeZone:t.timeZone}:{day:"numeric",month:"short",year:"numeric",...fo(t)},I=pt(o,i,b);return{date:o,iso:o.toISOString(),label:!p&&s?`${s} ${I}`:I,exact:pt(o,i,{dateStyle:"full",timeStyle:"long",timeZone:t.timeZone}),beyondThreshold:h,absoluteOnly:p}}function ht(e,t={}){let n={datetime:e.iso,format:t.format,tense:t.tense,precision:t.precision,threshold:t.threshold,prefix:t.prefix,"format-style":t.formatStyle,second:t.second,minute:t.minute,hour:t.hour,weekday:t.weekday,day:t.day,month:t.month,year:t.year,lang:t.locale,"time-zone":t.timeZone,"time-zone-name":t.timeZoneName,"no-title":t.noTitle?"":void 0},o={};for(let[i,r]of Object.entries(n))r!==void 0&&(o[i]=r);return o}var De="https://cdn.jsdelivr.net/gh/FJRG2007/enigma@main/assets/flags",yt={shape:"rect",format:"svg",source:"cdn",basePath:"/flags",size:16},j={...yt};function vt(e){return j={...j,...e},j}function wt(){return j}function St(){return j={...yt},j}var Fe={rect:4/3,square:1,circle:1},mo=/^[\u{1F1E6}-\u{1F1FF}]{2}$/u,po=/^([A-Za-z]{2,3})[-_]([A-Z]{2})$/,go=/^[a-z]{2,}[-_][a-z0-9_-]+$/,xt=/^[a-z]{2}$/;function Et(e){return e.normalize("NFD").replace(/\p{Diacritic}/gu,"").replace(/['‘’ʼ`´]/g,"").toLowerCase().replace(/&/g," and ").replace(/\bst\.?\s/g,"saint ").replace(/^the\s+/,"").replace(/[.,]/g,"").replace(/\s+/g," ").trim()}var bt=new Map;function Mt(e){try{return new Intl.Locale(`und-${e}`).region?.toLowerCase()??e.toLowerCase()}catch{return e.toLowerCase()}}function Tt(e){return e.of("ZZ")}function ho(e){let t=bt.get(e);if(t!==void 0)return t;let n=null;try{let o=new Intl.DisplayNames([e],{type:"region"}),i=Tt(o);n=new Map;for(let r=65;r<=90;r++)for(let s=65;s<=90;s++){let a=String.fromCharCode(r,s),l=o.of(a);if(!l||l===a||l===i)continue;let h=Et(l);n.has(h)||n.set(h,Mt(a))}}catch{n=null}return bt.set(e,n),n}function bo(e){try{let t=new Intl.DisplayNames(["en"],{type:"region"}),n=e.toUpperCase(),o=t.of(n);return!!o&&o!==n&&o!==Tt(t)}catch{return!0}}function ie(e,t){if(!e)return null;let n=e.trim();if(!n)return null;if(mo.test(n))return[...n].map(a=>String.fromCharCode((a.codePointAt(0)??0)-127462+97)).join("");let o=po.exec(n);if(o)return o[2].toLowerCase();let i=n.toLowerCase();if(xt.test(i))return bo(i)?Mt(i):null;if(go.test(i))return i;let r=Et(n);for(let s of[t,Ct(),"en",yo()]){if(!s)continue;let a=ho(s)?.get(r);if(a)return a}return null}function He(e,t){let n=ie(e);if(!n||!xt.test(n))return null;let o=n.toUpperCase();try{let r=new Intl.DisplayNames([t??Ct()??"en"],{type:"region"}).of(o);return!r||r===o?null:r}catch{return null}}function yo(){try{return Intl.DateTimeFormat().resolvedOptions().locale}catch{return}}function Ct(){if(!(typeof document>"u"))return document.documentElement.lang||void 0}var vo=!1;function Ue(e,t={}){let n={...j,...t},o=ie(e);if(!o)return null;let i=n.source==="cdn",r=n.format;return i&&r!=="svg"&&(!vo&&typeof process<"u",r="svg"),`${i?De:(n.source==="local"?n.basePath:n.source).replace(/\/+$/,"")}/${n.shape}/${o}.${r}`}function _e(e,t={}){let n={...j,...t},o=ie(e),i=Ue(o,t);if(!o||!i)return null;let r=Math.max(1,Math.round(n.size));return{code:o,src:i,shape:n.shape,format:n.source==="cdn"?"svg":n.format,width:Math.round(r*Fe[n.shape]),height:r,name:He(o,n.locale)}}function Lt(e,t={}){let n=_e(e,t);if(!n)return null;let o=t.decorative?"":t.label?.trim()||n.name||"";return{src:n.src,alt:o,width:n.width,height:n.height,loading:"lazy",decoding:"async","data-enigma-flag":"","data-flag-code":n.code,"data-flag-shape":n.shape,...o?{title:o}:{"aria-hidden":"true"}}}function ne(e){return`${e.scope??""}\0${e.href??""}\0${e.href?"":e.term.trim().toLowerCase()}`}function It(e={}){let{key:t="enigma:palette:recent",limit:n=8,storage:o="local"}=e;function i(){if(typeof window>"u")return null;try{return o==="session"?window.sessionStorage:window.localStorage}catch{return null}}function r(){let a=i();if(!a)return[];try{let l=a.getItem(t);if(!l)return[];let h=JSON.parse(l);return Array.isArray(h)?h.filter(p=>!!p&&typeof p.term=="string").sort((p,b)=>b.at-p.at).slice(0,n):[]}catch{return[]}}function s(a){let l=i(),h=a.slice(0,n);try{l?.setItem(t,JSON.stringify(h))}catch{}return h}return{list:r,remember(a){let l={...a,at:a.at??Date.now()};if(!l.term.trim()&&!l.href)return r();let h=ne(l);return s([l,...r().filter(p=>ne(p)!==h)])},forget(a){let l=ne(a);return s(r().filter(h=>ne(h)!==l))},clear(){let a=i();try{a?.removeItem(t)}catch{}}}}function Ot(e,t){let n=[],o=new Map;return e.forEach((i,r)=>{let s=t(i),a=o.get(s);a||(a={label:s,rows:[]},o.set(s,a),n.push(a)),a.rows.push({row:i,position:r})}),n}function At(e,t,n,o=5){if(t<=0)return 0;switch(n){case"ArrowDown":return(e+1)%t;case"ArrowUp":return(e-1+t)%t;case"Home":return 0;case"End":return t-1;case"PageDown":return Math.min(t-1,e+o);case"PageUp":return Math.max(0,e-o)}}function kt(e="K"){return`${typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||"")?"\u2318":"Ctrl"} ${e.toUpperCase()}`}function Rt(e,t="k"){return e.key.toLowerCase()!==t.toLowerCase()?!1:e.metaKey||e.ctrlKey}var Pt=new Set(["mod","ctrl","control","meta","cmd","command","super","win","shift","alt","option","opt"]),wo={esc:"escape",escape:"escape",del:"delete",delete:"delete",back:"backspace",backspace:"backspace",enter:"enter",return:"enter",space:" ",spacebar:" ",tab:"tab",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",arrowup:"arrowup",arrowdown:"arrowdown",arrowleft:"arrowleft",arrowright:"arrowright",home:"home",end:"end",pageup:"pageup",pagedown:"pagedown",plus:"+"};function ae(){if(typeof navigator>"u")return!1;let e=navigator.platform||navigator.userAgent||"";return/mac|iphone|ipad|ipod/i.test(e)}function fe(e){if(typeof e!="string")return{...e,key:se(e.key)};let t={key:""},n=e.split(/[+-](?!$)/).map(o=>o.trim()).filter(Boolean);return n.length===0?{key:se(e.trim())}:(n.forEach((o,i)=>{let r=o.toLowerCase(),s=i===n.length-1;if(!s&&Pt.has(r)){Nt(t,r);return}if(s&&Pt.has(r)&&n.length>1){Nt(t,r);return}t.key=se(o)}),t.key||(t.key=se(n[n.length-1])),t)}function Nt(e,t){t==="mod"?e.mod=!0:t==="ctrl"||t==="control"?e.ctrl=!0:t==="meta"||t==="cmd"||t==="command"||t==="super"||t==="win"?e.meta=!0:t==="shift"?e.shift=!0:e.alt=!0}function se(e){let t=e.toLowerCase();return wo[t]??t}function le(e){return e===!1||e==null?[]:(Array.isArray(e)?e:[e]).map(fe)}function me(e,t,n=ae()){return le(t).some(o=>So(e,o,n))}function So(e,t,n){let o=se(e.key),i=!!(t.ctrl||t.mod&&!n),r=!!(t.meta||t.mod&&n);return o===t.key&&!!e.ctrlKey===i&&!!e.metaKey===r&&!!e.shiftKey==!!t.shift&&!!e.altKey==!!t.alt}function Be(e,t=ae()){let n=fe(e),o=[];return(n.ctrl||n.mod&&!t)&&o.push(t?"\u2303":"Ctrl"),n.alt&&o.push(t?"\u2325":"Alt"),n.shift&&o.push(t?"\u21E7":"Shift"),(n.meta||n.mod&&t)&&o.push(t?"\u2318":"Win"),o.push(Eo(n.key,t)),o}function Ft(e,t=ae()){return Be(e,t).join(t?"":"+")}var xo={" ":"Space",escape:"Esc",enter:"Enter",backspace:"Backspace",delete:"Del",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",pageup:"PgUp",pagedown:"PgDn"},Dt={delete:"\u2326",backspace:"\u232B",enter:"\u21A9",escape:"esc"};function Eo(e,t){if(t&&Dt[e])return Dt[e];let n=xo[e];return n||(e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1))}var qe=600;function oe(e,t,n=Date.now(),o=qe){let i=n-e.at>o?t:e.typed+t,r=i.length>1&&[...i].every(s=>s===i[0]);return{typed:i,at:n,needle:r?i[0]:i,cycle:i.length===1||r}}var pe=["label","description","group","keywords"],Ht=5;function Ut(e){return e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase()}function _t(e){return e==null?[]:(Array.isArray(e)?[...e]:[e]).filter(n=>n!=="")}function Mo(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}function Bt(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}function To(e,t){return e.open===t.open&&e.query===t.query&&e.active===t.active&&e.multiple===t.multiple&&e.empty===t.empty&&Mo(e.value,t.value)&&Bt(e.visible,t.visible)&&Bt(e.selected,t.selected)}function qt(e={}){let t={...e},n=t.options??[],o=_t(t.value),i=!1,r="",s=-1,a=[...n],l="",h=0,p=!1,b=new Set,I=ee({items:n,keys:t.searchKeys??pe,fuse:t.fuse,fuseOptions:t.fuseOptions,matcher:t.matcher,debounce:0,empty:"all"});function C(f){return n.find(x=>x.value===f)}function R(){return o.map(C).filter(f=>!!f)}function H(){return{open:i,query:r,active:s,visible:a,selected:R(),value:[...o],multiple:!!t.multiple,empty:a.length===0}}function D(){let f=H();t.onChange?.(f);for(let x of b)x(f)}function E(f){let x=a.length;return(f%x+x)%x}function k(f,x){if(a.length===0)return-1;for(let N=0;N<a.length;N++){let P=E(f+x*N);if(!a[P]?.disabled)return P}return-1}let O;function y(){a=t.searchable&&r.trim()?I.searchNow(r).map(x=>x.item):[...n];let f=s>=0?a.findIndex(x=>x===O):-1;s=f>=0&&!a[f]?.disabled?f:k(0,1),O=a[s]}function T(){let f=R();t.onValueChange?.(t.multiple?[...o]:o[0]??"",f)}function w(){return t.closeOnSelect??!t.multiple}return y(),{get state(){return H()},setOpen(f){if(!(p||i===f)){if(i=f,i){r="",y();let x=o[0]?a.findIndex(N=>N.value===o[0]):-1;s=x>=0&&!a[x]?.disabled?x:k(0,1),O=a[s]}else r="",l="",y();D()}},toggleOpen(){this.setOpen(!i)},setQuery(f){p||(r=f,y(),D())},move(f){if(p||a.length===0)return;let x=s<0?-1:s;switch(f){case"ArrowDown":s=k(x+1,1);break;case"ArrowUp":s=k(x-1+a.length,-1);break;case"Home":s=k(0,1);break;case"End":s=k(a.length-1,-1);break;case"PageDown":s=k(Math.min(a.length-1,x+Ht),1);break;case"PageUp":s=k(Math.max(0,x-Ht),-1);break}O=a[s],D()},setActive(f){p||f===s||f<0||f>=a.length||a[f]?.disabled||(s=f,O=a[s],D())},select(f){if(p)return;let x=C(f);!x||x.disabled||(t.multiple?o=o.includes(f)?o.filter(N=>N!==f):[...o,f]:o=[f],T(),w()&&(i=!1,r="",y()),D())},selectActive(){let f=a[s];f&&this.select(f.value)},remove(f){p||!o.includes(f)||(o=o.filter(x=>x!==f),T(),D())},clear(){p||o.length===0||(o=[],T(),D())},typeahead(f){if(p||f.length!==1)return;let x=oe({typed:l,at:h},f);l=x.typed,h=x.at;let N=Ut(x.needle),P=x.cycle?1:0;for(let q=P;q<a.length+P;q++){let L=E(Math.max(s,0)+q),d=a[L];if(!(!d||d.disabled)&&Ut(d.label).startsWith(N)){s=L,O=d,D();return}}},update(f){if(p)return;let x=H(),N=f.options!==void 0;t={...t,...f},N&&(n=f.options??[]),f.value!==void 0&&(o=_t(f.value)),(N||f.searchKeys||f.fuse||f.fuseOptions||f.matcher)&&I.update({items:n,keys:t.searchKeys??pe,fuse:t.fuse,fuseOptions:t.fuseOptions,matcher:t.matcher}),y(),To(x,H())||D()},subscribe(f){return b.add(f),()=>{b.delete(f)}},destroy(){p=!0,b.clear(),I.destroy()}}}function V(e){return(e.type??"item")==="item"}var $e=["label","description","group","keywords"],Co=12,$t=5,Lo=300*1e3;function Kt(e){return e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase()}function zt(e={}){let t={...e},n=t.items??[],o=!1,i=null,r=[],s="",a=0,l=!1,h=new Set,p=new Map,b=new Set,I=new Map;function C(){return t.cacheMs??Lo}function R(c){return c.join("\0")}function H(c,u){let g=(c?c.searchable:t.searchable)??"auto";return g!=="auto"?g:u.filter(V).length>=Co}function D(c){if(!c.searchable||!c.query.trim())return[...c.entries];let u=c.entries.filter(V),g=new Set(E(c,u).searchNow(c.query).map(M=>M.item));return k(c.entries.filter(M=>!V(M)||g.has(M)))}function E(c,u){let g=R(c.path),M=I.get(g);if(M&&M.items.length===u.length&&M.items.every((U,_)=>U===u[_]))return M.engine;M?.engine.destroy();let A=ee({items:u,keys:t.searchKeys??$e,fuse:t.fuse,fuseOptions:t.fuseOptions,matcher:t.matcher,debounce:0,empty:"all"});return I.set(g,{items:u,engine:A}),A}function k(c){let u=[],g=null,M=null;for(let A of c){if(!V(A)){A.type==="separator"?g=A:M=A;continue}g&&u.length>0&&u.push(g),M&&u.push(M),g=null,M=null,u.push(A)}return u}function O(c,u){return(c%u+u)%u}function y(c,u,g){let M=c.visible.length;if(M===0)return-1;for(let A=0;A<M;A++){let U=O(u+g*A,M),_=c.visible[U];if(_&&V(_)&&!_.disabled)return U}return-1}function T(c,u,g,M=!1,A=null){let U={path:c,title:(u?u.title:t.title)??null,entries:[...g],visible:[],active:-1,query:"",searchable:H(u,g),loading:M,error:A};return U.visible=D(U),U}function w(){return{open:o,point:i,levels:r.map(c=>({...c,path:[...c.path],entries:[...c.entries],visible:[...c.visible]}))}}function f(){let c=w();t.onChange?.(c);for(let u of h)u(c)}function x(){return r[r.length-1]}function N(c,u){let g=c?.visible[u];return g&&V(g)?g:null}function P(c){return!!(c.loadItems||c.items&&c.items.some(V))}function q(c){return c.some(V)}function L(c,u,g){let M=r[c],A=N(M,u);if(!A||A.disabled||!P(A))return;let U=[...M.path,A.id],_=R(U),K=r[c+1];if(K&&R(K.path)===_){M.active=u,g&&(b.add(_),K.active<0&&m(c+1)),f();return}if(r=r.slice(0,c+1),M.active=u,g?b.add(_):b.delete(_),A.items){r.push(T(U,A,A.items)),g&&m(r.length-1),f();return}let Z=p.get(_);if(Z?.entries&&(C()<=0?!1:Date.now()-Z.at<C())&&Z?.entries){r.push(T(U,A,Z.entries)),g&&m(r.length-1),f();return}r.push(T(U,A,[],!0)),f();let re=Z?.pending??Promise.resolve().then(()=>A.loadItems());p.set(_,{at:Z?.at??Date.now(),entries:Z?.entries,pending:re}),re.then(G=>{p.set(_,{at:Date.now(),entries:G}),d(_,U,A,G,null)},G=>{p.delete(_),d(_,U,A,[],G instanceof Error?G:new Error(String(G)))})}function d(c,u,g,M,A){if(l)return;let U=r.findIndex(_=>R(_.path)===c);U!==-1&&(r=r.slice(0,U),r.push(T(u,g,M,!1,A)),b.has(c)&&m(U),f())}function m(c){let u=r[c];u&&(u.active=y(u,0,1))}function S(c){let u=c.active>=0?c.visible[c.active]:void 0;c.visible=D(c);let g=u?c.visible.indexOf(u):-1,M=g>=0?c.visible[g]:void 0;c.active=M&&V(M)&&!M.disabled?g:y(c,0,1)}return{get state(){return w()},open(c){if(l||!q(n))return!1;let u=o;return o=!0,i={x:c.x,y:c.y},r=[T([],null,n)],s="",b.clear(),u||t.onOpenChange?.(!0),f(),!0},close(){l||!o||(o=!1,i=null,r=[],s="",b.clear(),t.onOpenChange?.(!1),f())},move(c){if(l)return;let u=x();if(!u||u.visible.length===0)return;let g=u.active<0?-1:u.active;switch(c){case"ArrowDown":u.active=y(u,g+1,1);break;case"ArrowUp":u.active=y(u,g<0?u.visible.length-1:g-1+u.visible.length,-1);break;case"Home":u.active=y(u,0,1);break;case"End":u.active=y(u,u.visible.length-1,-1);break;case"PageDown":u.active=y(u,Math.min(u.visible.length-1,g+$t),1);break;case"PageUp":u.active=y(u,Math.max(0,g-$t),-1);break}f()},setActive(c,u){let g=r[c];if(l||!g||g.active===u||u<0||u>=g.visible.length)return;let M=N(g,u);!M||M.disabled||(g.active=u,f())},setQuery(c,u){let g=r[c];l||!g||(g.query=u,r=r.slice(0,c+1),S(g),f())},openSubmenu(c,u,g=!1){l||L(c,u,g)},closeBelow(c){l||r.length<=c+1||(r=r.slice(0,c+1),f())},select(c,u){if(l)return;let g=r[c],M=N(g,u);if(!M||M.disabled)return;if(P(M)){L(c,u,!0);return}let A=[...g?.path??[],M.id];o=!1,i=null,r=[],s="",b.clear(),t.onOpenChange?.(!1),f(),t.onSelect?.(M,A)},selectActive(){let c=r.length-1,u=r[c];u&&u.active>=0&&this.select(c,u.active)},enterSubmenu(){let c=r.length-1,u=r[c];if(!u||u.active<0)return;let g=N(u,u.active);g&&P(g)&&L(c,u.active,!0)},leaveSubmenu(){l||r.length<=1||(r=r.slice(0,r.length-1),f())},typeahead(c){if(l||c.length!==1)return;let u=x();if(!u||u.visible.length===0)return;let g=oe({typed:s,at:a},c);s=g.typed,a=g.at;let M=Kt(g.needle),A=g.cycle&&u.active>=0?1:0;for(let U=A;U<u.visible.length+A;U++){let _=O(Math.max(u.active,0)+U,u.visible.length),K=u.visible[_];if(!(!K||!V(K)||K.disabled)&&Kt(K.label).startsWith(M)){u.active=_,f();return}}},invalidate(c){if(!c){p.clear();return}p.delete(R(c))},update(c){if(l)return;let u=c.items!==void 0;if(t={...t,...c},u){n=c.items??[];let g=r[0];g&&(g.entries=[...n],g.title=t.title??null,g.searchable=H(null,n),S(g),f())}},subscribe(c){return h.add(c),()=>{h.delete(c)}},destroy(){l=!0,h.clear(),p.clear(),b.clear();for(let c of I.values())c.engine.destroy();I.clear()}}}var W="enigma:clipboard:",Io=new Set(["text","search","url","tel","password"]),Oo={editable:null,writable:!1,selection:"",copyable:!0,range:null};function Ao(e){return!!(e&&e.isContentEditable)}function ko(e){let t=typeof window>"u"?null:window.getSelection();if(!t||t.isCollapsed||t.rangeCount===0)return"";let n=t.getRangeAt(0);return e&&!n.intersectsNode(e)?"":t.toString()}function Zt(e){if(typeof document>"u")return Oo;let t=e instanceof Element?e:null,n=t?.closest?.("input, textarea");if(n){let i=n instanceof HTMLInputElement&&n.type==="password",r=n instanceof HTMLTextAreaElement||Io.has(n.type),s=r?n.selectionStart??0:0,a=r?n.selectionEnd??0:0;return{editable:n,writable:!n.disabled&&!n.readOnly,selection:r?n.value.slice(s,a):"",copyable:!i,range:r?{start:s,end:a}:null}}let o=Ao(t)?t.closest("[contenteditable]")??t:null;return{editable:o,writable:!!o,selection:ko(t),copyable:!0,range:null}}async function Gt(){if(typeof navigator>"u"||!navigator.clipboard?.readText)return null;try{return(await navigator.permissions?.query({name:"clipboard-read"}))?.state!=="granted"?null:(await navigator.clipboard.readText()).length>0}catch{return null}}function Yt(e,t={}){let{copy:n=!0,cut:o=!0,paste:i=!0,labels:r={},icons:s={},clipboardEmpty:a=!1}=t,l=[],h=e.selection.length>0&&e.copyable,p=typeof navigator<"u"&&!!navigator.clipboard?.readText;return n&&h&&l.push({id:`${W}copy`,label:r.copy??"Copy",shortcut:"Mod+C",icon:s.copy}),o&&h&&e.writable&&l.push({id:`${W}cut`,label:r.cut??"Cut",shortcut:"Mod+X",icon:s.cut}),i&&e.writable&&p&&l.push({id:`${W}paste`,label:r.paste??"Paste",shortcut:"Mod+V",icon:s.paste,disabled:a}),l}function jt(e){if(!e.startsWith(W))return null;let t=e.slice(W.length);return t==="copy"||t==="cut"||t==="paste"?t:null}function Ro(e){let t=e.editable;if(!t||(t.focus({preventScroll:!0}),!e.range))return;let n=t;try{n.setSelectionRange(e.range.start,e.range.end)}catch{}}function Po(e,t){let n=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(n,"value")?.set;o?o.call(e,t):e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0}))}function Vt(e,t){let n=e.editable;if(!n)return;try{if(document.execCommand("insertText",!1,t))return}catch{}let o=n;if(typeof o.setSelectionRange!="function"||e.range===null)return;let i=o.selectionStart??e.range.start,r=o.selectionEnd??e.range.end;Po(o,o.value.slice(0,i)+t+o.value.slice(r));let s=i+t.length;try{o.setSelectionRange(s,s)}catch{}}async function Wt(e,t){if(Ro(t),e==="copy"||e==="cut"){if(!t.selection||!t.copyable)return!1;try{await navigator.clipboard.writeText(t.selection)}catch{try{if(!document.execCommand("copy"))return!1}catch{return!1}}return e==="cut"&&t.writable&&Vt(t,""),!0}if(!t.writable)return!1;try{let n=await navigator.clipboard.readText();return n?(Vt(t,n),!0):!1}catch{return!1}}var Ke={selectAll:"Mod+A",clear:"Escape",invert:!1,moveUp:"ArrowUp",moveDown:"ArrowDown",moveLeft:"ArrowLeft",moveRight:"ArrowRight",moveHome:"Home",moveEnd:"End",movePageUp:"PageUp",movePageDown:"PageDown",extendUp:"Shift+ArrowUp",extendDown:"Shift+ArrowDown",extendLeft:"Shift+ArrowLeft",extendRight:"Shift+ArrowRight",extendHome:"Shift+Home",extendEnd:"Shift+End",extendPageUp:"Shift+PageUp",extendPageDown:"Shift+PageDown",cursorUp:"Mod+ArrowUp",cursorDown:"Mod+ArrowDown",toggleCursor:"Mod+Space",open:"Enter",rename:"F2",delete:"Delete",deletePermanent:"Shift+Delete",copy:"Mod+C",cut:"Mod+X",paste:"Mod+V"},No=new Set(["selectAll","clear","invert","moveUp","moveDown","moveLeft","moveRight","moveHome","moveEnd","movePageUp","movePageDown","extendUp","extendDown","extendLeft","extendRight","extendHome","extendEnd","extendPageUp","extendPageDown","cursorUp","cursorDown","toggleCursor"]);function Xt(e={}){let t={...e},n=t.items??[],o=new Set,i=-1,r=-1,s=null,a=null,l=!1,h=new Set;function p(d){let m=n[d];return m===void 0?null:t.getId?t.getId(m,d):String(d)}function b(d){let m=n[d];return m===void 0?!1:!t.disabled?.(m,d)}function I(){return t.multiple??!0}function C(){return Math.max(1,t.columns??1)}function R(){let d=[];for(let m=0;m<n.length;m++){let S=p(m);S!==null&&o.has(S)&&d.push(S)}return d}function H(){let d=[];for(let m=0;m<n.length;m++){let S=p(m);S!==null&&o.has(S)&&d.push(n[m])}return d}function D(){let d=R(),m=0;for(let S=0;S<n.length;S++)b(S)&&m++;return{selected:d,selectedSet:new Set(d),items:H(),cursor:i,anchor:r,count:d.length,allSelected:m>0&&d.length===m,partiallySelected:d.length>0&&d.length<m,marquee:a!==null}}function E(){let d=0;for(let m=0;m<n.length;m++)b(m)&&d++;return`${i}:${r}:${d}:${R().join("\0")}`}let k=[];function O(){let d=D();t.onChange?.(d);for(let S of h)S(d);let m=d.selected;(m.length!==k.length||m.some((S,c)=>S!==k[c]))&&(k=m,t.onSelectionChange?.(m,d.items))}function y(d){o=new Set(d)}function T(d,m){for(let S=d;S>=0&&S<n.length;S+=m)if(b(S))return S;return-1}function w(d,m){let[S,c]=d<m?[d,m]:[m,d],u=[];for(let g=S;g<=c;g++){if(!b(g))continue;let M=p(g);M!==null&&u.push(M)}return u}function f(d,m){let S=r>=0?r:d,c=w(S,d);m?(s=s??new Set(o),y([...s,...c])):(s=null,y(c)),i=d}function x(){return t.shortcuts===!1?{}:{...Ke,...t.shortcuts??{}}}function N(d){let m=x(),S=null;for(let[c,u]of Object.entries(m)){if(u===!1||u==null)continue;let g=le(u).find(A=>me(d,A));if(!g)continue;let M=P(g);(!S||M>S.length)&&(S={command:c,length:M})}return S?.command??null}function P(d){return+!!d.mod+ +!!d.ctrl+ +!!d.meta+ +!!d.shift+ +!!d.alt}function q(d){let m=C(),S=Math.max(1,t.page??10);switch(d){case"selectAll":return L.selectAll(),!0;case"clear":return L.clear(),!0;case"invert":return L.invert(),!0;case"moveUp":return L.moveCursor(-m),!0;case"moveDown":return L.moveCursor(m),!0;case"moveLeft":return L.moveCursor(-1),!0;case"moveRight":return L.moveCursor(1),!0;case"moveHome":return L.moveCursor(-n.length),!0;case"moveEnd":return L.moveCursor(n.length),!0;case"movePageUp":return L.moveCursor(-S*m),!0;case"movePageDown":return L.moveCursor(S*m),!0;case"extendUp":return L.moveCursor(-m,!0),!0;case"extendDown":return L.moveCursor(m,!0),!0;case"extendLeft":return L.moveCursor(-1,!0),!0;case"extendRight":return L.moveCursor(1,!0),!0;case"extendHome":return L.moveCursor(-n.length,!0),!0;case"extendEnd":return L.moveCursor(n.length,!0),!0;case"extendPageUp":return L.moveCursor(-S*m,!0),!0;case"extendPageDown":return L.moveCursor(S*m,!0),!0;case"cursorUp":return L.moveCursor(-m,!1,!0),!0;case"cursorDown":return L.moveCursor(m,!1,!0),!0;case"toggleCursor":return i>=0&&L.toggle(i),!0;default:return!1}}let L={get state(){return D()},click(d,m={}){if(l||!b(d))return;let S=!!(m.ctrlKey||m.metaKey);if(!!m.shiftKey&&I()){f(d,S&&I()),O();return}if(s=null,S&&I()){this.toggle(d);return}let u=p(d);u!==null&&(y([u]),i=d,r=d,O())},keyDown(d){if(l)return!1;let m=N(d);if(!m)return!1;let S=o.size>0?H():i>=0&&n[i]!==void 0?[n[i]]:[],c=o.size>0?R():i>=0?[p(i)].filter(M=>M!==null):[],u=!1,g={command:m,items:S,ids:c,cursor:i>=0?n[i]??null:null,cursorIndex:i,event:d,preventDefault(){u=!0,g.defaultPrevented=!0},defaultPrevented:!1};return t.onCommand?.(g),u||q(m),No.has(m)||t.onCommand!==void 0},select(d){l||(y(d),O())},selectIndex(d,m=!1){if(l||!b(d))return;let S=p(d);S!==null&&(m&&I()?o.add(S):y([S]),i=d,r=d,O())},toggle(d){if(l||!b(d))return;let m=p(d);m!==null&&(I()?o.has(m)?o.delete(m):o.add(m):y([m]),i=d,r=d,O())},selectRange(d,m=!1){l||!b(d)||!I()||(f(d,m),O())},selectAll(){if(l||!I())return;let d=[];for(let m=0;m<n.length;m++){if(!b(m))continue;let S=p(m);S!==null&&d.push(S)}y(d),O()},clear(){l||o.size===0||(o=new Set,s=null,O())},invert(){if(l||!I())return;let d=new Set;for(let m=0;m<n.length;m++){if(!b(m))continue;let S=p(m);S!==null&&!o.has(S)&&d.add(S)}o=d,O()},moveCursor(d,m=!1,S=!1){if(l||n.length===0)return;let c=i>=0?i:r>=0?r:d>0?-1:n.length,u=Math.max(0,Math.min(n.length-1,c+d)),g=d>=0?1:-1,M=T(u,g),A=M>=0?M:T(u,-g);if(A<0)return;if(m&&I()){f(A,!1),O();return}if(i=A,S){O();return}let U=p(A);U!==null&&(y([U]),r=A,s=null,O())},setCursor(d){l||d===i||d<-1||d>=n.length||(i=d,O())},targets(d){let m=p(d),S=n[d];return S===void 0||m!==null&&o.has(m)?H():[S]},beginMarquee(d=!1){l||!I()||(a=d?new Set(o):new Set,!d&&o.size>0&&(o=new Set),O())},marqueeTo(d){if(l||a===null)return;let m=new Set(a);for(let S of d){if(!b(S))continue;let c=p(S);c!==null&&m.add(c)}m.size===o.size&&[...m].every(S=>o.has(S))||(o=m,O())},endMarquee(){l||a===null||(a=null,O())},bindings(){return x()},binding(d){return x()[d]??!1},update(d){if(l)return;let m=E(),S=d.items!==void 0;if(t={...t,...d},S){n=d.items??[];let c=new Set;for(let u=0;u<n.length;u++){let g=p(u);g!==null&&c.add(g)}for(let u of o)c.has(u)||o.delete(u);i>=n.length&&(i=n.length-1),r>=n.length&&(r=n.length-1)}E()!==m&&O()},subscribe(d){return h.add(d),()=>{h.delete(d)}},destroy(){l=!0,h.clear()}};return L}var Qt={scale:1,x:0,y:0},he={min:1,max:8},en=1.35,tn=2.5;function ze(e,t=he){return Math.min(Math.max(e,t.min),t.max)}function nn(e,t=0){let n=t===1?e*16:t===2?e*400:e;return Math.exp(-Math.min(Math.max(n,-240),240)/320)}function on(e,t,n,o,i=he){let r=ze(e.scale*t,i);if(r===e.scale)return e;let s=n.x-(o.left+o.width/2),a=n.y-(o.top+o.height/2),l=r/e.scale;return{scale:r,x:s-(s-e.x)*l,y:a-(a-e.y)*l}}function rn(e,t,n){let o=n.width*e.scale,i=n.height*e.scale,r=Math.max(0,(o-t.width)/2),s=Math.max(0,(i-t.height)/2);return{scale:e.scale,x:Math.min(Math.max(e.x,-r),r),y:Math.min(Math.max(e.y,-s),s)}}function sn(e,t){if(!e.width||!e.height)return{width:t.width,height:t.height};let n=Math.min(t.width/e.width,t.height/e.height,1);return{width:e.width*n,height:e.height*n}}function an(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function ln(e,t,n,o={}){let{loop:i=!0,skip:r}=o;if(t<=0)return-1;let s=e;for(let a=0;a<t;a+=1){if(s+=n,s<0||s>=t){if(!i)return-1;s=(s%t+t)%t}if(!r?.has(s))return s}return-1}function Ve(e,t="image"){try{let{pathname:n}=new URL(e,typeof location>"u"?"https://localhost":location.href),o=n.split("/").filter(Boolean).pop();return o&&o.includes(".")?decodeURIComponent(o):t}catch{return t}}async function cn(e,t){let n=t??Ve(e);try{let o=await fetch(e,{mode:"cors",credentials:"omit"});if(!o.ok)throw new Error(`the file answered ${o.status}`);let i=await o.blob(),r=URL.createObjectURL(i);Jt(r,n),setTimeout(()=>URL.revokeObjectURL(r),1e4)}catch{Jt(e,n,!0)}}function Jt(e,t,n=!1){if(typeof document>"u")return;let o=document.createElement("a");o.href=e,o.download=t,o.rel="noopener",n&&(o.target="_blank"),document.body.append(o),o.click(),o.remove()}function Ze(e){let t=e.indexOf(",");if(!e.startsWith("data:")||t===-1)throw new Error("not a data URL");let n=e.slice(5,t),o=e.slice(t+1),i=n.endsWith(";base64"),r=(i?n.slice(0,-7):n)||"text/plain";if(!i)return new Blob([decodeURIComponent(o)],{type:r});let s=atob(o),a=new Uint8Array(s.length);for(let l=0;l<s.length;l+=1)a[l]=s.charCodeAt(l);return new Blob([a],{type:r})}function un(e){if(!(typeof window>"u")){if(!e.startsWith("data:")){window.open(e,"_blank","noopener,noreferrer");return}try{let t=URL.createObjectURL(Ze(e));window.open(t,"_blank","noopener,noreferrer"),setTimeout(()=>URL.revokeObjectURL(t),6e4)}catch{window.open(e,"_blank","noopener,noreferrer")}}}var ge=300;function dn(e){if(!e||typeof getComputedStyle>"u")return ge;let t=Number.parseFloat(getComputedStyle(e).transitionDuration);return Number.isFinite(t)&&t>0?t*1e3:ge}function fn(e,t){return!e.width||!e.height||!t.width||!t.height?null:{scale:e.width/t.width,x:e.left+e.width/2-(t.left+t.width/2),y:e.top+e.height/2-(t.top+t.height/2)}}function mn(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}var X=[.5,.75,1,1.25,1.5,1.75,2],be=5,ye=10,ve=.05;function pn(e,t=e){(!Number.isFinite(e)||e<0)&&(e=0);let n=Math.floor(e),o=Math.floor(n/3600),i=Math.floor(n%3600/60),r=n%60,s=Number.isFinite(t)&&t>=3600,a=l=>String(l).padStart(2,"0");return s||o>0?`${o}:${a(i)}:${a(r)}`:`${i}:${a(r)}`}function gn(e,t){return!Number.isFinite(t)||t<=0?0:Math.min(Math.max(e/t,0),1)}function hn(e,t){return e.width?Math.min(Math.max((t-e.left)/e.width,0),1):0}function bn(e,t,n){if(!e||!Number.isFinite(n)||n<=0)return 0;for(let o=0;o<e.length;o+=1)if(e.start(o)<=t&&e.end(o)>=t)return Math.min(e.end(o)/n,1);return 0}function yn(e,t=1){let n=X.indexOf(e),o=n===-1?X.indexOf(1):n;return X[(o+t+X.length)%X.length]}function vn(e){return e===" "||e==="k"||e==="K"?{type:"toggle"}:e==="ArrowRight"?{type:"seek",by:be}:e==="ArrowLeft"?{type:"seek",by:-be}:e==="l"||e==="L"?{type:"seek",by:ye}:e==="j"||e==="J"?{type:"seek",by:-ye}:e==="ArrowUp"?{type:"volume",by:ve}:e==="ArrowDown"?{type:"volume",by:-ve}:e==="m"||e==="M"?{type:"mute"}:e==="f"||e==="F"?{type:"fullscreen"}:e==="c"||e==="C"?{type:"captions"}:e==="p"||e==="P"?{type:"pip"}:e>="0"&&e<="9"?{type:"seekTo",fraction:Number(e)/10}:null}function wn(e){let t=e;return!t||typeof t.tagName!="string"?!1:t.isContentEditable?!0:["INPUT","TEXTAREA","SELECT"].includes(t.tagName)}function Ge(){if(typeof document>"u")return null;let e=document;return document.fullscreenElement??e.webkitFullscreenElement??null}async function Sn(e,t){let n=document;if(Ge()){await(document.exitFullscreen?.()??n.webkitExitFullscreen?.());return}let o=e;if(e.requestFullscreen)return void await e.requestFullscreen();if(o.webkitRequestFullscreen)return void await o.webkitRequestFullscreen();t?.webkitEnterFullscreen?.()}function xn(){return typeof document<"u"&&!!document.pictureInPictureEnabled}async function En(e){if(document.pictureInPictureElement)return void await document.exitPictureInPicture();await e.requestPictureInPicture()}var Do={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg",mov:"video/quicktime",mkv:"video/x-matroska",m3u8:"application/vnd.apple.mpegurl",mpd:"application/dash+xml"};function Mn(e){let t=e;try{t=new URL(e,typeof location>"u"?"https://localhost":location.href).pathname}catch{t=e.split("?")[0].split("#")[0]}let n=t.split("/").pop()??"",o=n.lastIndexOf(".");if(!(o<=0))return Do[n.slice(o+1).toLowerCase()]}function Tn(e){if(!e)return[];let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];!o||o.kind!=="subtitles"&&o.kind!=="captions"||t.push({index:n,label:o.label||o.language||`Track ${t.length+1}`,language:o.language})}return t}function Cn(e){if(!e)return-1;for(let t=0;t<e.length;t+=1)if(e[t]?.mode==="showing")return t;return-1}function Ln(e,t){if(e)for(let n=0;n<e.length;n+=1){let o=e[n];o&&(o.mode=n===t?"showing":"disabled")}}function In(e){let t=e;return!t||t.disableRemotePlayback?!1:!!(t.remote?.prompt??t.webkitShowPlaybackTargetPicker)}function On(e,t){let n=e,o={available:!1,connected:!1},i=a=>{Object.assign(o,a),t({...o})};if(n.remote){let a=n.remote,l=()=>i({connected:a.state==="connected"}),h=null,p=!1;a.watchAvailability(b=>{p||i({available:b})}).then(b=>{p?a.cancelWatchAvailability(b).catch(()=>{}):h=b}).catch(()=>{p||i({available:!0})});for(let b of["connect","connecting","disconnect"])a.addEventListener(b,l);return l(),()=>{p=!0;for(let b of["connect","connecting","disconnect"])a.removeEventListener(b,l);h!==null&&a.cancelWatchAvailability(h).catch(()=>{})}}let r=a=>i({available:a.availability==="available"}),s=()=>i({connected:!!n.webkitCurrentPlaybackTargetIsWireless});return n.addEventListener("webkitplaybacktargetavailabilitychanged",r),n.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",s),s(),()=>{n.removeEventListener("webkitplaybacktargetavailabilitychanged",r),n.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",s)}}async function An(e){let t=e;if(t.remote?.prompt)return void await t.remote.prompt();t.webkitShowPlaybackTargetPicker?.()}return _n(Fo);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmax/dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.112",
|
|
4
4
|
"description": "Local browser dashboard UI for enigma: the static page and chart assets enigma serves on its loopback dashboard (savings, real tool usage, in-browser settings). Installed on demand by enigma-cli; not a runtime dependency.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|