@jungherz-de/notionkit-elements 1.17.0 โ†’ 1.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +7 -7
  3. package/SKILL.md +53 -42
  4. package/dist/components/nk-calendar.js +6 -5
  5. package/dist/components/nk-cmdk.js +7 -5
  6. package/dist/components/nk-copy-field.js +33 -5
  7. package/dist/components/nk-dialog.js +5 -5
  8. package/dist/components/nk-menu.js +19 -6
  9. package/dist/components/nk-modal.js +7 -6
  10. package/dist/components/nk-peek.js +5 -4
  11. package/dist/components/nk-pop.js +3 -3
  12. package/dist/components/nk-progress.js +6 -3
  13. package/dist/components/nk-sheet.js +5 -5
  14. package/dist/components/nk-sidebar.js +1 -1
  15. package/dist/components/nk-tab-bar.js +10 -4
  16. package/dist/components/nk-toast.js +107 -11
  17. package/dist/components/nk-tooltip.js +1 -1
  18. package/dist/components/shared/{focus-C4tbSNND.js โ†’ focus-D55JGjRA.js} +7 -1
  19. package/dist/components/shared/layers-D9YYYA5g.js +35 -0
  20. package/dist/notionkit-elements.esm.js +241 -59
  21. package/dist/notionkit-elements.esm.min.js +1 -1
  22. package/dist/notionkit-elements.esm.min.js.map +1 -1
  23. package/dist/notionkit-elements.js +241 -59
  24. package/dist/notionkit-elements.min.js +1 -1
  25. package/package.json +3 -3
  26. package/src/components/content/nk-progress.js +6 -3
  27. package/src/components/forms/nk-calendar.js +5 -4
  28. package/src/components/forms/nk-copy-field.js +33 -5
  29. package/src/components/overlays/nk-cmdk.js +7 -5
  30. package/src/components/overlays/nk-dialog.js +4 -4
  31. package/src/components/overlays/nk-menu.js +19 -6
  32. package/src/components/overlays/nk-modal.js +7 -6
  33. package/src/components/overlays/nk-peek.js +4 -3
  34. package/src/components/overlays/nk-pop.js +3 -3
  35. package/src/components/overlays/nk-sheet.js +4 -4
  36. package/src/components/overlays/nk-toast.js +107 -11
  37. package/src/components/shell/nk-tab-bar.js +10 -4
  38. package/src/util/focus.js +6 -0
  39. package/src/util/layers.js +33 -0
@@ -1,2 +1,2 @@
1
- const t=':root{color-scheme:light;--nk-bg: #ffffff;--nk-bg-sidebar: #f9f8f7;--nk-bg-hover: rgba(55,53,47,.06);--nk-bg-active: rgba(55,53,47,.08);--nk-bg-callout: #f0efed;--nk-bg-code: #f7f6f3;--nk-bg-card: #ffffff;--nk-bg-input: rgba(242,241,238,.6);--nk-text: #2c2c2b;--nk-text-secondary: #7d7a75;--nk-text-tertiary: #91918e;--nk-text-sidebar: #5f5e5b;--nk-border: rgba(28,19,1,.11);--nk-border-strong: rgba(27,21,0,.19);--nk-accent: #2383e2;--nk-on-accent: #ffffff;--nk-danger: #cd3c3a;--nk-tag-gray-bg: #e3e2e0;--nk-tag-gray-text: #32302c;--nk-tag-brown-bg: #eee0da;--nk-tag-brown-text: #442a1e;--nk-tag-orange-bg: #fadec9;--nk-tag-orange-text: #49290e;--nk-tag-yellow-bg: #fdecc8;--nk-tag-yellow-text: #402c1b;--nk-tag-green-bg: #dbeddb;--nk-tag-green-text: #1c3829;--nk-tag-blue-bg: #d3e5ef;--nk-tag-blue-text: #183347;--nk-tag-purple-bg: #e8deee;--nk-tag-purple-text: #412454;--nk-tag-pink-bg: #f5e0e9;--nk-tag-pink-text: #4c2337;--nk-tag-red-bg: #ffe2dd;--nk-tag-red-text: #5d1715;--nk-tint-gray: #f1f1ef;--nk-color-gray: #787774;--nk-tint-brown: #f4eeee;--nk-color-brown: #9f6b53;--nk-tint-orange: #fbecdd;--nk-color-orange: #d9730d;--nk-tint-yellow: #fbf3db;--nk-color-yellow: #cb912f;--nk-tint-green: #edf3ec;--nk-color-green: #448361;--nk-tint-blue: #e7f3f8;--nk-color-blue: #337ea9;--nk-tint-purple: #f8f3fc;--nk-color-purple: #9065b0;--nk-tint-pink: #fcf1f6;--nk-color-pink: #c14c8a;--nk-tint-red: #fdebec;--nk-color-red: #cd3c3a;--nk-decor-purple: #9065b0;--nk-decor-blue: #529cca;--nk-decor-orange: #d9730d;--nk-scrim: rgba(15,15,15,.6);--nk-scrim-soft: rgba(15,15,15,.5);--nk-sidebar-width: 260px;--nk-peek-width: 560px;--nk-page-full-max: none;--nk-cover-height: 200px;--nk-panel-cover-height: 64px;--nk-tab-bar-height: 58px;--nk-radius: 6px;--nk-font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;--nk-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--nk-shadow-menu: rgba(15,15,15,.05) 0px 0px 0px 1px, rgba(15,15,15,.1) 0px 3px 6px, rgba(15,15,15,.2) 0px 9px 24px;--nk-shadow-card: 0 1px 2px rgba(0,0,0,.04);--nk-shadow-btn: inset 0 0 0 1px rgba(15,15,15,.1), 0 1px 2px rgba(15,15,15,.1);--nk-shadow-knob: 0 1px 2px rgba(0,0,0,.2);--nk-shadow-segment: 0 1px 2px rgba(0,0,0,.08)}[data-theme=dark]{color-scheme:dark;--nk-bg: #191919;--nk-bg-sidebar: #202020;--nk-bg-hover: rgba(255,255,255,.055);--nk-bg-active: rgba(255,255,255,.08);--nk-bg-callout: #252525;--nk-bg-code: #202020;--nk-bg-card: #202020;--nk-bg-input: rgba(255,255,255,.055);--nk-text: rgba(255,255,255,.81);--nk-text-secondary: rgba(255,255,255,.46);--nk-text-tertiary: rgba(255,255,255,.32);--nk-text-sidebar: rgba(255,255,255,.62);--nk-border: rgba(255,255,255,.094);--nk-border-strong: rgba(255,255,255,.16);--nk-accent: #529CCA;--nk-danger: #df5452;--nk-tag-gray-bg: #373737;--nk-tag-gray-text: rgba(255,255,255,.85);--nk-tag-brown-bg: #603b2c;--nk-tag-brown-text: rgba(255,255,255,.85);--nk-tag-orange-bg: #854c1d;--nk-tag-orange-text: rgba(255,255,255,.85);--nk-tag-yellow-bg: #89632a;--nk-tag-yellow-text: rgba(255,255,255,.85);--nk-tag-green-bg: #2b593f;--nk-tag-green-text: rgba(255,255,255,.85);--nk-tag-blue-bg: #28456c;--nk-tag-blue-text: rgba(255,255,255,.85);--nk-tag-purple-bg: #492f64;--nk-tag-purple-text: rgba(255,255,255,.85);--nk-tag-pink-bg: #69314c;--nk-tag-pink-text: rgba(255,255,255,.85);--nk-tag-red-bg: #6e3630;--nk-tag-red-text: rgba(255,255,255,.85);--nk-tint-gray: #252525;--nk-color-gray: #9b9b9b;--nk-tint-brown: #2e2724;--nk-color-brown: #ba856f;--nk-tint-orange: #36291f;--nk-color-orange: #c77d48;--nk-tint-yellow: #372e20;--nk-color-yellow: #ca8f3d;--nk-tint-green: #242b26;--nk-color-green: #529e72;--nk-tint-blue: #1f282d;--nk-color-blue: #5e87c9;--nk-tint-purple: #2a2430;--nk-color-purple: #9d68d3;--nk-tint-pink: #2e2328;--nk-color-pink: #d15796;--nk-tint-red: #332523;--nk-color-red: #df5452;--nk-shadow-menu: rgba(15,15,15,.2) 0px 0px 0px 1px, rgba(15,15,15,.4) 0px 3px 6px, rgba(15,15,15,.6) 0px 9px 24px;--nk-shadow-card: none;--nk-shadow-btn: inset 0 0 0 1px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.3)}',e='[class*=nk-],[class*=nk-] *,[class*=nk-]:before,[class*=nk-]:after,[class*=nk-] *:before,[class*=nk-] *:after{box-sizing:border-box}[class*=nk-] :where(h1,h2,h3,h4,h5,h6,p,figure,blockquote,dl,dd,pre,ul,ol,li){margin:0;padding:0}[class*=nk-] :where(ul,ol){list-style:none}[class*=nk-] :where(button,input,select,textarea,option,optgroup,fieldset,legend),:where(button,input,select,textarea)[class*=nk-]{margin:0;padding:0}[class*=nk-][hidden]:not([hidden=until-found i]){display:none!important}::slotted([hidden]:not([hidden="until-found" i])){display:none!important}',n='.nk-body{margin:0;min-height:100vh;min-height:100dvh;font-family:var(--nk-font);font-size:14px;background:var(--nk-bg);color:var(--nk-text);-webkit-font-smoothing:auto;transition:background .25s ease,color .25s ease}.nk-app{display:flex;height:100vh;height:100dvh;overflow:hidden}.nk-sidebar{width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));min-width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));padding-left:env(safe-area-inset-left,0px);background:var(--nk-bg-sidebar);display:flex;flex-direction:column;border-right:1px solid var(--nk-border);transition:background .25s ease,margin-left .24s cubic-bezier(.2,.8,.25,1)}.nk-workspace{display:flex;align-items:center;gap:8px;padding:10px 12px;margin:6px 8px 2px;border-radius:var(--nk-radius);cursor:pointer;font-weight:500;user-select:none}.nk-workspace:hover{background:var(--nk-bg-hover)}.nk-workspace .avatar,.nk-workspace ::slotted(.avatar),.nk-workspace ::slotted([slot="avatar"]){width:22px;height:22px;border-radius:4px;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:11px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-workspace .chev{margin-left:auto;color:var(--nk-text-tertiary);font-size:11px}.nk-sidebar-scroll{flex:1;overflow-y:auto;padding:4px 8px 16px}.nk-sidebar-scroll::-webkit-scrollbar{width:8px}.nk-sidebar-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:4px}.nk-section-label{font-size:12px;font-weight:500;letter-spacing:.01em;color:var(--nk-text-tertiary);padding:14px 10px 4px;display:flex;justify-content:space-between;align-items:center}.nk-section-label .plus{cursor:pointer;border-radius:4px;padding:0 4px;font-size:13px;opacity:0;transition:opacity .15s}.nk-section-label:hover .plus{opacity:1}.nk-section-label .plus:hover{background:var(--nk-bg-hover)}.nk-sidebar-footer{padding:8px;border-top:1px solid var(--nk-border);color:var(--nk-text-sidebar);font-size:14px}.nk-sidebar-footer .nk-tree-item{min-height:26px}.nk-sidebar-backdrop{display:none;position:fixed;inset:0;z-index:59;background:var(--nk-scrim-soft)}.nk-sidebar-toggle{display:none}.nk-sidebar.collapsed{margin-left:calc(0px - var(--nk-sidebar-width) - env(safe-area-inset-left,0px));visibility:hidden;transition:background .25s ease,margin-left .24s cubic-bezier(.2,.8,.25,1),visibility 0s linear .24s}.nk-sidebar-toggle.collapsed{display:inline-flex}.nk-sidebar-head{display:flex;align-items:center}.nk-sidebar-head>.nk-workspace,.nk-sidebar-head ::slotted(.nk-workspace){flex:1;min-width:0}.nk-sidebar-collapse{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:4px 12px 0 -4px;padding:0;border:none;border-radius:var(--nk-radius);background:transparent;color:var(--nk-text-tertiary);cursor:pointer;opacity:0;transition:opacity .15s}.nk-sidebar:hover .nk-sidebar-collapse,.nk-sidebar-collapse:focus-visible{opacity:1}.nk-sidebar-collapse:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-sidebar-collapse svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-main{flex:1;display:flex;flex-direction:column;min-width:0}.nk-topbar{height:44px;display:flex;align-items:center;padding:0 max(12px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px));gap:8px;flex-shrink:0}.nk-breadcrumb{display:flex;align-items:center;gap:4px;font-size:14px}.nk-breadcrumb .crumb,.nk-breadcrumb ::slotted(.crumb){padding:2px 6px;border-radius:4px;cursor:pointer;color:var(--nk-text-sidebar);display:flex;align-items:center;gap:5px}.nk-breadcrumb .crumb:hover{background:var(--nk-bg-hover)}a.crumb{text-decoration:none}.nk-breadcrumb .crumb.current,.nk-breadcrumb ::slotted(.crumb.current){color:var(--nk-text)}.nk-breadcrumb .sep{color:var(--nk-text-tertiary);font-size:12px}.nk-topbar-actions{margin-left:auto;display:flex;align-items:center;gap:4px}.nk-topbar-btn{padding:4px 8px;border-radius:var(--nk-radius);cursor:pointer;color:var(--nk-text-sidebar);font-size:14px;user-select:none;border:none;background:transparent;font-family:inherit}.nk-topbar-btn:hover{background:var(--nk-bg-hover)}.nk-topbar-btn svg,.nk-topbar-btn ::slotted(svg){width:16px;height:16px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-share-btn{font-size:14px;padding:4px 8px}.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){padding:4px 8px;font-size:12px;color:var(--nk-text-tertiary);white-space:nowrap}.nk-theme-toggle{font-size:15px;width:30px;height:28px;padding:0}.nk-tab-bar{display:none;flex:none;align-items:stretch;gap:2px;position:sticky;bottom:0;z-index:30;box-sizing:border-box;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)));padding:6px max(4px,env(safe-area-inset-right,0px)) max(6px,env(safe-area-inset-bottom,0px)) max(4px,env(safe-area-inset-left,0px));background:var(--nk-bg-sidebar);border-top:1px solid var(--nk-border)}.nk-tab-bar.always{display:flex}.nk-tab-bar.fixed{position:fixed;left:0;right:0;bottom:0}.nk-tab-bar-spacer{display:none;flex:none;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)))}.nk-tab-bar.always.fixed+.nk-tab-bar-spacer{display:block}.nk-tab-bar.floating{position:fixed;left:max(12px,env(safe-area-inset-left,0px));right:max(12px,env(safe-area-inset-right,0px));bottom:calc(12px + env(safe-area-inset-bottom,0px));height:var(--nk-tab-bar-height);padding:6px;border:1px solid var(--nk-border);border-radius:16px;box-shadow:var(--nk-shadow-menu)}.nk-tab-bar-item{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:4px 2px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:10.5px;line-height:1.2;color:var(--nk-text-secondary);text-decoration:none;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}.nk-tab-bar-item:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-tab-bar-item.active{color:var(--nk-accent)}.nk-tab-bar-item:disabled{opacity:.5;cursor:not-allowed}.nk-tab-bar-item .icon,.nk-tab-bar-item ::slotted([slot="icon"]){font-size:20px;line-height:1}.nk-tab-bar-item .label,.nk-tab-bar-item ::slotted(.label){max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-tree-item{display:flex;align-items:center;gap:6px;padding:3px 8px 3px 10px;border-radius:var(--nk-radius);cursor:pointer;user-select:none;color:var(--nk-text-sidebar);position:relative;min-height:var(--_nk-row, 28px)}.nk-tree-item:hover{background:var(--nk-bg-hover)}.nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-tree-item.compact{min-height:26px}.nk-tree-item .icon,.nk-tree-item ::slotted(.icon),.nk-tree-item ::slotted([slot="icon"]){font-size:15px;width:20px;text-align:center;flex-shrink:0}.nk-tree-item .label,.nk-tree-item ::slotted(.label){white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-tree-item .actions{margin-left:auto;display:none;gap:2px;color:var(--nk-text-tertiary)}.nk-tree-item:hover .actions{display:flex}.nk-tree-item .actions span{padding:0 3px;border-radius:3px;font-size:12px}.nk-tree-item .actions span:hover{background:var(--nk-bg-active)}.nk-tree-children{margin-left:14px;border-left:1px solid var(--nk-border);padding-left:4px;overflow:hidden}.nk-tree-children.collapsed{display:none}.nk-toggle-arrow{width:16px;height:16px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-size:9px;color:var(--nk-text-tertiary);border-radius:3px;transition:transform .15s}.nk-toggle-arrow.open{transform:rotate(90deg)}.nk-kbd-hint{margin-left:auto;display:flex;gap:3px;align-items:center}.nk-kbd{font-family:inherit;font-size:10.5px;background:var(--nk-bg-callout);border:1px solid var(--nk-border-strong);border-bottom-width:2px;border-radius:4px;padding:0 4px}.nk-page-scroll{flex:1;overflow-y:auto}.nk-page-scroll::-webkit-scrollbar{width:10px}.nk-page-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-cover{height:var(--nk-cover-height);background:radial-gradient(ellipse at 20% 40%,color-mix(in srgb,var(--nk-decor-purple) 35%,transparent),transparent 55%),radial-gradient(ellipse at 80% 20%,color-mix(in srgb,var(--nk-decor-blue) 35%,transparent),transparent 55%),radial-gradient(ellipse at 60% 90%,color-mix(in srgb,var(--nk-decor-orange) 25%,transparent),transparent 55%),var(--nk-bg-callout)}.nk-cover>img,.nk-cover ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-page{max-width:760px;margin:0 auto;padding:24px max(64px,env(safe-area-inset-right,0px)) 120px max(64px,env(safe-area-inset-left,0px));font-size:16px;line-height:1.5}.nk-page.full{max-width:var(--nk-page-full-max)}.nk-page.small{font-size:14px}.nk-cover+.nk-page:has(>.nk-page-icon:not([hidden])),.nk-page.covered{padding-top:0}.nk-page-icon,.nk-page ::slotted(.nk-page-icon),.nk-page ::slotted([slot="icon"]){font-size:64px;line-height:1;margin-top:0;cursor:pointer;user-select:none;display:inline-block}.nk-cover+.nk-page .nk-page-icon,.nk-cover+.nk-page ::slotted(.nk-page-icon),.nk-cover+.nk-page ::slotted([slot="icon"]),.nk-page.covered .nk-page-icon,.nk-page.covered ::slotted(.nk-page-icon),.nk-page.covered ::slotted([slot="icon"]){margin-top:-42px}.nk-page-title{font-size:var(--_nk-title, 40px);font-weight:700;line-height:1.2;margin:8px 0 4px;outline:none;letter-spacing:0}.nk-page-meta{color:var(--nk-text-tertiary);font-size:13px;margin-bottom:24px;display:flex;gap:16px}.nk-props{display:flex;flex-direction:column;margin:0 0 var(--nk-block-space, 20px);font-size:14px;line-height:1.5}.nk-props.flush{margin:0}.nk-prop{display:flex;flex-wrap:wrap;align-items:flex-start;min-width:0}.nk-prop .p-name{flex:0 0 160px;min-width:0;min-height:34px;padding:0 6px;display:flex;align-items:center;gap:6px;overflow:hidden;border-radius:var(--nk-radius);color:var(--nk-text-secondary);white-space:nowrap;user-select:none}.nk-prop .p-icon,.nk-prop ::slotted([slot="icon"]){width:16px;flex-shrink:0;text-align:center;font-size:13px}.nk-prop .p-value{flex:1 1 220px;min-width:0;min-height:34px;padding:5px 8px;display:flex;align-items:center;flex-wrap:wrap;gap:4px 6px;border-radius:var(--nk-radius);overflow-wrap:anywhere}.nk-prop .p-value.text{display:block;align-content:center}.nk-prop .p-name:hover,.nk-prop .p-value:hover{background:var(--nk-bg-hover)}.nk-page p.lead{font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px}.nk-page ::slotted(p.lead){font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px!important}.nk-heading{font-size:1.5em;font-weight:600;line-height:1.3;margin:32px 0 10px;display:flex;align-items:center;gap:8px}:is(.nk-props,.nk-callout,.nk-bookmark,.nk-toggle,.nk-divider,.nk-quote,.nk-code,.nk-database,.nk-danger-zone,.nk-gallery-grid,.nk-template-btn,.nk-synced,.nk-banner,.nk-panels,.nk-skeleton,.nk-steps,.nk-comments,.nk-block-host,.nk-model-card,.nk-ai-input-row).flush{margin-top:0;margin-bottom:0}.nk-callout{display:flex;gap:10px;align-items:flex-start;background:var(--nk-bg-callout);border-radius:var(--nk-radius);padding:16px 16px 16px 12px;margin:var(--nk-block-space, 16px) 0;line-height:1.5}.nk-callout .c-icon,.nk-callout ::slotted(.c-icon),.nk-callout ::slotted([slot="icon"]){font-size:17px}.nk-bookmark{display:flex;min-width:0;margin:var(--nk-block-space, 8px) 0;overflow:hidden;border:1px solid var(--nk-border);border-radius:var(--nk-radius);color:var(--nk-text);text-decoration:none;transition:background .12s ease}.nk-bookmark:hover{background:var(--nk-bg-hover)}.nk-bookmark .bm-text{flex:1 1 0;min-width:0;padding:12px 14px 14px;font-size:14px;line-height:20px}.nk-bookmark .bm-title{display:block;min-height:24px;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-bookmark .bm-desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;max-height:32px;font-size:12px;line-height:16px;color:var(--nk-text-secondary)}.nk-bookmark .bm-url{display:flex;align-items:center;gap:6px;margin-top:6px;font-size:12px;line-height:16px;white-space:nowrap}.nk-bookmark .bm-url>span{min-width:0;overflow:hidden;text-overflow:ellipsis}.nk-bookmark .bm-favicon{flex:none;width:16px;height:16px}.nk-bookmark .bm-cover{position:relative;flex:0 0 33%;max-width:240px}.nk-bookmark .bm-cover>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.nk-todo{display:flex;align-items:flex-start;gap:8px;padding:4px 0}.nk-todo input[type=checkbox]{appearance:none;width:16px;height:16px;margin-top:3px;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;flex-shrink:0;position:relative;background:var(--nk-bg)}.nk-todo input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-todo input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-todo input:checked+span{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-todo input:disabled{opacity:.5;cursor:not-allowed}.nk-toggle{margin:var(--nk-block-space, 6px) 0}.nk-toggle summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:var(--nk-radius);font-weight:500;user-select:none}.nk-toggle summary::-webkit-details-marker{display:none}.nk-toggle summary:hover{background:var(--nk-bg-hover)}.nk-toggle summary:before{content:"\\25b8";color:var(--nk-text-tertiary);font-size:11px;transition:transform .15s;display:inline-block}.nk-toggle[open] summary:before{transform:rotate(90deg)}.nk-toggle .toggle-body,.nk-toggle ::slotted(.toggle-body){padding:4px 0 8px 26px;color:var(--nk-text-secondary);line-height:1.55}.nk-divider{border:none;border-top:1px solid var(--nk-border);margin:var(--nk-block-space, 24px) 0}.nk-quote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:var(--nk-block-space, 16px) 0;color:var(--nk-text-secondary);line-height:1.5}.nk-quote .q-cite{display:block;margin-top:6px;font-size:12.5px;color:var(--nk-text-tertiary)}.nk-mention{display:inline-flex;align-items:center;gap:4px;padding:0 4px;border-radius:4px;font-weight:500;cursor:pointer;white-space:nowrap}.nk-mention:hover{background:var(--nk-bg-hover)}.nk-mention.person{color:var(--nk-text)}.nk-mention.person .mini-avatar,.nk-mention.person .nk-avatar,.nk-mention.person ::slotted(.mini-avatar),.nk-mention.person ::slotted([slot="avatar"]){width:16px;height:16px;border-radius:50%;color:var(--nk-on-accent);font-size:8.5px;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.nk-mention.page{color:var(--nk-text-secondary);text-decoration:underline;text-decoration-color:var(--nk-border-strong);text-underline-offset:2px}.nk-mention.date{color:var(--nk-color-orange)}.nk-inline-code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-code{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:20px 24px;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;margin:var(--nk-block-space, 14px) 0;overflow-x:auto;color:var(--nk-text-secondary);white-space:pre;position:relative}.nk-code .lang{position:absolute;top:6px;right:10px;font-size:11px;color:var(--nk-text-tertiary);font-family:var(--nk-font)}.nk-code .tag,.nk-code ::slotted(.tag){color:var(--nk-accent)}.nk-code .attr,.nk-code ::slotted(.attr){color:var(--nk-color-orange)}.nk-database{margin:var(--nk-block-space, 12px) 0 var(--nk-block-space, 8px)}.nk-db-tabs{display:flex;gap:2px;align-items:center;padding:0 0 6px;margin-bottom:0;font-size:14px}.nk-db-tab{padding:4px 8px;cursor:pointer;color:var(--nk-text-secondary);border-radius:var(--nk-radius);user-select:none;line-height:20px;display:flex;align-items:center;gap:6px;flex-shrink:0;white-space:nowrap}.nk-db-tab:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-db-tab.active{color:var(--nk-text);background:var(--nk-bg-active);font-weight:500}.nk-db-tab.add{color:var(--nk-text-tertiary)}.nk-db-tab .badge,.nk-db-tab ::slotted(.badge){background:var(--nk-bg-callout);border-radius:8px;font-size:11px;padding:0 6px;color:var(--nk-text-tertiary)}.nk-db-toolbar{display:flex;align-items:center;gap:8px;min-width:0;padding-bottom:6px}.nk-db-toolbar>.nk-db-tabs{flex:1 1 auto;min-width:0;padding-bottom:0;overflow-x:auto;scrollbar-width:none}.nk-db-toolbar>.nk-db-tabs::-webkit-scrollbar{display:none}.nk-db-toolbar .tools{flex:none;display:flex;align-items:center;gap:4px;margin-left:auto}.nk-db-tool{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 8px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-db-tool:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-db-tool.active{color:var(--nk-accent)}.nk-filter-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:2px 0 8px}.nk-filter-pill{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 8px;border:1px solid var(--nk-border-strong);border-radius:12px;background:transparent;font-family:inherit;font-size:13px;line-height:1;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-filter-pill:hover{background:var(--nk-bg-hover)}.nk-filter-pill.active{color:var(--nk-accent);border-color:color-mix(in srgb,var(--nk-accent) 35%,transparent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-filter-pill.add{border-color:transparent;color:var(--nk-text-tertiary)}.nk-filter-pill.add:hover{color:var(--nk-text-secondary)}.nk-filter-pill button{padding:0;border:none;background:none;font:inherit;color:inherit;cursor:pointer}.nk-filter-pill .fp-remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:-4px;border-radius:50%;font-size:13px}.nk-filter-pill .fp-remove:hover{background:color-mix(in srgb,currentColor 15%,transparent)}.nk-table-wrap{overflow-x:auto}.nk-table{width:100%;border-collapse:collapse;font-size:14px}.nk-table th{text-align:left;font-weight:400;color:var(--nk-text-secondary);height:36px;padding:0 8px;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);font-size:14px;white-space:nowrap;user-select:none;cursor:pointer}.nk-table th:hover{background:var(--nk-bg-hover)}.nk-table th .th-icon,.nk-table th ::slotted(.th-icon){margin-right:6px;font-size:13px;color:var(--nk-text-tertiary)}.nk-table td{height:36px;padding:6px 8px;line-height:1.5;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);white-space:nowrap;vertical-align:middle}.nk-table th:last-child,.nk-table td:last-child{border-right:none}.nk-table.wrap td,.nk-table td.wrap{white-space:normal;vertical-align:top}.nk-table tbody tr:hover{background:var(--nk-bg-hover)}.nk-table .row-title{display:flex;align-items:center;gap:7px;font-weight:500;cursor:pointer}.nk-table .row-title:hover{text-decoration:underline;text-decoration-color:var(--nk-text-tertiary)}.nk-table .date-cell{color:var(--nk-text-secondary)}.nk-table .num{text-align:right;font-variant-numeric:tabular-nums}.nk-table .row-actions{display:flex;justify-content:flex-end;gap:4px}.nk-table th.actions{cursor:default}.nk-table th.actions:hover{background:none}.nk-table .td-desc{display:block;font-size:12px;line-height:16px;color:var(--nk-text-tertiary)}.nk-table .td-text.gray{color:var(--nk-color-gray)}.nk-table .td-text.brown{color:var(--nk-color-brown)}.nk-table .td-text.orange{color:var(--nk-color-orange)}.nk-table .td-text.yellow{color:var(--nk-color-yellow)}.nk-table .td-text.green{color:var(--nk-color-green)}.nk-table .td-text.blue{color:var(--nk-color-blue)}.nk-table .td-text.purple{color:var(--nk-color-purple)}.nk-table .td-text.pink{color:var(--nk-color-pink)}.nk-table .td-text.red{color:var(--nk-color-red)}.nk-table .person-cell{display:flex;align-items:center;gap:6px;color:var(--nk-text-secondary)}.nk-table .person-cell .mini-avatar,.nk-table .person-cell ::slotted(.mini-avatar){width:20px;height:20px;border-radius:50%;font-size:10px;color:var(--nk-on-accent);display:inline-flex;align-items:center;justify-content:center;font-weight:600}.nk-new-row,.nk-table .new-row{color:var(--nk-text-tertiary);cursor:pointer;padding:8px;display:flex;align-items:center;gap:7px;font-size:14px}.nk-new-row:hover,.nk-table .new-row:hover{background:var(--nk-bg-hover)}.nk-tag{display:inline-flex;align-items:center;max-width:100%;height:20px;padding:0 6px;border-radius:3px;font-size:14px;font-weight:400;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.gray{background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.brown{background:var(--nk-tag-brown-bg);color:var(--nk-tag-brown-text)}.nk-tag.orange{background:var(--nk-tag-orange-bg);color:var(--nk-tag-orange-text)}.nk-tag.yellow{background:var(--nk-tag-yellow-bg);color:var(--nk-tag-yellow-text)}.nk-tag.green{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text)}.nk-tag.blue{background:var(--nk-tag-blue-bg);color:var(--nk-tag-blue-text)}.nk-tag.purple{background:var(--nk-tag-purple-bg);color:var(--nk-tag-purple-text)}.nk-tag.pink{background:var(--nk-tag-pink-bg);color:var(--nk-tag-pink-text)}.nk-tag.red{background:var(--nk-tag-red-bg);color:var(--nk-tag-red-text)}.nk-progress{width:110px;height:6px;border-radius:3px;background:var(--nk-tint-blue);overflow:hidden;display:inline-block}.nk-progress>i{display:block;height:100%;background:var(--nk-color-blue);border-radius:3px}.nk-progress.wide{width:100%;flex:1 1 60px;max-height:6px}.nk-progress-label{font-size:12px;color:var(--nk-text-tertiary);margin-left:7px;white-space:nowrap}.nk-list{display:flex;flex-direction:column;font-size:14px}.nk-list-item{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden;min-height:36px;padding:4px 6px;border-bottom:1px solid var(--nk-border);color:inherit;text-decoration:none;cursor:pointer}.nk-list-item:hover{background:var(--nk-bg-hover)}.nk-list-item.static{cursor:default}.nk-list-item.static:hover{background:none}.nk-list>.nk-list-item:last-child,.nk-list ::slotted(.nk-list-item:last-child),.nk-list-item.last{border-bottom:none}.nk-list-item .l-icon,.nk-list-item ::slotted([slot="icon"]){width:20px;flex-shrink:0;text-align:center;font-size:15px}.nk-list-item .l-title,.nk-list-item ::slotted(.l-title){flex:1 1 auto;min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-list-item .l-meta,.nk-list-item ::slotted(.l-meta){flex:none;display:flex;align-items:center;gap:8px;margin-left:auto;font-size:12px;color:var(--nk-text-secondary);white-space:nowrap}.nk-calendar-view{font-size:14px}.nk-calendar-view .cv-head{display:flex;align-items:center;gap:4px;padding:2px 0 8px}.nk-calendar-view .cv-title{flex:1;font-weight:600;white-space:nowrap}.nk-calendar-view .cv-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-top:1px solid var(--nk-border);border-left:1px solid var(--nk-border)}.nk-calendar-view.weeks .cv-grid{grid-template-columns:32px repeat(7,minmax(0,1fr))}.nk-calendar-view :is(.cv-wd,.cv-week,.cv-day){min-width:0;border-right:1px solid var(--nk-border);border-bottom:1px solid var(--nk-border)}.nk-calendar-view .cv-wd{padding:4px 8px;font-size:12px;color:var(--nk-text-secondary);text-align:center}.nk-calendar-view .cv-week{padding:6px 0;font-size:11px;color:var(--nk-text-tertiary);text-align:center;font-variant-numeric:tabular-nums}.nk-calendar-view .cv-day{display:flex;flex-direction:column;gap:3px;min-height:112px;padding:4px 4px 6px}.nk-calendar-view .cv-day:is(.out,.off){background:var(--nk-bg-sidebar)}.nk-calendar-view .cv-num{align-self:flex-end;min-width:22px;height:22px;padding:0 6px;border-radius:11px;font-size:13px;line-height:22px;text-align:center;color:var(--nk-text-secondary);font-variant-numeric:tabular-nums}.nk-calendar-view .cv-day.out .cv-num{color:var(--nk-text-tertiary)}.nk-calendar-view .cv-day.today .cv-num{background:var(--nk-danger);color:var(--nk-on-accent)}.nk-calendar-view .cv-item{display:block;min-width:0;padding:3px 6px;border-radius:4px;background:var(--nk-bg-card);border:1px solid var(--nk-border);box-shadow:var(--nk-shadow-card);font-size:12.5px;line-height:18px;color:var(--nk-text);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.nk-calendar-view .cv-item:hover{background:var(--nk-bg-hover)}.nk-board{display:none;gap:12px;padding:14px 2px;overflow-x:auto}.nk-board.active{display:flex}.nk-board-col{min-width:220px;width:220px;flex-shrink:0}.nk-board-col-header{display:flex;align-items:center;gap:7px;margin-bottom:8px;font-size:13.5px;font-weight:500}.nk-board-col-header .count{color:var(--nk-text-tertiary);font-weight:400}.nk-card{background:var(--nk-bg-card);border:1px solid var(--nk-border);border-radius:8px;padding:10px 12px;margin-bottom:8px;cursor:grab;box-shadow:var(--nk-shadow-card);transition:border-color .15s}.nk-card:hover{border-color:var(--nk-border-strong)}.nk-card .card-title,.nk-card ::slotted(.card-title){font-weight:500;margin-bottom:7px;display:flex;gap:6px;align-items:center}.nk-card .card-meta,.nk-card ::slotted(.card-meta){display:flex;gap:6px;flex-wrap:wrap;align-items:center;font-size:12px;color:var(--nk-text-secondary)}.nk-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr));gap:16px;padding:14px 2px}.nk-gallery.small{grid-template-columns:repeat(auto-fill,minmax(min(180px,100%),1fr));gap:12px}.nk-gallery.large{grid-template-columns:repeat(auto-fill,minmax(min(340px,100%),1fr))}.nk-gallery .nk-card{display:flex;flex-direction:column;min-width:0;margin:0;color:inherit;text-decoration:none;cursor:pointer}.nk-gallery .nk-card>.nk-cover{flex:none;height:auto;aspect-ratio:2 / 1;margin:-10px -12px 10px;border-radius:7px 7px 0 0;overflow:hidden}.nk-gallery.fit .nk-card>.nk-cover:has(>img){background:var(--nk-bg-callout)}.nk-gallery.fit .nk-card>.nk-cover>img{object-fit:contain}.nk-gallery .card-title{min-width:0}.nk-gallery>.card-item{display:flex;min-width:0}.nk-gallery>.card-item>.nk-card{flex:1 1 auto}.nk-gallery>.nk-new-row{justify-content:center;min-height:64px;border:1px dashed var(--nk-border-strong);border-radius:8px}.nk-field{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:9px 0;--_nk-field-min: 210px}.nk-field .f-label,.nk-field ::slotted(.f-label),.nk-field ::slotted([slot="label"]){font-size:14px}.nk-field .f-desc,.nk-field ::slotted(.f-desc),.nk-field ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-field .f-control,.nk-field ::slotted(.f-control){flex-shrink:0}.nk-field.stacked,.nk-fields>.nk-field{flex-direction:column;align-items:stretch;gap:6px;min-width:0}.nk-field.stacked .f-control,.nk-fields>.nk-field .f-control{width:100%;min-width:0}.nk-field.stacked .nk-input,.nk-field.stacked .nk-textarea,.nk-field.stacked .nk-select,.nk-fields>.nk-field .nk-input,.nk-fields>.nk-field .nk-textarea,.nk-fields>.nk-field .nk-select{width:100%;min-width:0}.nk-field.compact,.nk-fields>.nk-field{padding:0;gap:4px;min-width:0}.nk-field.compact .f-label,.nk-field.compact ::slotted([slot="label"]),.nk-fields>.nk-field .f-label,.nk-fields>.nk-field ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-tertiary)}.nk-fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px 12px;padding:9px 0}.nk-fields.fit{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}.nk-fields>.nk-field{min-width:0}.nk-input,.nk-select,.nk-textarea{font-family:inherit;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:5px 10px;outline:none;transition:border-color .15s,box-shadow .15s;min-width:var(--_nk-field-min, 210px);max-width:100%}.nk-input:hover,.nk-select:hover,.nk-textarea:hover{border-color:var(--nk-border-strong)}.nk-input:focus,.nk-select:focus,.nk-textarea:focus{border-color:color-mix(in srgb,var(--nk-accent) 60%,transparent);box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 30%,transparent)}.nk-input::placeholder,.nk-textarea::placeholder{color:var(--nk-text-tertiary)}.nk-input.wide,.nk-textarea.wide,.nk-select.wide{width:100%;min-width:0}.nk-input[type=date],.nk-input[type=time],.nk-input[type=datetime-local],.nk-input[type=month]{appearance:none}.nk-input::-webkit-date-and-time-value{text-align:start;min-height:1lh}.nk-select.compact{min-width:120px}.nk-textarea{resize:vertical;min-height:70px;line-height:1.5}.nk-select{appearance:none;cursor:pointer;padding-right:26px;background-image:linear-gradient(45deg,transparent 50%,var(--nk-text-tertiary) 50%),linear-gradient(135deg,var(--nk-text-tertiary) 50%,transparent 50%);background-position:calc(100% - 14px) 55%,calc(100% - 10px) 55%;background-size:4px 4px;background-repeat:no-repeat}.nk-copy-field{display:flex;align-items:center;gap:2px;min-width:var(--_nk-field-min, 210px);max-width:100%;padding:0 3px 0 10px;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius)}.nk-copy-field.wide{width:100%;min-width:0}.nk-copy-field.wrap{align-items:flex-start}.nk-copy-field .cf-value{flex:1 1 auto;min-width:0;padding:5px 6px 5px 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.nk-copy-field.mono .cf-value{font-family:var(--nk-font-mono);font-size:13px}.nk-copy-field.wrap .cf-value{white-space:pre-wrap;overflow-wrap:anywhere}.nk-copy-field .cf-btn{flex:none;height:24px;margin:3px 0;padding:0 8px;border:none;border-radius:4px;background:transparent;font-family:inherit;font-size:13px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer}.nk-copy-field .cf-btn:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-copy-field .cf-btn.copied{color:var(--nk-color-green)}.nk-calendar{display:block;width:max-content;max-width:100%;margin-inline:auto;font-size:14px;user-select:none;-webkit-user-select:none}.nk-calendar .cal-head{display:flex;align-items:center;gap:2px;padding:0 0 6px 6px}.nk-calendar .cal-title{flex:1;font-weight:600;white-space:nowrap}.nk-calendar .cal-nav,.nk-calendar-view .cal-nav{display:inline-flex;align-items:center;justify-content:center;height:28px;min-width:28px;padding:0 6px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:13px;color:var(--nk-text-secondary);cursor:pointer}.nk-calendar .cal-nav:hover,.nk-calendar-view .cal-nav:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-calendar .cal-nav svg,.nk-calendar-view .cal-nav svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-calendar .cal-grid{display:grid;grid-template-columns:repeat(7,var(--_nk-cell, 36px));row-gap:2px}.nk-calendar.weeks .cal-grid{grid-template-columns:24px repeat(7,var(--_nk-cell, 36px))}.nk-calendar .cal-wd,.nk-calendar .cal-week{display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--nk-text-tertiary);font-variant-numeric:tabular-nums}.nk-calendar .cal-wd{height:24px}.nk-calendar .cal-week{font-size:11px}.nk-calendar .cal-day{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--_nk-cell, 36px);height:var(--_nk-cell, 36px);padding:0;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text);font-variant-numeric:tabular-nums;cursor:pointer}.nk-calendar .cal-day:hover{background:var(--nk-bg-hover)}.nk-calendar .cal-day:focus-visible{outline:2px solid color-mix(in srgb,var(--nk-accent) 60%,transparent);outline-offset:-2px}.nk-calendar .cal-day.out,.nk-calendar .cal-day.off{color:var(--nk-text-tertiary)}.nk-calendar .cal-day.today{color:var(--nk-danger);font-weight:600}.nk-calendar .cal-day.in-range{border-radius:0;background:color-mix(in srgb,var(--nk-accent) 12%,transparent)}.nk-calendar .cal-day:is(.selected,.start,.end){background:var(--nk-accent);color:var(--nk-on-accent);font-weight:500}.nk-calendar .cal-day.start:not(.end){border-radius:var(--nk-radius) 0 0 var(--nk-radius)}.nk-calendar .cal-day.end:not(.start){border-radius:0 var(--nk-radius) var(--nk-radius) 0}.nk-calendar .cal-day[aria-disabled=true]{color:var(--nk-text-tertiary);background:none;opacity:.5;cursor:default}.nk-calendar .cal-marks{position:absolute;left:0;right:0;bottom:3px;display:flex;justify-content:center;gap:2px;pointer-events:none}.nk-calendar .cal-marks i{width:4px;height:4px;border-radius:50%;background:var(--nk-color-gray)}.nk-calendar .cal-day:is(.selected,.start,.end) .cal-marks i{background:var(--nk-on-accent)}.nk-calendar .cal-foot{display:flex;align-items:center;gap:8px;margin-top:8px;padding:8px 2px 0;border-top:1px solid var(--nk-border)}.nk-calendar .cal-foot .nk-input{min-width:0;flex:1 1 auto}.nk-btn{font-family:inherit;font-size:14px;line-height:20px;font-weight:500;border-radius:var(--nk-radius);cursor:pointer;padding:3px 12px;border:1px solid transparent;transition:background .15s,border-color .15s,box-shadow .15s,opacity .15s;display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}.nk-btn svg,.nk-btn ::slotted(svg){width:15px;height:15px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-btn.primary{background:var(--nk-accent);color:var(--nk-on-accent)}.nk-btn.primary:hover:not(:disabled,[aria-disabled=true]){opacity:.88}.nk-btn.secondary{background:var(--nk-bg-card);color:var(--nk-text);box-shadow:var(--nk-shadow-btn)}.nk-btn.secondary:hover:not(:disabled,[aria-disabled=true]){background:color-mix(in srgb,var(--nk-bg-card),var(--nk-text) 6%)}.nk-btn.danger{background:var(--nk-bg-card);color:var(--nk-danger);box-shadow:var(--nk-shadow-btn)}.nk-btn.danger:hover:not(:disabled,[aria-disabled=true]){background:color-mix(in srgb,var(--nk-danger) 8%,var(--nk-bg-card))}.nk-btn.danger-solid{background:var(--nk-danger);color:var(--nk-on-accent)}.nk-btn.danger-solid:hover:not(:disabled,[aria-disabled=true]){opacity:.88}.nk-btn.small{padding:1px 8px;font-size:13px;line-height:20px}a.nk-btn{text-decoration:none}.nk-btn:disabled,.nk-btn[aria-disabled=true]{opacity:.5;cursor:not-allowed}.nk-switch{position:relative;width:34px;height:20px;flex-shrink:0;appearance:none;border:none;cursor:pointer;border-radius:20px;background:var(--nk-border-strong);transition:background .2s}.nk-switch:after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--nk-on-accent);transition:transform .2s;box-shadow:var(--nk-shadow-knob)}.nk-switch:checked,.nk-switch[aria-checked=true]{background:var(--nk-accent)}.nk-switch:checked:after,.nk-switch[aria-checked=true]:after{transform:translate(14px)}.nk-switch:disabled{opacity:.5;cursor:not-allowed}.nk-switch-label{display:inline-flex;align-items:flex-start;gap:8px;font-size:14px;cursor:pointer}.nk-switch-label>.nk-switch{font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 20px)/2))}.nk-switch-label>span{padding-top:max(0px,calc((20px - 1lh)/2))}.nk-switch-label:has(.nk-switch:disabled){cursor:not-allowed;color:var(--nk-text-tertiary)}.nk-check{display:flex;align-items:flex-start;gap:8px;padding:4px 0;font-size:14px;cursor:pointer}.nk-check input{appearance:none;width:16px;height:16px;flex-shrink:0;border:1.4px solid var(--nk-border-strong);border-radius:3px;cursor:pointer;position:relative;background:var(--nk-bg);font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 16px)/2))}.nk-check input[type=radio]{border-radius:50%}.nk-check input:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-check input:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:10.5px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-check input[type=radio]:checked:after{content:"\\25cf";font-size:7px}.nk-check input:disabled{opacity:.5;cursor:not-allowed}.nk-check input:disabled+*{opacity:.6}.nk-slider{width:210px;accent-color:var(--nk-accent);cursor:pointer}.nk-slider-value{font-size:12.5px;color:var(--nk-text-tertiary);margin-top:3px}.nk-profile-row{display:flex;align-items:center;gap:14px;padding:8px 0}.nk-profile-row .big-avatar,.nk-profile-row ::slotted(.big-avatar),.nk-profile-row ::slotted([slot="avatar"]){width:56px;height:56px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:20px;font-weight:600;display:flex;align-items:center;justify-content:center;overflow:hidden;flex-shrink:0}.nk-profile-row .big-avatar>img{display:block;width:100%;height:100%;object-fit:cover}.nk-profile-row .big-avatar.square,.nk-profile-row ::slotted(.big-avatar.square){border-radius:8px}.nk-profile-row .pr-actions{display:flex;flex-direction:column;gap:6px}.nk-profile-row .pr-remove{color:var(--nk-text-tertiary)}.nk-model-card{border:1px solid var(--nk-border-strong);border-radius:8px;padding:12px 14px;margin-bottom:var(--nk-block-space, 10px);cursor:pointer;display:flex;align-items:flex-start;gap:11px;transition:border-color .15s,background .15s}.nk-model-card:hover{background:var(--nk-bg-hover)}.nk-model-card.selected{border-color:var(--nk-accent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-model-card .m-radio{width:15px;height:15px;border-radius:50%;flex-shrink:0;margin-top:2px;border:1.4px solid var(--nk-border-strong);position:relative}.nk-model-card.selected .m-radio{border-color:var(--nk-accent)}.nk-model-card.selected .m-radio:after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--nk-accent)}.nk-model-card .m-name,.nk-model-card ::slotted(.m-name),.nk-model-card ::slotted([slot="title"]){font-weight:500;font-size:14px;display:flex;align-items:center;gap:7px}.nk-model-card .m-desc,.nk-model-card ::slotted(.m-desc),.nk-model-card ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-danger-zone{border:1px solid color-mix(in srgb,var(--nk-danger) 40%,transparent);border-radius:8px;padding:14px 16px;margin-top:var(--nk-block-space, 26px)}.nk-danger-zone .dz-title{color:var(--nk-danger);font-weight:600;font-size:13px;margin-bottom:8px}.nk-member-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--nk-border)}.nk-member-list>.nk-member-row:last-child,.nk-member-list ::slotted(.nk-member-row:last-child),.nk-member-row.last{border-bottom:none}.nk-member-row .mini-avatar,.nk-member-row .nk-avatar,.nk-member-row ::slotted(.mini-avatar),.nk-member-row ::slotted([slot="avatar"]){width:28px;height:28px;border-radius:50%;color:var(--nk-on-accent);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;flex-shrink:0}.nk-member-row>:has(>.m-mail){min-width:0}.nk-member-row .m-mail{font-size:12px;color:var(--nk-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-member-row .nk-select{min-width:120px;margin-left:auto}.nk-member-row ::slotted([slot="role"]){margin-left:auto}.nk-modal-backdrop{position:fixed;inset:0;background:var(--nk-scrim);padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);display:flex;align-items:center;justify-content:center;z-index:100;opacity:0;pointer-events:none;transition:opacity .2s ease}.nk-modal-backdrop.open{opacity:1;pointer-events:auto}.nk-modal{width:min(1150px,92vw);height:min(715px,86vh);max-width:100%;max-height:100%;background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);display:flex;overflow:hidden;transform:scale(.98) translateY(6px);transition:transform .2s ease}.nk-modal-backdrop.open .nk-modal{transform:none}.nk-settings-nav{width:240px;min-width:240px;background:var(--nk-bg-sidebar);border-right:1px solid var(--nk-border);padding:10px 8px;overflow-y:auto;flex-shrink:0}.nk-settings-user{display:flex;align-items:center;gap:9px;padding:6px 10px 12px;margin-bottom:4px}.nk-settings-user .avatar,.nk-settings-user ::slotted(.avatar),.nk-settings-user ::slotted([slot="avatar"]){width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-weight:600;font-size:13px;display:flex;align-items:center;justify-content:center}.nk-settings-user .name{font-weight:500;font-size:14px}.nk-settings-user .mail{font-size:12px;color:var(--nk-text-secondary)}.nk-settings-nav .nk-tree-item{min-height:28px}.nk-settings-nav .nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-settings-content{flex:1;overflow-y:auto;padding:36px 60px 80px;min-width:0}.nk-settings-content::-webkit-scrollbar{width:10px}.nk-settings-content::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-settings-pane{display:none;max-width:800px}.nk-settings-pane.active{display:block}.nk-settings-pane>h2{font-size:22px;font-weight:600;line-height:1.3;margin-bottom:20px}.nk-settings-pane>h3{font-size:16px;font-weight:500;padding-bottom:8px;border-bottom:1px solid var(--nk-border);margin:30px 0 12px}.nk-settings-pane ::slotted(h2){font-size:22px;font-weight:600;line-height:1.3;padding:0!important;margin:0 0 20px!important}.nk-settings-pane ::slotted(h3){font-size:16px;font-weight:500;border:0;border-bottom:1px solid var(--nk-border);padding:0 0 8px!important;margin:30px 0 12px!important}.nk-pop{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:10px;width:296px}.nk-emoji-search{width:100%;font-family:inherit;font-size:14px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:6px 10px;outline:none;margin-bottom:8px}.nk-emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px}.nk-emoji-grid span,.nk-emoji-grid ::slotted(span){font-size:18px;text-align:center;padding:4px 0;border-radius:5px;cursor:pointer;user-select:none}.nk-emoji-grid span:hover{background:var(--nk-bg-hover)}.nk-emoji-cats{display:flex;gap:2px;margin-top:8px;padding-top:8px;border-top:1px solid var(--nk-border)}.nk-emoji-cats span{font-size:14px;padding:3px 7px;border-radius:5px;cursor:pointer;color:var(--nk-text-tertiary);filter:grayscale(1);opacity:.6}.nk-emoji-cats span.active,.nk-emoji-cats span:hover{filter:none;opacity:1;background:var(--nk-bg-hover)}.nk-menu{padding:5px;width:230px}.nk-menu-item{display:flex;align-items:center;gap:9px;padding:4px 8px;min-height:var(--_nk-row, 28px);border-radius:5px;cursor:pointer;font-size:14px;user-select:none}.nk-menu-item:hover{background:var(--nk-bg-hover)}.nk-menu-item .m-icon,.nk-menu-item ::slotted(.m-icon),.nk-menu-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-menu-item .m-shortcut,.nk-menu-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-menu-item.danger{color:var(--nk-danger)}.nk-menu-item>.nk-switch{margin-left:auto}.nk-menu-sep{border-top:1px solid var(--nk-border);margin:5px 4px}.nk-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:5px 8px 2px}.nk-pop.floating{z-index:106;opacity:0;visibility:hidden;pointer-events:none;max-height:min(var(--_nk-float-max, 100dvh),100dvh - 16px);overflow-y:auto;overscroll-behavior:contain;transform:translateY(-4px) scale(.98);transform-origin:top;transition:opacity .15s ease,transform .15s ease,visibility 0s linear .15s}.nk-pop.floating.open{opacity:1;visibility:visible;pointer-events:auto;transform:none;transition:opacity .15s ease,transform .15s ease,visibility 0s}.nk-cmdk-backdrop{position:fixed;inset:0;background:var(--nk-scrim-soft);display:flex;justify-content:center;align-items:flex-start;padding:max(14vh,env(safe-area-inset-top,0px)) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);z-index:110;opacity:0;pointer-events:none;transition:opacity .18s ease}.nk-cmdk-backdrop.open{opacity:1;pointer-events:auto}.nk-cmdk{max-width:100%;width:min(560px,92vw);background:var(--nk-bg);border-radius:12px;box-shadow:var(--nk-shadow-menu);overflow:hidden;transform:scale(.98);transition:transform .18s ease}.nk-cmdk-backdrop.open .nk-cmdk{transform:scale(1)}.nk-cmdk-input-row{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--nk-border)}.nk-cmdk-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:16px;color:var(--nk-text)}.nk-cmdk-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-cmdk-list{max-height:320px;overflow-y:auto;padding:6px}.nk-cmdk-group{font-size:12px;color:var(--nk-text-tertiary);padding:8px 10px 3px}.nk-cmdk-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;cursor:pointer;font-size:14px;user-select:none}.nk-cmdk-item.selected{background:var(--nk-bg-active)}.nk-cmdk-item .m-icon,.nk-cmdk-item ::slotted(.m-icon),.nk-cmdk-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-cmdk-item .m-shortcut,.nk-cmdk-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-cmdk-empty{padding:30px;text-align:center;color:var(--nk-text-tertiary);font-size:13.5px}.nk-cmdk-footer{display:flex;gap:14px;padding:8px 16px;border-top:1px solid var(--nk-border);font-size:11.5px;color:var(--nk-text-tertiary)}.nk-sheet-backdrop{position:fixed;inset:0;z-index:100;display:none;flex-direction:column;align-items:center;justify-content:flex-end;padding-top:max(24px,env(safe-area-inset-top,0px));background:var(--nk-scrim-soft);opacity:0;transition:opacity .2s ease,display .25s allow-discrete}.nk-sheet-backdrop.open{display:flex;opacity:1}@starting-style{.nk-sheet-backdrop.open{opacity:0}}.nk-sheet{--_nk-row: 40px;width:100%;max-width:640px;max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:6px max(10px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));background:var(--nk-bg);color:var(--nk-text);border-radius:14px 14px 0 0;box-shadow:var(--nk-shadow-menu);translate:0 100%;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-sheet-backdrop.open .nk-sheet{translate:none}@starting-style{.nk-sheet-backdrop.open .nk-sheet{translate:0 100%}}.nk-sheet .sh-grabber,.nk-sheet ::slotted(.sh-grabber){width:36px;height:4px;margin:4px auto 10px;border-radius:2px;background:var(--nk-border-strong)}.nk-sheet .sh-title,.nk-sheet ::slotted(.sh-title){font-size:14px;font-weight:600;text-align:center;padding:0 8px 10px}.nk-dialog-backdrop{position:fixed;inset:0;z-index:105;display:none;align-items:center;justify-content:center;padding:max(16px,env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));background:var(--nk-scrim-soft);opacity:0;transition:opacity .2s ease,display .2s allow-discrete}.nk-dialog-backdrop.open{display:flex;opacity:1}@starting-style{.nk-dialog-backdrop.open{opacity:0}}.nk-dialog{width:440px;max-width:100%;max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:20px 24px;border-radius:10px;outline:none;background:var(--nk-bg);color:var(--nk-text);box-shadow:var(--nk-shadow-menu);scale:.98;translate:0 6px;transition:scale .2s ease,translate .2s ease}.nk-dialog.wide{width:560px}.nk-dialog-backdrop.open .nk-dialog{scale:none;translate:none}@starting-style{.nk-dialog-backdrop.open .nk-dialog{scale:.98;translate:0 6px}}.nk-dialog .dl-title{font-size:16px;font-weight:600;line-height:1.4;margin-bottom:6px}.nk-dialog .dl-body{font-size:14px;line-height:1.5}.nk-dialog .dl-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.nk-peek-backdrop{position:fixed;inset:0;z-index:50;display:none;pointer-events:none;transition:background-color .2s ease,display .25s allow-discrete}.nk-peek-backdrop.open{display:block}.nk-peek{--_nk-title: 32px;position:absolute;top:0;right:0;bottom:0;width:min(var(--nk-peek-width),100%);display:flex;flex-direction:column;pointer-events:auto;outline:none;background:var(--nk-bg);color:var(--nk-text);box-shadow:var(--nk-shadow-menu);translate:100% 0;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-peek-backdrop.open .nk-peek{translate:none}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:100% 0}}.nk-peek .pk-bar{flex:none;display:flex;align-items:center;gap:2px;height:44px;padding:0 12px}.nk-peek .pk-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 48px 64px;font-size:16px;line-height:1.5}.nk-peek .pk-resize{position:absolute;top:0;bottom:0;left:-4px;width:8px;z-index:1;cursor:col-resize;touch-action:none;outline:none}.nk-peek .pk-resize:after{content:"";position:absolute;top:0;bottom:0;left:3px;width:2px;transition:background .15s}.nk-peek .pk-resize:hover:after,.nk-peek .pk-resize:focus-visible:after,.nk-peek .pk-resize.active:after{background:var(--nk-accent)}.nk-app.peek-inset .nk-main{padding-right:min(var(--nk-peek-width),100%)}.nk-toast{position:fixed;bottom:max(20px,calc(env(safe-area-inset-bottom,0px) + 12px));left:50%;transform:translate(-50%) translateY(80px);z-index:120;width:max-content;max-width:calc(100% - 32px);background:var(--nk-text);color:var(--nk-bg);padding:8px 16px;border-radius:8px;font-size:14px;opacity:0;transition:all .3s ease;pointer-events:none;box-shadow:var(--nk-shadow-menu);display:flex;gap:8px;align-items:center}.nk-toast.show{opacity:1;transform:translate(-50%) translateY(0)}.nk-tooltip{z-index:130;max-width:260px;padding:4px 8px;border-radius:var(--nk-radius);overflow-wrap:break-word;background:var(--nk-text);color:var(--nk-bg);box-shadow:var(--nk-shadow-menu);font-size:12px;font-weight:500;line-height:16px;pointer-events:none;opacity:0;visibility:hidden;transition:opacity .1s ease,visibility 0s linear .1s}.nk-tooltip.open{opacity:1;visibility:visible;transition:opacity .1s ease}.nk-tooltip .tt-key{margin-left:6px;color:color-mix(in srgb,var(--nk-bg) 60%,transparent)}.nk-tooltip.lines{white-space:pre-line}.nk-gallery-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));gap:20px 32px;margin:var(--nk-block-space, 12px) 0}.nk-g-item>h4{font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}.nk-g-item ::slotted(h4){font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px!important}.nk-tabs{display:flex;gap:2px;border-bottom:1px solid var(--nk-border);font-size:14px}.nk-tab{padding:7px 11px;cursor:pointer;color:var(--nk-text-secondary);border-bottom:2px solid transparent;margin-bottom:-1px;user-select:none}.nk-tab:hover{color:var(--nk-text)}.nk-tab.active{color:var(--nk-text);border-bottom-color:var(--nk-text);font-weight:500}.nk-tab-panel{padding:12px 2px;color:var(--nk-text-secondary);line-height:1.55;font-size:14px}.nk-tabs.scroll{overflow-x:auto;overflow-y:hidden;scrollbar-width:none;white-space:nowrap;border-bottom:0;padding-bottom:1px;box-shadow:inset 0 -1px 0 var(--nk-border)}.nk-tabs.scroll::-webkit-scrollbar{display:none}.nk-template-btn{display:flex;align-items:center;gap:8px;width:100%;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);background:var(--nk-bg-callout);border:none;border-radius:var(--nk-radius);padding:8px 12px;cursor:pointer;margin-bottom:var(--nk-block-space, 6px);text-align:left}.nk-template-btn:hover{background:var(--nk-bg-hover)}.nk-stats{display:flex;gap:10px}.nk-stat{flex:1;border:1px solid var(--nk-border);border-radius:8px;padding:12px 14px}.nk-stat .s-label,.nk-stat ::slotted(.s-label),.nk-stat ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-secondary);margin-bottom:4px}.nk-stat .s-value,.nk-stat ::slotted(.s-value),.nk-stat ::slotted([slot="value"]){font-size:22px;font-weight:600;letter-spacing:-.01em}.nk-stat .s-delta,.nk-stat ::slotted(.s-delta),.nk-stat ::slotted([slot="delta"]){font-size:12px;margin-top:3px}.nk-stat .s-delta.up,.nk-stat ::slotted(.s-delta.up),.nk-stat ::slotted([slot="delta"].up){color:var(--nk-color-green)}.nk-stat .s-delta.down,.nk-stat ::slotted(.s-delta.down),.nk-stat ::slotted([slot="delta"].down){color:var(--nk-danger)}.nk-synced{border:1.5px solid color-mix(in srgb,var(--nk-danger) 55%,transparent);border-radius:8px;padding:12px 14px;position:relative;margin:var(--nk-block-space, 8px) 0}.nk-synced .synced-badge{position:absolute;top:-9px;right:10px;font-size:11px;background:var(--nk-danger);color:var(--nk-on-accent);border-radius:8px;padding:1px 8px}.nk-segmented{display:inline-flex;background:var(--nk-bg-callout);border-radius:7px;padding:2px}.nk-segmented button{font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px;border-radius:5px;cursor:pointer}.nk-segmented ::slotted(button){font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px!important;border-radius:5px;cursor:pointer}.nk-segmented button.active,.nk-segmented ::slotted(button.active){background:var(--nk-bg);color:var(--nk-text);font-weight:500;box-shadow:var(--nk-shadow-segment)}.nk-segmented.wrap{flex-wrap:wrap}.nk-segmented.scroll{max-width:100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}.nk-segmented.scroll::-webkit-scrollbar{display:none}.nk-segmented.scroll button,.nk-segmented.scroll ::slotted(button){flex-shrink:0;white-space:nowrap}.nk-banner{display:flex;align-items:center;gap:10px;font-size:14px;border-radius:8px;padding:10px 14px;margin-bottom:var(--nk-block-space, 8px);color:var(--nk-text)}.nk-banner.info{background:var(--nk-tint-blue)}.nk-banner.success{background:var(--nk-tint-green)}.nk-banner.warning{background:var(--nk-tint-yellow)}.nk-banner.danger{background:var(--nk-tint-red)}.nk-banner .b-action,.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:auto;padding:0;border:0;background:none;color:inherit;font:inherit;font-weight:500;text-align:left;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:auto!important}.nk-avatar-group{display:flex}.nk-avatar-group .mini-avatar,.nk-avatar-group .nk-avatar,.nk-avatar-group ::slotted(.mini-avatar),.nk-avatar-group ::slotted(.nk-avatar){width:26px;height:26px;border-radius:50%;color:var(--nk-on-accent);font-size:10.5px;font-weight:600;border:2px solid var(--nk-bg);display:flex;align-items:center;justify-content:center;margin-left:-7px}.nk-avatar-group .mini-avatar:first-child,.nk-avatar-group .nk-avatar:first-child,.nk-avatar-group ::slotted(.mini-avatar:first-child),.nk-avatar-group ::slotted(.nk-avatar:first-child){margin-left:0}.nk-avatar-group .more,.nk-avatar-group ::slotted(.more){background:var(--nk-bg-callout);color:var(--nk-text-secondary)}.nk-avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;border-radius:50%;overflow:hidden;vertical-align:middle;font-size:10px;font-weight:600;line-height:1;color:var(--nk-on-accent);user-select:none;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));object-fit:cover}.nk-avatar.small{width:20px;height:20px;font-size:9px}.nk-avatar.large{width:32px;height:32px;font-size:12px}.nk-avatar.xlarge{width:56px;height:56px;font-size:20px}.nk-avatar.square{border-radius:4px}.nk-avatar>img,.nk-avatar ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-avatar.gray,.nk-calendar .cal-marks i.gray{background:var(--nk-color-gray)}.nk-avatar.brown,.nk-calendar .cal-marks i.brown{background:var(--nk-color-brown)}.nk-avatar.orange,.nk-calendar .cal-marks i.orange{background:var(--nk-color-orange)}.nk-avatar.yellow,.nk-calendar .cal-marks i.yellow{background:var(--nk-color-yellow)}.nk-avatar.green,.nk-calendar .cal-marks i.green{background:var(--nk-color-green)}.nk-avatar.blue,.nk-calendar .cal-marks i.blue{background:var(--nk-color-blue)}.nk-avatar.purple,.nk-calendar .cal-marks i.purple{background:var(--nk-color-purple)}.nk-avatar.pink,.nk-calendar .cal-marks i.pink{background:var(--nk-color-pink)}.nk-avatar.red,.nk-calendar .cal-marks i.red{background:var(--nk-color-red)}.nk-panels{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:12px;margin:var(--nk-block-space, 12px) 0}.nk-panels.flush{margin:0}.nk-panel{display:flex;flex-direction:column;gap:6px;min-width:0;--_nk-field-min: min(210px, 100%);padding:14px 16px;border:1px solid var(--nk-border);border-radius:10px;background:var(--nk-bg-card);box-shadow:var(--nk-shadow-card);font-size:14px;line-height:1.5;color:inherit;text-decoration:none;text-align:left}:is(a,button).nk-panel{cursor:pointer;font-family:inherit;transition:border-color .15s,background .15s}:is(a,button).nk-panel:hover{border-color:var(--nk-border-strong)}.nk-panel>h3,.nk-panel>.p-head>h3{font-size:14px;font-weight:600;line-height:1.4}.nk-panel ::slotted(h3){font-size:14px;font-weight:600;line-height:1.4;margin:0!important}.nk-panel>p{font-size:13px;color:var(--nk-text-secondary)}.nk-panel ::slotted(p){font-size:13px;color:var(--nk-text-secondary);margin:0!important}.nk-panel>.p-head{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}.nk-panel>.p-head>h3{flex:1 1 auto;min-width:0}.nk-panel .p-end{flex:none;display:flex;align-items:center;gap:6px;margin-left:auto}.nk-panel>.nk-cover{flex:none;height:var(--nk-panel-cover-height);margin:-14px -16px 2px;border-radius:9px 9px 0 0}.nk-panel>.nk-page-icon{font-size:28px}.nk-panel>.nk-cover+.nk-page-icon{margin-top:-24px}.nk-skeleton{border-radius:5px;margin-bottom:var(--nk-block-space, 10px);background:linear-gradient(90deg,var(--nk-bg-callout) 25%,var(--nk-bg-hover) 50%,var(--nk-bg-callout) 75%);background-size:200% 100%;animation:nk-shimmer 1.6s infinite}@keyframes nk-shimmer{to{background-position:-200% 0}}.nk-empty{text-align:center;padding:36px 20px;border:1.5px dashed var(--nk-border-strong);border-radius:10px;color:var(--nk-text-tertiary)}.nk-empty .e-icon,.nk-empty ::slotted(.e-icon),.nk-empty ::slotted([slot="icon"]){font-size:30px;margin-bottom:8px}.nk-empty .e-title,.nk-empty ::slotted(.e-title),.nk-empty ::slotted([slot="title"]){font-weight:500;color:var(--nk-text-secondary);margin-bottom:3px;font-size:14px}.nk-empty .e-desc,.nk-empty ::slotted(.e-desc),.nk-empty ::slotted([slot="desc"]){font-size:13px;margin-bottom:12px}.nk-empty .e-actions,.nk-empty ::slotted(.e-actions){display:flex;flex-wrap:wrap;justify-content:center;gap:8px}.nk-steps{display:flex;flex-direction:column;margin:var(--nk-block-space, 8px) 0;padding:0;list-style:none;font-size:14px}.nk-step{position:relative;display:flex;align-items:flex-start;gap:10px;padding-bottom:14px;line-height:20px;color:var(--nk-text-tertiary)}.nk-step:last-child{padding-bottom:0}.nk-step:not(:last-child):after{content:"";position:absolute;left:10px;top:24px;bottom:4px;width:1px;background:var(--nk-border)}.nk-step .st-mark{flex:none;width:20px;height:20px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--nk-border-strong);background:var(--nk-bg);font-size:11px;font-weight:600;line-height:1}.nk-step .st-desc{display:block;font-size:12px;line-height:18px;color:var(--nk-text-tertiary);font-weight:400}.nk-step.done{color:var(--nk-text-secondary)}.nk-step.done .st-mark{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text);border-color:transparent}.nk-step.current{color:var(--nk-text);font-weight:500}.nk-step.current .st-mark{border-color:var(--nk-accent);color:var(--nk-accent)}.nk-step.skipped .st-mark{border-style:dashed}.nk-step button.st-label,.nk-step a.st-label{font:inherit;color:inherit;text-align:left;text-decoration:none;background:none;border:0;border-radius:3px;cursor:pointer}.nk-step button.st-label:hover,.nk-step a.st-label:hover{text-decoration:underline;text-decoration-color:var(--nk-text-tertiary);text-underline-offset:2px}.nk-step button.st-label:focus-visible,.nk-step a.st-label:focus-visible{outline:2px solid color-mix(in srgb,var(--nk-accent) 60%,transparent);outline-offset:2px}.nk-steps.horizontal{flex-direction:row;align-items:flex-start;gap:10px}.nk-steps.horizontal .nk-step{flex:none;padding-bottom:0;min-width:0;white-space:nowrap}.nk-steps.horizontal .nk-step:not(:last-child){flex:1 1 auto}.nk-steps.horizontal .nk-step:not(:last-child):after{position:static;flex:1 1 16px;width:auto;min-width:16px;height:1px;margin-top:10px}.nk-comments{border-left:1px solid var(--nk-border);padding:4px 0 4px 18px;margin:var(--nk-block-space, 8px) 0 var(--nk-block-space, 8px) 8px}.nk-comment{display:flex;gap:9px;margin-bottom:14px}.nk-comment .mini-avatar,.nk-comment ::slotted(.mini-avatar),.nk-comment ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;color:var(--nk-on-accent);flex-shrink:0;font-size:10px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-comment .c-head,.nk-comment ::slotted(.c-head){font-size:12px;color:var(--nk-text-tertiary);margin-bottom:2px}.nk-comment .c-head b{color:var(--nk-text);font-weight:600}.nk-comment .c-body,.nk-comment ::slotted(.c-body){font-size:14px;line-height:1.5}.nk-comment-input{display:flex;gap:8px;align-items:center;margin-top:4px}.nk-comment-input input{min-width:0;flex:1}.nk-ai-thread{display:flex;flex-direction:column;gap:14px}.nk-ai-msg{display:flex;gap:9px}.nk-ai-msg .mini-avatar,.nk-ai-msg ::slotted(.mini-avatar),.nk-ai-msg ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;background:var(--nk-bg-callout)}.nk-ai-msg.user .mini-avatar,.nk-ai-msg.user ::slotted(.mini-avatar),.nk-ai-msg.user ::slotted([slot="avatar"]){background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:9.5px;font-weight:600}.nk-ai-msg .a-body,.nk-ai-msg ::slotted(.a-body){font-size:14px;line-height:1.55;padding-top:2px}.nk-ai-msg .a-name,.nk-ai-msg ::slotted(.a-name){font-size:12px;font-weight:600;margin-bottom:2px}.nk-ai-msg .a-name span{color:var(--nk-text-tertiary);font-weight:400}.nk-ai-msg.user.bubble{justify-content:flex-end}.nk-ai-msg.bubble .a-body,.nk-ai-msg.bubble ::slotted(.a-body){max-width:85%;padding:6px 12px;border-radius:16px;background:var(--nk-bg-callout)}.nk-ai-actions{display:flex;gap:4px;margin-top:6px}.nk-ai-actions button{font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px;cursor:pointer}.nk-ai-actions ::slotted(button){font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px!important;cursor:pointer}.nk-ai-actions button:hover,.nk-ai-actions ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-ai-input-row{display:flex;align-items:center;gap:8px;margin-top:var(--nk-block-space, 14px);border:1px solid var(--nk-border-strong);border-radius:10px;padding:8px 12px}.nk-ai-input-row:focus-within{border-color:var(--nk-accent)}.nk-ai-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text);min-width:0}.nk-ai-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-ai-send{border:none;background:var(--nk-accent);color:var(--nk-on-accent);border-radius:6px;width:26px;height:26px;cursor:pointer;font-size:13px;flex-shrink:0}.nk-block-host{position:relative;border-radius:var(--nk-radius);margin:var(--nk-block-space, 8px) 0;padding:2px 0 2px 2px;transition:background .15s,box-shadow .15s}.nk-block-host:hover{background:var(--nk-bg-hover)}.nk-block-host:focus-within{background:transparent;box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host.nk-drop-target{box-shadow:0 -2px 0 0 var(--nk-accent);background:transparent}.nk-block-host .nk-block-handle,.nk-block-host ::slotted(.nk-block-handle){position:absolute;left:-26px;top:4px;width:18px;height:20px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:var(--nk-text-tertiary);font-size:13px;cursor:grab;opacity:0;transition:opacity .15s;user-select:none}.nk-block-host:hover .nk-block-handle{opacity:1}.nk-block-host .nk-block-actions{position:absolute;display:flex;gap:1px;z-index:2;opacity:0;transition:opacity .15s;pointer-events:none}.nk-block-host .nk-block-actions.show{opacity:1;pointer-events:auto}.nk-block-host .nk-block-actions button,.nk-block-host .nk-block-actions ::slotted(button){width:20px;height:22px;padding:0;border:none;border-radius:4px;background:transparent;color:var(--nk-text-tertiary);font-family:inherit;font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center}.nk-block-host .nk-block-actions button:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-block-host .nk-block-actions .drag{cursor:grab}.nk-block-host .nk-block-actions .drag:active{cursor:grabbing}.nk-prose,.nk-block-host .ProseMirror{font-family:var(--nk-font);line-height:1.5;color:var(--nk-text);overflow-wrap:break-word}.nk-block-host .ProseMirror{outline:none;min-height:60px;padding:4px 2px}.nk-prose>*+*,.nk-block-host .ProseMirror>*+*{margin-top:6px}.nk-prose h1,.nk-block-host .ProseMirror h1{font-size:1.875em;font-weight:600;line-height:1.3;letter-spacing:-.01em;margin:32px 0 4px}.nk-prose h2,.nk-block-host .ProseMirror h2{font-size:1.5em;font-weight:600;line-height:1.3;margin:24px 0 4px}.nk-prose h3,.nk-block-host .ProseMirror h3{font-size:1.25em;font-weight:600;line-height:1.3;margin:16px 0 2px}.nk-prose :is(h4,h5,h6),.nk-block-host .ProseMirror :is(h4,h5,h6){font-size:1em;font-weight:600;margin:12px 0 0}.nk-prose>:first-child,.nk-block-host .ProseMirror>:first-child{margin-top:0}.nk-prose>:last-child,.nk-block-host .ProseMirror>:last-child{margin-bottom:0}.nk-prose p:empty:before{content:"";display:inline-block}.nk-prose :is(strong,b),.nk-block-host .ProseMirror :is(strong,b){font-weight:600}.nk-prose :is(ul,ol),.nk-block-host .ProseMirror :is(ul,ol){padding-left:24px;margin:4px 0}.nk-prose ul,.nk-block-host .ProseMirror ul{list-style:disc}.nk-prose ol,.nk-block-host .ProseMirror ol{list-style:decimal}.nk-prose li,.nk-block-host .ProseMirror li{margin:2px 0}.nk-prose li::marker,.nk-block-host .ProseMirror li::marker{color:var(--nk-text-tertiary)}.nk-prose ul[data-type=taskList],.nk-block-host .ProseMirror ul[data-type=taskList]{list-style:none;padding-left:2px}.nk-prose ul[data-type=taskList] li,.nk-block-host .ProseMirror ul[data-type=taskList] li{display:flex;gap:8px;align-items:flex-start}.nk-prose ul[data-type=taskList] li>label,.nk-block-host .ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:max(0px,calc((1lh - 16px)/2));user-select:none}.nk-prose ul[data-type=taskList] li>div,.nk-block-host .ProseMirror ul[data-type=taskList] li>div{flex:1;min-width:0}.nk-prose ul[data-type=taskList] input[type=checkbox],.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]{appearance:none;width:16px;height:16px;margin:0;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;position:relative;background:var(--nk-bg);display:block}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked:after,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-prose li[data-checked=true]>div,.nk-block-host .ProseMirror li[data-checked=true]>div{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-prose blockquote,.nk-block-host .ProseMirror blockquote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:12px 0;color:var(--nk-text-secondary)}.nk-prose code,.nk-block-host .ProseMirror code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-prose pre,.nk-block-host .ProseMirror pre{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:16px 20px;margin:12px 0;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;color:var(--nk-text-secondary);overflow-x:auto}.nk-prose pre code,.nk-block-host .ProseMirror pre code{background:none;color:inherit;padding:0;font-size:inherit}.nk-prose hr,.nk-block-host .ProseMirror hr{border:none;border-top:1px solid var(--nk-border);margin:20px 0}.nk-prose a,.nk-block-host .ProseMirror a{color:var(--nk-accent);text-decoration:underline;text-underline-offset:2px}.nk-prose img{max-width:100%;height:auto}.nk-prose table{display:block;width:max-content;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:14px;margin:12px 0}.nk-prose :is(th,td){padding:6px 10px;border:1px solid var(--nk-border);text-align:left;vertical-align:top}.nk-prose th{font-weight:600}.nk-block-host .ProseMirror-gapcursor:after{border-top-color:var(--nk-text)}.nk-block-host .ProseMirror .ProseMirror-selectednode{background:color-mix(in srgb,var(--nk-accent) 8%,transparent)}.nk-block-host .ProseMirror-selectednode{box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 35%,transparent);border-radius:3px}.nk-block-host .ProseMirror ::selection{background:color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host .ProseMirror p.is-editor-empty:first-child:before,.nk-block-host .ProseMirror .is-empty:before{content:attr(data-placeholder);color:var(--nk-text-tertiary);float:left;height:0;pointer-events:none}.nk-block-host .bn-container{font-family:var(--nk-font);color:var(--nk-text);background:transparent}.nk-block-host .bn-editor{padding:4px 2px}.nk-block-host .bn-block-content{font-size:14px;line-height:1.6}.nk-block-host .bn-side-menu{color:var(--nk-text-tertiary)}.nk-block-host .bn-drag-handle{border-radius:4px}.nk-block-host .bn-drag-handle:hover{background:var(--nk-bg-hover)}.nk-block-host .novel-editor{font-family:var(--nk-font);color:var(--nk-text)}.nk-block-host .novel-prose{max-width:none}.nk-slash-menu,.nk-block-host .bn-suggestion-menu,.nk-block-host .tippy-box{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:6px;width:280px;max-height:320px;overflow-y:auto;font-family:var(--nk-font);font-size:14px;color:var(--nk-text)}.nk-slash-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:6px 9px 2px}.nk-slash-item{display:flex;align-items:center;gap:10px;padding:6px 9px;border-radius:5px;cursor:pointer;user-select:none}.nk-slash-item:hover,.nk-slash-item.selected{background:var(--nk-bg-hover)}.nk-slash-item .m-icon,.nk-slash-item ::slotted(.m-icon){width:28px;height:28px;flex-shrink:0;border-radius:4px;background:var(--nk-bg-callout);border:1px solid var(--nk-border);display:flex;align-items:center;justify-content:center;font-size:15px}.nk-slash-item .m-desc{font-size:12px;color:var(--nk-text-tertiary)}.nk-bubble-menu{display:flex;align-items:center;gap:2px;background:var(--nk-bg);border-radius:8px;box-shadow:var(--nk-shadow-menu);padding:4px}.nk-bubble-menu button{font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px;border-radius:5px;cursor:pointer}.nk-bubble-menu ::slotted(button){font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px!important;border-radius:5px;cursor:pointer}.nk-bubble-menu button:hover,.nk-bubble-menu ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-bubble-menu button.active,.nk-bubble-menu ::slotted(button.active){color:var(--nk-accent)}@media(max-width:860px){.nk-sidebar{display:none;position:fixed;inset:0 auto 0 0;z-index:60;transform:translate(-100%);transition:background .25s ease,transform .24s cubic-bezier(.2,.8,.25,1),display .24s allow-discrete}.nk-sidebar.open{display:flex;transform:none}@starting-style{.nk-sidebar.open{transform:translate(-100%)}}.nk-sidebar-backdrop{opacity:0;transition:opacity .24s ease,display .24s allow-discrete}.nk-sidebar-backdrop.open{display:block;opacity:1}@starting-style{.nk-sidebar-backdrop.open{opacity:0}}.nk-sidebar-toggle{display:inline-flex}.nk-sidebar.collapsed{margin-left:0;visibility:visible;transition:background .25s ease,transform .24s cubic-bezier(.2,.8,.25,1),display .24s allow-discrete}.nk-sidebar-collapse{display:none}.nk-tab-bar{display:flex}.nk-tab-bar.fixed+.nk-tab-bar-spacer{display:block}.nk-page{padding-left:max(24px,env(safe-area-inset-left,0px));padding-right:max(24px,env(safe-area-inset-right,0px));padding-bottom:80px}.nk-settings-nav{width:60px;min-width:60px}.nk-settings-nav .label,.nk-settings-nav .nk-section-label,.nk-settings-user .u-text{display:none}.nk-settings-content{padding:24px}.nk-cmdk-backdrop{padding-top:max(6vh,env(safe-area-inset-top,0px))}.nk-cmdk{width:min(560px,96vw)}.nk-stats{flex-wrap:wrap}.nk-breadcrumb{min-width:0}.nk-breadcrumb>.crumb:not(:last-child),.nk-breadcrumb ::slotted(.crumb:not(:last-child)),.nk-breadcrumb>.sep,.nk-breadcrumb ::slotted(.sep),.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){display:none}.nk-breadcrumb>.crumb:last-child,.nk-breadcrumb ::slotted(.crumb:last-child){display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-topbar-actions{flex-shrink:0}.nk-field{flex-wrap:wrap;row-gap:6px}.nk-field .f-control,.nk-field ::slotted(.f-control){max-width:100%;min-width:0}.nk-input,.nk-select,.nk-textarea,.nk-slider{max-width:100%}.nk-prop{flex-direction:column;align-items:stretch}.nk-prop .p-name{flex:none;min-height:26px}.nk-prop .p-value{flex:none;min-height:30px;padding:3px 6px 7px}.nk-steps.horizontal .nk-step:not(.current)>:not(.st-mark){display:none}.nk-pop.sheet{position:fixed!important;inset:auto 0 0!important;width:auto!important;transform:none!important;z-index:106;--_nk-row: 40px;max-height:85dvh;overflow-y:auto;overscroll-behavior:contain;border-radius:14px 14px 0 0;padding:6px max(8px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));box-shadow:0 0 0 100vmax var(--nk-scrim-soft),var(--nk-shadow-menu)}.nk-pop.sheet:before{content:"";display:block;width:36px;height:4px;margin:4px auto 8px;border-radius:2px;background:var(--nk-border-strong)}.nk-pop.sheet.floating{translate:0 100%;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s linear .25s}.nk-pop.sheet.floating.open{translate:none;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s}.nk-pop.sheet,.nk-sheet{--_nk-cell: 44px}.nk-calendar-view .cv-day{min-height:64px;padding:2px 2px 4px}.nk-calendar-view .cv-item{padding:1px 4px;font-size:11px;line-height:16px}.nk-peek-backdrop{pointer-events:auto}.nk-peek-backdrop.open{background-color:var(--nk-scrim-soft)}@starting-style{.nk-peek-backdrop.open{background-color:transparent}}.nk-peek{--_nk-title: 28px;top:auto;left:0;width:auto;max-height:92dvh;border-radius:14px 14px 0 0;translate:0 100%}.nk-peek-backdrop.open .nk-peek{translate:none}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:0 100%}}.nk-peek:before{content:"";flex:none;width:36px;height:4px;margin:10px auto 0;border-radius:2px;background:var(--nk-border-strong)}.nk-peek .pk-bar{height:40px;padding:0 max(8px,env(safe-area-inset-right,0px)) 0 max(8px,env(safe-area-inset-left,0px))}.nk-peek .pk-body{padding:0 max(20px,env(safe-area-inset-right,0px)) max(24px,env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px))}.nk-peek .pk-resize{display:none}.nk-banner{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:baseline}.nk-banner .b-action,.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){grid-column:1 / -1;justify-self:start;margin-left:0}.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:0!important}.nk-app.peek-inset .nk-main{padding-right:0}.nk-dialog-backdrop{flex-direction:column;justify-content:flex-end;padding:max(24px,env(safe-area-inset-top,0px)) 0 0}.nk-dialog{width:100%;max-width:640px;border-radius:14px 14px 0 0;scale:none;translate:0 100%;padding:6px max(20px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px));transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-dialog.wide{width:100%}.nk-dialog-backdrop.open .nk-dialog{translate:none}@starting-style{.nk-dialog-backdrop.open .nk-dialog{translate:0 100%}}.nk-dialog:before{content:"";display:block;width:36px;height:4px;margin:4px auto 14px;border-radius:2px;background:var(--nk-border-strong)}.nk-dialog .dl-actions{flex-direction:column-reverse}:root:has(.nk-tab-bar:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + max(6px,env(safe-area-inset-bottom,0px)) + 6px)}:root:has(.nk-tab-bar.floating:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + 24px + env(safe-area-inset-bottom,0px))}}@media(prefers-reduced-motion:reduce){.nk-skeleton{animation:none;background:var(--nk-bg-callout)}[class*=nk-],[class*=nk-]:before,[class*=nk-]:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}\n',i=e+n,s=e+t+n;(new CSSStyleSheet).replaceSync(s);(new CSSStyleSheet).replaceSync(t);const r=new CSSStyleSheet;r.replaceSync(i);const o={en:{copy:"Copy",copied:"Copied",show:"Show",hide:"Hide",uploadImage:"Upload image",changeImage:"Change image",remove:"Remove",close:"Close",resize:"Resize",today:"Today",previousMonth:"Previous month",nextMonth:"Next month",clear:"Clear",time:"Time",filter:"Filter",sort:"Sort",addFilter:"๏ผ‹ Filter",removeFilter:"Remove filter",search:"Search โ€ฆ",closeSidebar:"Close sidebar",newPage:"๏ผ‹ New page",commentPlaceholder:"Comment โ€ฆ",send:"Send",askPlaceholder:"Ask something โ€ฆ",commandPlaceholder:"Search or type a command โ€ฆ",emojiPlaceholder:"Searchโ€ฆ",toggleTheme:"Toggle light / dark",synced:"โŸณ synced",message:"Message",breadcrumb:"Breadcrumb",commandPalette:"Command palette",comment:"Comment",searchEmoji:"Search emoji",settings:"Settings",title:"Title",changeIcon:"Change icon",add:"Add",more:"More"},de:{copy:"Kopieren",copied:"Kopiert",show:"Zeigen",hide:"Verbergen",uploadImage:"Bild hochladen",changeImage:"Bild รคndern",remove:"Entfernen",close:"SchlieรŸen",resize:"Breite รคndern",today:"Heute",previousMonth:"Voriger Monat",nextMonth:"Nรคchster Monat",clear:"Leeren",time:"Uhrzeit",filter:"Filter",sort:"Sortieren",addFilter:"๏ผ‹ Filter",removeFilter:"Filter entfernen",search:"Suchen โ€ฆ",closeSidebar:"Seitenleiste schlieรŸen",newPage:"๏ผ‹ Neue Seite",commentPlaceholder:"Kommentieren โ€ฆ",send:"Senden",askPlaceholder:"Frag etwas โ€ฆ",commandPlaceholder:"Suchen oder Befehl eingeben โ€ฆ",emojiPlaceholder:"Suchen โ€ฆ",toggleTheme:"Hell / Dunkel",synced:"โŸณ synchronisiert",message:"Nachricht",breadcrumb:"Pfad",commandPalette:"Befehlspalette",comment:"Kommentar",searchEmoji:"Emoji suchen",settings:"Einstellungen",title:"Titel",changeIcon:"Symbol รคndern",add:"Hinzufรผgen",more:"Mehr"}},a={},l=new Set;function h(t,e="*"){const n=String(e).toLowerCase().split("-")[0];a[n]={...a[n],...t};for(const t of l)t()}function d(t="en"){return{...o[String(t).toLowerCase().split("-")[0]]||o.en}}function c(t,e){const n=function(t){for(let e=t;e;e=e.getRootNode?.().host){const t=e.closest?.("[lang]");if(t)return t.getAttribute("lang").toLowerCase().split("-")[0]}return(document.documentElement.lang||"en").toLowerCase().split("-")[0]}(e);return a[n]?.[t]??a["*"]?.[t]??o[n]?.[t]??o.en[t]??t}const p="__nkDefaultTokensInjected";!function(){if("undefined"==typeof document)return;if(globalThis[p])return;globalThis[p]=!0;const e=new CSSStyleSheet;e.replaceSync(`@layer notionkit-defaults { ${t} }`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]}();const u=new Set;function g(){return document.documentElement.getAttribute("data-theme")||"light"}function b(){for(const t of u)t.onStringsChanged()}var m;m=b,l.add(m),"undefined"!=typeof window&&"undefined"!=typeof MutationObserver&&new MutationObserver(t=>{t.some(t=>"data-theme"===t.attributeName)&&function(){const t=g();for(const e of u)e._syncTheme(t)}(),t.some(t=>"lang"===t.attributeName)&&b()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","lang"]});const k=new Map;function _(t){let e=k.get(t);return e||(e=new CSSStyleSheet,e.replaceSync(`\n :host { display: ${t}; }\n :host([hidden]) { display: none; }\n :host([flush]) .nk-wrapper > * { margin-top: 0; margin-bottom: 0; }\n .nk-wrapper { display: contents; }\n `),k.set(t,e)),e}class v extends HTMLElement{static get display(){return"contents"}static get hostStyles(){return null}static get observesLightDom(){return!1}static get lightDomObserverInit(){return{childList:!0,subtree:!0,characterData:!0,attributes:!0}}static get slotAssignment(){return"named"}static get observedAttributes(){return[]}constructor(){super(),this._initialized=!1,this._shadow=this.attachShadow({mode:"open",slotAssignment:this.constructor.slotAssignment});const t=[r,_(this.constructor.display)],e=this.constructor.hostStyles;e&&t.push(e),this._shadow.adoptedStyleSheets=t}connectedCallback(){this._initialized?this._wrapper.setAttribute("data-theme",g()):(this._upgradeOwnProperties(),this._initialized=!0,this._wrapper=document.createElement("div"),this._wrapper.className="nk-wrapper",this._wrapper.setAttribute("data-theme",g()),this._shadow.appendChild(this._wrapper),this.render()),this.setupEvents(),u.add(this),this.constructor.observesLightDom&&(this._lightDomObserver??=new MutationObserver(t=>this.projectLightDom(t)),this._lightDomObserver.observe(this,this.constructor.lightDomObserverInit)),"manual"===this.constructor.slotAssignment&&(this.assignSlots(),this._slotObserver??=new MutationObserver(()=>this.assignSlots()),this._slotObserver.observe(this,{childList:!0}))}disconnectedCallback(){u.delete(this),this._lightDomObserver?.disconnect(),this._slotObserver?.disconnect(),this.teardownEvents()}attributeChangedCallback(t,e,n){this._initialized&&e!==n&&this.onAttributeChanged(t,e,n)}_syncTheme(t){this._wrapper?.setAttribute("data-theme",t)}str(t){return c(t,this)}onStringsChanged(){}_upgradeOwnProperties(){for(const t of Object.keys(this)){if(t.startsWith("_"))continue;let e,n=Object.getPrototypeOf(this);for(;n&&n!==HTMLElement.prototype&&!(e=Object.getOwnPropertyDescriptor(n,t));)n=Object.getPrototypeOf(n);if(!e?.set)continue;const i=this[t];delete this[t],this[t]=i}}render(){}setupEvents(){}teardownEvents(){}onAttributeChanged(t,e,n){}projectLightDom(){}assignSlots(){}refresh(){this.projectLightDom(),"manual"===this.constructor.slotAssignment&&this.assignSlots()}takeTitle(t=this.getAttribute("title")){return null!==t&&(this._titleText=t,this.removeAttribute("title"),!0)}getBoolAttr(t){return this.hasAttribute(t)}setBoolAttr(t,e){e?this.setAttribute(t,""):this.removeAttribute(t)}createElement(t,e=[],n={}){const i=document.createElement(t);e.length&&i.classList.add(...e);for(const[t,e]of Object.entries(n))null!=e&&!1!==e&&i.setAttribute(t,!0===e?"":e);return i}emit(t,e=null){return this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,cancelable:!0,detail:e}))}}class x extends v{static formAssociated=!0;constructor(){super(),this._internals=this.attachInternals()}get form(){return this._internals.form}get validationMessage(){return this._internals.validationMessage}get validity(){return this._internals.validity}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}connectedCallback(){const t=!this._initialized;super.connectedCallback(),t&&this._formDisabled&&this.onFormDisabled(!0)}formResetCallback(){this.resetValue()}formStateRestoreCallback(t,e){this.restoreValue(t,e)}formDisabledCallback(t){this._formDisabled=t,this._initialized&&this.onFormDisabled(t)}resetValue(){}restoreValue(t,e){}onFormDisabled(t){}setFormValue(t,e){this._internals.setFormValue(t,e)}setValidity(t,e,n){this._internals.setValidity(t,e,n)}syncValidityFrom(t){t&&(t.validity.valid?this._internals.setValidity({}):this._internals.setValidity(t.validity,t.validationMessage,t))}}const f=["primary","secondary","danger","danger-solid","topbar","share"];class y extends v{static get observedAttributes(){return["variant","small","disabled","type","href","title","aria-label","aria-haspopup","active"]}render(){this._build()}_build(){const t=this.getAttribute("href"),e=t?this.createElement("a",[],{href:t}):this.createElement("button",[],{type:this.getAttribute("type")||"button"});e.className=this._computeClasses().join(" "),e.appendChild(document.createElement("slot")),this._applyState(e),this._btn?(this._btn.removeEventListener("click",this._onClick),this._btn.replaceWith(e)):this._wrapper.appendChild(e),this._btn=e,this._onClick&&e.addEventListener("click",this._onClick)}_applyState(t){const e=this.getBoolAttr("disabled");"BUTTON"===t.tagName?t.disabled=e:t.setAttribute("aria-disabled",e?"true":"false");const n=this.getAttribute("title");n?t.setAttribute("title",n):t.removeAttribute("title");for(const e of["aria-label","aria-haspopup"]){const n=this.getAttribute(e);n?t.setAttribute(e,n):t.removeAttribute(e)}"sidebar"===this.getAttribute("variant")?t.setAttribute("aria-expanded",this._sidebar()?.open?"true":"false"):t.removeAttribute("aria-expanded")}_sidebar(){return this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar")}_sidebarCollapsed(){return"sidebar"===this.getAttribute("variant")&&!!this._sidebar()?.hasAttribute("collapsed")}setupEvents(){this._onClick=t=>{if(this.getBoolAttr("disabled"))return t.preventDefault(),void t.stopPropagation();if("sidebar"===this.getAttribute("variant")){const t=this._sidebar();return void(t?.hasAttribute("collapsed")&&!matchMedia("(max-width: 860px)").matches?t.expand?.():t?.toggle?.())}const e=this.getAttribute("type");if("submit"===e||"reset"===e){const t=this.closest("form");t&&("submit"===e?t.requestSubmit():t.reset())}},this._onToggle=t=>{"sidebar"===this.getAttribute("variant")&&t.target===this._sidebar()&&this._btn.setAttribute("aria-expanded",t.detail.open?"true":"false")},this._onCollapse=t=>{"sidebar"===this.getAttribute("variant")&&t.target===this._sidebar()&&this._btn.classList.toggle("collapsed",t.detail.collapsed)},this._btn.addEventListener("click",this._onClick),document.addEventListener("nk-toggle",this._onToggle),document.addEventListener("nk-collapse",this._onCollapse),"sidebar"===this.getAttribute("variant")&&(this._btn.className=this._computeClasses().join(" "))}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),document.removeEventListener("nk-toggle",this._onToggle),document.removeEventListener("nk-collapse",this._onCollapse)}onAttributeChanged(t){if(this._btn)switch(t){case"href":this._build();break;case"variant":this._btn.className=this._computeClasses().join(" "),this._applyState(this._btn);break;case"small":case"active":this._btn.className=this._computeClasses().join(" ");break;case"type":"BUTTON"===this._btn.tagName&&this._btn.setAttribute("type",this.getAttribute("type")||"button");break;default:this._applyState(this._btn)}}_computeClasses(){const t=this.getAttribute("variant");if("topbar"===t)return["nk-topbar-btn"];if("share"===t)return["nk-topbar-btn","nk-share-btn"];if("sidebar"===t)return this._sidebarCollapsed()?["nk-topbar-btn","nk-sidebar-toggle","collapsed"]:["nk-topbar-btn","nk-sidebar-toggle"];if("tool"===t)return this.getBoolAttr("active")?["nk-db-tool","active"]:["nk-db-tool"];const e=["nk-btn"];return f.includes(t)&&e.push(t),this.getBoolAttr("small")&&e.push("small"),e}focus(t){this._btn?.focus(t)}click(){this._btn?.click()}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get type(){return this.getAttribute("type")||"button"}set type(t){this.setAttribute("type",t)}get href(){return this.getAttribute("href")}set href(t){t?this.setAttribute("href",t):this.removeAttribute("href")}}customElements.define("nk-btn",y);const w=["type","placeholder","name","min","max","step","autocomplete","pattern","maxlength","minlength","inputmode","list","aria-label"],A=["required","disabled","readonly"];class E extends x{static get observedAttributes(){return["value","wide",...w,...A]}render(){this._input=this.createElement("input",["nk-input"]);for(const t of w)this._forward(t);for(const t of A)this._forward(t);this._input.value=this.getAttribute("value")??"",this._defaultValue=this._input.value,this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(A.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??"",this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}select(){this._input?.select()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get type(){return this.getAttribute("type")||"text"}set type(t){this.setAttribute("type",t)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(t){this.setAttribute("placeholder",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get readonly(){return this.getBoolAttr("readonly")}set readonly(t){this.setBoolAttr("readonly",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-input",E);const C=["placeholder","name","rows","maxlength","minlength","autocomplete","aria-label"],B=["required","disabled","readonly"];class L extends x{static get observedAttributes(){return["value","wide",...C,...B]}render(){this._input=this.createElement("textarea",["nk-textarea"]);for(const t of[...C,...B])this._forward(t);this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(B.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-textarea",L);class S extends x{static get observedAttributes(){return["value","name","disabled","required","compact","wide","aria-label"]}static get observesLightDom(){return!0}render(){this._select=this.createElement("select",["nk-select"]),this._forwardAll(),this._wrapper.appendChild(this._select),this._defaultValue=this.getAttribute("value"),this._pending=this._defaultValue,this.projectLightDom(),requestAnimationFrame(()=>this.projectLightDom())}_forwardAll(){const t=this.getAttribute("name");t?this._select.setAttribute("name",t):this._select.removeAttribute("name");const e=this.getAttribute("aria-label");e?this._select.setAttribute("aria-label",e):this._select.removeAttribute("aria-label"),this._select.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._select.required=this.getBoolAttr("required"),this._select.classList.toggle("compact",this.getBoolAttr("compact")),this._select.classList.toggle("wide",this.getBoolAttr("wide"))}projectLightDom(){if(!this._select)return;const t=[...this.children].filter(t=>t.matches("option, optgroup")),e=t.map(t=>t.outerHTML).join("");if(e===this._optionSignature)return;this._optionSignature=e;const n=this._select.selectedIndex>=0?this._select.value:null;this._select.innerHTML="";for(const e of t)this._select.appendChild(e.cloneNode(!0));null!=this._pending?this._applyValue(this._pending)&&(this._pending=null):this._applyValue(n),this._syncFormValue()}_applyValue(t){return null!==t&&(!![...this._select.options].some(e=>e.value===t)&&(this._select.value=t,!0))}setupEvents(){this._onChange=()=>{this._pending=null,this._syncFormValue(),this.emit("nk-change",{value:this._select.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._select.addEventListener("change",this._onChange)}teardownEvents(){this._select?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._select){if("value"===t){const t=this.getAttribute("value");return this._pending=null===t||this._applyValue(t)?null:t,void this._syncFormValue()}this._forwardAll(),this._syncFormValue()}}_syncFormValue(){this.setFormValue(this._select.value),this.syncValidityFrom(this._select)}resetValue(){this._pending=null,this._applyValue(this._defaultValue)||(this._select.selectedIndex=0),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._applyValue(t),this._syncFormValue())}onFormDisabled(t){this._select.disabled=t||this.getBoolAttr("disabled")}focus(t){this._select?.focus(t)}get value(){return this._pending??this._select?.value??""}set value(t){const e=null==t?"":String(t);this._select?(this._pending=this._applyValue(e)?null:e,this._syncFormValue()):this.setAttribute("value",e)}get selectedIndex(){return this._select?.selectedIndex??-1}get options(){return this._select?.options??[]}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-select",S);class z extends x{static get observedAttributes(){return["checked","disabled","name","value","label","text"]}render(){this._row=this.createElement("label",["nk-switch-label"]),this._btn=this.createElement("button",["nk-switch"],{type:"button",role:"switch"}),this._text=document.createElement("span"),this._slot=document.createElement("slot"),this._textNode=document.createTextNode(""),this._slot.appendChild(this._textNode),this._text.appendChild(this._slot),this._row.append(this._btn,this._text),this._defaultChecked=this.getBoolAttr("checked"),this._apply(),this._syncText(),this._wrapper.appendChild(this._row),this._syncFormValue()}_apply(){this._btn.setAttribute("aria-checked",this.getBoolAttr("checked")?"true":"false"),this._btn.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("label");t?this._btn.setAttribute("aria-label",t):this._btn.removeAttribute("aria-label")}_syncText(){const t=this.getAttribute("text")??"";this._textNode.data!==t&&(this._textNode.data=t);const e=!(!this.getAttribute("text")&&!this._slot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim()));this._text.hidden=!e,this._row.style.display=e?"":"contents"}setupEvents(){this._onClick=()=>this.toggle(),this._onSlot=()=>this._syncText(),this._btn.addEventListener("click",this._onClick),this._slot.addEventListener("slotchange",this._onSlot),this._syncText()}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),this._slot?.removeEventListener("slotchange",this._onSlot)}toggle(){this.getBoolAttr("disabled")||this._formDisabled||(this.checked=!this.checked,this.emit("nk-change",{checked:this.checked,value:this.getAttribute("value")||"on",name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){this._btn&&("text"!==t?(this._apply(),this._syncFormValue()):this._syncText())}_syncFormValue(){const t=this.getAttribute("value")||"on";this.setFormValue(this.getBoolAttr("checked")?t:null,this.getBoolAttr("checked")?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._btn?.focus(t)}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}}customElements.define("nk-switch",z);class T extends x{static get observedAttributes(){return["checked","disabled","name","value","text","indeterminate","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"checkbox"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.indeterminate=this.getBoolAttr("indeterminate"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this.removeAttribute("indeterminate"),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get indeterminate(){return this.getBoolAttr("indeterminate")}set indeterminate(t){this.setBoolAttr("indeterminate",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-check",T);const D={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function M(t){return(void 0!==t.form?t.form:t.closest("form"))??null}function N(t){const e=t.filter(t=>!t.disabled);if(!e.length)return;const n=e.find(t=>t.checked)||e[0];for(const e of t)e._input&&(e._input.tabIndex=e===n?0:-1)}class F extends x{static get observedAttributes(){return["checked","disabled","name","value","text","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"radio"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue(),this._input.checked&&this._uncheckPeers(),N(this._group())}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>this._applyChange(),this._onKeyDown=t=>{const e=D[t.key];if(!e||t.ctrlKey||t.metaKey||t.altKey)return;const n=this._group().filter(t=>!t.disabled);if(n.length<2)return;t.preventDefault();const i=n[(n.indexOf(this)+e+n.length)%n.length];i._input.focus(),i._input.checked=!0,i._applyChange()},this._input.addEventListener("change",this._onChange),this._input.addEventListener("keydown",this._onKeyDown),N(this._group())}teardownEvents(){this._input?.removeEventListener("change",this._onChange),this._input?.removeEventListener("keydown",this._onKeyDown)}_applyChange(){this._input.checked&&this._uncheckPeers(),this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),N(this._group()),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))}_group(){const t=this.getAttribute("name"),e=this.getRootNode();if(!t||"function"!=typeof e?.querySelectorAll)return[this];const n=M(this);return[...e.querySelectorAll("nk-radio")].filter(e=>e.getAttribute("name")===t&&M(e)===n)}_uncheckPeers(){for(const t of this._group())t!==this&&t.checked&&(t.checked=!1)}onAttributeChanged(t){!this._syncing&&this._input&&(this._apply(),"checked"===t&&this._input.checked&&this._uncheckPeers(),this._syncFormValue(),N(this._group()))}_syncFormValue(){const t=this.getAttribute("value")||"";this.setFormValue(this._input.checked?t:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this._input.checked=this._defaultChecked,this.setBoolAttr("checked",this._defaultChecked),this._syncFormValue(),N(this._group())}restoreValue(t){"checked"===t&&(this.checked=!0)}onFormDisabled(t){this._formDisabled=t,this._apply(),N(this._group())}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this._input&&(this._input.checked=t),t&&this._uncheckPeers(),this.setBoolAttr("checked",t),this._input&&(this._syncFormValue(),N(this._group()))}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}customElements.define("nk-radio",F);const I=["name","min","max","step","aria-label"];class V extends x{static get observedAttributes(){return["value","disabled","show-value","unit",...I]}render(){this._input=this.createElement("input",["nk-slider"],{type:"range"}),this._out=this.createElement("div",["nk-slider-value"]),this._apply(),this._input.value=this.getAttribute("value")??this._input.value,this._defaultValue=this._input.value,this._wrapper.appendChild(this._input),this._wrapper.appendChild(this._out),this._syncOut(),this._syncFormValue()}_apply(){for(const t of I){const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._out.style.display=this.getBoolAttr("show-value")?"":"none"}_syncOut(){this._out.textContent=`${this._input.value}${this.getAttribute("unit")||""}`}setupEvents(){this._onInput=()=>{this._syncOut(),this._syncFormValue(),this.emit("nk-input",{value:Number(this._input.value),name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:Number(this._input.value),name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){this._input&&("value"===t?this._input.value=this.getAttribute("value")??"":this._apply(),this._syncOut(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.value)}resetValue(){this._input.value=this._defaultValue,this._syncOut(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncOut(),this._syncFormValue())}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get value(){return Number(this._input?.value??this.getAttribute("value"))}set value(t){this._input?(this._input.value=t,this._syncOut(),this._syncFormValue()):this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get showValue(){return this.getBoolAttr("show-value")}set showValue(t){this.setBoolAttr("show-value",t)}}customElements.define("nk-slider",V);const j=["nk-input","nk-textarea","nk-select"];class q extends v{static get observedAttributes(){return["label","desc","stacked","compact"]}render(){this._field=this.createElement("div",["nk-field"]);const t=document.createElement("div");this._label=this.createElement("div",["f-label"]);const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),this._desc=this.createElement("div",["f-desc"]);const n=this.createElement("slot",[],{name:"desc"});n.appendChild(this._desc),t.appendChild(e),t.appendChild(n);const i=this.createElement("div",["f-control"]);this._slot=document.createElement("slot"),i.appendChild(this._slot),this._field.appendChild(t),this._field.appendChild(i),this._wrapper.appendChild(this._field),this._widened=new Set,this._sync()}setupEvents(){this._onSlot=()=>this._syncWide(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(){this._sync()}get stacked(){return this.getBoolAttr("stacked")||!!this.closest("nk-fields")}set stacked(t){this.setBoolAttr("stacked",t)}get compact(){return this.getBoolAttr("compact")||!!this.closest("nk-fields")}set compact(t){this.setBoolAttr("compact",t)}_sync(){if(!this._label)return;this._label.textContent=this.getAttribute("label")||"";const t=this.getAttribute("desc");this._desc.textContent=t||"",this._desc.style.display=t?"":"none",this._field.classList.toggle("stacked",this.stacked),this._field.classList.toggle("compact",this.compact),this._syncWide()}_syncWide(){if(!this._slot)return;const t=this.stacked;for(const e of this._slot.assignedElements())j.includes(e.localName)&&(t&&!e.hasAttribute("wide")?(e.setAttribute("wide",""),this._widened.add(e)):!t&&this._widened.has(e)&&(e.removeAttribute("wide"),this._widened.delete(e)))}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}get desc(){return this.getAttribute("desc")}set desc(t){null==t?this.removeAttribute("desc"):this.setAttribute("desc",t)}}customElements.define("nk-field",q);class K extends v{static get observedAttributes(){return["fit"]}render(){this._grid=this.createElement("div",["nk-fields"]),this._grid.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._grid),this.onAttributeChanged()}onAttributeChanged(){this._grid?.classList.toggle("fit",this.getBoolAttr("fit"))}get fit(){return this.getBoolAttr("fit")}set fit(t){this.setBoolAttr("fit",t)}}customElements.define("nk-fields",K);const O=["gray","brown","orange","yellow","green","blue","purple","pink","red"];class P extends v{static get observedAttributes(){return["color"]}render(){this._tag=this.createElement("span",this._computeClasses()),this._tag.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tag)}onAttributeChanged(){this._tag&&(this._tag.className=this._computeClasses().join(" "))}_computeClasses(){const t=["nk-tag"],e=this.getAttribute("color");return O.includes(e)&&t.push(e),t}get color(){return this.getAttribute("color")}set color(t){t?this.setAttribute("color",t):this.removeAttribute("color")}}customElements.define("nk-tag",P);class R extends v{static get observedAttributes(){return["value","max","label","wide"]}render(){this._bar=this.createElement("span",["nk-progress"],{role:"progressbar"}),this._fill=document.createElement("i"),this._bar.appendChild(this._fill),this._label=this.createElement("span",["nk-progress-label"]),this._wrapper.appendChild(this._bar),this._wrapper.appendChild(this._label),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._bar)return;const t=Number(this.getAttribute("max"))||100,e=Math.min(t,Math.max(0,Number(this.getAttribute("value"))||0));this._fill.style.width=e/t*100+"%",this._bar.classList.toggle("wide",this.getBoolAttr("wide")),this._bar.setAttribute("aria-valuenow",e),this._bar.setAttribute("aria-valuemin",0),this._bar.setAttribute("aria-valuemax",t);const n=this.getAttribute("label");this._label.textContent=n??"",this._label.style.display=null===n?"none":""}get value(){return Number(this.getAttribute("value"))||0}set value(t){this.setAttribute("value",t)}get max(){return Number(this.getAttribute("max"))||100}set max(t){this.setAttribute("max",t)}get label(){return this.getAttribute("label")}set label(t){null==t?this.removeAttribute("label"):this.setAttribute("label",t)}}customElements.define("nk-progress",R);class $ extends v{static get observedAttributes(){return["icon"]}render(){this._box=this.createElement("div",["nk-callout"]),this._icon=this.createElement("span",["c-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon);const e=document.createElement("div");e.appendChild(document.createElement("slot")),this._box.appendChild(t),this._box.appendChild(e),this._wrapper.appendChild(this._box),this._syncIcon()}onAttributeChanged(){this._syncIcon()}_syncIcon(){this._icon&&(this._icon.textContent=this.getAttribute("icon")||"๐Ÿ’ก")}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}}customElements.define("nk-callout",$);class H extends v{render(){this._wrapper.appendChild(this.createElement("hr",["nk-divider"]))}}customElements.define("nk-divider",H);class W extends v{static get observedAttributes(){return["level"]}render(){this._build()}_build(){const t=Math.min(4,Math.max(1,Number(this.getAttribute("level"))||2)),e=this.createElement(`h${t}`,["nk-heading"]);e.appendChild(document.createElement("slot")),this._heading?this._heading.replaceWith(e):this._wrapper.appendChild(e),this._heading=e}onAttributeChanged(){this._build()}get level(){return Number(this.getAttribute("level"))||2}set level(t){this.setAttribute("level",t)}}customElements.define("nk-heading",W);class U extends v{static get observedAttributes(){return["label","open"]}render(){this._details=this.createElement("details",["nk-toggle"]);const t=document.createElement("summary");this._label=document.createElement("span");const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),t.appendChild(e);const n=this.createElement("div",["toggle-body"]);n.appendChild(document.createElement("slot")),this._details.appendChild(t),this._details.appendChild(n),this._details.open=this.getBoolAttr("open"),this._wrapper.appendChild(this._details),this._sync()}setupEvents(){this._onToggle=()=>{this._syncing=!0,this.setBoolAttr("open",this._details.open),this._syncing=!1,this.emit("nk-toggle",{open:this._details.open})},this._details.addEventListener("toggle",this._onToggle)}teardownEvents(){this._details?.removeEventListener("toggle",this._onToggle)}onAttributeChanged(t){this._details&&("open"!==t?this._sync():this._syncing||(this._details.open=this.getBoolAttr("open")))}_sync(){this._label.textContent=this.getAttribute("label")||""}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}}customElements.define("nk-toggle",U);class G extends x{static get observedAttributes(){return["checked","disabled","name","value"]}render(){const t=this.createElement("label",["nk-todo"]);this._input=this.createElement("input",[],{type:"checkbox"}),this._apply(),this._defaultChecked=this.getBoolAttr("checked");const e=document.createElement("span");e.appendChild(document.createElement("slot")),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on"}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-todo",G);class Y extends v{render(){const t=this.createElement("kbd",["nk-kbd"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-kbd",Y);class Q extends v{static get observedAttributes(){return["lang","highlight"]}static get observesLightDom(){return!0}render(){this._box=this.createElement("div",["nk-code"]),this._lang=this.createElement("span",["lang"]),this._slot=document.createElement("slot"),this._pre=this.createElement("span",["hl"]),this._box.appendChild(this._lang),this._box.appendChild(this._slot),this._box.appendChild(this._pre),this._wrapper.appendChild(this._box),this._sync(),this.projectLightDom()}onAttributeChanged(){this._sync(),this.projectLightDom()}_sync(){if(!this._lang)return;const t=this.getAttribute("lang");this._lang.textContent=t||"",this._lang.style.display=t?"":"none"}projectLightDom(){if(!this._pre)return;const t=this.hasAttribute("highlight");if(this._slot.style.display=t?"none":"",this._pre.style.display=t?"":"none",!t)return;const e=this.textContent.replace(/^\n/,"");var n;e!==this._lastText&&(this._lastText=e,this._pre.innerHTML=(n=e,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")).replace(/&lt;(\/?)([a-zA-Z][\w-]*)([^&]*?)(\/?)&gt;/g,(t,e,n,i,s)=>`&lt;${e}<span class="tag">${n}</span>${i.replace(/([\w-]+)(=)("[^"]*"|'[^']*')?/g,(t,e,n,i)=>`<span class="attr">${e}</span>${n}${i??""}`)}${s}&gt;`))}get lang(){return this.getAttribute("lang")}set lang(t){null==t?this.removeAttribute("lang"):this.setAttribute("lang",t)}}customElements.define("nk-code",Q);class X extends v{static get observedAttributes(){return["cite"]}render(){this._quote=this.createElement("blockquote",["nk-quote"]),this._quote.appendChild(document.createElement("slot")),this._cite=this.createElement("cite",["q-cite"]),this._quote.appendChild(this._cite),this._wrapper.appendChild(this._quote),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._cite)return;const t=this.getAttribute("cite");this._cite.textContent=t||"",this._cite.style.display=t?"":"none"}get cite(){return this.getAttribute("cite")}set cite(t){null==t?this.removeAttribute("cite"):this.setAttribute("cite",t)}}customElements.define("nk-quote",X);class Z extends v{static get observedAttributes(){return["peek-inset"]}render(){const t=this._app=this.createElement("div",["nk-app"]);t.classList.toggle("peek-inset",this.getBoolAttr("peek-inset")),t.appendChild(this.createElement("slot",[],{name:"sidebar"}));const e=this.createElement("main",["nk-main"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t)}onAttributeChanged(){this._app.classList.toggle("peek-inset",this.getBoolAttr("peek-inset"))}}customElements.define("nk-app",Z);let J=0,tt="";function et(){0===J++&&(tt=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function nt(){J>0&&0===--J&&(document.documentElement.style.overflow=tt)}function it(t){const e=[];let n=t;for(;n&&n!==document.body;){const t=(n.parentNode,ShadowRoot,n.parentNode);if(!t)break;for(const i of t.children)i===n||i.inert||/^(SCRIPT|STYLE|LINK|TEMPLATE)$/.test(i.tagName)||i.matches("nk-menu[floating], nk-calendar[floating], nk-tooltip, nk-toast")||(i.inert=!0,e.push(i));n=t instanceof ShadowRoot?t.host:t}return()=>{for(const t of e)t.inert=!1}}function st(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function rt(t){const e=t=>{for(const n of t.querySelectorAll("*")){if(n.matches('a[href], button:not([disabled]), input:not([disabled]):not([type=hidden]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable="true"], [contenteditable="plaintext-only"]')&&n.getClientRects().length)return n;if(n.shadowRoot){const t=e(n.shadowRoot);if(t)return t}}return null};return e(t)}class ot extends v{static get observedAttributes(){return["open","collapsible","collapsed","collapse-label"]}render(){this._backdrop=this.createElement("div",["nk-sidebar-backdrop"]),this._aside=this.createElement("aside",["nk-sidebar"]);const t=this.createElement("div",["nk-sidebar-head"]);this._collapse=this.createElement("button",["nk-sidebar-collapse"],{type:"button","data-tooltip-key":"โŒ˜\\"}),this._collapse.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m18 17-5-5 5-5M11 17l-5-5 5-5"/></svg>',t.append(this.createElement("slot",[],{name:"workspace"}),this._collapse),this._aside.appendChild(t);const e=this.createElement("div",["nk-sidebar-scroll"]);e.appendChild(document.createElement("slot")),this._aside.appendChild(e),this._footer=this.createElement("div",["nk-sidebar-footer"]),this._footerSlot=this.createElement("slot",[],{name:"footer"}),this._footer.appendChild(this._footerSlot),this._aside.appendChild(this._footer),this._wrapper.appendChild(this._backdrop),this._wrapper.appendChild(this._aside),this._syncFooter(),this._syncOpen(),this._syncCollapse()}_syncCollapse(){const t=this.getAttribute("collapse-label")||this.str("closeSidebar");this._collapse.hidden=!this.getBoolAttr("collapsible"),this._collapse.setAttribute("aria-label",t),this._collapse.dataset.tooltip=t,this._aside.classList.toggle("collapsed",this.getBoolAttr("collapsed"))}_toggleButton(){const t='nk-btn[variant="sidebar"]';return this.closest("nk-app")?.querySelector(t)??document.querySelector(t)}_syncOpen(){const t=this.getBoolAttr("open");this._aside.classList.toggle("open",t),this._backdrop.classList.toggle("open",t)}_syncFooter(){const t=this._footerSlot.assignedElements();this._footer.style.display=t.length?"":"none";for(const e of t)"nk-tree-item"===e.localName&&e.setAttribute("compact","")}setupEvents(){this._onSlot=()=>this._syncFooter(),this._onBackdrop=()=>this.close(),this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close(),"\\"===t.key&&(t.metaKey||t.ctrlKey)&&this.getBoolAttr("collapsible")&&!t.defaultPrevented&&(t.preventDefault(),matchMedia("(max-width: 860px)").matches?this.toggle():this.toggleCollapsed())},this._onCollapse=()=>this.collapse(),this._footerSlot.addEventListener("slotchange",this._onSlot),this._backdrop.addEventListener("click",this._onBackdrop),this._collapse.addEventListener("click",this._onCollapse),document.addEventListener("keydown",this._onKey)}teardownEvents(){this._footerSlot?.removeEventListener("slotchange",this._onSlot),this._backdrop?.removeEventListener("click",this._onBackdrop),this._collapse?.removeEventListener("click",this._onCollapse),document.removeEventListener("keydown",this._onKey)}onStringsChanged(){this._syncCollapse()}onAttributeChanged(t){if("open"===t)return this._syncOpen(),void this.emit("nk-toggle",{open:this.getBoolAttr("open")});const e=st(),n=e&&(this.contains(e)||this._shadow.contains(e)),i=e?.closest?.(".nk-sidebar-toggle");if(this._syncCollapse(),"collapsed"!==t)return;const s=this.getBoolAttr("collapsed");this.emit("nk-collapse",{collapsed:s});const r=t=>requestAnimationFrame(()=>requestAnimationFrame(t));s&&n&&r(()=>this._toggleButton()?.focus({preventScroll:!0})),s||!i||this._collapse.hidden||r(()=>this._collapse.focus({preventScroll:!0}))}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}collapse(){this.setBoolAttr("collapsed",!0)}expand(){this.setBoolAttr("collapsed",!1)}toggleCollapsed(){this.setBoolAttr("collapsed",!this.getBoolAttr("collapsed"))}get collapsed(){return this.getBoolAttr("collapsed")}set collapsed(t){this.setBoolAttr("collapsed",t)}}customElements.define("nk-sidebar",ot);const at=new CSSStyleSheet;at.replaceSync("\n .nk-ws-anchor { position: relative; flex: 1 1 auto; min-width: 0; }\n .nk-ws-menu { display: none; position: absolute; left: 8px; top: calc(100% - 2px); z-index: 50; }\n :host([open]) .nk-ws-menu { display: block; }\n");class lt extends v{static get hostStyles(){return at}static get observedAttributes(){return["name","avatar","open"]}render(){this._row=this.createElement("div",["nk-workspace"],{role:"button",tabindex:"0","aria-haspopup":"menu"}),this._avatar=this.createElement("div",["avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._name=document.createElement("span");const e=this.createElement("span",["chev"]);e.textContent="โŒ„",this._row.append(t,this._name,e),this._menu=this.createElement("div",["nk-ws-menu"]),this._menu.appendChild(this.createElement("slot",[],{name:"menu"}));const n=this.createElement("div",["nk-ws-anchor"]);n.append(this._row,this._menu),this._wrapper.appendChild(n),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t,this._avatar.textContent=this.getAttribute("avatar")||t.trim().charAt(0).toUpperCase(),this._row.setAttribute("aria-expanded",this.getBoolAttr("open")?"true":"false")}setupEvents(){this._onClick=()=>this.toggle(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onDocKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onMenuSelect=()=>this.close(),this._row.addEventListener("click",this._onClick),this._row.addEventListener("keydown",this._onKey),this._menu.addEventListener("nk-select",this._onMenuSelect),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKey)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._row?.removeEventListener("keydown",this._onKey),this._menu?.removeEventListener("nk-select",this._onMenuSelect),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKey)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}}customElements.define("nk-workspace-switcher",lt);class ht extends v{static get observedAttributes(){return["label","addable"]}render(){this._box=this.createElement("div",["nk-section-label"]),this._text=document.createElement("span"),this._text.appendChild(document.createElement("slot")),this._plus=this.createElement("span",["plus"],{role:"button",title:"+"}),this._plus.textContent="๏ผ‹",this._box.append(this._text,this._plus),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("label");null!==t&&(this._text.textContent=t),this._plus.style.display=this.getBoolAttr("addable")?"":"none"}setupEvents(){this._onPlus=t=>{t.stopPropagation(),this.emit("nk-action",{action:"add"})},this._plus.addEventListener("click",this._onPlus)}teardownEvents(){this._plus?.removeEventListener("click",this._onPlus)}onAttributeChanged(){this._sync()}get addable(){return this.getBoolAttr("addable")}set addable(t){this.setBoolAttr("addable",t)}}customElements.define("nk-section-label",ht);const dt=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]);class ct extends v{static get observedAttributes(){return["manual"]}render(){const t=this.createElement("div",[],{role:"tree"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._box=t}setActive(t){if(!this.getBoolAttr("manual")){for(const e of this.querySelectorAll("nk-tree-item[active]"))e!==t&&e.removeAttribute("active");t.setAttribute("active",""),this._syncTabIndex(t)}}setupEvents(){this._onKey=t=>{if(!dt.has(t.key)||t.ctrlKey||t.metaKey||t.altKey)return;const e=t.target.closest?.("nk-tree-item");if(!e)return;const n=this.visibleItems(),i=n.indexOf(e);if(i<0)return;let s=null;switch(t.key){case"ArrowDown":s=n[i+1];break;case"ArrowUp":s=n[i-1];break;case"Home":s=n[0];break;case"End":s=n[n.length-1];break;case"ArrowRight":e.hasChildren&&!e.open?e.open=!0:e.hasChildren&&(s=e.querySelector("nk-tree-item"));break;case"ArrowLeft":e.hasChildren&&e.open?e.open=!1:s=e.parentElement?.closest("nk-tree-item")}t.preventDefault(),s&&(this._syncTabIndex(s),s.focus())},this._onSlot=()=>this._syncTabIndex(),this.addEventListener("keydown",this._onKey),this._box.querySelector("slot").addEventListener("slotchange",this._onSlot),this._syncTabIndex()}teardownEvents(){this.removeEventListener("keydown",this._onKey),this._box?.querySelector("slot").removeEventListener("slotchange",this._onSlot)}visibleItems(){return[...this.querySelectorAll("nk-tree-item")].filter(t=>{for(let e=t.parentElement?.closest("nk-tree-item");e&&this.contains(e);e=e.parentElement?.closest("nk-tree-item"))if(!e.open)return!1;return!0})}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._syncTabIndex()}))}_syncTabIndex(t){const e=[...this.querySelectorAll("nk-tree-item")];if(!e.length)return;const n=this.visibleItems(),i=t||n.find(t=>t.active)||n[0];for(const t of e)t.setTabbable?.(t===i)}set data(t){this._data=t;const e=t=>t.map(t=>{const n=document.createElement("nk-tree-item");return t.icon&&n.setAttribute("icon",t.icon),null!=t.value&&n.setAttribute("value",t.value),t.href&&n.setAttribute("href",t.href),t.open&&n.setAttribute("open",""),t.active&&n.setAttribute("active",""),n.append(document.createTextNode(t.label??""),...e(t.children||[])),n});for(const t of this.querySelectorAll(":scope > nk-tree-item"))t.remove();this.append(...e(t||[]))}get data(){return this._data}get activeItem(){return this.querySelector("nk-tree-item[active]")}get value(){return this.activeItem?.value??null}}customElements.define("nk-tree",ct);class pt extends v{static get slotAssignment(){return"manual"}static get observedAttributes(){return["label","icon","value","href","active","open","compact","no-actions"]}render(){this._row=this.createElement("div",["nk-tree-item"],{role:"treeitem",tabindex:"-1"}),this._arrow=this.createElement("span",["nk-toggle-arrow"],{"aria-hidden":"true"}),this._arrow.textContent="โ–ธ",this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"]),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=this.createElement("slot",[],{name:"label"}),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._actions=this.createElement("span",["actions"]);for(const[t,e,n]of[["add","๏ผ‹",this.str("add")],["more","โ‹ฏ",this.str("more")]]){const i=this.createElement("span",[],{"data-action":t,role:"button",title:n});i.textContent=e,this._actions.appendChild(i)}this._endSlot=this.createElement("slot",[],{name:"end"}),this._row.append(this._arrow,this._iconSlot,this._label,this._actions,this._endSlot),this._children=this.createElement("div",["nk-tree-children"],{role:"group"}),this._childSlot=this.createElement("slot",[],{name:"children"}),this._children.appendChild(this._childSlot),this._wrapper.append(this._row,this._children),this._sync(),this.closest("nk-tree")?.requestSync?.()}assignSlots(){if(!this._row)return;const t=[],e=[],n=[],i=[];for(const s of this.childNodes)if(s.nodeType===Node.ELEMENT_NODE){const r=s.getAttribute("slot");"icon"===r?t.push(s):"end"===r?e.push(s):"nk-tree-item"===s.localName?n.push(s):i.push(s)}else s.nodeType===Node.TEXT_NODE&&i.push(s);this._iconSlot.assign(...t),this._endSlot.assign(...e),this._childSlot.assign(...n),this._labelSlot.assign(...this.hasAttribute("label")?[]:i),this._hasChildren=n.length>0,this._hasEnd=e.length>0,this._sync()}_sync(){const t=this.getBoolAttr("active"),e=this.getBoolAttr("open");this._row.classList.toggle("active",t),this._row.classList.toggle("compact",this.getBoolAttr("compact")),this._row.setAttribute("aria-selected",t?"true":"false"),this._arrow.classList.toggle("open",e),this._arrow.style.display=this._hasChildren?"":"none",this._hasChildren?this._row.setAttribute("aria-expanded",e?"true":"false"):this._row.removeAttribute("aria-expanded"),this._children.classList.toggle("collapsed",!e||!this._hasChildren);const n=this.getAttribute("icon")||"";this._icon.textContent!==n&&(this._icon.textContent=n),this._icon.style.display=n?"":"none";const i=this.getAttribute("label")||"";this._labelText.data!==i&&(this._labelText.data=i);const s=!this.getBoolAttr("no-actions")&&!this._hasEnd;s&&!this._actions.isConnected&&this._row.insertBefore(this._actions,this._endSlot),!s&&this._actions.isConnected&&this._actions.remove();const r=this.getAttribute("href");r?this._row.setAttribute("data-href",r):this._row.removeAttribute("data-href")}setupEvents(){this._onRowClick=t=>{const e=t.target.closest?.("[data-action]");return e?(t.stopPropagation(),void this.emit("nk-action",{action:e.dataset.action,value:this.value,label:this.label})):t.target===this._arrow||this._arrow.contains(t.target)?(t.stopPropagation(),void this.toggle()):void this.select()},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._row.addEventListener("click",this._onRowClick),this._row.addEventListener("keydown",this._onKey)}teardownEvents(){this._row?.removeEventListener("click",this._onRowClick),this._row?.removeEventListener("keydown",this._onKey)}onStringsChanged(){for(const t of this._actions.children)t.title=this.str(t.dataset.action)}onAttributeChanged(t){"label"===t?this.assignSlots():this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open"),value:this.value})}select(){if(!this.emit("nk-select",{value:this.value,label:this.label,href:this.getAttribute("href"),item:this}))return;const t=this.closest("nk-tree");t?t.setActive(this):this.setBoolAttr("active",!0),this.getAttribute("href")&&location.assign(this.getAttribute("href"))}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}focus(t){this._row?.focus(t)}setTabbable(t){this._row&&(this._row.tabIndex=t?0:-1)}get tabbable(){return 0===this._row?.tabIndex}get hasChildren(){return!!this._hasChildren}get label(){return this.getAttribute("label")??this._labelSlot?.assignedNodes().map(t=>t.textContent).join("").trim()??""}set label(t){this.setAttribute("label",t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}}customElements.define("nk-tree-item",pt);class ut extends v{render(){const t=this.createElement("div",["nk-topbar"]);t.appendChild(document.createElement("slot"));const e=this.createElement("div",["nk-topbar-actions"]);e.appendChild(this.createElement("slot",[],{name:"actions"})),t.appendChild(e),this._wrapper.appendChild(t)}}customElements.define("nk-topbar",ut);class gt extends v{static get observedAttributes(){return["separator"]}static get observesLightDom(){return!0}render(){this._nav=this.createElement("nav",["nk-breadcrumb"],{"aria-label":this.str("breadcrumb")}),this._wrapper.appendChild(this._nav),this.projectLightDom()}projectLightDom(){if(!this._nav)return;const t=[...this.children],e=this.getAttribute("separator")??"/",n=t.map(t=>t.outerHTML).join("")+e;if(n===this._signature)return;this._signature=n,this._nav.innerHTML="";const i=t.some(t=>t.hasAttribute("current")||t.classList.contains("current"));t.forEach((n,s)=>{if(s>0){const t=this.createElement("span",["sep"],{"aria-hidden":"true"});t.textContent=e,this._nav.appendChild(t)}const r=n.cloneNode(!0);r.removeAttribute("slot"),r.classList.add("crumb");const o=i?n.hasAttribute("current")||n.classList.contains("current"):s===t.length-1;r.classList.toggle("current",o),o&&r.setAttribute("aria-current","page"),r.dataset.index=s,this._nav.appendChild(r)})}setupEvents(){this._onClick=t=>{const e=t.target.closest(".crumb");if(!e)return;t.preventDefault();const n=Number(e.dataset.index),i=this.children[n];this.emit("nk-select",{index:n,label:e.textContent.trim(),href:i?.getAttribute("href")??null,value:i?.dataset.value??i?.getAttribute("href")??e.textContent.trim(),current:e.classList.contains("current")})&&i?.click()},this._nav.addEventListener("click",this._onClick)}teardownEvents(){this._nav?.removeEventListener("click",this._onClick)}onAttributeChanged(){this.projectLightDom()}onStringsChanged(){this._nav.setAttribute("aria-label",this.str("breadcrumb"))}get separator(){return this.getAttribute("separator")??"/"}set separator(t){this.setAttribute("separator",t)}}customElements.define("nk-breadcrumb",gt);class bt extends v{static get observedAttributes(){return["storage-key","title"]}render(){this._btn=this.createElement("button",["nk-topbar-btn","nk-theme-toggle"],{type:"button"}),this._syncTitle(),this._wrapper.appendChild(this._btn);const t=document.documentElement;let e=null;try{e=localStorage.getItem(this.storageKey)}catch{}"light"===e||"dark"===e?t.setAttribute("data-theme",e):t.hasAttribute("data-theme")||t.setAttribute("data-theme",matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),this._syncGlyph()}_syncGlyph(){this._btn&&(this._btn.textContent="dark"===g()?"โ˜€๏ธ":"๐ŸŒ™")}_syncTheme(t){super._syncTheme(t),this._syncGlyph()}setupEvents(){this._onClick=()=>this.apply("dark"===g()?"light":"dark"),this._onMessage=t=>{const e=t.data?.nkTheme;"light"!==e&&"dark"!==e||this.apply(e)},this._btn.addEventListener("click",this._onClick),window.addEventListener("message",this._onMessage)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),window.removeEventListener("message",this._onMessage)}_syncTitle(){this._btn.title=this.getAttribute("title")||this.str("toggleTheme")}onStringsChanged(){this._syncTitle()}onAttributeChanged(t){"title"===t&&this._btn&&this._syncTitle()}apply(t){document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem(this.storageKey,t)}catch{}this._syncGlyph(),this.emit("nk-change",{value:t})}get storageKey(){return this.getAttribute("storage-key")||"nk-theme"}get value(){return g()}set value(t){this.apply(t)}}customElements.define("nk-theme-toggle",bt);class mt extends v{static get observedAttributes(){return["value","always","fixed","floating","label"]}render(){this._bar=this.createElement("nav",["nk-tab-bar"]),this._slot=document.createElement("slot"),this._bar.appendChild(this._slot),this._spacer=this.createElement("div",["nk-tab-bar-spacer"]),this._wrapper.append(this._bar,this._spacer),this._syncBar(),this._sync()}get items(){return[...this.querySelectorAll(":scope > nk-tab-bar-item")]}_valueOf(t){return t.getAttribute("value")??t.getAttribute("label")??t.textContent.trim()}_syncBar(){this._bar.classList.toggle("always",this.getBoolAttr("always")),this._bar.classList.toggle("fixed",this.getBoolAttr("fixed")),this._bar.classList.toggle("floating",this.getBoolAttr("floating"));const t=this.getAttribute("label");t?this._bar.setAttribute("aria-label",t):this._bar.removeAttribute("aria-label")}_sync(){const t=this.items.filter(t=>!t.hasAttribute("drawer"));if(!t.length)return;let e=this.getAttribute("value");if(null===e||!t.some(t=>this._valueOf(t)===e)){const n=t.find(t=>t.hasAttribute("active"))||t[0];e=this._valueOf(n)}for(const n of t)this._valueOf(n)===e?n.setAttribute("active",""):n.removeAttribute("active");this._value=e}setupEvents(){this._onSlot=()=>this._sync(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("value"!==t)return void this._syncBar();const e=this._value;this._sync(),this._value!==e&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get always(){return this.getBoolAttr("always")}set always(t){this.setBoolAttr("always",t)}get fixed(){return this.getBoolAttr("fixed")}set fixed(t){this.setBoolAttr("fixed",t)}get floating(){return this.getBoolAttr("floating")}set floating(t){this.setBoolAttr("floating",t)}}customElements.define("nk-tab-bar",mt);class kt extends v{static get observedAttributes(){return["icon","label","value","href","active","disabled","drawer"]}render(){this._btn=this.createElement("button",["nk-tab-bar-item"],{type:"button"}),this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"],{"aria-hidden":"true"}),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=document.createElement("slot"),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._btn.append(this._iconSlot,this._label),this._wrapper.appendChild(this._btn),this._sync()}_sync(){this._icon.textContent=this.getAttribute("icon")??"",this._labelText.data=this.getAttribute("label")??"";const t=this.getBoolAttr("active");this._btn.classList.toggle("active",t),t?this._btn.setAttribute("aria-current","page"):this._btn.removeAttribute("aria-current"),this._btn.disabled=this.getBoolAttr("disabled");const e=this.getAttribute("href");e?this._btn.setAttribute("data-href",e):this._btn.removeAttribute("data-href")}setupEvents(){this._onClick=()=>this.select(),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}select(){if(this.getBoolAttr("disabled"))return;const t=this.getAttribute("href");if(!this.emit("nk-select",{value:this.value,label:this.label,href:t,item:this,drawer:this.getBoolAttr("drawer")}))return;if(this.getBoolAttr("drawer")){const t=this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar");return void t?.toggle?.()}const e=this.closest("nk-tab-bar");e?e.value=this.value:this.setBoolAttr("active",!0),t&&location.assign(t)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get label(){return this.getAttribute("label")??this.textContent.trim()}set label(t){this.setAttribute("label",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get drawer(){return this.getBoolAttr("drawer")}set drawer(t){this.setBoolAttr("drawer",t)}}customElements.define("nk-tab-bar-item",kt);class _t extends v{static get observedAttributes(){return["icon","cover","narrow","full","small"]}render(){this._page=this.createElement("div",["nk-page"]),this._icon=this.createElement("div",["nk-page-icon"],{role:"button",title:this.str("changeIcon")}),this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._iconSlot.appendChild(this._icon),this._page.appendChild(this._iconSlot),this._page.appendChild(document.createElement("slot")),this._cover=this.createElement("div",["nk-cover"]),this._coverSlot=this.createElement("slot",[],{name:"cover"}),this._coverSlot.appendChild(this._cover),this._build()}_build(){if(this._wrapper.replaceChildren(),this.getBoolAttr("narrow"))this._wrapper.append(this._coverSlot,this._page);else{const t=this.createElement("div",["nk-page-scroll"]);t.append(this._coverSlot,this._page),this._wrapper.appendChild(t)}this._sync()}_sync(){const t=this.getAttribute("icon")||"";this._icon.textContent!==t&&(this._icon.textContent=t),this._icon.style.display=t?"":"none",this._cover.style.display=this.getBoolAttr("cover")?"":"none";const e=t=>t.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim()),n=this.getBoolAttr("cover")||e(this._coverSlot),i=!!t||e(this._iconSlot);this._page.classList.toggle("covered",n&&i),this._page.classList.toggle("full",this.getBoolAttr("full")),this._page.classList.toggle("small",this.getBoolAttr("small"))}setupEvents(){this._onIcon=()=>this.emit("nk-action",{action:"icon",value:this.getAttribute("icon")}),this._onCover=()=>this._sync(),this._icon.addEventListener("click",this._onIcon),this._coverSlot.addEventListener("slotchange",this._onCover),this._iconSlot.addEventListener("slotchange",this._onCover),this._sync()}teardownEvents(){this._icon?.removeEventListener("click",this._onIcon),this._coverSlot?.removeEventListener("slotchange",this._onCover),this._iconSlot?.removeEventListener("slotchange",this._onCover)}onStringsChanged(){this._icon.title=this.str("changeIcon")}onAttributeChanged(t){"narrow"===t?this._build():this._sync()}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get cover(){return this.getBoolAttr("cover")}set cover(t){this.setBoolAttr("cover",t)}get full(){return this.getBoolAttr("full")}set full(t){this.setBoolAttr("full",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}}customElements.define("nk-page",_t);class vt extends v{static get observedAttributes(){return["src","position"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._wrapper.appendChild(this._cover),this._sync()}_sync(){const t=this.getAttribute("src");t?(this._img.src=t,this._img.style.objectPosition=this.getAttribute("position")||"",this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove()}onAttributeChanged(){this._sync()}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-page-cover",vt);class xt extends v{static get observedAttributes(){return["editable","placeholder","value"]}static get observesLightDom(){return!0}render(){this._h1=this.createElement("h1",["nk-page-title"]),this._slot=document.createElement("slot"),this._h1.appendChild(this._slot),this._wrapper.appendChild(this._h1),this._sync()}_sync(){if(this.getBoolAttr("editable")){this._slot.isConnected&&this._slot.remove(),this._h1.setAttribute("contenteditable","plaintext-only"),this._h1.setAttribute("spellcheck","false"),this._h1.setAttribute("role","textbox"),this._h1.setAttribute("aria-label",this.str("title"));const t=this.getAttribute("value")??this.textContent.trim();this._h1.textContent!==t&&document.activeElement!==this&&(this._h1.textContent=t),this._h1.setAttribute("data-placeholder",this.getAttribute("placeholder")||"")}else this._h1.removeAttribute("contenteditable"),this._h1.removeAttribute("role"),this.hasAttribute("value")?(this._slot.isConnected&&this._slot.remove(),this._h1.textContent=this.getAttribute("value")):this._slot.isConnected||(this._h1.textContent="",this._h1.appendChild(this._slot))}projectLightDom(){this._h1&&!this.hasAttribute("value")&&this._sync()}setupEvents(){this._committed=this.value,this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this._h1.blur())},this._onBlur=()=>this._commit(),this._h1.addEventListener("keydown",this._onKey),this._h1.addEventListener("blur",this._onBlur)}teardownEvents(){this._h1?.removeEventListener("keydown",this._onKey),this._h1?.removeEventListener("blur",this._onBlur)}_commit(){const t=this._h1.textContent.trim();t!==this._committed&&(this._committed=t,this.emit("nk-change",{value:t}))}onAttributeChanged(){this._sync()}onStringsChanged(){this._h1.hasAttribute("role")&&this._h1.setAttribute("aria-label",this.str("title"))}get value(){return this.getBoolAttr("editable")?this._h1?.textContent.trim()??"":this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get editable(){return this.getBoolAttr("editable")}set editable(t){this.setBoolAttr("editable",t)}focus(t){this._h1?.focus(t)}}customElements.define("nk-page-title",xt);class ft extends v{render(){const t=this.createElement("div",["nk-page-meta"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-page-actions",ft);class yt extends v{static get observedAttributes(){return["handle","drop-target"]}render(){this._box=this.createElement("div",["nk-block-host"]),this._handle=this.createElement("span",["nk-block-handle"],{"aria-hidden":"true"}),this._handle.textContent="โ ฟ",this._box.appendChild(this._handle),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._sync()}_sync(){this._handle.style.display=this.getBoolAttr("handle")?"":"none",this._box.classList.toggle("nk-drop-target",this.getBoolAttr("drop-target"))}onAttributeChanged(){this._sync()}get handle(){return this.getBoolAttr("handle")}set handle(t){this.setBoolAttr("handle",t)}get dropTarget(){return this.getBoolAttr("drop-target")}set dropTarget(t){this.setBoolAttr("drop-target",t)}}customElements.define("nk-block-host",yt);const wt=["info","success","warning","danger"];class At extends v{static get observedAttributes(){return["variant"]}render(){this._box=this.createElement("div",this._classes(),{role:"status"}),this._box.appendChild(document.createElement("slot")),this._box.appendChild(this.createElement("slot",[],{name:"action"})),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("variant");return["nk-banner",...wt.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}}customElements.define("nk-banner",At);class Et extends v{static get observedAttributes(){return["icon","title","desc"]}render(){const t=this.createElement("div",["nk-empty"]);this._parts={};for(const[e,n]of[["icon","e-icon"],["title","e-title"],["desc","e-desc"]]){const i=this.createElement("div",[n]),s=this.createElement("slot",[],{name:e});s.appendChild(i),t.appendChild(s),this._parts[e]=i}const e=this.createElement("div",["e-actions"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const n="title"===t?this._titleText:this.getAttribute(t);e.textContent=n||"",e.style.display=n?"":"none"}}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-empty",Et);class Ct extends v{static get observedAttributes(){return["lines","height","width","widths"]}render(){this._build()}_build(){this._wrapper.replaceChildren();const t=Math.max(1,Number(this.getAttribute("lines"))||1),e=this.getAttribute("height")||"13",n=(this.getAttribute("widths")||"").split(",").map(t=>t.trim()).filter(Boolean),i=this.getAttribute("width");for(let s=0;s<t;s++){const t=this.createElement("div",["nk-skeleton"],{"aria-hidden":"true"});t.style.height=/^\d+(\.\d+)?$/.test(e)?`${e}px`:e;const r=n[s]??i;r&&(t.style.width=r),this._wrapper.appendChild(t)}}onAttributeChanged(){this._build()}}customElements.define("nk-skeleton",Ct);class Bt extends v{static get observedAttributes(){return["badge"]}render(){const t=this.createElement("div",["nk-synced"]);this._badge=this.createElement("span",["synced-badge"]),t.appendChild(this._badge),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._badge.textContent=this.getAttribute("badge")??this.str("synced")}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}get badge(){return this.getAttribute("badge")}set badge(t){this.setAttribute("badge",t)}}function Lt(t){if(t.getClientRects().length)return t.getBoundingClientRect();for(const e of[...t.shadowRoot?.children??[],...t.children]){const t=Lt(e);if(t.width||t.height)return t}return t.getBoundingClientRect()}function St(t){const e=t.style;e.top="0px",e.left="0px",e.right="auto";const n=t.getBoundingClientRect();e.left="auto",e.right="0px";const i=t.getBoundingClientRect();return{x:n.left,y:n.top,right:i.right,width:n.width,height:n.height}}function zt(t,e,n){const i=Lt(e);t.style.removeProperty("--_nk-float-max");const s=St(t),r=innerHeight-i.bottom-6-8,o=i.top-6-8,a=s.height>r&&o>r,l=Math.max(0,Math.floor(a?o:r));s.height>l&&t.style.setProperty("--_nk-float-max",`${l}px`),t.style.top=(a?i.top-6-Math.min(s.height,l):i.bottom+6)-s.y+"px","start"===n?(t.style.left=i.left-s.x+"px",t.style.right="auto"):(t.style.right=s.right-Math.min(i.right,innerWidth-8)+"px",t.style.left="auto")}customElements.define("nk-synced",Bt);const Tt={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class Dt extends v{static get observedAttributes(){return["value","scroll"]}render(){this._strip=this.createElement("div",["nk-tabs"],{role:"tablist"}),this._tabSlot=document.createElement("slot"),this._strip.appendChild(this._tabSlot),this._panelSlot=this.createElement("slot",[],{name:"panel"}),this._wrapper.append(this._strip,this._panelSlot),this._sync()}get tabs(){return[...this.querySelectorAll(":scope > nk-tab")]}get panels(){return[...this.querySelectorAll(':scope > [slot="panel"]')]}_sync(){const t=this.tabs;if(!t.length)return;let e=this.getAttribute("value");if(null===e||!t.some(t=>t.getAttribute("value")===e||null===t.getAttribute("value")&&t.textContent.trim()===e)){const n=t.find(t=>t.hasAttribute("active"))||t[0];e=n.getAttribute("value")??n.textContent.trim()}for(const n of t){(n.getAttribute("value")??n.textContent.trim())===e?n.setAttribute("active",""):n.removeAttribute("active")}for(const t of this.panels)t.hidden=t.dataset.tab!==e;this._value=e,this._strip.classList.toggle("scroll",this.getBoolAttr("scroll")),this._reveal(this._revealed?"smooth":"instant")}_reveal(t){if(!this.getBoolAttr("scroll")||!this._strip?.clientWidth)return;const e=this.tabs.find(t=>t.hasAttribute("active"));if(!e)return;const n=this._strip.getBoundingClientRect(),i=Lt(e),s=i.left<n.left?i.left-n.left-8:i.right>n.right?i.right-n.right+8:0,r="smooth"===t&&!matchMedia("(prefers-reduced-motion: reduce)").matches;s&&this._strip.scrollBy({left:s,behavior:r?"smooth":"instant"}),this._revealed=!0}setupEvents(){this._onSlot=()=>this._sync(),this._onKey=t=>{const e=Tt[t.key];if(!e)return;const n=this.tabs.filter(t=>!t.hasAttribute("disabled")),i=n.indexOf(t.target.closest?.("nk-tab"));if(i<0||n.length<2)return;t.preventDefault();const s=n[(i+e+n.length)%n.length];s.select(),s.focus()},this._tabSlot.addEventListener("slotchange",this._onSlot),this._panelSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("keydown",this._onKey),this._resize=new ResizeObserver(()=>this._reveal("instant")),this._resize.observe(this._strip),this._sync()}teardownEvents(){this._tabSlot?.removeEventListener("slotchange",this._onSlot),this._panelSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("keydown",this._onKey),this._resize?.disconnect()}onAttributeChanged(){const t=this._value;this._sync(),this._value!==t&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get scroll(){return this.getBoolAttr("scroll")}set scroll(t){this.setBoolAttr("scroll",t)}}customElements.define("nk-tabs",Dt);class Mt extends v{static get observedAttributes(){return["active","value","disabled"]}render(){this._tab=this.createElement("span",["nk-tab"],{role:"tab"}),this._tab.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tab),this._sync()}_sync(){const t=this.getBoolAttr("active");this._tab.classList.toggle("active",t),this._tab.setAttribute("aria-selected",t?"true":"false"),this._tab.tabIndex=t?0:-1,this._tab.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._tab.addEventListener("click",this._onClick),this._tab.addEventListener("keydown",this._onKey)}teardownEvents(){this._tab?.removeEventListener("click",this._onClick),this._tab?.removeEventListener("keydown",this._onKey)}select(){if(this.getBoolAttr("disabled"))return;if(!this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this}))return;const t=this.closest("nk-tabs");t?t.value=this.value:this.setBoolAttr("active",!0)}onAttributeChanged(){this._sync()}focus(t){this._tab?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-tab",Mt);const Nt={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class Ft extends x{static get observedAttributes(){return["value","name","disabled","scroll","wrap"]}render(){this._box=this.createElement("div",["nk-segmented"],{role:"radiogroup"}),this._slot=document.createElement("slot"),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._syncBox(),this._sync()}_syncBox(){this._box.classList.toggle("scroll",this.getBoolAttr("scroll")),this._box.classList.toggle("wrap",this.getBoolAttr("wrap"))}get buttons(){return this._slot?.assignedElements().filter(t=>"button"===t.localName)??[]}_valueOf(t){return t.getAttribute("value")??t.textContent.trim()}_sync(){const t=this.buttons;if(!t.length)return;let e=this.getAttribute("value");null!==e&&t.some(t=>this._valueOf(t)===e)||(e=this._valueOf(t.find(t=>t.classList.contains("active"))||t[0])),void 0===this._defaultValue&&(this._defaultValue=e);const n=this.getBoolAttr("disabled")||!!this._formDisabled;for(const i of t){const t=this._valueOf(i)===e;i.type="button",i.setAttribute("role","radio"),i.setAttribute("aria-checked",t?"true":"false"),i.classList.toggle("active",t),i.tabIndex=t?0:-1,i.disabled=n}this._value=e,this.setFormValue(e),this._reveal(this._revealed?"smooth":"instant")}_reveal(t){if(!this.getBoolAttr("scroll")||!this._box?.clientWidth)return;const e=this.buttons.find(t=>t.classList.contains("active"));if(!e)return;const n=this._box.getBoundingClientRect(),i=e.getBoundingClientRect(),s=i.left<n.left?i.left-n.left-8:i.right>n.right?i.right-n.right+8:0,r="smooth"===t&&!matchMedia("(prefers-reduced-motion: reduce)").matches;s&&this._box.scrollBy({left:s,behavior:r?"smooth":"instant"}),this._revealed=!0}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this.buttons.includes(e)&&!e.disabled&&this._choose(this._valueOf(e))},this._onKey=t=>{const e=Nt[t.key];if(!e)return;const n=this.buttons,i=n.indexOf(t.target.closest?.("button"));if(i<0||n.length<2)return;t.preventDefault();const s=n[(i+e+n.length)%n.length];this._choose(this._valueOf(s)),s.focus()},this._slot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKey),this._resize=new ResizeObserver(()=>this._reveal("instant")),this._resize.observe(this._box),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKey),this._resize?.disconnect()}_choose(t){t!==this._value&&(this._syncing=!0,this.setAttribute("value",t),this._syncing=!1,this._sync(),this.emit("nk-change",{value:t,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){"scroll"!==t&&"wrap"!==t?this._syncing||this._sync():this._syncBox()}resetValue(){void 0!==this._defaultValue&&this.setAttribute("value",this._defaultValue)}onFormDisabled(t){this._formDisabled=t,this._sync()}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get scroll(){return this.getBoolAttr("scroll")}set scroll(t){this.setBoolAttr("scroll",t)}get wrap(){return this.getBoolAttr("wrap")}set wrap(t){this.setBoolAttr("wrap",t)}}customElements.define("nk-segmented",Ft);class It extends v{render(){const t=this.createElement("div",["nk-stats"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-stats",It);class Vt extends v{static get observedAttributes(){return["label","value","delta","trend"]}render(){const t=this.createElement("div",["nk-stat"]);this._parts={};for(const[e,n]of[["label","s-label"],["value","s-value"],["delta","s-delta"]]){const i=this.createElement("div",[n]),s=this.createElement("slot",[],{name:e});s.appendChild(i),t.appendChild(s),this._parts[e]=i}this._wrapper.appendChild(t),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const n=this.getAttribute(t);e.textContent=n??"",e.style.display=null===n?"none":""}const t=this.getAttribute("trend");this._parts.delta.className="s-delta"+("up"===t||"down"===t?` ${t}`:"")}onAttributeChanged(){this._sync()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-stat",Vt);class jt extends v{static get observedAttributes(){return["more"]}render(){const t=this.createElement("div",["nk-avatar-group"]);t.appendChild(document.createElement("slot")),this._more=this.createElement("span",["mini-avatar","more"]),t.appendChild(this._more),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("more");this._more.textContent=t||"",this._more.style.display=t?"":"none"}onAttributeChanged(){this._sync()}get more(){return this.getAttribute("more")}set more(t){null==t?this.removeAttribute("more"):this.setAttribute("more",t)}}customElements.define("nk-avatar-group",jt);const qt=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function Kt(t,e){for(const n of qt)t.classList.toggle(n,n===e);t.style.background=e&&!qt.includes(e)?e:""}const Ot=t=>String(t||"").split(/\s+/).map(t=>t.match(/[\p{L}\p{N}]/u)?.[0]).filter(Boolean).join("").slice(0,2).toUpperCase();class Pt extends v{static get observedAttributes(){return["size","color","square","src","name"]}render(){this._box=this.createElement("span",["nk-avatar"]),this._slot=document.createElement("slot"),this._initials=document.createTextNode(""),this._slot.appendChild(this._initials),this._img=this.createElement("img",[],{alt:""}),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("size");for(const e of["small","large","xlarge"])this._box.classList.toggle(e,e===t);this._box.classList.toggle("square",this.getBoolAttr("square")),Kt(this._box,this.getAttribute("color"));const e=this.getAttribute("name");this._initials.data=Ot(e);const n=this.getAttribute("src");n?(this._img.src=n,this._img.alt=e||"",this._slot.isConnected&&this._slot.replaceWith(this._img)):this._img.isConnected&&this._img.replaceWith(this._slot),e&&!n?(this._box.setAttribute("role","img"),this._box.setAttribute("aria-label",e)):(this._box.removeAttribute("role"),this._box.removeAttribute("aria-label"))}onAttributeChanged(){this._sync()}get size(){return this.getAttribute("size")}set size(t){null==t?this.removeAttribute("size"):this.setAttribute("size",t)}get color(){return this.getAttribute("color")}set color(t){null==t?this.removeAttribute("color"):this.setAttribute("color",t)}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-avatar",Pt);const Rt=["person","page","date"];class $t extends v{static get observedAttributes(){return["type"]}render(){this._box=this.createElement("span",this._classes()),this._box.appendChild(this.createElement("slot",[],{name:"avatar"})),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("type");return["nk-mention",...Rt.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get type(){return this.getAttribute("type")}set type(t){t?this.setAttribute("type",t):this.removeAttribute("type")}}customElements.define("nk-mention",$t);class Ht extends v{static get observedAttributes(){return["icon","value","disabled"]}render(){this._btn=this.createElement("button",["nk-template-btn"],{type:"button"});const t=document.createElement("span");this._icon=document.createElement("span"),this._space=document.createTextNode(" "),t.append(this._icon,this._space,document.createElement("slot")),this._btn.appendChild(t),this._wrapper.appendChild(this._btn),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._space.data=t?" ":"",this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onClick=()=>this.emit("nk-select",{value:this.value,label:this.textContent.trim()}),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-template-btn",Ht);class Wt extends x{static get observedAttributes(){return["name","value","title","desc","selected","disabled"]}render(){this._card=this.createElement("div",["nk-model-card"],{role:"radio",tabindex:"0"}),this._card.appendChild(this.createElement("div",["m-radio"]));const t=document.createElement("div");this._name=this.createElement("div",["m-name"]);const e=this.createElement("slot",[],{name:"title"});e.appendChild(this._name),this._desc=this.createElement("div",["m-desc"]);const n=this.createElement("slot",[],{name:"desc"});n.appendChild(this._desc),t.append(e,n),this._card.appendChild(t),this._wrapper.appendChild(this._card),this._defaultSelected=this.getBoolAttr("selected"),this.takeTitle(),this._sync(),this.getBoolAttr("selected")&&this._unselectPeers()}_sync(){const t=this.getBoolAttr("selected");this._card.classList.toggle("selected",t),this._card.setAttribute("aria-checked",t?"true":"false"),this._card.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._name.textContent=this._titleText||"";const e=this.getAttribute("desc");this._desc.textContent=e||"",this._desc.style.display=e?"":"none",this.setFormValue(t?this.getAttribute("value")||"on":null,t?"selected":"unselected")}_group(){const t=this.getAttribute("name"),e=this.getRootNode();return t&&"function"==typeof e?.querySelectorAll?[...e.querySelectorAll("nk-model-card")].filter(e=>e.getAttribute("name")===t):[this]}_unselectPeers(){for(const t of this._group())t!==this&&t.hasAttribute("selected")&&t.removeAttribute("selected")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._card.addEventListener("click",this._onClick),this._card.addEventListener("keydown",this._onKey)}teardownEvents(){this._card?.removeEventListener("click",this._onClick),this._card?.removeEventListener("keydown",this._onKey)}select(){this.getBoolAttr("disabled")||this.getBoolAttr("selected")||(this.setBoolAttr("selected",!0),this.emit("nk-change",{value:this.value,name:this.name,checked:!0}),this.emit("nk-select",{value:this.value,label:this.title}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&(this._sync(),"selected"===t&&this.getBoolAttr("selected")&&this._unselectPeers())}resetValue(){this.setBoolAttr("selected",this._defaultSelected)}focus(t){this._card?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get selected(){return this.getBoolAttr("selected")}set selected(t){this.setBoolAttr("selected",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}}customElements.define("nk-model-card",Wt);class Ut extends v{static get observedAttributes(){return["avatar"]}render(){const t=this.createElement("div",["nk-profile-row"]);this._avatar=this.createElement("div",["big-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar),t.appendChild(e),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._avatar.textContent=this.getAttribute("avatar")||""}onAttributeChanged(){this._sync()}}customElements.define("nk-profile-row",Ut);class Gt extends v{static get observedAttributes(){return["title"]}render(){const t=this.createElement("div",["nk-danger-zone"]);this._titleEl=this.createElement("div",["dz-title"]),t.appendChild(this._titleEl),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._titleEl.textContent=t||"",this._titleEl.style.display=t?"":"none"}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-danger-zone",Gt);class Yt extends v{render(){const t=this.createElement("div",["nk-member-list"]);this._slot=document.createElement("slot"),t.appendChild(this._slot),this._wrapper.appendChild(t),this._mark()}_mark(){const t=this._slot.assignedElements().filter(t=>"nk-member-row"===t.localName);t.forEach((e,n)=>{n===t.length-1?e.setAttribute("last",""):e.removeAttribute("last")})}setupEvents(){this._onSlot=()=>this._mark(),this._slot.addEventListener("slotchange",this._onSlot),this._mark()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}}customElements.define("nk-member-list",Yt);class Qt extends v{static get observedAttributes(){return["name","mail","avatar","color","last"]}render(){this._row=this.createElement("div",["nk-member-row"]),this._avatar=this.createElement("span",["nk-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar);const e=document.createElement("div");this._name=document.createTextNode(""),this._mail=this.createElement("div",["m-mail"]),e.append(this._name,this._mail);const n=document.createElement("div");n.style.marginLeft="auto",n.appendChild(this.createElement("slot",[],{name:"role"})),this._row.append(t,e,n,document.createElement("slot")),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._name.data=this.getAttribute("name")||"";const t=this.getAttribute("mail");this._mail.textContent=t||"",this._mail.style.display=t?"":"none";const e=this.getAttribute("avatar");this._avatar.textContent=e||Ot(this.getAttribute("name")),Kt(this._avatar,this.getAttribute("color")),this._row.classList.toggle("last",this.getBoolAttr("last"))}onAttributeChanged(){this._sync()}}customElements.define("nk-member-row",Qt);class Xt extends v{static get observedAttributes(){return["flush"]}render(){this._list=this.createElement("dl",["nk-props"]),this._list.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._list),this.onAttributeChanged()}onAttributeChanged(){this._list?.classList.toggle("flush",this.getBoolAttr("flush"))}get flush(){return this.getBoolAttr("flush")}set flush(t){this.setBoolAttr("flush",t)}}customElements.define("nk-props",Xt);class Zt extends v{static get observedAttributes(){return["label","icon","text"]}render(){this._row=this.createElement("div",["nk-prop"]),this._name=this.createElement("dt",["p-name"]),this._icon=this.createElement("span",["p-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon),this._label=document.createTextNode(""),this._name.append(t,this._label),this._value=this.createElement("dd",["p-value"]),this._value.appendChild(document.createElement("slot")),this._row.append(this._name,this._value),this._wrapper.appendChild(this._row),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none",this._label.data=this.getAttribute("label")||"",this._value.classList.toggle("text",this.getBoolAttr("text"))}setupEvents(){this._onClick=t=>{const e=t.composedPath().includes(this._name)?"name":"value";this.emit("nk-action",{action:e,label:this.label})},this._row.addEventListener("click",this._onClick)}teardownEvents(){this._row?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}get label(){return this.getAttribute("label")||""}set label(t){this.setAttribute("label",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get text(){return this.getBoolAttr("text")}set text(t){this.setBoolAttr("text",t)}}customElements.define("nk-prop",Zt);class Jt extends v{static get observedAttributes(){return["flush"]}render(){this._grid=this.createElement("div",["nk-panels"]),this._grid.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._grid),this.onAttributeChanged()}onAttributeChanged(){this._grid?.classList.toggle("flush",this.getBoolAttr("flush"))}get flush(){return this.getBoolAttr("flush")}set flush(t){this.setBoolAttr("flush",t)}}customElements.define("nk-panels",Jt);class te extends v{static get observedAttributes(){return["title","icon","cover","href","target"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._icon=this.createElement("div",["nk-page-icon"]),this._heading=document.createElement("h3"),this._endSlot=this.createElement("slot",[],{name:"end"}),this._end=this.createElement("span",["p-end"]),this._end.appendChild(this._endSlot),this._head=this.createElement("div",["p-head"]),this._head.append(this._heading,this._end),this._slot=document.createElement("slot"),this.takeTitle(),this._build()}_build(){const t=this.getAttribute("href"),e=this.createElement(t?"a":"div",["nk-panel"]);e.append(this._cover,this._icon,this._head,this._slot),this._wrapper.replaceChildren(e),this._box=e,this._sync()}_sync(){const t=this.getAttribute("href");t&&(this._box.setAttribute("href",t),this._box.target=this.getAttribute("target")||"");const e=this.getAttribute("cover");null===e?this._cover.remove():this._cover.isConnected||this._box.prepend(this._cover),e?(this._img.src=e,this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove();const n=this.getAttribute("icon");this._icon.textContent=n||"",this._icon.style.display=n?"":"none";const i=this._titleText||"";this._heading.textContent!==i&&(this._heading.textContent=i),this._heading.style.display=i?"":"none";const s=this._endSlot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent.trim());this._end.style.display=s?"":"none",this._head.style.display=i||s?"":"none"}setupEvents(){this._onEnd=()=>this._sync(),this._endSlot.addEventListener("slotchange",this._onEnd)}teardownEvents(){this._endSlot?.removeEventListener("slotchange",this._onEnd)}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&("href"!==t||null===n==("div"===this._box.localName)?this._sync():this._build())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get href(){return this.getAttribute("href")}set href(t){null==t?this.removeAttribute("href"):this.setAttribute("href",t)}}customElements.define("nk-panel",te);class ee extends v{static get observedAttributes(){return["open","title"]}render(){this.takeTitle(),this._backdrop=this.createElement("div",["nk-sheet-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-sheet"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._heading=this.createElement("div",["sh-title"],{id:"title"}),this._box.append(this.createElement("div",["sh-grabber"]),this._heading,document.createElement("slot")),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncTitle(),this._syncOpen()}_syncTitle(){const t=this._titleText||"";this._heading.textContent=t,this._heading.hidden=!t,t?this._box.setAttribute("aria-labelledby","title"):this._box.removeAttribute("aria-labelledby")}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=st(),et(),this._undoInert=it(this),requestAnimationFrame(()=>(rt(this)||this._box).focus({preventScroll:!0}));else{nt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),this._wasOpen&&(nt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t,e,n){"title"!==t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this.takeTitle(n)&&this._syncTitle()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._syncTitle()}}customElements.define("nk-sheet",ee);class ne extends v{static get observedAttributes(){return["steps","current","label","selectable","horizontal"]}render(){this._list=this.createElement("ol",["nk-steps"]),this._wrapper.appendChild(this._list),this._sync()}_items(){return this._steps?this._steps:(this.getAttribute("steps")||"").split(",").map(t=>t.trim()).filter(Boolean)}_step(t){const e=this._items()[t];return"object"==typeof e&&e?e:void 0===e?void 0:{label:String(e)}}_sync(){const t=this.getAttribute("label");t?this._list.setAttribute("aria-label",t):this._list.removeAttribute("aria-label"),this._list.classList.toggle("horizontal",this.getBoolAttr("horizontal"));const e=this.current,n=this.getBoolAttr("selectable"),i=this.shadowRoot?.activeElement?.closest?.("li")?.dataset.index;this._list.replaceChildren(...this._items().map((t,i)=>{const s=i+1,{label:r,desc:o,state:a,href:l}=this._step(i),h=a?"done"===a:s<e,d="skipped"===a,c=this.createElement("li",["nk-step"],{"data-index":String(s)});c.classList.toggle("done",h),c.classList.toggle("skipped",d),c.classList.toggle("current",s===e),s===e&&c.setAttribute("aria-current","step");const p=this.createElement("span",["st-mark"],{"aria-hidden":"true"});p.textContent=h?"โœ“":d?"โ€“":String(s);const u=null!=l&&""!==l?this.createElement("a",["st-label"],{href:String(l)}):n?this.createElement("button",["st-label"],{type:"button"}):document.createElement("span");if(u.textContent=r??"",o){const t=this.createElement("span",["st-desc"]);t.textContent=o,u.appendChild(t)}return c.append(p,u),c})),i&&this._list.querySelector(`li[data-index="${i}"] .st-label`)?.focus()}setupEvents(){this._onClick=t=>{const e=t.target.closest?.("li.nk-step");if(!e||!this._list.contains(e))return;const n=e.querySelector("a.st-label");if(n){if(0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;return n.contains(t.target)?void(this.select(Number(e.dataset.index))||t.preventDefault()):void n.click()}this.getBoolAttr("selectable")&&this.select(Number(e.dataset.index))},this._list.addEventListener("click",this._onClick)}teardownEvents(){this._list?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}select(t){const e=this._step(t-1);if(!e)return!1;const n=this.emit("nk-select",{index:t,value:e.value??e.label,step:e});return n&&(this.current=t),n}get steps(){return this._items()}set steps(t){this._steps=Array.isArray(t)?t:null,this._list&&this._sync()}get current(){const t=parseInt(this.getAttribute("current"),10);return Number.isFinite(t)?t:1}set current(t){this.setAttribute("current",String(t))}get selectable(){return this.getBoolAttr("selectable")}set selectable(t){this.setBoolAttr("selectable",t)}get horizontal(){return this.getBoolAttr("horizontal")}set horizontal(t){this.setBoolAttr("horizontal",t)}next(){return this.current=Math.min(this.current+1,this._items().length+1),this.current}}customElements.define("nk-steps",ne);class ie extends v{static get observedAttributes(){return["href","title","desc","favicon","cover","target","url"]}render(){this.takeTitle(),this._a=this.createElement("a",["nk-bookmark"]),this._wrapper.appendChild(this._a),this._sync()}_sync(){if(!this._a)return;const t=this.getAttribute("href")||"";this._a.setAttribute("href",t);const e=this.getAttribute("target")||"_blank";this._a.setAttribute("target",e),"_blank"===e?this._a.setAttribute("rel","noopener"):this._a.removeAttribute("rel");let n=t;try{n=new URL(t,location.href).host}catch{}const i=this.createElement("span",["bm-text"]),s=this.createElement("span",["bm-title"]);s.textContent=this._titleText||n,i.appendChild(s);const r=this.getAttribute("desc");if(r){const t=this.createElement("span",["bm-desc"]);t.textContent=r,i.appendChild(t)}const o=this.createElement("span",["bm-url"]),a=this.getAttribute("favicon");a&&o.appendChild(this.createElement("img",["bm-favicon"],{src:a,alt:""}));const l=document.createElement("span");l.textContent=this.getAttribute("url")||t,o.appendChild(l),i.appendChild(o);const h=[i],d=this.getAttribute("cover");if(d){const t=this.createElement("span",["bm-cover"]);t.appendChild(this.createElement("img",[],{src:d,alt:""})),h.push(t)}this._a.replaceChildren(...h)}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}focus(t){this._a?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._sync()}get href(){return this.getAttribute("href")||""}set href(t){this.setAttribute("href",t)}}customElements.define("nk-bookmark",ie);class se extends v{static get observedAttributes(){return["value","mono","wrap","wide","secret","copy-label","copied-label","show-label","hide-label"]}render(){this._val??=this.getAttribute("value")??"",this._box=this.createElement("div",["nk-copy-field"]),this._text=this.createElement("span",["cf-value"]),this._show=this.createElement("button",["cf-btn"],{type:"button"}),this._copy=this.createElement("button",["cf-btn"],{type:"button"}),this._box.append(this._text,this._copy),this._wrapper.appendChild(this._box),this._sync()}_sync(){if(!this._box)return;for(const t of["mono","wrap","wide"])this._box.classList.toggle(t,this.getBoolAttr(t));const t=this.getBoolAttr("secret");this._text.textContent=t&&!this._revealed?"โ€ข".repeat(Math.min(this._val.length,24)):this._val,t&&!this._show.isConnected&&this._copy.before(this._show),t||this._show.remove(),this._show.textContent=this._revealed?this.getAttribute("hide-label")||this.str("hide"):this.getAttribute("show-label")||this.str("show"),this._show.setAttribute("aria-pressed",String(!!this._revealed)),this._copy.textContent=this._copied?this.getAttribute("copied-label")||this.str("copied"):this.getAttribute("copy-label")||this.str("copy"),this._copy.classList.toggle("copied",!!this._copied)}setupEvents(){this._onCopy=()=>this.copy(),this._onShow=()=>{this._revealed=!this._revealed,this._sync()},this._copy.addEventListener("click",this._onCopy),this._show.addEventListener("click",this._onShow)}teardownEvents(){this._copy?.removeEventListener("click",this._onCopy),this._show?.removeEventListener("click",this._onShow),clearTimeout(this._timer)}onStringsChanged(){this._sync()}onAttributeChanged(t,e,n){"value"===t&&(this._val=n??""),this._sync()}async copy(){const t=this._val;let e=!0;try{await navigator.clipboard.writeText(t)}catch{e=!1}return e?(this._copied=!0,clearTimeout(this._timer),this._timer=setTimeout(()=>{this._copied=!1,this._sync()},1500)):this._revealed=!0,this._sync(),e||getSelection()?.selectAllChildren(this._text),this.emit("nk-action",{action:"copy",value:t,ok:e}),e}get value(){return this._val??this.getAttribute("value")??""}set value(t){this._val=null==t?"":String(t),this._sync()}get secret(){return this.getBoolAttr("secret")}set secret(t){this.setBoolAttr("secret",t)}}function re(t){const e=t.slice(t.indexOf(",")+1),n=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(3*e.length/4)-n}customElements.define("nk-copy-field",se);class oe extends v{static get observedAttributes(){return["src","initials","square","label","max","type","quality","accept","choose-label","change-label","remove-label"]}render(){this._src??=this.getAttribute("src")||"",this._row=this.createElement("div",["nk-profile-row"],{role:"group"}),this._avatar=this.createElement("div",["big-avatar"]);const t=this.createElement("div",["pr-actions"]);this._choose=this.createElement("button",["nk-btn","secondary","small"],{type:"button"}),this._remove=this.createElement("button",["nk-btn","secondary","small","pr-remove"],{type:"button"}),this._input=this.createElement("input",[],{type:"file",tabindex:"-1"}),this._input.hidden=!0,t.append(this._choose,this._remove,this._input),this._row.append(this._avatar,t),this._wrapper.appendChild(this._row),this._sync()}get _max(){return Math.max(1,Math.floor(Number(this.getAttribute("max")))||512)}get _type(){return this.getAttribute("type")||"image/jpeg"}get _quality(){const t=Number(this.getAttribute("quality"));return this.hasAttribute("quality")&&t>=0&&t<=1?t:.82}_sync(){if(!this._row)return;this._avatar.classList.toggle("square",this.getBoolAttr("square")),this._src?this._img&&this._img.getAttribute("src")===this._src||(this._img=this.createElement("img",[],{src:this._src,alt:""}),this._avatar.replaceChildren(this._img)):(this._img=null,this._avatar.textContent=this.getAttribute("initials")||"");const t=this.getAttribute("label");t?this._row.setAttribute("aria-label",t):this._row.removeAttribute("aria-label"),this._choose.textContent=this._src?this.getAttribute("change-label")||this.str("changeImage"):this.getAttribute("choose-label")||this.str("uploadImage"),this._remove.textContent=this.getAttribute("remove-label")||this.str("remove"),this._remove.hidden=!this._src,this._input.accept=this.getAttribute("accept")||"image/*"}async _pick(t){if(t)try{const e=await createImageBitmap(t,{imageOrientation:"from-image"}),n=Math.min(1,this._max/Math.max(e.width,e.height)),i=document.createElement("canvas");i.width=Math.max(1,Math.round(e.width*n)),i.height=Math.max(1,Math.round(e.height*n));const s=i.getContext("2d");"image/jpeg"===this._type&&(s.fillStyle="#fff",s.fillRect(0,0,i.width,i.height)),s.drawImage(e,0,0,i.width,i.height),e.close();const r=i.toDataURL(this._type,this._quality);this.src=r,this.emit("nk-change",{dataUrl:r,width:i.width,height:i.height,size:re(r)})}catch(e){this.emit("nk-error",{message:e?.message||String(e),name:t.name})}}setupEvents(){this._onChoose=()=>this._input.click(),this._onChange=t=>{const e=t.target.files?.[0];t.target.value="",this._pick(e)},this._onRemove=()=>{this.src="",this._choose.focus(),this.emit("nk-change",{dataUrl:"",width:0,height:0,size:0})},this._choose.addEventListener("click",this._onChoose),this._input.addEventListener("change",this._onChange),this._remove.addEventListener("click",this._onRemove)}teardownEvents(){this._choose?.removeEventListener("click",this._onChoose),this._input?.removeEventListener("change",this._onChange),this._remove?.removeEventListener("click",this._onRemove)}onStringsChanged(){this._sync()}onAttributeChanged(t,e,n){"src"===t&&(this._src=n||""),this._sync()}choose(){this._input?.click()}get src(){return this._src??this.getAttribute("src")??""}set src(t){this._src=t||"",this._sync()}get square(){return this.getBoolAttr("square")}set square(t){this.setBoolAttr("square",t)}}customElements.define("nk-image-picker",oe);const ae=t=>String(t).padStart(2,"0"),le=t=>`${t.getFullYear()}-${ae(t.getMonth()+1)}-${ae(t.getDate())}`,he=(t,e)=>new Date(t.getFullYear(),t.getMonth(),t.getDate()+e);function de(t){if(t instanceof Date)return Number.isNaN(t.getTime())?null:new Date(t.getFullYear(),t.getMonth(),t.getDate());if(t&&"object"==typeof t)return t.start?de(t.start):null;const e=String(t??"").trim();let n=e.match(/^(\d{4})-(\d{2})-(\d{2})/);return n?new Date(+n[1],+n[2]-1,+n[3]):(n=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/),n?new Date(+n[3],+n[2]-1,+n[1]):null)}function ce(t){const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));return e.setUTCDate(e.getUTCDate()+4-(e.getUTCDay()||7)),Math.ceil(((e-Date.UTC(e.getUTCFullYear(),0,1))/864e5+1)/7)}const pe=t=>t||document.documentElement.lang||navigator.language||"en";function ue(t){try{const e=new Intl.Locale(t),n=e.getWeekInfo?.()??e.weekInfo;if(n?.firstDay)return n.firstDay%7}catch{}return 1}function ge(t,e,n=0){const i=new Intl.DateTimeFormat(t,{weekday:"short"});return Array.from({length:7},(t,s)=>{const r=i.format(new Date(2026,5,7+(e+s)%7)).replace(".","");return n?r.slice(0,n):r})}function be(t,e){const[n,i]=t.split("-").map(Number),s=new Date(n,i-1,1),r=(s.getDay()-e+7)%7;return{m:i,first:s,day:t=>new Date(n,i-1,1-r+t),rows:Math.ceil((r+new Date(n,i,0).getDate())/7)}}function me(t,e){const[n,i]=t.split("-").map(Number);return le(new Date(n,i-1+e,1)).slice(0,7)}const ke=t=>/^de\b/i.test(t)?"KW":"W",_e='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 6l-6 6 6 6"/></svg>',ve='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>',xe={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},fe=new CSSStyleSheet;fe.replaceSync(":host([floating]) { display: block; position: fixed; top: 0; left: 0; z-index: 106; pointer-events: none; }");class ye extends x{static get hostStyles(){return fe}static get observedAttributes(){return["value","month","min","max","today","locale","week-start","weeks","weekend","range","time","clearable","days","label","today-label","prev-label","next-label","week-label","time-label","clear-label","floating","sheet","open","align","required"]}render(){this._readValue(this._pendingValue??this.getAttribute("value"));const t=this._pendingMonth||this._attrMonth();t&&(this._month=t),this._initialValue=this.getAttribute("value")??"",this._build()}_readValue(t){const e=String(t??"");if(this._start=this._end=this._day=null,this._time="",this.getBoolAttr("range")){const[t,n]=e.split("/");this._start=de(t)?le(de(t)):null,this._end=de(n)?le(de(n)):null}else de(e)&&(this._day=le(de(e)),this._time=e.match(/T(\d{2}:\d{2})/)?.[1]??"");const n=this._day||this._start;this._month=n?n.slice(0,7):this._month||this._attrMonth()||this._todayIso().slice(0,7),this._focus=null}_attrMonth(){const t=this.getAttribute("month");return/^\d{4}-\d{2}$/.test(t||"")?t:null}_todayIso(){return this.getAttribute("today")||le(new Date)}get value(){return this.getBoolAttr("range")?this._start?`${this._start}${this._end?`/${this._end}`:""}`:"":this._day?`${this._day}${this.getBoolAttr("time")&&this._time?`T${this._time}`:""}`:""}set value(t){this._readValue(t),this._grid?this._draw():this._pendingValue=String(t??"")}get start(){return this.getBoolAttr("range")?this._start:this._day}get end(){return this.getBoolAttr("range")?this._end:this._day}get month(){return this._month}set month(t){/^\d{4}-\d{2}$/.test(t)&&(this._month=t,this._focus=null,this._grid?this._draw():this._pendingMonth=t)}get days(){return this._days??{}}set days(t){this._days=t&&"object"==typeof t?t:{},this._grid&&this._draw()}_build(){const t=this.getBoolAttr("floating");this._cal=this.createElement("div",["nk-calendar"],{role:"group"});const e=this.createElement("div",["cal-head"]);this._title=this.createElement("div",["cal-title"],{"aria-live":"polite"}),this._todayBtn=this.createElement("button",["cal-nav"],{type:"button"}),this._prev=this.createElement("button",["cal-nav"],{type:"button"}),this._prev.innerHTML=_e,this._next=this.createElement("button",["cal-nav"],{type:"button"}),this._next.innerHTML=ve,e.append(this._title,this._todayBtn,this._prev,this._next),this._grid=this.createElement("div",["cal-grid"]),this._foot=this.createElement("div",["cal-foot"]),this._timeInput=this.createElement("input",["nk-input"],{type:"time"}),this._clear=this.createElement("button",["cal-nav"],{type:"button"}),this._cal.append(e,this._grid),this._pop=t?this.createElement("div",["nk-pop","floating"]):null,this._pop&&this._pop.appendChild(this._cal),this._wrapper.replaceChildren(this._pop??this._cal),this._draw()}get _hasTime(){return this.getBoolAttr("time")&&!this.getBoolAttr("range")}get _locale(){return pe(this.getAttribute("locale"))}get _weekStart(){const t=Number(this.getAttribute("week-start"));return this.hasAttribute("week-start")&&Number.isInteger(t)&&t>=0&&t<=6?t:ue(this._locale)}_syncPop(){this._pop?.classList.toggle("sheet",this.getBoolAttr("sheet")),this._pop?.classList.toggle("open",this.getBoolAttr("open"))}_draw(){const t=this._locale,e=this._weekStart,n=this.getBoolAttr("weeks"),i=this.getBoolAttr("range"),s=be(this._month,e),r=this._todayIso(),o=this.getAttribute("min")||"",a=this.getAttribute("max")||"",l=new Set((this.getAttribute("weekend")||"").split(",").map(t=>t.trim()).filter(Boolean).map(Number));let h=this._days;if(!h&&this.hasAttribute("days"))try{h=JSON.parse(this.getAttribute("days"))}catch{h={}}h??={};const d=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"});this._cal.classList.toggle("weeks",n),this._syncPop();const c=this.getAttribute("label");c?this._cal.setAttribute("aria-label",c):this._cal.removeAttribute("aria-label"),this._title.textContent=new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(s.first),this._todayBtn.textContent=this.getAttribute("today-label")||this.str("today"),this._prev.setAttribute("aria-label",this.getAttribute("prev-label")||this.str("previousMonth")),this._next.setAttribute("aria-label",this.getAttribute("next-label")||this.str("nextMonth"));const p=Array.from({length:42},(t,e)=>le(s.day(e))),u=i?this._start:this._day;this._focus&&p.includes(this._focus)||(this._focus=p.includes(u)?u:`${this._month}-01`);const g=[];n&&g.push(this._head(this.getAttribute("week-label")||ke(t)));for(const n of ge(t,e,2))g.push(this._head(n));for(let t=0;t<42;t++){const e=s.day(t),c=p[t],u=h[c]||{};if(n&&t%7==0){const t=this.createElement("span",["cal-week"],{"aria-hidden":"true"});t.textContent=ce(e),g.push(t)}const b=i&&this._start&&this._end&&c>this._start&&c<this._end,m=["cal-day",e.getMonth()!==s.m-1&&"out",(l.has(e.getDay())||u.off)&&"off",c===r&&"today",!i&&c===this._day&&"selected",i&&c===this._start&&"start",i&&c===(this._end||this._start)&&this._start&&"end",b&&"in-range"].filter(Boolean),k=this.createElement("button",m,{type:"button","data-date":c,tabindex:c===this._focus?"0":"-1","aria-pressed":String(m.includes("selected")||m.includes("start")||m.includes("end")),"aria-label":`${d.format(e)}${u.label?`, ${u.label}`:""}`});u.label&&(k.title=u.label),(o&&c<o||a&&c>a)&&k.setAttribute("aria-disabled","true"),k.textContent=e.getDate();const _=(u.marks||[]).slice(0,3);if(_.length){const t=this.createElement("span",["cal-marks"]);for(const e of _)t.appendChild(this.createElement("i",[e]));k.appendChild(t)}g.push(k)}const b=this._grid.contains(this._shadow.activeElement);this._grid.replaceChildren(...g),b&&this.focusDay();const m=this._hasTime,k=this.getBoolAttr("clearable");this._timeInput.value=this._time,this._timeInput.setAttribute("aria-label",this.getAttribute("time-label")||this.str("time")),this._clear.textContent=this.getAttribute("clear-label")||this.str("clear"),this._foot.replaceChildren(...[m&&this._timeInput,k&&this._clear].filter(Boolean)),m||k?this._cal.appendChild(this._foot):this._foot.remove(),this._syncForm()}_syncForm(){this.setFormValue(this.value),this.getBoolAttr("required")&&!this.value?this.setValidity({valueMissing:!0},"Please choose a date.",this._grid?.querySelector('[tabindex="0"]')??void 0):this.setValidity({})}_head(t){const e=this.createElement("span",["cal-wd"],{"aria-hidden":"true"});return e.textContent=t,e}_goMonth(t,e){t!==this._month&&(this._month=t,this.emit("nk-month",{month:t})),this._focus=e??null,this._draw()}_pick(t){const e=this._grid.querySelector(`[data-date="${t}"]`);if("true"===e?.getAttribute("aria-disabled"))return;const n=this.value;let i=!0;this.getBoolAttr("range")?!this._start||this._end?(this._start=t,this._end=null,i=!1):t<this._start?(this._end=this._start,this._start=t):this._end=t:this._day=t,this._focus=t,t.slice(0,7)!==this._month?this._goMonth(t.slice(0,7),t):this._draw(),i&&(this.value!==n&&this.emit("nk-change",{value:this.value,start:this.start,end:this.end,time:this._time||null}),this.getBoolAttr("floating")&&!this._hasTime&&this.close())}setupEvents(){this._onGrid=t=>{const e=t.target.closest(".cal-day");e&&this._pick(e.dataset.date)},this._onToday=()=>{const t=this._todayIso();this._goMonth(t.slice(0,7),t)},this._onPrev=()=>this._goMonth(me(this._month,-1)),this._onNext=()=>this._goMonth(me(this._month,1)),this._onKey=t=>{const e=t.target.closest?.(".cal-day");if(!e)return;const n=de(e.dataset.date),i=this._weekStart,s=(n.getDay()-i+7)%7;let r=null;if(xe[t.key])r=he(n,xe[t.key]);else if("Home"===t.key)r=he(n,-s);else if("End"===t.key)r=he(n,6-s);else if("PageUp"===t.key||"PageDown"===t.key){const e=("PageUp"===t.key?-1:1)*(t.shiftKey?12:1),i=new Date(n.getFullYear(),n.getMonth()+e+1,0).getDate();r=new Date(n.getFullYear(),n.getMonth()+e,Math.min(n.getDate(),i))}if(!r)return;t.preventDefault();const o=le(r);o.slice(0,7)!==this._month?this._goMonth(o.slice(0,7),o):(this._focus=o,this._draw())},this._onTime=()=>{this._time=this._timeInput.value,this._syncForm(),this._day&&this.emit("nk-change",{value:this.value,start:this.start,end:this.end,time:this._time||null})},this._onClear=()=>{this.value&&(this._day=this._start=this._end=null,this._time="",this._draw(),this.emit("nk-change",{value:"",start:null,end:null,time:null}))},this._onOutside=t=>{const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||(t.preventDefault(),t.stopPropagation(),this.close())},this._onEscape=t=>{"Escape"===t.key&&this.getBoolAttr("floating")&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._grid.addEventListener("click",this._onGrid),this._grid.addEventListener("keydown",this._onKey),this._todayBtn.addEventListener("click",this._onToday),this._prev.addEventListener("click",this._onPrev),this._next.addEventListener("click",this._onNext),this._timeInput.addEventListener("change",this._onTime),this._clear.addEventListener("click",this._onClear),document.addEventListener("keydown",this._onEscape,!0),this.getBoolAttr("open")&&document.addEventListener("click",this._onOutside,!0)}teardownEvents(){this._grid?.removeEventListener("click",this._onGrid),this._grid?.removeEventListener("keydown",this._onKey),this._todayBtn?.removeEventListener("click",this._onToday),this._prev?.removeEventListener("click",this._onPrev),this._next?.removeEventListener("click",this._onNext),this._timeInput?.removeEventListener("change",this._onTime),this._clear?.removeEventListener("click",this._onClear),document.removeEventListener("keydown",this._onEscape,!0),document.removeEventListener("click",this._onOutside,!0)}onStringsChanged(){this._grid&&this._draw()}onAttributeChanged(t,e,n){if("value"===t)return this._readValue(n),void this._draw();if("month"!==t){if("open"===t||"sheet"===t)return this._syncPop(),void("open"===t&&this._syncOpen());if("align"!==t){if("floating"===t)return this.teardownEvents(),this._build(),void(this.isConnected&&this.setupEvents());"range"===t&&this._readValue(this.getAttribute("value")),"days"===t&&(this._days=null),this._draw()}}else this.month=n}_syncOpen(){const t=this.getBoolAttr("open");if(this._anchor&&(this._anchor.shadowRoot?.querySelector("button, a[href]")??this._anchor).setAttribute("aria-expanded",String(t)),t)this._returnFocus=st(),this._returnFocus?.matches(":focus-visible")&&requestAnimationFrame(()=>this.focusDay()),document.addEventListener("click",this._onOutside,!0);else{document.removeEventListener("click",this._onOutside,!0);const t=this._returnFocus;this._returnFocus=null;const e=st();t?.isConnected&&e&&this._shadow.contains(e)&&t.focus({preventScroll:!0})}this.emit("nk-toggle",{open:t})}resetValue(){this._readValue(this._initialValue),this._draw()}restoreValue(t){this._readValue(t),this._draw()}onFormDisabled(t){this._cal?.toggleAttribute("inert",t)}show(t){t&&(this._anchor=t,zt(this,t,this.getAttribute("align")));const e=this.start;e&&e.slice(0,7)!==this._month&&(this._month=e.slice(0,7),this._focus=null,this._draw()),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(t){this.getBoolAttr("open")?this.close():this.show(t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}focusDay(){this._grid?.querySelector('[tabindex="0"]')?.focus()}}customElements.define("nk-calendar",ye);const we=new Set(["nk-menu","nk-pop","nk-modal","nk-sheet","nk-dialog","nk-cmdk","nk-toast"]),Ae=["nk-pop","nk-modal-backdrop","nk-sheet-backdrop","nk-dialog-backdrop","nk-cmdk-backdrop"],Ee=()=>matchMedia("(max-width: 860px)").matches;class Ce extends v{static get observedAttributes(){return["open","label","close-label","resizable","width","min","max","resize-label","inset"]}render(){this._backdrop=this.createElement("div",["nk-peek-backdrop"]),this._box=this.createElement("aside",["nk-peek"],{role:"dialog",tabindex:"-1"}),this._handle=this.createElement("div",["pk-resize"],{role:"separator","aria-orientation":"vertical",tabindex:"0"}),this._box.appendChild(this._handle);const t=this.createElement("div",["pk-bar"]);this._close=this.createElement("button",["nk-topbar-btn"],{type:"button"}),this._close.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 17 5-5-5-5M13 17l5-5-5-5"/></svg>',t.append(this._close,this.createElement("slot",[],{name:"actions"}));const e=this.createElement("div",["pk-body"]);e.appendChild(document.createElement("slot")),this._box.append(t,e),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncLabels(),this._syncResize(),this.hasAttribute("width")&&this._setWidth(Number(this.getAttribute("width"))),this._syncOpen()}get _min(){return Number(this.getAttribute("min"))||380}get _max(){return Number(this.getAttribute("max"))||Math.max(this._min,innerWidth-320)}get width(){return parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--nk-peek-width"))||560}set width(t){this._setWidth(Number(t))}_setWidth(t){Number.isFinite(t)&&(t=Math.round(Math.min(Math.max(t,this._min),Math.max(this._min,this._max))),document.documentElement.style.setProperty("--nk-peek-width",`${t}px`),this._handle.setAttribute("aria-valuenow",t))}_syncResize(){this._handle.hidden=!this.getBoolAttr("resizable"),this._handle.setAttribute("aria-label",this.getAttribute("resize-label")||this.str("resize")),this._handle.setAttribute("aria-valuemin",this._min),this._handle.setAttribute("aria-valuenow",Math.round(this.width))}_app(){return this.closest("nk-app")??document.querySelector("nk-app")}_syncInset(){const t=this.getBoolAttr("inset")&&this.getBoolAttr("open")&&!Ee();t?this._app()?.setAttribute("peek-inset",""):this._insetApp&&this._app()?.removeAttribute("peek-inset"),this._insetApp=t}_syncLabels(){const t=this.getAttribute("label");t?this._box.setAttribute("aria-label",t):this._box.removeAttribute("aria-label"),this._close.setAttribute("aria-label",this.getAttribute("close-label")||this.str("close"))}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._syncInset(),t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=st(),Ee()&&(this._modal=!0,this._box.setAttribute("aria-modal","true"),et(),this._undoInert=it(this)),requestAnimationFrame(()=>this._box.focus({preventScroll:!0}));else{this._modal&&(this._modal=!1,this._box.removeAttribute("aria-modal"),nt(),this._undoInert?.(),this._undoInert=null);const t=st(),e=t&&(this.contains(t)||this._shadow.contains(t)||t===document.body),n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&"function"==typeof n.focus&&n.focus({preventScroll:!0})}}setupEvents(){this._onClose=()=>this.close(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onOutside=t=>{if(!this.getBoolAttr("open")||this._shownAt>=t.timeStamp)return;const e=t.composedPath();e.includes(this)||e.some(t=>1===t.nodeType&&(we.has(t.localName)||Ae.some(e=>t.classList.contains(e))))||this.close()};const t=()=>this.emit("nk-resize",{width:Math.round(this.width)});this._onResizeStart=t=>{0===t.button&&(t.preventDefault(),this._handle.setPointerCapture(t.pointerId),this._handle.classList.add("active"))},this._onResizeMove=t=>{this._handle.hasPointerCapture(t.pointerId)&&this._setWidth(innerWidth-t.clientX)},this._onResizeEnd=()=>{this._handle.classList.remove("active"),t()},this._onResizeKey=e=>{const n={ArrowLeft:16,ArrowRight:-16}[e.key];n&&(e.preventDefault(),this._setWidth(this.width+n),t())},this._onViewport=()=>this._syncInset(),this._close.addEventListener("click",this._onClose),this._backdrop.addEventListener("click",this._onBackdrop),this._handle.addEventListener("pointerdown",this._onResizeStart),this._handle.addEventListener("pointermove",this._onResizeMove),this._handle.addEventListener("lostpointercapture",this._onResizeEnd),this._handle.addEventListener("keydown",this._onResizeKey),document.addEventListener("keydown",this._onKey),document.addEventListener("click",this._onOutside),addEventListener("resize",this._onViewport)}teardownEvents(){this._close?.removeEventListener("click",this._onClose),this._backdrop?.removeEventListener("click",this._onBackdrop),this._handle?.removeEventListener("pointerdown",this._onResizeStart),this._handle?.removeEventListener("pointermove",this._onResizeMove),this._handle?.removeEventListener("lostpointercapture",this._onResizeEnd),this._handle?.removeEventListener("keydown",this._onResizeKey),document.removeEventListener("keydown",this._onKey),document.removeEventListener("click",this._onOutside),removeEventListener("resize",this._onViewport),this._insetApp&&(this._app()?.removeAttribute("peek-inset"),this._insetApp=!1),this._modal&&(this._modal=!1,nt(),this._undoInert?.(),this._undoInert=null),this._wasOpen=!1}onStringsChanged(){this._syncResize(),this._syncLabels()}onAttributeChanged(t,e,n){if("width"!==t)if("inset"!==t){if("open"!==t)return this._syncLabels(),void this._syncResize();this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})}else this._syncInset();else this._setWidth(Number(n))}show(){this._shownAt=performance.now(),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.getBoolAttr("open")?this.close():this.show()}get open(){return this.getBoolAttr("open")}set open(t){t?this.show():this.close()}}customElements.define("nk-peek",Ce);class Be extends v{static get observedAttributes(){return["open","title","wide","alert"]}render(){this.takeTitle(),this.returnValue="",this._backdrop=this.createElement("div",["nk-dialog-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-dialog"],{"aria-modal":"true",tabindex:"-1"}),this._heading=this.createElement("div",["dl-title"],{id:"title"});const t=this.createElement("div",["dl-body"],{id:"body"});t.appendChild(document.createElement("slot")),this._actions=this.createElement("div",["dl-actions"]),this._actionsSlot=this.createElement("slot",[],{name:"actions"}),this._actions.appendChild(this._actionsSlot),this._box.append(this._heading,t,this._actions),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncTitle(),this._syncMode(),this._syncOpen()}_syncTitle(){const t=this._titleText||"";this._heading.textContent=t,this._heading.hidden=!t,t?this._box.setAttribute("aria-labelledby","title"):this._box.removeAttribute("aria-labelledby")}_syncMode(){const t=this.getBoolAttr("alert");this._box.setAttribute("role",t?"alertdialog":"dialog"),t?this._box.setAttribute("aria-describedby","body"):this._box.removeAttribute("aria-describedby"),this._box.classList.toggle("wide",this.getBoolAttr("wide"))}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=this._from??st(),this._from=null,this._wasInert=this.inert,this.inert=!1,et(),this._undoInert=it(this),requestAnimationFrame(()=>(this.querySelector("[autofocus]")||rt(this)||this._box).focus({preventScroll:!0}));else{nt(),this._undoInert?.(),this._undoInert=null,this.inert=this._wasInert;const t=this._returnFocus;this._returnFocus=null,t?.isConnected&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close("")},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close(""))},this._onClick=t=>{const e=t.composedPath(),n=e.slice(0,Math.max(0,e.indexOf(this))).filter(t=>t instanceof Element&&this.contains(t)),i=n.find(t=>"nk-btn"===t.localName||"button"===t.localName);i&&"submit"!==i.getAttribute("type")&&!i.hasAttribute("disabled")&&(i.hasAttribute("data-close")?this.close(i.getAttribute("data-close")):i.hasAttribute("value")&&n.some(t=>"actions"===t.getAttribute("slot"))&&this.close(i.getAttribute("value")))},this._onSubmit=t=>{"dialog"===(t.target.getAttribute("method")||"").toLowerCase()&&(t.preventDefault(),this.close(t.submitter?.value||t.submitter?.getAttribute?.("value")||"submit"))},this._onSlot=()=>{this._actions.hidden=!this._actionsSlot.assignedElements().length},this._backdrop.addEventListener("click",this._onBackdrop),this.addEventListener("click",this._onClick),this.addEventListener("submit",this._onSubmit),this._actionsSlot.addEventListener("slotchange",this._onSlot),document.addEventListener("keydown",this._onKey,!0),this._onSlot()}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),this.removeEventListener("click",this._onClick),this.removeEventListener("submit",this._onSubmit),this._actionsSlot?.removeEventListener("slotchange",this._onSlot),document.removeEventListener("keydown",this._onKey,!0),this._wasOpen&&(nt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t,e,n){"title"!==t?"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncMode():this.takeTitle(n)&&this._syncTitle()}show(t){this.returnValue="",this._from=t??null,this.setBoolAttr("open",!0)}close(t=""){return!!this.getBoolAttr("open")&&(!!this.emit("nk-close",{value:t})&&(this.returnValue=t,this.setBoolAttr("open",!1),!0))}toggle(){this.getBoolAttr("open")?this.close(""):this.show()}get open(){return this.getBoolAttr("open")}set open(t){t?this.show():this.close("")}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._syncTitle()}}customElements.define("nk-dialog",Be);const Le=new CSSStyleSheet;Le.replaceSync(":host { display: block; position: fixed; top: 0; left: 0; z-index: 130; pointer-events: none; }");let Se=0;class ze extends v{static get hostStyles(){return Le}static get observedAttributes(){return["for","shortcut"]}render(){this._bubble=this.createElement("div",["nk-tooltip"],{role:"tooltip"}),this._slot=document.createElement("slot"),this._text=document.createTextNode(""),this._key=this.createElement("span",["tt-key"]),this._bubble.append(this._slot,this._text,this._key),this._wrapper.appendChild(this._bubble),this._fill(null)}get _delay(){const t=Number(this.getAttribute("delay"));return this.hasAttribute("delay")&&t>=0?t:400}_fill(t,e=this.getAttribute("shortcut")){this._slot.style.display=null==t?"":"none",this._text.data=t??"",this._bubble.classList.toggle("lines",(t??"").includes("\n")),this._key.textContent=e||"",this._key.hidden=!e}show(t,e,n){clearTimeout(this._timer),t&&(this._target=t instanceof Element?t:null,this._fill(e??null,n),this._describe(t),function(t,e,n="bottom",i=6){const s=e instanceof Element?Lt(e):e,r=St(t),o=r.width,a=r.height,l=s.bottom+i,h=s.top-i-a,d="top"===n?h<8?l:h:l+a>innerHeight-8?h:l,c=Math.min(Math.max(8,(s.left+s.right)/2-o/2),innerWidth-8-o);t.style.top=`${Math.round(d-r.y)}px`,t.style.left=`${Math.round(c-r.x)}px`,t.style.right="auto"}(this,t,"top"===this.getAttribute("placement")?"top":"bottom"),this._bubble.classList.add("open"))}hide(){clearTimeout(this._timer),this._bubble?.classList.remove("open"),this._describe(null),this._target=null}get open(){return!!this._bubble?.classList.contains("open")}_describe(t){if(this._described){const t=(this._described.getAttribute("aria-describedby")||"").split(/\s+/).filter(t=>t&&t!==this.id);t.length?this._described.setAttribute("aria-describedby",t.join(" ")):this._described.removeAttribute("aria-describedby"),this._described=null}if(!(t instanceof Element)||t.getRootNode()!==this.getRootNode())return;this.id||="nk-tooltip-"+ ++Se;const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);e.includes(this.id)||t.setAttribute("aria-describedby",[...e,this.id].join(" ")),this._described=t}_targetOf(t){const e=t.composedPath(),n=this.getAttribute("for");if(n){const t=this.getRootNode().getElementById?.(n);return t&&e.includes(t)?t:null}return e.find(t=>t instanceof Element&&t.hasAttribute("data-tooltip"))??null}_showFor(t){const e=this.hasAttribute("for");this.show(t,e?null:t.getAttribute("data-tooltip"),e?this.getAttribute("shortcut"):t.getAttribute("data-tooltip-key"))}setupEvents(){this._onOver=t=>{const e="touch"===t.pointerType?null:this._targetOf(t);e!==this._target&&(this.hide(),e&&(this._target=e,this._timer=setTimeout(()=>this._showFor(e),this._delay)))},this._onFocus=t=>{const e=this._targetOf(t);e&&st()?.matches(":focus-visible")&&(this.hide(),this._target=e,this._showFor(e))},this._onHide=()=>this.hide(),this._onKey=t=>{"Escape"===t.key&&this.open&&this.hide()},document.addEventListener("pointerover",this._onOver),document.addEventListener("focusin",this._onFocus),document.addEventListener("focusout",this._onHide),document.addEventListener("pointerdown",this._onHide,!0),document.addEventListener("scroll",this._onHide,!0),document.addEventListener("wheel",this._onHide,{capture:!0,passive:!0}),document.addEventListener("keydown",this._onKey)}teardownEvents(){document.removeEventListener("pointerover",this._onOver),document.removeEventListener("focusin",this._onFocus),document.removeEventListener("focusout",this._onHide),document.removeEventListener("pointerdown",this._onHide,!0),document.removeEventListener("scroll",this._onHide,!0),document.removeEventListener("wheel",this._onHide,{capture:!0}),document.removeEventListener("keydown",this._onKey),this.hide()}onAttributeChanged(t){"shortcut"!==t||this._text.data||this._fill(null),"for"===t&&this.hide()}}customElements.define("nk-tooltip",ze);class Te extends v{static get observedAttributes(){return["open","pane"]}render(){this._backdrop=this.createElement("div",["nk-modal-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-modal"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._nav=this.createElement("nav",["nk-settings-nav"],{"aria-label":this.str("settings")}),this._nav.appendChild(this.createElement("slot",[],{name:"user"})),this._rows=document.createElement("div"),this._nav.appendChild(this._rows),this._nav.appendChild(this.createElement("slot",[],{name:"nav"})),this._content=this.createElement("div",["nk-settings-content"]),this._slot=document.createElement("slot"),this._content.appendChild(this._slot),this._box.append(this._nav,this._content),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncOpen(),this.requestNav()}get panes(){return[...this.querySelectorAll(":scope > nk-settings-pane")]}requestNav(){this._navQueued||(this._navQueued=!0,queueMicrotask(()=>{this._navQueued=!1,this._buildNav()}))}_buildNav(){if(!this._rows)return;const t=this.panes.filter(t=>t.getAttribute("label"));this._rows.replaceChildren(),this._nav.style.display=t.length||this.querySelector(':scope > [slot="nav"], :scope > [slot="user"]')?"":"none";let e=null;for(const n of t){const t=n.getAttribute("group");if(t&&t!==e){const n=this.createElement("div",["nk-section-label"]);n.textContent=t,this._rows.appendChild(n),e=t}const i=this.createElement("div",["nk-tree-item"],{role:"tab",tabindex:"0","data-pane":n.name}),s=this.createElement("span",["icon"]);s.textContent=n.getAttribute("icon")||"";const r=this.createElement("span",["label"]);r.textContent=n.getAttribute("label"),i.append(s,r),this._rows.appendChild(i)}this._syncActive()}_syncActive(){const t=this.panes;let e=this.getAttribute("pane");t.some(t=>t.name===e)||(e=(t.find(t=>t.hasAttribute("active"))||t[0])?.name??null);for(const t of this._rows.querySelectorAll("[data-pane]")){const n=t.dataset.pane===e;t.classList.toggle("active",n),t.setAttribute("aria-selected",n?"true":"false")}for(const n of t)n.active=n.name===e;this._current=e}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=document.activeElement,et(),this._undoInert=it(this),requestAnimationFrame(()=>{(this._rows.querySelector(".nk-tree-item.active")||rt(this)||this._box).focus({preventScroll:!0})});else{nt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onNavClick=t=>{const e=t.target.closest("[data-pane]");e&&(e.focus(),this.pane=e.dataset.pane)},this._onNavKey=t=>{const e=t.target.closest?.("[data-pane]");if(!e)return;if("Enter"===t.key||" "===t.key)return t.preventDefault(),void(this.pane=e.dataset.pane);const n={ArrowDown:1,ArrowUp:-1}[t.key];if(!n)return;const i=[...this._rows.querySelectorAll("[data-pane]")],s=i[(i.indexOf(e)+n+i.length)%i.length];t.preventDefault(),s.focus(),this.pane=s.dataset.pane},this._onSlot=()=>this.requestNav(),this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey),this._rows.addEventListener("click",this._onNavClick),this._rows.addEventListener("keydown",this._onNavKey),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),this._rows?.removeEventListener("click",this._onNavClick),this._rows?.removeEventListener("keydown",this._onNavKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._wasOpen&&(nt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onStringsChanged(){this._nav.setAttribute("aria-label",this.str("settings"))}onAttributeChanged(t){if("open"===t)this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")});else if("pane"===t){const t=this._current;this._syncActive(),this._current!==t&&this.emit("nk-select",{value:this._current,label:this.panes.find(t=>t.name===this._current)?.getAttribute("label")??this._current})}}show(t){t&&this.setAttribute("pane",t),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get pane(){return this._current??this.getAttribute("pane")}set pane(t){this.setAttribute("pane",t)}}customElements.define("nk-modal",Te);class De extends v{static get observedAttributes(){return["name","label","icon","group","title","active"]}render(){this._section=this.createElement("section",["nk-settings-pane"],{role:"tabpanel"}),this._h2=document.createElement("h2"),this._section.appendChild(this._h2),this._section.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._section),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._h2.textContent=t||"",this._h2.style.display=t?"":"none",this._section.classList.toggle("active",this.getBoolAttr("active")),this._section.setAttribute("aria-label",this.getAttribute("label")||t||this.getAttribute("name")||"")}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&(this._sync(),["label","icon","group","name"].includes(t)&&this.closest("nk-modal")?.requestNav?.())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get name(){return this.getAttribute("name")??this.getAttribute("label")??""}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-settings-pane",De);class Me extends v{static get observedAttributes(){return["name","mail","avatar"]}render(){const t=this.createElement("div",["nk-settings-user"]);this._avatar=this.createElement("div",["avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const n=this.createElement("div",["u-text"]);this._name=this.createElement("div",["name"]),this._mail=this.createElement("div",["mail"]),n.append(this._name,this._mail),t.append(e,n),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t;const e=this.getAttribute("mail");this._mail.textContent=e||"",this._mail.style.display=e?"":"none",this._avatar.textContent=this.getAttribute("avatar")||t.split(/\s+/).map(t=>t[0]).join("").slice(0,2).toUpperCase()}onAttributeChanged(){this._sync()}}function Ne(t,e){const n=t.trim().toLowerCase();if(!n)return 1;const i=e.toLowerCase();let s=0,r=0,o=0;for(let t=0;t<n.length;t++){const e=i.indexOf(n[t],s);if(e<0)return 0;o=e===s?o+1:0,r+=1+2*o+(0===e||/[\s\-_/.]/.test(i[e-1])?3:0)-Math.min(3,.25*(e-s)),s=e+1}return i.startsWith(n)&&(r+=10),Math.max(.01,r/(1+i.length/40))}customElements.define("nk-settings-user",Me);class Fe extends v{static get observedAttributes(){return["open","hotkey","placeholder"]}render(){this._backdrop=this.createElement("div",["nk-cmdk-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-cmdk"],{role:"dialog","aria-modal":"true"});const t=this.createElement("div",["nk-cmdk-input-row"]),e=document.createElement("span");e.style.fontSize="15px",e.textContent="๐Ÿ”",this._input=this.createElement("input",[],{type:"text",autocomplete:"off",role:"combobox","aria-expanded":"true","aria-autocomplete":"list"});const n=this.createElement("kbd",["nk-kbd"]);n.textContent="esc",t.append(e,this._input,n),this._list=this.createElement("div",["nk-cmdk-list"],{role:"listbox",id:"list"}),this._input.setAttribute("aria-controls","list"),this._footer=this.createElement("div",["nk-cmdk-footer"]);const i=this.createElement("slot",[],{name:"footer"});i.innerHTML='<span><kbd class="nk-kbd">โ†‘</kbd><kbd class="nk-kbd">โ†“</kbd> navigate</span><span><kbd class="nk-kbd">โ†ต</kbd> open</span><span><kbd class="nk-kbd">โŒ˜</kbd><kbd class="nk-kbd">K</kbd> toggle</span>',this._footer.appendChild(i),this._box.append(t,this._list,this._footer),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._commands=[],this._index=0,this._syncAttrs(),this._renderList(),this._syncOpen()}_syncAttrs(){this._input.placeholder=this.getAttribute("placeholder")||this.str("commandPlaceholder"),this._box.setAttribute("aria-label",this.str("commandPalette"))}onStringsChanged(){this._syncAttrs()}results(){const t=this._input?.value??"",e=[];for(const n of this._commands){const i=(n.items||[]).map(e=>({item:e,group:n.group,score:Ne(t,`${e.label} ${e.keywords||""}`)})).filter(t=>t.score>0);i.sort((t,e)=>e.score-t.score),e.push(...i)}return e}_renderList(){if(!this._list)return;const t=this.results();if(this._index=Math.min(this._index,Math.max(0,t.length-1)),this._list.replaceChildren(),!t.length){const t=this.createElement("div",["nk-cmdk-empty"]);return t.textContent=`No results for โ€œ${this._input.value}โ€`,this._list.appendChild(t),void this._input.removeAttribute("aria-activedescendant")}let e=null;t.forEach((t,n)=>{if(t.group&&t.group!==e){const n=this.createElement("div",["nk-cmdk-group"]);n.textContent=t.group,this._list.appendChild(n),e=t.group}const i=this.createElement("div",["nk-cmdk-item"],{role:"option",id:`opt-${n}`,"data-index":n});i.classList.toggle("selected",n===this._index),i.setAttribute("aria-selected",n===this._index?"true":"false");const s=this.createElement("span",["m-icon"]);s.textContent=t.item.icon||"";const r=document.createElement("span");if(r.textContent=t.item.label,i.append(s,r),t.item.shortcut){const e=this.createElement("span",["m-shortcut"]);e.textContent=t.item.shortcut,i.appendChild(e)}this._list.appendChild(i)}),this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}_move(t){const e=this.results().length;if(e){this._index=(this._index+t+e)%e;for(const t of this._list.querySelectorAll(".nk-cmdk-item")){const e=Number(t.dataset.index)===this._index;t.classList.toggle("selected",e),t.setAttribute("aria-selected",e?"true":"false"),e&&t.scrollIntoView({block:"nearest"})}this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}}pick(t=this._index){const e=this.results()[t];if(!e)return;const n=this._input.value;this.close();this.emit("nk-command",{id:e.item.id??e.item.label,item:e.item,query:n})&&"function"==typeof e.item.action&&e.item.action(e.item)}_matchesHotkey(t){const e=(this.getAttribute("hotkey")||"mod+k").toLowerCase().split("+"),n=e.pop(),i=!e.includes("mod")||(t.metaKey||t.ctrlKey),s=e.includes("shift")?t.shiftKey:!t.shiftKey,r=e.includes("alt")?t.altKey:!t.altKey;return i&&s&&r&&t.key.toLowerCase()===n}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=document.activeElement,this._input.value="",this._index=0,this._renderList(),et(),this._undoInert=it(this),requestAnimationFrame(()=>this._input.focus({preventScroll:!0}));else{nt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onDocKey=t=>{if(this._matchesHotkey(t))return t.preventDefault(),void this.toggle();"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onInput=()=>{this._index=0,this._renderList()},this._onInputKey=t=>{"ArrowDown"===t.key?(t.preventDefault(),this._move(1)):"ArrowUp"===t.key?(t.preventDefault(),this._move(-1)):"Enter"===t.key&&(t.preventDefault(),this.pick())},this._onListClick=t=>{const e=t.target.closest(".nk-cmdk-item");e&&this.pick(Number(e.dataset.index))},this._onListMove=t=>{const e=t.target.closest(".nk-cmdk-item");e&&Number(e.dataset.index)!==this._index&&(this._index=Number(e.dataset.index),this._move(0))},this._onListDown=t=>t.preventDefault(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},document.addEventListener("keydown",this._onDocKey),this._input.addEventListener("input",this._onInput),this._input.addEventListener("keydown",this._onInputKey),this._list.addEventListener("click",this._onListClick),this._list.addEventListener("mousemove",this._onListMove),this._list.addEventListener("mousedown",this._onListDown),this._backdrop.addEventListener("click",this._onBackdrop)}teardownEvents(){document.removeEventListener("keydown",this._onDocKey),this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("keydown",this._onInputKey),this._list?.removeEventListener("click",this._onListClick),this._list?.removeEventListener("mousemove",this._onListMove),this._list?.removeEventListener("mousedown",this._onListDown),this._backdrop?.removeEventListener("click",this._onBackdrop),this._wasOpen&&(nt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t){"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncAttrs()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get commands(){return this._commands}set commands(t){this._commands=Array.isArray(t)?t:[],this._index=0,this._renderList()}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get query(){return this._input?.value??""}set query(t){this._input&&(this._input.value=t,this._index=0,this._renderList())}}customElements.define("nk-cmdk",Fe);const Ie=new CSSStyleSheet;Ie.replaceSync(":host([floating]) { display: block; position: fixed; top: 0; left: 0; z-index: 106; pointer-events: none; }");class Ve extends v{static get hostStyles(){return Ie}static get observedAttributes(){return["floating","sheet","open","align"]}render(){this._box=this.createElement("div",["nk-pop","nk-menu"],{role:"menu"}),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._syncMode()}_syncMode(){this._box.classList.toggle("floating",this.getBoolAttr("floating")),this._box.classList.toggle("sheet",this.getBoolAttr("sheet")),this._box.classList.toggle("open",this.getBoolAttr("open"))}onAttributeChanged(t){if(this._syncMode(),"open"!==t)return;const e=this.getBoolAttr("open");if(this._anchor&&(this._anchor.shadowRoot?.querySelector("button, a[href]")??this._anchor).setAttribute("aria-expanded",String(e)),e)this._returnFocus=st(),this._returnFocus?.matches(":focus-visible")&&requestAnimationFrame(()=>this.focusFirst()),document.addEventListener("click",this._onOutside,!0);else{document.removeEventListener("click",this._onOutside,!0);const t=this._returnFocus;this._returnFocus=null,t?.isConnected&&this.contains(document.activeElement)&&t.focus({preventScroll:!0})}this.emit("nk-toggle",{open:e})}show(t){t&&(this._anchor=t,zt(this,t,this.getAttribute("align"))),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(t){this.getBoolAttr("open")?this.close():this.show(t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get items(){return[...this.querySelectorAll(":scope > nk-menu-item")].filter(t=>t.selectable)}setupEvents(){this._onKey=t=>{const e={ArrowDown:1,ArrowUp:-1}[t.key],n=t.target.closest?.("nk-menu-item"),i=this.items;if(i.length)if(e){t.preventDefault();const s=i.indexOf(n);i[(s+e+i.length)%i.length].focus()}else"Enter"!==t.key&&" "!==t.key||!n||(t.preventDefault(),n.select())},this.addEventListener("keydown",this._onKey),this._onOutside=t=>{const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||(t.preventDefault(),t.stopPropagation(),this.close())},this._onEscape=t=>{"Escape"===t.key&&this.getBoolAttr("floating")&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onSelect=()=>{this.getBoolAttr("floating")&&this.close()},document.addEventListener("keydown",this._onEscape,!0),this.addEventListener("nk-select",this._onSelect),this.getBoolAttr("open")&&document.addEventListener("click",this._onOutside,!0)}teardownEvents(){this.removeEventListener("keydown",this._onKey),document.removeEventListener("keydown",this._onEscape,!0),this.removeEventListener("nk-select",this._onSelect),document.removeEventListener("click",this._onOutside,!0)}focusFirst(){this.items[0]?.focus()}}customElements.define("nk-menu",Ve);class je extends v{static get observedAttributes(){return["icon","shortcut","danger","value","type","disabled","checked"]}render(){this._build()}_build(){const t=this.getAttribute("type");let e;if("separator"===t)e=this.createElement("div",["nk-menu-sep"],{role:"separator"});else if("label"===t)e=this.createElement("div",["nk-menu-label"]),e.appendChild(document.createElement("slot"));else{const n="switch"===t;this._check="check"===t,e=this.createElement("div",["nk-menu-item"],{role:n||this._check?"menuitemcheckbox":"menuitem",tabindex:"-1"}),this._icon=this.createElement("span",["m-icon"]);const i=this.createElement("slot",[],{name:"icon"});i.appendChild(this._icon),this._shortcut=this.createElement("span",["m-shortcut"]),e.append(i,document.createElement("slot"),this._shortcut),this._switch=n?this.createElement("span",["nk-switch"],{"aria-hidden":"true"}):null,this._switch&&e.appendChild(this._switch)}this._el?(this._el.removeEventListener("click",this._onClick),this._el.replaceWith(e)):this._wrapper.appendChild(e),this._el=e,this._onClick&&e.addEventListener("click",this._onClick),this._sync()}_sync(){if(!this._el.classList.contains("nk-menu-item"))return;const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none";const e=this.getAttribute("shortcut");if(this._shortcut.textContent=e||"",this._shortcut.style.display=e?"":"none",this._el.classList.toggle("danger",this.getBoolAttr("danger")),this._el.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._switch||this._check){const t=this.getBoolAttr("checked")?"true":"false";this._el.setAttribute("aria-checked",t),this._switch&&this._switch.setAttribute("aria-checked",t),this._check&&(this._shortcut.textContent="true"===t?"โœ“":"",this._shortcut.style.display="")}}setupEvents(){this._onClick=()=>this.select(),this._el.addEventListener("click",this._onClick)}teardownEvents(){this._el?.removeEventListener("click",this._onClick)}select(){if(this._el.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled"))return this._switch||this._check?(this.checked=!this.checked,void this.emit("nk-change",{value:this.value,checked:this.checked,item:this})):void this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this})}onAttributeChanged(t){"type"===t?this._build():this._sync()}focus(t){this._el?.focus(t)}get selectable(){return this._el?.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled")}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-menu-item",je);const qe=new CSSStyleSheet;qe.replaceSync('\n .nk-pop-anchor { position: relative; display: inline-block; }\n .nk-pop-float { display: none; position: absolute; z-index: 50; top: 100%; left: 0; margin-top: 4px; }\n :host([open]) .nk-pop-float { display: block; }\n :host([placement="bottom-end"]) .nk-pop-float { left: auto; right: 0; }\n :host([placement="top-start"]) .nk-pop-float { top: auto; bottom: 100%; margin: 0 0 4px; }\n :host([placement="top-end"]) .nk-pop-float { top: auto; bottom: 100%; left: auto; right: 0; margin: 0 0 4px; }\n');const Ke=new Set(["nk-menu","nk-emoji-picker"]);class Oe extends v{static get hostStyles(){return qe}static get observedAttributes(){return["open","placement","bare"]}render(){const t=this.createElement("div",["nk-pop-anchor"]);this._triggerSlot=this.createElement("slot",[],{name:"trigger"}),this._float=this.createElement("div",["nk-pop-float"]),this._surface=this.createElement("div",["nk-pop"]),this._slot=document.createElement("slot"),this._surface.appendChild(this._slot),this._float.appendChild(this._surface),t.append(this._triggerSlot,this._float),this._wrapper.appendChild(t),this._syncSurface()}_syncSurface(){const t=this.getBoolAttr("bare")||this._slot.assignedElements().some(t=>Ke.has(t.localName));this._surface.className=t?"":"nk-pop"}setupEvents(){this._onTrigger=t=>{t.composedPath().some(t=>t instanceof Element&&"trigger"===t.getAttribute?.("slot"))&&(t.stopPropagation(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onSelect=t=>{t.target!==this&&this.close()},this._onSlot=()=>this._syncSurface(),this.addEventListener("click",this._onTrigger),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onKey),this._float.addEventListener("nk-select",this._onSelect),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this.removeEventListener("click",this._onTrigger),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onKey),this._float?.removeEventListener("nk-select",this._onSelect),this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("bare"===t&&this._syncSurface(),"open"===t){const t=this.getBoolAttr("open");for(const e of this._triggerSlot.assignedElements())e.setAttribute("aria-expanded",t?"true":"false");this.emit("nk-toggle",{open:t})}}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get placement(){return this.getAttribute("placement")||"bottom-start"}set placement(t){this.setAttribute("placement",t)}}customElements.define("nk-pop",Oe);const Pe=(t,e,n)=>n.map(([n,i])=>({char:n,name:i,cat:t,icon:e})),Re=[{id:"smileys",icon:"๐Ÿ˜€"},{id:"people",icon:"๐Ÿ‘‹"},{id:"nature",icon:"๐ŸŒฟ"},{id:"food",icon:"โ˜•"},{id:"activity",icon:"๐ŸŽฏ"},{id:"travel",icon:"๐Ÿš€"},{id:"objects",icon:"๐Ÿ’ก"},{id:"symbols",icon:"โœ…"}],$e=[...Pe("smileys","๐Ÿ˜€",[["๐Ÿ˜€","grinning"],["๐Ÿ˜Š","smile blush"],["๐Ÿ˜‚","joy laugh"],["๐Ÿ™‚","slight smile"],["๐Ÿ˜‰","wink"],["๐Ÿ˜","heart eyes love"],["๐Ÿค”","thinking"],["๐Ÿ˜Ž","cool sunglasses"],["๐Ÿฅณ","party"],["๐Ÿ˜ด","sleep"],["๐Ÿคฏ","mind blown"],["๐Ÿ˜…","sweat smile"],["๐Ÿ™ƒ","upside down"],["๐Ÿ˜‡","angel halo"],["๐Ÿค—","hug"],["๐Ÿ˜ข","cry sad"]]),...Pe("people","๐Ÿ‘‹",[["๐Ÿ‘‹","wave hello"],["๐Ÿ‘","thumbs up"],["๐Ÿ‘Ž","thumbs down"],["๐Ÿ™","pray thanks"],["๐Ÿ‘","clap"],["๐Ÿค","handshake deal"],["๐Ÿ’ช","strong"],["๐Ÿ‘€","eyes look"],["๐Ÿง ","brain knowledge"],["โค๏ธ","heart love"],["๐Ÿ‘ค","person user"],["๐Ÿ‘ฅ","people team members"],["๐Ÿง‘โ€๐Ÿ’ป","developer"],["๐Ÿ™‹","raise hand"],["โœ๏ธ","writing"],["๐Ÿซถ","heart hands"]]),...Pe("nature","๐ŸŒฟ",[["๐ŸŒฟ","leaf herb"],["๐ŸŒฑ","seedling"],["๐ŸŒณ","tree"],["๐ŸŒธ","blossom flower"],["๐ŸŒž","sun"],["๐ŸŒ™","moon night"],["โญ","star"],["๐Ÿ”ฅ","fire hot"],["๐ŸŒˆ","rainbow"],["๐ŸŒŠ","wave water"],["๐Ÿ€","clover luck"],["๐Ÿ","bee"],["๐Ÿฆ‹","butterfly"],["๐Ÿข","turtle"],["๐ŸŒ","earth globe"],["โ„๏ธ","snow"]]),...Pe("food","โ˜•",[["โ˜•","coffee"],["๐Ÿต","tea"],["๐ŸŽ","apple"],["๐Ÿ•","pizza"],["๐Ÿฐ","cake"],["๐Ÿช","cookie"],["๐Ÿฅ","croissant"],["๐Ÿ”","burger"],["๐Ÿœ","noodles"],["๐Ÿบ","beer"],["๐Ÿท","wine"],["๐Ÿฅ—","salad"],["๐Ÿซ","chocolate"],["๐Ÿ“","strawberry"],["๐Ÿฅ‘","avocado"],["๐Ÿฉ","donut"]]),...Pe("activity","๐ŸŽฏ",[["๐ŸŽฏ","target goal"],["๐Ÿ†","trophy win"],["๐ŸŽ‰","tada celebration"],["๐ŸŽจ","art palette design"],["๐ŸŽ™๏ธ","microphone podcast voice"],["๐ŸŽฌ","clapper movie"],["๐ŸŽฎ","game"],["โšฝ","football"],["๐Ÿƒ","run"],["๐Ÿง˜","yoga calm"],["๐ŸŽต","music"],["๐ŸŽฒ","dice"],["๐Ÿ","finish flag"],["๐ŸŽ“","graduation learn"],["๐Ÿงฉ","puzzle piece"],["๐Ÿ”","repeat retro"]]),...Pe("travel","๐Ÿš€",[["๐Ÿš€","rocket launch"],["โœˆ๏ธ","plane travel"],["๐Ÿš—","car"],["๐Ÿšฒ","bike"],["๐Ÿ ","house home"],["๐Ÿข","office building"],["๐Ÿ—บ๏ธ","map"],["๐Ÿงญ","compass"],["โ›ฐ๏ธ","mountain"],["๐Ÿ–๏ธ","beach"],["๐Ÿš‰","station"],["๐Ÿ›ฐ๏ธ","satellite"],["๐ŸŒ†","city"],["๐Ÿ•๏ธ","camping"],["โ›ต","sailboat"],["๐Ÿ›ซ","departure"]]),...Pe("objects","๐Ÿ’ก",[["๐Ÿ’ก","idea bulb"],["๐Ÿ“Š","chart bar"],["๐Ÿ“ˆ","chart up"],["๐Ÿ“…","calendar date"],["๐Ÿ“„","page document"],["๐Ÿ“","folder"],["๐Ÿ—ƒ๏ธ","card box database"],["๐Ÿ“Œ","pin"],["๐Ÿ”","search"],["๐Ÿ› ๏ธ","tools"],["โš™๏ธ","gear settings"],["๐Ÿ””","bell notification"],["๐Ÿ’Ž","gem diamond"],["๐Ÿ“","memo notes"],["๐Ÿ“Ž","paperclip files"],["๐Ÿ”’","lock secure"],["๐Ÿ’ฌ","speech comment"],["๐Ÿ“ค","export outbox"],["๐Ÿ“ฅ","inbox"],["๐Ÿ—‘๏ธ","trash bin"],["๐Ÿ–ฅ๏ธ","desktop"],["๐Ÿ“ฑ","phone"],["๐Ÿ’ป","laptop"],["๐Ÿงพ","receipt"]]),...Pe("symbols","โœ…",[["โœ…","check done"],["โœจ","sparkles ai magic"],["โŒ","cross no"],["โš ๏ธ","warning"],["โ„น๏ธ","info"],["โ“","question"],["โž•","plus add"],["โžก๏ธ","arrow right"],["๐Ÿ”ด","red circle"],["๐ŸŸข","green circle"],["๐ŸŸก","yellow circle"],["๐Ÿ”ต","blue circle"],["โณ","hourglass wait"],["โ™ป๏ธ","recycle"],["๐Ÿ†•","new"],["๐Ÿ’ฏ","hundred"]])];class He extends v{static get observedAttributes(){return["placeholder","value"]}render(){this._box=this.createElement("div",["nk-pop"]),this._search=this.createElement("input",["nk-emoji-search"],{type:"search",autocomplete:"off"}),this._grid=this.createElement("div",["nk-emoji-grid"],{role:"listbox"}),this._cats=this.createElement("div",["nk-emoji-cats"],{role:"tablist"}),this._box.append(this._search,this._grid,this._cats),this._wrapper.appendChild(this._box),this._emojis=$e,this._cat=Re[0].id,this._renderCats(),this._renderGrid(),this._syncAttrs()}_syncAttrs(){this._search.placeholder=this.getAttribute("placeholder")||this.str("emojiPlaceholder"),this._search.setAttribute("aria-label",this.str("searchEmoji"))}onStringsChanged(){this._syncAttrs()}_renderCats(){this._cats.replaceChildren();const t=this._categories();for(const e of t){const t=this.createElement("span",[],{role:"tab","data-cat":e.id,title:e.id});t.textContent=e.icon,t.classList.toggle("active",e.id===this._cat),this._cats.appendChild(t)}this._cats.style.display=t.length>1?"":"none"}_categories(){if(this._catList)return this._catList;const t=new Map;for(const e of this._emojis)e.cat&&!t.has(e.cat)&&t.set(e.cat,{id:e.cat,icon:e.icon||Re.find(t=>t.id===e.cat)?.icon||e.char});return[...t.values()]}_renderGrid(){const t=this._search.value.trim().toLowerCase(),e=t?this._emojis.filter(e=>(e.name||"").toLowerCase().includes(t)||e.char===t):this._emojis.filter(t=>!t.cat||t.cat===this._cat);this._grid.replaceChildren();for(const t of e.slice(0,64)){const e=this.createElement("span",[],{role:"option",title:t.name||"","data-emoji":t.char});e.textContent=t.char,this._grid.appendChild(e)}for(const e of this._cats.children)e.classList.toggle("active",!t&&e.dataset.cat===this._cat)}setupEvents(){this._onInput=()=>this._renderGrid(),this._onGrid=t=>{const e=t.target.closest("[data-emoji]");e&&this.select(e.dataset.emoji)},this._onCats=t=>{const e=t.target.closest("[data-cat]");e&&(this._cat=e.dataset.cat,this._search.value="",this._renderGrid())},this._onKey=t=>{if("Enter"===t.key){const t=this._grid.querySelector("[data-emoji]");t&&this.select(t.dataset.emoji)}},this._search.addEventListener("input",this._onInput),this._search.addEventListener("keydown",this._onKey),this._grid.addEventListener("click",this._onGrid),this._cats.addEventListener("click",this._onCats)}teardownEvents(){this._search?.removeEventListener("input",this._onInput),this._search?.removeEventListener("keydown",this._onKey),this._grid?.removeEventListener("click",this._onGrid),this._cats?.removeEventListener("click",this._onCats)}select(t){this.setAttribute("value",t),this.emit("nk-select",{emoji:t,value:t})}onAttributeChanged(){this._syncAttrs()}focus(t){this._search?.focus(t)}get categories(){return this._categories()}set categories(t){this._catList=Array.isArray(t)&&t.length?t:null,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get emojis(){return this._emojis}set emojis(t){this._emojis=Array.isArray(t)?t:$e,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-emoji-picker",He);class We extends v{static get observedAttributes(){return["open","duration","icon"]}render(){this._box=this.createElement("div",["nk-toast"],{role:"status","aria-live":"polite"}),this._icon=document.createElement("span"),this._msg=document.createElement("span"),this._box.append(this._icon,this._msg,document.createElement("slot")),this._wrapper.appendChild(this._box),this._sync()}_sync(){this.getBoolAttr("open")&&this._lift(),this._box.classList.toggle("show",this.getBoolAttr("open"));const t=this.getAttribute("icon")??"โœ“";this._icon.textContent=t,this._icon.style.display=t?"":"none"}_lift(){const t=[...document.querySelectorAll(".nk-tab-bar")];for(const e of document.querySelectorAll("nk-tab-bar")){const n=e.shadowRoot?.querySelector(".nk-tab-bar");n&&t.push(n)}const e=t.map(t=>t.getBoundingClientRect()).find(t=>t.height>0&&t.top<innerHeight&&t.bottom>innerHeight-60);this._box.style.bottom=e?`${Math.round(innerHeight-e.top+12)}px`:""}show(t,{duration:e}={}){void 0!==t&&(this._msg.textContent=t),clearTimeout(this._timer),this.setBoolAttr("open",!0);const n=e??Number(this.getAttribute("duration"))??2200;n>0&&(this._timer=setTimeout(()=>this.close(),n||2200))}close(){clearTimeout(this._timer),this.setBoolAttr("open",!1)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._timer)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get message(){return this._msg?.textContent??""}set message(t){this._msg&&(this._msg.textContent=t)}}customElements.define("nk-toast",We);class Ue extends v{static get observedAttributes(){return["view","add-view"]}render(){this._box=this.createElement("div",["nk-database"]),this._toolbar=this.createElement("div",["nk-db-toolbar"]),this._tabs=this.createElement("div",["nk-db-tabs"],{role:"tablist"});const t=this.createElement("div",["tools"]);this._toolsSlot=this.createElement("slot",[],{name:"tools"}),t.appendChild(this._toolsSlot),this._toolbar.append(this._tabs,t),this._slot=document.createElement("slot"),this._box.append(this._toolbar,this.createElement("slot",[],{name:"filters"}),this._slot),this._wrapper.appendChild(this._box),this._columns=[],this._rows=[],this._sync()}get views(){return this._slot?.assignedElements().filter(t=>/^nk-[a-z]+-view$/.test(t.localName))??[]}_sync(){if(!this._tabs)return;const t=this.views;let e=this.getAttribute("view");t.some(t=>t.name===e)||(e=t[0]?.name??null),this._tabs.replaceChildren();for(const n of t){const t=this.createElement("span",["nk-db-tab"],{role:"tab","data-view":n.name,tabindex:"0"});t.classList.toggle("active",n.name===e),t.setAttribute("aria-selected",n.name===e?"true":"false"),t.append(document.createTextNode(n.getAttribute("label")||n.name));const i=n.hasAttribute("count")?String(this._rows.length):n.getAttribute("badge");if(i){const e=this.createElement("span",["badge"]);e.textContent=i,t.appendChild(e)}this._tabs.appendChild(t),n.hidden=n.name!==e,n.setData?.(this._columns,this._rows)}if(this.getBoolAttr("add-view")){const t=this.createElement("span",["nk-db-tab","add"],{role:"button","data-add":"",tabindex:"0"});t.textContent="๏ผ‹",this._tabs.appendChild(t)}this._toolbar.hidden=!t.length&&!this._toolsSlot.assignedElements().length,this._current=e}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._sync()}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-view]");e?this.view=e.dataset.view:t.target.closest("[data-add]")&&this.emit("nk-action",{action:"add-view"})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||!t.target.closest("[data-view],[data-add]")||(t.preventDefault(),t.target.click())},this._onSlot=()=>this._sync(),this._tabs.addEventListener("click",this._onClick),this._tabs.addEventListener("keydown",this._onKey),this._slot.addEventListener("slotchange",this._onSlot),this._toolsSlot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._tabs?.removeEventListener("click",this._onClick),this._tabs?.removeEventListener("keydown",this._onKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._toolsSlot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){const e=this._current;this._sync(),"view"===t&&this._current!==e&&this.emit("nk-view-change",{view:this._current})}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._sync()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._sync()}get view(){return this._current??this.getAttribute("view")}set view(t){this.setAttribute("view",t)}refresh(){this._sync()}}customElements.define("nk-database",Ue);const Ge=(t,e,n)=>{const i=document.createElement(t);return e&&(i.className=e),null!=n&&(i.textContent=n),i},Ye=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function Qe(t,e){const n=function(t,e){const n=t.options||[];return n.find(t=>t.value===e)||n.find(t=>t.label===e)||null}(t,e),i=n?.color&&Ye.includes(n.color)?n.color:"gray";return Ge("span",`nk-tag ${i}`,n?.label??String(e))}const Xe=t=>t&&"object"==typeof t?t.text??t.label??t.name??"":String(t??"");function Ze(t){if(t instanceof Date)return t.getTime();if("number"==typeof t)return t;if(t&&"object"==typeof t)return Ze(t.start);const e=String(t??"").trim();let n=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/);return n?new Date(+n[3],+n[2]-1,+n[1]).getTime():(n=e.match(/^(\d{4})-(\d{2})-(\d{2})$/),n?new Date(+n[1],+n[2]-1,+n[3]).getTime():/^\d{4}-\d{2}-\d{2}T/.test(e)?Date.parse(e):NaN)}function Je(t,e){if(e&&"object"==typeof e&&!(e instanceof Date))return[e.start,e.end].filter(Boolean).map(e=>Je(t,e)).join(" โ†’ ");const n=t.format,i=Ze(e);if(!n||Number.isNaN(i))return String(e??"");const s=new Date(i),r=t.locale||pe();if("relative"===n){const t=Math.round((i-Date.now())/6e4),e=new Intl.RelativeTimeFormat(r,{numeric:"auto",style:"short"});if(Math.abs(t)<60)return e.format(t,"minute");if(Math.abs(t)<1440)return e.format(Math.round(t/60),"hour")}if("short"===n||"relative"===n){const t=s.getFullYear()===(new Date).getFullYear()?{}:{year:"numeric"};return s.toLocaleDateString(r,{day:"2-digit",month:"2-digit",...t})}return"object"==typeof n?new Intl.DateTimeFormat(r,n).format(s):String(e)}function tn(t,e,n={}){const i=t.type||"text";if("actions"===i)return function(t,e){const n=t.actions||[],i=null==e?n:(Array.isArray(e)?e:[e]).map(t=>"string"==typeof t?n.find(e=>e.action===t)??{action:t,label:t}:t),s=Ge("span","row-actions");for(const t of i){const e=Ge("button",`nk-btn ${t.danger?"danger":"secondary"} small`,[t.icon,t.label??t.action].filter(Boolean).join(" "));e.type="button",e.dataset.action=t.action,e.disabled=!!t.disabled,t.tooltip&&(e.dataset.tooltip=t.tooltip),s.appendChild(e)}return s}(t,e);if(null==e||""===e)return"checkbox"===i?en(t,!1,n):"progress"===i?nn(t,0):Ge("span","person"===i?"person-cell":null,"text"===i&&t.title?"":"โ€”");switch(i){case"select":return Qe(t,e);case"multi-select":{const n=Ge("span");n.style.display="inline-flex",n.style.gap="4px",n.style.flexWrap="wrap";for(const i of Array.isArray(e)?e:String(e).split(",").map(t=>t.trim()).filter(Boolean))n.appendChild(Qe(t,i));return n}case"date":return Ge("span","date-cell",Je(t,e));case"person":{const t=Ge("span","person-cell"),n="string"==typeof e?{name:e}:e,i=Ge("span","nk-avatar small",n.initials||n.avatar||Ot(n.name));return Kt(i,n.color),t.append(i,document.createTextNode(" "+(n.name||""))),t}case"checkbox":return en(t,!!e,n);case"url":{const t="object"==typeof e?e:{href:String(e),label:String(e).replace(/^https?:\/\//,""),target:"_blank"},n=Ge("a",null,t.label??t.href);return n.href=t.href??"",t.target&&(n.target=t.target),"_blank"===t.target&&(n.rel="noopener"),n}case"number":return Ge("span",null,"number"==typeof e?e.toLocaleString(t.locale,t.format):String(e));case"progress":return nn(t,Number(e)||0);default:{const i="object"==typeof e?e:{text:e};let s;if(t.title)s=Ge("span","row-title"),n.icon&&s.append(document.createTextNode(n.icon+" ")),s.append(document.createTextNode(String(i.text??"")));else{if("object"!=typeof e)return Ge("span",null,String(e));s=Ge("span",i.color&&Ye.includes(i.color)?`td-text ${i.color}`:"td-text",String(i.text??""))}if(i.tooltip&&(s.dataset.tooltip=i.tooltip),!i.desc)return s;const r=document.createDocumentFragment();return r.append(s,Ge("span","td-desc",String(i.desc))),r}}}function en(t,e,n){const i=Ge("label","nk-check"),s=Ge("input");return s.type="checkbox",s.checked=e,s.dataset.key=t.key,null!=n.id&&(s.dataset.rowId=n.id),i.appendChild(s),i}function nn(t,e){const n=document.createDocumentFragment(),i=Ge("span","nk-progress"),s=Ge("i");return s.style.width=`${Math.max(0,Math.min(100,e))}%`,i.appendChild(s),n.append(i,Ge("span","nk-progress-label",sn(t,e))),n}function sn(t,e){const n=Number(e)||0;try{return new Intl.NumberFormat(t.locale||pe(),{style:"percent",maximumFractionDigits:0}).format(n/100)}catch{return`${Math.round(n)}%`}}function rn(t,e){const n=(t.options||[]).findIndex(t=>t.value===e||t.label===e);return n<0?(t.options||[]).length:n}function on(t,e){if(t.sortKey)return e[t.sortKey];const n=e[t.key];if(null==n||""===n)return null;if("object"==typeof n&&!Array.isArray(n)&&"sort"in n)return n.sort;switch(t.type||"text"){case"number":case"progress":return Number(n);case"checkbox":return n?1:0;case"date":{const t=Ze(n);return Number.isNaN(t)?String(n):t}case"select":return rn(t,n);case"multi-select":{const e=(Array.isArray(n)?n:String(n).split(","))[0];return null==e?null:rn(t,String(e).trim())}default:return Xe(n)}}function an(t,e=1){const n=t=>null==t||""===t||Number.isNaN(t);return(i,s)=>{const r=on(t,i),o=on(t,s);return n(r)||n(o)?n(r)===n(o)?0:n(r)?1:-1:"number"==typeof r&&"number"==typeof o?(r-o)*e:String(r).localeCompare(String(o),void 0,{numeric:!0})*e}}class ln extends v{static get observedAttributes(){return["name","label","badge","count","new-row","new-row-label","sortable","sort-key","sort-dir","wrap"]}render(){this._wrap=this.createElement("div",["nk-table-wrap"]),this._table=this.createElement("table",["nk-table"]),this._thead=document.createElement("thead"),this._tbody=document.createElement("tbody"),this._table.append(this._thead,this._tbody),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._wrap.append(this._table,this._newRow),this._wrapper.appendChild(this._wrap),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_sortedRows(){const t=this.getAttribute("sort-key"),e=this._columns.find(e=>e.key===t);return e?[...this._rows].sort(an(e,"desc"===this.getAttribute("sort-dir")?-1:1)):this._rows}_render(){if(!this._thead)return;this._table.classList.toggle("wrap",this.getBoolAttr("wrap"));const t=document.createElement("tr");for(const e of this._columns){const n="actions"===e.type,i=this.createElement("th",n?["actions"]:[],n?{scope:"col"}:{"data-key":e.key,scope:"col"});if(e.icon){const t=this.createElement("span",["th-icon"]);t.textContent=e.icon,i.appendChild(t)}i.appendChild(document.createTextNode(e.label??(n?"":e.key))),e.key===this.getAttribute("sort-key")&&i.appendChild(document.createTextNode("desc"===this.getAttribute("sort-dir")?" โ†“":" โ†‘")),e.width&&(i.style.width=e.width),t.appendChild(i)}this._thead.replaceChildren(t),this._tbody.replaceChildren();for(const t of this._sortedRows()){const e=this.createElement("tr",[],{"data-id":t.id??""});for(const n of this._columns){const i=document.createElement("td");"number"===n.type&&(i.className="num"),i.appendChild(tn(n,t[n.key],t)),e.appendChild(i)}this._tbody.appendChild(e)}this._newRow.textContent=this.getAttribute("new-row-label")||this.str("newPage"),this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest("th[data-key]");if(e){const t=e.dataset.key,n=this.getAttribute("sort-key")===t&&"desc"!==this.getAttribute("sort-dir")?"desc":"asc";return void(this.emit("nk-action",{action:"sort",key:t,value:n})&&this.getBoolAttr("sortable")&&(this.setAttribute("sort-key",t),this.setAttribute("sort-dir",n)))}const n=t.target.closest("button[data-action]");if(n){const t=this._rowById(n.closest("tr[data-id]")?.dataset.id);return void(n.disabled||this.emit("nk-action",{action:n.dataset.action,row:t,id:t?.id,anchor:n}))}if(t.target.closest("input[type=checkbox], a"))return;const i=t.target.closest("tr[data-id]");if(!i)return;const s=t.target.closest("td"),r=this._rowById(i.dataset.id);this.emit("nk-select",{row:r,id:r?.id,value:r?.id,key:s?this._columns[s.cellIndex]?.key:void 0,cell:s})},this._onChange=t=>{const e=t.target;if("checkbox"!==e.type)return;const n=this._rowById(e.dataset.rowId);n&&(n[e.dataset.key]=e.checked),this.emit("nk-change",{row:n,key:e.dataset.key,value:e.checked})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||t.target!==this._newRow||(t.preventDefault(),this.emit("nk-action",{action:"new-row"}))},this._wrap.addEventListener("click",this._onClick),this._wrap.addEventListener("change",this._onChange),this._wrap.addEventListener("keydown",this._onKey)}teardownEvents(){this._wrap?.removeEventListener("click",this._onClick),this._wrap?.removeEventListener("change",this._onChange),this._wrap?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}onStringsChanged(){this._render()}get name(){return this.getAttribute("name")||"table"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-table-view",ln);class hn extends v{static get observedAttributes(){return["name","label","badge","count","group-by","title-key","meta-keys","new-row"]}render(){this._board=this.createElement("div",["nk-board","active"]),this._wrapper.appendChild(this._board),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_groupColumn(){const t=this.getAttribute("group-by");return this._columns.find(e=>e.key===t)||this._columns.find(t=>"select"===t.type)||null}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"date"===t.type||"progress"===t.type)}_render(){if(!this._board)return;this._board.replaceChildren();const t=this._groupColumn(),e=this._titleColumn();if(!t)return;const n=t.options?.length?t.options:[...new Set(this._rows.map(e=>e[t.key]))].map(t=>({value:t,label:String(t)}));for(const i of n){const n=this.createElement("div",["nk-board-col"],{"data-value":i.value}),s=this.createElement("div",["nk-board-col-header"]),r=this._rows.filter(e=>e[t.key]===i.value||e[t.key]===i.label),o=this.createElement("span",["count"]);o.textContent=String(r.length),s.append(Qe(t,i.value),o),n.appendChild(s);for(const t of r){const i=this.createElement("div",["nk-card"],{draggable:"true","data-id":t.id??"",tabindex:"0"}),s=this.createElement("div",["card-title"]);s.textContent=`${t.icon?t.icon+" ":""}${e?Xe(t[e.key]):""}`;const r=this.createElement("div",["card-meta"]);for(const e of this._metaColumns()){const n=t[e.key];if(null==n||""===n)continue;const i=document.createElement("span");"progress"===e.type?i.textContent=`โ–ฐ ${sn(e,n)}`:"date"===e.type?i.textContent=`๐Ÿ“… ${Je(e,n)}`:i.appendChild(tn(e,n,t)),r.appendChild(i)}i.append(s,r),n.appendChild(i)}if(this.getBoolAttr("new-row")){const t=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0","data-add":i.value});t.style.padding="6px 10px",t.textContent="๏ผ‹",n.appendChild(t)}this._board.appendChild(n)}}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-add]");if(e)return void this.emit("nk-action",{action:"new-row",value:e.dataset.add});const n=t.target.closest(".nk-card");if(n){const t=this._rowById(n.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onDragStart=t=>{const e=t.target.closest?.(".nk-card");if(e){this._dragId=e.dataset.id,t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",e.dataset.id)}catch{}}},this._onDragOver=t=>{null!=this._dragId&&t.target.closest(".nk-board-col")&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},this._onDrop=t=>{const e=t.target.closest(".nk-board-col");e&&null!=this._dragId&&(t.preventDefault(),this.move(this._dragId,e.dataset.value),this._dragId=null)},this._board.addEventListener("click",this._onClick),this._board.addEventListener("dragstart",this._onDragStart),this._board.addEventListener("dragover",this._onDragOver),this._board.addEventListener("drop",this._onDrop)}teardownEvents(){this._board?.removeEventListener("click",this._onClick),this._board?.removeEventListener("dragstart",this._onDragStart),this._board?.removeEventListener("dragover",this._onDragOver),this._board?.removeEventListener("drop",this._onDrop)}move(t,e){const n=this._rowById(t),i=this._groupColumn();n&&i&&n[i.key]!==e&&(n[i.key]=e,this._render(),this.emit("nk-change",{row:n,key:i.key,value:e}))}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"board"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-board-view",hn);class dn extends v{static get observedAttributes(){return["name","label","badge","count","title-key","meta-keys","new-row","new-row-label"]}render(){this._box=document.createElement("div"),this._list=this.createElement("div",["nk-list"],{role:"list"}),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._box.append(this._list,this._newRow),this._wrapper.appendChild(this._box),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"select"===t.type||"date"===t.type)}_render(){if(!this._list)return;const t=this._titleColumn(),e=this._metaColumns();this._list.replaceChildren();for(const n of this._rows){const i=this.createElement("div",["nk-list-item"],{role:"listitem",tabindex:"0","data-id":n.id??""}),s=this.createElement("span",["l-icon"]);s.textContent=n.icon||"",n.icon||(s.style.display="none");const r=this.createElement("span",["l-title"]);r.textContent=t?Xe(n[t.key]):"";const o=this.createElement("span",["l-meta"]);for(const t of e){const e=n[t.key];null!=e&&""!==e&&o.appendChild("date"===t.type?document.createTextNode(Je(t,e)):"text"!==t.type&&t.type?tn(t,e,n):document.createTextNode(Xe(e)))}i.append(s,r,o),this._list.appendChild(i)}this._newRow.textContent=this.getAttribute("new-row-label")||this.str("newPage"),this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest(".nk-list-item");if(e){const t=this._rowById(e.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.target===this._newRow||t.target.classList?.contains("nk-list-item"))&&(t.preventDefault(),t.target.click())},this._box.addEventListener("click",this._onClick),this._box.addEventListener("keydown",this._onKey)}teardownEvents(){this._box?.removeEventListener("click",this._onClick),this._box?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}onStringsChanged(){this._render()}get name(){return this.getAttribute("name")||"list"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-list-view",dn);class cn extends v{static get observedAttributes(){return["name","label","badge","count","date-key","title-key","month","weeks","week-start","weekend","today","locale","today-label","prev-label","next-label","week-label"]}render(){this._box=this.createElement("div",["nk-calendar-view"]);const t=this.createElement("div",["cv-head"]);this._title=this.createElement("div",["cv-title"]),this._todayBtn=this.createElement("button",["cal-nav"],{type:"button"}),this._prev=this.createElement("button",["cal-nav"],{type:"button"}),this._prev.innerHTML=_e,this._next=this.createElement("button",["cal-nav"],{type:"button"}),this._next.innerHTML=ve,t.append(this._title,this._todayBtn,this._prev,this._next),this._grid=this.createElement("div",["cv-grid"]),this._box.append(t,this._grid),this._wrapper.appendChild(this._box),this._columns??=[],this._rows??=[],this._month??=this._attrMonth()??this._todayIso().slice(0,7),this._render(),this.closest("nk-database")?.requestSync?.()}_attrMonth(){const t=this.getAttribute("month");return/^\d{4}-\d{2}$/.test(t||"")?t:null}_todayIso(){return this.getAttribute("today")||le(new Date)}_dateColumn(){const t=this.getAttribute("date-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>"date"===t.type)||null}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_render(){if(!this._grid)return;const t=pe(this.getAttribute("locale")),e=this.getBoolAttr("weeks"),n=Number(this.getAttribute("week-start")),i=this.hasAttribute("week-start")&&Number.isInteger(n)&&n>=0&&n<=6?n:ue(t),s=be(this._month,i),r=this._todayIso(),o=new Set((this.getAttribute("weekend")||"").split(",").map(t=>t.trim()).filter(Boolean).map(Number)),a=this._dateColumn(),l=this._titleColumn(),h={};if(a)for(const t of this._rows){const e=de(t[a.key]);e&&(h[le(e)]||=[]).push(t)}this._box.classList.toggle("weeks",e),this._title.textContent=new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(s.first),this._todayBtn.textContent=this.getAttribute("today-label")||this.str("today"),this._prev.setAttribute("aria-label",this.getAttribute("prev-label")||this.str("previousMonth")),this._next.setAttribute("aria-label",this.getAttribute("next-label")||this.str("nextMonth"));const d=(t,e)=>{const n=this.createElement("div",[t]);return n.textContent=e,n},c=[];e&&c.push(d("cv-wd",this.getAttribute("week-label")||ke(t)));for(const e of ge(t,i))c.push(d("cv-wd",e));for(let t=0;t<7*s.rows;t++){const n=s.day(t),i=le(n);e&&t%7==0&&c.push(d("cv-week",ce(n)));const a=this.createElement("div",["cv-day",n.getMonth()!==s.m-1&&"out",o.has(n.getDay())&&"off",i===r&&"today"].filter(Boolean)),p=this.createElement("span",["cv-num"]);p.textContent=n.getDate(),a.appendChild(p);for(const t of h[i]||[]){const e=this.createElement("button",["cv-item"],{type:"button","data-id":t.id??""}),n=l?Xe(t[l.key]):"";e.textContent=t.icon?`${t.icon} ${n}`:n,a.appendChild(e)}c.push(a)}this._grid.replaceChildren(...c)}_goMonth(t){t!==this._month&&(this._month=t,this._render(),this.emit("nk-month",{month:t}))}setupEvents(){this._onClick=t=>{if(t.target.closest(".cal-nav")===this._todayBtn)return void this._goMonth(this._todayIso().slice(0,7));if(t.target.closest(".cal-nav")===this._prev)return void this._goMonth(me(this._month,-1));if(t.target.closest(".cal-nav")===this._next)return void this._goMonth(me(this._month,1));const e=t.target.closest(".cv-item");if(e){const t=this._rowById(e.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._box.addEventListener("click",this._onClick)}teardownEvents(){this._box?.removeEventListener("click",this._onClick)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onStringsChanged(){this._render()}onAttributeChanged(t){"month"===t&&(this._month=this._attrMonth()??this._month),this._render(),"label"!==t&&"badge"!==t&&"count"!==t||this.closest("nk-database")?.requestSync?.()}get name(){return this.getAttribute("name")||"calendar"}get month(){return this._month}set month(t){/^\d{4}-\d{2}$/.test(t)&&(this._grid?this._goMonth(t):this._month=t)}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-calendar-view",cn);const pn=["small","large"];class un extends v{static get observedAttributes(){return["name","label","badge","count","cover-key","no-cover","size","fit","title-key","meta-keys","href-key","new-row","new-row-label"]}render(){this._grid=this.createElement("div",["nk-gallery"],{role:"list"}),this._wrapper.appendChild(this._grid),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"select"===t.type||"date"===t.type)}_render(){if(!this._grid)return;const t=this.getAttribute("size");this._grid.className=["nk-gallery",pn.includes(t)&&t,this.getBoolAttr("fit")&&"fit"].filter(Boolean).join(" ");const e=this._titleColumn(),n=this._metaColumns(),i=this.getAttribute("cover-key")||"cover",s=!this.getBoolAttr("no-cover"),r=this.getAttribute("href-key");this._grid.replaceChildren();for(const t of this._rows){const o=r?t[r]:null,a=o&&"object"==typeof o?o.href:o,l=a?this.createElement("a",["nk-card"],{href:String(a),"data-id":t.id??""}):this.createElement("div",["nk-card"],{role:"listitem",tabindex:"0","data-id":t.id??""});if(s){const e=this.createElement("div",["nk-cover"]);t[i]&&e.appendChild(this.createElement("img",[],{src:t[i],alt:""})),l.appendChild(e)}const h=this.createElement("div",["card-title"]);h.textContent=`${t.icon?t.icon+" ":""}${e?Xe(t[e.key]):""}`;const d=this.createElement("div",["card-meta"]);for(const e of n){const n=t[e.key];if(null==n||""===n)continue;const i=document.createElement("span");"progress"===e.type?i.textContent=`โ–ฐ ${sn(e,n)}`:"date"===e.type?i.textContent=`๐Ÿ“… ${Je(e,n)}`:i.appendChild(tn(e,n,t)),d.appendChild(i)}if(l.append(h,d),a){const t=this.createElement("div",["card-item"],{role:"listitem"});t.appendChild(l),this._grid.appendChild(t)}else this._grid.appendChild(l)}if(this.getBoolAttr("new-row")){const t=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0","data-add":""});t.textContent=this.getAttribute("new-row-label")||this.str("newPage"),this._grid.appendChild(t)}}setupEvents(){this._onClick=t=>{if(t.target.closest("[data-add]"))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest(".nk-card");if(!e)return;const n="a"===e.localName;if(n&&(0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const i=this._rowById(e.dataset.id);!this.emit("nk-select",{row:i,id:i?.id,value:i?.id})&&n&&t.preventDefault()},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||"a"!==t.target.localName&&t.target.matches?.(".nk-card, [data-add]")&&(t.preventDefault(),t.target.click())},this._grid.addEventListener("click",this._onClick),this._grid.addEventListener("keydown",this._onKey)}teardownEvents(){this._grid?.removeEventListener("click",this._onClick),this._grid?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}onStringsChanged(){this._render()}get name(){return this.getAttribute("name")||"gallery"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-gallery-view",un);class gn extends v{static get observedAttributes(){return["search","placeholder","no-filter","no-sort","value","add","add-label","filter-label","sort-label","remove-label"]}render(){this._row=this.createElement("div",["nk-filter-row"]),this._filterBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"filter"}),this._sortBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"sort"}),this._pillStart=document.createComment("pills"),this._addBtn=this.createElement("button",["nk-filter-pill","add"],{type:"button","data-action":"add"}),this._input=this.createElement("input",["nk-input"],{type:"search",autocomplete:"off"}),this._row.append(this._filterBtn,this._sortBtn,this._pillStart,this._addBtn,document.createElement("slot"),this._input),this._wrapper.appendChild(this._row),this._filters=[],this._sync()}_sync(){this._filterBtn.textContent=this.getAttribute("filter-label")||this.str("filter"),this._filterBtn.hidden=this.getBoolAttr("no-filter"),this._filterBtn.classList.toggle("active",this._filters.length>0),this._sortBtn.textContent=this.getAttribute("sort-label")||this.str("sort"),this._sortBtn.hidden=this.getBoolAttr("no-sort"),this._addBtn.textContent=this.getAttribute("add-label")||this.str("addFilter"),this._addBtn.hidden=!this.getBoolAttr("add"),this._input.hidden=!this.getBoolAttr("search"),this._input.placeholder=this.getAttribute("placeholder")||this.str("search"),this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value"));for(const t of this._row.querySelectorAll("[data-pill]"))t.remove();const t=this.getAttribute("remove-label")||this.str("removeFilter");this._pillStart.after(...this._filters.map((e,n)=>{const i=this.createElement("span",["nk-filter-pill","active"],{"data-pill":n}),s=this.createElement("button",[],{type:"button","data-edit":n});s.textContent=e.label??`${e.key}: ${e.value}`;const r=this.createElement("button",["fp-remove"],{type:"button","data-remove":n,"aria-label":`${t}: ${s.textContent}`});return r.textContent="ร—",i.append(s,r),i}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-remove]");if(e){const t=Number(e.dataset.remove);return this._filters=this._filters.filter((e,n)=>n!==t),this._sync(),void this._emitChange()}const n=t.target.closest("[data-edit]");if(n){const t=Number(n.dataset.edit);return void this.emit("nk-action",{action:"edit",index:t,filter:this._filters[t],anchor:n})}const i=t.target.closest("[data-action]");i&&this.emit("nk-action",{action:i.dataset.action,anchor:i})},this._onInput=()=>{clearTimeout(this._debounce),this._debounce=setTimeout(()=>this._emitChange(),150)},this._row.addEventListener("click",this._onClick),this._input.addEventListener("input",this._onInput)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._input?.removeEventListener("input",this._onInput),clearTimeout(this._debounce)}_emitChange(){this.emit("nk-change",{filters:[...this._filters],search:this._input.value})}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}get filters(){return[...this._filters]}set filters(t){this._filters=Array.isArray(t)?[...t]:[],this._row&&this._sync()}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}apply(t){const e=this.value.trim().toLowerCase();return t.filter(t=>this._filters.every(e=>"is-not"===e.op?t[e.key]!==e.value:t[e.key]===e.value)&&(!e||Object.values(t).some(t=>String("object"==typeof t&&t?t.name??t.text??t.label??"":t??"").toLowerCase().includes(e))))}}customElements.define("nk-filter-bar",gn);class bn extends v{static get observedAttributes(){return["placeholder","send-label","no-input","disabled"]}render(){const t=this.createElement("div",["nk-comments"]);t.appendChild(document.createElement("slot")),this._row=this.createElement("div",["nk-comment-input"]),this._input=this.createElement("input",["nk-input"],{type:"text"}),this._btn=this.createElement("button",["nk-btn","primary","small"],{type:"button"}),this._row.append(this._input,this._btn),t.appendChild(this._row),this._wrapper.appendChild(t),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||this.str("commentPlaceholder"),this._input.setAttribute("aria-label",this.str("comment")),this._btn.textContent=this.getAttribute("send-label")||this.str("send"),this._row.style.display=this.getBoolAttr("no-input")?"none":"",this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t)return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}customElements.define("nk-comments",bn);class mn extends v{static get observedAttributes(){return["author","time","avatar","color"]}render(){const t=this.createElement("div",["nk-comment"]);this._avatar=this.createElement("span",["nk-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const n=document.createElement("div");this._head=this.createElement("div",["c-head"]),this._author=document.createElement("b"),this._time=document.createTextNode(""),this._head.append(this._author,this.createElement("slot",[],{name:"head"}),this._time);const i=this.createElement("div",["c-body"]);i.appendChild(document.createElement("slot")),n.append(this._head,i),t.append(e,n),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("author")||"";this._author.textContent=t;const e=this.getAttribute("time");this._time.data=e?` ยท ${e}`:"",this._avatar.textContent=this.getAttribute("avatar")||Ot(t),Kt(this._avatar,this.getAttribute("color"))}onAttributeChanged(){this._sync()}}customElements.define("nk-comment",mn);class kn extends v{render(){const t=this.createElement("div",["nk-ai-thread"],{role:"log","aria-live":"polite"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-ai-thread",kn);class _n extends v{static get observedAttributes(){return["role","name","badge","avatar","color","bubble"]}render(){this._box=this.createElement("div",["nk-ai-msg"]),this._avatar=this.createElement("span",["mini-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._avatarSlot=t;const e=this.createElement("div",["a-body"]);this._name=this.createElement("div",["a-name"]),this._nameText=document.createTextNode(""),this._badge=document.createElement("span"),this._name.append(this._nameText,this._badge),this._actions=this.createElement("div",["nk-ai-actions"]),this._actionSlot=this.createElement("slot",[],{name:"actions"}),this._actions.appendChild(this._actionSlot),e.append(this._name,document.createElement("slot"),this._actions),this._box.append(t,e),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t="user"===this.getAttribute("role"),e=this.getBoolAttr("bubble");this._box.classList.toggle("user",t),this._box.classList.toggle("bubble",e);const n=this.getAttribute("name");this._nameText.data!==(n||"")&&(this._nameText.data=n||"");const i=this.getAttribute("badge"),s=i?` ${i}`:"";this._badge.textContent!==s&&(this._badge.textContent=s),this._name.style.display=n&&!e?"":"none",this._avatarSlot.style.display=e?"none":"";const r=this.getAttribute("avatar")||(t?(n||"U").slice(0,2).toUpperCase():"โœจ");this._avatar.textContent!==r&&(this._avatar.textContent=r);const o=this.getAttribute("color");this._avatar.style.background=o||"",this._actions.style.display=this._actionSlot.assignedElements().length?"":"none"}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this._actionSlot.assignedElements().includes(e)&&this.emit("nk-action",{action:e.value||e.textContent.trim(),value:e.value||e.textContent.trim()})},this._actionSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this._sync()}teardownEvents(){this._actionSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}}customElements.define("nk-ai-msg",_n);class vn extends v{static get observedAttributes(){return["placeholder","value","disabled","icon"]}render(){this._row=this.createElement("div",["nk-ai-input-row"]),this._icon=document.createElement("span"),this._icon.style.fontSize="14px",this._input=this.createElement("input",[],{type:"text"}),this._btn=this.createElement("button",["nk-ai-send"],{type:"button"}),this._btn.textContent="โ†‘",this._row.append(this._icon,this._input,this._btn),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||this.str("askPlaceholder"),this._input.setAttribute("aria-label",this.str("message")),this._btn.setAttribute("aria-label",this.str("send")),this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value")),this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled");const t=this.getAttribute("icon")??"โœจ";this._icon.textContent=t,this._icon.style.display=t?"":"none"}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t||this.getBoolAttr("disabled"))return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}customElements.define("nk-ai-input-row",vn);export{vn as NkAiInputRow,_n as NkAiMsg,kn as NkAiThread,Z as NkApp,Pt as NkAvatar,jt as NkAvatarGroup,At as NkBanner,yt as NkBlockHost,hn as NkBoardView,ie as NkBookmark,gt as NkBreadcrumb,y as NkBtn,ye as NkCalendar,cn as NkCalendarView,$ as NkCallout,T as NkCheck,Fe as NkCmdk,Q as NkCode,mn as NkComment,bn as NkComments,se as NkCopyField,Gt as NkDangerZone,Ue as NkDatabase,Be as NkDialog,H as NkDivider,v as NkElement,He as NkEmojiPicker,Et as NkEmpty,q as NkField,K as NkFields,gn as NkFilterBar,x as NkFormElement,un as NkGalleryView,W as NkHeading,oe as NkImagePicker,E as NkInput,Y as NkKbd,dn as NkListView,Yt as NkMemberList,Qt as NkMemberRow,$t as NkMention,Ve as NkMenu,je as NkMenuItem,Te as NkModal,Wt as NkModelCard,_t as NkPage,ft as NkPageActions,vt as NkPageCover,xt as NkPageTitle,te as NkPanel,Jt as NkPanels,Ce as NkPeek,Oe as NkPop,Ut as NkProfileRow,R as NkProgress,Zt as NkProp,Xt as NkProps,X as NkQuote,F as NkRadio,ht as NkSectionLabel,Ft as NkSegmented,S as NkSelect,De as NkSettingsPane,Me as NkSettingsUser,ee as NkSheet,ot as NkSidebar,Ct as NkSkeleton,V as NkSlider,Vt as NkStat,It as NkStats,ne as NkSteps,z as NkSwitch,Bt as NkSynced,Mt as NkTab,mt as NkTabBar,kt as NkTabBarItem,ln as NkTableView,Dt as NkTabs,P as NkTag,Ht as NkTemplateBtn,L as NkTextarea,bt as NkThemeToggle,We as NkToast,G as NkTodo,U as NkToggle,ze as NkTooltip,ut as NkTopbar,ct as NkTree,pt as NkTreeItem,lt as NkWorkspaceSwitcher,d as builtInStrings,an as compareBy,r as componentsSheet,Je as formatDate,sn as formatPercent,tn as renderPropertyCell,h as setStrings,Qe as tagFor,Xe as textOf,Ze as timeOf};
1
+ const t=':root{color-scheme:light;--nk-bg: #ffffff;--nk-bg-sidebar: #f9f8f7;--nk-bg-hover: rgba(55,53,47,.06);--nk-bg-active: rgba(55,53,47,.08);--nk-bg-callout: #f0efed;--nk-bg-code: #f7f6f3;--nk-bg-card: #ffffff;--nk-bg-input: rgba(242,241,238,.6);--nk-text: #2c2c2b;--nk-text-secondary: #7d7a75;--nk-text-tertiary: #91918e;--nk-text-sidebar: #5f5e5b;--nk-border: rgba(28,19,1,.11);--nk-border-strong: rgba(27,21,0,.19);--nk-accent: #2383e2;--nk-on-accent: #ffffff;--nk-danger: #cd3c3a;--nk-tag-gray-bg: #e3e2e0;--nk-tag-gray-text: #32302c;--nk-tag-brown-bg: #eee0da;--nk-tag-brown-text: #442a1e;--nk-tag-orange-bg: #fadec9;--nk-tag-orange-text: #49290e;--nk-tag-yellow-bg: #fdecc8;--nk-tag-yellow-text: #402c1b;--nk-tag-green-bg: #dbeddb;--nk-tag-green-text: #1c3829;--nk-tag-blue-bg: #d3e5ef;--nk-tag-blue-text: #183347;--nk-tag-purple-bg: #e8deee;--nk-tag-purple-text: #412454;--nk-tag-pink-bg: #f5e0e9;--nk-tag-pink-text: #4c2337;--nk-tag-red-bg: #ffe2dd;--nk-tag-red-text: #5d1715;--nk-tint-gray: #f1f1ef;--nk-color-gray: #787774;--nk-tint-brown: #f4eeee;--nk-color-brown: #9f6b53;--nk-tint-orange: #fbecdd;--nk-color-orange: #d9730d;--nk-tint-yellow: #fbf3db;--nk-color-yellow: #cb912f;--nk-tint-green: #edf3ec;--nk-color-green: #448361;--nk-tint-blue: #e7f3f8;--nk-color-blue: #337ea9;--nk-tint-purple: #f8f3fc;--nk-color-purple: #9065b0;--nk-tint-pink: #fcf1f6;--nk-color-pink: #c14c8a;--nk-tint-red: #fdebec;--nk-color-red: #cd3c3a;--nk-decor-purple: #9065b0;--nk-decor-blue: #529cca;--nk-decor-orange: #d9730d;--nk-scrim: rgba(15,15,15,.6);--nk-scrim-soft: rgba(15,15,15,.5);--nk-sidebar-width: 260px;--nk-peek-width: 560px;--nk-page-full-max: none;--nk-cover-height: 200px;--nk-panel-cover-height: 64px;--nk-tab-bar-height: 58px;--nk-radius: 6px;--nk-font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;--nk-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--nk-shadow-menu: rgba(15,15,15,.05) 0px 0px 0px 1px, rgba(15,15,15,.1) 0px 3px 6px, rgba(15,15,15,.2) 0px 9px 24px;--nk-shadow-card: 0 1px 2px rgba(0,0,0,.04);--nk-shadow-btn: inset 0 0 0 1px rgba(15,15,15,.1), 0 1px 2px rgba(15,15,15,.1);--nk-shadow-knob: 0 1px 2px rgba(0,0,0,.2);--nk-shadow-segment: 0 1px 2px rgba(0,0,0,.08)}[data-theme=dark]{color-scheme:dark;--nk-bg: #191919;--nk-bg-sidebar: #202020;--nk-bg-hover: rgba(255,255,255,.055);--nk-bg-active: rgba(255,255,255,.08);--nk-bg-callout: #252525;--nk-bg-code: #202020;--nk-bg-card: #202020;--nk-bg-input: rgba(255,255,255,.055);--nk-text: rgba(255,255,255,.81);--nk-text-secondary: rgba(255,255,255,.46);--nk-text-tertiary: rgba(255,255,255,.32);--nk-text-sidebar: rgba(255,255,255,.62);--nk-border: rgba(255,255,255,.094);--nk-border-strong: rgba(255,255,255,.16);--nk-accent: #529CCA;--nk-danger: #df5452;--nk-tag-gray-bg: #373737;--nk-tag-gray-text: rgba(255,255,255,.85);--nk-tag-brown-bg: #603b2c;--nk-tag-brown-text: rgba(255,255,255,.85);--nk-tag-orange-bg: #854c1d;--nk-tag-orange-text: rgba(255,255,255,.85);--nk-tag-yellow-bg: #89632a;--nk-tag-yellow-text: rgba(255,255,255,.85);--nk-tag-green-bg: #2b593f;--nk-tag-green-text: rgba(255,255,255,.85);--nk-tag-blue-bg: #28456c;--nk-tag-blue-text: rgba(255,255,255,.85);--nk-tag-purple-bg: #492f64;--nk-tag-purple-text: rgba(255,255,255,.85);--nk-tag-pink-bg: #69314c;--nk-tag-pink-text: rgba(255,255,255,.85);--nk-tag-red-bg: #6e3630;--nk-tag-red-text: rgba(255,255,255,.85);--nk-tint-gray: #252525;--nk-color-gray: #9b9b9b;--nk-tint-brown: #2e2724;--nk-color-brown: #ba856f;--nk-tint-orange: #36291f;--nk-color-orange: #c77d48;--nk-tint-yellow: #372e20;--nk-color-yellow: #ca8f3d;--nk-tint-green: #242b26;--nk-color-green: #529e72;--nk-tint-blue: #1f282d;--nk-color-blue: #5e87c9;--nk-tint-purple: #2a2430;--nk-color-purple: #9d68d3;--nk-tint-pink: #2e2328;--nk-color-pink: #d15796;--nk-tint-red: #332523;--nk-color-red: #df5452;--nk-shadow-menu: rgba(15,15,15,.2) 0px 0px 0px 1px, rgba(15,15,15,.4) 0px 3px 6px, rgba(15,15,15,.6) 0px 9px 24px;--nk-shadow-card: none;--nk-shadow-btn: inset 0 0 0 1px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.3)}',e='[class*=nk-],[class*=nk-] *,[class*=nk-]:before,[class*=nk-]:after,[class*=nk-] *:before,[class*=nk-] *:after{box-sizing:border-box}[class*=nk-] :where(h1,h2,h3,h4,h5,h6,p,figure,blockquote,dl,dd,pre,ul,ol,li){margin:0;padding:0}[class*=nk-] :where(ul,ol){list-style:none}[class*=nk-] :where(button,input,select,textarea,option,optgroup,fieldset,legend),:where(button,input,select,textarea)[class*=nk-]{margin:0;padding:0}[class*=nk-][hidden]:not([hidden=until-found i]){display:none!important}::slotted([hidden]:not([hidden="until-found" i])){display:none!important}',i='.nk-body{margin:0;min-height:100vh;min-height:100dvh;font-family:var(--nk-font);font-size:14px;background:var(--nk-bg);color:var(--nk-text);-webkit-font-smoothing:auto;transition:background .25s ease,color .25s ease}.nk-app{display:flex;height:100vh;height:100dvh;overflow:hidden}.nk-sidebar{width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));min-width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));padding-left:env(safe-area-inset-left,0px);background:var(--nk-bg-sidebar);display:flex;flex-direction:column;border-right:1px solid var(--nk-border);transition:background .25s ease,margin-left .24s cubic-bezier(.2,.8,.25,1)}.nk-workspace{display:flex;align-items:center;gap:8px;padding:10px 12px;margin:6px 8px 2px;border-radius:var(--nk-radius);cursor:pointer;font-weight:500;user-select:none}.nk-workspace:hover{background:var(--nk-bg-hover)}.nk-workspace .avatar,.nk-workspace ::slotted(.avatar),.nk-workspace ::slotted([slot="avatar"]){width:22px;height:22px;border-radius:4px;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:11px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-workspace .chev{margin-left:auto;color:var(--nk-text-tertiary);font-size:11px}.nk-sidebar-scroll{flex:1;overflow-y:auto;padding:4px 8px 16px}.nk-sidebar-scroll::-webkit-scrollbar{width:8px}.nk-sidebar-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:4px}.nk-section-label{font-size:12px;font-weight:500;letter-spacing:.01em;color:var(--nk-text-tertiary);padding:14px 10px 4px;display:flex;justify-content:space-between;align-items:center}.nk-section-label .plus{cursor:pointer;border-radius:4px;padding:0 4px;font-size:13px;opacity:0;transition:opacity .15s}.nk-section-label:hover .plus{opacity:1}.nk-section-label .plus:hover{background:var(--nk-bg-hover)}.nk-sidebar-footer{padding:8px;border-top:1px solid var(--nk-border);color:var(--nk-text-sidebar);font-size:14px}.nk-sidebar-footer .nk-tree-item{min-height:26px}.nk-sidebar-backdrop{display:none;position:fixed;inset:0;z-index:59;background:var(--nk-scrim-soft)}.nk-sidebar-toggle{display:none}.nk-sidebar.collapsed{margin-left:calc(0px - var(--nk-sidebar-width) - env(safe-area-inset-left,0px));visibility:hidden;transition:background .25s ease,margin-left .24s cubic-bezier(.2,.8,.25,1),visibility 0s linear .24s}.nk-sidebar-toggle.collapsed{display:inline-flex}.nk-sidebar-head{display:flex;align-items:center}.nk-sidebar-head>.nk-workspace,.nk-sidebar-head ::slotted(.nk-workspace){flex:1;min-width:0}.nk-sidebar-collapse{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:4px 12px 0 -4px;padding:0;border:none;border-radius:var(--nk-radius);background:transparent;color:var(--nk-text-tertiary);cursor:pointer;opacity:0;transition:opacity .15s}.nk-sidebar:hover .nk-sidebar-collapse,.nk-sidebar-collapse:focus-visible{opacity:1}.nk-sidebar-collapse:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-sidebar-collapse svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-main{flex:1;display:flex;flex-direction:column;min-width:0}.nk-topbar{height:44px;display:flex;align-items:center;padding:0 max(12px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px));gap:8px;flex-shrink:0}.nk-breadcrumb{display:flex;align-items:center;gap:4px;font-size:14px}.nk-breadcrumb .crumb,.nk-breadcrumb ::slotted(.crumb){padding:2px 6px;border-radius:4px;cursor:pointer;color:var(--nk-text-sidebar);display:flex;align-items:center;gap:5px}.nk-breadcrumb .crumb:hover{background:var(--nk-bg-hover)}a.crumb{text-decoration:none}.nk-breadcrumb .crumb.current,.nk-breadcrumb ::slotted(.crumb.current){color:var(--nk-text)}.nk-breadcrumb .sep{color:var(--nk-text-tertiary);font-size:12px}.nk-topbar-actions{margin-left:auto;display:flex;align-items:center;gap:4px}.nk-topbar-btn{padding:4px 8px;border-radius:var(--nk-radius);cursor:pointer;color:var(--nk-text-sidebar);font-size:14px;user-select:none;border:none;background:transparent;font-family:inherit}.nk-topbar-btn:hover{background:var(--nk-bg-hover)}.nk-topbar-btn svg,.nk-topbar-btn ::slotted(svg){width:16px;height:16px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-share-btn{font-size:14px;padding:4px 8px}.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){padding:4px 8px;font-size:12px;color:var(--nk-text-tertiary);white-space:nowrap}.nk-theme-toggle{font-size:15px;width:30px;height:28px;padding:0}.nk-tab-bar{display:none;flex:none;align-items:stretch;gap:2px;position:sticky;bottom:0;z-index:30;box-sizing:border-box;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)));padding:6px max(4px,env(safe-area-inset-right,0px)) max(6px,env(safe-area-inset-bottom,0px)) max(4px,env(safe-area-inset-left,0px));background:var(--nk-bg-sidebar);border-top:1px solid var(--nk-border)}.nk-tab-bar.always{display:flex}.nk-tab-bar.fixed{position:fixed;left:0;right:0;bottom:0}.nk-tab-bar-spacer{display:none;flex:none;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)))}.nk-tab-bar.always.fixed+.nk-tab-bar-spacer{display:block}.nk-tab-bar.floating{position:fixed;left:max(12px,env(safe-area-inset-left,0px));right:max(12px,env(safe-area-inset-right,0px));bottom:calc(12px + env(safe-area-inset-bottom,0px));height:var(--nk-tab-bar-height);padding:6px;border:1px solid var(--nk-border);border-radius:16px;box-shadow:var(--nk-shadow-menu)}.nk-tab-bar-item{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:4px 2px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:10.5px;line-height:1.2;color:var(--nk-text-secondary);text-decoration:none;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}.nk-tab-bar-item:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-tab-bar-item.active{color:var(--nk-accent)}.nk-tab-bar-item:disabled{opacity:.5;cursor:not-allowed}.nk-tab-bar-item .icon,.nk-tab-bar-item ::slotted([slot="icon"]){font-size:20px;line-height:1}.nk-tab-bar-item .label,.nk-tab-bar-item ::slotted(.label){max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-tree-item{display:flex;align-items:center;gap:6px;padding:3px 8px 3px 10px;border-radius:var(--nk-radius);cursor:pointer;user-select:none;color:var(--nk-text-sidebar);position:relative;min-height:var(--_nk-row, 28px)}.nk-tree-item:hover{background:var(--nk-bg-hover)}.nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-tree-item.compact{min-height:26px}.nk-tree-item .icon,.nk-tree-item ::slotted(.icon),.nk-tree-item ::slotted([slot="icon"]){font-size:15px;width:20px;text-align:center;flex-shrink:0}.nk-tree-item .label,.nk-tree-item ::slotted(.label){white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-tree-item .actions{margin-left:auto;display:none;gap:2px;color:var(--nk-text-tertiary)}.nk-tree-item:hover .actions{display:flex}.nk-tree-item .actions span{padding:0 3px;border-radius:3px;font-size:12px}.nk-tree-item .actions span:hover{background:var(--nk-bg-active)}.nk-tree-children{margin-left:14px;border-left:1px solid var(--nk-border);padding-left:4px;overflow:hidden}.nk-tree-children.collapsed{display:none}.nk-toggle-arrow{width:16px;height:16px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-size:9px;color:var(--nk-text-tertiary);border-radius:3px;transition:transform .15s}.nk-toggle-arrow.open{transform:rotate(90deg)}.nk-kbd-hint{margin-left:auto;display:flex;gap:3px;align-items:center}.nk-kbd{font-family:inherit;font-size:10.5px;background:var(--nk-bg-callout);border:1px solid var(--nk-border-strong);border-bottom-width:2px;border-radius:4px;padding:0 4px}.nk-page-scroll{flex:1;overflow-y:auto}.nk-page-scroll::-webkit-scrollbar{width:10px}.nk-page-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-cover{height:var(--nk-cover-height);background:radial-gradient(ellipse at 20% 40%,color-mix(in srgb,var(--nk-decor-purple) 35%,transparent),transparent 55%),radial-gradient(ellipse at 80% 20%,color-mix(in srgb,var(--nk-decor-blue) 35%,transparent),transparent 55%),radial-gradient(ellipse at 60% 90%,color-mix(in srgb,var(--nk-decor-orange) 25%,transparent),transparent 55%),var(--nk-bg-callout)}.nk-cover>img,.nk-cover ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-page{max-width:760px;margin:0 auto;padding:24px max(64px,env(safe-area-inset-right,0px)) 120px max(64px,env(safe-area-inset-left,0px));font-size:16px;line-height:1.5}.nk-page.full{max-width:var(--nk-page-full-max)}.nk-page.small{font-size:14px}.nk-cover+.nk-page:has(>.nk-page-icon:not([hidden])),.nk-page.covered{padding-top:0}.nk-page-icon,.nk-page ::slotted(.nk-page-icon),.nk-page ::slotted([slot="icon"]){font-size:64px;line-height:1;margin-top:0;cursor:pointer;user-select:none;display:inline-block}.nk-cover+.nk-page .nk-page-icon,.nk-cover+.nk-page ::slotted(.nk-page-icon),.nk-cover+.nk-page ::slotted([slot="icon"]),.nk-page.covered .nk-page-icon,.nk-page.covered ::slotted(.nk-page-icon),.nk-page.covered ::slotted([slot="icon"]){margin-top:-42px}.nk-page-title{font-size:var(--_nk-title, 40px);font-weight:700;line-height:1.2;margin:8px 0 4px;outline:none;letter-spacing:0}.nk-page-meta{color:var(--nk-text-tertiary);font-size:13px;margin-bottom:24px;display:flex;gap:16px}.nk-props{display:flex;flex-direction:column;margin:0 0 var(--nk-block-space, 20px);font-size:14px;line-height:1.5}.nk-props.flush{margin:0}.nk-prop{display:flex;flex-wrap:wrap;align-items:flex-start;min-width:0}.nk-prop .p-name{flex:0 0 160px;min-width:0;min-height:34px;padding:0 6px;display:flex;align-items:center;gap:6px;overflow:hidden;border-radius:var(--nk-radius);color:var(--nk-text-secondary);white-space:nowrap;user-select:none}.nk-prop .p-icon,.nk-prop ::slotted([slot="icon"]){width:16px;flex-shrink:0;text-align:center;font-size:13px}.nk-prop .p-value{flex:1 1 220px;min-width:0;min-height:34px;padding:5px 8px;display:flex;align-items:center;flex-wrap:wrap;gap:4px 6px;border-radius:var(--nk-radius);overflow-wrap:anywhere}.nk-prop .p-value.text{display:block;align-content:center}.nk-prop .p-name:hover,.nk-prop .p-value:hover{background:var(--nk-bg-hover)}.nk-page p.lead{font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px}.nk-page ::slotted(p.lead){font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px!important}.nk-heading{font-size:1.5em;font-weight:600;line-height:1.3;margin:32px 0 10px;display:flex;align-items:center;gap:8px}:is(.nk-props,.nk-callout,.nk-bookmark,.nk-toggle,.nk-divider,.nk-quote,.nk-code,.nk-database,.nk-danger-zone,.nk-gallery-grid,.nk-template-btn,.nk-synced,.nk-banner,.nk-panels,.nk-skeleton,.nk-steps,.nk-comments,.nk-block-host,.nk-model-card,.nk-ai-input-row).flush{margin-top:0;margin-bottom:0}.nk-callout{display:flex;gap:10px;align-items:flex-start;background:var(--nk-bg-callout);border-radius:var(--nk-radius);padding:16px 16px 16px 12px;margin:var(--nk-block-space, 16px) 0;line-height:1.5}.nk-callout .c-icon,.nk-callout ::slotted(.c-icon),.nk-callout ::slotted([slot="icon"]){font-size:17px}.nk-bookmark{display:flex;min-width:0;margin:var(--nk-block-space, 8px) 0;overflow:hidden;border:1px solid var(--nk-border);border-radius:var(--nk-radius);color:var(--nk-text);text-decoration:none;transition:background .12s ease}.nk-bookmark:hover{background:var(--nk-bg-hover)}.nk-bookmark .bm-text{flex:1 1 0;min-width:0;padding:12px 14px 14px;font-size:14px;line-height:20px}.nk-bookmark .bm-title{display:block;min-height:24px;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-bookmark .bm-desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;max-height:32px;font-size:12px;line-height:16px;color:var(--nk-text-secondary)}.nk-bookmark .bm-url{display:flex;align-items:center;gap:6px;margin-top:6px;font-size:12px;line-height:16px;white-space:nowrap}.nk-bookmark .bm-url>span{min-width:0;overflow:hidden;text-overflow:ellipsis}.nk-bookmark .bm-favicon{flex:none;width:16px;height:16px}.nk-bookmark .bm-cover{position:relative;flex:0 0 33%;max-width:240px}.nk-bookmark .bm-cover>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.nk-todo{display:flex;align-items:flex-start;gap:8px;padding:4px 0}.nk-todo input[type=checkbox]{appearance:none;width:16px;height:16px;margin-top:3px;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;flex-shrink:0;position:relative;background:var(--nk-bg)}.nk-todo input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-todo input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-todo input:checked+span{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-todo input:disabled{opacity:.5;cursor:not-allowed}.nk-toggle{margin:var(--nk-block-space, 6px) 0}.nk-toggle summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:var(--nk-radius);font-weight:500;user-select:none}.nk-toggle summary::-webkit-details-marker{display:none}.nk-toggle summary:hover{background:var(--nk-bg-hover)}.nk-toggle summary:before{content:"\\25b8";color:var(--nk-text-tertiary);font-size:11px;transition:transform .15s;display:inline-block}.nk-toggle[open] summary:before{transform:rotate(90deg)}.nk-toggle .toggle-body,.nk-toggle ::slotted(.toggle-body){padding:4px 0 8px 26px;color:var(--nk-text-secondary);line-height:1.55}.nk-divider{border:none;border-top:1px solid var(--nk-border);margin:var(--nk-block-space, 24px) 0}.nk-quote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:var(--nk-block-space, 16px) 0;color:var(--nk-text-secondary);line-height:1.5}.nk-quote .q-cite{display:block;margin-top:6px;font-size:12.5px;color:var(--nk-text-tertiary)}.nk-mention{display:inline-flex;align-items:center;gap:4px;padding:0 4px;border-radius:4px;font-weight:500;cursor:pointer;white-space:nowrap}.nk-mention:hover{background:var(--nk-bg-hover)}.nk-mention.person{color:var(--nk-text)}.nk-mention.person .mini-avatar,.nk-mention.person .nk-avatar,.nk-mention.person ::slotted(.mini-avatar),.nk-mention.person ::slotted([slot="avatar"]){width:16px;height:16px;border-radius:50%;color:var(--nk-on-accent);font-size:8.5px;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.nk-mention.page{color:var(--nk-text-secondary);text-decoration:underline;text-decoration-color:var(--nk-border-strong);text-underline-offset:2px}.nk-mention.date{color:var(--nk-color-orange)}.nk-inline-code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-code{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:20px 24px;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;margin:var(--nk-block-space, 14px) 0;overflow-x:auto;color:var(--nk-text-secondary);white-space:pre;position:relative}.nk-code .lang{position:absolute;top:6px;right:10px;font-size:11px;color:var(--nk-text-tertiary);font-family:var(--nk-font)}.nk-code .tag,.nk-code ::slotted(.tag){color:var(--nk-accent)}.nk-code .attr,.nk-code ::slotted(.attr){color:var(--nk-color-orange)}.nk-database{margin:var(--nk-block-space, 12px) 0 var(--nk-block-space, 8px)}.nk-db-tabs{display:flex;gap:2px;align-items:center;padding:0 0 6px;margin-bottom:0;font-size:14px}.nk-db-tab{padding:4px 8px;cursor:pointer;color:var(--nk-text-secondary);border-radius:var(--nk-radius);user-select:none;line-height:20px;display:flex;align-items:center;gap:6px;flex-shrink:0;white-space:nowrap}.nk-db-tab:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-db-tab.active{color:var(--nk-text);background:var(--nk-bg-active);font-weight:500}.nk-db-tab.add{color:var(--nk-text-tertiary)}.nk-db-tab .badge,.nk-db-tab ::slotted(.badge){background:var(--nk-bg-callout);border-radius:8px;font-size:11px;padding:0 6px;color:var(--nk-text-tertiary)}.nk-db-toolbar{display:flex;align-items:center;gap:8px;min-width:0;padding-bottom:6px}.nk-db-toolbar>.nk-db-tabs{flex:1 1 auto;min-width:0;padding-bottom:0;overflow-x:auto;scrollbar-width:none}.nk-db-toolbar>.nk-db-tabs::-webkit-scrollbar{display:none}.nk-db-toolbar .tools{flex:none;display:flex;align-items:center;gap:4px;margin-left:auto}.nk-db-tool{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 8px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-db-tool:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-db-tool.active{color:var(--nk-accent)}.nk-filter-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:2px 0 8px}.nk-filter-pill{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 8px;border:1px solid var(--nk-border-strong);border-radius:12px;background:transparent;font-family:inherit;font-size:13px;line-height:1;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-filter-pill:hover{background:var(--nk-bg-hover)}.nk-filter-pill.active{color:var(--nk-accent);border-color:color-mix(in srgb,var(--nk-accent) 35%,transparent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-filter-pill.add{border-color:transparent;color:var(--nk-text-tertiary)}.nk-filter-pill.add:hover{color:var(--nk-text-secondary)}.nk-filter-pill button{padding:0;border:none;background:none;font:inherit;color:inherit;cursor:pointer}.nk-filter-pill .fp-remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:-4px;border-radius:50%;font-size:13px}.nk-filter-pill .fp-remove:hover{background:color-mix(in srgb,currentColor 15%,transparent)}.nk-table-wrap{overflow-x:auto}.nk-table{width:100%;border-collapse:collapse;font-size:14px}.nk-table th{text-align:left;font-weight:400;color:var(--nk-text-secondary);height:36px;padding:0 8px;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);font-size:14px;white-space:nowrap;user-select:none;cursor:pointer}.nk-table th:hover{background:var(--nk-bg-hover)}.nk-table th .th-icon,.nk-table th ::slotted(.th-icon){margin-right:6px;font-size:13px;color:var(--nk-text-tertiary)}.nk-table td{height:36px;padding:6px 8px;line-height:1.5;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);white-space:nowrap;vertical-align:middle}.nk-table th:last-child,.nk-table td:last-child{border-right:none}.nk-table.wrap td,.nk-table td.wrap{white-space:normal;vertical-align:top}.nk-table tbody tr:hover{background:var(--nk-bg-hover)}.nk-table .row-title{display:flex;align-items:center;gap:7px;font-weight:500;cursor:pointer}.nk-table .row-title:hover{text-decoration:underline;text-decoration-color:var(--nk-text-tertiary)}.nk-table .date-cell{color:var(--nk-text-secondary)}.nk-table .num{text-align:right;font-variant-numeric:tabular-nums}.nk-table .row-actions{display:flex;justify-content:flex-end;gap:4px}.nk-table th.actions{cursor:default}.nk-table th.actions:hover{background:none}.nk-table .td-desc{display:block;font-size:12px;line-height:16px;color:var(--nk-text-tertiary)}.nk-table .td-text.gray{color:var(--nk-color-gray)}.nk-table .td-text.brown{color:var(--nk-color-brown)}.nk-table .td-text.orange{color:var(--nk-color-orange)}.nk-table .td-text.yellow{color:var(--nk-color-yellow)}.nk-table .td-text.green{color:var(--nk-color-green)}.nk-table .td-text.blue{color:var(--nk-color-blue)}.nk-table .td-text.purple{color:var(--nk-color-purple)}.nk-table .td-text.pink{color:var(--nk-color-pink)}.nk-table .td-text.red{color:var(--nk-color-red)}.nk-table .person-cell{display:flex;align-items:center;gap:6px;color:var(--nk-text-secondary)}.nk-table .person-cell .mini-avatar,.nk-table .person-cell ::slotted(.mini-avatar){width:20px;height:20px;border-radius:50%;font-size:10px;color:var(--nk-on-accent);display:inline-flex;align-items:center;justify-content:center;font-weight:600}.nk-new-row,.nk-table .new-row{color:var(--nk-text-tertiary);cursor:pointer;padding:8px;display:flex;align-items:center;gap:7px;font-size:14px}.nk-new-row:hover,.nk-table .new-row:hover{background:var(--nk-bg-hover)}.nk-tag{display:inline-flex;align-items:center;max-width:100%;height:20px;padding:0 6px;border-radius:3px;font-size:14px;font-weight:400;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.gray{background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.brown{background:var(--nk-tag-brown-bg);color:var(--nk-tag-brown-text)}.nk-tag.orange{background:var(--nk-tag-orange-bg);color:var(--nk-tag-orange-text)}.nk-tag.yellow{background:var(--nk-tag-yellow-bg);color:var(--nk-tag-yellow-text)}.nk-tag.green{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text)}.nk-tag.blue{background:var(--nk-tag-blue-bg);color:var(--nk-tag-blue-text)}.nk-tag.purple{background:var(--nk-tag-purple-bg);color:var(--nk-tag-purple-text)}.nk-tag.pink{background:var(--nk-tag-pink-bg);color:var(--nk-tag-pink-text)}.nk-tag.red{background:var(--nk-tag-red-bg);color:var(--nk-tag-red-text)}.nk-progress{width:110px;height:6px;border-radius:3px;background:var(--nk-tint-blue);overflow:hidden;display:inline-block}.nk-progress>i{display:block;height:100%;background:var(--nk-color-blue);border-radius:3px}.nk-progress.wide{width:100%;flex:1 1 60px;max-height:6px}.nk-progress-label{font-size:12px;color:var(--nk-text-tertiary);margin-left:7px;white-space:nowrap}.nk-progress-row{display:inline-flex;align-items:center;max-width:100%;vertical-align:middle}.nk-progress-row:has(>.nk-progress.wide){display:flex;flex:1 1 60px;width:100%;max-height:max-content}.nk-list{display:flex;flex-direction:column;font-size:14px}.nk-list-item{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden;min-height:36px;padding:4px 6px;border-bottom:1px solid var(--nk-border);color:inherit;text-decoration:none;cursor:pointer}.nk-list-item:hover{background:var(--nk-bg-hover)}.nk-list-item.static{cursor:default}.nk-list-item.static:hover{background:none}.nk-list>.nk-list-item:last-child,.nk-list ::slotted(.nk-list-item:last-child),.nk-list-item.last{border-bottom:none}.nk-list-item .l-icon,.nk-list-item ::slotted([slot="icon"]){width:20px;flex-shrink:0;text-align:center;font-size:15px}.nk-list-item .l-title,.nk-list-item ::slotted(.l-title){flex:1 1 auto;min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-list-item .l-meta,.nk-list-item ::slotted(.l-meta){flex:none;display:flex;align-items:center;gap:8px;margin-left:auto;font-size:12px;color:var(--nk-text-secondary);white-space:nowrap}.nk-calendar-view{font-size:14px}.nk-calendar-view .cv-head{display:flex;align-items:center;gap:4px;padding:2px 0 8px}.nk-calendar-view .cv-title{flex:1;font-weight:600;white-space:nowrap}.nk-calendar-view .cv-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-top:1px solid var(--nk-border);border-left:1px solid var(--nk-border)}.nk-calendar-view.weeks .cv-grid{grid-template-columns:32px repeat(7,minmax(0,1fr))}.nk-calendar-view :is(.cv-wd,.cv-week,.cv-day){min-width:0;border-right:1px solid var(--nk-border);border-bottom:1px solid var(--nk-border)}.nk-calendar-view .cv-wd{padding:4px 8px;font-size:12px;color:var(--nk-text-secondary);text-align:center}.nk-calendar-view .cv-week{padding:6px 0;font-size:11px;color:var(--nk-text-tertiary);text-align:center;font-variant-numeric:tabular-nums}.nk-calendar-view .cv-day{display:flex;flex-direction:column;gap:3px;min-height:112px;padding:4px 4px 6px}.nk-calendar-view .cv-day:is(.out,.off){background:var(--nk-bg-sidebar)}.nk-calendar-view .cv-num{align-self:flex-end;min-width:22px;height:22px;padding:0 6px;border-radius:11px;font-size:13px;line-height:22px;text-align:center;color:var(--nk-text-secondary);font-variant-numeric:tabular-nums}.nk-calendar-view .cv-day.out .cv-num{color:var(--nk-text-tertiary)}.nk-calendar-view .cv-day.today .cv-num{background:var(--nk-danger);color:var(--nk-on-accent)}.nk-calendar-view .cv-item{display:block;min-width:0;padding:3px 6px;border-radius:4px;background:var(--nk-bg-card);border:1px solid var(--nk-border);box-shadow:var(--nk-shadow-card);font-size:12.5px;line-height:18px;color:var(--nk-text);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.nk-calendar-view .cv-item:hover{background:var(--nk-bg-hover)}.nk-board{display:none;gap:12px;padding:14px 2px;overflow-x:auto}.nk-board.active{display:flex}.nk-board-col{min-width:220px;width:220px;flex-shrink:0}.nk-board-col-header{display:flex;align-items:center;gap:7px;margin-bottom:8px;font-size:13.5px;font-weight:500}.nk-board-col-header .count{color:var(--nk-text-tertiary);font-weight:400}.nk-card{background:var(--nk-bg-card);border:1px solid var(--nk-border);border-radius:8px;padding:10px 12px;margin-bottom:8px;cursor:grab;box-shadow:var(--nk-shadow-card);transition:border-color .15s}.nk-card:hover{border-color:var(--nk-border-strong)}.nk-card .card-title,.nk-card ::slotted(.card-title){font-weight:500;margin-bottom:7px;display:flex;gap:6px;align-items:center}.nk-card .card-meta,.nk-card ::slotted(.card-meta){display:flex;gap:6px;flex-wrap:wrap;align-items:center;font-size:12px;color:var(--nk-text-secondary)}.nk-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr));gap:16px;padding:14px 2px}.nk-gallery.small{grid-template-columns:repeat(auto-fill,minmax(min(180px,100%),1fr));gap:12px}.nk-gallery.large{grid-template-columns:repeat(auto-fill,minmax(min(340px,100%),1fr))}.nk-gallery .nk-card{display:flex;flex-direction:column;min-width:0;margin:0;color:inherit;text-decoration:none;cursor:pointer}.nk-gallery .nk-card>.nk-cover{flex:none;height:auto;aspect-ratio:2 / 1;margin:-10px -12px 10px;border-radius:7px 7px 0 0;overflow:hidden}.nk-gallery.fit .nk-card>.nk-cover:has(>img){background:var(--nk-bg-callout)}.nk-gallery.fit .nk-card>.nk-cover>img{object-fit:contain}.nk-gallery .card-title{min-width:0}.nk-gallery>.card-item{display:flex;min-width:0}.nk-gallery>.card-item>.nk-card{flex:1 1 auto}.nk-gallery>.nk-new-row{justify-content:center;min-height:64px;border:1px dashed var(--nk-border-strong);border-radius:8px}.nk-field{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:9px 0;--_nk-field-min: 210px}.nk-field .f-label,.nk-field ::slotted(.f-label),.nk-field ::slotted([slot="label"]){font-size:14px}.nk-field .f-desc,.nk-field ::slotted(.f-desc),.nk-field ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-field .f-control,.nk-field ::slotted(.f-control){flex-shrink:0}.nk-field.stacked,.nk-fields>.nk-field{flex-direction:column;align-items:stretch;gap:6px;min-width:0}.nk-field.stacked .f-control,.nk-fields>.nk-field .f-control{width:100%;min-width:0}.nk-field.stacked .nk-input,.nk-field.stacked .nk-textarea,.nk-field.stacked .nk-select,.nk-fields>.nk-field .nk-input,.nk-fields>.nk-field .nk-textarea,.nk-fields>.nk-field .nk-select{width:100%;min-width:0}.nk-field.compact,.nk-fields>.nk-field{padding:0;gap:4px;min-width:0}.nk-field.compact .f-label,.nk-field.compact ::slotted([slot="label"]),.nk-fields>.nk-field .f-label,.nk-fields>.nk-field ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-tertiary)}.nk-fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px 12px;padding:9px 0}.nk-fields.fit{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}.nk-fields>.nk-field{min-width:0}.nk-input,.nk-select,.nk-textarea{font-family:inherit;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:5px 10px;outline:none;transition:border-color .15s,box-shadow .15s;min-width:var(--_nk-field-min, 210px);max-width:100%}.nk-input:hover,.nk-select:hover,.nk-textarea:hover{border-color:var(--nk-border-strong)}.nk-input:focus,.nk-select:focus,.nk-textarea:focus{border-color:color-mix(in srgb,var(--nk-accent) 60%,transparent);box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 30%,transparent)}.nk-input::placeholder,.nk-textarea::placeholder{color:var(--nk-text-tertiary)}.nk-input.wide,.nk-textarea.wide,.nk-select.wide{width:100%;min-width:0}.nk-input[type=date],.nk-input[type=time],.nk-input[type=datetime-local],.nk-input[type=month]{appearance:none}.nk-input::-webkit-date-and-time-value{text-align:start;min-height:1lh}.nk-select.compact{min-width:120px}.nk-textarea{resize:vertical;min-height:70px;line-height:1.5}.nk-select{appearance:none;cursor:pointer;padding-right:26px;background-image:linear-gradient(45deg,transparent 50%,var(--nk-text-tertiary) 50%),linear-gradient(135deg,var(--nk-text-tertiary) 50%,transparent 50%);background-position:calc(100% - 14px) 55%,calc(100% - 10px) 55%;background-size:4px 4px;background-repeat:no-repeat}.nk-copy-field{display:flex;align-items:center;gap:2px;min-width:var(--_nk-field-min, 210px);max-width:100%;padding:0 3px 0 10px;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius)}.nk-copy-field.wide{width:100%;min-width:0}.nk-copy-field.wrap{align-items:flex-start}.nk-copy-field .cf-value{flex:1 1 auto;min-width:0;padding:5px 6px 5px 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.nk-copy-field.mono .cf-value{font-family:var(--nk-font-mono);font-size:13px}.nk-copy-field.wrap .cf-value{white-space:pre-wrap;overflow-wrap:anywhere}.nk-copy-field .cf-btn{flex:none;height:24px;margin:3px 0;padding:0 8px;border:none;border-radius:4px;background:transparent;font-family:inherit;font-size:13px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer}.nk-copy-field .cf-btn:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-copy-field .cf-btn.copied{color:var(--nk-color-green)}.nk-copy-field .cf-btn>svg{display:none;width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-copy-field.icons .cf-btn:has(>svg){display:inline-flex;align-items:center;justify-content:center;width:28px;padding:0}.nk-copy-field.icons .cf-btn>svg{display:block}.nk-copy-field.icons .cf-btn:has(>svg)>span{display:none}.nk-calendar{display:block;width:max-content;max-width:100%;margin-inline:auto;font-size:14px;user-select:none;-webkit-user-select:none}.nk-calendar .cal-head{display:flex;align-items:center;gap:2px;padding:0 0 6px 6px}.nk-calendar .cal-title{flex:1;font-weight:600;white-space:nowrap}.nk-calendar .cal-nav,.nk-calendar-view .cal-nav{display:inline-flex;align-items:center;justify-content:center;height:28px;min-width:28px;padding:0 6px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:13px;color:var(--nk-text-secondary);cursor:pointer}.nk-calendar .cal-nav:hover,.nk-calendar-view .cal-nav:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-calendar .cal-nav svg,.nk-calendar-view .cal-nav svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-calendar .cal-grid{display:grid;grid-template-columns:repeat(7,var(--_nk-cell, 36px));row-gap:2px}.nk-calendar.weeks .cal-grid{grid-template-columns:24px repeat(7,var(--_nk-cell, 36px))}.nk-calendar .cal-wd,.nk-calendar .cal-week{display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--nk-text-tertiary);font-variant-numeric:tabular-nums}.nk-calendar .cal-wd{height:24px}.nk-calendar .cal-week{font-size:11px}.nk-calendar .cal-day{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--_nk-cell, 36px);height:var(--_nk-cell, 36px);padding:0;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text);font-variant-numeric:tabular-nums;cursor:pointer}.nk-calendar .cal-day:hover{background:var(--nk-bg-hover)}.nk-calendar .cal-day:focus-visible{outline:2px solid color-mix(in srgb,var(--nk-accent) 60%,transparent);outline-offset:-2px}.nk-calendar .cal-day.out,.nk-calendar .cal-day.off{color:var(--nk-text-tertiary)}.nk-calendar .cal-day.today{color:var(--nk-danger);font-weight:600}.nk-calendar .cal-day.in-range{border-radius:0;background:color-mix(in srgb,var(--nk-accent) 12%,transparent)}.nk-calendar .cal-day:is(.selected,.start,.end){background:var(--nk-accent);color:var(--nk-on-accent);font-weight:500}.nk-calendar .cal-day.start:not(.end){border-radius:var(--nk-radius) 0 0 var(--nk-radius)}.nk-calendar .cal-day.end:not(.start){border-radius:0 var(--nk-radius) var(--nk-radius) 0}.nk-calendar .cal-day[aria-disabled=true]{color:var(--nk-text-tertiary);background:none;opacity:.5;cursor:default}.nk-calendar .cal-marks{position:absolute;left:0;right:0;bottom:3px;display:flex;justify-content:center;gap:2px;pointer-events:none}.nk-calendar .cal-marks i{width:4px;height:4px;border-radius:50%;background:var(--nk-color-gray)}.nk-calendar .cal-day:is(.selected,.start,.end) .cal-marks i{background:var(--nk-on-accent)}.nk-calendar .cal-foot{display:flex;align-items:center;gap:8px;margin-top:8px;padding:8px 2px 0;border-top:1px solid var(--nk-border)}.nk-calendar .cal-foot .nk-input{min-width:0;flex:1 1 auto}.nk-btn{font-family:inherit;font-size:14px;line-height:20px;font-weight:500;border-radius:var(--nk-radius);cursor:pointer;padding:3px 12px;border:1px solid transparent;transition:background .15s,border-color .15s,box-shadow .15s,opacity .15s;display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}.nk-btn svg,.nk-btn ::slotted(svg){width:15px;height:15px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-btn.primary{background:var(--nk-accent);color:var(--nk-on-accent)}.nk-btn.primary:hover:not(:disabled,[aria-disabled=true]){opacity:.88}.nk-btn.secondary{background:var(--nk-bg-card);color:var(--nk-text);box-shadow:var(--nk-shadow-btn)}.nk-btn.secondary:hover:not(:disabled,[aria-disabled=true]){background:color-mix(in srgb,var(--nk-bg-card),var(--nk-text) 6%)}.nk-btn.danger{background:var(--nk-bg-card);color:var(--nk-danger);box-shadow:var(--nk-shadow-btn)}.nk-btn.danger:hover:not(:disabled,[aria-disabled=true]){background:color-mix(in srgb,var(--nk-danger) 8%,var(--nk-bg-card))}.nk-btn.danger-solid{background:var(--nk-danger);color:var(--nk-on-accent)}.nk-btn.danger-solid:hover:not(:disabled,[aria-disabled=true]){opacity:.88}.nk-btn.small{padding:1px 8px;font-size:13px;line-height:20px}a.nk-btn{text-decoration:none}.nk-btn:disabled,.nk-btn[aria-disabled=true]{opacity:.5;cursor:not-allowed}.nk-switch{position:relative;width:34px;height:20px;flex-shrink:0;appearance:none;border:none;cursor:pointer;border-radius:20px;background:var(--nk-border-strong);transition:background .2s}.nk-switch:after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--nk-on-accent);transition:transform .2s;box-shadow:var(--nk-shadow-knob)}.nk-switch:checked,.nk-switch[aria-checked=true]{background:var(--nk-accent)}.nk-switch:checked:after,.nk-switch[aria-checked=true]:after{transform:translate(14px)}.nk-switch:disabled{opacity:.5;cursor:not-allowed}.nk-switch-label{display:inline-flex;align-items:flex-start;gap:8px;font-size:14px;cursor:pointer}.nk-switch-label>.nk-switch{font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 20px)/2))}.nk-switch-label>span{padding-top:max(0px,calc((20px - 1lh)/2))}.nk-switch-label:has(.nk-switch:disabled){cursor:not-allowed;color:var(--nk-text-tertiary)}.nk-check{display:flex;align-items:flex-start;gap:8px;padding:4px 0;font-size:14px;cursor:pointer}.nk-check input{appearance:none;width:16px;height:16px;flex-shrink:0;border:1.4px solid var(--nk-border-strong);border-radius:3px;cursor:pointer;position:relative;background:var(--nk-bg);font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 16px)/2))}.nk-check input[type=radio]{border-radius:50%}.nk-check input:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-check input:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:10.5px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-check input[type=radio]:checked:after{content:"\\25cf";font-size:7px}.nk-check input:disabled{opacity:.5;cursor:not-allowed}.nk-check input:disabled+*{opacity:.6}.nk-slider{width:210px;accent-color:var(--nk-accent);cursor:pointer}.nk-slider-value{font-size:12.5px;color:var(--nk-text-tertiary);margin-top:3px}.nk-profile-row{display:flex;align-items:center;gap:14px;padding:8px 0}.nk-profile-row .big-avatar,.nk-profile-row ::slotted(.big-avatar),.nk-profile-row ::slotted([slot="avatar"]){width:56px;height:56px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:20px;font-weight:600;display:flex;align-items:center;justify-content:center;overflow:hidden;flex-shrink:0}.nk-profile-row .big-avatar>img{display:block;width:100%;height:100%;object-fit:cover}.nk-profile-row .big-avatar.square,.nk-profile-row ::slotted(.big-avatar.square){border-radius:8px}.nk-profile-row .pr-actions{display:flex;flex-direction:column;gap:6px}.nk-profile-row .pr-remove{color:var(--nk-text-tertiary)}.nk-model-card{border:1px solid var(--nk-border-strong);border-radius:8px;padding:12px 14px;margin-bottom:var(--nk-block-space, 10px);cursor:pointer;display:flex;align-items:flex-start;gap:11px;transition:border-color .15s,background .15s}.nk-model-card:hover{background:var(--nk-bg-hover)}.nk-model-card.selected{border-color:var(--nk-accent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-model-card .m-radio{width:15px;height:15px;border-radius:50%;flex-shrink:0;margin-top:2px;border:1.4px solid var(--nk-border-strong);position:relative}.nk-model-card.selected .m-radio{border-color:var(--nk-accent)}.nk-model-card.selected .m-radio:after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--nk-accent)}.nk-model-card .m-name,.nk-model-card ::slotted(.m-name),.nk-model-card ::slotted([slot="title"]){font-weight:500;font-size:14px;display:flex;align-items:center;gap:7px}.nk-model-card .m-desc,.nk-model-card ::slotted(.m-desc),.nk-model-card ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-danger-zone{border:1px solid color-mix(in srgb,var(--nk-danger) 40%,transparent);border-radius:8px;padding:14px 16px;margin-top:var(--nk-block-space, 26px)}.nk-danger-zone .dz-title{color:var(--nk-danger);font-weight:600;font-size:13px;margin-bottom:8px}.nk-member-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--nk-border)}.nk-member-list>.nk-member-row:last-child,.nk-member-list ::slotted(.nk-member-row:last-child),.nk-member-row.last{border-bottom:none}.nk-member-row .mini-avatar,.nk-member-row .nk-avatar,.nk-member-row ::slotted(.mini-avatar),.nk-member-row ::slotted([slot="avatar"]){width:28px;height:28px;border-radius:50%;color:var(--nk-on-accent);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;flex-shrink:0}.nk-member-row>:has(>.m-mail){min-width:0}.nk-member-row .m-mail{font-size:12px;color:var(--nk-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-member-row .nk-select{min-width:120px;margin-left:auto}.nk-member-row ::slotted([slot="role"]){margin-left:auto}.nk-modal-backdrop{position:fixed;inset:0;background:var(--nk-scrim);padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);display:flex;align-items:center;justify-content:center;z-index:100;opacity:0;pointer-events:none;transition:opacity .2s ease}.nk-modal-backdrop.open{opacity:1;pointer-events:auto}.nk-modal{width:min(1150px,92vw);height:min(715px,86vh);max-width:100%;max-height:100%;background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);display:flex;overflow:hidden;transform:scale(.98) translateY(6px);transition:transform .2s ease}.nk-modal-backdrop.open .nk-modal{transform:none}.nk-settings-nav{width:240px;min-width:240px;background:var(--nk-bg-sidebar);border-right:1px solid var(--nk-border);padding:10px 8px;overflow-y:auto;flex-shrink:0}.nk-settings-user{display:flex;align-items:center;gap:9px;padding:6px 10px 12px;margin-bottom:4px}.nk-settings-user .avatar,.nk-settings-user ::slotted(.avatar),.nk-settings-user ::slotted([slot="avatar"]){width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-weight:600;font-size:13px;display:flex;align-items:center;justify-content:center}.nk-settings-user .name{font-weight:500;font-size:14px}.nk-settings-user .mail{font-size:12px;color:var(--nk-text-secondary)}.nk-settings-nav .nk-tree-item{min-height:28px}.nk-settings-nav .nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-settings-content{flex:1;overflow-y:auto;padding:36px 60px 80px;min-width:0}.nk-settings-content::-webkit-scrollbar{width:10px}.nk-settings-content::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-settings-pane{display:none;max-width:800px}.nk-settings-pane.active{display:block}.nk-settings-pane>h2{font-size:22px;font-weight:600;line-height:1.3;margin-bottom:20px}.nk-settings-pane>h3{font-size:16px;font-weight:500;padding-bottom:8px;border-bottom:1px solid var(--nk-border);margin:30px 0 12px}.nk-settings-pane ::slotted(h2){font-size:22px;font-weight:600;line-height:1.3;padding:0!important;margin:0 0 20px!important}.nk-settings-pane ::slotted(h3){font-size:16px;font-weight:500;border:0;border-bottom:1px solid var(--nk-border);padding:0 0 8px!important;margin:30px 0 12px!important}.nk-pop{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:10px;width:296px}.nk-emoji-search{width:100%;font-family:inherit;font-size:14px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:6px 10px;outline:none;margin-bottom:8px}.nk-emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px}.nk-emoji-grid span,.nk-emoji-grid ::slotted(span){font-size:18px;text-align:center;padding:4px 0;border-radius:5px;cursor:pointer;user-select:none}.nk-emoji-grid span:hover{background:var(--nk-bg-hover)}.nk-emoji-cats{display:flex;gap:2px;margin-top:8px;padding-top:8px;border-top:1px solid var(--nk-border)}.nk-emoji-cats span{font-size:14px;padding:3px 7px;border-radius:5px;cursor:pointer;color:var(--nk-text-tertiary);filter:grayscale(1);opacity:.6}.nk-emoji-cats span.active,.nk-emoji-cats span:hover{filter:none;opacity:1;background:var(--nk-bg-hover)}.nk-menu{padding:5px;width:230px}.nk-menu-item{display:flex;align-items:center;gap:9px;padding:4px 8px;min-height:var(--_nk-row, 28px);border-radius:5px;cursor:pointer;font-size:14px;user-select:none}.nk-menu-item:hover{background:var(--nk-bg-hover)}.nk-menu-item .m-icon,.nk-menu-item ::slotted(.m-icon),.nk-menu-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-menu-item .m-shortcut,.nk-menu-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-menu-item.danger{color:var(--nk-danger)}.nk-menu-item>.nk-switch{margin-left:auto}.nk-menu-sep{border-top:1px solid var(--nk-border);margin:5px 4px}.nk-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:5px 8px 2px}.nk-pop.floating{z-index:106;opacity:0;visibility:hidden;pointer-events:none;max-height:min(var(--_nk-float-max, 100dvh),100dvh - 16px);overflow-y:auto;overscroll-behavior:contain;transform:translateY(-4px) scale(.98);transform-origin:top;transition:opacity .15s ease,transform .15s ease,visibility 0s linear .15s}.nk-pop.floating.open{opacity:1;visibility:visible;pointer-events:auto;transform:none;transition:opacity .15s ease,transform .15s ease,visibility 0s}.nk-cmdk-backdrop{position:fixed;inset:0;background:var(--nk-scrim-soft);display:flex;justify-content:center;align-items:flex-start;padding:max(14vh,env(safe-area-inset-top,0px)) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);z-index:110;opacity:0;pointer-events:none;transition:opacity .18s ease}.nk-cmdk-backdrop.open{opacity:1;pointer-events:auto}.nk-cmdk{max-width:100%;width:min(560px,92vw);background:var(--nk-bg);border-radius:12px;box-shadow:var(--nk-shadow-menu);overflow:hidden;transform:scale(.98);transition:transform .18s ease}.nk-cmdk-backdrop.open .nk-cmdk{transform:scale(1)}.nk-cmdk-input-row{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--nk-border)}.nk-cmdk-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:16px;color:var(--nk-text)}.nk-cmdk-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-cmdk-list{max-height:320px;overflow-y:auto;padding:6px}.nk-cmdk-group{font-size:12px;color:var(--nk-text-tertiary);padding:8px 10px 3px}.nk-cmdk-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;cursor:pointer;font-size:14px;user-select:none}.nk-cmdk-item.selected{background:var(--nk-bg-active)}.nk-cmdk-item .m-icon,.nk-cmdk-item ::slotted(.m-icon),.nk-cmdk-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-cmdk-item .m-shortcut,.nk-cmdk-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-cmdk-empty{padding:30px;text-align:center;color:var(--nk-text-tertiary);font-size:13.5px}.nk-cmdk-footer{display:flex;gap:14px;padding:8px 16px;border-top:1px solid var(--nk-border);font-size:11.5px;color:var(--nk-text-tertiary)}.nk-sheet-backdrop{position:fixed;inset:0;z-index:100;display:none;flex-direction:column;align-items:center;justify-content:flex-end;padding-top:max(24px,env(safe-area-inset-top,0px));background:var(--nk-scrim-soft);opacity:0;transition:opacity .2s ease,display .25s allow-discrete}.nk-sheet-backdrop.open{display:flex;opacity:1}@starting-style{.nk-sheet-backdrop.open{opacity:0}}.nk-sheet{--_nk-row: 40px;width:100%;max-width:640px;max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:6px max(10px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));background:var(--nk-bg);color:var(--nk-text);border-radius:14px 14px 0 0;box-shadow:var(--nk-shadow-menu);translate:0 100%;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-sheet-backdrop.open .nk-sheet{translate:none}@starting-style{.nk-sheet-backdrop.open .nk-sheet{translate:0 100%}}.nk-sheet .sh-grabber,.nk-sheet ::slotted(.sh-grabber){width:36px;height:4px;margin:4px auto 10px;border-radius:2px;background:var(--nk-border-strong)}.nk-sheet .sh-title,.nk-sheet ::slotted(.sh-title){font-size:14px;font-weight:600;text-align:center;padding:0 8px 10px}.nk-dialog-backdrop{position:fixed;inset:0;z-index:105;display:none;align-items:center;justify-content:center;padding:max(16px,env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));background:var(--nk-scrim-soft);opacity:0;transition:opacity .2s ease,display .2s allow-discrete}.nk-dialog-backdrop.open{display:flex;opacity:1}@starting-style{.nk-dialog-backdrop.open{opacity:0}}.nk-dialog{width:440px;max-width:100%;max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:20px 24px;border-radius:10px;outline:none;background:var(--nk-bg);color:var(--nk-text);box-shadow:var(--nk-shadow-menu);scale:.98;translate:0 6px;transition:scale .2s ease,translate .2s ease}.nk-dialog.wide{width:560px}.nk-dialog-backdrop.open .nk-dialog{scale:none;translate:none}@starting-style{.nk-dialog-backdrop.open .nk-dialog{scale:.98;translate:0 6px}}.nk-dialog .dl-title{font-size:16px;font-weight:600;line-height:1.4;margin-bottom:6px}.nk-dialog .dl-body{font-size:14px;line-height:1.5}.nk-dialog .dl-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.nk-peek-backdrop{position:fixed;inset:0;z-index:50;display:none;pointer-events:none;transition:background-color .2s ease,display .25s allow-discrete}.nk-peek-backdrop.open{display:block}.nk-peek{--_nk-title: 32px;position:absolute;top:0;right:0;bottom:0;width:min(var(--nk-peek-width),100%);display:flex;flex-direction:column;pointer-events:auto;outline:none;background:var(--nk-bg);color:var(--nk-text);box-shadow:var(--nk-shadow-menu);translate:100% 0;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-peek-backdrop.open .nk-peek{translate:none}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:100% 0}}.nk-peek .pk-bar{flex:none;display:flex;align-items:center;gap:2px;height:44px;padding:0 12px}.nk-peek .pk-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 48px 64px;font-size:16px;line-height:1.5}.nk-peek .pk-resize{position:absolute;top:0;bottom:0;left:-4px;width:8px;z-index:1;cursor:col-resize;touch-action:none;outline:none}.nk-peek .pk-resize:after{content:"";position:absolute;top:0;bottom:0;left:3px;width:2px;transition:background .15s}.nk-peek .pk-resize:hover:after,.nk-peek .pk-resize:focus-visible:after,.nk-peek .pk-resize.active:after{background:var(--nk-accent)}.nk-app.peek-inset .nk-main{padding-right:min(var(--nk-peek-width),100%)}.nk-toast{position:fixed;bottom:max(20px,calc(env(safe-area-inset-bottom,0px) + 12px));left:50%;transform:translate(-50%) translateY(80px);z-index:120;width:max-content;max-width:calc(100% - 32px);background:var(--nk-text);color:var(--nk-bg);padding:8px 16px;border-radius:8px;font-size:14px;opacity:0;transition:all .3s ease;pointer-events:none;box-shadow:var(--nk-shadow-menu);display:flex;gap:8px;align-items:center}.nk-toast.show{opacity:1;transform:translate(-50%) translateY(0)}.nk-toast .t-action,.nk-toast ::slotted([slot="action"]){flex:none;margin:-2px 0 -2px 4px;padding:2px 8px;border:0;border-radius:5px;background:color-mix(in srgb,var(--nk-bg) 16%,transparent);color:inherit;font:inherit;font-weight:500;white-space:nowrap;cursor:pointer}.nk-toast ::slotted([slot="action"]){margin:-2px 0 -2px 4px!important;padding:2px 8px!important}.nk-toast .t-action:hover,.nk-toast ::slotted([slot="action"]:hover){background:color-mix(in srgb,var(--nk-bg) 26%,transparent)}.nk-toast .t-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:-6px -8px -6px -2px;padding:0;border:0;border-radius:5px;background:none;color:inherit;opacity:.7;cursor:pointer}.nk-toast .t-close:hover{opacity:1;background:color-mix(in srgb,var(--nk-bg) 16%,transparent)}.nk-toast .t-close svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}.nk-toast :is(.t-action,.t-close):focus-visible,.nk-toast ::slotted([slot="action"]:focus-visible){outline:2px solid color-mix(in srgb,var(--nk-bg) 70%,transparent);outline-offset:1px}.nk-toast.show :is(.t-action,.t-close),.nk-toast.show ::slotted([slot="action"]){pointer-events:auto}.nk-tooltip{z-index:130;max-width:260px;padding:4px 8px;border-radius:var(--nk-radius);overflow-wrap:break-word;background:var(--nk-text);color:var(--nk-bg);box-shadow:var(--nk-shadow-menu);font-size:12px;font-weight:500;line-height:16px;pointer-events:none;opacity:0;visibility:hidden;transition:opacity .1s ease,visibility 0s linear .1s}.nk-tooltip.open{opacity:1;visibility:visible;transition:opacity .1s ease}.nk-tooltip .tt-key{margin-left:6px;color:color-mix(in srgb,var(--nk-bg) 60%,transparent)}.nk-tooltip.lines{white-space:pre-line}.nk-gallery-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));gap:20px 32px;margin:var(--nk-block-space, 12px) 0}.nk-g-item>h4{font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}.nk-g-item ::slotted(h4){font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px!important}.nk-tabs{display:flex;gap:2px;border-bottom:1px solid var(--nk-border);font-size:14px}.nk-tab{padding:7px 11px;cursor:pointer;color:var(--nk-text-secondary);border-bottom:2px solid transparent;margin-bottom:-1px;user-select:none}.nk-tab:hover{color:var(--nk-text)}.nk-tab.active{color:var(--nk-text);border-bottom-color:var(--nk-text);font-weight:500}.nk-tab-panel{padding:12px 2px;color:var(--nk-text-secondary);line-height:1.55;font-size:14px}.nk-tabs.scroll{overflow-x:auto;overflow-y:hidden;scrollbar-width:none;white-space:nowrap;border-bottom:0;padding-bottom:1px;box-shadow:inset 0 -1px 0 var(--nk-border)}.nk-tabs.scroll::-webkit-scrollbar{display:none}.nk-template-btn{display:flex;align-items:center;gap:8px;width:100%;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);background:var(--nk-bg-callout);border:none;border-radius:var(--nk-radius);padding:8px 12px;cursor:pointer;margin-bottom:var(--nk-block-space, 6px);text-align:left}.nk-template-btn:hover{background:var(--nk-bg-hover)}.nk-stats{display:flex;gap:10px}.nk-stat{flex:1;border:1px solid var(--nk-border);border-radius:8px;padding:12px 14px}.nk-stat .s-label,.nk-stat ::slotted(.s-label),.nk-stat ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-secondary);margin-bottom:4px}.nk-stat .s-value,.nk-stat ::slotted(.s-value),.nk-stat ::slotted([slot="value"]){font-size:22px;font-weight:600;letter-spacing:-.01em}.nk-stat .s-delta,.nk-stat ::slotted(.s-delta),.nk-stat ::slotted([slot="delta"]){font-size:12px;margin-top:3px}.nk-stat .s-delta.up,.nk-stat ::slotted(.s-delta.up),.nk-stat ::slotted([slot="delta"].up){color:var(--nk-color-green)}.nk-stat .s-delta.down,.nk-stat ::slotted(.s-delta.down),.nk-stat ::slotted([slot="delta"].down){color:var(--nk-danger)}.nk-synced{border:1.5px solid color-mix(in srgb,var(--nk-danger) 55%,transparent);border-radius:8px;padding:12px 14px;position:relative;margin:var(--nk-block-space, 8px) 0}.nk-synced .synced-badge{position:absolute;top:-9px;right:10px;font-size:11px;background:var(--nk-danger);color:var(--nk-on-accent);border-radius:8px;padding:1px 8px}.nk-segmented{display:inline-flex;background:var(--nk-bg-callout);border-radius:7px;padding:2px}.nk-segmented button{font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px;border-radius:5px;cursor:pointer}.nk-segmented ::slotted(button){font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px!important;border-radius:5px;cursor:pointer}.nk-segmented button.active,.nk-segmented ::slotted(button.active){background:var(--nk-bg);color:var(--nk-text);font-weight:500;box-shadow:var(--nk-shadow-segment)}.nk-segmented.wrap{flex-wrap:wrap}.nk-segmented.scroll{max-width:100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}.nk-segmented.scroll::-webkit-scrollbar{display:none}.nk-segmented.scroll button,.nk-segmented.scroll ::slotted(button){flex-shrink:0;white-space:nowrap}.nk-banner{display:flex;align-items:center;gap:10px;font-size:14px;border-radius:8px;padding:10px 14px;margin-bottom:var(--nk-block-space, 8px);color:var(--nk-text)}.nk-banner.info{background:var(--nk-tint-blue)}.nk-banner.success{background:var(--nk-tint-green)}.nk-banner.warning{background:var(--nk-tint-yellow)}.nk-banner.danger{background:var(--nk-tint-red)}.nk-banner .b-action,.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:auto;padding:0;border:0;background:none;color:inherit;font:inherit;font-weight:500;text-align:left;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:auto!important}.nk-avatar-group{display:flex}.nk-avatar-group .mini-avatar,.nk-avatar-group .nk-avatar,.nk-avatar-group ::slotted(.mini-avatar),.nk-avatar-group ::slotted(.nk-avatar){width:26px;height:26px;border-radius:50%;color:var(--nk-on-accent);font-size:10.5px;font-weight:600;border:2px solid var(--nk-bg);display:flex;align-items:center;justify-content:center;margin-left:-7px}.nk-avatar-group .mini-avatar:first-child,.nk-avatar-group .nk-avatar:first-child,.nk-avatar-group ::slotted(.mini-avatar:first-child),.nk-avatar-group ::slotted(.nk-avatar:first-child){margin-left:0}.nk-avatar-group .more,.nk-avatar-group ::slotted(.more){background:var(--nk-bg-callout);color:var(--nk-text-secondary)}.nk-avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;border-radius:50%;overflow:hidden;vertical-align:middle;font-size:10px;font-weight:600;line-height:1;color:var(--nk-on-accent);user-select:none;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));object-fit:cover}.nk-avatar.small{width:20px;height:20px;font-size:9px}.nk-avatar.large{width:32px;height:32px;font-size:12px}.nk-avatar.xlarge{width:56px;height:56px;font-size:20px}.nk-avatar.square{border-radius:4px}.nk-avatar>img,.nk-avatar ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-avatar.gray,.nk-calendar .cal-marks i.gray{background:var(--nk-color-gray)}.nk-avatar.brown,.nk-calendar .cal-marks i.brown{background:var(--nk-color-brown)}.nk-avatar.orange,.nk-calendar .cal-marks i.orange{background:var(--nk-color-orange)}.nk-avatar.yellow,.nk-calendar .cal-marks i.yellow{background:var(--nk-color-yellow)}.nk-avatar.green,.nk-calendar .cal-marks i.green{background:var(--nk-color-green)}.nk-avatar.blue,.nk-calendar .cal-marks i.blue{background:var(--nk-color-blue)}.nk-avatar.purple,.nk-calendar .cal-marks i.purple{background:var(--nk-color-purple)}.nk-avatar.pink,.nk-calendar .cal-marks i.pink{background:var(--nk-color-pink)}.nk-avatar.red,.nk-calendar .cal-marks i.red{background:var(--nk-color-red)}.nk-panels{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:12px;margin:var(--nk-block-space, 12px) 0}.nk-panels.flush{margin:0}.nk-panel{display:flex;flex-direction:column;gap:6px;min-width:0;--_nk-field-min: min(210px, 100%);padding:14px 16px;border:1px solid var(--nk-border);border-radius:10px;background:var(--nk-bg-card);box-shadow:var(--nk-shadow-card);font-size:14px;line-height:1.5;color:inherit;text-decoration:none;text-align:left}:is(a,button).nk-panel{cursor:pointer;font-family:inherit;transition:border-color .15s,background .15s}:is(a,button).nk-panel:hover{border-color:var(--nk-border-strong)}.nk-panel>h3,.nk-panel>.p-head>h3{font-size:14px;font-weight:600;line-height:1.4}.nk-panel ::slotted(h3){font-size:14px;font-weight:600;line-height:1.4;margin:0!important}.nk-panel>p{font-size:13px;color:var(--nk-text-secondary)}.nk-panel ::slotted(p){font-size:13px;color:var(--nk-text-secondary);margin:0!important}.nk-panel>.p-head{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}.nk-panel>.p-head>h3{flex:1 1 auto;min-width:0}.nk-panel .p-end{flex:none;display:flex;align-items:center;gap:6px;margin-left:auto}.nk-panel>.nk-cover{flex:none;height:var(--nk-panel-cover-height);margin:-14px -16px 2px;border-radius:9px 9px 0 0}.nk-panel>.nk-page-icon{font-size:28px}.nk-panel>.nk-cover+.nk-page-icon{margin-top:-24px}.nk-skeleton{border-radius:5px;margin-bottom:var(--nk-block-space, 10px);background:linear-gradient(90deg,var(--nk-bg-callout) 25%,var(--nk-bg-hover) 50%,var(--nk-bg-callout) 75%);background-size:200% 100%;animation:nk-shimmer 1.6s infinite}@keyframes nk-shimmer{to{background-position:-200% 0}}.nk-empty{text-align:center;padding:36px 20px;border:1.5px dashed var(--nk-border-strong);border-radius:10px;color:var(--nk-text-tertiary)}.nk-empty .e-icon,.nk-empty ::slotted(.e-icon),.nk-empty ::slotted([slot="icon"]){font-size:30px;margin-bottom:8px}.nk-empty .e-title,.nk-empty ::slotted(.e-title),.nk-empty ::slotted([slot="title"]){font-weight:500;color:var(--nk-text-secondary);margin-bottom:3px;font-size:14px}.nk-empty .e-desc,.nk-empty ::slotted(.e-desc),.nk-empty ::slotted([slot="desc"]){font-size:13px;margin-bottom:12px}.nk-empty .e-actions,.nk-empty ::slotted(.e-actions){display:flex;flex-wrap:wrap;justify-content:center;gap:8px}.nk-steps{display:flex;flex-direction:column;margin:var(--nk-block-space, 8px) 0;padding:0;list-style:none;font-size:14px}.nk-step{position:relative;display:flex;align-items:flex-start;gap:10px;padding-bottom:14px;line-height:20px;color:var(--nk-text-tertiary)}.nk-step:last-child{padding-bottom:0}.nk-step:not(:last-child):after{content:"";position:absolute;left:10px;top:24px;bottom:4px;width:1px;background:var(--nk-border)}.nk-step .st-mark{flex:none;width:20px;height:20px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--nk-border-strong);background:var(--nk-bg);font-size:11px;font-weight:600;line-height:1}.nk-step .st-desc{display:block;font-size:12px;line-height:18px;color:var(--nk-text-tertiary);font-weight:400}.nk-step.done{color:var(--nk-text-secondary)}.nk-step.done .st-mark{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text);border-color:transparent}.nk-step.current{color:var(--nk-text);font-weight:500}.nk-step.current .st-mark{border-color:var(--nk-accent);color:var(--nk-accent)}.nk-step.skipped .st-mark{border-style:dashed}.nk-step button.st-label,.nk-step a.st-label{font:inherit;color:inherit;text-align:left;text-decoration:none;background:none;border:0;border-radius:3px;cursor:pointer}.nk-step button.st-label:hover,.nk-step a.st-label:hover{text-decoration:underline;text-decoration-color:var(--nk-text-tertiary);text-underline-offset:2px}.nk-step button.st-label:focus-visible,.nk-step a.st-label:focus-visible{outline:2px solid color-mix(in srgb,var(--nk-accent) 60%,transparent);outline-offset:2px}.nk-steps.horizontal{flex-direction:row;align-items:flex-start;gap:10px}.nk-steps.horizontal .nk-step{flex:none;padding-bottom:0;min-width:0;white-space:nowrap}.nk-steps.horizontal .nk-step:not(:last-child){flex:1 1 auto}.nk-steps.horizontal .nk-step:not(:last-child):after{position:static;flex:1 1 16px;width:auto;min-width:16px;height:1px;margin-top:10px}.nk-comments{border-left:1px solid var(--nk-border);padding:4px 0 4px 18px;margin:var(--nk-block-space, 8px) 0 var(--nk-block-space, 8px) 8px}.nk-comment{display:flex;gap:9px;margin-bottom:14px}.nk-comment .mini-avatar,.nk-comment ::slotted(.mini-avatar),.nk-comment ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;color:var(--nk-on-accent);flex-shrink:0;font-size:10px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-comment .c-head,.nk-comment ::slotted(.c-head){font-size:12px;color:var(--nk-text-tertiary);margin-bottom:2px}.nk-comment .c-head b{color:var(--nk-text);font-weight:600}.nk-comment .c-body,.nk-comment ::slotted(.c-body){font-size:14px;line-height:1.5}.nk-comment-input{display:flex;gap:8px;align-items:center;margin-top:4px}.nk-comment-input input{min-width:0;flex:1}.nk-ai-thread{display:flex;flex-direction:column;gap:14px}.nk-ai-msg{display:flex;gap:9px}.nk-ai-msg .mini-avatar,.nk-ai-msg ::slotted(.mini-avatar),.nk-ai-msg ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;background:var(--nk-bg-callout)}.nk-ai-msg.user .mini-avatar,.nk-ai-msg.user ::slotted(.mini-avatar),.nk-ai-msg.user ::slotted([slot="avatar"]){background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:9.5px;font-weight:600}.nk-ai-msg .a-body,.nk-ai-msg ::slotted(.a-body){font-size:14px;line-height:1.55;padding-top:2px}.nk-ai-msg .a-name,.nk-ai-msg ::slotted(.a-name){font-size:12px;font-weight:600;margin-bottom:2px}.nk-ai-msg .a-name span{color:var(--nk-text-tertiary);font-weight:400}.nk-ai-msg.user.bubble{justify-content:flex-end}.nk-ai-msg.bubble .a-body,.nk-ai-msg.bubble ::slotted(.a-body){max-width:85%;padding:6px 12px;border-radius:16px;background:var(--nk-bg-callout)}.nk-ai-actions{display:flex;gap:4px;margin-top:6px}.nk-ai-actions button{font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px;cursor:pointer}.nk-ai-actions ::slotted(button){font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px!important;cursor:pointer}.nk-ai-actions button:hover,.nk-ai-actions ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-ai-input-row{display:flex;align-items:center;gap:8px;margin-top:var(--nk-block-space, 14px);border:1px solid var(--nk-border-strong);border-radius:10px;padding:8px 12px}.nk-ai-input-row:focus-within{border-color:var(--nk-accent)}.nk-ai-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text);min-width:0}.nk-ai-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-ai-send{border:none;background:var(--nk-accent);color:var(--nk-on-accent);border-radius:6px;width:26px;height:26px;cursor:pointer;font-size:13px;flex-shrink:0}.nk-block-host{position:relative;border-radius:var(--nk-radius);margin:var(--nk-block-space, 8px) 0;padding:2px 0 2px 2px;transition:background .15s,box-shadow .15s}.nk-block-host:hover{background:var(--nk-bg-hover)}.nk-block-host:focus-within{background:transparent;box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host.nk-drop-target{box-shadow:0 -2px 0 0 var(--nk-accent);background:transparent}.nk-block-host .nk-block-handle,.nk-block-host ::slotted(.nk-block-handle){position:absolute;left:-26px;top:4px;width:18px;height:20px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:var(--nk-text-tertiary);font-size:13px;cursor:grab;opacity:0;transition:opacity .15s;user-select:none}.nk-block-host:hover .nk-block-handle{opacity:1}.nk-block-host .nk-block-actions{position:absolute;display:flex;gap:1px;z-index:2;opacity:0;transition:opacity .15s;pointer-events:none}.nk-block-host .nk-block-actions.show{opacity:1;pointer-events:auto}.nk-block-host .nk-block-actions button,.nk-block-host .nk-block-actions ::slotted(button){width:20px;height:22px;padding:0;border:none;border-radius:4px;background:transparent;color:var(--nk-text-tertiary);font-family:inherit;font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center}.nk-block-host .nk-block-actions button:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-block-host .nk-block-actions .drag{cursor:grab}.nk-block-host .nk-block-actions .drag:active{cursor:grabbing}.nk-prose,.nk-block-host .ProseMirror{font-family:var(--nk-font);line-height:1.5;color:var(--nk-text);overflow-wrap:break-word}.nk-block-host .ProseMirror{outline:none;min-height:60px;padding:4px 2px}.nk-prose>*+*,.nk-block-host .ProseMirror>*+*{margin-top:6px}.nk-prose h1,.nk-block-host .ProseMirror h1{font-size:1.875em;font-weight:600;line-height:1.3;letter-spacing:-.01em;margin:32px 0 4px}.nk-prose h2,.nk-block-host .ProseMirror h2{font-size:1.5em;font-weight:600;line-height:1.3;margin:24px 0 4px}.nk-prose h3,.nk-block-host .ProseMirror h3{font-size:1.25em;font-weight:600;line-height:1.3;margin:16px 0 2px}.nk-prose :is(h4,h5,h6),.nk-block-host .ProseMirror :is(h4,h5,h6){font-size:1em;font-weight:600;margin:12px 0 0}.nk-prose>:first-child,.nk-block-host .ProseMirror>:first-child{margin-top:0}.nk-prose>:last-child,.nk-block-host .ProseMirror>:last-child{margin-bottom:0}.nk-prose p:empty:before{content:"";display:inline-block}.nk-prose :is(strong,b),.nk-block-host .ProseMirror :is(strong,b){font-weight:600}.nk-prose :is(ul,ol),.nk-block-host .ProseMirror :is(ul,ol){padding-left:24px;margin:4px 0}.nk-prose ul,.nk-block-host .ProseMirror ul{list-style:disc}.nk-prose ol,.nk-block-host .ProseMirror ol{list-style:decimal}.nk-prose li,.nk-block-host .ProseMirror li{margin:2px 0}.nk-prose li::marker,.nk-block-host .ProseMirror li::marker{color:var(--nk-text-tertiary)}.nk-prose ul[data-type=taskList],.nk-block-host .ProseMirror ul[data-type=taskList]{list-style:none;padding-left:2px}.nk-prose ul[data-type=taskList] li,.nk-block-host .ProseMirror ul[data-type=taskList] li{display:flex;gap:8px;align-items:flex-start}.nk-prose ul[data-type=taskList] li>label,.nk-block-host .ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:max(0px,calc((1lh - 16px)/2));user-select:none}.nk-prose ul[data-type=taskList] li>div,.nk-block-host .ProseMirror ul[data-type=taskList] li>div{flex:1;min-width:0}.nk-prose ul[data-type=taskList] input[type=checkbox],.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]{appearance:none;width:16px;height:16px;margin:0;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;position:relative;background:var(--nk-bg);display:block}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked:after,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-prose li[data-checked=true]>div,.nk-block-host .ProseMirror li[data-checked=true]>div{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-prose blockquote,.nk-block-host .ProseMirror blockquote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:12px 0;color:var(--nk-text-secondary)}.nk-prose code,.nk-block-host .ProseMirror code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-prose pre,.nk-block-host .ProseMirror pre{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:16px 20px;margin:12px 0;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;color:var(--nk-text-secondary);overflow-x:auto}.nk-prose pre code,.nk-block-host .ProseMirror pre code{background:none;color:inherit;padding:0;font-size:inherit}.nk-prose hr,.nk-block-host .ProseMirror hr{border:none;border-top:1px solid var(--nk-border);margin:20px 0}.nk-prose a,.nk-block-host .ProseMirror a{color:var(--nk-accent);text-decoration:underline;text-underline-offset:2px}.nk-prose img{max-width:100%;height:auto}.nk-prose table{display:block;width:max-content;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:14px;margin:12px 0}.nk-prose :is(th,td){padding:6px 10px;border:1px solid var(--nk-border);text-align:left;vertical-align:top}.nk-prose th{font-weight:600}.nk-block-host .ProseMirror-gapcursor:after{border-top-color:var(--nk-text)}.nk-block-host .ProseMirror .ProseMirror-selectednode{background:color-mix(in srgb,var(--nk-accent) 8%,transparent)}.nk-block-host .ProseMirror-selectednode{box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 35%,transparent);border-radius:3px}.nk-block-host .ProseMirror ::selection{background:color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host .ProseMirror p.is-editor-empty:first-child:before,.nk-block-host .ProseMirror .is-empty:before{content:attr(data-placeholder);color:var(--nk-text-tertiary);float:left;height:0;pointer-events:none}.nk-block-host .bn-container{font-family:var(--nk-font);color:var(--nk-text);background:transparent}.nk-block-host .bn-editor{padding:4px 2px}.nk-block-host .bn-block-content{font-size:14px;line-height:1.6}.nk-block-host .bn-side-menu{color:var(--nk-text-tertiary)}.nk-block-host .bn-drag-handle{border-radius:4px}.nk-block-host .bn-drag-handle:hover{background:var(--nk-bg-hover)}.nk-block-host .novel-editor{font-family:var(--nk-font);color:var(--nk-text)}.nk-block-host .novel-prose{max-width:none}.nk-slash-menu,.nk-block-host .bn-suggestion-menu,.nk-block-host .tippy-box{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:6px;width:280px;max-height:320px;overflow-y:auto;font-family:var(--nk-font);font-size:14px;color:var(--nk-text)}.nk-slash-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:6px 9px 2px}.nk-slash-item{display:flex;align-items:center;gap:10px;padding:6px 9px;border-radius:5px;cursor:pointer;user-select:none}.nk-slash-item:hover,.nk-slash-item.selected{background:var(--nk-bg-hover)}.nk-slash-item .m-icon,.nk-slash-item ::slotted(.m-icon){width:28px;height:28px;flex-shrink:0;border-radius:4px;background:var(--nk-bg-callout);border:1px solid var(--nk-border);display:flex;align-items:center;justify-content:center;font-size:15px}.nk-slash-item .m-desc{font-size:12px;color:var(--nk-text-tertiary)}.nk-bubble-menu{display:flex;align-items:center;gap:2px;background:var(--nk-bg);border-radius:8px;box-shadow:var(--nk-shadow-menu);padding:4px}.nk-bubble-menu button{font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px;border-radius:5px;cursor:pointer}.nk-bubble-menu ::slotted(button){font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px!important;border-radius:5px;cursor:pointer}.nk-bubble-menu button:hover,.nk-bubble-menu ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-bubble-menu button.active,.nk-bubble-menu ::slotted(button.active){color:var(--nk-accent)}@media(max-width:860px){.nk-sidebar{display:none;position:fixed;inset:0 auto 0 0;z-index:60;transform:translate(-100%);transition:background .25s ease,transform .24s cubic-bezier(.2,.8,.25,1),display .24s allow-discrete}.nk-sidebar.open{display:flex;transform:none}@starting-style{.nk-sidebar.open{transform:translate(-100%)}}.nk-sidebar-backdrop{opacity:0;transition:opacity .24s ease,display .24s allow-discrete}.nk-sidebar-backdrop.open{display:block;opacity:1}@starting-style{.nk-sidebar-backdrop.open{opacity:0}}.nk-sidebar-toggle{display:inline-flex}.nk-sidebar.collapsed{margin-left:0;visibility:visible;transition:background .25s ease,transform .24s cubic-bezier(.2,.8,.25,1),display .24s allow-discrete}.nk-sidebar-collapse{display:none}.nk-tab-bar{display:flex}.nk-tab-bar.fixed+.nk-tab-bar-spacer{display:block}.nk-page{padding-left:max(24px,env(safe-area-inset-left,0px));padding-right:max(24px,env(safe-area-inset-right,0px));padding-bottom:80px}.nk-settings-nav{width:60px;min-width:60px}.nk-settings-nav .label,.nk-settings-nav .nk-section-label,.nk-settings-user .u-text{display:none}.nk-settings-content{padding:24px}.nk-cmdk-backdrop{padding-top:max(6vh,env(safe-area-inset-top,0px))}.nk-cmdk{width:min(560px,96vw)}.nk-stats{flex-wrap:wrap}.nk-breadcrumb{min-width:0}.nk-breadcrumb>.crumb:not(:last-child),.nk-breadcrumb ::slotted(.crumb:not(:last-child)),.nk-breadcrumb>.sep,.nk-breadcrumb ::slotted(.sep),.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){display:none}.nk-breadcrumb>.crumb:last-child,.nk-breadcrumb ::slotted(.crumb:last-child){display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-topbar-actions{flex-shrink:0}.nk-field{flex-wrap:wrap;row-gap:6px}.nk-field .f-control,.nk-field ::slotted(.f-control){max-width:100%;min-width:0}.nk-input,.nk-select,.nk-textarea,.nk-slider{max-width:100%}.nk-prop{flex-direction:column;flex-wrap:nowrap;align-items:stretch}.nk-prop .p-name{flex:none;min-height:26px}.nk-prop .p-value{flex:none;min-height:30px;padding:3px 6px 7px}.nk-copy-field .cf-btn:has(>svg){display:inline-flex;align-items:center;justify-content:center;width:28px;padding:0}.nk-copy-field .cf-btn>svg{display:block}.nk-copy-field .cf-btn:has(>svg)>span{display:none}.nk-steps.horizontal .nk-step:not(.current)>:not(.st-mark){display:none}.nk-pop.sheet{position:fixed!important;inset:auto 0 0!important;width:auto!important;transform:none!important;z-index:106;--_nk-row: 40px;max-height:85dvh;overflow-y:auto;overscroll-behavior:contain;border-radius:14px 14px 0 0;padding:6px max(8px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));box-shadow:0 0 0 100vmax var(--nk-scrim-soft),var(--nk-shadow-menu)}.nk-pop.sheet:before{content:"";display:block;width:36px;height:4px;margin:4px auto 8px;border-radius:2px;background:var(--nk-border-strong)}.nk-pop.sheet.floating{translate:0 100%;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s linear .25s}.nk-pop.sheet.floating.open{translate:none;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s}.nk-pop.sheet,.nk-sheet{--_nk-cell: 44px}.nk-calendar-view .cv-day{min-height:64px;padding:2px 2px 4px}.nk-calendar-view .cv-item{padding:1px 4px;font-size:11px;line-height:16px}.nk-peek-backdrop{pointer-events:auto}.nk-peek-backdrop.open{background-color:var(--nk-scrim-soft)}@starting-style{.nk-peek-backdrop.open{background-color:transparent}}.nk-peek{--_nk-title: 28px;top:auto;left:0;width:auto;max-height:92dvh;border-radius:14px 14px 0 0;translate:0 100%}.nk-peek-backdrop.open .nk-peek{translate:none}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:0 100%}}.nk-peek:before{content:"";flex:none;width:36px;height:4px;margin:10px auto 0;border-radius:2px;background:var(--nk-border-strong)}.nk-peek .pk-bar{height:40px;padding:0 max(8px,env(safe-area-inset-right,0px)) 0 max(8px,env(safe-area-inset-left,0px))}.nk-peek .pk-body{padding:0 max(20px,env(safe-area-inset-right,0px)) max(24px,env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px))}.nk-peek .pk-resize{display:none}.nk-banner{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:baseline}.nk-banner .b-action,.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){grid-column:1 / -1;justify-self:start;margin-left:0}.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:0!important}.nk-app.peek-inset .nk-main{padding-right:0}.nk-dialog-backdrop{flex-direction:column;justify-content:flex-end;padding:max(24px,env(safe-area-inset-top,0px)) 0 0}.nk-dialog{width:100%;max-width:640px;border-radius:14px 14px 0 0;scale:none;translate:0 100%;padding:6px max(20px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px));transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-dialog.wide{width:100%}.nk-dialog-backdrop.open .nk-dialog{translate:none}@starting-style{.nk-dialog-backdrop.open .nk-dialog{translate:0 100%}}.nk-dialog:before{content:"";display:block;width:36px;height:4px;margin:4px auto 14px;border-radius:2px;background:var(--nk-border-strong)}.nk-dialog .dl-actions{flex-direction:column-reverse}:root:has(.nk-tab-bar:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + max(6px,env(safe-area-inset-bottom,0px)) + 6px)}:root:has(.nk-tab-bar.floating:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + 24px + env(safe-area-inset-bottom,0px))}}@media(prefers-reduced-motion:reduce){.nk-skeleton{animation:none;background:var(--nk-bg-callout)}[class*=nk-],[class*=nk-]:before,[class*=nk-]:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}\n',n=e+i,s=e+t+i;(new CSSStyleSheet).replaceSync(s);(new CSSStyleSheet).replaceSync(t);const r=new CSSStyleSheet;r.replaceSync(n);const o={en:{copy:"Copy",copied:"Copied",show:"Show",hide:"Hide",uploadImage:"Upload image",changeImage:"Change image",remove:"Remove",close:"Close",resize:"Resize",today:"Today",previousMonth:"Previous month",nextMonth:"Next month",clear:"Clear",time:"Time",filter:"Filter",sort:"Sort",addFilter:"๏ผ‹ Filter",removeFilter:"Remove filter",search:"Search โ€ฆ",closeSidebar:"Close sidebar",newPage:"๏ผ‹ New page",commentPlaceholder:"Comment โ€ฆ",send:"Send",askPlaceholder:"Ask something โ€ฆ",commandPlaceholder:"Search or type a command โ€ฆ",emojiPlaceholder:"Searchโ€ฆ",toggleTheme:"Toggle light / dark",synced:"โŸณ synced",message:"Message",breadcrumb:"Breadcrumb",commandPalette:"Command palette",comment:"Comment",searchEmoji:"Search emoji",settings:"Settings",title:"Title",changeIcon:"Change icon",add:"Add",more:"More"},de:{copy:"Kopieren",copied:"Kopiert",show:"Zeigen",hide:"Verbergen",uploadImage:"Bild hochladen",changeImage:"Bild รคndern",remove:"Entfernen",close:"SchlieรŸen",resize:"Breite รคndern",today:"Heute",previousMonth:"Voriger Monat",nextMonth:"Nรคchster Monat",clear:"Leeren",time:"Uhrzeit",filter:"Filter",sort:"Sortieren",addFilter:"๏ผ‹ Filter",removeFilter:"Filter entfernen",search:"Suchen โ€ฆ",closeSidebar:"Seitenleiste schlieรŸen",newPage:"๏ผ‹ Neue Seite",commentPlaceholder:"Kommentieren โ€ฆ",send:"Senden",askPlaceholder:"Frag etwas โ€ฆ",commandPlaceholder:"Suchen oder Befehl eingeben โ€ฆ",emojiPlaceholder:"Suchen โ€ฆ",toggleTheme:"Hell / Dunkel",synced:"โŸณ synchronisiert",message:"Nachricht",breadcrumb:"Pfad",commandPalette:"Befehlspalette",comment:"Kommentar",searchEmoji:"Emoji suchen",settings:"Einstellungen",title:"Titel",changeIcon:"Symbol รคndern",add:"Hinzufรผgen",more:"Mehr"}},a={},l=new Set;function h(t,e="*"){const i=String(e).toLowerCase().split("-")[0];a[i]={...a[i],...t};for(const t of l)t()}function c(t="en"){return{...o[String(t).toLowerCase().split("-")[0]]||o.en}}function d(t,e){const i=function(t){for(let e=t;e;e=e.getRootNode?.().host){const t=e.closest?.("[lang]");if(t)return t.getAttribute("lang").toLowerCase().split("-")[0]}return(document.documentElement.lang||"en").toLowerCase().split("-")[0]}(e);return a[i]?.[t]??a["*"]?.[t]??o[i]?.[t]??o.en[t]??t}const p="__nkDefaultTokensInjected";!function(){if("undefined"==typeof document)return;if(globalThis[p])return;globalThis[p]=!0;const e=new CSSStyleSheet;e.replaceSync(`@layer notionkit-defaults { ${t} }`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]}();const u=new Set;function g(){return document.documentElement.getAttribute("data-theme")||"light"}function b(){for(const t of u)t.onStringsChanged()}var m;m=b,l.add(m),"undefined"!=typeof window&&"undefined"!=typeof MutationObserver&&new MutationObserver(t=>{t.some(t=>"data-theme"===t.attributeName)&&function(){const t=g();for(const e of u)e._syncTheme(t)}(),t.some(t=>"lang"===t.attributeName)&&b()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","lang"]});const k=new Map;function _(t){let e=k.get(t);return e||(e=new CSSStyleSheet,e.replaceSync(`\n :host { display: ${t}; }\n :host([hidden]) { display: none; }\n :host([flush]) .nk-wrapper > * { margin-top: 0; margin-bottom: 0; }\n .nk-wrapper { display: contents; }\n `),k.set(t,e)),e}class v extends HTMLElement{static get display(){return"contents"}static get hostStyles(){return null}static get observesLightDom(){return!1}static get lightDomObserverInit(){return{childList:!0,subtree:!0,characterData:!0,attributes:!0}}static get slotAssignment(){return"named"}static get observedAttributes(){return[]}constructor(){super(),this._initialized=!1,this._shadow=this.attachShadow({mode:"open",slotAssignment:this.constructor.slotAssignment});const t=[r,_(this.constructor.display)],e=this.constructor.hostStyles;e&&t.push(e),this._shadow.adoptedStyleSheets=t}connectedCallback(){this._initialized?this._wrapper.setAttribute("data-theme",g()):(this._upgradeOwnProperties(),this._initialized=!0,this._wrapper=document.createElement("div"),this._wrapper.className="nk-wrapper",this._wrapper.setAttribute("data-theme",g()),this._shadow.appendChild(this._wrapper),this.render()),this.setupEvents(),u.add(this),this.constructor.observesLightDom&&(this._lightDomObserver??=new MutationObserver(t=>this.projectLightDom(t)),this._lightDomObserver.observe(this,this.constructor.lightDomObserverInit)),"manual"===this.constructor.slotAssignment&&(this.assignSlots(),this._slotObserver??=new MutationObserver(()=>this.assignSlots()),this._slotObserver.observe(this,{childList:!0}))}disconnectedCallback(){u.delete(this),this._lightDomObserver?.disconnect(),this._slotObserver?.disconnect(),this.teardownEvents()}attributeChangedCallback(t,e,i){this._initialized&&e!==i&&this.onAttributeChanged(t,e,i)}_syncTheme(t){this._wrapper?.setAttribute("data-theme",t)}str(t){return d(t,this)}onStringsChanged(){}_upgradeOwnProperties(){for(const t of Object.keys(this)){if(t.startsWith("_"))continue;let e,i=Object.getPrototypeOf(this);for(;i&&i!==HTMLElement.prototype&&!(e=Object.getOwnPropertyDescriptor(i,t));)i=Object.getPrototypeOf(i);if(!e?.set)continue;const n=this[t];delete this[t],this[t]=n}}render(){}setupEvents(){}teardownEvents(){}onAttributeChanged(t,e,i){}projectLightDom(){}assignSlots(){}refresh(){this.projectLightDom(),"manual"===this.constructor.slotAssignment&&this.assignSlots()}takeTitle(t=this.getAttribute("title")){return null!==t&&(this._titleText=t,this.removeAttribute("title"),!0)}getBoolAttr(t){return this.hasAttribute(t)}setBoolAttr(t,e){e?this.setAttribute(t,""):this.removeAttribute(t)}createElement(t,e=[],i={}){const n=document.createElement(t);e.length&&n.classList.add(...e);for(const[t,e]of Object.entries(i))null!=e&&!1!==e&&n.setAttribute(t,!0===e?"":e);return n}emit(t,e=null){return this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,cancelable:!0,detail:e}))}}class x extends v{static formAssociated=!0;constructor(){super(),this._internals=this.attachInternals()}get form(){return this._internals.form}get validationMessage(){return this._internals.validationMessage}get validity(){return this._internals.validity}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}connectedCallback(){const t=!this._initialized;super.connectedCallback(),t&&this._formDisabled&&this.onFormDisabled(!0)}formResetCallback(){this.resetValue()}formStateRestoreCallback(t,e){this.restoreValue(t,e)}formDisabledCallback(t){this._formDisabled=t,this._initialized&&this.onFormDisabled(t)}resetValue(){}restoreValue(t,e){}onFormDisabled(t){}setFormValue(t,e){this._internals.setFormValue(t,e)}setValidity(t,e,i){this._internals.setValidity(t,e,i)}syncValidityFrom(t){t&&(t.validity.valid?this._internals.setValidity({}):this._internals.setValidity(t.validity,t.validationMessage,t))}}const f=["primary","secondary","danger","danger-solid","topbar","share"];class y extends v{static get observedAttributes(){return["variant","small","disabled","type","href","title","aria-label","aria-haspopup","active"]}render(){this._build()}_build(){const t=this.getAttribute("href"),e=t?this.createElement("a",[],{href:t}):this.createElement("button",[],{type:this.getAttribute("type")||"button"});e.className=this._computeClasses().join(" "),e.appendChild(document.createElement("slot")),this._applyState(e),this._btn?(this._btn.removeEventListener("click",this._onClick),this._btn.replaceWith(e)):this._wrapper.appendChild(e),this._btn=e,this._onClick&&e.addEventListener("click",this._onClick)}_applyState(t){const e=this.getBoolAttr("disabled");"BUTTON"===t.tagName?t.disabled=e:t.setAttribute("aria-disabled",e?"true":"false");const i=this.getAttribute("title");i?t.setAttribute("title",i):t.removeAttribute("title");for(const e of["aria-label","aria-haspopup"]){const i=this.getAttribute(e);i?t.setAttribute(e,i):t.removeAttribute(e)}"sidebar"===this.getAttribute("variant")?t.setAttribute("aria-expanded",this._sidebar()?.open?"true":"false"):t.removeAttribute("aria-expanded")}_sidebar(){return this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar")}_sidebarCollapsed(){return"sidebar"===this.getAttribute("variant")&&!!this._sidebar()?.hasAttribute("collapsed")}setupEvents(){this._onClick=t=>{if(this.getBoolAttr("disabled"))return t.preventDefault(),void t.stopPropagation();if("sidebar"===this.getAttribute("variant")){const t=this._sidebar();return void(t?.hasAttribute("collapsed")&&!matchMedia("(max-width: 860px)").matches?t.expand?.():t?.toggle?.())}const e=this.getAttribute("type");if("submit"===e||"reset"===e){const t=this.closest("form");t&&("submit"===e?t.requestSubmit():t.reset())}},this._onToggle=t=>{"sidebar"===this.getAttribute("variant")&&t.target===this._sidebar()&&this._btn.setAttribute("aria-expanded",t.detail.open?"true":"false")},this._onCollapse=t=>{"sidebar"===this.getAttribute("variant")&&t.target===this._sidebar()&&this._btn.classList.toggle("collapsed",t.detail.collapsed)},this._btn.addEventListener("click",this._onClick),document.addEventListener("nk-toggle",this._onToggle),document.addEventListener("nk-collapse",this._onCollapse),"sidebar"===this.getAttribute("variant")&&(this._btn.className=this._computeClasses().join(" "))}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),document.removeEventListener("nk-toggle",this._onToggle),document.removeEventListener("nk-collapse",this._onCollapse)}onAttributeChanged(t){if(this._btn)switch(t){case"href":this._build();break;case"variant":this._btn.className=this._computeClasses().join(" "),this._applyState(this._btn);break;case"small":case"active":this._btn.className=this._computeClasses().join(" ");break;case"type":"BUTTON"===this._btn.tagName&&this._btn.setAttribute("type",this.getAttribute("type")||"button");break;default:this._applyState(this._btn)}}_computeClasses(){const t=this.getAttribute("variant");if("topbar"===t)return["nk-topbar-btn"];if("share"===t)return["nk-topbar-btn","nk-share-btn"];if("sidebar"===t)return this._sidebarCollapsed()?["nk-topbar-btn","nk-sidebar-toggle","collapsed"]:["nk-topbar-btn","nk-sidebar-toggle"];if("tool"===t)return this.getBoolAttr("active")?["nk-db-tool","active"]:["nk-db-tool"];const e=["nk-btn"];return f.includes(t)&&e.push(t),this.getBoolAttr("small")&&e.push("small"),e}focus(t){this._btn?.focus(t)}click(){this._btn?.click()}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get type(){return this.getAttribute("type")||"button"}set type(t){this.setAttribute("type",t)}get href(){return this.getAttribute("href")}set href(t){t?this.setAttribute("href",t):this.removeAttribute("href")}}customElements.define("nk-btn",y);const w=["type","placeholder","name","min","max","step","autocomplete","pattern","maxlength","minlength","inputmode","list","aria-label"],A=["required","disabled","readonly"];class E extends x{static get observedAttributes(){return["value","wide",...w,...A]}render(){this._input=this.createElement("input",["nk-input"]);for(const t of w)this._forward(t);for(const t of A)this._forward(t);this._input.value=this.getAttribute("value")??"",this._defaultValue=this._input.value,this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(A.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??"",this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}select(){this._input?.select()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get type(){return this.getAttribute("type")||"text"}set type(t){this.setAttribute("type",t)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(t){this.setAttribute("placeholder",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get readonly(){return this.getBoolAttr("readonly")}set readonly(t){this.setBoolAttr("readonly",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-input",E);const C=["placeholder","name","rows","maxlength","minlength","autocomplete","aria-label"],B=["required","disabled","readonly"];class L extends x{static get observedAttributes(){return["value","wide",...C,...B]}render(){this._input=this.createElement("textarea",["nk-textarea"]);for(const t of[...C,...B])this._forward(t);this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(B.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-textarea",L);class S extends x{static get observedAttributes(){return["value","name","disabled","required","compact","wide","aria-label"]}static get observesLightDom(){return!0}render(){this._select=this.createElement("select",["nk-select"]),this._forwardAll(),this._wrapper.appendChild(this._select),this._defaultValue=this.getAttribute("value"),this._pending=this._defaultValue,this.projectLightDom(),requestAnimationFrame(()=>this.projectLightDom())}_forwardAll(){const t=this.getAttribute("name");t?this._select.setAttribute("name",t):this._select.removeAttribute("name");const e=this.getAttribute("aria-label");e?this._select.setAttribute("aria-label",e):this._select.removeAttribute("aria-label"),this._select.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._select.required=this.getBoolAttr("required"),this._select.classList.toggle("compact",this.getBoolAttr("compact")),this._select.classList.toggle("wide",this.getBoolAttr("wide"))}projectLightDom(){if(!this._select)return;const t=[...this.children].filter(t=>t.matches("option, optgroup")),e=t.map(t=>t.outerHTML).join("");if(e===this._optionSignature)return;this._optionSignature=e;const i=this._select.selectedIndex>=0?this._select.value:null;this._select.innerHTML="";for(const e of t)this._select.appendChild(e.cloneNode(!0));null!=this._pending?this._applyValue(this._pending)&&(this._pending=null):this._applyValue(i),this._syncFormValue()}_applyValue(t){return null!==t&&(!![...this._select.options].some(e=>e.value===t)&&(this._select.value=t,!0))}setupEvents(){this._onChange=()=>{this._pending=null,this._syncFormValue(),this.emit("nk-change",{value:this._select.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._select.addEventListener("change",this._onChange)}teardownEvents(){this._select?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._select){if("value"===t){const t=this.getAttribute("value");return this._pending=null===t||this._applyValue(t)?null:t,void this._syncFormValue()}this._forwardAll(),this._syncFormValue()}}_syncFormValue(){this.setFormValue(this._select.value),this.syncValidityFrom(this._select)}resetValue(){this._pending=null,this._applyValue(this._defaultValue)||(this._select.selectedIndex=0),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._applyValue(t),this._syncFormValue())}onFormDisabled(t){this._select.disabled=t||this.getBoolAttr("disabled")}focus(t){this._select?.focus(t)}get value(){return this._pending??this._select?.value??""}set value(t){const e=null==t?"":String(t);this._select?(this._pending=this._applyValue(e)?null:e,this._syncFormValue()):this.setAttribute("value",e)}get selectedIndex(){return this._select?.selectedIndex??-1}get options(){return this._select?.options??[]}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-select",S);class z extends x{static get observedAttributes(){return["checked","disabled","name","value","label","text"]}render(){this._row=this.createElement("label",["nk-switch-label"]),this._btn=this.createElement("button",["nk-switch"],{type:"button",role:"switch"}),this._text=document.createElement("span"),this._slot=document.createElement("slot"),this._textNode=document.createTextNode(""),this._slot.appendChild(this._textNode),this._text.appendChild(this._slot),this._row.append(this._btn,this._text),this._defaultChecked=this.getBoolAttr("checked"),this._apply(),this._syncText(),this._wrapper.appendChild(this._row),this._syncFormValue()}_apply(){this._btn.setAttribute("aria-checked",this.getBoolAttr("checked")?"true":"false"),this._btn.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("label");t?this._btn.setAttribute("aria-label",t):this._btn.removeAttribute("aria-label")}_syncText(){const t=this.getAttribute("text")??"";this._textNode.data!==t&&(this._textNode.data=t);const e=!(!this.getAttribute("text")&&!this._slot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim()));this._text.hidden=!e,this._row.style.display=e?"":"contents"}setupEvents(){this._onClick=()=>this.toggle(),this._onSlot=()=>this._syncText(),this._btn.addEventListener("click",this._onClick),this._slot.addEventListener("slotchange",this._onSlot),this._syncText()}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),this._slot?.removeEventListener("slotchange",this._onSlot)}toggle(){this.getBoolAttr("disabled")||this._formDisabled||(this.checked=!this.checked,this.emit("nk-change",{checked:this.checked,value:this.getAttribute("value")||"on",name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){this._btn&&("text"!==t?(this._apply(),this._syncFormValue()):this._syncText())}_syncFormValue(){const t=this.getAttribute("value")||"on";this.setFormValue(this.getBoolAttr("checked")?t:null,this.getBoolAttr("checked")?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._btn?.focus(t)}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}}customElements.define("nk-switch",z);class T extends x{static get observedAttributes(){return["checked","disabled","name","value","text","indeterminate","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"checkbox"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.indeterminate=this.getBoolAttr("indeterminate"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this.removeAttribute("indeterminate"),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get indeterminate(){return this.getBoolAttr("indeterminate")}set indeterminate(t){this.setBoolAttr("indeterminate",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-check",T);const D={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function M(t){return(void 0!==t.form?t.form:t.closest("form"))??null}function N(t){const e=t.filter(t=>!t.disabled);if(!e.length)return;const i=e.find(t=>t.checked)||e[0];for(const e of t)e._input&&(e._input.tabIndex=e===i?0:-1)}class F extends x{static get observedAttributes(){return["checked","disabled","name","value","text","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"radio"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue(),this._input.checked&&this._uncheckPeers(),N(this._group())}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>this._applyChange(),this._onKeyDown=t=>{const e=D[t.key];if(!e||t.ctrlKey||t.metaKey||t.altKey)return;const i=this._group().filter(t=>!t.disabled);if(i.length<2)return;t.preventDefault();const n=i[(i.indexOf(this)+e+i.length)%i.length];n._input.focus(),n._input.checked=!0,n._applyChange()},this._input.addEventListener("change",this._onChange),this._input.addEventListener("keydown",this._onKeyDown),N(this._group())}teardownEvents(){this._input?.removeEventListener("change",this._onChange),this._input?.removeEventListener("keydown",this._onKeyDown)}_applyChange(){this._input.checked&&this._uncheckPeers(),this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),N(this._group()),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))}_group(){const t=this.getAttribute("name"),e=this.getRootNode();if(!t||"function"!=typeof e?.querySelectorAll)return[this];const i=M(this);return[...e.querySelectorAll("nk-radio")].filter(e=>e.getAttribute("name")===t&&M(e)===i)}_uncheckPeers(){for(const t of this._group())t!==this&&t.checked&&(t.checked=!1)}onAttributeChanged(t){!this._syncing&&this._input&&(this._apply(),"checked"===t&&this._input.checked&&this._uncheckPeers(),this._syncFormValue(),N(this._group()))}_syncFormValue(){const t=this.getAttribute("value")||"";this.setFormValue(this._input.checked?t:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this._input.checked=this._defaultChecked,this.setBoolAttr("checked",this._defaultChecked),this._syncFormValue(),N(this._group())}restoreValue(t){"checked"===t&&(this.checked=!0)}onFormDisabled(t){this._formDisabled=t,this._apply(),N(this._group())}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this._input&&(this._input.checked=t),t&&this._uncheckPeers(),this.setBoolAttr("checked",t),this._input&&(this._syncFormValue(),N(this._group()))}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}customElements.define("nk-radio",F);const I=["name","min","max","step","aria-label"];class j extends x{static get observedAttributes(){return["value","disabled","show-value","unit",...I]}render(){this._input=this.createElement("input",["nk-slider"],{type:"range"}),this._out=this.createElement("div",["nk-slider-value"]),this._apply(),this._input.value=this.getAttribute("value")??this._input.value,this._defaultValue=this._input.value,this._wrapper.appendChild(this._input),this._wrapper.appendChild(this._out),this._syncOut(),this._syncFormValue()}_apply(){for(const t of I){const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._out.style.display=this.getBoolAttr("show-value")?"":"none"}_syncOut(){this._out.textContent=`${this._input.value}${this.getAttribute("unit")||""}`}setupEvents(){this._onInput=()=>{this._syncOut(),this._syncFormValue(),this.emit("nk-input",{value:Number(this._input.value),name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:Number(this._input.value),name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){this._input&&("value"===t?this._input.value=this.getAttribute("value")??"":this._apply(),this._syncOut(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.value)}resetValue(){this._input.value=this._defaultValue,this._syncOut(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncOut(),this._syncFormValue())}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get value(){return Number(this._input?.value??this.getAttribute("value"))}set value(t){this._input?(this._input.value=t,this._syncOut(),this._syncFormValue()):this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get showValue(){return this.getBoolAttr("show-value")}set showValue(t){this.setBoolAttr("show-value",t)}}customElements.define("nk-slider",j);const V=["nk-input","nk-textarea","nk-select"];class q extends v{static get observedAttributes(){return["label","desc","stacked","compact"]}render(){this._field=this.createElement("div",["nk-field"]);const t=document.createElement("div");this._label=this.createElement("div",["f-label"]);const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),this._desc=this.createElement("div",["f-desc"]);const i=this.createElement("slot",[],{name:"desc"});i.appendChild(this._desc),t.appendChild(e),t.appendChild(i);const n=this.createElement("div",["f-control"]);this._slot=document.createElement("slot"),n.appendChild(this._slot),this._field.appendChild(t),this._field.appendChild(n),this._wrapper.appendChild(this._field),this._widened=new Set,this._sync()}setupEvents(){this._onSlot=()=>this._syncWide(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(){this._sync()}get stacked(){return this.getBoolAttr("stacked")||!!this.closest("nk-fields")}set stacked(t){this.setBoolAttr("stacked",t)}get compact(){return this.getBoolAttr("compact")||!!this.closest("nk-fields")}set compact(t){this.setBoolAttr("compact",t)}_sync(){if(!this._label)return;this._label.textContent=this.getAttribute("label")||"";const t=this.getAttribute("desc");this._desc.textContent=t||"",this._desc.style.display=t?"":"none",this._field.classList.toggle("stacked",this.stacked),this._field.classList.toggle("compact",this.compact),this._syncWide()}_syncWide(){if(!this._slot)return;const t=this.stacked;for(const e of this._slot.assignedElements())V.includes(e.localName)&&(t&&!e.hasAttribute("wide")?(e.setAttribute("wide",""),this._widened.add(e)):!t&&this._widened.has(e)&&(e.removeAttribute("wide"),this._widened.delete(e)))}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}get desc(){return this.getAttribute("desc")}set desc(t){null==t?this.removeAttribute("desc"):this.setAttribute("desc",t)}}customElements.define("nk-field",q);class O extends v{static get observedAttributes(){return["fit"]}render(){this._grid=this.createElement("div",["nk-fields"]),this._grid.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._grid),this.onAttributeChanged()}onAttributeChanged(){this._grid?.classList.toggle("fit",this.getBoolAttr("fit"))}get fit(){return this.getBoolAttr("fit")}set fit(t){this.setBoolAttr("fit",t)}}customElements.define("nk-fields",O);const P=["gray","brown","orange","yellow","green","blue","purple","pink","red"];class K extends v{static get observedAttributes(){return["color"]}render(){this._tag=this.createElement("span",this._computeClasses()),this._tag.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tag)}onAttributeChanged(){this._tag&&(this._tag.className=this._computeClasses().join(" "))}_computeClasses(){const t=["nk-tag"],e=this.getAttribute("color");return P.includes(e)&&t.push(e),t}get color(){return this.getAttribute("color")}set color(t){t?this.setAttribute("color",t):this.removeAttribute("color")}}customElements.define("nk-tag",K);class R extends v{static get observedAttributes(){return["value","max","label","wide"]}render(){this._bar=this.createElement("span",["nk-progress"],{role:"progressbar"}),this._fill=document.createElement("i"),this._bar.appendChild(this._fill),this._label=this.createElement("span",["nk-progress-label"]),this._row=this.createElement("span",["nk-progress-row"]),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._bar)return;const t=Number(this.getAttribute("max"))||100,e=Math.min(t,Math.max(0,Number(this.getAttribute("value"))||0));this._fill.style.width=e/t*100+"%",this._bar.classList.toggle("wide",this.getBoolAttr("wide")),this._bar.setAttribute("aria-valuenow",e),this._bar.setAttribute("aria-valuemin",0),this._bar.setAttribute("aria-valuemax",t);const i=this.getAttribute("label");this._label.textContent=i??"",null===i?this._bar.parentNode!==this._wrapper&&this._wrapper.replaceChildren(this._bar):this._bar.parentNode!==this._row&&(this._row.replaceChildren(this._bar,this._label),this._wrapper.replaceChildren(this._row))}get value(){return Number(this.getAttribute("value"))||0}set value(t){this.setAttribute("value",t)}get max(){return Number(this.getAttribute("max"))||100}set max(t){this.setAttribute("max",t)}get label(){return this.getAttribute("label")}set label(t){null==t?this.removeAttribute("label"):this.setAttribute("label",t)}}customElements.define("nk-progress",R);class $ extends v{static get observedAttributes(){return["icon"]}render(){this._box=this.createElement("div",["nk-callout"]),this._icon=this.createElement("span",["c-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon);const e=document.createElement("div");e.appendChild(document.createElement("slot")),this._box.appendChild(t),this._box.appendChild(e),this._wrapper.appendChild(this._box),this._syncIcon()}onAttributeChanged(){this._syncIcon()}_syncIcon(){this._icon&&(this._icon.textContent=this.getAttribute("icon")||"๐Ÿ’ก")}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}}customElements.define("nk-callout",$);class H extends v{render(){this._wrapper.appendChild(this.createElement("hr",["nk-divider"]))}}customElements.define("nk-divider",H);class W extends v{static get observedAttributes(){return["level"]}render(){this._build()}_build(){const t=Math.min(4,Math.max(1,Number(this.getAttribute("level"))||2)),e=this.createElement(`h${t}`,["nk-heading"]);e.appendChild(document.createElement("slot")),this._heading?this._heading.replaceWith(e):this._wrapper.appendChild(e),this._heading=e}onAttributeChanged(){this._build()}get level(){return Number(this.getAttribute("level"))||2}set level(t){this.setAttribute("level",t)}}customElements.define("nk-heading",W);class U extends v{static get observedAttributes(){return["label","open"]}render(){this._details=this.createElement("details",["nk-toggle"]);const t=document.createElement("summary");this._label=document.createElement("span");const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),t.appendChild(e);const i=this.createElement("div",["toggle-body"]);i.appendChild(document.createElement("slot")),this._details.appendChild(t),this._details.appendChild(i),this._details.open=this.getBoolAttr("open"),this._wrapper.appendChild(this._details),this._sync()}setupEvents(){this._onToggle=()=>{this._syncing=!0,this.setBoolAttr("open",this._details.open),this._syncing=!1,this.emit("nk-toggle",{open:this._details.open})},this._details.addEventListener("toggle",this._onToggle)}teardownEvents(){this._details?.removeEventListener("toggle",this._onToggle)}onAttributeChanged(t){this._details&&("open"!==t?this._sync():this._syncing||(this._details.open=this.getBoolAttr("open")))}_sync(){this._label.textContent=this.getAttribute("label")||""}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}}customElements.define("nk-toggle",U);class G extends x{static get observedAttributes(){return["checked","disabled","name","value"]}render(){const t=this.createElement("label",["nk-todo"]);this._input=this.createElement("input",[],{type:"checkbox"}),this._apply(),this._defaultChecked=this.getBoolAttr("checked");const e=document.createElement("span");e.appendChild(document.createElement("slot")),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on"}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-todo",G);class Y extends v{render(){const t=this.createElement("kbd",["nk-kbd"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-kbd",Y);class Q extends v{static get observedAttributes(){return["lang","highlight"]}static get observesLightDom(){return!0}render(){this._box=this.createElement("div",["nk-code"]),this._lang=this.createElement("span",["lang"]),this._slot=document.createElement("slot"),this._pre=this.createElement("span",["hl"]),this._box.appendChild(this._lang),this._box.appendChild(this._slot),this._box.appendChild(this._pre),this._wrapper.appendChild(this._box),this._sync(),this.projectLightDom()}onAttributeChanged(){this._sync(),this.projectLightDom()}_sync(){if(!this._lang)return;const t=this.getAttribute("lang");this._lang.textContent=t||"",this._lang.style.display=t?"":"none"}projectLightDom(){if(!this._pre)return;const t=this.hasAttribute("highlight");if(this._slot.style.display=t?"none":"",this._pre.style.display=t?"":"none",!t)return;const e=this.textContent.replace(/^\n/,"");var i;e!==this._lastText&&(this._lastText=e,this._pre.innerHTML=(i=e,i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")).replace(/&lt;(\/?)([a-zA-Z][\w-]*)([^&]*?)(\/?)&gt;/g,(t,e,i,n,s)=>`&lt;${e}<span class="tag">${i}</span>${n.replace(/([\w-]+)(=)("[^"]*"|'[^']*')?/g,(t,e,i,n)=>`<span class="attr">${e}</span>${i}${n??""}`)}${s}&gt;`))}get lang(){return this.getAttribute("lang")}set lang(t){null==t?this.removeAttribute("lang"):this.setAttribute("lang",t)}}customElements.define("nk-code",Q);class Z extends v{static get observedAttributes(){return["cite"]}render(){this._quote=this.createElement("blockquote",["nk-quote"]),this._quote.appendChild(document.createElement("slot")),this._cite=this.createElement("cite",["q-cite"]),this._quote.appendChild(this._cite),this._wrapper.appendChild(this._quote),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._cite)return;const t=this.getAttribute("cite");this._cite.textContent=t||"",this._cite.style.display=t?"":"none"}get cite(){return this.getAttribute("cite")}set cite(t){null==t?this.removeAttribute("cite"):this.setAttribute("cite",t)}}customElements.define("nk-quote",Z);class X extends v{static get observedAttributes(){return["peek-inset"]}render(){const t=this._app=this.createElement("div",["nk-app"]);t.classList.toggle("peek-inset",this.getBoolAttr("peek-inset")),t.appendChild(this.createElement("slot",[],{name:"sidebar"}));const e=this.createElement("main",["nk-main"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t)}onAttributeChanged(){this._app.classList.toggle("peek-inset",this.getBoolAttr("peek-inset"))}}customElements.define("nk-app",X);let J=0,tt="";function et(){0===J++&&(tt=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function it(){J>0&&0===--J&&(document.documentElement.style.overflow=tt)}function nt(t){const e=[];let i=t;for(;i&&i!==document.body;){const t=(i.parentNode,ShadowRoot,i.parentNode);if(!t)break;for(const n of t.children)n===i||n.inert||/^(SCRIPT|STYLE|LINK|TEMPLATE)$/.test(n.tagName)||n.matches("nk-menu[floating], nk-calendar[floating], nk-tooltip, nk-toast")||(n.inert=!0,e.push(n));i=t instanceof ShadowRoot?t.host:t}return()=>{for(const t of e)t.inert=!1}}function st(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function rt(t,e){for(let i=e;i;i=i.parentNode??i.host)if(i===t)return!0;return!1}function ot(t){const e=t=>{for(const i of t.querySelectorAll("*")){if(i.matches('a[href], button:not([disabled]), input:not([disabled]):not([type=hidden]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable="true"], [contenteditable="plaintext-only"]')&&i.getClientRects().length)return i;if(i.shadowRoot){const t=e(i.shadowRoot);if(t)return t}}return null};return e(t)}class at extends v{static get observedAttributes(){return["open","collapsible","collapsed","collapse-label"]}render(){this._backdrop=this.createElement("div",["nk-sidebar-backdrop"]),this._aside=this.createElement("aside",["nk-sidebar"]);const t=this.createElement("div",["nk-sidebar-head"]);this._collapse=this.createElement("button",["nk-sidebar-collapse"],{type:"button","data-tooltip-key":"โŒ˜\\"}),this._collapse.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m18 17-5-5 5-5M11 17l-5-5 5-5"/></svg>',t.append(this.createElement("slot",[],{name:"workspace"}),this._collapse),this._aside.appendChild(t);const e=this.createElement("div",["nk-sidebar-scroll"]);e.appendChild(document.createElement("slot")),this._aside.appendChild(e),this._footer=this.createElement("div",["nk-sidebar-footer"]),this._footerSlot=this.createElement("slot",[],{name:"footer"}),this._footer.appendChild(this._footerSlot),this._aside.appendChild(this._footer),this._wrapper.appendChild(this._backdrop),this._wrapper.appendChild(this._aside),this._syncFooter(),this._syncOpen(),this._syncCollapse()}_syncCollapse(){const t=this.getAttribute("collapse-label")||this.str("closeSidebar");this._collapse.hidden=!this.getBoolAttr("collapsible"),this._collapse.setAttribute("aria-label",t),this._collapse.dataset.tooltip=t,this._aside.classList.toggle("collapsed",this.getBoolAttr("collapsed"))}_toggleButton(){const t='nk-btn[variant="sidebar"]';return this.closest("nk-app")?.querySelector(t)??document.querySelector(t)}_syncOpen(){const t=this.getBoolAttr("open");this._aside.classList.toggle("open",t),this._backdrop.classList.toggle("open",t)}_syncFooter(){const t=this._footerSlot.assignedElements();this._footer.style.display=t.length?"":"none";for(const e of t)"nk-tree-item"===e.localName&&e.setAttribute("compact","")}setupEvents(){this._onSlot=()=>this._syncFooter(),this._onBackdrop=()=>this.close(),this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close(),"\\"===t.key&&(t.metaKey||t.ctrlKey)&&this.getBoolAttr("collapsible")&&!t.defaultPrevented&&(t.preventDefault(),matchMedia("(max-width: 860px)").matches?this.toggle():this.toggleCollapsed())},this._onCollapse=()=>this.collapse(),this._footerSlot.addEventListener("slotchange",this._onSlot),this._backdrop.addEventListener("click",this._onBackdrop),this._collapse.addEventListener("click",this._onCollapse),document.addEventListener("keydown",this._onKey)}teardownEvents(){this._footerSlot?.removeEventListener("slotchange",this._onSlot),this._backdrop?.removeEventListener("click",this._onBackdrop),this._collapse?.removeEventListener("click",this._onCollapse),document.removeEventListener("keydown",this._onKey)}onStringsChanged(){this._syncCollapse()}onAttributeChanged(t){if("open"===t)return this._syncOpen(),void this.emit("nk-toggle",{open:this.getBoolAttr("open")});const e=st(),i=e&&(this.contains(e)||this._shadow.contains(e)),n=e?.closest?.(".nk-sidebar-toggle");if(this._syncCollapse(),"collapsed"!==t)return;const s=this.getBoolAttr("collapsed");this.emit("nk-collapse",{collapsed:s});const r=t=>requestAnimationFrame(()=>requestAnimationFrame(t));s&&i&&r(()=>this._toggleButton()?.focus({preventScroll:!0})),s||!n||this._collapse.hidden||r(()=>this._collapse.focus({preventScroll:!0}))}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}collapse(){this.setBoolAttr("collapsed",!0)}expand(){this.setBoolAttr("collapsed",!1)}toggleCollapsed(){this.setBoolAttr("collapsed",!this.getBoolAttr("collapsed"))}get collapsed(){return this.getBoolAttr("collapsed")}set collapsed(t){this.setBoolAttr("collapsed",t)}}customElements.define("nk-sidebar",at);const lt=new CSSStyleSheet;lt.replaceSync("\n .nk-ws-anchor { position: relative; flex: 1 1 auto; min-width: 0; }\n .nk-ws-menu { display: none; position: absolute; left: 8px; top: calc(100% - 2px); z-index: 50; }\n :host([open]) .nk-ws-menu { display: block; }\n");class ht extends v{static get hostStyles(){return lt}static get observedAttributes(){return["name","avatar","open"]}render(){this._row=this.createElement("div",["nk-workspace"],{role:"button",tabindex:"0","aria-haspopup":"menu"}),this._avatar=this.createElement("div",["avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._name=document.createElement("span");const e=this.createElement("span",["chev"]);e.textContent="โŒ„",this._row.append(t,this._name,e),this._menu=this.createElement("div",["nk-ws-menu"]),this._menu.appendChild(this.createElement("slot",[],{name:"menu"}));const i=this.createElement("div",["nk-ws-anchor"]);i.append(this._row,this._menu),this._wrapper.appendChild(i),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t,this._avatar.textContent=this.getAttribute("avatar")||t.trim().charAt(0).toUpperCase(),this._row.setAttribute("aria-expanded",this.getBoolAttr("open")?"true":"false")}setupEvents(){this._onClick=()=>this.toggle(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onDocKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onMenuSelect=()=>this.close(),this._row.addEventListener("click",this._onClick),this._row.addEventListener("keydown",this._onKey),this._menu.addEventListener("nk-select",this._onMenuSelect),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKey)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._row?.removeEventListener("keydown",this._onKey),this._menu?.removeEventListener("nk-select",this._onMenuSelect),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKey)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}}customElements.define("nk-workspace-switcher",ht);class ct extends v{static get observedAttributes(){return["label","addable"]}render(){this._box=this.createElement("div",["nk-section-label"]),this._text=document.createElement("span"),this._text.appendChild(document.createElement("slot")),this._plus=this.createElement("span",["plus"],{role:"button",title:"+"}),this._plus.textContent="๏ผ‹",this._box.append(this._text,this._plus),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("label");null!==t&&(this._text.textContent=t),this._plus.style.display=this.getBoolAttr("addable")?"":"none"}setupEvents(){this._onPlus=t=>{t.stopPropagation(),this.emit("nk-action",{action:"add"})},this._plus.addEventListener("click",this._onPlus)}teardownEvents(){this._plus?.removeEventListener("click",this._onPlus)}onAttributeChanged(){this._sync()}get addable(){return this.getBoolAttr("addable")}set addable(t){this.setBoolAttr("addable",t)}}customElements.define("nk-section-label",ct);const dt=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]);class pt extends v{static get observedAttributes(){return["manual"]}render(){const t=this.createElement("div",[],{role:"tree"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._box=t}setActive(t){if(!this.getBoolAttr("manual")){for(const e of this.querySelectorAll("nk-tree-item[active]"))e!==t&&e.removeAttribute("active");t.setAttribute("active",""),this._syncTabIndex(t)}}setupEvents(){this._onKey=t=>{if(!dt.has(t.key)||t.ctrlKey||t.metaKey||t.altKey)return;const e=t.target.closest?.("nk-tree-item");if(!e)return;const i=this.visibleItems(),n=i.indexOf(e);if(n<0)return;let s=null;switch(t.key){case"ArrowDown":s=i[n+1];break;case"ArrowUp":s=i[n-1];break;case"Home":s=i[0];break;case"End":s=i[i.length-1];break;case"ArrowRight":e.hasChildren&&!e.open?e.open=!0:e.hasChildren&&(s=e.querySelector("nk-tree-item"));break;case"ArrowLeft":e.hasChildren&&e.open?e.open=!1:s=e.parentElement?.closest("nk-tree-item")}t.preventDefault(),s&&(this._syncTabIndex(s),s.focus())},this._onSlot=()=>this._syncTabIndex(),this.addEventListener("keydown",this._onKey),this._box.querySelector("slot").addEventListener("slotchange",this._onSlot),this._syncTabIndex()}teardownEvents(){this.removeEventListener("keydown",this._onKey),this._box?.querySelector("slot").removeEventListener("slotchange",this._onSlot)}visibleItems(){return[...this.querySelectorAll("nk-tree-item")].filter(t=>{for(let e=t.parentElement?.closest("nk-tree-item");e&&this.contains(e);e=e.parentElement?.closest("nk-tree-item"))if(!e.open)return!1;return!0})}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._syncTabIndex()}))}_syncTabIndex(t){const e=[...this.querySelectorAll("nk-tree-item")];if(!e.length)return;const i=this.visibleItems(),n=t||i.find(t=>t.active)||i[0];for(const t of e)t.setTabbable?.(t===n)}set data(t){this._data=t;const e=t=>t.map(t=>{const i=document.createElement("nk-tree-item");return t.icon&&i.setAttribute("icon",t.icon),null!=t.value&&i.setAttribute("value",t.value),t.href&&i.setAttribute("href",t.href),t.open&&i.setAttribute("open",""),t.active&&i.setAttribute("active",""),i.append(document.createTextNode(t.label??""),...e(t.children||[])),i});for(const t of this.querySelectorAll(":scope > nk-tree-item"))t.remove();this.append(...e(t||[]))}get data(){return this._data}get activeItem(){return this.querySelector("nk-tree-item[active]")}get value(){return this.activeItem?.value??null}}customElements.define("nk-tree",pt);class ut extends v{static get slotAssignment(){return"manual"}static get observedAttributes(){return["label","icon","value","href","active","open","compact","no-actions"]}render(){this._row=this.createElement("div",["nk-tree-item"],{role:"treeitem",tabindex:"-1"}),this._arrow=this.createElement("span",["nk-toggle-arrow"],{"aria-hidden":"true"}),this._arrow.textContent="โ–ธ",this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"]),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=this.createElement("slot",[],{name:"label"}),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._actions=this.createElement("span",["actions"]);for(const[t,e,i]of[["add","๏ผ‹",this.str("add")],["more","โ‹ฏ",this.str("more")]]){const n=this.createElement("span",[],{"data-action":t,role:"button",title:i});n.textContent=e,this._actions.appendChild(n)}this._endSlot=this.createElement("slot",[],{name:"end"}),this._row.append(this._arrow,this._iconSlot,this._label,this._actions,this._endSlot),this._children=this.createElement("div",["nk-tree-children"],{role:"group"}),this._childSlot=this.createElement("slot",[],{name:"children"}),this._children.appendChild(this._childSlot),this._wrapper.append(this._row,this._children),this._sync(),this.closest("nk-tree")?.requestSync?.()}assignSlots(){if(!this._row)return;const t=[],e=[],i=[],n=[];for(const s of this.childNodes)if(s.nodeType===Node.ELEMENT_NODE){const r=s.getAttribute("slot");"icon"===r?t.push(s):"end"===r?e.push(s):"nk-tree-item"===s.localName?i.push(s):n.push(s)}else s.nodeType===Node.TEXT_NODE&&n.push(s);this._iconSlot.assign(...t),this._endSlot.assign(...e),this._childSlot.assign(...i),this._labelSlot.assign(...this.hasAttribute("label")?[]:n),this._hasChildren=i.length>0,this._hasEnd=e.length>0,this._sync()}_sync(){const t=this.getBoolAttr("active"),e=this.getBoolAttr("open");this._row.classList.toggle("active",t),this._row.classList.toggle("compact",this.getBoolAttr("compact")),this._row.setAttribute("aria-selected",t?"true":"false"),this._arrow.classList.toggle("open",e),this._arrow.style.display=this._hasChildren?"":"none",this._hasChildren?this._row.setAttribute("aria-expanded",e?"true":"false"):this._row.removeAttribute("aria-expanded"),this._children.classList.toggle("collapsed",!e||!this._hasChildren);const i=this.getAttribute("icon")||"";this._icon.textContent!==i&&(this._icon.textContent=i),this._icon.style.display=i?"":"none";const n=this.getAttribute("label")||"";this._labelText.data!==n&&(this._labelText.data=n);const s=!this.getBoolAttr("no-actions")&&!this._hasEnd;s&&!this._actions.isConnected&&this._row.insertBefore(this._actions,this._endSlot),!s&&this._actions.isConnected&&this._actions.remove();const r=this.getAttribute("href");r?this._row.setAttribute("data-href",r):this._row.removeAttribute("data-href")}setupEvents(){this._onRowClick=t=>{const e=t.target.closest?.("[data-action]");return e?(t.stopPropagation(),void this.emit("nk-action",{action:e.dataset.action,value:this.value,label:this.label})):t.target===this._arrow||this._arrow.contains(t.target)?(t.stopPropagation(),void this.toggle()):void this.select()},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._row.addEventListener("click",this._onRowClick),this._row.addEventListener("keydown",this._onKey)}teardownEvents(){this._row?.removeEventListener("click",this._onRowClick),this._row?.removeEventListener("keydown",this._onKey)}onStringsChanged(){for(const t of this._actions.children)t.title=this.str(t.dataset.action)}onAttributeChanged(t){"label"===t?this.assignSlots():this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open"),value:this.value})}select(){if(!this.emit("nk-select",{value:this.value,label:this.label,href:this.getAttribute("href"),item:this}))return;const t=this.closest("nk-tree");t?t.setActive(this):this.setBoolAttr("active",!0),this.getAttribute("href")&&location.assign(this.getAttribute("href"))}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}focus(t){this._row?.focus(t)}setTabbable(t){this._row&&(this._row.tabIndex=t?0:-1)}get tabbable(){return 0===this._row?.tabIndex}get hasChildren(){return!!this._hasChildren}get label(){return this.getAttribute("label")??this._labelSlot?.assignedNodes().map(t=>t.textContent).join("").trim()??""}set label(t){this.setAttribute("label",t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}}customElements.define("nk-tree-item",ut);class gt extends v{render(){const t=this.createElement("div",["nk-topbar"]);t.appendChild(document.createElement("slot"));const e=this.createElement("div",["nk-topbar-actions"]);e.appendChild(this.createElement("slot",[],{name:"actions"})),t.appendChild(e),this._wrapper.appendChild(t)}}customElements.define("nk-topbar",gt);class bt extends v{static get observedAttributes(){return["separator"]}static get observesLightDom(){return!0}render(){this._nav=this.createElement("nav",["nk-breadcrumb"],{"aria-label":this.str("breadcrumb")}),this._wrapper.appendChild(this._nav),this.projectLightDom()}projectLightDom(){if(!this._nav)return;const t=[...this.children],e=this.getAttribute("separator")??"/",i=t.map(t=>t.outerHTML).join("")+e;if(i===this._signature)return;this._signature=i,this._nav.innerHTML="";const n=t.some(t=>t.hasAttribute("current")||t.classList.contains("current"));t.forEach((i,s)=>{if(s>0){const t=this.createElement("span",["sep"],{"aria-hidden":"true"});t.textContent=e,this._nav.appendChild(t)}const r=i.cloneNode(!0);r.removeAttribute("slot"),r.classList.add("crumb");const o=n?i.hasAttribute("current")||i.classList.contains("current"):s===t.length-1;r.classList.toggle("current",o),o&&r.setAttribute("aria-current","page"),r.dataset.index=s,this._nav.appendChild(r)})}setupEvents(){this._onClick=t=>{const e=t.target.closest(".crumb");if(!e)return;t.preventDefault();const i=Number(e.dataset.index),n=this.children[i];this.emit("nk-select",{index:i,label:e.textContent.trim(),href:n?.getAttribute("href")??null,value:n?.dataset.value??n?.getAttribute("href")??e.textContent.trim(),current:e.classList.contains("current")})&&n?.click()},this._nav.addEventListener("click",this._onClick)}teardownEvents(){this._nav?.removeEventListener("click",this._onClick)}onAttributeChanged(){this.projectLightDom()}onStringsChanged(){this._nav.setAttribute("aria-label",this.str("breadcrumb"))}get separator(){return this.getAttribute("separator")??"/"}set separator(t){this.setAttribute("separator",t)}}customElements.define("nk-breadcrumb",bt);class mt extends v{static get observedAttributes(){return["storage-key","title"]}render(){this._btn=this.createElement("button",["nk-topbar-btn","nk-theme-toggle"],{type:"button"}),this._syncTitle(),this._wrapper.appendChild(this._btn);const t=document.documentElement;let e=null;try{e=localStorage.getItem(this.storageKey)}catch{}"light"===e||"dark"===e?t.setAttribute("data-theme",e):t.hasAttribute("data-theme")||t.setAttribute("data-theme",matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),this._syncGlyph()}_syncGlyph(){this._btn&&(this._btn.textContent="dark"===g()?"โ˜€๏ธ":"๐ŸŒ™")}_syncTheme(t){super._syncTheme(t),this._syncGlyph()}setupEvents(){this._onClick=()=>this.apply("dark"===g()?"light":"dark"),this._onMessage=t=>{const e=t.data?.nkTheme;"light"!==e&&"dark"!==e||this.apply(e)},this._btn.addEventListener("click",this._onClick),window.addEventListener("message",this._onMessage)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),window.removeEventListener("message",this._onMessage)}_syncTitle(){this._btn.title=this.getAttribute("title")||this.str("toggleTheme")}onStringsChanged(){this._syncTitle()}onAttributeChanged(t){"title"===t&&this._btn&&this._syncTitle()}apply(t){document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem(this.storageKey,t)}catch{}this._syncGlyph(),this.emit("nk-change",{value:t})}get storageKey(){return this.getAttribute("storage-key")||"nk-theme"}get value(){return g()}set value(t){this.apply(t)}}customElements.define("nk-theme-toggle",mt);class kt extends v{static get observedAttributes(){return["value","always","fixed","floating","label"]}render(){this._bar=this.createElement("nav",["nk-tab-bar"]),this._slot=document.createElement("slot"),this._bar.appendChild(this._slot),this._spacer=this.createElement("div",["nk-tab-bar-spacer"]),this._wrapper.append(this._bar,this._spacer),this._syncBar(),this._sync()}get items(){return[...this.querySelectorAll(":scope > nk-tab-bar-item")]}_valueOf(t){return t.getAttribute("value")??t.getAttribute("label")??t.textContent.trim()}_syncBar(){this._bar.classList.toggle("always",this.getBoolAttr("always")),this._bar.classList.toggle("fixed",this.getBoolAttr("fixed")),this._bar.classList.toggle("floating",this.getBoolAttr("floating"));const t=this.getAttribute("label");t?this._bar.setAttribute("aria-label",t):this._bar.removeAttribute("aria-label")}_sync(){const t=this.items.filter(t=>!t.hasAttribute("drawer")),e=this.items.filter(t=>t.hasAttribute("drawer"));if(!t.length)return;let i=this.getAttribute("value");if(null===i){const e=t.find(t=>t.hasAttribute("active"))||t[0];i=this._valueOf(e)}const n=t.some(t=>this._valueOf(t)===i);for(const e of t)this._valueOf(e)===i?e.setAttribute("active",""):e.removeAttribute("active");e.forEach((t,e)=>{n||0!==e?t.removeAttribute("active"):t.setAttribute("active","")}),this._value=i}setupEvents(){this._onSlot=()=>this._sync(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("value"!==t)return void this._syncBar();const e=this._value;this._sync(),this._value!==e&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get always(){return this.getBoolAttr("always")}set always(t){this.setBoolAttr("always",t)}get fixed(){return this.getBoolAttr("fixed")}set fixed(t){this.setBoolAttr("fixed",t)}get floating(){return this.getBoolAttr("floating")}set floating(t){this.setBoolAttr("floating",t)}}customElements.define("nk-tab-bar",kt);class _t extends v{static get observedAttributes(){return["icon","label","value","href","active","disabled","drawer"]}render(){this._btn=this.createElement("button",["nk-tab-bar-item"],{type:"button"}),this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"],{"aria-hidden":"true"}),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=document.createElement("slot"),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._btn.append(this._iconSlot,this._label),this._wrapper.appendChild(this._btn),this._sync()}_sync(){this._icon.textContent=this.getAttribute("icon")??"",this._labelText.data=this.getAttribute("label")??"";const t=this.getBoolAttr("active");this._btn.classList.toggle("active",t),t?this._btn.setAttribute("aria-current","page"):this._btn.removeAttribute("aria-current"),this._btn.disabled=this.getBoolAttr("disabled");const e=this.getAttribute("href");e?this._btn.setAttribute("data-href",e):this._btn.removeAttribute("data-href")}setupEvents(){this._onClick=()=>this.select(),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}select(){if(this.getBoolAttr("disabled"))return;const t=this.getAttribute("href");if(!this.emit("nk-select",{value:this.value,label:this.label,href:t,item:this,drawer:this.getBoolAttr("drawer")}))return;if(this.getBoolAttr("drawer")){const t=this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar");return void t?.toggle?.()}const e=this.closest("nk-tab-bar");e?e.value=this.value:this.setBoolAttr("active",!0),t&&location.assign(t)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get label(){return this.getAttribute("label")??this.textContent.trim()}set label(t){this.setAttribute("label",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get drawer(){return this.getBoolAttr("drawer")}set drawer(t){this.setBoolAttr("drawer",t)}}customElements.define("nk-tab-bar-item",_t);class vt extends v{static get observedAttributes(){return["icon","cover","narrow","full","small"]}render(){this._page=this.createElement("div",["nk-page"]),this._icon=this.createElement("div",["nk-page-icon"],{role:"button",title:this.str("changeIcon")}),this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._iconSlot.appendChild(this._icon),this._page.appendChild(this._iconSlot),this._page.appendChild(document.createElement("slot")),this._cover=this.createElement("div",["nk-cover"]),this._coverSlot=this.createElement("slot",[],{name:"cover"}),this._coverSlot.appendChild(this._cover),this._build()}_build(){if(this._wrapper.replaceChildren(),this.getBoolAttr("narrow"))this._wrapper.append(this._coverSlot,this._page);else{const t=this.createElement("div",["nk-page-scroll"]);t.append(this._coverSlot,this._page),this._wrapper.appendChild(t)}this._sync()}_sync(){const t=this.getAttribute("icon")||"";this._icon.textContent!==t&&(this._icon.textContent=t),this._icon.style.display=t?"":"none",this._cover.style.display=this.getBoolAttr("cover")?"":"none";const e=t=>t.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim()),i=this.getBoolAttr("cover")||e(this._coverSlot),n=!!t||e(this._iconSlot);this._page.classList.toggle("covered",i&&n),this._page.classList.toggle("full",this.getBoolAttr("full")),this._page.classList.toggle("small",this.getBoolAttr("small"))}setupEvents(){this._onIcon=()=>this.emit("nk-action",{action:"icon",value:this.getAttribute("icon")}),this._onCover=()=>this._sync(),this._icon.addEventListener("click",this._onIcon),this._coverSlot.addEventListener("slotchange",this._onCover),this._iconSlot.addEventListener("slotchange",this._onCover),this._sync()}teardownEvents(){this._icon?.removeEventListener("click",this._onIcon),this._coverSlot?.removeEventListener("slotchange",this._onCover),this._iconSlot?.removeEventListener("slotchange",this._onCover)}onStringsChanged(){this._icon.title=this.str("changeIcon")}onAttributeChanged(t){"narrow"===t?this._build():this._sync()}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get cover(){return this.getBoolAttr("cover")}set cover(t){this.setBoolAttr("cover",t)}get full(){return this.getBoolAttr("full")}set full(t){this.setBoolAttr("full",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}}customElements.define("nk-page",vt);class xt extends v{static get observedAttributes(){return["src","position"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._wrapper.appendChild(this._cover),this._sync()}_sync(){const t=this.getAttribute("src");t?(this._img.src=t,this._img.style.objectPosition=this.getAttribute("position")||"",this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove()}onAttributeChanged(){this._sync()}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-page-cover",xt);class ft extends v{static get observedAttributes(){return["editable","placeholder","value"]}static get observesLightDom(){return!0}render(){this._h1=this.createElement("h1",["nk-page-title"]),this._slot=document.createElement("slot"),this._h1.appendChild(this._slot),this._wrapper.appendChild(this._h1),this._sync()}_sync(){if(this.getBoolAttr("editable")){this._slot.isConnected&&this._slot.remove(),this._h1.setAttribute("contenteditable","plaintext-only"),this._h1.setAttribute("spellcheck","false"),this._h1.setAttribute("role","textbox"),this._h1.setAttribute("aria-label",this.str("title"));const t=this.getAttribute("value")??this.textContent.trim();this._h1.textContent!==t&&document.activeElement!==this&&(this._h1.textContent=t),this._h1.setAttribute("data-placeholder",this.getAttribute("placeholder")||"")}else this._h1.removeAttribute("contenteditable"),this._h1.removeAttribute("role"),this.hasAttribute("value")?(this._slot.isConnected&&this._slot.remove(),this._h1.textContent=this.getAttribute("value")):this._slot.isConnected||(this._h1.textContent="",this._h1.appendChild(this._slot))}projectLightDom(){this._h1&&!this.hasAttribute("value")&&this._sync()}setupEvents(){this._committed=this.value,this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this._h1.blur())},this._onBlur=()=>this._commit(),this._h1.addEventListener("keydown",this._onKey),this._h1.addEventListener("blur",this._onBlur)}teardownEvents(){this._h1?.removeEventListener("keydown",this._onKey),this._h1?.removeEventListener("blur",this._onBlur)}_commit(){const t=this._h1.textContent.trim();t!==this._committed&&(this._committed=t,this.emit("nk-change",{value:t}))}onAttributeChanged(){this._sync()}onStringsChanged(){this._h1.hasAttribute("role")&&this._h1.setAttribute("aria-label",this.str("title"))}get value(){return this.getBoolAttr("editable")?this._h1?.textContent.trim()??"":this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get editable(){return this.getBoolAttr("editable")}set editable(t){this.setBoolAttr("editable",t)}focus(t){this._h1?.focus(t)}}customElements.define("nk-page-title",ft);class yt extends v{render(){const t=this.createElement("div",["nk-page-meta"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-page-actions",yt);class wt extends v{static get observedAttributes(){return["handle","drop-target"]}render(){this._box=this.createElement("div",["nk-block-host"]),this._handle=this.createElement("span",["nk-block-handle"],{"aria-hidden":"true"}),this._handle.textContent="โ ฟ",this._box.appendChild(this._handle),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._sync()}_sync(){this._handle.style.display=this.getBoolAttr("handle")?"":"none",this._box.classList.toggle("nk-drop-target",this.getBoolAttr("drop-target"))}onAttributeChanged(){this._sync()}get handle(){return this.getBoolAttr("handle")}set handle(t){this.setBoolAttr("handle",t)}get dropTarget(){return this.getBoolAttr("drop-target")}set dropTarget(t){this.setBoolAttr("drop-target",t)}}customElements.define("nk-block-host",wt);const At=["info","success","warning","danger"];class Et extends v{static get observedAttributes(){return["variant"]}render(){this._box=this.createElement("div",this._classes(),{role:"status"}),this._box.appendChild(document.createElement("slot")),this._box.appendChild(this.createElement("slot",[],{name:"action"})),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("variant");return["nk-banner",...At.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}}customElements.define("nk-banner",Et);class Ct extends v{static get observedAttributes(){return["icon","title","desc"]}render(){const t=this.createElement("div",["nk-empty"]);this._parts={};for(const[e,i]of[["icon","e-icon"],["title","e-title"],["desc","e-desc"]]){const n=this.createElement("div",[i]),s=this.createElement("slot",[],{name:e});s.appendChild(n),t.appendChild(s),this._parts[e]=n}const e=this.createElement("div",["e-actions"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const i="title"===t?this._titleText:this.getAttribute(t);e.textContent=i||"",e.style.display=i?"":"none"}}onAttributeChanged(t,e,i){("title"!==t||this.takeTitle(i))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-empty",Ct);class Bt extends v{static get observedAttributes(){return["lines","height","width","widths"]}render(){this._build()}_build(){this._wrapper.replaceChildren();const t=Math.max(1,Number(this.getAttribute("lines"))||1),e=this.getAttribute("height")||"13",i=(this.getAttribute("widths")||"").split(",").map(t=>t.trim()).filter(Boolean),n=this.getAttribute("width");for(let s=0;s<t;s++){const t=this.createElement("div",["nk-skeleton"],{"aria-hidden":"true"});t.style.height=/^\d+(\.\d+)?$/.test(e)?`${e}px`:e;const r=i[s]??n;r&&(t.style.width=r),this._wrapper.appendChild(t)}}onAttributeChanged(){this._build()}}customElements.define("nk-skeleton",Bt);class Lt extends v{static get observedAttributes(){return["badge"]}render(){const t=this.createElement("div",["nk-synced"]);this._badge=this.createElement("span",["synced-badge"]),t.appendChild(this._badge),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._badge.textContent=this.getAttribute("badge")??this.str("synced")}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}get badge(){return this.getAttribute("badge")}set badge(t){this.setAttribute("badge",t)}}function St(t){if(t.getClientRects().length)return t.getBoundingClientRect();for(const e of[...t.shadowRoot?.children??[],...t.children]){const t=St(e);if(t.width||t.height)return t}return t.getBoundingClientRect()}function zt(t){const e=t.style;e.top="0px",e.left="0px",e.right="auto";const i=t.getBoundingClientRect();e.left="auto",e.right="0px";const n=t.getBoundingClientRect();return{x:i.left,y:i.top,right:n.right,width:i.width,height:i.height}}function Tt(t,e,i){const n=St(e);t.style.removeProperty("--_nk-float-max");const s=zt(t),r=innerHeight-n.bottom-6-8,o=n.top-6-8,a=s.height>r&&o>r,l=Math.max(0,Math.floor(a?o:r));s.height>l&&t.style.setProperty("--_nk-float-max",`${l}px`),t.style.top=(a?n.top-6-Math.min(s.height,l):n.bottom+6)-s.y+"px","start"===i?(t.style.left=n.left-s.x+"px",t.style.right="auto"):(t.style.right=s.right-Math.min(n.right,innerWidth-8)+"px",t.style.left="auto")}customElements.define("nk-synced",Lt);const Dt={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class Mt extends v{static get observedAttributes(){return["value","scroll"]}render(){this._strip=this.createElement("div",["nk-tabs"],{role:"tablist"}),this._tabSlot=document.createElement("slot"),this._strip.appendChild(this._tabSlot),this._panelSlot=this.createElement("slot",[],{name:"panel"}),this._wrapper.append(this._strip,this._panelSlot),this._sync()}get tabs(){return[...this.querySelectorAll(":scope > nk-tab")]}get panels(){return[...this.querySelectorAll(':scope > [slot="panel"]')]}_sync(){const t=this.tabs;if(!t.length)return;let e=this.getAttribute("value");if(null===e||!t.some(t=>t.getAttribute("value")===e||null===t.getAttribute("value")&&t.textContent.trim()===e)){const i=t.find(t=>t.hasAttribute("active"))||t[0];e=i.getAttribute("value")??i.textContent.trim()}for(const i of t){(i.getAttribute("value")??i.textContent.trim())===e?i.setAttribute("active",""):i.removeAttribute("active")}for(const t of this.panels)t.hidden=t.dataset.tab!==e;this._value=e,this._strip.classList.toggle("scroll",this.getBoolAttr("scroll")),this._reveal(this._revealed?"smooth":"instant")}_reveal(t){if(!this.getBoolAttr("scroll")||!this._strip?.clientWidth)return;const e=this.tabs.find(t=>t.hasAttribute("active"));if(!e)return;const i=this._strip.getBoundingClientRect(),n=St(e),s=n.left<i.left?n.left-i.left-8:n.right>i.right?n.right-i.right+8:0,r="smooth"===t&&!matchMedia("(prefers-reduced-motion: reduce)").matches;s&&this._strip.scrollBy({left:s,behavior:r?"smooth":"instant"}),this._revealed=!0}setupEvents(){this._onSlot=()=>this._sync(),this._onKey=t=>{const e=Dt[t.key];if(!e)return;const i=this.tabs.filter(t=>!t.hasAttribute("disabled")),n=i.indexOf(t.target.closest?.("nk-tab"));if(n<0||i.length<2)return;t.preventDefault();const s=i[(n+e+i.length)%i.length];s.select(),s.focus()},this._tabSlot.addEventListener("slotchange",this._onSlot),this._panelSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("keydown",this._onKey),this._resize=new ResizeObserver(()=>this._reveal("instant")),this._resize.observe(this._strip),this._sync()}teardownEvents(){this._tabSlot?.removeEventListener("slotchange",this._onSlot),this._panelSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("keydown",this._onKey),this._resize?.disconnect()}onAttributeChanged(){const t=this._value;this._sync(),this._value!==t&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get scroll(){return this.getBoolAttr("scroll")}set scroll(t){this.setBoolAttr("scroll",t)}}customElements.define("nk-tabs",Mt);class Nt extends v{static get observedAttributes(){return["active","value","disabled"]}render(){this._tab=this.createElement("span",["nk-tab"],{role:"tab"}),this._tab.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tab),this._sync()}_sync(){const t=this.getBoolAttr("active");this._tab.classList.toggle("active",t),this._tab.setAttribute("aria-selected",t?"true":"false"),this._tab.tabIndex=t?0:-1,this._tab.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._tab.addEventListener("click",this._onClick),this._tab.addEventListener("keydown",this._onKey)}teardownEvents(){this._tab?.removeEventListener("click",this._onClick),this._tab?.removeEventListener("keydown",this._onKey)}select(){if(this.getBoolAttr("disabled"))return;if(!this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this}))return;const t=this.closest("nk-tabs");t?t.value=this.value:this.setBoolAttr("active",!0)}onAttributeChanged(){this._sync()}focus(t){this._tab?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-tab",Nt);const Ft={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class It extends x{static get observedAttributes(){return["value","name","disabled","scroll","wrap"]}render(){this._box=this.createElement("div",["nk-segmented"],{role:"radiogroup"}),this._slot=document.createElement("slot"),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._syncBox(),this._sync()}_syncBox(){this._box.classList.toggle("scroll",this.getBoolAttr("scroll")),this._box.classList.toggle("wrap",this.getBoolAttr("wrap"))}get buttons(){return this._slot?.assignedElements().filter(t=>"button"===t.localName)??[]}_valueOf(t){return t.getAttribute("value")??t.textContent.trim()}_sync(){const t=this.buttons;if(!t.length)return;let e=this.getAttribute("value");null!==e&&t.some(t=>this._valueOf(t)===e)||(e=this._valueOf(t.find(t=>t.classList.contains("active"))||t[0])),void 0===this._defaultValue&&(this._defaultValue=e);const i=this.getBoolAttr("disabled")||!!this._formDisabled;for(const n of t){const t=this._valueOf(n)===e;n.type="button",n.setAttribute("role","radio"),n.setAttribute("aria-checked",t?"true":"false"),n.classList.toggle("active",t),n.tabIndex=t?0:-1,n.disabled=i}this._value=e,this.setFormValue(e),this._reveal(this._revealed?"smooth":"instant")}_reveal(t){if(!this.getBoolAttr("scroll")||!this._box?.clientWidth)return;const e=this.buttons.find(t=>t.classList.contains("active"));if(!e)return;const i=this._box.getBoundingClientRect(),n=e.getBoundingClientRect(),s=n.left<i.left?n.left-i.left-8:n.right>i.right?n.right-i.right+8:0,r="smooth"===t&&!matchMedia("(prefers-reduced-motion: reduce)").matches;s&&this._box.scrollBy({left:s,behavior:r?"smooth":"instant"}),this._revealed=!0}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this.buttons.includes(e)&&!e.disabled&&this._choose(this._valueOf(e))},this._onKey=t=>{const e=Ft[t.key];if(!e)return;const i=this.buttons,n=i.indexOf(t.target.closest?.("button"));if(n<0||i.length<2)return;t.preventDefault();const s=i[(n+e+i.length)%i.length];this._choose(this._valueOf(s)),s.focus()},this._slot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKey),this._resize=new ResizeObserver(()=>this._reveal("instant")),this._resize.observe(this._box),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKey),this._resize?.disconnect()}_choose(t){t!==this._value&&(this._syncing=!0,this.setAttribute("value",t),this._syncing=!1,this._sync(),this.emit("nk-change",{value:t,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){"scroll"!==t&&"wrap"!==t?this._syncing||this._sync():this._syncBox()}resetValue(){void 0!==this._defaultValue&&this.setAttribute("value",this._defaultValue)}onFormDisabled(t){this._formDisabled=t,this._sync()}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get scroll(){return this.getBoolAttr("scroll")}set scroll(t){this.setBoolAttr("scroll",t)}get wrap(){return this.getBoolAttr("wrap")}set wrap(t){this.setBoolAttr("wrap",t)}}customElements.define("nk-segmented",It);class jt extends v{render(){const t=this.createElement("div",["nk-stats"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-stats",jt);class Vt extends v{static get observedAttributes(){return["label","value","delta","trend"]}render(){const t=this.createElement("div",["nk-stat"]);this._parts={};for(const[e,i]of[["label","s-label"],["value","s-value"],["delta","s-delta"]]){const n=this.createElement("div",[i]),s=this.createElement("slot",[],{name:e});s.appendChild(n),t.appendChild(s),this._parts[e]=n}this._wrapper.appendChild(t),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const i=this.getAttribute(t);e.textContent=i??"",e.style.display=null===i?"none":""}const t=this.getAttribute("trend");this._parts.delta.className="s-delta"+("up"===t||"down"===t?` ${t}`:"")}onAttributeChanged(){this._sync()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-stat",Vt);class qt extends v{static get observedAttributes(){return["more"]}render(){const t=this.createElement("div",["nk-avatar-group"]);t.appendChild(document.createElement("slot")),this._more=this.createElement("span",["mini-avatar","more"]),t.appendChild(this._more),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("more");this._more.textContent=t||"",this._more.style.display=t?"":"none"}onAttributeChanged(){this._sync()}get more(){return this.getAttribute("more")}set more(t){null==t?this.removeAttribute("more"):this.setAttribute("more",t)}}customElements.define("nk-avatar-group",qt);const Ot=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function Pt(t,e){for(const i of Ot)t.classList.toggle(i,i===e);t.style.background=e&&!Ot.includes(e)?e:""}const Kt=t=>String(t||"").split(/\s+/).map(t=>t.match(/[\p{L}\p{N}]/u)?.[0]).filter(Boolean).join("").slice(0,2).toUpperCase();class Rt extends v{static get observedAttributes(){return["size","color","square","src","name"]}render(){this._box=this.createElement("span",["nk-avatar"]),this._slot=document.createElement("slot"),this._initials=document.createTextNode(""),this._slot.appendChild(this._initials),this._img=this.createElement("img",[],{alt:""}),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("size");for(const e of["small","large","xlarge"])this._box.classList.toggle(e,e===t);this._box.classList.toggle("square",this.getBoolAttr("square")),Pt(this._box,this.getAttribute("color"));const e=this.getAttribute("name");this._initials.data=Kt(e);const i=this.getAttribute("src");i?(this._img.src=i,this._img.alt=e||"",this._slot.isConnected&&this._slot.replaceWith(this._img)):this._img.isConnected&&this._img.replaceWith(this._slot),e&&!i?(this._box.setAttribute("role","img"),this._box.setAttribute("aria-label",e)):(this._box.removeAttribute("role"),this._box.removeAttribute("aria-label"))}onAttributeChanged(){this._sync()}get size(){return this.getAttribute("size")}set size(t){null==t?this.removeAttribute("size"):this.setAttribute("size",t)}get color(){return this.getAttribute("color")}set color(t){null==t?this.removeAttribute("color"):this.setAttribute("color",t)}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-avatar",Rt);const $t=["person","page","date"];class Ht extends v{static get observedAttributes(){return["type"]}render(){this._box=this.createElement("span",this._classes()),this._box.appendChild(this.createElement("slot",[],{name:"avatar"})),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("type");return["nk-mention",...$t.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get type(){return this.getAttribute("type")}set type(t){t?this.setAttribute("type",t):this.removeAttribute("type")}}customElements.define("nk-mention",Ht);class Wt extends v{static get observedAttributes(){return["icon","value","disabled"]}render(){this._btn=this.createElement("button",["nk-template-btn"],{type:"button"});const t=document.createElement("span");this._icon=document.createElement("span"),this._space=document.createTextNode(" "),t.append(this._icon,this._space,document.createElement("slot")),this._btn.appendChild(t),this._wrapper.appendChild(this._btn),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._space.data=t?" ":"",this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onClick=()=>this.emit("nk-select",{value:this.value,label:this.textContent.trim()}),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-template-btn",Wt);class Ut extends x{static get observedAttributes(){return["name","value","title","desc","selected","disabled"]}render(){this._card=this.createElement("div",["nk-model-card"],{role:"radio",tabindex:"0"}),this._card.appendChild(this.createElement("div",["m-radio"]));const t=document.createElement("div");this._name=this.createElement("div",["m-name"]);const e=this.createElement("slot",[],{name:"title"});e.appendChild(this._name),this._desc=this.createElement("div",["m-desc"]);const i=this.createElement("slot",[],{name:"desc"});i.appendChild(this._desc),t.append(e,i),this._card.appendChild(t),this._wrapper.appendChild(this._card),this._defaultSelected=this.getBoolAttr("selected"),this.takeTitle(),this._sync(),this.getBoolAttr("selected")&&this._unselectPeers()}_sync(){const t=this.getBoolAttr("selected");this._card.classList.toggle("selected",t),this._card.setAttribute("aria-checked",t?"true":"false"),this._card.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._name.textContent=this._titleText||"";const e=this.getAttribute("desc");this._desc.textContent=e||"",this._desc.style.display=e?"":"none",this.setFormValue(t?this.getAttribute("value")||"on":null,t?"selected":"unselected")}_group(){const t=this.getAttribute("name"),e=this.getRootNode();return t&&"function"==typeof e?.querySelectorAll?[...e.querySelectorAll("nk-model-card")].filter(e=>e.getAttribute("name")===t):[this]}_unselectPeers(){for(const t of this._group())t!==this&&t.hasAttribute("selected")&&t.removeAttribute("selected")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._card.addEventListener("click",this._onClick),this._card.addEventListener("keydown",this._onKey)}teardownEvents(){this._card?.removeEventListener("click",this._onClick),this._card?.removeEventListener("keydown",this._onKey)}select(){this.getBoolAttr("disabled")||this.getBoolAttr("selected")||(this.setBoolAttr("selected",!0),this.emit("nk-change",{value:this.value,name:this.name,checked:!0}),this.emit("nk-select",{value:this.value,label:this.title}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t,e,i){("title"!==t||this.takeTitle(i))&&(this._sync(),"selected"===t&&this.getBoolAttr("selected")&&this._unselectPeers())}resetValue(){this.setBoolAttr("selected",this._defaultSelected)}focus(t){this._card?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get selected(){return this.getBoolAttr("selected")}set selected(t){this.setBoolAttr("selected",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}}customElements.define("nk-model-card",Ut);class Gt extends v{static get observedAttributes(){return["avatar"]}render(){const t=this.createElement("div",["nk-profile-row"]);this._avatar=this.createElement("div",["big-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar),t.appendChild(e),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._avatar.textContent=this.getAttribute("avatar")||""}onAttributeChanged(){this._sync()}}customElements.define("nk-profile-row",Gt);class Yt extends v{static get observedAttributes(){return["title"]}render(){const t=this.createElement("div",["nk-danger-zone"]);this._titleEl=this.createElement("div",["dz-title"]),t.appendChild(this._titleEl),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._titleEl.textContent=t||"",this._titleEl.style.display=t?"":"none"}onAttributeChanged(t,e,i){("title"!==t||this.takeTitle(i))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-danger-zone",Yt);class Qt extends v{render(){const t=this.createElement("div",["nk-member-list"]);this._slot=document.createElement("slot"),t.appendChild(this._slot),this._wrapper.appendChild(t),this._mark()}_mark(){const t=this._slot.assignedElements().filter(t=>"nk-member-row"===t.localName);t.forEach((e,i)=>{i===t.length-1?e.setAttribute("last",""):e.removeAttribute("last")})}setupEvents(){this._onSlot=()=>this._mark(),this._slot.addEventListener("slotchange",this._onSlot),this._mark()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}}customElements.define("nk-member-list",Qt);class Zt extends v{static get observedAttributes(){return["name","mail","avatar","color","last"]}render(){this._row=this.createElement("div",["nk-member-row"]),this._avatar=this.createElement("span",["nk-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar);const e=document.createElement("div");this._name=document.createTextNode(""),this._mail=this.createElement("div",["m-mail"]),e.append(this._name,this._mail);const i=document.createElement("div");i.style.marginLeft="auto",i.appendChild(this.createElement("slot",[],{name:"role"})),this._row.append(t,e,i,document.createElement("slot")),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._name.data=this.getAttribute("name")||"";const t=this.getAttribute("mail");this._mail.textContent=t||"",this._mail.style.display=t?"":"none";const e=this.getAttribute("avatar");this._avatar.textContent=e||Kt(this.getAttribute("name")),Pt(this._avatar,this.getAttribute("color")),this._row.classList.toggle("last",this.getBoolAttr("last"))}onAttributeChanged(){this._sync()}}customElements.define("nk-member-row",Zt);class Xt extends v{static get observedAttributes(){return["flush"]}render(){this._list=this.createElement("dl",["nk-props"]),this._list.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._list),this.onAttributeChanged()}onAttributeChanged(){this._list?.classList.toggle("flush",this.getBoolAttr("flush"))}get flush(){return this.getBoolAttr("flush")}set flush(t){this.setBoolAttr("flush",t)}}customElements.define("nk-props",Xt);class Jt extends v{static get observedAttributes(){return["label","icon","text"]}render(){this._row=this.createElement("div",["nk-prop"]),this._name=this.createElement("dt",["p-name"]),this._icon=this.createElement("span",["p-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon),this._label=document.createTextNode(""),this._name.append(t,this._label),this._value=this.createElement("dd",["p-value"]),this._value.appendChild(document.createElement("slot")),this._row.append(this._name,this._value),this._wrapper.appendChild(this._row),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none",this._label.data=this.getAttribute("label")||"",this._value.classList.toggle("text",this.getBoolAttr("text"))}setupEvents(){this._onClick=t=>{const e=t.composedPath().includes(this._name)?"name":"value";this.emit("nk-action",{action:e,label:this.label})},this._row.addEventListener("click",this._onClick)}teardownEvents(){this._row?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}get label(){return this.getAttribute("label")||""}set label(t){this.setAttribute("label",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get text(){return this.getBoolAttr("text")}set text(t){this.setBoolAttr("text",t)}}customElements.define("nk-prop",Jt);class te extends v{static get observedAttributes(){return["flush"]}render(){this._grid=this.createElement("div",["nk-panels"]),this._grid.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._grid),this.onAttributeChanged()}onAttributeChanged(){this._grid?.classList.toggle("flush",this.getBoolAttr("flush"))}get flush(){return this.getBoolAttr("flush")}set flush(t){this.setBoolAttr("flush",t)}}customElements.define("nk-panels",te);class ee extends v{static get observedAttributes(){return["title","icon","cover","href","target"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._icon=this.createElement("div",["nk-page-icon"]),this._heading=document.createElement("h3"),this._endSlot=this.createElement("slot",[],{name:"end"}),this._end=this.createElement("span",["p-end"]),this._end.appendChild(this._endSlot),this._head=this.createElement("div",["p-head"]),this._head.append(this._heading,this._end),this._slot=document.createElement("slot"),this.takeTitle(),this._build()}_build(){const t=this.getAttribute("href"),e=this.createElement(t?"a":"div",["nk-panel"]);e.append(this._cover,this._icon,this._head,this._slot),this._wrapper.replaceChildren(e),this._box=e,this._sync()}_sync(){const t=this.getAttribute("href");t&&(this._box.setAttribute("href",t),this._box.target=this.getAttribute("target")||"");const e=this.getAttribute("cover");null===e?this._cover.remove():this._cover.isConnected||this._box.prepend(this._cover),e?(this._img.src=e,this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove();const i=this.getAttribute("icon");this._icon.textContent=i||"",this._icon.style.display=i?"":"none";const n=this._titleText||"";this._heading.textContent!==n&&(this._heading.textContent=n),this._heading.style.display=n?"":"none";const s=this._endSlot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent.trim());this._end.style.display=s?"":"none",this._head.style.display=n||s?"":"none"}setupEvents(){this._onEnd=()=>this._sync(),this._endSlot.addEventListener("slotchange",this._onEnd)}teardownEvents(){this._endSlot?.removeEventListener("slotchange",this._onEnd)}onAttributeChanged(t,e,i){("title"!==t||this.takeTitle(i))&&("href"!==t||null===i==("div"===this._box.localName)?this._sync():this._build())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get href(){return this.getAttribute("href")}set href(t){null==t?this.removeAttribute("href"):this.setAttribute("href",t)}}customElements.define("nk-panel",ee);const ie=[];let ne=!1;function se(t){if("Escape"!==t.key)return;if(t.composedPath().some(t=>"nk-toast"===t.localName))return;for(let t=ie.length-1;t>=0;t--)ie[t].el.isConnected||ie.splice(t,1);const e=ie.at(-1);e&&(t.stopPropagation(),e.close())}function re(t,e){oe(t),ie.push({el:t,close:e}),ne||"undefined"==typeof document||(document.addEventListener("keydown",se,!0),ne=!0)}function oe(t){const e=ie.findIndex(e=>e.el===t);e>=0&&ie.splice(e,1)}class ae extends v{static get observedAttributes(){return["open","title"]}render(){this.takeTitle(),this._backdrop=this.createElement("div",["nk-sheet-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-sheet"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._heading=this.createElement("div",["sh-title"],{id:"title"}),this._box.append(this.createElement("div",["sh-grabber"]),this._heading,document.createElement("slot")),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncTitle(),this._syncOpen()}_syncTitle(){const t=this._titleText||"";this._heading.textContent=t,this._heading.hidden=!t,t?this._box.setAttribute("aria-labelledby","title"):this._box.removeAttribute("aria-labelledby")}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=st(),et(),this._undoInert=nt(this),re(this,()=>this.close()),requestAnimationFrame(()=>(ot(this)||this._box).focus({preventScroll:!0}));else{oe(this),it(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._backdrop.addEventListener("click",this._onBackdrop)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),this._wasOpen&&(oe(this),it(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t,e,i){"title"!==t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this.takeTitle(i)&&this._syncTitle()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._syncTitle()}}customElements.define("nk-sheet",ae);class le extends v{static get observedAttributes(){return["steps","current","label","selectable","horizontal"]}render(){this._list=this.createElement("ol",["nk-steps"]),this._wrapper.appendChild(this._list),this._sync()}_items(){return this._steps?this._steps:(this.getAttribute("steps")||"").split(",").map(t=>t.trim()).filter(Boolean)}_step(t){const e=this._items()[t];return"object"==typeof e&&e?e:void 0===e?void 0:{label:String(e)}}_sync(){const t=this.getAttribute("label");t?this._list.setAttribute("aria-label",t):this._list.removeAttribute("aria-label"),this._list.classList.toggle("horizontal",this.getBoolAttr("horizontal"));const e=this.current,i=this.getBoolAttr("selectable"),n=this.shadowRoot?.activeElement?.closest?.("li")?.dataset.index;this._list.replaceChildren(...this._items().map((t,n)=>{const s=n+1,{label:r,desc:o,state:a,href:l}=this._step(n),h=a?"done"===a:s<e,c="skipped"===a,d=this.createElement("li",["nk-step"],{"data-index":String(s)});d.classList.toggle("done",h),d.classList.toggle("skipped",c),d.classList.toggle("current",s===e),s===e&&d.setAttribute("aria-current","step");const p=this.createElement("span",["st-mark"],{"aria-hidden":"true"});p.textContent=h?"โœ“":c?"โ€“":String(s);const u=null!=l&&""!==l?this.createElement("a",["st-label"],{href:String(l)}):i?this.createElement("button",["st-label"],{type:"button"}):document.createElement("span");if(u.textContent=r??"",o){const t=this.createElement("span",["st-desc"]);t.textContent=o,u.appendChild(t)}return d.append(p,u),d})),n&&this._list.querySelector(`li[data-index="${n}"] .st-label`)?.focus()}setupEvents(){this._onClick=t=>{const e=t.target.closest?.("li.nk-step");if(!e||!this._list.contains(e))return;const i=e.querySelector("a.st-label");if(i){if(0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;return i.contains(t.target)?void(this.select(Number(e.dataset.index))||t.preventDefault()):void i.click()}this.getBoolAttr("selectable")&&this.select(Number(e.dataset.index))},this._list.addEventListener("click",this._onClick)}teardownEvents(){this._list?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}select(t){const e=this._step(t-1);if(!e)return!1;const i=this.emit("nk-select",{index:t,value:e.value??e.label,step:e});return i&&(this.current=t),i}get steps(){return this._items()}set steps(t){this._steps=Array.isArray(t)?t:null,this._list&&this._sync()}get current(){const t=parseInt(this.getAttribute("current"),10);return Number.isFinite(t)?t:1}set current(t){this.setAttribute("current",String(t))}get selectable(){return this.getBoolAttr("selectable")}set selectable(t){this.setBoolAttr("selectable",t)}get horizontal(){return this.getBoolAttr("horizontal")}set horizontal(t){this.setBoolAttr("horizontal",t)}next(){return this.current=Math.min(this.current+1,this._items().length+1),this.current}}customElements.define("nk-steps",le);class he extends v{static get observedAttributes(){return["href","title","desc","favicon","cover","target","url"]}render(){this.takeTitle(),this._a=this.createElement("a",["nk-bookmark"]),this._wrapper.appendChild(this._a),this._sync()}_sync(){if(!this._a)return;const t=this.getAttribute("href")||"";this._a.setAttribute("href",t);const e=this.getAttribute("target")||"_blank";this._a.setAttribute("target",e),"_blank"===e?this._a.setAttribute("rel","noopener"):this._a.removeAttribute("rel");let i=t;try{i=new URL(t,location.href).host}catch{}const n=this.createElement("span",["bm-text"]),s=this.createElement("span",["bm-title"]);s.textContent=this._titleText||i,n.appendChild(s);const r=this.getAttribute("desc");if(r){const t=this.createElement("span",["bm-desc"]);t.textContent=r,n.appendChild(t)}const o=this.createElement("span",["bm-url"]),a=this.getAttribute("favicon");a&&o.appendChild(this.createElement("img",["bm-favicon"],{src:a,alt:""}));const l=document.createElement("span");l.textContent=this.getAttribute("url")||t,o.appendChild(l),n.appendChild(o);const h=[n],c=this.getAttribute("cover");if(c){const t=this.createElement("span",["bm-cover"]);t.appendChild(this.createElement("img",[],{src:c,alt:""})),h.push(t)}this._a.replaceChildren(...h)}onAttributeChanged(t,e,i){("title"!==t||this.takeTitle(i))&&this._sync()}focus(t){this._a?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._sync()}get href(){return this.getAttribute("href")||""}set href(t){this.setAttribute("href",t)}}customElements.define("nk-bookmark",he);const ce={copy:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 9V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4"/><rect x="9" y="9" width="12" height="12" rx="2"/></svg>',copied:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>',show:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg>',hide:'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/><path d="m3 3 18 18"/></svg>'},de="function"==typeof matchMedia?matchMedia("(max-width: 860px)"):null;class pe extends v{static get observedAttributes(){return["value","mono","wrap","wide","secret","icons","copy-label","copied-label","show-label","hide-label"]}render(){this._val??=this.getAttribute("value")??"",this._box=this.createElement("div",["nk-copy-field"]),this._text=this.createElement("span",["cf-value"]),this._show=this.createElement("button",["cf-btn"],{type:"button"}),this._copy=this.createElement("button",["cf-btn"],{type:"button"}),this._box.append(this._text,this._copy),this._wrapper.appendChild(this._box),this._sync()}_sync(){if(!this._box)return;for(const t of["mono","wrap","wide","icons"])this._box.classList.toggle(t,this.getBoolAttr(t));const t=this.getBoolAttr("secret");this._text.textContent=t&&!this._revealed?"โ€ข".repeat(Math.min(this._val.length,24)):this._val,t&&!this._show.isConnected&&this._copy.before(this._show),t||this._show.remove();const e=this.getBoolAttr("icons")||!!de?.matches;this._button(this._show,this._revealed?"hide":"show",this._revealed?this.getAttribute("hide-label")||this.str("hide"):this.getAttribute("show-label")||this.str("show"),e),this._show.setAttribute("aria-pressed",String(!!this._revealed)),this._button(this._copy,this._copied?"copied":"copy",this._copied?this.getAttribute("copied-label")||this.str("copied"):this.getAttribute("copy-label")||this.str("copy"),e),this._copy.classList.toggle("copied",!!this._copied)}_button(t,e,i,n){t.dataset.icon!==e&&(t.innerHTML=`${ce[e]}<span></span>`,t.dataset.icon=e),t.lastChild.textContent=i,t.setAttribute("aria-label",i),n?t.setAttribute("data-tooltip",i):t.removeAttribute("data-tooltip")}setupEvents(){this._onCopy=()=>this.copy(),this._onShow=()=>{this._revealed=!this._revealed,this._sync()},this._onPhone=()=>this._sync(),this._copy.addEventListener("click",this._onCopy),this._show.addEventListener("click",this._onShow),de?.addEventListener("change",this._onPhone)}teardownEvents(){this._copy?.removeEventListener("click",this._onCopy),this._show?.removeEventListener("click",this._onShow),de?.removeEventListener("change",this._onPhone),clearTimeout(this._timer)}onStringsChanged(){this._sync()}onAttributeChanged(t,e,i){"value"===t&&(this._val=i??""),this._sync()}async copy(){const t=this._val;let e=!0;try{await navigator.clipboard.writeText(t)}catch{e=!1}return e?(this._copied=!0,clearTimeout(this._timer),this._timer=setTimeout(()=>{this._copied=!1,this._sync()},1500)):this._revealed=!0,this._sync(),e||getSelection()?.selectAllChildren(this._text),this.emit("nk-action",{action:"copy",value:t,ok:e}),e}get value(){return this._val??this.getAttribute("value")??""}set value(t){this._val=null==t?"":String(t),this._sync()}get secret(){return this.getBoolAttr("secret")}set secret(t){this.setBoolAttr("secret",t)}get icons(){return this.getBoolAttr("icons")}set icons(t){this.setBoolAttr("icons",t)}}function ue(t){const e=t.slice(t.indexOf(",")+1),i=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(3*e.length/4)-i}customElements.define("nk-copy-field",pe);class ge extends v{static get observedAttributes(){return["src","initials","square","label","max","type","quality","accept","choose-label","change-label","remove-label"]}render(){this._src??=this.getAttribute("src")||"",this._row=this.createElement("div",["nk-profile-row"],{role:"group"}),this._avatar=this.createElement("div",["big-avatar"]);const t=this.createElement("div",["pr-actions"]);this._choose=this.createElement("button",["nk-btn","secondary","small"],{type:"button"}),this._remove=this.createElement("button",["nk-btn","secondary","small","pr-remove"],{type:"button"}),this._input=this.createElement("input",[],{type:"file",tabindex:"-1"}),this._input.hidden=!0,t.append(this._choose,this._remove,this._input),this._row.append(this._avatar,t),this._wrapper.appendChild(this._row),this._sync()}get _max(){return Math.max(1,Math.floor(Number(this.getAttribute("max")))||512)}get _type(){return this.getAttribute("type")||"image/jpeg"}get _quality(){const t=Number(this.getAttribute("quality"));return this.hasAttribute("quality")&&t>=0&&t<=1?t:.82}_sync(){if(!this._row)return;this._avatar.classList.toggle("square",this.getBoolAttr("square")),this._src?this._img&&this._img.getAttribute("src")===this._src||(this._img=this.createElement("img",[],{src:this._src,alt:""}),this._avatar.replaceChildren(this._img)):(this._img=null,this._avatar.textContent=this.getAttribute("initials")||"");const t=this.getAttribute("label");t?this._row.setAttribute("aria-label",t):this._row.removeAttribute("aria-label"),this._choose.textContent=this._src?this.getAttribute("change-label")||this.str("changeImage"):this.getAttribute("choose-label")||this.str("uploadImage"),this._remove.textContent=this.getAttribute("remove-label")||this.str("remove"),this._remove.hidden=!this._src,this._input.accept=this.getAttribute("accept")||"image/*"}async _pick(t){if(t)try{const e=await createImageBitmap(t,{imageOrientation:"from-image"}),i=Math.min(1,this._max/Math.max(e.width,e.height)),n=document.createElement("canvas");n.width=Math.max(1,Math.round(e.width*i)),n.height=Math.max(1,Math.round(e.height*i));const s=n.getContext("2d");"image/jpeg"===this._type&&(s.fillStyle="#fff",s.fillRect(0,0,n.width,n.height)),s.drawImage(e,0,0,n.width,n.height),e.close();const r=n.toDataURL(this._type,this._quality);this.src=r,this.emit("nk-change",{dataUrl:r,width:n.width,height:n.height,size:ue(r)})}catch(e){this.emit("nk-error",{message:e?.message||String(e),name:t.name})}}setupEvents(){this._onChoose=()=>this._input.click(),this._onChange=t=>{const e=t.target.files?.[0];t.target.value="",this._pick(e)},this._onRemove=()=>{this.src="",this._choose.focus(),this.emit("nk-change",{dataUrl:"",width:0,height:0,size:0})},this._choose.addEventListener("click",this._onChoose),this._input.addEventListener("change",this._onChange),this._remove.addEventListener("click",this._onRemove)}teardownEvents(){this._choose?.removeEventListener("click",this._onChoose),this._input?.removeEventListener("change",this._onChange),this._remove?.removeEventListener("click",this._onRemove)}onStringsChanged(){this._sync()}onAttributeChanged(t,e,i){"src"===t&&(this._src=i||""),this._sync()}choose(){this._input?.click()}get src(){return this._src??this.getAttribute("src")??""}set src(t){this._src=t||"",this._sync()}get square(){return this.getBoolAttr("square")}set square(t){this.setBoolAttr("square",t)}}customElements.define("nk-image-picker",ge);const be=t=>String(t).padStart(2,"0"),me=t=>`${t.getFullYear()}-${be(t.getMonth()+1)}-${be(t.getDate())}`,ke=(t,e)=>new Date(t.getFullYear(),t.getMonth(),t.getDate()+e);function _e(t){if(t instanceof Date)return Number.isNaN(t.getTime())?null:new Date(t.getFullYear(),t.getMonth(),t.getDate());if(t&&"object"==typeof t)return t.start?_e(t.start):null;const e=String(t??"").trim();let i=e.match(/^(\d{4})-(\d{2})-(\d{2})/);return i?new Date(+i[1],+i[2]-1,+i[3]):(i=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/),i?new Date(+i[3],+i[2]-1,+i[1]):null)}function ve(t){const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));return e.setUTCDate(e.getUTCDate()+4-(e.getUTCDay()||7)),Math.ceil(((e-Date.UTC(e.getUTCFullYear(),0,1))/864e5+1)/7)}const xe=t=>t||document.documentElement.lang||navigator.language||"en";function fe(t){try{const e=new Intl.Locale(t),i=e.getWeekInfo?.()??e.weekInfo;if(i?.firstDay)return i.firstDay%7}catch{}return 1}function ye(t,e,i=0){const n=new Intl.DateTimeFormat(t,{weekday:"short"});return Array.from({length:7},(t,s)=>{const r=n.format(new Date(2026,5,7+(e+s)%7)).replace(".","");return i?r.slice(0,i):r})}function we(t,e){const[i,n]=t.split("-").map(Number),s=new Date(i,n-1,1),r=(s.getDay()-e+7)%7;return{m:n,first:s,day:t=>new Date(i,n-1,1-r+t),rows:Math.ceil((r+new Date(i,n,0).getDate())/7)}}function Ae(t,e){const[i,n]=t.split("-").map(Number);return me(new Date(i,n-1+e,1)).slice(0,7)}const Ee=t=>/^de\b/i.test(t)?"KW":"W",Ce='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 6l-6 6 6 6"/></svg>',Be='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>',Le={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},Se=new CSSStyleSheet;Se.replaceSync(":host([floating]) { display: block; position: fixed; top: 0; left: 0; z-index: 106; pointer-events: none; }");class ze extends x{static get hostStyles(){return Se}static get observedAttributes(){return["value","month","min","max","today","locale","week-start","weeks","weekend","range","time","clearable","days","label","today-label","prev-label","next-label","week-label","time-label","clear-label","floating","sheet","open","align","required"]}render(){this._readValue(this._pendingValue??this.getAttribute("value"));const t=this._pendingMonth||this._attrMonth();t&&(this._month=t),this._initialValue=this.getAttribute("value")??"",this._build()}_readValue(t){const e=String(t??"");if(this._start=this._end=this._day=null,this._time="",this.getBoolAttr("range")){const[t,i]=e.split("/");this._start=_e(t)?me(_e(t)):null,this._end=_e(i)?me(_e(i)):null}else _e(e)&&(this._day=me(_e(e)),this._time=e.match(/T(\d{2}:\d{2})/)?.[1]??"");const i=this._day||this._start;this._month=i?i.slice(0,7):this._month||this._attrMonth()||this._todayIso().slice(0,7),this._focus=null}_attrMonth(){const t=this.getAttribute("month");return/^\d{4}-\d{2}$/.test(t||"")?t:null}_todayIso(){return this.getAttribute("today")||me(new Date)}get value(){return this.getBoolAttr("range")?this._start?`${this._start}${this._end?`/${this._end}`:""}`:"":this._day?`${this._day}${this.getBoolAttr("time")&&this._time?`T${this._time}`:""}`:""}set value(t){this._readValue(t),this._grid?this._draw():this._pendingValue=String(t??"")}get start(){return this.getBoolAttr("range")?this._start:this._day}get end(){return this.getBoolAttr("range")?this._end:this._day}get month(){return this._month}set month(t){/^\d{4}-\d{2}$/.test(t)&&(this._month=t,this._focus=null,this._grid?this._draw():this._pendingMonth=t)}get days(){return this._days??{}}set days(t){this._days=t&&"object"==typeof t?t:{},this._grid&&this._draw()}_build(){const t=this.getBoolAttr("floating");this._cal=this.createElement("div",["nk-calendar"],{role:"group"});const e=this.createElement("div",["cal-head"]);this._title=this.createElement("div",["cal-title"],{"aria-live":"polite"}),this._todayBtn=this.createElement("button",["cal-nav"],{type:"button"}),this._prev=this.createElement("button",["cal-nav"],{type:"button"}),this._prev.innerHTML=Ce,this._next=this.createElement("button",["cal-nav"],{type:"button"}),this._next.innerHTML=Be,e.append(this._title,this._todayBtn,this._prev,this._next),this._grid=this.createElement("div",["cal-grid"]),this._foot=this.createElement("div",["cal-foot"]),this._timeInput=this.createElement("input",["nk-input"],{type:"time"}),this._clear=this.createElement("button",["cal-nav"],{type:"button"}),this._cal.append(e,this._grid),this._pop=t?this.createElement("div",["nk-pop","floating"]):null,this._pop&&this._pop.appendChild(this._cal),this._wrapper.replaceChildren(this._pop??this._cal),this._draw()}get _hasTime(){return this.getBoolAttr("time")&&!this.getBoolAttr("range")}get _locale(){return xe(this.getAttribute("locale"))}get _weekStart(){const t=Number(this.getAttribute("week-start"));return this.hasAttribute("week-start")&&Number.isInteger(t)&&t>=0&&t<=6?t:fe(this._locale)}_syncPop(){this._pop?.classList.toggle("sheet",this.getBoolAttr("sheet")),this._pop?.classList.toggle("open",this.getBoolAttr("open"))}_draw(){const t=this._locale,e=this._weekStart,i=this.getBoolAttr("weeks"),n=this.getBoolAttr("range"),s=we(this._month,e),r=this._todayIso(),o=this.getAttribute("min")||"",a=this.getAttribute("max")||"",l=new Set((this.getAttribute("weekend")||"").split(",").map(t=>t.trim()).filter(Boolean).map(Number));let h=this._days;if(!h&&this.hasAttribute("days"))try{h=JSON.parse(this.getAttribute("days"))}catch{h={}}h??={};const c=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"});this._cal.classList.toggle("weeks",i),this._syncPop();const d=this.getAttribute("label");d?this._cal.setAttribute("aria-label",d):this._cal.removeAttribute("aria-label"),this._title.textContent=new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(s.first),this._todayBtn.textContent=this.getAttribute("today-label")||this.str("today"),this._prev.setAttribute("aria-label",this.getAttribute("prev-label")||this.str("previousMonth")),this._next.setAttribute("aria-label",this.getAttribute("next-label")||this.str("nextMonth"));const p=Array.from({length:42},(t,e)=>me(s.day(e))),u=n?this._start:this._day;this._focus&&p.includes(this._focus)||(this._focus=p.includes(u)?u:`${this._month}-01`);const g=[];i&&g.push(this._head(this.getAttribute("week-label")||Ee(t)));for(const i of ye(t,e,2))g.push(this._head(i));for(let t=0;t<42;t++){const e=s.day(t),d=p[t],u=h[d]||{};if(i&&t%7==0){const t=this.createElement("span",["cal-week"],{"aria-hidden":"true"});t.textContent=ve(e),g.push(t)}const b=n&&this._start&&this._end&&d>this._start&&d<this._end,m=["cal-day",e.getMonth()!==s.m-1&&"out",(l.has(e.getDay())||u.off)&&"off",d===r&&"today",!n&&d===this._day&&"selected",n&&d===this._start&&"start",n&&d===(this._end||this._start)&&this._start&&"end",b&&"in-range"].filter(Boolean),k=this.createElement("button",m,{type:"button","data-date":d,tabindex:d===this._focus?"0":"-1","aria-pressed":String(m.includes("selected")||m.includes("start")||m.includes("end")),"aria-label":`${c.format(e)}${u.label?`, ${u.label}`:""}`});u.label&&(k.title=u.label),(o&&d<o||a&&d>a)&&k.setAttribute("aria-disabled","true"),k.textContent=e.getDate();const _=(u.marks||[]).slice(0,3);if(_.length){const t=this.createElement("span",["cal-marks"]);for(const e of _)t.appendChild(this.createElement("i",[e]));k.appendChild(t)}g.push(k)}const b=this._grid.contains(this._shadow.activeElement);this._grid.replaceChildren(...g),b&&this.focusDay();const m=this._hasTime,k=this.getBoolAttr("clearable");this._timeInput.value=this._time,this._timeInput.setAttribute("aria-label",this.getAttribute("time-label")||this.str("time")),this._clear.textContent=this.getAttribute("clear-label")||this.str("clear"),this._foot.replaceChildren(...[m&&this._timeInput,k&&this._clear].filter(Boolean)),m||k?this._cal.appendChild(this._foot):this._foot.remove(),this._syncForm()}_syncForm(){this.setFormValue(this.value),this.getBoolAttr("required")&&!this.value?this.setValidity({valueMissing:!0},"Please choose a date.",this._grid?.querySelector('[tabindex="0"]')??void 0):this.setValidity({})}_head(t){const e=this.createElement("span",["cal-wd"],{"aria-hidden":"true"});return e.textContent=t,e}_goMonth(t,e){t!==this._month&&(this._month=t,this.emit("nk-month",{month:t})),this._focus=e??null,this._draw()}_pick(t){const e=this._grid.querySelector(`[data-date="${t}"]`);if("true"===e?.getAttribute("aria-disabled"))return;const i=this.value;let n=!0;this.getBoolAttr("range")?!this._start||this._end?(this._start=t,this._end=null,n=!1):t<this._start?(this._end=this._start,this._start=t):this._end=t:this._day=t,this._focus=t,t.slice(0,7)!==this._month?this._goMonth(t.slice(0,7),t):this._draw(),n&&(this.value!==i&&this.emit("nk-change",{value:this.value,start:this.start,end:this.end,time:this._time||null}),this.getBoolAttr("floating")&&!this._hasTime&&this.close())}setupEvents(){this._onGrid=t=>{const e=t.target.closest(".cal-day");e&&this._pick(e.dataset.date)},this._onToday=()=>{const t=this._todayIso();this._goMonth(t.slice(0,7),t)},this._onPrev=()=>this._goMonth(Ae(this._month,-1)),this._onNext=()=>this._goMonth(Ae(this._month,1)),this._onKey=t=>{const e=t.target.closest?.(".cal-day");if(!e)return;const i=_e(e.dataset.date),n=this._weekStart,s=(i.getDay()-n+7)%7;let r=null;if(Le[t.key])r=ke(i,Le[t.key]);else if("Home"===t.key)r=ke(i,-s);else if("End"===t.key)r=ke(i,6-s);else if("PageUp"===t.key||"PageDown"===t.key){const e=("PageUp"===t.key?-1:1)*(t.shiftKey?12:1),n=new Date(i.getFullYear(),i.getMonth()+e+1,0).getDate();r=new Date(i.getFullYear(),i.getMonth()+e,Math.min(i.getDate(),n))}if(!r)return;t.preventDefault();const o=me(r);o.slice(0,7)!==this._month?this._goMonth(o.slice(0,7),o):(this._focus=o,this._draw())},this._onTime=()=>{this._time=this._timeInput.value,this._syncForm(),this._day&&this.emit("nk-change",{value:this.value,start:this.start,end:this.end,time:this._time||null})},this._onClear=()=>{this.value&&(this._day=this._start=this._end=null,this._time="",this._draw(),this.emit("nk-change",{value:"",start:null,end:null,time:null}))},this._onOutside=t=>{const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||(t.preventDefault(),t.stopPropagation(),this.close())},this._grid.addEventListener("click",this._onGrid),this._grid.addEventListener("keydown",this._onKey),this._todayBtn.addEventListener("click",this._onToday),this._prev.addEventListener("click",this._onPrev),this._next.addEventListener("click",this._onNext),this._timeInput.addEventListener("change",this._onTime),this._clear.addEventListener("click",this._onClear),this.getBoolAttr("open")&&document.addEventListener("click",this._onOutside,!0)}teardownEvents(){this._grid?.removeEventListener("click",this._onGrid),this._grid?.removeEventListener("keydown",this._onKey),this._todayBtn?.removeEventListener("click",this._onToday),this._prev?.removeEventListener("click",this._onPrev),this._next?.removeEventListener("click",this._onNext),this._timeInput?.removeEventListener("change",this._onTime),this._clear?.removeEventListener("click",this._onClear),oe(this),document.removeEventListener("click",this._onOutside,!0)}onStringsChanged(){this._grid&&this._draw()}onAttributeChanged(t,e,i){if("value"===t)return this._readValue(i),void this._draw();if("month"!==t){if("open"===t||"sheet"===t)return this._syncPop(),void("open"===t&&this._syncOpen());if("align"!==t){if("floating"===t)return this.teardownEvents(),this._build(),void(this.isConnected&&this.setupEvents());"range"===t&&this._readValue(this.getAttribute("value")),"days"===t&&(this._days=null),this._draw()}}else this.month=i}_syncOpen(){const t=this.getBoolAttr("open");if(this._anchor&&(this._anchor.shadowRoot?.querySelector("button, a[href]")??this._anchor).setAttribute("aria-expanded",String(t)),t)this._returnFocus=st(),this._returnFocus?.matches(":focus-visible")&&requestAnimationFrame(()=>this.focusDay()),document.addEventListener("click",this._onOutside,!0),this.getBoolAttr("floating")&&re(this,()=>this.close());else{oe(this),document.removeEventListener("click",this._onOutside,!0);const t=this._returnFocus;this._returnFocus=null;const e=st();t?.isConnected&&e&&this._shadow.contains(e)&&t.focus({preventScroll:!0})}this.emit("nk-toggle",{open:t})}resetValue(){this._readValue(this._initialValue),this._draw()}restoreValue(t){this._readValue(t),this._draw()}onFormDisabled(t){this._cal?.toggleAttribute("inert",t)}show(t){t&&(this._anchor=t,Tt(this,t,this.getAttribute("align")));const e=this.start;e&&e.slice(0,7)!==this._month&&(this._month=e.slice(0,7),this._focus=null,this._draw()),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(t){this.getBoolAttr("open")?this.close():this.show(t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}focusDay(){this._grid?.querySelector('[tabindex="0"]')?.focus()}}customElements.define("nk-calendar",ze);const Te=new Set(["nk-menu","nk-pop","nk-modal","nk-sheet","nk-dialog","nk-cmdk","nk-toast"]),De=["nk-pop","nk-modal-backdrop","nk-sheet-backdrop","nk-dialog-backdrop","nk-cmdk-backdrop"],Me=()=>matchMedia("(max-width: 860px)").matches;class Ne extends v{static get observedAttributes(){return["open","label","close-label","resizable","width","min","max","resize-label","inset"]}render(){this._backdrop=this.createElement("div",["nk-peek-backdrop"]),this._box=this.createElement("aside",["nk-peek"],{role:"dialog",tabindex:"-1"}),this._handle=this.createElement("div",["pk-resize"],{role:"separator","aria-orientation":"vertical",tabindex:"0"}),this._box.appendChild(this._handle);const t=this.createElement("div",["pk-bar"]);this._close=this.createElement("button",["nk-topbar-btn"],{type:"button"}),this._close.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 17 5-5-5-5M13 17l5-5-5-5"/></svg>',t.append(this._close,this.createElement("slot",[],{name:"actions"}));const e=this.createElement("div",["pk-body"]);e.appendChild(document.createElement("slot")),this._box.append(t,e),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncLabels(),this._syncResize(),this.hasAttribute("width")&&this._setWidth(Number(this.getAttribute("width"))),this._syncOpen()}get _min(){return Number(this.getAttribute("min"))||380}get _max(){return Number(this.getAttribute("max"))||Math.max(this._min,innerWidth-320)}get width(){return parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--nk-peek-width"))||560}set width(t){this._setWidth(Number(t))}_setWidth(t){Number.isFinite(t)&&(t=Math.round(Math.min(Math.max(t,this._min),Math.max(this._min,this._max))),document.documentElement.style.setProperty("--nk-peek-width",`${t}px`),this._handle.setAttribute("aria-valuenow",t))}_syncResize(){this._handle.hidden=!this.getBoolAttr("resizable"),this._handle.setAttribute("aria-label",this.getAttribute("resize-label")||this.str("resize")),this._handle.setAttribute("aria-valuemin",this._min),this._handle.setAttribute("aria-valuenow",Math.round(this.width))}_app(){return this.closest("nk-app")??document.querySelector("nk-app")}_syncInset(){const t=this.getBoolAttr("inset")&&this.getBoolAttr("open")&&!Me();t?this._app()?.setAttribute("peek-inset",""):this._insetApp&&this._app()?.removeAttribute("peek-inset"),this._insetApp=t}_syncLabels(){const t=this.getAttribute("label");t?this._box.setAttribute("aria-label",t):this._box.removeAttribute("aria-label"),this._close.setAttribute("aria-label",this.getAttribute("close-label")||this.str("close"))}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._syncInset(),t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=st(),Me()&&(this._modal=!0,this._box.setAttribute("aria-modal","true"),et(),this._undoInert=nt(this)),re(this,()=>this.close()),requestAnimationFrame(()=>this._box.focus({preventScroll:!0}));else{oe(this),this._modal&&(this._modal=!1,this._box.removeAttribute("aria-modal"),it(),this._undoInert?.(),this._undoInert=null);const t=st(),e=t&&(this.contains(t)||this._shadow.contains(t)||t===document.body),i=this._returnFocus;this._returnFocus=null,e&&i?.isConnected&&"function"==typeof i.focus&&i.focus({preventScroll:!0})}}setupEvents(){this._onClose=()=>this.close(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onOutside=t=>{if(!this.getBoolAttr("open")||this._shownAt>=t.timeStamp)return;const e=t.composedPath();e.includes(this)||e.some(t=>1===t.nodeType&&(Te.has(t.localName)||De.some(e=>t.classList.contains(e))))||this.close()};const t=()=>this.emit("nk-resize",{width:Math.round(this.width)});this._onResizeStart=t=>{0===t.button&&(t.preventDefault(),this._handle.setPointerCapture(t.pointerId),this._handle.classList.add("active"))},this._onResizeMove=t=>{this._handle.hasPointerCapture(t.pointerId)&&this._setWidth(innerWidth-t.clientX)},this._onResizeEnd=()=>{this._handle.classList.remove("active"),t()},this._onResizeKey=e=>{const i={ArrowLeft:16,ArrowRight:-16}[e.key];i&&(e.preventDefault(),this._setWidth(this.width+i),t())},this._onViewport=()=>this._syncInset(),this._close.addEventListener("click",this._onClose),this._backdrop.addEventListener("click",this._onBackdrop),this._handle.addEventListener("pointerdown",this._onResizeStart),this._handle.addEventListener("pointermove",this._onResizeMove),this._handle.addEventListener("lostpointercapture",this._onResizeEnd),this._handle.addEventListener("keydown",this._onResizeKey),document.addEventListener("click",this._onOutside),addEventListener("resize",this._onViewport)}teardownEvents(){this._close?.removeEventListener("click",this._onClose),this._backdrop?.removeEventListener("click",this._onBackdrop),this._handle?.removeEventListener("pointerdown",this._onResizeStart),this._handle?.removeEventListener("pointermove",this._onResizeMove),this._handle?.removeEventListener("lostpointercapture",this._onResizeEnd),this._handle?.removeEventListener("keydown",this._onResizeKey),oe(this),document.removeEventListener("click",this._onOutside),removeEventListener("resize",this._onViewport),this._insetApp&&(this._app()?.removeAttribute("peek-inset"),this._insetApp=!1),this._modal&&(this._modal=!1,it(),this._undoInert?.(),this._undoInert=null),this._wasOpen=!1}onStringsChanged(){this._syncResize(),this._syncLabels()}onAttributeChanged(t,e,i){if("width"!==t)if("inset"!==t){if("open"!==t)return this._syncLabels(),void this._syncResize();this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})}else this._syncInset();else this._setWidth(Number(i))}show(){this._shownAt=performance.now(),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.getBoolAttr("open")?this.close():this.show()}get open(){return this.getBoolAttr("open")}set open(t){t?this.show():this.close()}}customElements.define("nk-peek",Ne);class Fe extends v{static get observedAttributes(){return["open","title","wide","alert"]}render(){this.takeTitle(),this.returnValue="",this._backdrop=this.createElement("div",["nk-dialog-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-dialog"],{"aria-modal":"true",tabindex:"-1"}),this._heading=this.createElement("div",["dl-title"],{id:"title"});const t=this.createElement("div",["dl-body"],{id:"body"});t.appendChild(document.createElement("slot")),this._actions=this.createElement("div",["dl-actions"]),this._actionsSlot=this.createElement("slot",[],{name:"actions"}),this._actions.appendChild(this._actionsSlot),this._box.append(this._heading,t,this._actions),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncTitle(),this._syncMode(),this._syncOpen()}_syncTitle(){const t=this._titleText||"";this._heading.textContent=t,this._heading.hidden=!t,t?this._box.setAttribute("aria-labelledby","title"):this._box.removeAttribute("aria-labelledby")}_syncMode(){const t=this.getBoolAttr("alert");this._box.setAttribute("role",t?"alertdialog":"dialog"),t?this._box.setAttribute("aria-describedby","body"):this._box.removeAttribute("aria-describedby"),this._box.classList.toggle("wide",this.getBoolAttr("wide"))}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=this._from??st(),this._from=null,this._wasInert=this.inert,this.inert=!1,et(),this._undoInert=nt(this),re(this,()=>this.close("")),requestAnimationFrame(()=>(this.querySelector("[autofocus]")||ot(this)||this._box).focus({preventScroll:!0}));else{oe(this),it(),this._undoInert?.(),this._undoInert=null,this.inert=this._wasInert;const t=this._returnFocus;this._returnFocus=null,t?.isConnected&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close("")},this._onClick=t=>{const e=t.composedPath(),i=e.slice(0,Math.max(0,e.indexOf(this))).filter(t=>t instanceof Element&&this.contains(t)),n=i.find(t=>"nk-btn"===t.localName||"button"===t.localName);n&&"submit"!==n.getAttribute("type")&&!n.hasAttribute("disabled")&&(n.hasAttribute("data-close")?this.close(n.getAttribute("data-close")):n.hasAttribute("value")&&i.some(t=>"actions"===t.getAttribute("slot"))&&this.close(n.getAttribute("value")))},this._onSubmit=t=>{"dialog"===(t.target.getAttribute("method")||"").toLowerCase()&&(t.preventDefault(),this.close(t.submitter?.value||t.submitter?.getAttribute?.("value")||"submit"))},this._onSlot=()=>{this._actions.hidden=!this._actionsSlot.assignedElements().length},this._backdrop.addEventListener("click",this._onBackdrop),this.addEventListener("click",this._onClick),this.addEventListener("submit",this._onSubmit),this._actionsSlot.addEventListener("slotchange",this._onSlot),this._onSlot()}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),this.removeEventListener("click",this._onClick),this.removeEventListener("submit",this._onSubmit),this._actionsSlot?.removeEventListener("slotchange",this._onSlot),this._wasOpen&&(oe(this),it(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t,e,i){"title"!==t?"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncMode():this.takeTitle(i)&&this._syncTitle()}show(t){this.returnValue="",this._from=t??null,this.setBoolAttr("open",!0)}close(t=""){return!!this.getBoolAttr("open")&&(!!this.emit("nk-close",{value:t})&&(this.returnValue=t,this.setBoolAttr("open",!1),!0))}toggle(){this.getBoolAttr("open")?this.close(""):this.show()}get open(){return this.getBoolAttr("open")}set open(t){t?this.show():this.close("")}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._syncTitle()}}customElements.define("nk-dialog",Fe);const Ie=new CSSStyleSheet;Ie.replaceSync(":host { display: block; position: fixed; top: 0; left: 0; z-index: 130; pointer-events: none; }");let je=0;class Ve extends v{static get hostStyles(){return Ie}static get observedAttributes(){return["for","shortcut"]}render(){this._bubble=this.createElement("div",["nk-tooltip"],{role:"tooltip"}),this._slot=document.createElement("slot"),this._text=document.createTextNode(""),this._key=this.createElement("span",["tt-key"]),this._bubble.append(this._slot,this._text,this._key),this._wrapper.appendChild(this._bubble),this._fill(null)}get _delay(){const t=Number(this.getAttribute("delay"));return this.hasAttribute("delay")&&t>=0?t:400}_fill(t,e=this.getAttribute("shortcut")){this._slot.style.display=null==t?"":"none",this._text.data=t??"",this._bubble.classList.toggle("lines",(t??"").includes("\n")),this._key.textContent=e||"",this._key.hidden=!e}show(t,e,i){clearTimeout(this._timer),t&&(this._target=t instanceof Element?t:null,this._fill(e??null,i),this._describe(t),function(t,e,i="bottom",n=6){const s=e instanceof Element?St(e):e,r=zt(t),o=r.width,a=r.height,l=s.bottom+n,h=s.top-n-a,c="top"===i?h<8?l:h:l+a>innerHeight-8?h:l,d=Math.min(Math.max(8,(s.left+s.right)/2-o/2),innerWidth-8-o);t.style.top=`${Math.round(c-r.y)}px`,t.style.left=`${Math.round(d-r.x)}px`,t.style.right="auto"}(this,t,"top"===this.getAttribute("placement")?"top":"bottom"),this._bubble.classList.add("open"))}hide(){clearTimeout(this._timer),this._bubble?.classList.remove("open"),this._describe(null),this._target=null}get open(){return!!this._bubble?.classList.contains("open")}_describe(t){if(this._described){const t=(this._described.getAttribute("aria-describedby")||"").split(/\s+/).filter(t=>t&&t!==this.id);t.length?this._described.setAttribute("aria-describedby",t.join(" ")):this._described.removeAttribute("aria-describedby"),this._described=null}if(!(t instanceof Element)||t.getRootNode()!==this.getRootNode())return;this.id||="nk-tooltip-"+ ++je;const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);e.includes(this.id)||t.setAttribute("aria-describedby",[...e,this.id].join(" ")),this._described=t}_targetOf(t){const e=t.composedPath(),i=this.getAttribute("for");if(i){const t=this.getRootNode().getElementById?.(i);return t&&e.includes(t)?t:null}return e.find(t=>t instanceof Element&&t.hasAttribute("data-tooltip"))??null}_showFor(t){const e=this.hasAttribute("for");this.show(t,e?null:t.getAttribute("data-tooltip"),e?this.getAttribute("shortcut"):t.getAttribute("data-tooltip-key"))}setupEvents(){this._onOver=t=>{const e="touch"===t.pointerType?null:this._targetOf(t);e!==this._target&&(this.hide(),e&&(this._target=e,this._timer=setTimeout(()=>this._showFor(e),this._delay)))},this._onFocus=t=>{const e=this._targetOf(t);e&&st()?.matches(":focus-visible")&&(this.hide(),this._target=e,this._showFor(e))},this._onHide=()=>this.hide(),this._onKey=t=>{"Escape"===t.key&&this.open&&this.hide()},document.addEventListener("pointerover",this._onOver),document.addEventListener("focusin",this._onFocus),document.addEventListener("focusout",this._onHide),document.addEventListener("pointerdown",this._onHide,!0),document.addEventListener("scroll",this._onHide,!0),document.addEventListener("wheel",this._onHide,{capture:!0,passive:!0}),document.addEventListener("keydown",this._onKey)}teardownEvents(){document.removeEventListener("pointerover",this._onOver),document.removeEventListener("focusin",this._onFocus),document.removeEventListener("focusout",this._onHide),document.removeEventListener("pointerdown",this._onHide,!0),document.removeEventListener("scroll",this._onHide,!0),document.removeEventListener("wheel",this._onHide,{capture:!0}),document.removeEventListener("keydown",this._onKey),this.hide()}onAttributeChanged(t){"shortcut"!==t||this._text.data||this._fill(null),"for"===t&&this.hide()}}customElements.define("nk-tooltip",Ve);class qe extends v{static get observedAttributes(){return["open","pane"]}render(){this._backdrop=this.createElement("div",["nk-modal-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-modal"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._nav=this.createElement("nav",["nk-settings-nav"],{"aria-label":this.str("settings")}),this._nav.appendChild(this.createElement("slot",[],{name:"user"})),this._rows=document.createElement("div"),this._nav.appendChild(this._rows),this._nav.appendChild(this.createElement("slot",[],{name:"nav"})),this._content=this.createElement("div",["nk-settings-content"]),this._slot=document.createElement("slot"),this._content.appendChild(this._slot),this._box.append(this._nav,this._content),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncOpen(),this.requestNav()}get panes(){return[...this.querySelectorAll(":scope > nk-settings-pane")]}requestNav(){this._navQueued||(this._navQueued=!0,queueMicrotask(()=>{this._navQueued=!1,this._buildNav()}))}_buildNav(){if(!this._rows)return;const t=this.panes.filter(t=>t.getAttribute("label"));this._rows.replaceChildren(),this._nav.style.display=t.length||this.querySelector(':scope > [slot="nav"], :scope > [slot="user"]')?"":"none";let e=null;for(const i of t){const t=i.getAttribute("group");if(t&&t!==e){const i=this.createElement("div",["nk-section-label"]);i.textContent=t,this._rows.appendChild(i),e=t}const n=this.createElement("div",["nk-tree-item"],{role:"tab",tabindex:"0","data-pane":i.name}),s=this.createElement("span",["icon"]);s.textContent=i.getAttribute("icon")||"";const r=this.createElement("span",["label"]);r.textContent=i.getAttribute("label"),n.append(s,r),this._rows.appendChild(n)}this._syncActive()}_syncActive(){const t=this.panes;let e=this.getAttribute("pane");t.some(t=>t.name===e)||(e=(t.find(t=>t.hasAttribute("active"))||t[0])?.name??null);for(const t of this._rows.querySelectorAll("[data-pane]")){const i=t.dataset.pane===e;t.classList.toggle("active",i),t.setAttribute("aria-selected",i?"true":"false")}for(const i of t)i.active=i.name===e;this._current=e}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=st(),et(),this._undoInert=nt(this),re(this,()=>this.close()),requestAnimationFrame(()=>{(this._rows.querySelector(".nk-tree-item.active")||ot(this)||this._box).focus({preventScroll:!0})});else{oe(this),it(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onNavClick=t=>{const e=t.target.closest("[data-pane]");e&&(e.focus(),this.pane=e.dataset.pane)},this._onNavKey=t=>{const e=t.target.closest?.("[data-pane]");if(!e)return;if("Enter"===t.key||" "===t.key)return t.preventDefault(),void(this.pane=e.dataset.pane);const i={ArrowDown:1,ArrowUp:-1}[t.key];if(!i)return;const n=[...this._rows.querySelectorAll("[data-pane]")],s=n[(n.indexOf(e)+i+n.length)%n.length];t.preventDefault(),s.focus(),this.pane=s.dataset.pane},this._onSlot=()=>this.requestNav(),this._backdrop.addEventListener("click",this._onBackdrop),this._rows.addEventListener("click",this._onNavClick),this._rows.addEventListener("keydown",this._onNavKey),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),this._rows?.removeEventListener("click",this._onNavClick),this._rows?.removeEventListener("keydown",this._onNavKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._wasOpen&&(oe(this),it(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onStringsChanged(){this._nav.setAttribute("aria-label",this.str("settings"))}onAttributeChanged(t){if("open"===t)this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")});else if("pane"===t){const t=this._current;this._syncActive(),this._current!==t&&this.emit("nk-select",{value:this._current,label:this.panes.find(t=>t.name===this._current)?.getAttribute("label")??this._current})}}show(t){t&&this.setAttribute("pane",t),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get pane(){return this._current??this.getAttribute("pane")}set pane(t){this.setAttribute("pane",t)}}customElements.define("nk-modal",qe);class Oe extends v{static get observedAttributes(){return["name","label","icon","group","title","active"]}render(){this._section=this.createElement("section",["nk-settings-pane"],{role:"tabpanel"}),this._h2=document.createElement("h2"),this._section.appendChild(this._h2),this._section.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._section),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._h2.textContent=t||"",this._h2.style.display=t?"":"none",this._section.classList.toggle("active",this.getBoolAttr("active")),this._section.setAttribute("aria-label",this.getAttribute("label")||t||this.getAttribute("name")||"")}onAttributeChanged(t,e,i){("title"!==t||this.takeTitle(i))&&(this._sync(),["label","icon","group","name"].includes(t)&&this.closest("nk-modal")?.requestNav?.())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get name(){return this.getAttribute("name")??this.getAttribute("label")??""}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-settings-pane",Oe);class Pe extends v{static get observedAttributes(){return["name","mail","avatar"]}render(){const t=this.createElement("div",["nk-settings-user"]);this._avatar=this.createElement("div",["avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const i=this.createElement("div",["u-text"]);this._name=this.createElement("div",["name"]),this._mail=this.createElement("div",["mail"]),i.append(this._name,this._mail),t.append(e,i),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t;const e=this.getAttribute("mail");this._mail.textContent=e||"",this._mail.style.display=e?"":"none",this._avatar.textContent=this.getAttribute("avatar")||t.split(/\s+/).map(t=>t[0]).join("").slice(0,2).toUpperCase()}onAttributeChanged(){this._sync()}}function Ke(t,e){const i=t.trim().toLowerCase();if(!i)return 1;const n=e.toLowerCase();let s=0,r=0,o=0;for(let t=0;t<i.length;t++){const e=n.indexOf(i[t],s);if(e<0)return 0;o=e===s?o+1:0,r+=1+2*o+(0===e||/[\s\-_/.]/.test(n[e-1])?3:0)-Math.min(3,.25*(e-s)),s=e+1}return n.startsWith(i)&&(r+=10),Math.max(.01,r/(1+n.length/40))}customElements.define("nk-settings-user",Pe);class Re extends v{static get observedAttributes(){return["open","hotkey","placeholder"]}render(){this._backdrop=this.createElement("div",["nk-cmdk-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-cmdk"],{role:"dialog","aria-modal":"true"});const t=this.createElement("div",["nk-cmdk-input-row"]),e=document.createElement("span");e.style.fontSize="15px",e.textContent="๐Ÿ”",this._input=this.createElement("input",[],{type:"text",autocomplete:"off",role:"combobox","aria-expanded":"true","aria-autocomplete":"list"});const i=this.createElement("kbd",["nk-kbd"]);i.textContent="esc",t.append(e,this._input,i),this._list=this.createElement("div",["nk-cmdk-list"],{role:"listbox",id:"list"}),this._input.setAttribute("aria-controls","list"),this._footer=this.createElement("div",["nk-cmdk-footer"]);const n=this.createElement("slot",[],{name:"footer"});n.innerHTML='<span><kbd class="nk-kbd">โ†‘</kbd><kbd class="nk-kbd">โ†“</kbd> navigate</span><span><kbd class="nk-kbd">โ†ต</kbd> open</span><span><kbd class="nk-kbd">โŒ˜</kbd><kbd class="nk-kbd">K</kbd> toggle</span>',this._footer.appendChild(n),this._box.append(t,this._list,this._footer),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._commands=[],this._index=0,this._syncAttrs(),this._renderList(),this._syncOpen()}_syncAttrs(){this._input.placeholder=this.getAttribute("placeholder")||this.str("commandPlaceholder"),this._box.setAttribute("aria-label",this.str("commandPalette"))}onStringsChanged(){this._syncAttrs()}results(){const t=this._input?.value??"",e=[];for(const i of this._commands){const n=(i.items||[]).map(e=>({item:e,group:i.group,score:Ke(t,`${e.label} ${e.keywords||""}`)})).filter(t=>t.score>0);n.sort((t,e)=>e.score-t.score),e.push(...n)}return e}_renderList(){if(!this._list)return;const t=this.results();if(this._index=Math.min(this._index,Math.max(0,t.length-1)),this._list.replaceChildren(),!t.length){const t=this.createElement("div",["nk-cmdk-empty"]);return t.textContent=`No results for โ€œ${this._input.value}โ€`,this._list.appendChild(t),void this._input.removeAttribute("aria-activedescendant")}let e=null;t.forEach((t,i)=>{if(t.group&&t.group!==e){const i=this.createElement("div",["nk-cmdk-group"]);i.textContent=t.group,this._list.appendChild(i),e=t.group}const n=this.createElement("div",["nk-cmdk-item"],{role:"option",id:`opt-${i}`,"data-index":i});n.classList.toggle("selected",i===this._index),n.setAttribute("aria-selected",i===this._index?"true":"false");const s=this.createElement("span",["m-icon"]);s.textContent=t.item.icon||"";const r=document.createElement("span");if(r.textContent=t.item.label,n.append(s,r),t.item.shortcut){const e=this.createElement("span",["m-shortcut"]);e.textContent=t.item.shortcut,n.appendChild(e)}this._list.appendChild(n)}),this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}_move(t){const e=this.results().length;if(e){this._index=(this._index+t+e)%e;for(const t of this._list.querySelectorAll(".nk-cmdk-item")){const e=Number(t.dataset.index)===this._index;t.classList.toggle("selected",e),t.setAttribute("aria-selected",e?"true":"false"),e&&t.scrollIntoView({block:"nearest"})}this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}}pick(t=this._index){const e=this.results()[t];if(!e)return;const i=this._input.value;this.close();this.emit("nk-command",{id:e.item.id??e.item.label,item:e.item,query:i})&&"function"==typeof e.item.action&&e.item.action(e.item)}_matchesHotkey(t){const e=(this.getAttribute("hotkey")||"mod+k").toLowerCase().split("+"),i=e.pop(),n=!e.includes("mod")||(t.metaKey||t.ctrlKey),s=e.includes("shift")?t.shiftKey:!t.shiftKey,r=e.includes("alt")?t.altKey:!t.altKey;return n&&s&&r&&t.key.toLowerCase()===i}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=st(),this._input.value="",this._index=0,this._renderList(),et(),this._undoInert=nt(this),re(this,()=>this.close()),requestAnimationFrame(()=>this._input.focus({preventScroll:!0}));else{oe(this),it(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onDocKey=t=>{this._matchesHotkey(t)&&(t.preventDefault(),this.toggle())},this._onInput=()=>{this._index=0,this._renderList()},this._onInputKey=t=>{"ArrowDown"===t.key?(t.preventDefault(),this._move(1)):"ArrowUp"===t.key?(t.preventDefault(),this._move(-1)):"Enter"===t.key&&(t.preventDefault(),this.pick())},this._onListClick=t=>{const e=t.target.closest(".nk-cmdk-item");e&&this.pick(Number(e.dataset.index))},this._onListMove=t=>{const e=t.target.closest(".nk-cmdk-item");e&&Number(e.dataset.index)!==this._index&&(this._index=Number(e.dataset.index),this._move(0))},this._onListDown=t=>t.preventDefault(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},document.addEventListener("keydown",this._onDocKey),this._input.addEventListener("input",this._onInput),this._input.addEventListener("keydown",this._onInputKey),this._list.addEventListener("click",this._onListClick),this._list.addEventListener("mousemove",this._onListMove),this._list.addEventListener("mousedown",this._onListDown),this._backdrop.addEventListener("click",this._onBackdrop)}teardownEvents(){document.removeEventListener("keydown",this._onDocKey),this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("keydown",this._onInputKey),this._list?.removeEventListener("click",this._onListClick),this._list?.removeEventListener("mousemove",this._onListMove),this._list?.removeEventListener("mousedown",this._onListDown),this._backdrop?.removeEventListener("click",this._onBackdrop),this._wasOpen&&(oe(this),it(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t){"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncAttrs()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get commands(){return this._commands}set commands(t){this._commands=Array.isArray(t)?t:[],this._index=0,this._renderList()}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get query(){return this._input?.value??""}set query(t){this._input&&(this._input.value=t,this._index=0,this._renderList())}}customElements.define("nk-cmdk",Re);const $e=new CSSStyleSheet;$e.replaceSync(":host([floating]) { display: block; position: fixed; top: 0; left: 0; z-index: 106; pointer-events: none; }");class He extends v{static get hostStyles(){return $e}static get observedAttributes(){return["floating","sheet","open","align"]}render(){this._box=this.createElement("div",["nk-pop","nk-menu"],{role:"menu"}),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._syncMode()}_syncMode(){this._box.classList.toggle("floating",this.getBoolAttr("floating")),this._box.classList.toggle("sheet",this.getBoolAttr("sheet")),this._box.classList.toggle("open",this.getBoolAttr("open"))}onAttributeChanged(t){if(this._syncMode(),"open"!==t)return;const e=this.getBoolAttr("open");if(this._anchor&&(this._anchor.shadowRoot?.querySelector("button, a[href]")??this._anchor).setAttribute("aria-expanded",String(e)),e)this._returnFocus=st(),this._returnFocus?.matches(":focus-visible")&&requestAnimationFrame(()=>this.focusFirst()),document.addEventListener("click",this._onOutside,!0),this.getBoolAttr("floating")&&(re(this,()=>this.close()),this._scrollToStart());else{oe(this),document.removeEventListener("click",this._onOutside,!0);const t=this._returnFocus;this._returnFocus=null;const e=st();t?.isConnected&&e&&(rt(this,e)||e===document.body)&&t.focus({preventScroll:!0})}this.emit("nk-toggle",{open:e})}_scrollToStart(){this._box.scrollTop=0;const t=this.items.find(t=>t.hasAttribute("checked"))?.shadowRoot?.querySelector(".nk-menu-item");if(!t)return;const e=this._box.getBoundingClientRect(),i=t.getBoundingClientRect();i.bottom>e.bottom&&(this._box.scrollTop+=i.top-e.top-(e.height-i.height)/2)}show(t){t&&(this._anchor=t,Tt(this,t,this.getAttribute("align"))),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(t){this.getBoolAttr("open")?this.close():this.show(t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get items(){return[...this.querySelectorAll(":scope > nk-menu-item")].filter(t=>t.selectable)}setupEvents(){this._onKey=t=>{const e={ArrowDown:1,ArrowUp:-1}[t.key],i=t.target.closest?.("nk-menu-item"),n=this.items;if(n.length)if(e){t.preventDefault();const s=n.indexOf(i);n[(s+e+n.length)%n.length].focus()}else"Enter"!==t.key&&" "!==t.key||!i||(t.preventDefault(),i.select())},this.addEventListener("keydown",this._onKey),this._onOutside=t=>{const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||(t.preventDefault(),t.stopPropagation(),this.close())},this._onSelect=()=>{this.getBoolAttr("floating")&&this.close()},this.addEventListener("nk-select",this._onSelect),this.getBoolAttr("open")&&document.addEventListener("click",this._onOutside,!0)}teardownEvents(){this.removeEventListener("keydown",this._onKey),oe(this),this.removeEventListener("nk-select",this._onSelect),document.removeEventListener("click",this._onOutside,!0)}focusFirst(){this.items[0]?.focus()}}customElements.define("nk-menu",He);class We extends v{static get observedAttributes(){return["icon","shortcut","danger","value","type","disabled","checked"]}render(){this._build()}_build(){const t=this.getAttribute("type");let e;if("separator"===t)e=this.createElement("div",["nk-menu-sep"],{role:"separator"});else if("label"===t)e=this.createElement("div",["nk-menu-label"]),e.appendChild(document.createElement("slot"));else{const i="switch"===t;this._check="check"===t,e=this.createElement("div",["nk-menu-item"],{role:i||this._check?"menuitemcheckbox":"menuitem",tabindex:"-1"}),this._icon=this.createElement("span",["m-icon"]);const n=this.createElement("slot",[],{name:"icon"});n.appendChild(this._icon),this._shortcut=this.createElement("span",["m-shortcut"]),e.append(n,document.createElement("slot"),this._shortcut),this._switch=i?this.createElement("span",["nk-switch"],{"aria-hidden":"true"}):null,this._switch&&e.appendChild(this._switch)}this._el?(this._el.removeEventListener("click",this._onClick),this._el.replaceWith(e)):this._wrapper.appendChild(e),this._el=e,this._onClick&&e.addEventListener("click",this._onClick),this._sync()}_sync(){if(!this._el.classList.contains("nk-menu-item"))return;const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none";const e=this.getAttribute("shortcut");if(this._shortcut.textContent=e||"",this._shortcut.style.display=e?"":"none",this._el.classList.toggle("danger",this.getBoolAttr("danger")),this._el.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._switch||this._check){const t=this.getBoolAttr("checked")?"true":"false";this._el.setAttribute("aria-checked",t),this._switch&&this._switch.setAttribute("aria-checked",t),this._check&&(this._shortcut.textContent="true"===t?"โœ“":"",this._shortcut.style.display="")}}setupEvents(){this._onClick=()=>this.select(),this._el.addEventListener("click",this._onClick)}teardownEvents(){this._el?.removeEventListener("click",this._onClick)}select(){if(this._el.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled"))return this._switch||this._check?(this.checked=!this.checked,void this.emit("nk-change",{value:this.value,checked:this.checked,item:this})):void this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this})}onAttributeChanged(t){"type"===t?this._build():this._sync()}focus(t){this._el?.focus(t)}get selectable(){return this._el?.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled")}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-menu-item",We);const Ue=new CSSStyleSheet;Ue.replaceSync('\n .nk-pop-anchor { position: relative; display: inline-block; }\n .nk-pop-float { display: none; position: absolute; z-index: 50; top: 100%; left: 0; margin-top: 4px; }\n :host([open]) .nk-pop-float { display: block; }\n :host([placement="bottom-end"]) .nk-pop-float { left: auto; right: 0; }\n :host([placement="top-start"]) .nk-pop-float { top: auto; bottom: 100%; margin: 0 0 4px; }\n :host([placement="top-end"]) .nk-pop-float { top: auto; bottom: 100%; left: auto; right: 0; margin: 0 0 4px; }\n');const Ge=new Set(["nk-menu","nk-emoji-picker"]);class Ye extends v{static get hostStyles(){return Ue}static get observedAttributes(){return["open","placement","bare"]}render(){const t=this.createElement("div",["nk-pop-anchor"]);this._triggerSlot=this.createElement("slot",[],{name:"trigger"}),this._float=this.createElement("div",["nk-pop-float"]),this._surface=this.createElement("div",["nk-pop"]),this._slot=document.createElement("slot"),this._surface.appendChild(this._slot),this._float.appendChild(this._surface),t.append(this._triggerSlot,this._float),this._wrapper.appendChild(t),this._syncSurface()}_syncSurface(){const t=this.getBoolAttr("bare")||this._slot.assignedElements().some(t=>Ge.has(t.localName));this._surface.className=t?"":"nk-pop"}setupEvents(){this._onTrigger=t=>{t.composedPath().some(t=>t instanceof Element&&"trigger"===t.getAttribute?.("slot"))&&(t.stopPropagation(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onSelect=t=>{t.target!==this&&this.close()},this._onSlot=()=>this._syncSurface(),this.addEventListener("click",this._onTrigger),document.addEventListener("click",this._onDocClick),this._float.addEventListener("nk-select",this._onSelect),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this.removeEventListener("click",this._onTrigger),document.removeEventListener("click",this._onDocClick),oe(this),this._float?.removeEventListener("nk-select",this._onSelect),this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("bare"===t&&this._syncSurface(),"open"===t){const t=this.getBoolAttr("open");t?re(this,()=>this.close()):oe(this);for(const e of this._triggerSlot.assignedElements())e.setAttribute("aria-expanded",t?"true":"false");this.emit("nk-toggle",{open:t})}}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get placement(){return this.getAttribute("placement")||"bottom-start"}set placement(t){this.setAttribute("placement",t)}}customElements.define("nk-pop",Ye);const Qe=(t,e,i)=>i.map(([i,n])=>({char:i,name:n,cat:t,icon:e})),Ze=[{id:"smileys",icon:"๐Ÿ˜€"},{id:"people",icon:"๐Ÿ‘‹"},{id:"nature",icon:"๐ŸŒฟ"},{id:"food",icon:"โ˜•"},{id:"activity",icon:"๐ŸŽฏ"},{id:"travel",icon:"๐Ÿš€"},{id:"objects",icon:"๐Ÿ’ก"},{id:"symbols",icon:"โœ…"}],Xe=[...Qe("smileys","๐Ÿ˜€",[["๐Ÿ˜€","grinning"],["๐Ÿ˜Š","smile blush"],["๐Ÿ˜‚","joy laugh"],["๐Ÿ™‚","slight smile"],["๐Ÿ˜‰","wink"],["๐Ÿ˜","heart eyes love"],["๐Ÿค”","thinking"],["๐Ÿ˜Ž","cool sunglasses"],["๐Ÿฅณ","party"],["๐Ÿ˜ด","sleep"],["๐Ÿคฏ","mind blown"],["๐Ÿ˜…","sweat smile"],["๐Ÿ™ƒ","upside down"],["๐Ÿ˜‡","angel halo"],["๐Ÿค—","hug"],["๐Ÿ˜ข","cry sad"]]),...Qe("people","๐Ÿ‘‹",[["๐Ÿ‘‹","wave hello"],["๐Ÿ‘","thumbs up"],["๐Ÿ‘Ž","thumbs down"],["๐Ÿ™","pray thanks"],["๐Ÿ‘","clap"],["๐Ÿค","handshake deal"],["๐Ÿ’ช","strong"],["๐Ÿ‘€","eyes look"],["๐Ÿง ","brain knowledge"],["โค๏ธ","heart love"],["๐Ÿ‘ค","person user"],["๐Ÿ‘ฅ","people team members"],["๐Ÿง‘โ€๐Ÿ’ป","developer"],["๐Ÿ™‹","raise hand"],["โœ๏ธ","writing"],["๐Ÿซถ","heart hands"]]),...Qe("nature","๐ŸŒฟ",[["๐ŸŒฟ","leaf herb"],["๐ŸŒฑ","seedling"],["๐ŸŒณ","tree"],["๐ŸŒธ","blossom flower"],["๐ŸŒž","sun"],["๐ŸŒ™","moon night"],["โญ","star"],["๐Ÿ”ฅ","fire hot"],["๐ŸŒˆ","rainbow"],["๐ŸŒŠ","wave water"],["๐Ÿ€","clover luck"],["๐Ÿ","bee"],["๐Ÿฆ‹","butterfly"],["๐Ÿข","turtle"],["๐ŸŒ","earth globe"],["โ„๏ธ","snow"]]),...Qe("food","โ˜•",[["โ˜•","coffee"],["๐Ÿต","tea"],["๐ŸŽ","apple"],["๐Ÿ•","pizza"],["๐Ÿฐ","cake"],["๐Ÿช","cookie"],["๐Ÿฅ","croissant"],["๐Ÿ”","burger"],["๐Ÿœ","noodles"],["๐Ÿบ","beer"],["๐Ÿท","wine"],["๐Ÿฅ—","salad"],["๐Ÿซ","chocolate"],["๐Ÿ“","strawberry"],["๐Ÿฅ‘","avocado"],["๐Ÿฉ","donut"]]),...Qe("activity","๐ŸŽฏ",[["๐ŸŽฏ","target goal"],["๐Ÿ†","trophy win"],["๐ŸŽ‰","tada celebration"],["๐ŸŽจ","art palette design"],["๐ŸŽ™๏ธ","microphone podcast voice"],["๐ŸŽฌ","clapper movie"],["๐ŸŽฎ","game"],["โšฝ","football"],["๐Ÿƒ","run"],["๐Ÿง˜","yoga calm"],["๐ŸŽต","music"],["๐ŸŽฒ","dice"],["๐Ÿ","finish flag"],["๐ŸŽ“","graduation learn"],["๐Ÿงฉ","puzzle piece"],["๐Ÿ”","repeat retro"]]),...Qe("travel","๐Ÿš€",[["๐Ÿš€","rocket launch"],["โœˆ๏ธ","plane travel"],["๐Ÿš—","car"],["๐Ÿšฒ","bike"],["๐Ÿ ","house home"],["๐Ÿข","office building"],["๐Ÿ—บ๏ธ","map"],["๐Ÿงญ","compass"],["โ›ฐ๏ธ","mountain"],["๐Ÿ–๏ธ","beach"],["๐Ÿš‰","station"],["๐Ÿ›ฐ๏ธ","satellite"],["๐ŸŒ†","city"],["๐Ÿ•๏ธ","camping"],["โ›ต","sailboat"],["๐Ÿ›ซ","departure"]]),...Qe("objects","๐Ÿ’ก",[["๐Ÿ’ก","idea bulb"],["๐Ÿ“Š","chart bar"],["๐Ÿ“ˆ","chart up"],["๐Ÿ“…","calendar date"],["๐Ÿ“„","page document"],["๐Ÿ“","folder"],["๐Ÿ—ƒ๏ธ","card box database"],["๐Ÿ“Œ","pin"],["๐Ÿ”","search"],["๐Ÿ› ๏ธ","tools"],["โš™๏ธ","gear settings"],["๐Ÿ””","bell notification"],["๐Ÿ’Ž","gem diamond"],["๐Ÿ“","memo notes"],["๐Ÿ“Ž","paperclip files"],["๐Ÿ”’","lock secure"],["๐Ÿ’ฌ","speech comment"],["๐Ÿ“ค","export outbox"],["๐Ÿ“ฅ","inbox"],["๐Ÿ—‘๏ธ","trash bin"],["๐Ÿ–ฅ๏ธ","desktop"],["๐Ÿ“ฑ","phone"],["๐Ÿ’ป","laptop"],["๐Ÿงพ","receipt"]]),...Qe("symbols","โœ…",[["โœ…","check done"],["โœจ","sparkles ai magic"],["โŒ","cross no"],["โš ๏ธ","warning"],["โ„น๏ธ","info"],["โ“","question"],["โž•","plus add"],["โžก๏ธ","arrow right"],["๐Ÿ”ด","red circle"],["๐ŸŸข","green circle"],["๐ŸŸก","yellow circle"],["๐Ÿ”ต","blue circle"],["โณ","hourglass wait"],["โ™ป๏ธ","recycle"],["๐Ÿ†•","new"],["๐Ÿ’ฏ","hundred"]])];class Je extends v{static get observedAttributes(){return["placeholder","value"]}render(){this._box=this.createElement("div",["nk-pop"]),this._search=this.createElement("input",["nk-emoji-search"],{type:"search",autocomplete:"off"}),this._grid=this.createElement("div",["nk-emoji-grid"],{role:"listbox"}),this._cats=this.createElement("div",["nk-emoji-cats"],{role:"tablist"}),this._box.append(this._search,this._grid,this._cats),this._wrapper.appendChild(this._box),this._emojis=Xe,this._cat=Ze[0].id,this._renderCats(),this._renderGrid(),this._syncAttrs()}_syncAttrs(){this._search.placeholder=this.getAttribute("placeholder")||this.str("emojiPlaceholder"),this._search.setAttribute("aria-label",this.str("searchEmoji"))}onStringsChanged(){this._syncAttrs()}_renderCats(){this._cats.replaceChildren();const t=this._categories();for(const e of t){const t=this.createElement("span",[],{role:"tab","data-cat":e.id,title:e.id});t.textContent=e.icon,t.classList.toggle("active",e.id===this._cat),this._cats.appendChild(t)}this._cats.style.display=t.length>1?"":"none"}_categories(){if(this._catList)return this._catList;const t=new Map;for(const e of this._emojis)e.cat&&!t.has(e.cat)&&t.set(e.cat,{id:e.cat,icon:e.icon||Ze.find(t=>t.id===e.cat)?.icon||e.char});return[...t.values()]}_renderGrid(){const t=this._search.value.trim().toLowerCase(),e=t?this._emojis.filter(e=>(e.name||"").toLowerCase().includes(t)||e.char===t):this._emojis.filter(t=>!t.cat||t.cat===this._cat);this._grid.replaceChildren();for(const t of e.slice(0,64)){const e=this.createElement("span",[],{role:"option",title:t.name||"","data-emoji":t.char});e.textContent=t.char,this._grid.appendChild(e)}for(const e of this._cats.children)e.classList.toggle("active",!t&&e.dataset.cat===this._cat)}setupEvents(){this._onInput=()=>this._renderGrid(),this._onGrid=t=>{const e=t.target.closest("[data-emoji]");e&&this.select(e.dataset.emoji)},this._onCats=t=>{const e=t.target.closest("[data-cat]");e&&(this._cat=e.dataset.cat,this._search.value="",this._renderGrid())},this._onKey=t=>{if("Enter"===t.key){const t=this._grid.querySelector("[data-emoji]");t&&this.select(t.dataset.emoji)}},this._search.addEventListener("input",this._onInput),this._search.addEventListener("keydown",this._onKey),this._grid.addEventListener("click",this._onGrid),this._cats.addEventListener("click",this._onCats)}teardownEvents(){this._search?.removeEventListener("input",this._onInput),this._search?.removeEventListener("keydown",this._onKey),this._grid?.removeEventListener("click",this._onGrid),this._cats?.removeEventListener("click",this._onCats)}select(t){this.setAttribute("value",t),this.emit("nk-select",{emoji:t,value:t})}onAttributeChanged(){this._syncAttrs()}focus(t){this._search?.focus(t)}get categories(){return this._categories()}set categories(t){this._catList=Array.isArray(t)&&t.length?t:null,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get emojis(){return this._emojis}set emojis(t){this._emojis=Array.isArray(t)?t:Xe,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-emoji-picker",Je);class ti extends v{static get observedAttributes(){return["open","duration","icon"]}render(){this._box=this.createElement("div",["nk-toast"],{role:"status","aria-live":"polite"}),this._icon=document.createElement("span"),this._msg=document.createElement("span"),this._action=this.createElement("button",["t-action"],{type:"button"}),this._actionSlot=this.createElement("slot",[],{name:"action"}),this._close=this.createElement("button",["t-close"],{type:"button"}),this._close.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg>',this._box.append(this._icon,this._msg,document.createElement("slot"),this._actionSlot),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getBoolAttr("open");t&&this._lift(),this._box.classList.toggle("show",t);const e=this.getAttribute("icon")??"โœ“";this._icon.textContent=e,this._icon.style.display=e?"":"none",this._msg.style.display=this._msg.textContent?"":"none";const i=this._act,n=this._slotted();i?(this._action.textContent=i.label,this._action.isConnected||this._actionSlot.before(this._action)):this._action.remove(),i||n?this._close.isConnected||this._box.appendChild(this._close):this._close.remove(),this._close.setAttribute("aria-label",this.str("close"));for(const e of[this._action,this._close])t?e.removeAttribute("tabindex"):e.setAttribute("tabindex","-1")}_slotted(){return this._actionSlot?.assignedElements()[0]??null}_lift(){const t=[...document.querySelectorAll(".nk-tab-bar")];for(const e of document.querySelectorAll("nk-tab-bar")){const i=e.shadowRoot?.querySelector(".nk-tab-bar");i&&t.push(i)}const e=t.map(t=>t.getBoundingClientRect()).find(t=>t.height>0&&t.top<innerHeight&&t.bottom>innerHeight-60);this._box.style.bottom=e?`${Math.round(innerHeight-e.top+12)}px`:""}show(t,{duration:e,action:i}={}){void 0!==t&&(this._msg.textContent=t),this._shown=(this._shown??0)+1,this._act=i?{label:String(i.label??i.value??""),value:i.value??i.label}:null;const n=this.getAttribute("duration"),s=null!==n&&""!==n.trim()&&Number.isFinite(Number(n));this._ms=e??(this._act||this._slotted()?0:s?Number(n):2200),this.getBoolAttr("open")?this._sync():this.setBoolAttr("open",!0),this._arm()}close(){clearTimeout(this._timer);const t=st();t&&rt(this,t)&&(this._from?.isConnected&&this._from.focus({preventScroll:!0}),rt(this,st())&&t.blur()),this._from=null,this.setBoolAttr("open",!1)}_arm(){clearTimeout(this._timer),this._ms>0&&!this._held&&this.getBoolAttr("open")&&(this._timer=setTimeout(()=>this.close(),this._ms))}_take(t){if(!t)return;const e=this._shown;this.emit("nk-action",{action:t.value,value:t.value,label:t.label})&&this._shown===e&&this.close()}setupEvents(){this._onClick=t=>{const e=t.composedPath();if(e.includes(this._close))return void this.close();if(e.includes(this._action))return void this._take(this._act);const i=this._slotted();i&&e.includes(i)&&this._take({value:i.value||i.getAttribute("value")||i.textContent.trim(),label:i.textContent.trim()})},this._onHold=t=>{"focusin"!==t.type||this._from||(this._from=t.relatedTarget??null),this._held=!0,clearTimeout(this._timer)},this._onRelease=t=>{t.relatedTarget&&rt(this,t.relatedTarget)||(this._held=!1,this._arm())},this._onKey=t=>{"Escape"===t.key&&(t.stopPropagation(),this.close())},this._onSlot=()=>this._sync(),this._box.addEventListener("click",this._onClick),this._box.addEventListener("pointerover",this._onHold),this._box.addEventListener("pointerout",this._onRelease),this._box.addEventListener("focusin",this._onHold),this._box.addEventListener("focusout",this._onRelease),this._box.addEventListener("keydown",this._onKey),this._actionSlot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this._box?.removeEventListener("click",this._onClick),this._box?.removeEventListener("pointerover",this._onHold),this._box?.removeEventListener("pointerout",this._onRelease),this._box?.removeEventListener("focusin",this._onHold),this._box?.removeEventListener("focusout",this._onRelease),this._box?.removeEventListener("keydown",this._onKey),this._actionSlot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._timer)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get message(){return this._msg?.textContent??""}set message(t){this._msg&&(this._msg.textContent=t,this._sync())}onStringsChanged(){this._box&&this._sync()}}customElements.define("nk-toast",ti);class ei extends v{static get observedAttributes(){return["view","add-view"]}render(){this._box=this.createElement("div",["nk-database"]),this._toolbar=this.createElement("div",["nk-db-toolbar"]),this._tabs=this.createElement("div",["nk-db-tabs"],{role:"tablist"});const t=this.createElement("div",["tools"]);this._toolsSlot=this.createElement("slot",[],{name:"tools"}),t.appendChild(this._toolsSlot),this._toolbar.append(this._tabs,t),this._slot=document.createElement("slot"),this._box.append(this._toolbar,this.createElement("slot",[],{name:"filters"}),this._slot),this._wrapper.appendChild(this._box),this._columns=[],this._rows=[],this._sync()}get views(){return this._slot?.assignedElements().filter(t=>/^nk-[a-z]+-view$/.test(t.localName))??[]}_sync(){if(!this._tabs)return;const t=this.views;let e=this.getAttribute("view");t.some(t=>t.name===e)||(e=t[0]?.name??null),this._tabs.replaceChildren();for(const i of t){const t=this.createElement("span",["nk-db-tab"],{role:"tab","data-view":i.name,tabindex:"0"});t.classList.toggle("active",i.name===e),t.setAttribute("aria-selected",i.name===e?"true":"false"),t.append(document.createTextNode(i.getAttribute("label")||i.name));const n=i.hasAttribute("count")?String(this._rows.length):i.getAttribute("badge");if(n){const e=this.createElement("span",["badge"]);e.textContent=n,t.appendChild(e)}this._tabs.appendChild(t),i.hidden=i.name!==e,i.setData?.(this._columns,this._rows)}if(this.getBoolAttr("add-view")){const t=this.createElement("span",["nk-db-tab","add"],{role:"button","data-add":"",tabindex:"0"});t.textContent="๏ผ‹",this._tabs.appendChild(t)}this._toolbar.hidden=!t.length&&!this._toolsSlot.assignedElements().length,this._current=e}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._sync()}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-view]");e?this.view=e.dataset.view:t.target.closest("[data-add]")&&this.emit("nk-action",{action:"add-view"})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||!t.target.closest("[data-view],[data-add]")||(t.preventDefault(),t.target.click())},this._onSlot=()=>this._sync(),this._tabs.addEventListener("click",this._onClick),this._tabs.addEventListener("keydown",this._onKey),this._slot.addEventListener("slotchange",this._onSlot),this._toolsSlot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._tabs?.removeEventListener("click",this._onClick),this._tabs?.removeEventListener("keydown",this._onKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._toolsSlot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){const e=this._current;this._sync(),"view"===t&&this._current!==e&&this.emit("nk-view-change",{view:this._current})}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._sync()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._sync()}get view(){return this._current??this.getAttribute("view")}set view(t){this.setAttribute("view",t)}refresh(){this._sync()}}customElements.define("nk-database",ei);const ii=(t,e,i)=>{const n=document.createElement(t);return e&&(n.className=e),null!=i&&(n.textContent=i),n},ni=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function si(t,e){const i=function(t,e){const i=t.options||[];return i.find(t=>t.value===e)||i.find(t=>t.label===e)||null}(t,e),n=i?.color&&ni.includes(i.color)?i.color:"gray";return ii("span",`nk-tag ${n}`,i?.label??String(e))}const ri=t=>t&&"object"==typeof t?t.text??t.label??t.name??"":String(t??"");function oi(t){if(t instanceof Date)return t.getTime();if("number"==typeof t)return t;if(t&&"object"==typeof t)return oi(t.start);const e=String(t??"").trim();let i=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/);return i?new Date(+i[3],+i[2]-1,+i[1]).getTime():(i=e.match(/^(\d{4})-(\d{2})-(\d{2})$/),i?new Date(+i[1],+i[2]-1,+i[3]).getTime():/^\d{4}-\d{2}-\d{2}T/.test(e)?Date.parse(e):NaN)}function ai(t,e){if(e&&"object"==typeof e&&!(e instanceof Date))return[e.start,e.end].filter(Boolean).map(e=>ai(t,e)).join(" โ†’ ");const i=t.format,n=oi(e);if(!i||Number.isNaN(n))return String(e??"");const s=new Date(n),r=t.locale||xe();if("relative"===i){const t=Math.round((n-Date.now())/6e4),e=new Intl.RelativeTimeFormat(r,{numeric:"auto",style:"short"});if(Math.abs(t)<60)return e.format(t,"minute");if(Math.abs(t)<1440)return e.format(Math.round(t/60),"hour")}if("short"===i||"relative"===i){const t=s.getFullYear()===(new Date).getFullYear()?{}:{year:"numeric"};return s.toLocaleDateString(r,{day:"2-digit",month:"2-digit",...t})}return"object"==typeof i?new Intl.DateTimeFormat(r,i).format(s):String(e)}function li(t,e,i={}){const n=t.type||"text";if("actions"===n)return function(t,e){const i=t.actions||[],n=null==e?i:(Array.isArray(e)?e:[e]).map(t=>"string"==typeof t?i.find(e=>e.action===t)??{action:t,label:t}:t),s=ii("span","row-actions");for(const t of n){const e=ii("button",`nk-btn ${t.danger?"danger":"secondary"} small`,[t.icon,t.label??t.action].filter(Boolean).join(" "));e.type="button",e.dataset.action=t.action,e.disabled=!!t.disabled,t.tooltip&&(e.dataset.tooltip=t.tooltip),s.appendChild(e)}return s}(t,e);if(null==e||""===e)return"checkbox"===n?hi(t,!1,i):"progress"===n?ci(t,0):ii("span","person"===n?"person-cell":null,"text"===n&&t.title?"":"โ€”");switch(n){case"select":return si(t,e);case"multi-select":{const i=ii("span");i.style.display="inline-flex",i.style.gap="4px",i.style.flexWrap="wrap";for(const n of Array.isArray(e)?e:String(e).split(",").map(t=>t.trim()).filter(Boolean))i.appendChild(si(t,n));return i}case"date":return ii("span","date-cell",ai(t,e));case"person":{const t=ii("span","person-cell"),i="string"==typeof e?{name:e}:e,n=ii("span","nk-avatar small",i.initials||i.avatar||Kt(i.name));return Pt(n,i.color),t.append(n,document.createTextNode(" "+(i.name||""))),t}case"checkbox":return hi(t,!!e,i);case"url":{const t="object"==typeof e?e:{href:String(e),label:String(e).replace(/^https?:\/\//,""),target:"_blank"},i=ii("a",null,t.label??t.href);return i.href=t.href??"",t.target&&(i.target=t.target),"_blank"===t.target&&(i.rel="noopener"),i}case"number":return ii("span",null,"number"==typeof e?e.toLocaleString(t.locale,t.format):String(e));case"progress":return ci(t,Number(e)||0);default:{const n="object"==typeof e?e:{text:e};let s;if(t.title)s=ii("span","row-title"),i.icon&&s.append(document.createTextNode(i.icon+" ")),s.append(document.createTextNode(String(n.text??"")));else{if("object"!=typeof e)return ii("span",null,String(e));s=ii("span",n.color&&ni.includes(n.color)?`td-text ${n.color}`:"td-text",String(n.text??""))}if(n.tooltip&&(s.dataset.tooltip=n.tooltip),!n.desc)return s;const r=document.createDocumentFragment();return r.append(s,ii("span","td-desc",String(n.desc))),r}}}function hi(t,e,i){const n=ii("label","nk-check"),s=ii("input");return s.type="checkbox",s.checked=e,s.dataset.key=t.key,null!=i.id&&(s.dataset.rowId=i.id),n.appendChild(s),n}function ci(t,e){const i=document.createDocumentFragment(),n=ii("span","nk-progress"),s=ii("i");return s.style.width=`${Math.max(0,Math.min(100,e))}%`,n.appendChild(s),i.append(n,ii("span","nk-progress-label",di(t,e))),i}function di(t,e){const i=Number(e)||0;try{return new Intl.NumberFormat(t.locale||xe(),{style:"percent",maximumFractionDigits:0}).format(i/100)}catch{return`${Math.round(i)}%`}}function pi(t,e){const i=(t.options||[]).findIndex(t=>t.value===e||t.label===e);return i<0?(t.options||[]).length:i}function ui(t,e){if(t.sortKey)return e[t.sortKey];const i=e[t.key];if(null==i||""===i)return null;if("object"==typeof i&&!Array.isArray(i)&&"sort"in i)return i.sort;switch(t.type||"text"){case"number":case"progress":return Number(i);case"checkbox":return i?1:0;case"date":{const t=oi(i);return Number.isNaN(t)?String(i):t}case"select":return pi(t,i);case"multi-select":{const e=(Array.isArray(i)?i:String(i).split(","))[0];return null==e?null:pi(t,String(e).trim())}default:return ri(i)}}function gi(t,e=1){const i=t=>null==t||""===t||Number.isNaN(t);return(n,s)=>{const r=ui(t,n),o=ui(t,s);return i(r)||i(o)?i(r)===i(o)?0:i(r)?1:-1:"number"==typeof r&&"number"==typeof o?(r-o)*e:String(r).localeCompare(String(o),void 0,{numeric:!0})*e}}class bi extends v{static get observedAttributes(){return["name","label","badge","count","new-row","new-row-label","sortable","sort-key","sort-dir","wrap"]}render(){this._wrap=this.createElement("div",["nk-table-wrap"]),this._table=this.createElement("table",["nk-table"]),this._thead=document.createElement("thead"),this._tbody=document.createElement("tbody"),this._table.append(this._thead,this._tbody),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._wrap.append(this._table,this._newRow),this._wrapper.appendChild(this._wrap),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_sortedRows(){const t=this.getAttribute("sort-key"),e=this._columns.find(e=>e.key===t);return e?[...this._rows].sort(gi(e,"desc"===this.getAttribute("sort-dir")?-1:1)):this._rows}_render(){if(!this._thead)return;this._table.classList.toggle("wrap",this.getBoolAttr("wrap"));const t=document.createElement("tr");for(const e of this._columns){const i="actions"===e.type,n=this.createElement("th",i?["actions"]:[],i?{scope:"col"}:{"data-key":e.key,scope:"col"});if(e.icon){const t=this.createElement("span",["th-icon"]);t.textContent=e.icon,n.appendChild(t)}n.appendChild(document.createTextNode(e.label??(i?"":e.key))),e.key===this.getAttribute("sort-key")&&n.appendChild(document.createTextNode("desc"===this.getAttribute("sort-dir")?" โ†“":" โ†‘")),e.width&&(n.style.width=e.width),t.appendChild(n)}this._thead.replaceChildren(t),this._tbody.replaceChildren();for(const t of this._sortedRows()){const e=this.createElement("tr",[],{"data-id":t.id??""});for(const i of this._columns){const n=document.createElement("td");"number"===i.type&&(n.className="num"),n.appendChild(li(i,t[i.key],t)),e.appendChild(n)}this._tbody.appendChild(e)}this._newRow.textContent=this.getAttribute("new-row-label")||this.str("newPage"),this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest("th[data-key]");if(e){const t=e.dataset.key,i=this.getAttribute("sort-key")===t&&"desc"!==this.getAttribute("sort-dir")?"desc":"asc";return void(this.emit("nk-action",{action:"sort",key:t,value:i})&&this.getBoolAttr("sortable")&&(this.setAttribute("sort-key",t),this.setAttribute("sort-dir",i)))}const i=t.target.closest("button[data-action]");if(i){const t=this._rowById(i.closest("tr[data-id]")?.dataset.id);return void(i.disabled||this.emit("nk-action",{action:i.dataset.action,row:t,id:t?.id,anchor:i}))}if(t.target.closest("input[type=checkbox], a"))return;const n=t.target.closest("tr[data-id]");if(!n)return;const s=t.target.closest("td"),r=this._rowById(n.dataset.id);this.emit("nk-select",{row:r,id:r?.id,value:r?.id,key:s?this._columns[s.cellIndex]?.key:void 0,cell:s})},this._onChange=t=>{const e=t.target;if("checkbox"!==e.type)return;const i=this._rowById(e.dataset.rowId);i&&(i[e.dataset.key]=e.checked),this.emit("nk-change",{row:i,key:e.dataset.key,value:e.checked})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||t.target!==this._newRow||(t.preventDefault(),this.emit("nk-action",{action:"new-row"}))},this._wrap.addEventListener("click",this._onClick),this._wrap.addEventListener("change",this._onChange),this._wrap.addEventListener("keydown",this._onKey)}teardownEvents(){this._wrap?.removeEventListener("click",this._onClick),this._wrap?.removeEventListener("change",this._onChange),this._wrap?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}onStringsChanged(){this._render()}get name(){return this.getAttribute("name")||"table"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-table-view",bi);class mi extends v{static get observedAttributes(){return["name","label","badge","count","group-by","title-key","meta-keys","new-row"]}render(){this._board=this.createElement("div",["nk-board","active"]),this._wrapper.appendChild(this._board),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_groupColumn(){const t=this.getAttribute("group-by");return this._columns.find(e=>e.key===t)||this._columns.find(t=>"select"===t.type)||null}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"date"===t.type||"progress"===t.type)}_render(){if(!this._board)return;this._board.replaceChildren();const t=this._groupColumn(),e=this._titleColumn();if(!t)return;const i=t.options?.length?t.options:[...new Set(this._rows.map(e=>e[t.key]))].map(t=>({value:t,label:String(t)}));for(const n of i){const i=this.createElement("div",["nk-board-col"],{"data-value":n.value}),s=this.createElement("div",["nk-board-col-header"]),r=this._rows.filter(e=>e[t.key]===n.value||e[t.key]===n.label),o=this.createElement("span",["count"]);o.textContent=String(r.length),s.append(si(t,n.value),o),i.appendChild(s);for(const t of r){const n=this.createElement("div",["nk-card"],{draggable:"true","data-id":t.id??"",tabindex:"0"}),s=this.createElement("div",["card-title"]);s.textContent=`${t.icon?t.icon+" ":""}${e?ri(t[e.key]):""}`;const r=this.createElement("div",["card-meta"]);for(const e of this._metaColumns()){const i=t[e.key];if(null==i||""===i)continue;const n=document.createElement("span");"progress"===e.type?n.textContent=`โ–ฐ ${di(e,i)}`:"date"===e.type?n.textContent=`๐Ÿ“… ${ai(e,i)}`:n.appendChild(li(e,i,t)),r.appendChild(n)}n.append(s,r),i.appendChild(n)}if(this.getBoolAttr("new-row")){const t=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0","data-add":n.value});t.style.padding="6px 10px",t.textContent="๏ผ‹",i.appendChild(t)}this._board.appendChild(i)}}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-add]");if(e)return void this.emit("nk-action",{action:"new-row",value:e.dataset.add});const i=t.target.closest(".nk-card");if(i){const t=this._rowById(i.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onDragStart=t=>{const e=t.target.closest?.(".nk-card");if(e){this._dragId=e.dataset.id,t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",e.dataset.id)}catch{}}},this._onDragOver=t=>{null!=this._dragId&&t.target.closest(".nk-board-col")&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},this._onDrop=t=>{const e=t.target.closest(".nk-board-col");e&&null!=this._dragId&&(t.preventDefault(),this.move(this._dragId,e.dataset.value),this._dragId=null)},this._board.addEventListener("click",this._onClick),this._board.addEventListener("dragstart",this._onDragStart),this._board.addEventListener("dragover",this._onDragOver),this._board.addEventListener("drop",this._onDrop)}teardownEvents(){this._board?.removeEventListener("click",this._onClick),this._board?.removeEventListener("dragstart",this._onDragStart),this._board?.removeEventListener("dragover",this._onDragOver),this._board?.removeEventListener("drop",this._onDrop)}move(t,e){const i=this._rowById(t),n=this._groupColumn();i&&n&&i[n.key]!==e&&(i[n.key]=e,this._render(),this.emit("nk-change",{row:i,key:n.key,value:e}))}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"board"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-board-view",mi);class ki extends v{static get observedAttributes(){return["name","label","badge","count","title-key","meta-keys","new-row","new-row-label"]}render(){this._box=document.createElement("div"),this._list=this.createElement("div",["nk-list"],{role:"list"}),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._box.append(this._list,this._newRow),this._wrapper.appendChild(this._box),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"select"===t.type||"date"===t.type)}_render(){if(!this._list)return;const t=this._titleColumn(),e=this._metaColumns();this._list.replaceChildren();for(const i of this._rows){const n=this.createElement("div",["nk-list-item"],{role:"listitem",tabindex:"0","data-id":i.id??""}),s=this.createElement("span",["l-icon"]);s.textContent=i.icon||"",i.icon||(s.style.display="none");const r=this.createElement("span",["l-title"]);r.textContent=t?ri(i[t.key]):"";const o=this.createElement("span",["l-meta"]);for(const t of e){const e=i[t.key];null!=e&&""!==e&&o.appendChild("date"===t.type?document.createTextNode(ai(t,e)):"text"!==t.type&&t.type?li(t,e,i):document.createTextNode(ri(e)))}n.append(s,r,o),this._list.appendChild(n)}this._newRow.textContent=this.getAttribute("new-row-label")||this.str("newPage"),this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest(".nk-list-item");if(e){const t=this._rowById(e.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.target===this._newRow||t.target.classList?.contains("nk-list-item"))&&(t.preventDefault(),t.target.click())},this._box.addEventListener("click",this._onClick),this._box.addEventListener("keydown",this._onKey)}teardownEvents(){this._box?.removeEventListener("click",this._onClick),this._box?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}onStringsChanged(){this._render()}get name(){return this.getAttribute("name")||"list"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-list-view",ki);class _i extends v{static get observedAttributes(){return["name","label","badge","count","date-key","title-key","month","weeks","week-start","weekend","today","locale","today-label","prev-label","next-label","week-label"]}render(){this._box=this.createElement("div",["nk-calendar-view"]);const t=this.createElement("div",["cv-head"]);this._title=this.createElement("div",["cv-title"]),this._todayBtn=this.createElement("button",["cal-nav"],{type:"button"}),this._prev=this.createElement("button",["cal-nav"],{type:"button"}),this._prev.innerHTML=Ce,this._next=this.createElement("button",["cal-nav"],{type:"button"}),this._next.innerHTML=Be,t.append(this._title,this._todayBtn,this._prev,this._next),this._grid=this.createElement("div",["cv-grid"]),this._box.append(t,this._grid),this._wrapper.appendChild(this._box),this._columns??=[],this._rows??=[],this._month??=this._attrMonth()??this._todayIso().slice(0,7),this._render(),this.closest("nk-database")?.requestSync?.()}_attrMonth(){const t=this.getAttribute("month");return/^\d{4}-\d{2}$/.test(t||"")?t:null}_todayIso(){return this.getAttribute("today")||me(new Date)}_dateColumn(){const t=this.getAttribute("date-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>"date"===t.type)||null}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_render(){if(!this._grid)return;const t=xe(this.getAttribute("locale")),e=this.getBoolAttr("weeks"),i=Number(this.getAttribute("week-start")),n=this.hasAttribute("week-start")&&Number.isInteger(i)&&i>=0&&i<=6?i:fe(t),s=we(this._month,n),r=this._todayIso(),o=new Set((this.getAttribute("weekend")||"").split(",").map(t=>t.trim()).filter(Boolean).map(Number)),a=this._dateColumn(),l=this._titleColumn(),h={};if(a)for(const t of this._rows){const e=_e(t[a.key]);e&&(h[me(e)]||=[]).push(t)}this._box.classList.toggle("weeks",e),this._title.textContent=new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(s.first),this._todayBtn.textContent=this.getAttribute("today-label")||this.str("today"),this._prev.setAttribute("aria-label",this.getAttribute("prev-label")||this.str("previousMonth")),this._next.setAttribute("aria-label",this.getAttribute("next-label")||this.str("nextMonth"));const c=(t,e)=>{const i=this.createElement("div",[t]);return i.textContent=e,i},d=[];e&&d.push(c("cv-wd",this.getAttribute("week-label")||Ee(t)));for(const e of ye(t,n))d.push(c("cv-wd",e));for(let t=0;t<7*s.rows;t++){const i=s.day(t),n=me(i);e&&t%7==0&&d.push(c("cv-week",ve(i)));const a=this.createElement("div",["cv-day",i.getMonth()!==s.m-1&&"out",o.has(i.getDay())&&"off",n===r&&"today"].filter(Boolean)),p=this.createElement("span",["cv-num"]);p.textContent=i.getDate(),a.appendChild(p);for(const t of h[n]||[]){const e=this.createElement("button",["cv-item"],{type:"button","data-id":t.id??""}),i=l?ri(t[l.key]):"";e.textContent=t.icon?`${t.icon} ${i}`:i,a.appendChild(e)}d.push(a)}this._grid.replaceChildren(...d)}_goMonth(t){t!==this._month&&(this._month=t,this._render(),this.emit("nk-month",{month:t}))}setupEvents(){this._onClick=t=>{if(t.target.closest(".cal-nav")===this._todayBtn)return void this._goMonth(this._todayIso().slice(0,7));if(t.target.closest(".cal-nav")===this._prev)return void this._goMonth(Ae(this._month,-1));if(t.target.closest(".cal-nav")===this._next)return void this._goMonth(Ae(this._month,1));const e=t.target.closest(".cv-item");if(e){const t=this._rowById(e.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._box.addEventListener("click",this._onClick)}teardownEvents(){this._box?.removeEventListener("click",this._onClick)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onStringsChanged(){this._render()}onAttributeChanged(t){"month"===t&&(this._month=this._attrMonth()??this._month),this._render(),"label"!==t&&"badge"!==t&&"count"!==t||this.closest("nk-database")?.requestSync?.()}get name(){return this.getAttribute("name")||"calendar"}get month(){return this._month}set month(t){/^\d{4}-\d{2}$/.test(t)&&(this._grid?this._goMonth(t):this._month=t)}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-calendar-view",_i);const vi=["small","large"];class xi extends v{static get observedAttributes(){return["name","label","badge","count","cover-key","no-cover","size","fit","title-key","meta-keys","href-key","new-row","new-row-label"]}render(){this._grid=this.createElement("div",["nk-gallery"],{role:"list"}),this._wrapper.appendChild(this._grid),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"select"===t.type||"date"===t.type)}_render(){if(!this._grid)return;const t=this.getAttribute("size");this._grid.className=["nk-gallery",vi.includes(t)&&t,this.getBoolAttr("fit")&&"fit"].filter(Boolean).join(" ");const e=this._titleColumn(),i=this._metaColumns(),n=this.getAttribute("cover-key")||"cover",s=!this.getBoolAttr("no-cover"),r=this.getAttribute("href-key");this._grid.replaceChildren();for(const t of this._rows){const o=r?t[r]:null,a=o&&"object"==typeof o?o.href:o,l=a?this.createElement("a",["nk-card"],{href:String(a),"data-id":t.id??""}):this.createElement("div",["nk-card"],{role:"listitem",tabindex:"0","data-id":t.id??""});if(s){const e=this.createElement("div",["nk-cover"]);t[n]&&e.appendChild(this.createElement("img",[],{src:t[n],alt:""})),l.appendChild(e)}const h=this.createElement("div",["card-title"]);h.textContent=`${t.icon?t.icon+" ":""}${e?ri(t[e.key]):""}`;const c=this.createElement("div",["card-meta"]);for(const e of i){const i=t[e.key];if(null==i||""===i)continue;const n=document.createElement("span");"progress"===e.type?n.textContent=`โ–ฐ ${di(e,i)}`:"date"===e.type?n.textContent=`๐Ÿ“… ${ai(e,i)}`:n.appendChild(li(e,i,t)),c.appendChild(n)}if(l.append(h,c),a){const t=this.createElement("div",["card-item"],{role:"listitem"});t.appendChild(l),this._grid.appendChild(t)}else this._grid.appendChild(l)}if(this.getBoolAttr("new-row")){const t=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0","data-add":""});t.textContent=this.getAttribute("new-row-label")||this.str("newPage"),this._grid.appendChild(t)}}setupEvents(){this._onClick=t=>{if(t.target.closest("[data-add]"))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest(".nk-card");if(!e)return;const i="a"===e.localName;if(i&&(0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const n=this._rowById(e.dataset.id);!this.emit("nk-select",{row:n,id:n?.id,value:n?.id})&&i&&t.preventDefault()},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||"a"!==t.target.localName&&t.target.matches?.(".nk-card, [data-add]")&&(t.preventDefault(),t.target.click())},this._grid.addEventListener("click",this._onClick),this._grid.addEventListener("keydown",this._onKey)}teardownEvents(){this._grid?.removeEventListener("click",this._onClick),this._grid?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}onStringsChanged(){this._render()}get name(){return this.getAttribute("name")||"gallery"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-gallery-view",xi);class fi extends v{static get observedAttributes(){return["search","placeholder","no-filter","no-sort","value","add","add-label","filter-label","sort-label","remove-label"]}render(){this._row=this.createElement("div",["nk-filter-row"]),this._filterBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"filter"}),this._sortBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"sort"}),this._pillStart=document.createComment("pills"),this._addBtn=this.createElement("button",["nk-filter-pill","add"],{type:"button","data-action":"add"}),this._input=this.createElement("input",["nk-input"],{type:"search",autocomplete:"off"}),this._row.append(this._filterBtn,this._sortBtn,this._pillStart,this._addBtn,document.createElement("slot"),this._input),this._wrapper.appendChild(this._row),this._filters=[],this._sync()}_sync(){this._filterBtn.textContent=this.getAttribute("filter-label")||this.str("filter"),this._filterBtn.hidden=this.getBoolAttr("no-filter"),this._filterBtn.classList.toggle("active",this._filters.length>0),this._sortBtn.textContent=this.getAttribute("sort-label")||this.str("sort"),this._sortBtn.hidden=this.getBoolAttr("no-sort"),this._addBtn.textContent=this.getAttribute("add-label")||this.str("addFilter"),this._addBtn.hidden=!this.getBoolAttr("add"),this._input.hidden=!this.getBoolAttr("search"),this._input.placeholder=this.getAttribute("placeholder")||this.str("search"),this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value"));for(const t of this._row.querySelectorAll("[data-pill]"))t.remove();const t=this.getAttribute("remove-label")||this.str("removeFilter");this._pillStart.after(...this._filters.map((e,i)=>{const n=this.createElement("span",["nk-filter-pill","active"],{"data-pill":i}),s=this.createElement("button",[],{type:"button","data-edit":i});s.textContent=e.label??`${e.key}: ${e.value}`;const r=this.createElement("button",["fp-remove"],{type:"button","data-remove":i,"aria-label":`${t}: ${s.textContent}`});return r.textContent="ร—",n.append(s,r),n}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-remove]");if(e){const t=Number(e.dataset.remove);return this._filters=this._filters.filter((e,i)=>i!==t),this._sync(),void this._emitChange()}const i=t.target.closest("[data-edit]");if(i){const t=Number(i.dataset.edit);return void this.emit("nk-action",{action:"edit",index:t,filter:this._filters[t],anchor:i})}const n=t.target.closest("[data-action]");n&&this.emit("nk-action",{action:n.dataset.action,anchor:n})},this._onInput=()=>{clearTimeout(this._debounce),this._debounce=setTimeout(()=>this._emitChange(),150)},this._row.addEventListener("click",this._onClick),this._input.addEventListener("input",this._onInput)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._input?.removeEventListener("input",this._onInput),clearTimeout(this._debounce)}_emitChange(){this.emit("nk-change",{filters:[...this._filters],search:this._input.value})}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}get filters(){return[...this._filters]}set filters(t){this._filters=Array.isArray(t)?[...t]:[],this._row&&this._sync()}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}apply(t){const e=this.value.trim().toLowerCase();return t.filter(t=>this._filters.every(e=>"is-not"===e.op?t[e.key]!==e.value:t[e.key]===e.value)&&(!e||Object.values(t).some(t=>String("object"==typeof t&&t?t.name??t.text??t.label??"":t??"").toLowerCase().includes(e))))}}customElements.define("nk-filter-bar",fi);class yi extends v{static get observedAttributes(){return["placeholder","send-label","no-input","disabled"]}render(){const t=this.createElement("div",["nk-comments"]);t.appendChild(document.createElement("slot")),this._row=this.createElement("div",["nk-comment-input"]),this._input=this.createElement("input",["nk-input"],{type:"text"}),this._btn=this.createElement("button",["nk-btn","primary","small"],{type:"button"}),this._row.append(this._input,this._btn),t.appendChild(this._row),this._wrapper.appendChild(t),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||this.str("commentPlaceholder"),this._input.setAttribute("aria-label",this.str("comment")),this._btn.textContent=this.getAttribute("send-label")||this.str("send"),this._row.style.display=this.getBoolAttr("no-input")?"none":"",this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t)return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}customElements.define("nk-comments",yi);class wi extends v{static get observedAttributes(){return["author","time","avatar","color"]}render(){const t=this.createElement("div",["nk-comment"]);this._avatar=this.createElement("span",["nk-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const i=document.createElement("div");this._head=this.createElement("div",["c-head"]),this._author=document.createElement("b"),this._time=document.createTextNode(""),this._head.append(this._author,this.createElement("slot",[],{name:"head"}),this._time);const n=this.createElement("div",["c-body"]);n.appendChild(document.createElement("slot")),i.append(this._head,n),t.append(e,i),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("author")||"";this._author.textContent=t;const e=this.getAttribute("time");this._time.data=e?` ยท ${e}`:"",this._avatar.textContent=this.getAttribute("avatar")||Kt(t),Pt(this._avatar,this.getAttribute("color"))}onAttributeChanged(){this._sync()}}customElements.define("nk-comment",wi);class Ai extends v{render(){const t=this.createElement("div",["nk-ai-thread"],{role:"log","aria-live":"polite"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-ai-thread",Ai);class Ei extends v{static get observedAttributes(){return["role","name","badge","avatar","color","bubble"]}render(){this._box=this.createElement("div",["nk-ai-msg"]),this._avatar=this.createElement("span",["mini-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._avatarSlot=t;const e=this.createElement("div",["a-body"]);this._name=this.createElement("div",["a-name"]),this._nameText=document.createTextNode(""),this._badge=document.createElement("span"),this._name.append(this._nameText,this._badge),this._actions=this.createElement("div",["nk-ai-actions"]),this._actionSlot=this.createElement("slot",[],{name:"actions"}),this._actions.appendChild(this._actionSlot),e.append(this._name,document.createElement("slot"),this._actions),this._box.append(t,e),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t="user"===this.getAttribute("role"),e=this.getBoolAttr("bubble");this._box.classList.toggle("user",t),this._box.classList.toggle("bubble",e);const i=this.getAttribute("name");this._nameText.data!==(i||"")&&(this._nameText.data=i||"");const n=this.getAttribute("badge"),s=n?` ${n}`:"";this._badge.textContent!==s&&(this._badge.textContent=s),this._name.style.display=i&&!e?"":"none",this._avatarSlot.style.display=e?"none":"";const r=this.getAttribute("avatar")||(t?(i||"U").slice(0,2).toUpperCase():"โœจ");this._avatar.textContent!==r&&(this._avatar.textContent=r);const o=this.getAttribute("color");this._avatar.style.background=o||"",this._actions.style.display=this._actionSlot.assignedElements().length?"":"none"}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this._actionSlot.assignedElements().includes(e)&&this.emit("nk-action",{action:e.value||e.textContent.trim(),value:e.value||e.textContent.trim()})},this._actionSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this._sync()}teardownEvents(){this._actionSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}}customElements.define("nk-ai-msg",Ei);class Ci extends v{static get observedAttributes(){return["placeholder","value","disabled","icon"]}render(){this._row=this.createElement("div",["nk-ai-input-row"]),this._icon=document.createElement("span"),this._icon.style.fontSize="14px",this._input=this.createElement("input",[],{type:"text"}),this._btn=this.createElement("button",["nk-ai-send"],{type:"button"}),this._btn.textContent="โ†‘",this._row.append(this._icon,this._input,this._btn),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||this.str("askPlaceholder"),this._input.setAttribute("aria-label",this.str("message")),this._btn.setAttribute("aria-label",this.str("send")),this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value")),this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled");const t=this.getAttribute("icon")??"โœจ";this._icon.textContent=t,this._icon.style.display=t?"":"none"}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t||this.getBoolAttr("disabled"))return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}onStringsChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}customElements.define("nk-ai-input-row",Ci);export{Ci as NkAiInputRow,Ei as NkAiMsg,Ai as NkAiThread,X as NkApp,Rt as NkAvatar,qt as NkAvatarGroup,Et as NkBanner,wt as NkBlockHost,mi as NkBoardView,he as NkBookmark,bt as NkBreadcrumb,y as NkBtn,ze as NkCalendar,_i as NkCalendarView,$ as NkCallout,T as NkCheck,Re as NkCmdk,Q as NkCode,wi as NkComment,yi as NkComments,pe as NkCopyField,Yt as NkDangerZone,ei as NkDatabase,Fe as NkDialog,H as NkDivider,v as NkElement,Je as NkEmojiPicker,Ct as NkEmpty,q as NkField,O as NkFields,fi as NkFilterBar,x as NkFormElement,xi as NkGalleryView,W as NkHeading,ge as NkImagePicker,E as NkInput,Y as NkKbd,ki as NkListView,Qt as NkMemberList,Zt as NkMemberRow,Ht as NkMention,He as NkMenu,We as NkMenuItem,qe as NkModal,Ut as NkModelCard,vt as NkPage,yt as NkPageActions,xt as NkPageCover,ft as NkPageTitle,ee as NkPanel,te as NkPanels,Ne as NkPeek,Ye as NkPop,Gt as NkProfileRow,R as NkProgress,Jt as NkProp,Xt as NkProps,Z as NkQuote,F as NkRadio,ct as NkSectionLabel,It as NkSegmented,S as NkSelect,Oe as NkSettingsPane,Pe as NkSettingsUser,ae as NkSheet,at as NkSidebar,Bt as NkSkeleton,j as NkSlider,Vt as NkStat,jt as NkStats,le as NkSteps,z as NkSwitch,Lt as NkSynced,Nt as NkTab,kt as NkTabBar,_t as NkTabBarItem,bi as NkTableView,Mt as NkTabs,K as NkTag,Wt as NkTemplateBtn,L as NkTextarea,mt as NkThemeToggle,ti as NkToast,G as NkTodo,U as NkToggle,Ve as NkTooltip,gt as NkTopbar,pt as NkTree,ut as NkTreeItem,ht as NkWorkspaceSwitcher,c as builtInStrings,gi as compareBy,r as componentsSheet,ai as formatDate,di as formatPercent,li as renderPropertyCell,h as setStrings,si as tagFor,ri as textOf,oi as timeOf};
2
2
  //# sourceMappingURL=notionkit-elements.esm.min.js.map