amateras 0.15.1 → 0.16.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.
- package/build/core.js +1 -1
- package/build/css.js +1 -1
- package/build/for.js +1 -1
- package/build/i18n.js +1 -1
- package/build/if.js +1 -1
- package/build/import-map.js +1 -1
- package/build/match.js +1 -1
- package/build/meta.js +1 -1
- package/build/prefetch.js +1 -1
- package/build/router.js +1 -1
- package/build/signal.js +1 -1
- package/build/ui.js +1 -1
- package/build/utils.js +1 -1
- package/build/widget.js +1 -1
- package/package.json +4 -4
- package/packages/core/src/index.ts +19 -44
- package/packages/core/src/lib/hmr.ts +1 -1
- package/packages/core/src/lib/virtual_scroll.ts +1 -1
- package/packages/core/src/structure/ElementProto.ts +18 -5
- package/packages/core/src/structure/Proto.ts +1 -1
- package/packages/core/src/structure/ProtoProcess.ts +45 -0
- package/packages/css/package.json +4 -2
- package/packages/css/src/ext/fluent.ts +3 -3
- package/packages/css/src/ext/fluents/border.ts +49 -0
- package/packages/css/src/ext/fluents/box.ts +135 -0
- package/packages/css/src/ext/fluents/container.ts +3 -0
- package/packages/css/src/ext/fluents/flex.ts +32 -0
- package/packages/css/src/ext/fluents/flexItem.ts +20 -0
- package/packages/css/src/ext/fluents/font.ts +18 -0
- package/packages/css/src/ext/fluents/grid.ts +15 -0
- package/packages/css/src/ext/fluents/hover.ts +6 -0
- package/packages/css/src/ext/fluents/media.ts +12 -0
- package/packages/css/src/ext/fluents.ts +9 -0
- package/packages/css/src/ext/static-colors.ts +2 -0
- package/packages/css/src/ext/variables/colors.ts +32 -0
- package/packages/css/src/ext/variables/general.ts +4 -0
- package/packages/css/src/ext/variables/lineHeight.ts +14 -0
- package/packages/css/src/ext/variables/radius.ts +13 -0
- package/packages/css/src/ext/variables/text.ts +17 -0
- package/packages/css/src/ext/variables/weight.ts +12 -0
- package/packages/css/src/ext/variables.ts +14 -0
- package/packages/css/src/index.ts +39 -5
- package/packages/css/src/lib/spacingFn.ts +3 -0
- package/packages/css/src/lib/static-colors/amber.ts +11 -0
- package/packages/css/src/lib/static-colors/blackwhite.ts +2 -0
- package/packages/css/src/lib/static-colors/blue.ts +11 -0
- package/packages/css/src/lib/static-colors/cyan.ts +11 -0
- package/packages/css/src/lib/static-colors/emerald.ts +11 -0
- package/packages/css/src/lib/static-colors/fuchsia.ts +11 -0
- package/packages/css/src/lib/static-colors/gray.ts +11 -0
- package/packages/css/src/lib/static-colors/green.ts +11 -0
- package/packages/css/src/lib/static-colors/indigo.ts +11 -0
- package/packages/css/src/lib/static-colors/lime.ts +11 -0
- package/packages/css/src/lib/static-colors/neutral.ts +11 -0
- package/packages/css/src/lib/static-colors/orange.ts +11 -0
- package/packages/css/src/lib/static-colors/pink.ts +11 -0
- package/packages/css/src/lib/static-colors/purple.ts +11 -0
- package/packages/css/src/lib/static-colors/red.ts +11 -0
- package/packages/css/src/lib/static-colors/rose.ts +11 -0
- package/packages/css/src/lib/static-colors/sky.ts +11 -0
- package/packages/css/src/lib/static-colors/slate.ts +11 -0
- package/packages/css/src/lib/static-colors/stone.ts +11 -0
- package/packages/css/src/lib/static-colors/teal.ts +11 -0
- package/packages/css/src/lib/static-colors/violet.ts +11 -0
- package/packages/css/src/lib/static-colors/yellow.ts +11 -0
- package/packages/css/src/lib/static-colors/zinc.ts +11 -0
- package/packages/css/src/lib/static-colors.ts +23 -0
- package/packages/css/src/lib/valueFn.ts +1 -0
- package/packages/css/src/structure/$CSSFluent.ts +81 -25
- package/packages/for/src/index.ts +1 -1
- package/packages/for/src/structure/For.ts +1 -1
- package/packages/hmr/src/index.ts +1 -1
- package/packages/i18n/package.json +2 -1
- package/packages/i18n/src/index.ts +4 -2
- package/packages/i18n/src/structure/I18n.ts +27 -24
- package/packages/i18n/src/structure/I18nDictionary.ts +9 -6
- package/packages/i18n/src/structure/I18nSession.ts +21 -3
- package/packages/i18n/src/structure/I18nTranslation.ts +4 -2
- package/packages/i18n/src/types.ts +43 -34
- package/packages/if/src/index.ts +2 -2
- package/packages/match/src/index.ts +1 -1
- package/packages/meta/src/index.ts +13 -4
- package/packages/prefetch/src/index.ts +21 -1
- package/packages/router/src/index.ts +10 -8
- package/packages/router/src/structure/NavLink.ts +10 -4
- package/packages/router/src/structure/Route.ts +5 -0
- package/packages/router/src/structure/RouteNode.ts +2 -2
- package/packages/router/src/structure/Router.ts +30 -24
- package/packages/signal/src/index.ts +8 -6
- package/packages/ui/src/index.ts +4 -1
- package/packages/ui/src/lib/matrix.ts +27 -0
- package/packages/ui/src/lib/slideshowAnimations.ts +2 -1
- package/packages/ui/src/lib/toCSS.ts +1 -1
- package/packages/ui/src/structure/Badge.ts +7 -10
- package/packages/ui/src/structure/Card.ts +27 -5
- package/packages/ui/src/structure/Carousel.ts +462 -0
- package/packages/ui/src/structure/Combobox/ComboboxChips.ts +15 -12
- package/packages/ui/src/structure/Container.ts +25 -0
- package/packages/ui/src/structure/ContextMenu.ts +145 -31
- package/packages/ui/src/structure/Field.ts +9 -6
- package/packages/ui/src/structure/Icon.ts +15 -2
- package/packages/ui/src/structure/Progress.ts +72 -0
- package/packages/ui/src/structure/Select/Select.ts +1 -2
- package/packages/ui/src/structure/Select/SelectValue.ts +1 -1
- package/packages/ui/src/structure/Slide.ts +7 -1
- package/packages/ui/src/structure/Slideshow.ts +6 -1
- package/packages/ui/src/structure/Tabs.ts +19 -19
- package/packages/ui/src/structure/TextArea.ts +2 -2
- package/packages/ui/src/structure/TextBlock.ts +2 -1
- package/packages/ui/src/structure/Waterfall.ts +1 -1
- package/packages/ui/src/style/content_style.ts +3 -3
- package/packages/ui/src/style/input_style.ts +14 -0
- package/packages/utils/src/lib/camelToDashedStyle.ts +1 -0
- package/packages/utils/src/lib/match.ts +28 -0
- package/packages/utils/src/lib/merge.ts +12 -0
- package/packages/utils/src/lib/tuple.ts +1 -0
- package/packages/utils/src/lib/utils.ts +5 -1
- package/packages/widget/src/index.ts +1 -1
- package/tsconfig.json +1 -0
package/build/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Utils as t}from"@amateras/utils";const e=window,s=document,i=t=>!t||t(),o=t=>!1,r=/* @__PURE__ */Symbol("ProtoType"),n=/* @__PURE__ */Symbol("Statement"),l=/* @__PURE__ */Symbol("Signal");class
|
|
1
|
+
import{Utils as t}from"@amateras/utils";const e=window,s=document,i=t=>!t||t(),o=t=>!1,r=/* @__PURE__ */Symbol("ProtoType"),n=/* @__PURE__ */Symbol("Statement"),l=/* @__PURE__ */Symbol("Signal");class a{static disposers=/* @__PURE__ */new Set;promises=/* @__PURE__ */new Set;root;static initials=/* @__PURE__ */new Set;constructor(e){t.forEach(a.initials,e=>{const s=e(this);s&&t.assign(this,s)}),this.root=e,e.listen("dispose",()=>this.dispose())}dispose(){this.promises.clear(),this.root=t.Null,t.forEach(a.disposers,t=>t(this))}static assign(t){this.initials.add(t)}asyncTask(t){return this.promises.add(t),t.finally(()=>this.promises.delete(t)),t}}class h{static proto=t.Null;static[r]="Proto";static[n]=!1;static eventMap=/* @__PURE__ */new WeakMap;layout;parent=t.Null;global=h.proto?.global??new a(this);sibling=t.Null;firstProto=t.Null;lastProto=t.Null;builded=!1;visible=!0;virtual=!1;constructor(e){this.layout=e??t.Null}dispose(e=!0){this.dispatch("dispose",[this]),e&&t.forEach(this.protos,t=>t.dispose()),h.eventMap.delete(this),this.global=t.Null,this.sibling=t.Null,this.firstProto=t.Null,this.lastProto=t.Null,this.parent=t.Null,this.layout=t.Null}get children(){return t.map(this.protos,t=>t.constructor[n]?t.children:t).flat()}get visibleChildren(){return this.children.filter(t=>t.visible)}get protos(){let t=[],e=this.firstProto;if(e){let s=e;for(;s;)t.push(s),s=s.sibling}return t}append(...e){t.forEach(e,e=>{if(e.parent!==this&&e.parent?.removeProtos(e),this.lastProto){if(this.lastProto===e)return;this.firstProto===e&&(this.firstProto=e.sibling),e.sibling=t.Null,this.lastProto.sibling=e,this.lastProto=e}else this.firstProto=e,this.lastProto=e;e.parent=this,e.global=this.global})}replaceProtos(...t){this.clear(),this.processProtos(...t)}replace(t,...e){const s=this.protos;s.splice(s.indexOf(t),1,...e),this.processProtos(...s)}insert(t,e=-1){if(0===e)this.firstProto&&(t.sibling=this.firstProto),this.firstProto=t;else{let s=this.protos,i=e<0?s.length+e+1:e;s.splice(i,0,t),this.processProtos(...s)}t.parent=this,t.global=this.global}remove(){this.parent?.removeProtos(this)}removeProtos(...e){let s=new Set(this.protos);t.forEach(e,t=>{t.parent=null,t.sibling=null,s.delete(t)}),this.processProtos(...s)}processProtos(...e){let s=t.Null;e.length?t.forEach(e,(e,i)=>{0===i&&(this.firstProto=e),s&&(s.sibling=e),e.sibling=t.Null,s=e,e.parent=this}):this.firstProto=t.Null,this.lastProto=s}build(e=!0,s=!0){return s&&this.clear(!0),$.context(this,()=>this.layout?.(this)),this.builded=!0,e&&t.forEach(this.protos,t=>{t.build()}),this.dispatch("builded",[this]),this}toString(){return t.map(this.protos.filter(t=>t.visible),t=>`${t}`).join("")}toDOM(e=!0){let s=[];return t.forEach(this.protos,t=>{t.visible?e&&s.push(...t.toDOM()):t.removeNode()}),s}removeNode(){t.forEach(this.protos,t=>t.removeNode())}clear(e=!1){let s=this.protos;this.removeProtos(...s),e&&t.forEach(s,t=>t.dispose())}findAbove(e){let s=this.parent;return s?e(s)?s:s.findAbove(e):t.Null}findBelow(e){for(let t of this.protos){if(e(t))return t;let s=t.findBelow(e);if(s)return s}return t.Null}findBelowAll(t){let e=[];for(let s of this.protos)t(s)&&e.push(s),e.push(...s.findBelowAll(t));return e}mutate(){}get text(){return this.children.map(t=>t.text).join("")}get listeners(){return h.eventMap.get(this)}dispatch(e,s,i){let o=this.listeners?.[e],r=!1;if(i?.bubbles){let t=this.parent?.dispatch(e,s,i);r||(r=t??!1)}return t.forEach(o,t=>{let e=t(...s)??!1;r||(r=e)}),r}listen(t,e){let s=this.listeners??{};h.eventMap.set(this,s);let i=s[t]??/* @__PURE__ */new Set;s[t]=i,i.add(e)}}class d extends h{node=t.Null;constructor(t){super(t)}dispose(){super.dispose(),this.node=t.Null}inDOM(){return!!i()&&document.contains(this.node)}removeNode(){this.node?.remove()}DOMProcess(){let e=this.node;if(e){let s=this.protos,i=t.map(s.filter(t=>t.visible),t=>t.toDOM()).flat(),o=t.Null;t.forEach(i,(s,r)=>{let n=e.childNodes[r];n!==s&&(o=i.includes(n)?e.childNodes[r+1]??t.Null:n??t.Null,e.insertBefore(s,o))})}}}const c=["img","hr","br","input","link","meta"];class u extends d{tagname;#t={};static[r]="Element";#e="";__props__;constructor(t,e,s){super(()=>s?.(this)),this.tagname=t,this.__props__=e}static attrProcess(e,s){t.forEach(t.entries(s),([s,i])=>{for(let o of $.middleware.attr){let r=o(s,i,e);if(!t.isUndefined(r))return}e.attr(s,i)})}dispose(){super.dispose(),this.layout=null}build(e){return this.__props__&&(this.props(this.__props__),this.__props__=t.Null),super.build(e),this}props({...e}){let{class:s,...i}=e;s&&this.addClass(...s.split(" ")),t.forEach(t.entries(i),([e,s])=>{e.startsWith("on")&&t.isFunction(s)&&(this.on(e.replace("on",""),s),delete i[e])}),u.attrProcess(this,i)}on(t,e,s){let i=i=>{i.addEventListener(t,e,s),this.listen("dispose",()=>this.node?.removeEventListener(t,e))};this.node&&i(this.node),this.listen("dom",i)}off(t,e,s){this.node?.removeEventListener(t,e,s)}toString(){return this.parseHTML()}parseHTML(e){let s=this.tagname,i=e?.children??(this.#e||t.map(this.protos,t=>t.visible?`${t}`:"").join("")),o=e?.attr??t.map(t.entries(this.#t),([t,e])=>e.length?`${t}="${e}"`:t).join(" "),r=o.length?" "+o:"";return c.includes(s)?`<${s}${r} />`:`<${s}${r}>${i}</${s}>`}toDOM(e=!0){super.toDOM();let s=!!this.node,i=this.node??document.createElement(this.tagname);return this.node=i,e&&(this.#e&&!s?this.node.innerHTML=this.#e:s&&!this.virtual||this.DOMProcess()),s||t.forEach(t.entries(this.#t),([t,e])=>i.setAttribute(t,e)),s||this.dispatch("dom",[this.node]),[i]}innerHTML(t){this.#e=t,this.node&&(this.node.innerHTML=t)}attr(e,s){return arguments.length?t.isUndefined(s)?this.#t[e]??t.Null:(t.isNull(s)?(delete this.#t[e],this.node?.removeAttribute(e)):(this.#t[e]=`${s}`,this.node?.setAttribute(e,s)),this):this.#t}hasAttr(e){return!t.isNull(this.attr(e))}addClass(...t){this.token("add","class",...t),this.node?.classList.add(...t)}removeClass(...t){this.token("delete","class",...t),this.node?.classList.remove(...t)}style(e){if(this.node)t.assign(this.node.style,e);else{const s=this.attr("style");if(s){e={...t.fromEntries(s.split(";").map(t=>t.split(":"))),...e}}this.attr("style",t.entries(e).map(([e,s])=>`${t.camelToDashedStyle(e)}: ${s}`).join("; "))}}token(e,s,...i){let o=this.#t[s],r=new Set(o?.split(" ")??[]);t.forEach(i,t=>r[e](t)),this.#t[s]=t.arrayFrom(r).join(" ")}}class p extends d{#s;constructor(t){super(),this.#s=t}get content(){return this.#s}set content(t){this.#s=t,this.node&&(this.node.textContent=t)}toString(){return this.#s}toDOM(){if(super.toDOM(),this.node)return[this.node];let t=new Text(this.#s);return this.node=t,this.dispatch("dom",[this.node]),[t]}get text(){return this.#s}}class f extends d{constructor(t){super(t),i()&&(this.node=new Text)}toDOM(){return[this.node,...super.toDOM()]}removeNode(){super.removeNode(),t.forEach(this.protos,t=>t.removeNode())}}class m{proto;tasks=/* @__PURE__ */new Set;constructor(t=h.proto){if(!t)throw"ProtoProcess error: proto context is missing";this.proto=t}exec(t){return this.tasks.add({fn:t,await:!1}),this}await(e){return e=t.toArray(e),this.tasks.add({fn:()=>Promise.all(e.map(e=>t.isFunction(e)?e():e)),await:!0}),this}async run(){for(const e of this.tasks){const s=()=>{const s=$.context(this.proto,e.fn);if(t.isInstanceof(s,Promise))return this.proto?.global.asyncTask(s)};e.await?await s():s()}return this.dispose(),this}dispose(){this.tasks.clear(),this.proto=null}}const b=t=>{i()&&(document.addEventListener("scroll",()=>requestAnimationFrame(()=>g(t)),!0),t.listen("dom",e=>new ResizeObserver(()=>g(t)).observe(e)),t.listen("mutate",()=>g(t)),t.virtual=!0)},g=e=>{if(!e.inDOM())return;if(!e.node)return;const s=e.node?.getBoundingClientRect();t.forEach(e.children,e=>{if(!t.isInstanceof(e,u))return;if(!e.node)return;if(e.node.contains(document.activeElement))return e.visible=!0;const{translate:i}=e.node.style,o=i.split(" ")[1],r=s.top+parseInt(o);r+e.node.offsetHeight<-200||r>outerHeight+200?e.visible=!1:e.visible=!0}),e.toDOM()};function v(e,...s){const i=h.proto,o=[],r=t=>{e&&i?.append(t),o.push(t)};for(let h of y.middleware.craft){let e=h(...s);if(!t.isUndefined(e))return r(e),e}const[n,l,a]=s;if(t.isInstanceof(n,h))return r(n),n;if(t.isString(n)){let e=t.isFunction(l)?[,l]:[l,a],s=new u(n,...e);return r(s),s}if(t.isFunction(n)){let e=l?[l,a]:[a];t.isInstanceof(n.prototype,u)&&(e=t.isFunction(l)?[{},l]:[l,a]);let s=new n(...e);if(t.isInstanceof(s,h))return r(s),s}if(t.isArray(n)){let e=e=>{for(let i of y.middleware.text){let s=i(e);if(!t.isUndefined(s))return r(s)}let s=t.isUndefined(e)?t.Null:new p(`${e}`);s&&r(s)},[i,...n]=s;return i.raw?t.forEach(i,(s,i)=>{let o=s.length?new p(s):t.Null,l=n[i];o&&r(o),e(l)}):t.forEach(i,t=>e(t)),o}}function y(...t){return v(!0,...t)}var w;(w=y||(y={})).middleware={craft:/* @__PURE__ */new Set,text:/* @__PURE__ */new Set,attr:/* @__PURE__ */new Set,ssr:/* @__PURE__ */new Set},w.craft=(...t)=>v(!1,...t),w.render=async(t,e)=>{let s=w(t),o=s.build().toDOM(),r=document.querySelector(e);r&&(await Promise.all(s.global.promises),r?.replaceChildren(...o),i()&&document.querySelector("style#__ssr__")?.remove())},w.context=(t,e)=>{let s=h.proto;h.proto=t;let i=e();return h.proto=s,i},w.async=t=>h.proto?.global.asyncTask(t(h.proto))??t(h.proto),w.process=t=>t(new m).run(),w.stylesheet=i()?new CSSStyleSheet:t.Null,w.styleMap=/* @__PURE__ */new Map,w.style=(e,s)=>{let i=t.toArray(s);if(e){let s=w.styleMap.get(e)??/* @__PURE__ */new Set;t.forEach(i,t=>s.add(t)),w.styleMap.set(e,s)}w.stylesheet&&t.forEach(i,t=>w.stylesheet.insertRule(t))},w.stylesheet&&document.adoptedStyleSheets.push(w.stylesheet),w.stylesheet?.insertRule("@layer base, ui"),globalThis.$=y;export{y as $,u as ElementProto,a as GlobalState,d as NodeProto,h as Proto,f as ProxyProto,p as TextProto,b as VirtualScroll,s as _document,e as _window,i as onclient,o as onserver,r as symbol_ProtoType,l as symbol_Signal,n as symbol_Statement};
|
package/build/css.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Utils as e,UID as t}from"@amateras/utils";import{ElementProto as s,onserver as r}from"@amateras/core";const
|
|
1
|
+
import{Utils as e,UID as t}from"@amateras/utils";import{ElementProto as s,onserver as r,onclient as n}from"@amateras/core";const o=/* @__PURE__ */new WeakMap,a=/* @__PURE__ */new Set,l=e.call(()=>/* @__PURE__ */new Map);class i{}class c extends i{declarations=/* @__PURE__ */new Map;rules=/* @__PURE__ */new Map;selector;parent=e.Null;css;constructor(e,t,s){super(),this.selector=e,this.parent=s,t&&u(this,t),this.css=t}toString(){let t=e.map(this.declarations,([e,t])=>`${e.replaceAll(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${t};`),s=e.map(this.rules,([e,t])=>`${t}`);return`${this.selector} { ${[...t,...s].join(" ")} }`}}const u=(t,s)=>{for(let[r,n]of e.entries(s))if("__selector__"!==r)if(e.isString(n)||e.isNumber(n)||e.isInstanceof(n,i))t.declarations.set(r,`${n}`);else{let e=t.selector.startsWith("@")&&!t.parent?r:`${/^[@]|&/.test(r)?r:`& ${r}`}`;t.rules.set(e,new c(e,n,t))}},d=(t,s,r=!0)=>{let n=r?e.stringify(s):"";if(r){let e=l.get(n);if(e)return e}let o=new c(t(),s,e.Null);return $.style(e.Null,`${o}`),r&&l.set(n,o),o};e.assign($,{css:s=>e.isInstanceof(s,c)?s:d(()=>`.${t.generate("css")}`,s),CSS:t=>e.map(e.entries(t),([e,t])=>{let s=d(()=>e,{...t,__selector__:e});return a.add(s),s})}),e.assign(s.prototype,{css(...e){return p(e,this),this}});const p=(t,s)=>{let r=e.Null;e.forEach(e.toArray(t),t=>{e.isInstanceof(t,c)?f(s,t):r=e.assign(r??{},t)}),e.isNull(r)||f(s,r)},f=(e,t)=>{let s=$.css(t),r=s.selector.slice(1);e.addClass(r);const n=o.get(e)??/* @__PURE__ */new Set;n.add(s),o.set(e,n)};if(r()&&e.assign($.CSS,{rules(t){let s=/* @__PURE__ */new Set;return e.forEach([t,...t.protos],r=>{let n=o.get(r);e.forEach(n,e=>s.add(e)),t!==r&&e.forEach(this.rules(r),e=>s.add(e))}),e.arrayFrom(s)},text(e){return[...a,...this.rules(e)].join("\n")}}),n()){const e=e=>{addEventListener(e,e=>{"touch"===e.pointerType?document.documentElement.setAttribute("touch",""):document.documentElement.removeAttribute("touch")})};e("pointerdown"),e("pointermove")}$.middleware.attr.add((e,t,s)=>{if("css"===e)return p(t,s),!0}),r()&&$.middleware.ssr.add((t,s)=>{let r="";if(e.forEach($.styleMap,([s,n])=>{t.findBelow(e=>e.constructor===s)&&e.forEach(n,e=>r+=e)}),r+=$.CSS.text(t),r.length){const e=$.context(s,()=>$.craft("style",{id:"__ssr__"},()=>$([r])));s.append(e),e.build()}});export{i as $CSS,c as $CSSRule};
|
package/build/for.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ProxyProto as t,symbol_Statement as e,Proto as s}from"@amateras/core";import{Utils as i}from"@amateras/utils";class o extends t{static[e]=!0;#t;list$;#e=/* @__PURE__ */new Map;constructor(t,e){super(),this.list$=t,this.#t=e;let s=()=>{const t=this.exec();i.forEach(this.protos,t=>t.builded||t.build()),i.forEach(t,t=>t.removeNode());let e=this.node,s=e?.parentNode;if(e&&s){let t=this.toDOM(),o=i.arrayFrom(s.childNodes).indexOf(e),r=i.Null;i.forEach(t,a=>{if(a!==e){let e=s.childNodes[o];e!==a&&(r=t.includes(e)?s.childNodes[o+1]??i.Null:e??i.Null,s.insertBefore(a,r))}o++})}this.parent?.mutate(),this.parent?.dispatch("mutate",[],{bubbles:!0})};this.list$.subscribe(s),this.listen("dispose",()=>this.list$.unsubscribe(s))}build(){return this.#e=/* @__PURE__ */new Map,this.exec(),this.protos.forEach(t=>t.builded||t.build()),this}exec(){let t=new Set(this.protos),e=/* @__PURE__ */new Set;return i.forEach(i.arrayFrom(this.list$.value),(i
|
|
1
|
+
import{ProxyProto as t,symbol_Statement as e,Proto as s}from"@amateras/core";import{Utils as i}from"@amateras/utils";class o extends t{static[e]=!0;#t;list$;#e=/* @__PURE__ */new Map;constructor(t,e){super(),this.list$=t,this.#t=e;let s=()=>{const t=this.exec();i.forEach(this.protos,t=>t.builded||t.build()),i.forEach(t,t=>t.removeNode());let e=this.node,s=e?.parentNode;if(e&&s){let t=this.toDOM(),o=i.arrayFrom(s.childNodes).indexOf(e),r=i.Null;i.forEach(t,a=>{if(a!==e){let e=s.childNodes[o];e!==a&&(r=t.includes(e)?s.childNodes[o+1]??i.Null:e??i.Null,s.insertBefore(a,r))}o++})}this.parent?.mutate(),this.parent?.dispatch("mutate",[],{bubbles:!0})};this.list$.subscribe(s),this.listen("dispose",()=>this.list$.unsubscribe(s))}build(){return this.#e=/* @__PURE__ */new Map,this.exec(),this.protos.forEach(t=>t.builded||t.build()),this}exec(){let t=new Set(this.protos),e=/* @__PURE__ */new Set;return i.forEach(i.arrayFrom(this.list$.value),(s,i)=>{$.context(this,()=>{let o=this.#t,a=this.#e.get(s)??new r(()=>o(s,i));this.#e.set(s,a),t.delete(a),e.add(a)})}),this.replaceProtos(...e),t}dispose(){super.dispose(),i.forEach(this.#e.values(),t=>t.dispose()),this.#e.clear()}mutate(){super.mutate(),this.parent?.mutate()}}class r extends s{static[e]=!0}globalThis.For=o,$.middleware.craft.add((t,e,s)=>{if(t===o)return new o(e,s)});export{o as For,r as ForItem};
|
package/build/i18n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Utils as t}from"@amateras/utils";import{onclient as e,Proto as s,GlobalState as i,ProxyProto as n}from"@amateras/core";class a{session;key;options;locale;updating=!1;updaters=[];constructor(t,e,s,i){this.session=t,this.key=e,this.options=s,this.session.translations.add(this),this.locale=i}async update(){if(this.updating)return;this.updating=!0;const e=this.session.fetch(this.key,this.options,this.locale);this.session.global.asyncTask(e);const{text:s,args:i}=await e,n=t.map(s,(t,e)=>e<i.length?[t,i[e]]:[t]).flat();return t.forEach(this.updaters,t=>t(n)),this.updating=!1,this}onupdate(t){this.updaters.push(t)}}class l{translations=/* @__PURE__ */new Set;i18n;#t;locale$;global;listeners=/* @__PURE__ */new Set;constructor(t,e){this.i18n=t,this.global=e,this.#t=t.locale(),this.locale$=$.signal(this.#t),t.sessions.add(this)}async fetch(e,s,i=this.#t){const n=this.i18n.dictionaries.get(i);if(!n)return{text:[e],args:[]};const a=await n.find(e);if(t.isUndefined(a))return{text:[e],args:[]};const l=a.split(/\$[a-zA-Z0-9_]+\$/);if(1===l.length||!s)return{text:[a],args:[]};const o=a.matchAll(/(\$([a-zA-Z0-9_]+)\$)/g);return{text:l,args:t.map(o,([,,t])=>s[t])}}locale(s){if(!arguments.length)return this.#t;if(s){if(!this.i18n.dictionaries.get(s)){let t=s.split("-");if(1===t.length)return;return this.locale(t[0])}}return s&&s!==this.#t?(this.#t=s,this.locale$.set(s),new Promise(async s=>{await Promise.all(t.map(this.translations,t=>t.update())),s(),e()&&dispatchEvent(new Event("localeupdate")),t.forEach(this.listeners,t=>t(this))})):void 0}dispose(){this.global=t.Null,this.listeners=t.Null,this.i18n.sessions.delete(this),this.i18n=t.Null,this.translations=t.Null,this.locale$.dispose(),this.locale$=t.Null}}class o{#e=null;#s=null;constructor(e){t.isFunction(e)?this.#s=e:this.#e=e}async context(){let s=()=>e()&&window.dispatchEvent(new Event("i18ncontext"));if(this.#e)return t.isAsyncFunction(this.#e)?await this.#e.finally(s):this.#e;if(!this.#s)throw"I18n Context Fetch Error";return this.#e=this.#s().then(t=>t.default).finally(s)}async find(e,s){s||(s=await this.context());const[i,...n]=e.split("."),a=s[i];if(t.isFunction(a)){const t=await a().then(t=>t.default);return n.length?this.find(n.join("."),t):t._}return t.isObject(a)?n.length?this.find(n.join("."),a):a._:n.length?e:a}}class r{#t;dictionaries=/* @__PURE__ */new Map;defaultLocale;sessions=/* @__PURE__ */new Set;path="";static key="__locale__";constructor(t){this.defaultLocale=t,this.#t=t}add(t,e){return this.dictionaries.set(t,new o(e)),this}delete(t){return this.dictionaries.delete(t),this}t(t,...e){return new a(this.session,this.getFullPath(t),...e)}async text(e,...s){const[i,n]=s;let a=await this.session.fetch(this.getFullPath(e),...t.isString(i)?[t.Undefined,i]:[i,n]);return a.text.reduce((t,e,s)=>t+e+(a.args[s]||""),"")}dir(t){let e=this;return{t:(s,i,n)=>e.t(`${t}.${s}`,i,n),text:(s,i,n)=>e.text(`${t}.${s}`,i,n),dir:s=>e.dir(`${t}.${s}`)}}locale(e){if(!arguments.length)return this.readStoreLocale(),this.#t;if(!e)return;if(!this.dictionaries.get(e)){let t=e.split("-");if(1===t.length)return;return this.locale(t[0])}return this.#t=e,this.writeStoreLocale(e),Promise.all(t.map(this.sessions,t=>t.locale(e)))}getFullPath(t){return this.path?`${this.path}.${t}`:t}get session(){let t=s.proto;if(t){let e=t.global.i18n.session??new l(this,t.global);return t.global.i18n.session=e,e}throw"I18n.getSession(): session not found from Proto.proto"}readStoreLocale(){e()&&(this.#t=localStorage.getItem(r.key)??this.defaultLocale)}writeStoreLocale(t){e()&&localStorage.setItem(r.key,t)}}i.assign(()=>({i18n:{session:t.Null}})),i.disposers.add(e=>{e.i18n.session?.dispose(),e.i18n.session=t.Null}),t.assign($,{i18n:t=>new r(t)}),$.middleware.text.add(e=>{if(t.isInstanceof(e,a)){const s=new n;return e.onupdate(e=>{s.layout=()=>$([...e]),t.forEach(s.protos,t=>t.removeNode()),s.build(),s.node?.replaceWith(...s.toDOM()),s.dispatch("i18nupdate",[void 0],{bubbles:!0})}),e.update(),s}}),$.middleware.attr.add((e,s,i)=>{t.isInstanceof(s,a)&&(s.onupdate(t=>{i.attr(e,t.join(""))}),s.update())});export{r as I18n,o as I18nDictionary,l as I18nSession,a as I18nTranslation};
|
package/build/if.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Proto as s,symbol_Statement as t,ProxyProto as e}from"@amateras/core";import{Utils as i}from"@amateras/utils";import{Signal as a}from"@amateras/signal";class l extends s{static[t]=!0;exps;constructor(s,t){super(()=>t(...this.exps??[])),this.exps=s?i.toArray(s):i.Null}dispose(){super.dispose(),this.exps=i.Null}mutate(){super.mutate(),this.parent?.mutate()}validate(){return!this.exps||!this.exps.find(s=>!s.value)}}class r extends l{}class o extends l{}class u extends l{}class p extends e{static[t]=!0;statement=i.Null;virtual=!0;build(){super.build(!1,!1),this.validate()?.build();let s=()=>{let s=this.validate();s?.builded||s?.build(),this.statement!==s&&(this.statement=s??i.Null,i.forEach(this.protos,s=>!s.visible&&s.removeNode()),this.node?.replaceWith(...this.toDOM()),this.parent?.mutate(),this.parent?.dispatch("mutate",[],{bubbles:!0}))};return i.forEach(this.protos,t=>{i.forEach(t.exps,e=>{e?.subscribe(s),t.listen("dispose",()=>{e?.unsubscribe(s)})})}),this}get protos(){return super.protos}dispose(){super.dispose(),this.statement=i.Null}mutate(){super.mutate(),this.parent?.mutate()}validate(){i.forEach(this.protos,s=>s.visible=!1);for(let s of this.protos)if(s.validate())return s.visible=!0,s}}globalThis.If=u,globalThis.Else=r,globalThis.ElseIf=o;let
|
|
1
|
+
import{Proto as s,symbol_Statement as t,ProxyProto as e}from"@amateras/core";import{Utils as i}from"@amateras/utils";import{Signal as a}from"@amateras/signal";class l extends s{static[t]=!0;exps;constructor(s,t){super(()=>t(...this.exps??[])),this.exps=s?i.toArray(s):i.Null}dispose(){super.dispose(),this.exps=i.Null}mutate(){super.mutate(),this.parent?.mutate()}validate(){return!this.exps||!this.exps.find(s=>!s.value)}}class r extends l{}class o extends l{}class u extends l{}class p extends e{static[t]=!0;statement=i.Null;virtual=!0;build(){super.build(!1,!1),this.validate()?.build();let s=()=>{let s=this.validate();s?.builded||s?.build(),this.statement!==s&&(this.statement=s??i.Null,i.forEach(this.protos,s=>!s.visible&&s.removeNode()),this.node?.replaceWith(...this.toDOM()),this.parent?.mutate(),this.parent?.dispatch("mutate",[],{bubbles:!0}))};return i.forEach(this.protos,t=>{i.forEach(t.exps,e=>{e?.subscribe(s),t.listen("dispose",()=>{e?.unsubscribe(s)})})}),this}get protos(){return super.protos}dispose(){super.dispose(),this.statement=i.Null}mutate(){super.mutate(),this.parent?.mutate()}validate(){i.forEach(this.protos,s=>s.visible=!1);for(let s of this.protos)if(s.validate())return s.visible=!0,s}}globalThis.If=u,globalThis.Else=r,globalThis.ElseIf=o;let d=null;$.middleware.craft.add((s,t,e)=>{if(s===u&&(d=new p),i.isInstanceof(d,p)){if(i.isIncluded(s,[u,r,o])){{let l=new s(...i.isInstanceof(t,a)||i.isArray(t)?[t,e]:[i.Null,t]);d.append(l)}return d}d=i.Null}else if(i.isIncluded(s,[r,o]))throw"ElseIf/Else must be after If or ElseIf"});
|
package/build/import-map.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=`https://unpkg.com/amateras@${"0.
|
|
1
|
+
const e=`https://unpkg.com/amateras@${"0.16.0"}/build`,t={amateras:`${e}/core.js`},s=[{name:"core",description:"Core module",entry:"core/src/index.ts",mapped:!0,listed:!0},{name:"widget",description:"Component module",entry:"widget/src/index.ts",mapped:!0,listed:!0},{name:"signal",description:"Reactive data module",entry:"signal/src/index.ts",mapped:!0,listed:!0},{name:"store",description:"Access data between widgets",entry:"store/src/index.ts",mapped:!0,listed:!0},{name:"css",description:"CSS-in-JS module",entry:"css/src/index.ts",mapped:!0,listed:!0},{name:"css-variable",description:"CSS variable module",entry:"css/src/ext/variable.ts",mapped:!0,listed:!1},{name:"css-keyframes",description:"CSS keyframes module",entry:"css/src/ext/keyframes.ts",mapped:!0,listed:!1},{name:"css-property",description:"CSS property module",entry:"css/src/ext/property.ts",mapped:!0,listed:!1},{name:"for",description:"For loop control-flow",entry:"for/src/index.ts",mapped:!0,listed:!0},{name:"if",description:"If/Else/ElseIf control-flow",entry:"if/src/index.ts",mapped:!0,listed:!0},{name:"match",description:"Match/Case/Default control-flow",entry:"match/src/index.ts",mapped:!0,listed:!0},{name:"router",description:"Router module",entry:"router/src/index.ts",mapped:!0,listed:!0},{name:"i18n",description:"Translation module",entry:"i18n/src/index.ts",mapped:!0,listed:!0},{name:"idb",description:"IndexedDB module",entry:"idb/src/index.ts",mapped:!0,listed:!0},{name:"markdown",description:"Markdown to HTML module",codeInsert:'import { Markdown } from "amateras/markdown"; new Markdown();',entry:"markdown/src/index.ts",mapped:!0,listed:!0},{name:"prefetch",description:"SSR data prefetch",entry:"prefetch/src/index.ts",mapped:!0,listed:!0},{name:"meta",description:"SSR `meta` tag manager",entry:"meta/src/index.ts",mapped:!0,listed:!0},{name:"ui",description:"UI components",entry:"ui/src/index.ts",mapped:!0,listed:!0},{name:"utils",description:"Utilities module",entry:"utils/src/index.ts",mapped:!0,listed:!0}].map(e=>e.name),r={...t,...Object.fromEntries(s.map(t=>{const s=`amateras/${t}`,r=`${e}/${t}.js`;return[[s,r],[`@${s}`,r]]}).flat())},n=document.querySelector('script[type="importmap"]');if(n){const e=JSON.parse(n.innerHTML);e.imports={...e.imports,...r},n.innerHTML=JSON.stringify(e,null,"\t")}else{const e=document.createElement("script");e.setAttribute("type","importmap"),e.innerHTML=JSON.stringify({imports:r},null,"\t"),document.head.prepend(e)}
|
package/build/match.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Proto as t,symbol_Statement as e,ProxyProto as s}from"@amateras/core";import{Utils as i}from"@amateras/utils";class a extends t{static[e]=!0;condition;constructor(t,e){super(e),this.condition=i.isArray(t)?t:[t]}}class l extends t{static[e]=!0;constructor(t){super(t)}}class d extends s{static[e]=!0;exp$;cases=/* @__PURE__ */new Set;matched=i.Null;#t=i.Null;constructor(t,e){super(()=>{e((t,e,s)=>{$(t,e,s)})}),this.exp$=t}dispose(){i.forEach(this.cases,t=>t.dispose()),this.#t?.dispose(),this.matched=i.Null,this.#t=i.Null,this.cases.clear()}build(){super.build(!1),this.validate();let t=()=>{let t=this.matched,e=this.validate();t!==e&&(i.forEach(this.cases,t=>t!==e&&t.removeNode()),e!==this.#t&&this.#t?.removeNode(),this.node?.replaceWith(...this.toDOM()),this.parent?.mutate(),this.parent?.dispatch("mutate",[],{bubbles:!0}))};return i.forEach(this.cases,e=>{this.exp$.subscribe(t),e.listen("dispose",()=>this.exp$.unsubscribe(t))}),this}mutate(){super.mutate(),this.parent?.mutate()}case(t,e){let s=new a(t,e);return this.cases.add(s),s}default(t){let e=new l(t);return this.#t=e,e}validate(){this.clear();for(let t of this.cases)if(t.condition.includes(this.exp$.value))return this.append(t),t.builded||t.build(),this.matched=t;if(this.#t)return this.append(this.#t),this.#t.builded||this.#t.build(),this.matched=this.#t}}globalThis.Match=d,globalThis.Case=a,globalThis.Default=l,$.
|
|
1
|
+
import{Proto as t,symbol_Statement as e,ProxyProto as s}from"@amateras/core";import{Utils as i}from"@amateras/utils";class a extends t{static[e]=!0;condition;constructor(t,e){super(e),this.condition=i.isArray(t)?t:[t]}}class l extends t{static[e]=!0;constructor(t){super(t)}}class d extends s{static[e]=!0;exp$;cases=/* @__PURE__ */new Set;matched=i.Null;#t=i.Null;constructor(t,e){super(()=>{e((t,e,s)=>{$(t,e,s)})}),this.exp$=t}dispose(){i.forEach(this.cases,t=>t.dispose()),this.#t?.dispose(),this.matched=i.Null,this.#t=i.Null,this.cases.clear()}build(){super.build(!1),this.validate();let t=()=>{let t=this.matched,e=this.validate();t!==e&&(i.forEach(this.cases,t=>t!==e&&t.removeNode()),e!==this.#t&&this.#t?.removeNode(),this.node?.replaceWith(...this.toDOM()),this.parent?.mutate(),this.parent?.dispatch("mutate",[],{bubbles:!0}))};return i.forEach(this.cases,e=>{this.exp$.subscribe(t),e.listen("dispose",()=>this.exp$.unsubscribe(t))}),this}mutate(){super.mutate(),this.parent?.mutate()}case(t,e){let s=new a(t,e);return this.cases.add(s),s}default(t){let e=new l(t);return this.#t=e,e}validate(){this.clear();for(let t of this.cases)if(t.condition.includes(this.exp$.value))return this.append(t),t.builded||t.build(),this.matched=t;if(this.#t)return this.append(this.#t),this.#t.builded||this.#t.build(),this.matched=this.#t}}globalThis.Match=d,globalThis.Case=a,globalThis.Default=l,$.middleware.craft.add((e,s,h)=>e===d?new d(s,h):e===a?i.is(t.proto,d)?.case(s,h):e===l?i.is(t.proto,d)?.default(s):void 0);
|
package/build/meta.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Utils as t}from"@amateras/utils";import{Proto as
|
|
1
|
+
import{Utils as t}from"@amateras/utils";import{Proto as e,onclient as o,onserver as r}from"@amateras/core";const a=(e,o,r,n)=>{let s=t=>r?`${r}:${t}`:t,i=(t,e)=>o.push({[n]:s(t),content:e});for(const[c,l]of t.entries(e))t.isString(l)?i(c,l):t.isArray(l)?t.forEach(l,e=>{t.isString(e)?i(c,e):a(e,o,s(c),n)}):a(l,o,s(c),n)};function n(e,o){for(const[r,a]of t.entries(o))!t.isNull(a)&&t.isObject(a)&&e[r]?n(e[r],a):e[r]=a;return e}t.assign($,{meta(t,r=e.proto){o()||r&&(r.global.meta=n(r.global.meta??{},t))}}),r()&&$.middleware.ssr.add((e,o)=>{const r=e.global.meta;let a=$.meta.resolve(r);t.forEach(a,t=>{const e=$.context(o,()=>$.craft("meta",t));o.append(e),e.build()})}),r()&&t.assign($.meta,{resolve:function(t){let e=[],{description:o,og:r,twitter:n}=t;return o&&e.push({name:"description",content:o}),r&&a(r,e,"og","property"),n&&a(n,e,"twitter","name"),e}});
|
package/build/prefetch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GlobalState as e,onclient as
|
|
1
|
+
import{GlobalState as e,onclient as r,onserver as t,Proto as o}from"@amateras/core";import{Utils as i}from"@amateras/utils";e.assign(()=>({prefetch:{caches:{},req:null,expired:Date.now()+3e4}})),e.disposers.add(e=>{e.prefetch.caches=i.Null,e.prefetch.req=i.Null,e.prefetch=i.Null}),r()&&!globalThis.prefetch&&(globalThis.prefetch={caches:{},expired:Date.now()}),t()&&$.middleware.ssr.add((e,r)=>{const t=$.context(r,()=>$("script",()=>$`window.prefetch = ${JSON.stringify({caches:e.global.prefetch.caches,expired:e.global.prefetch.expired})}`));r.append(t),t.build()}),i.assign($,{async fetch(e,s,l=o.proto){e=i.toURL(e,$.fetch.origin);let h=r()&&Date.now()<prefetch.expired?a(e,s):i.Null,d=s?.then,n=new Promise(async r=>{if(h){let e=d?.(h.data);return void r({record:h.data,result:e})}let{origin:o,server:a}=$.fetch,n=l?.global.prefetch.req?.headers.get("cookie")||"",f=e.origin===o&&a?await a.fetch(new Request(e,{...s,headers:{...s?.headers,Cookie:n}})):await fetch(e,s),p=s?.record;if(p){let o,a=i.isAsyncFunction(p)?await p(f):p(f);t()&&l&&c(l,e,a,s),$.context(l,()=>{o=d?.(a)}),r({record:a,result:o})}});return t()&&l?.global.asyncTask(n),n}});const c=(e,r,t,o)=>{const c=e.global.prefetch.req;if(c&&r.origin===$.fetch.origin){const e=new URL(c.url),t=c.headers.get("x-forwarded-proto")||e.protocol.replace(":",""),o=c.headers.get("x-forwarded-host")||c.headers.get("host")||r.host;r=new URL(r.href.replace(r.origin,""),`${t}://${o}`)}const a=e.global.prefetch.caches[r.href]??[],s=i.isUndefined(o?.body)?"":i.isString(o.body)?o.body:i.Null;i.isNull(s)||(a.push({data:t,method:o?.method??"GET",body:s}),e.global.prefetch.caches[r.href]=a)},a=(e,r)=>{const t=prefetch.caches[e.href],o=i.isUndefined(r?.body)?"":i.isString(r.body)?r.body:i.Null;if(!i.isNull(o)&&t)return t.find(e=>{if(e.method===(r?.method??"GET"))return e.body===o||void 0})};i.assign($.fetch,{origin:r()?location.origin:"http://localhost",server:null});
|
package/build/router.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ElementProto as t,onclient as e,Proto as s,
|
|
1
|
+
import{ElementProto as t,onclient as e,Proto as s,onserver as r,ProxyProto as i,symbol_ProtoType as o,GlobalState as l}from"@amateras/core";import{Utils as a}from"@amateras/utils";class n extends t{constructor(t,e){super("a",t,e),this.on("click",t=>{if(t.shiftKey||t.ctrlKey)return;t.preventDefault();let e=this.attr("target"),s=this.attr("href");s&&("_replace"===e?$.replace(s):$.open(s,e??a.Undefined))})}}let c=0;const[h,u]=[1,2],[p,d]=["forward","back"],f="__scroll_history__",g=e()?sessionStorage:a.Null,w=e()?window.addEventListener:a.Null,v=e()?window.removeEventListener:a.Null;e()&&(history.scrollRestoration="manual");const b=t=>{const e=m.scrollHistory;if(t){let s=t.target;"#document"===s.nodeName?e[c]={[s.nodeName]:{x:window.scrollX,y:window.scrollY}}:""!==s.id&&(e[c]={[s.id]:{x:s.scrollLeft,y:s.scrollTop}})}else a.forEach(a.entries(e),([t])=>+t>=c&&delete e[+t]);g?.setItem(f,a.stringify(e))};class m extends s{static direction=p;static prev=a.Null;static url=a.Null;routes=/* @__PURE__ */new Map;slot=new x;static routers=/* @__PURE__ */new Set;constructor(){super(()=>$(this.slot)),e()&&m.routers.add(this)}set url(t){this.global.router.url=t}build(){if(e()){const t=()=>{const t=history.state?.index??0;c>t&&(m.direction=d),c<t&&(m.direction=p),c=t,m.prev=this.url,this.url=a.toURL(location.href),this.resolve(location.href)};t(),w?.("popstate",t),w?.("scroll",b,{capture:!0,passive:!1}),this.listen("dispose",()=>{v?.("popstate",t),v?.("scroll",b,{capture:!0})})}return super.build()}dispose(t){super.dispose(t),m.routers.delete(this)}async resolve(t){if(!t)return;let s=a.toURL(t);this.url=s,this.global.router.scrollQueue.clear();for(let[,e]of this.routes){let t=await e.resolve(s.pathname,this.slot,{});if(t){this.global.router.routes=t;let e=[""],s=[];a.forEach(t,t=>(e=a.map(t.validPaths,t=>a.map(e,e=>e+t)).flat(),s.push(...e),e)),this.global.router.matchPaths=s;break}}m.url=s,a.forEach(this.global.router.navlinks,t=>t.checkActive()),e()&&window.dispatchEvent(new y("pathchange",this.constructor)),Promise.all(this.global.router.scrollQueue).then(()=>{s===m.url&&m.scrollRestoration()})}static open(t,e="_self"){r()||(a.toURL(t).origin!==origin?open(t,e):m.writeState(t,h,e))}static forward(){r()||history.forward()}static back(){r()||history.back()}static replace(t){r()||m.writeState(t,u)}static get scrollData(){return this.scrollHistory[c]??{}}static get scrollHistory(){return a.json(g?.getItem(f)??"{}")}static scrollRestoration(){if(e()){if(!window.dispatchEvent(new y("scrollrestoration",this,{cancelable:!0})))return;let t=m.scrollData??{x:0,y:0},e=a.entries(t);e.length?a.forEach(e,([t,{x:e,y:s}])=>{"#document"===t?window.scrollTo(e,s):document.getElementById(t)?.scrollTo(e,s)}):(document.querySelectorAll("*").forEach(t=>t.scrollTo(0,0)),window.scrollTo(0,0))}}static writeState(t,e,s){if(r())return;if(!t)return;let i=a.toURL(t);if(i.href!==location.href){if(s&&"_self"!==s)return open(i,s);e===h&&c++,b(),m.direction=p,m.prev=a.toURL(location.href),history[e===h?"pushState":"replaceState"]({index:c},"",i),a.forEach(this.routers,e=>e.resolve(t)),window.dispatchEvent(new y("pathchange",this))}}}class y extends Event{Router;constructor(t,e,s){super(t,s),this.Router=e}}class x extends i{page=a.Null;prevPage=a.Null;constructor(){super()}switch(t){this.page!==t&&(this.prevPage=this.page,this.clear(),this.layout=()=>$(t),this.append(t),this.page=t,t.builded||t.build(),t.updateTitle(),this.dispatch("pageswitch",[this,m.direction],{bubbles:!0})||this.render())}render(){if(e()){this.prevPage?.removeNode();let t=this.toDOM();this.node?.replaceWith(...t)}}dispose(){super.dispose(),this.page=a.Null,this.prevPage=a.Null}}class k extends s{slot=new x;route;title=a.Null;constructor(t,e,s){super(()=>e({params:s,slot:this.slot})),this.route=t}updateTitle(){let t=this.title??this.findAbove(t=>a.is(t,k)?.title)?.title??a.Null,s=t=>{e()&&(document.title=t),this.global.title=t};t&&(a.isInstanceof(t,Promise)?t.then(t=>{this.title=t,s(t)}):s(t))}}class R{routes=/* @__PURE__ */new Map;path;paths=/* @__PURE__ */new Map;validPaths=[];constructor(t){this.path=t,this.paths.set(t,a.Undefined)}routing(t){let e=t.split("/"),s={},r="";t:for(let[o,l]of this.paths){s={};let t=o.split("/"),i=[];for(let s=0;s<Math.max(e.length,t.length);s++)i.push([t[s],e[s]]);e:for(let[e,o]of i){let t=()=>{r=""},i=()=>{r+=("/"!==r?"/":"")+o};if(a.isUndefined(e))break e;if(a.isUndefined(o)){t();continue t}if("*"!==e){if(e?.includes(":")){let[r,l]=e.split(":");if(!o.startsWith(r)){t();continue t}s[l]=o.replace(r,""),i();continue e}if(e!==o){t();continue t}i()}else i()}if(r){s={...s,...a.isFunction(l)?l():l};break t}}if(!r)return;let i=R.resolvePath(this.path,s);return this.validPaths=a.map(this.paths,t=>R.resolvePath(t[0],s)),[i,r,s]}static resolvePath(t,e){return t.replaceAll(/:([^/]+)/g,(t,s)=>`${e[s]}`)}alias(t,e){return this.paths.set(t,e),this}}class P extends R{constructor(t){super(t)}async resolve(t,e,s){let r=this.routing(t);if(!r)return;let[,i,o]=r;s={...s,...o};let l=t.replace(i,"");for(let[a,n]of this.routes){let t=await n.resolve(l||"/",e,s);if(t)return[this,...t]}return[this]}}class N extends R{pages=/* @__PURE__ */new Map;page=a.Null;#t;constructor(t,e){super(t),this.#t=e}async resolve(t,e,s){let r=this.routing(t);if(!r)return;let[i,o,l]=r;s={...s,...l};let a=await this.usePage(i,s,e),n=t.replace(o,"");for(let[c,h]of this.routes){let t=await h.resolve(n||"/",a.slot,s);if(t)return[this,...t]}return n?void 0:[this]}async usePage(t,s,r){let i=this.pages.get(t);if(!i){let l,n=this.#t;if(a.isArray(n)){let t=n[0]();e()&&t.catch(()=>location.reload());let r=await t.then(t=>t.default);l=()=>$(r,s,()=>$(i.slot))}else l="Widget"===this.#t[o]?()=>$(this.#t,s,()=>$(i.slot)):this.#t;$.context(r,()=>{i=new k(this,l,s)}),this.pages.set(t,i)}return this.page=i,r.switch(i),i}}const L=t=>class extends m{static[o]="Router";constructor(){super(),t(this)}};let E={route(t,e,s){let r=new N(t,e);return this.routes.set(t,r),s?.(r),this},group(t,e){let s=new P(t);return this.routes.set(t,s),e?.(s),this}};a.assign(R.prototype,E),a.assign(m.prototype,E),l.assign(()=>({router:{routers:/* @__PURE__ */new Set,resolve(t){return a.map(this.routers,e=>e.resolve(t))},url:e()?new URL(location.href):new URL("http://localhost"),routes:[],matchPaths:[],navlinks:/* @__PURE__ */new Set,scrollQueue:/* @__PURE__ */new Set,postScrollRestoration(t){t.finally(()=>this.scrollQueue.delete(t)),this.scrollQueue.add(t)}}})),l.disposers.add(({router:t})=>{t.routers.clear(),t.routes=[],t.matchPaths=[],t.navlinks.clear()}),a.assign($,{router:t=>L(t),open:m.open,replace:m.replace,back:m.back,forward:m.forward,scrollRestoration:m.scrollRestoration,title(t,e=s.proto){let r=e?.findAbove(t=>a.is(t,k));r&&(r.title=t,r.updateTitle())}}),globalThis.Link=n,globalThis.NavLink=class extends n{constructor(t,e){super(t,e),this.global.router.navlinks.add(this)}dispose(){this.global.router.navlinks.delete(this),super.dispose()}checkActive(){let t=this.attr("href");if(!t)return;const e=this.global.router.matchPaths;for(let s of e)if(("true"!==this.attr("exact")||e.indexOf(s)===e.length-1)&&a.toURL(s).href.replace(/\/$/,"")===a.toURL(t).href.replace(/\/$/,""))return this.attr("active","");this.attr("active",a.Null)}build(t){return super.build(t),this.checkActive(),this}},$.middleware.craft.add(t=>{if(a.isFunction(t)&&"Router"===t[o]){let e=s.proto,r=new t;return e?.global.router.routers.add(r),r}}),r()&&$.middleware.ssr.add((t,e)=>{const s=$.context(e,()=>$.craft("title",()=>$([t.global.title])));e.append(s),s.build()});export{n as Link,k as Page,R as Route,P as RouteGroup,N as RouteNode,x as RouteSlot,m as Router,y as RouterEvent};
|
package/build/signal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Utils as e}from"@amateras/utils";import{symbol_Signal as s,Proto as t,GlobalState as i,ProxyProto as l}from"@amateras/core";let u=!1,a=/* @__PURE__ */new Set,r=e=>{u=!1;let s=e();return u=!0,s},n=e=>{u=!0;let s=e(r);return u=!1,s},o=new FinalizationRegistry(({signal:e,ref:s})=>{e.computes?.delete(s)});class h extends Function{[s]=!0;linked=e.Null;_value;subs=e.Null;map=e.Null;exec=e.Null;computes=e.Null;constructor(s){return super(),t.proto?.global.signals.add(this),this._value=s,e.isInstanceof(s,h)&&this.link(s),new Proxy(this,{apply:()=>this._exec(),get:(s,t)=>{if(e.isSymbol(t)||e.isString(t)&&!t.endsWith("$"))return this[t];t=t.slice(0,-1),this.map||(this.map={});const i=this.map[t];if(i)return i;{const s=this.map[t]??new h(null);return this.map[t]=s,this.setPropValue(s,t),s.subscribe(s=>{e.isObject(this.value)&&!e.isNull(this.value)&&Object.getOwnPropertyDescriptor(this.value,t)?.writable&&(this.value[t]=s),e.isNull(this.value)||this.emit()}),this.subscribe(()=>this.setPropValue(s,t)),s}}})}_exec(){return u&&a.add(this),this.value}setPropValue(s,t){if(e.isObject(this.value)&&!e.isNull(this.value)){const e=this.value[t];s.set(e)}else s._value=null}get value(){return this.linked?this.linked.value:this._value}dispose(){this.subs=e.Null,this.linked=e.Null,e.forEach(this.computes,e=>e.deref()?.dispose()),this.computes=e.Null,this.exec=e.Null,this._value=e.Null,this.map&&e.forEach(e.entries(this.map),([e,s])=>s.dispose()),this.map=e.Null}set(s){e.isInstanceof(s,h)?this.link(s):e.isFunction(s)?this.set(s(this.value)):this.value!==s&&(this._value=s,this.linked=e.Null,this.emit())}modify(e){e(this.value),this.linked?.emit(),this.emit()}emit(){e.forEach(this.subs,e=>e(this.value)),e.forEach(this.computes,e=>{let s=e.deref();s||this.computes?.delete(e),s?.exec?.()})}subscribe(e){this.subs=this.subs??[],this.subs.push(e)}unsubscribe(s){let t=this.subs?.indexOf(s);e.isUndefined(t)||-1===t||this.subs?.splice(t,1)}link(e){if(this===e)throw"Signal.link(): cannot link self";this.linked=e,this.emit(),e.subscribe(()=>this.emit())}is(e){return e(this)}toString(){return`${this.value}`}}i.assign(()=>({signals:/* @__PURE__ */new Set})),i.disposers.add(s=>{e.forEach(s.signals,e=>e.dispose()),s.signals.clear()}),e.assign($,{signal:e=>new h(e),effect(s,t=[]){n(s),e.forEach(t,e=>a.add(e)),e.forEach(a,e=>e.subscribe(e=>s(r))),a.clear()},compute(s){let
|
|
1
|
+
import{Utils as e}from"@amateras/utils";import{symbol_Signal as s,Proto as t,GlobalState as i,ProxyProto as l}from"@amateras/core";let u=!1,a=/* @__PURE__ */new Set,r=e=>{u=!1;let s=e();return u=!0,s},n=e=>{u=!0;let s=e(r);return u=!1,s},o=new FinalizationRegistry(({signal:e,ref:s})=>{e.computes?.delete(s)});class h extends Function{[s]=!0;linked=e.Null;_value;subs=e.Null;map=e.Null;exec=e.Null;computes=e.Null;constructor(s){return super(),t.proto?.global.signals.add(this),this._value=s,e.isInstanceof(s,h)&&this.link(s),new Proxy(this,{apply:()=>this._exec(),get:(s,t)=>{if(e.isSymbol(t)||e.isString(t)&&!t.endsWith("$"))return this[t];t=t.slice(0,-1),this.map||(this.map={});const i=this.map[t];if(i)return i;{const s=this.map[t]??new h(null);return this.map[t]=s,this.setPropValue(s,t),s.subscribe(s=>{e.isObject(this.value)&&!e.isNull(this.value)&&Object.getOwnPropertyDescriptor(this.value,t)?.writable&&(this.value[t]=s),e.isNull(this.value)||this.emit()}),this.subscribe(()=>this.setPropValue(s,t)),s}}})}_exec(){return u&&a.add(this),this.value}setPropValue(s,t){if(e.isObject(this.value)&&!e.isNull(this.value)){const e=this.value[t];s.set(e)}else s._value=null}get value(){return this.linked?this.linked.value:this._value}dispose(){this.subs=e.Null,this.linked=e.Null,e.forEach(this.computes,e=>e.deref()?.dispose()),this.computes=e.Null,this.exec=e.Null,this._value=e.Null,this.map&&e.forEach(e.entries(this.map),([e,s])=>s.dispose()),this.map=e.Null}set(s){e.isInstanceof(s,h)?this.link(s):e.isFunction(s)?this.set(s(this.value)):this.value!==s&&(this._value=s,this.linked=e.Null,this.emit())}modify(e){e(this.value),this.linked?.emit(),this.emit()}emit(){e.forEach(this.subs,e=>e(this.value)),e.forEach(this.computes,e=>{let s=e.deref();s||this.computes?.delete(e),s?.exec?.()})}subscribe(e){this.subs=this.subs??[],this.subs.push(e)}unsubscribe(s){let t=this.subs?.indexOf(s);e.isUndefined(t)||-1===t||this.subs?.splice(t,1)}link(e){if(this===e)throw"Signal.link(): cannot link self";this.linked=e,this.emit(),e.subscribe(()=>this.emit())}is(e){return e(this)}toString(){return`${this.value}`}}i.assign(()=>({signals:/* @__PURE__ */new Set})),i.disposers.add(s=>{e.forEach(s.signals,e=>e.dispose()),s.signals.clear()}),e.assign($,{signal:e=>new h(e),effect(s,t=[]){n(s),e.forEach(t,e=>a.add(e)),e.forEach(a,e=>e.subscribe(e=>s(r))),a.clear()},compute(s,i=[]){let l=n(s),u=$.signal(l),h=t.proto;return u.exec=()=>{$.context(h,()=>{u.set(s(r))})},e.forEach(i,e=>a.add(e)),e.forEach(a,e=>{e.computes=e.computes??/* @__PURE__ */new Set;let s=new WeakRef(u);e.computes.add(s),o.register(u,{signal:e,ref:s})}),a.clear(),u},optional:s=>s.value?s:e.Null,resolve:(s,t)=>e.isInstanceof(s,h)?(t&&(s.subscribe(t),t(s.value)),s.value):(t?.(s),s)});let c=s=>{if(e.isInstanceof(s,h)){let t=new l,i=e.Undefined,u=s=>{e.isString(s)||e.isBoolean(s)||e.isNumber(s)?(i?i.content=`${s}`:t.layout=()=>i=$([s]).at(0),t.builded||t.build()):(i=e.Undefined,t.layout=()=>$([s]),e.forEach(t.protos,e=>e.removeNode()),t.clear(!0),t.builded&&t.build(),t.node?.replaceWith(...t.toDOM()))};return s.subscribe(u),t.listen("dispose",()=>s.unsubscribe(u)),u(s.value),t}};$.middleware.text.add(c),$.middleware.craft.add(c),$.middleware.attr.add((s,t,i)=>{if(e.isInstanceof(t,h)){let e=()=>i.attr(s,t.value);return t.subscribe(e),e(),i.listen("dispose",()=>t.unsubscribe(e)),!0}});export{h as Signal};
|
package/build/ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e,s,i,o,r,n,a,c,l,h=Object.defineProperty,d=t=>{throw TypeError(t)},u=(t,e,s)=>((t,e,s)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),p=(t,e,s)=>e.has(t)||d("Cannot "+s),b=(t,e,s)=>(p(t,e,"read from private field"),s?s.call(t):e.get(t)),g=(t,e,s)=>e.has(t)?d("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),m=(t,e,s,i)=>(p(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s);import{onclient as v,ElementProto as f,onserver as x,TextProto as k,Proto as y,ProxyProto as w}from"@amateras/core";import{Utils as I,UID as N}from"@amateras/utils";const M=t=>(e,s,i)=>{if(e.slide=s,!v())return;let o=s.toDOM();e.node?.append(...o);let r={duration:t?.duration??500,easing:t?.easing??"ease"},n=$.match(t?.direction,t=>t.case("up",()=>[["0 100%","0 0"],["0 0","0 -100%"]]).case("down",()=>[["0 -100%","0 0"],["0 0","0 100%"]]).case("left",()=>[["100% 0","0 0"],["0 0","-100% 0"]]).case("right",()=>[["-100% 0","0 0"],["0 0","100% 0"]]).default(()=>[["100% 0","0 0"],["0 0","-100% 0"]]));s.node?.animate({translate:n[0]},r);const a=i?.node?.animate({translate:n[1]},r);a&&(a.onfinish=()=>i?.node?.remove())},D=class extends f{constructor(t,e){super("slide",t,e)}};$.style(D,"slide{display:block;height:100%;width:100%;position:absolute}");let C=D;const z=class extends f{constructor({index:s,interval:i,autoplay:o,autopause:r,animation:n,...a},c){super("slideshow",a,c),u(this,"slide",I.Null),u(this,"index"),u(this,"timer",I.Null),u(this,"interval"),u(this,"autoplay"),u(this,"autopause"),u(this,"animation"),g(this,t,0),g(this,e,I.Null),u(this,"playing",!1),this.index=s??0,this.interval=i??5,this.autoplay=o??!1,this.autopause=r??!0,this.animation=n??I.Null,this.listen("dispose",()=>this.pause()),this.listen("dom",()=>{this.autoplay&&this.play()})}build(){return super.build(),this.switch(this.index),this}toString(){return this.parseHTML({children:this.slide?.toString()})}toDOM(t=!0){return super.toDOM(!1),this.node&&!b(this,e)&&(m(this,e,new ResizeObserver(()=>{this.autopause&&(this.inDOM()?this.play():this.pause())})),b(this,e).observe(this.node)),t&&this.slide&&this.node?.append(...this.slide.toDOM()),[this.node]}play(){this.playing||(this.playing=!0,this.timer=setInterval(()=>{var e,s,i,o;(e=this,s=t,{set _(t){m(e,s,t,i)},get _(){return b(e,s,o)}})._++,b(this,t)>=100*this.interval&&(this.next(),m(this,t,0))},10))}pause(){this.playing=!1,this.timer&&clearTimeout(this.timer)}next(){let t=this.children.length,e=this.index+1;e>=t&&(e=0),this.switch(e)}prev(){let t=this.children.length,e=this.index-1;e<=0&&(e=t-1),this.switch(e)}switch(t){this.index=t;let e=this.children.at(t);this.slide!==e&&e&&(this.animation?this.animation(this,e,this.slide):(this.append(e),this.slide=e,this.node?.replaceChildren(...e.toDOM())),e.node?.dispatchEvent(new Event("showslide")))}};t=new WeakMap,e=new WeakMap,$.style(z,"slideshow{display:block;position:relative;overflow:clip}");let S=z;const O=class extends f{value;constructor({value:t,...e},s){super("radio-group",e,s),this.value=t,this.on("input",t=>{this.value=I.is(t.target,HTMLInputElement)?.value})}};$.style(O,"radio-group{display:block}");let A=O;const E=class extends f{inputId;name;value;constructor({inputId:t,name:e,value:s,...i},o){super("radio-item",i,o),this.inputId=t??`input-${N.persistInProto(this,"radio-item")}`,this.name=e??I.Null,this.value=s}};$.style(E,"radio-item{display:block}");let H=E;class W extends f{constructor(t,e){super("input",{type:"radio",...t},e)}build(t){let e=this.findAbove(t=>I.is(t,H));return e&&(this.attr("id",e.inputId),this.attr("name",e.name)),super.build(t)}}class R extends f{constructor(t,e){super("label",t,e)}build(t){let e=this.findAbove(t=>I.is(t,H));return e&&this.attr("for",e.inputId),super.build(t)}}const[L,T,V,B,F]=["accordion","accordion-item","accordion-trigger","accordion-content","accordion-container"],U=class extends f{$trigger=I.Null;$container=I.Null;constructor(t,e){super(L,t,e)}open(){this.attr("opened","")}close(){this.attr("opened",null)}switch(){""===this.attr("opened")?this.close():this.open()}};$.style(U,[`${L},${T},${V}{display:block}`,`${F}{display:grid;grid-template-rows:0fr}`,`${L}[opened] ${F}{grid-template-rows:1fr}`,`${B}{overflow:hidden}`]);let _=U;class Y extends f{constructor(t,e){super(F,t,e)}build(t){let e=this.findAbove(t=>I.is(t,_));return e&&(e.$container=this),super.build(t)}}class j extends f{constructor(t,e){super(B,t,e)}}class q extends f{constructor(t,e){super(V,t,e)}build(t){let e=this.findAbove(t=>I.is(t,_));return e&&(e.$trigger=this,this.on("click",()=>e.switch())),super.build(t)}}const P=(t,e)=>`@layer ui { ${G(t,e)} }`,G=(t,e)=>{let s=[];for(let[i,o]of I.entries(e))I.isObject(o)?s.push(G(i,o)):s.push(`${i.replaceAll(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}: ${o};`);return`${t} { ${s.join(" ")} }`},Z=class extends f{gap;columns;size;observer=null;constructor({gap:t,columns:e,autosize:s,size:i,...o},r){super("waterfall",o,r),this.gap=t??0,this.columns=e??1,this.size=i??0,v()&&(this.observer=new ResizeObserver(t=>{this.inDOM()&&requestAnimationFrame(()=>this.resize())})),this.listen("dom",t=>this.observer?.observe(t)),this.listen("waterfall_resize",()=>this.resize()),this.listen("mutate",()=>this.resize()),x()&&this.attr("style",`display: flex; flex-direction: column; gap: ${t}px`)}resize(){if(!this.node)return;const t=[],e=this.node.offsetWidth;let s=this.columns;this.size&&(s=Math.trunc(e/(this.size+this.gap))||1);const i=(e-this.gap*(s-1))/s;for(let o=0;o<s;o++)t.push({items:[],height:0,width:i,left:o*(i+this.gap)});I.forEach(this.children,e=>{if(!e.node)return;e.node.offsetHeight&&(e.height=e.node.offsetHeight);const s=t.sort((t,e)=>t.height-e.height)[0];e.style({width:`${i}px`,translate:`${s.left}px ${s.height}px`}),s.height+=e.height+this.gap}),this.style({height:`${t.sort((t,e)=>e.height-t.height)[0].height}px`})}};$.style(Z,P("waterfall",{display:"block",position:"relative"}));let J=Z;const K=class extends f{ratio=0;height=0;constructor(t,e){super("waterfall-item",t,e)}toDOM(t=!0){let e=super.toDOM(t);const s=this.findAbove(t=>I.is(t,J));return this.node?.querySelectorAll("[observe]").forEach(t=>s?.observer?.observe(t)),e}};$.style(K,P("waterfall-item",{display:"block",position:v()?"absolute":"static"}));let Q=K;const X=class extends f{targetId;$container=I.Null;triggers=/* @__PURE__ */new Map;constructor({targetId:t,...e},s){super("tabs",e,s),this.targetId=t??I.Null}switch(t){this.targetId!==t&&(this.targetId=t,this.$container?.renderContent())}};$.style(X,"tabs{display:block;}");let tt=X;class et extends f{tabId;tabs=I.Null;constructor({tabId:t,...e},s){super("tab-trigger",e,s),this.tabId=t,this.on("click",()=>this.tabs?.switch(this.tabId))}build(t){return super.build(t),this.tabs=this.findAbove(t=>I.is(t,tt)),this.tabs?.triggers.set(this.tabId,this),this}}$.style(tt,"tab-trigger{cursor:pointer;}");class st extends f{tabs=null;constructor({...t},e){super("tab-container",t,e)}build(t){return super.build(t),this.tabs=this.findAbove(t=>I.is(t,tt)),this.tabs&&(this.tabs.$container=this),this}toDOM(t=!0){return super.toDOM(!1),this.renderContent(t),[this.node]}toString(){return this.parseHTML({children:this.renderContent()?.toString()})}mutate(){this.renderContent()}getContent(t){return this.children.find(e=>e.tabId===t)}renderContent(t=!0){const e=this.tabs?.targetId,s=e?this.getContent(e):this.children.at(0);return t&&s&&(this.node?.replaceChildren(...s.toDOM()),this.tabs?.triggers.forEach(t=>{t.attr("active",t.tabId===s.tabId?"":I.Null)})),s}}$.style(tt,"tab-container{display:block;}");class it extends f{tabId;tabs=null;constructor({tabId:t,...e},s){super("tab-content",e,s),this.tabId=t}build(t){return super.build(t),this.tabs=this.findAbove(t=>I.is(t,tt)),this}}$.style(tt,"tab-content{display:block;}");const ot={position:"absolute",left:"0",maxHeight:"50dvh",overflowY:"auto",display:"block",boxSizing:"border-box",border:"1px solid var(--input)",background:"oklch(from var(--bg) l c h)",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)",borderRadius:"var(--radius)",userSelect:"none",scrollbarWidth:"thin",scrollbarColor:"var(--input) transparent"},rt=class t extends f{$select=I.Null;$focusedItem=I.Null;constructor(e,s){super(t.tagname,e,s)}build(t){return super.build(t),this.$select=this.findAbove(t=>I.isInstanceof(t,pt)),this.$select&&(this.$select.$content=this),this}switch(t){const e=this.$focusedItem,s=this.visibleChildren,i=e?s.indexOf(e):"up"===t?0:-1;let o="up"===t?i-1:i+1;(o<0||o>=s.length)&&(o="up"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedItem?.blur(),e?.focus()}};u(rt,"tagname","select-content"),$.style(rt,P(rt.tagname,ot));let nt=rt;const at={display:"flex",gap:"calc(var(--spacing) * 1.25)",boxSizing:"border-box",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)",borderRadius:"var(--radius)",fontSize:"0.875rem",fontWeight:"500",lineHeight:"1","&:hover, :not(:has(select-item:hover)) &[focus]":{background:"oklch(from var(--input) l c h / .1)"},"&[focus]":{outline:"none"}},ct=class t extends f{constructor(e,i){super(t.tagname,{tabindex:0,...e},i),u(this,"$select",I.Null),u(this,"$content",I.Null),g(this,s,I.Null),this.on("mousedown",t=>t.preventDefault()),this.on("click",()=>{this.$select?.close(),this.select()})}props({value:t,...e}){super.props(e),this.value(t)}build(t){return super.build(t),this.$select=this.findAbove(t=>I.isInstanceof(t,pt)),this.$content=this.findAbove(t=>I.isInstanceof(t,nt)),this.$select&&this.$select.value()===b(this,s)&&(this.$select.selected=this),this.$select?.itemMap.set(b(this,s),this),this}value(t){if(!arguments.length)return b(this,s);I.isUndefined(t)||$.resolve(t,t=>{m(this,s,t)})}select(){this.$select&&this.$select.value(this.value())}focus(t=!0){this.$content?.$focusedItem?.blur(),this.attr("focus","");const e=this.$content?.node;e&&e.scrollHeight>e.clientHeight&&this.node?.scrollIntoView({block:"nearest"}),this.$content&&(this.$content.$focusedItem=this)}blur(){this.attr("focus",I.Null),this.$content&&(this.$content.$focusedItem=null)}};s=new WeakMap,u(ct,"tagname","select-item"),$.style(ct,P(ct.tagname,at));let lt=ct;const ht=(t,e,s)=>{let i={top:0,left:0,height:0,width:0,bottom:0},o=new ResizeObserver(()=>dt(t,e,i)),r=()=>dt(t,e,i);return o.observe(t),addEventListener("resize",r),dt(t,e,i),()=>{o.disconnect(),removeEventListener("resize",r)}},dt=(t,e,s)=>{let i=t.getBoundingClientRect(),o={top:i.top+i.height+scrollY,left:i.left,width:i.width,height:e.offsetHeight,bottom:innerHeight-i.top-scrollY},r=o.top+o.height>scrollY+innerHeight&&o.top-i.height-o.height>scrollY,{top:n,left:a,width:c,height:l,bottom:h}=o;I.isEqual(s,o,["top","left","height","width","bottom"])||(I.assign(s,{top:n,left:a,width:c,height:l,bottom:h}),r?(e.style.bottom=`${h}px`,e.style.top=""):(e.style.top=`${n}px`,e.style.bottom=""),e.style.left=`${a}px`,e.style.width=`${c}px`)},ut=class t extends f{constructor(e,s){super(t.tagname,e,s),u(this,"$trigger",I.Null),u(this,"$content",I.Null),g(this,i,I.Null),u(this,"selected",I.Null),u(this,"itemMap",/* @__PURE__ */new Map),u(this,"$value",I.Null),u(this,"disconnect",I.Null),g(this,o,!1),this.listen("i18nupdate",()=>this.$value?.render())}props({value:t,disabled:e,...s}){super.props(s),this.disabled(e),this.value(t)}disabled(t){if(!arguments.length)return""===this.attr("disabled");I.isUndefined(t)||$.resolve(t,t=>{this.attr("disabled",t?"":I.Null)})}value(t){if(!arguments.length)return b(this,i);I.isUndefined(t)||($.resolve(t,t=>{m(this,i,t);let e=this.itemMap.get(t);this.selected=e??I.Null,this.$value?.render(),this.dispatch("selectvalue",[this,t],{bubbles:!0})}),this.node?.dispatchEvent(new Event("select-value")))}open(){this.attr("opened",""),v()&&this.$content&&(this.disconnect=ht(this.$trigger?.node,this.$content.node),document.body.append(...this.$content.toDOM()),this.selected?.focus())}close(){this.attr("opened",I.Null),v()&&(this.$content?.removeNode(),this.disconnect?.(),this.disconnect=I.Null)}toDOM(t=!0){const e=super.toDOM(!1);return!b(this,o)&&t&&this.$trigger&&(m(this,o,!0),this.node?.append(...this.$trigger.toDOM()),this.$content?.toDOM(),this.$value?.render()),e}toString(){let t=this.$trigger?.toString()??"";return this.parseHTML({children:t})}};i=new WeakMap,o=new WeakMap,u(ut,"tagname","select-proto"),$.style(ut,P(ut.tagname,{display:"inline-block",width:"10rem",userSelect:"none"}));let pt=ut;const bt=class t extends f{$select=I.Null;constructor(e,s){super(t.tagname,{tabindex:0,...e},s),this.on("click",t=>I.isNull(this.$select?.attr("opened"))?this.$select.open():this.$select?.close()),this.on("blur",t=>this.$select?.close()),this.on("keydown",t=>{switch(t.key){case"ArrowDown":if(t.preventDefault(),!this.$select?.hasAttr("opened"))return this.$select?.open();this.$select?.$content?.switch("down");break;case"ArrowUp":if(t.preventDefault(),!this.$select?.hasAttr("opened"))return this.$select?.open();this.$select?.$content?.switch("up");break;case" ":t.preventDefault()}}),this.on("keyup",t=>{switch(t.key){case"Escape":t.preventDefault(),this.$select?.close();break;case" ":case"Enter":if(t.preventDefault(),!this.$select?.hasAttr("opened"))return this.$select?.open();this.$select?.$content?.$focusedItem?.select(),this.$select?.close()}})}build(t){return super.build(t),this.$select=this.findAbove(t=>I.isInstanceof(t,pt)),this.$select&&(this.$select.$trigger=this),this}};u(bt,"tagname","select-trigger"),$.style(bt,P(bt.tagname,{display:"flex",gap:"0.5rem",placeContent:"space-between",placeItems:"center",boxSizing:"border-box",border:"1px solid var(--input)",background:"color-mix(in oklch, var(--input) 30%, transparent)",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 2.5)",borderRadius:"var(--radius)",fontSize:"0.875rem",fontWeight:"var(--font-weight-medium)",lineHeight:"1","&:hover":{background:"color-mix(in oklch, var(--input) 50%, transparent)"},"&:focus":{outline:"0.1rem solid var(--border)"},"*":{pointerEvents:"none"}}));let gt=bt;class mt extends f{static tagname="select-value";$select=I.Null;$placeholder=I.Null;$text=new k("");constructor(t,e){super(mt.tagname,t,e)}props({placeholder:t,...e}){super.props(e),this.placeholder(t??I.Null)}build(t){return super.build(t),this.$select=this.findAbove(t=>I.isInstanceof(t,pt)),this.$select&&(this.$select.$value=this),this}placeholder(t){$.resolve(t,t=>{I.isString(t)?$.context(y,this,()=>this.$placeholder=new k(t)):this.$placeholder=t,this.render()})}render(){let t=I.Null;this.$select?.selected?(t=this.$text,this.$text.content=this.$select.selected.text):this.$placeholder&&(t=this.$placeholder),t&&(t.builded||t.build(),this.replaceProtos(t),this.node?.replaceChildren(...t.toDOM()))}}class vt extends f{constructor(t,e){super("selector-group",t,e)}}const ft=class t extends f{constructor(e,s){super(t.tagname,e,s)}props({svg:t,...e}){super.props(e),this.svg(t)}svg(t){$.resolve(t,t=>{this.innerHTML(t)})}};u(ft,"tagname","icon"),$.style(ft,P(ft.tagname,{display:"inline-block",verticalAlign:"middle",height:"1rem",width:"1rem",svg:{display:"block",height:"auto",width:"100%"}}));let $t=ft;const xt=class extends $t{constructor(t){super({svg:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down-icon lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>',...t})}};$.style(xt,P(`select-proto[opened] ${xt.tagname}`,{rotate:"180deg"}));let kt=xt;const yt="@media (hover: hover) and (pointer: fine)",wt=class extends f{constructor(t,e){super("button",{ui:"button",...t},e)}};u(wt,"tagname","button"),$.style(wt,P('button[ui="button"]',{display:"inline-flex",placeContent:"center",placeItems:"center",padding:"0 calc(var(--spacing) * 2.5)",borderRadius:"var(--radius)",height:"calc(var(--spacing) * 8)",lineHeight:"1rem",transition:"0.2s all ease",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",outline:"0.1rem solid oklch(from var(--border) l c h / 0)",userSelect:"none",gap:"calc(var(--spacing) * 2.5)",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .9)","&:focus-visible":{outline:"0.1rem solid var(--border)"},"&:not([disabled]):active":{translate:"0 0.125rem"},[yt]:{"&:not([disabled]):hover":{background:"oklch(from var(--input) l c h / .1)"}},'&[variant="primary"]':{border:"none",color:"oklch(from var(--primary-fg) l c h)",background:"var(--primary-bg)",[yt]:{"&:not([disabled]):hover":{background:"oklch(from var(--primary-bg) l c h / .8)"}}},'&[variant="secondary"]':{border:"none",color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)",[yt]:{"&:not([disabled]):hover":{background:"oklch(from var(--secondary-bg) l c h / .8)"}}},'&[variant="destructive"]':{border:"none",color:"oklch(from var(--destructive-fg) l c h)",background:"oklch(from var(--destructive-bg) l c h / .3)",[yt]:{"&:not([disabled]):hover":{background:"oklch(from var(--destructive-bg) l c h / .5)"}}},'&[variant="ghost"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)",[yt]:{"&:not([disabled]):hover":{background:"oklch(from var(--input) l c h / .1)"}}},'&[variant="link"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)",[yt]:{"&:not([disabled]):hover":{textDecoration:"underline",textUnderlineOffset:"0.2rem"}}},'&[size="icon"]':{width:"calc(var(--spacing) * 8)",padding:"0"},'&[size="xs"]':{padding:"calc(var(--spacing) * 2)",fontSize:"var(--text-xs)",lineHeight:"var(--text-xs)",height:"calc(var(--spacing) * 6)"},'&[size="icon-xs"]':{width:"calc(var(--spacing) * 6)",height:"calc(var(--spacing) * 6)",padding:"0",svg:{width:"calc(var(--spacing) * 3)",height:"calc(var(--spacing) * 3)"}},'&[size="sm"]':{height:"calc(var(--spacing) * 7)"},'&[size="icon-sm"]':{width:"calc(var(--spacing) * 7)",height:"calc(var(--spacing) * 7)",padding:"0"},'&[size="lg"]':{height:"calc(var(--spacing) * 9)"},'&[size="icon-lg"]':{width:"calc(var(--spacing) * 9)",height:"calc(var(--spacing) * 9)",padding:"0"},'&[size="custom"]':{padding:"calc(var(--spacing) * 2)",height:"unset"},"&[disabled]":{opacity:".5"}}));let It=wt;const Nt=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Nt,"tagname","badge"),$.style(Nt,P(Nt.tagname,{display:"inline-flex",placeContent:"center",placeItems:"center",padding:"0 calc(var(--spacing) * 2)",borderRadius:"calc(var(--radius) * 2.6)",height:"calc(var(--spacing) * 5)",lineHeight:"var(--text-xs)",transition:"0.2s all ease",fontSize:"var(--text-xs)",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",outline:"0.1rem solid oklch(from var(--border) l c h / 0)",whiteSpace:"nowrap",gap:"var(--spacing)",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .9)","&:focus-visible":{outline:"0.1rem solid var(--border)"},"a:not([disabled]) &:hover":{background:"oklch(from var(--input) l c h / .1)",color:"oklch(from var(--fg) l c h / 1)"},'&[variant="primary"]':{border:"none",color:"oklch(from var(--primary-fg) l c h)",background:"var(--primary-bg)"},'&[variant="secondary"]':{border:"none",color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)","a:not([disabled]) &:hover":{background:"oklch(from var(--secondary-bg) l c h / .8)"}},'&[variant="destructive"]':{border:"none",color:"oklch(from var(--destructive-fg) l c h)",background:"oklch(from var(--destructive-bg) l c h / .3)","a:not([disabled]) &:hover":{background:"oklch(from var(--destructive-bg) l c h / .5)"}},'&[variant="ghost"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)","a:not([disabled]) &:hover":{background:"oklch(from var(--input) l c h / .1)"}},'&[variant="link"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)","a:not([disabled]) &:hover":{textDecoration:"underline",textUnderlineOffset:"0.2rem"}},'&[size="sm"]':{padding:"0 calc(var(--spacing) * 1)",fontSize:"var(--text-xs2)",lineHeight:"var(--text-xs2)",height:"calc(var(--spacing) * 4)"},"a[disabled] &":{opacity:".5"}}));let Mt=Nt;const Dt=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Dt,"tagname","card"),$.style(Dt,P(Dt.tagname,{display:"flex",flexDirection:"column",gap:"calc(var(--spacing))",paddingBlock:"calc(var(--spacing) * 4)",background:"var(--secondary-bg)",borderRadius:"calc(var(--radius) * 1.4)"}));let Ct=Dt;const zt=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(zt,"tagname","card-header"),$.style(zt,P(zt.tagname,{display:"flex",width:"100%",flexDirection:"column",gap:"var(--spacing)",paddingInline:"calc(var(--spacing) * 4)"}));let St=zt;const Ot=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Ot,"tagname","card-content"),$.style(Ot,P(Ot.tagname,{display:"block",paddingInline:"calc(var(--spacing) * 4)"}));let At=Ot;const Et=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Et,"tagname","h3"),$.style(Et,P(`card ${Et.tagname}`,{fontWeight:"var(--font-weight-medium)",lineHeight:"1.375",fontSize:"var(--text-base)",color:"var(--fg)"}));let Ht=Et;const Wt=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Wt,"tagname","p"),$.style(Wt,P(`card ${Wt.tagname}`,{fontWeight:"var(--font-weight-medium)",lineHeight:"var(--line-height-sm)",fontSize:"var(--text-sm)",color:"var(--muted)"}));let Rt=Wt;const Lt=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Lt,"tagname","dl"),$.style(Lt,P(Lt.tagname,{display:"flex",flexDirection:"column",margin:"0"}));let Tt=Lt;const Vt=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Vt,"tagname","dc"),$.style(Vt,P(Vt.tagname,{paddingBlock:"1rem",borderBottom:"1px solid color-mix(in oklch, var(--input) 50%, transparent)","&:last-child":{borderBottom:"none"}}));let Bt=Vt;const Ft=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(Ft,"tagname","dt"),$.style(Ft,P(Ft.tagname,{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)"}));let Ut=Ft;const _t=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(_t,"tagname","dd"),$.style(_t,P(_t.tagname,{margin:"0",fontSize:"var(--text-sm)",color:"var(--muted)"}));let Yt=_t;const jt=class t extends f{clickListener=I.Null;constructor(e,s){super(t.tagname,e,s)}open(t){v()&&(this.build(),this.style({top:`${t.y}px`,left:`${t.x}px`}),this.clickListener=t=>{t.target!==this.node&&(t.target&&this.node?.contains(t.target)||this.close())},setTimeout(()=>window.addEventListener("click",this.clickListener),1),document.body.append(...this.toDOM()))}close(t=!0){this.removeNode(),this.clickListener&&window.removeEventListener("click",this.clickListener),this.clickListener=I.Null,t&&this.dispose()}};u(jt,"tagname","context-menu"),$.style(jt,P(jt.tagname,{display:"block",position:"fixed",top:"0",left:"0",maxHeight:"50dvh",overflowY:"auto",boxSizing:"border-box",border:"1px solid var(--input)",background:"oklch(from var(--bg) l c h)",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)",borderRadius:"var(--radius)",userSelect:"none",scrollbarWidth:"thin",scrollbarColor:"var(--input) transparent"}));let qt=jt;const Pt=class t extends f{$menu=I.Null;constructor(e,s){super(t.tagname,e,s),this.on("click",()=>this.$menu?.close())}build(t){return super.build(t),this.$menu=this.findAbove(t=>I.isInstanceof(t,qt)),this}};u(Pt,"tagname","context-menu-item"),$.style(Pt,P(Pt.tagname,{display:"block",boxSizing:"border-box",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)",borderRadius:"var(--radius)",fontSize:"0.875rem",fontWeight:"500",lineHeight:"1","&:hover, :not(:has(select-item:hover)) &:focus":{background:"oklch(from var(--input) l c h / .1)"},"&:focus":{outline:"none"}}));let Gt=Pt;const Zt={borderRadius:"var(--radius)",height:"calc(var(--spacing) * 8)",transition:"0.2s all ease",fontFamily:"inherit",fontSize:"var(--text-sm)",padding:"0 calc(var(--spacing) * 2.5)",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .9)",outline:"0.2rem solid transparent","&:focus-visible":{outlineColor:"var(--border)"}},Jt=class t extends f{constructor(e,s){super(t.tagname,{ui:"input",...e},s)}};u(Jt,"tagname","input"),$.style(Jt,P('input[ui="input"]',{...Zt}));let Kt=Jt;const Qt=class t extends f{constructor(e,s){super(t.tagname,e,s)}props({for:t,...e}){super.props(e),this.for(t)}build(t){return super.build(t),this.setFor(),this}for(t){if(!arguments.length)return this.attr("for");I.isUndefined(t)||$.resolve(t,t=>{this.attr("for",t),this.setFor()})}setFor(){const t=this.for();this.findBelow(e=>{I.isInstanceof(e,f)&&("input"===e.tagname&&e.attr("id",t),"label"===e.tagname&&e.attr("for",t))})}};u(Qt,"tagname","field"),$.style(Qt,P(Qt.tagname,{display:"flex",flexDirection:"column",gap:"calc(var(--spacing) * 2)",width:"100%",'&[direction="horizontal"]':{flexDirection:"row",placeItems:"center",width:"unset"},'&:has(field-error) input[ui="input"]':{borderColor:"var(--destructive-fg)","&:focus-visible":{outlineColor:"color-mix(in oklch, var(--destructive-fg) 30%, transparent)"}}}));let Xt=Qt;const te=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(te,"tagname","label"),$.style(te,P(te.tagname,{"field &":{display:"block",userSelect:"none",color:"var(--fg)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",lineHeight:"var(--text-sm)",flexShrink:"0"},"field[disabled] &":{pointerEvents:"none"}}));let ee=te;const se=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(se,"tagname","field-description"),$.style(se,P(se.tagname,{"field &":{display:"block",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)"},"field[disabled] &":{pointerEvents:"none"}}));let ie=se;const oe=class t extends f{constructor(e,s){super(t.tagname,e,s)}};u(oe,"tagname","field-error"),$.style(oe,P(oe.tagname,{fontSize:"var(--text-sm)",color:"var(--destructive-fg)",display:"block"}));let re=oe;const ne=class extends f{constructor(t,e){super("input",{type:"checkbox",ui:"switch",...t},e)}};u(ne,"tagname","input"),$.style(ne,P('input[ui="switch"]',{appearance:"none",display:"inline-flex",height:"calc(var(--spacing) * 5)",width:"calc(var(--spacing) * 9)",background:"color-mix(in oklab, var(--input) 80%, transparent)",border:"none",placeItems:"center",borderRadius:"calc(var(--spacing) * 5)",transition:"all .3s ease",padding:"0",flexShrink:"0",margin:"0","&::after":{content:'""',display:"block",height:"calc(var(--spacing) * 5)",width:"calc(var(--spacing) * 5)",background:"var(--fg)",borderRadius:"var(--radius-round)",transition:"all .3s ease"},"&:checked":{background:"var(--primary-bg)","&::after":{height:"calc(var(--spacing) * 4.5)",width:"calc(var(--spacing) * 4.5)",translate:"calc(115% - var(--spacing)) 0",background:"var(--bg)"}}}));let ae=ne;const ce=class extends f{constructor(t,e){super("button",{ui:"toggle",...t},e),this.on("click",t=>this.checked(!this.checked()))}props({checked:t,...e}){super.props(e),this.checked(t)}checked(t){if(!arguments.length)return!I.isNull(this.attr("checked"));I.isUndefined(t)||$.resolve(t,t=>{this.attr("checked",t?"":I.Null),this.node?.dispatchEvent(new Event("input"))})}};u(ce,"tagname","button"),$.style(ce,P('button[ui="toggle"]',{display:"inline-flex",placeContent:"center",placeItems:"center",padding:"0 calc(var(--spacing) * 2.5)",borderRadius:"var(--radius)",height:"calc(var(--spacing) * 8)",lineHeight:"1rem",transition:"0.1s all ease",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",outline:"0.1rem solid oklch(from var(--border) l c h / 0)",userSelect:"none",gap:"calc(var(--spacing) * 2.5)",flexShrink:"0",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .8)",[yt]:{"&:not([disabled]):hover":{background:"oklch(from var(--input) l c h / .1)",color:"oklch(from var(--fg) l c h)"}},"&[checked]":{color:"oklch(from var(--primary-fg) l c h)",background:"oklch(from var(--primary-bg) l c h / .8)",[yt]:{"&:not([disabled]):hover":{background:"oklch(from var(--primary-bg) l c h)",color:"oklch(from var(--primary-fg) l c h)"}}},'&[variant="primary"]':{"&[checked]":{color:"oklch(from var(--primary-fg) l c h)",background:"var(--primary-bg)"}},'&[variant="secondary"]':{"&[checked]":{color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)"}},'&[variant="destructive"]':{"&[checked]":{color:"oklch(from var(--destructive-fg) l c h)",background:"oklch(from var(--destructive-bg) l c h / .3)"}},'&[variant="ghost"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)","&[checked]":{color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)"}},'&[size="icon"]':{width:"calc(var(--spacing) * 8)",padding:"0"},'&[size="xs"]':{padding:"calc(var(--spacing) * 2)",fontSize:"var(--text-xs)",lineHeight:"var(--text-xs)",height:"calc(var(--spacing) * 6)"},'&[size="icon-xs"]':{width:"calc(var(--spacing) * 6)",height:"calc(var(--spacing) * 6)",padding:"0",svg:{width:"calc(var(--spacing) * 3)",height:"calc(var(--spacing) * 3)"}},'&[size="sm"]':{height:"calc(var(--spacing) * 7)"},'&[size="icon-sm"]':{width:"calc(var(--spacing) * 7)",height:"calc(var(--spacing) * 7)",padding:"0"},'&[size="lg"]':{height:"calc(var(--spacing) * 9)"},'&[size="icon-lg"]':{width:"calc(var(--spacing) * 9)",height:"calc(var(--spacing) * 9)",padding:"0"},"&[disabled]":{opacity:".5"}}));let le=ce;class he extends f{$combobox=I.Null;$focusedItem=I.Null;$createItem=I.Null;virtual=!0;constructor(t,e){super("combobox-list",t,e)}build(t){return super.build(t),this.$combobox=this.findAbove(t=>I.isInstanceof(t,me)),this.$combobox&&(this.$combobox.$list=this),this.$combobox?.$chips?.toDOM(),this}filter(t){if(!this.$combobox)return;const e=[];this.$createItem&&(this.$createItem.visible=!!t.trim()&&!I.arrayFrom(this.$combobox.itemMap.values()).find(e=>e.text===t.trim())),I.forEach(this.$combobox.itemMap,([s,i])=>{i.visible=!1,i.text.toLowerCase().includes(t.toLowerCase())&&(i.visible=!0,e.push(i))}),this.$combobox?.$content?.$empty&&(this.$combobox.$content.$empty.visible=!this.$createItem?.visible&&!e.length),this.$combobox.$content?.toDOM()}switch(t){const e=this.$focusedItem,s=this.visibleChildren,i=e?s.indexOf(e):"up"===t?0:-1;let o="up"===t?i-1:i+1;(o<0||o>=s.length)&&(o="up"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedItem?.blur(),e?.focus()}focusFirstItem(){this.$createItem?.visible&&this.visibleChildren[1]?this.focus(1):this.focus(0)}mutate(){if(super.mutate(),this.$combobox?.itemMap.clear(),I.forEach(this.children,t=>{I.isInstanceof(t,ue)&&this.$combobox?.itemMap.set(t.value(),t)}),!this.$combobox)return;const t=this.$combobox.values(),e=t.filter(t=>this.$combobox?.itemMap.has(t));I.isEqual(t,e)||(this.$combobox?.values(e),this.$combobox?.dispatch("combobox_input",[]))}}const de=class extends f{constructor(t,e){super("combobox-item",t,()=>{e?.(this),$($t,{ui:"combobox-item-check",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-icon lucide-check"><path d="M20 6 9 17l-5-5"/></svg>'})}),u(this,"$combobox",I.Null),u(this,"$list",I.Null),g(this,r,I.Null),g(this,n,!1),this.on("mousedown",t=>t.preventDefault()),this.on("click",()=>{this.$combobox?.select(b(this,r),!this.selected())})}build(t){return super.build(t),this.$combobox=this.findAbove(t=>I.isInstanceof(t,me)),this.$list=this.findAbove(t=>I.isInstanceof(t,he)),this.$combobox?.itemMap.set(b(this,r),this),this.$combobox?.values().includes(b(this,r))&&this.selected(!0),this}props({value:t,label:e,selected:s,...i}){super.props(i),this.value(t),this.selected(s)}value(t){if(!arguments.length)return b(this,r);I.isUndefined(t)||$.resolve(t,t=>{this.$combobox?.itemMap.delete(b(this,r)),this.$combobox?.itemMap.set(t,this),m(this,r,t)})}selected(t){if(!arguments.length)return b(this,n);I.isUndefined(t)||$.resolve(t,t=>{m(this,n,t),this.attr("selected",t?"":null)})}focus(){this.attr("focus",""),this.node?.scrollIntoView({block:"nearest"}),this.$list&&(this.$list.$focusedItem=this)}blur(){this.attr("focus",I.Null),this.$list&&(this.$list.$focusedItem=null)}};r=new WeakMap,n=new WeakMap,u(de,"tagname","combobox-item"),$.style(de,P(de.tagname,{...at,'icon[ui="combobox-item-check"]':{visibility:"hidden",marginInlineStart:"auto"},'&[selected] icon[ui="combobox-item-check"]':{visibility:"visible"}}));let ue=de;const pe=class extends f{$combobox=I.Null;$list=I.Null;constructor(t,e){super("combobox-create-item",t,e),this.on("mousedown",t=>t.preventDefault()),this.on("click",t=>{this.dispatch("combobox_create",[this.$combobox?.$input?.node?.value],{bubbles:!0}),this.$combobox?.$input?.clearValue()})}build(t){return super.build(t),this.$combobox=this.findAbove(t=>I.isInstanceof(t,me)),this.$list=this.findAbove(t=>I.isInstanceof(t,he)),this.$list&&(this.$list.$createItem=this),this}focus(){this.attr("focus",""),this.$list&&(this.$list.$focusedItem=this)}blur(){this.attr("focus",I.Null),this.$list&&(this.$list.$focusedItem=null)}};u(pe,"tagname","combobox-create-item"),$.style(pe,P(pe.tagname,at));let be=pe;const ge=class extends f{constructor(t,e){super("combobox",t,e),u(this,"$trigger",I.Null),u(this,"$content",I.Null),u(this,"$list",I.Null),u(this,"$chips",I.Null),u(this,"$input",I.Null),u(this,"itemMap",/* @__PURE__ */new Map),g(this,a,/* @__PURE__ */new Set),g(this,c,!1),u(this,"disconnect",I.Null)}toDOM(t=!0){const e=super.toDOM(!1);return!b(this,c)&&t&&this.$trigger&&(this.node?.append(...this.$trigger.toDOM()),this.$content?.toDOM(),m(this,c,!0)),e}props({values:t,...e}){super.props(e),this.values(t)}open(){this.attr("opened",""),v()&&this.$content&&(this.disconnect=ht(this.$trigger?.node,this.$content.node),document.body.append(...this.$content.toDOM()),this.$input&&this.$list?.filter(this.$input.node?.value??""))}close(){this.attr("opened",I.Null),v()&&(this.$content?.removeNode(),this.disconnect?.(),this.disconnect=I.Null)}select(t,e=!0){const s=this.itemMap.get(t);s&&(s.selected(e),e?(b(this,a).add(t),this.dispatch("combobox_select",[t])):(b(this,a).delete(t),this.dispatch("combobox_unselect",[t])),this.$chips?.toDOM(),this.dispatch("combobox_input",[]))}get selected(){return I.map(b(this,a),t=>this.itemMap.get(t))}values(t){if(!arguments.length)return I.arrayFrom(b(this,a));I.isUndefined(t)||$.resolve(t,t=>{m(this,a,new Set(t)),I.forEach(this.itemMap.values(),t=>{t.selected(b(this,a).has(t.value()))}),this.$chips?.toDOM()})}};a=new WeakMap,c=new WeakMap,u(ge,"tagname","combobox"),$.style(ge,P(ge.tagname,{display:"inline-block",width:"10rem",userSelect:"none"}));let me=ge;const ve=class extends f{$combobox=I.Null;constructor(t,e){super("combobox-trigger",t,e),this.on("dragover",t=>this.$combobox?.$chips?.dragover(t)),this.on("dragend",t=>this.$combobox?.$chips?.dragend())}build(t){return super.build(t),this.$combobox=this.findAbove(t=>I.isInstanceof(t,me)),this.$combobox&&(this.$combobox.$trigger=this),this}};u(ve,"tagname","combobox-trigger"),$.style(ve,P(ve.tagname,{display:"flex",flexWrap:"wrap",columnGap:"calc(var(--spacing) * 1.25)",placeItems:"center",boxSizing:"border-box",border:"1px solid var(--input)",background:"color-mix(in oklch, var(--input) 30%, transparent)",borderRadius:"var(--radius)",fontSize:"0.875rem",fontWeight:"var(--font-weight-medium)",lineHeight:"1",padding:"0 calc(var(--spacing) * 1.25)","&:hover":{background:"color-mix(in oklch, var(--input) 50%, transparent)"},"&:focus-within":{outline:"0.1rem solid var(--border)"}}));let fe=ve;const $e=class extends f{$combobox=I.Null;constructor(t,e){super("input",{ui:"combobox-input",autocomplete:"off",...t},e),this.on("focus",t=>I.isNull(this.$combobox?.attr("opened"))&&this.$combobox.open()),this.on("blur",t=>{this.$combobox?.close(),this.$combobox?.$chips?.$focusedChip?.blur()}),this.on("input",t=>{this.$combobox?.$list?.filter(t.currentTarget.value),this.$combobox?.$list?.focusFirstItem()}),this.on("keydown",t=>{switch(t.key){case"ArrowDown":return t.preventDefault(),void this.$combobox?.$list?.switch("down");case"ArrowUp":return t.preventDefault(),void this.$combobox?.$list?.switch("up");case"Backspace":return void(0===t.currentTarget.value.length&&this.$combobox?.$chips?.visibleChildren.at(-1)?.delete());case"ArrowRight":return void(0===t.currentTarget.value.length&&this.$combobox?.$chips?.switch("right"));case"ArrowLeft":return void(0===t.currentTarget.value.length&&this.$combobox?.$chips?.switch("left"))}}),this.on("keyup",t=>{switch(t.key){case"Escape":return t.preventDefault(),this.$combobox?.close(),void this.$combobox?.$trigger?.node?.focus();case"Delete":{const t=this.$combobox?.$chips?.$focusedChip;return this.$combobox?.$chips?.switch("right"),void t?.delete()}case"Tab":case"Enter":{t.preventDefault();const e=this.$combobox?.$list?.$focusedItem;if(!e)return;return I.isInstanceof(e,ue)?this.$combobox?.select(e.value()):this.dispatch("combobox_create",[t.currentTarget.value],{bubbles:!0}),void this.clearValue()}}t.currentTarget.value.length&&this.$combobox?.$chips?.$focusedChip?.blur()})}build(t){return super.build(t),this.$combobox=this.findAbove(t=>I.isInstanceof(t,me)),this.$combobox&&(this.$combobox.$input=this),this}clearValue(){this.node&&(this.node.value=""),this.$combobox?.$list?.filter("")}};$.style($e,P('input[ui="combobox-input"]',{display:"inline",border:"unset",background:"unset",color:"oklch(from var(--fg) l c h / .9)",fontSize:"0.875rem",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",lineHeight:"1",height:"calc(var(--spacing) * 8)",flex:"1",minWidth:"2rem",padding:"0 calc(var(--spacing) * 1.25)",outline:"unset","&:focus":{outline:"unset"}}));let xe=$e;const ke=class extends f{$combobox=I.Null;$empty=I.Null;constructor(t,e){super("combobox-content",t,e)}build(t){return super.build(t),this.$combobox=this.findAbove(t=>I.isInstanceof(t,me)),this.$combobox&&(this.$combobox.$content=this),this}};u(ke,"tagname","combobox-content"),$.style(ke,P(ke.tagname,ot));let ye=ke;const we=class extends f{$content=I.Null;constructor(t,e){super("combobox-empty",t,e)}build(t){return super.build(t),this.$content=this.findAbove(t=>I.isInstanceof(t,ye)),this.$content&&(this.$content.$empty=this),this}};u(we,"tagname","combobox-empty"),$.style(we,P(we.tagname,{...at}));let Ie=we;class Ne extends w{$combobox=I.Null;chipMap=/* @__PURE__ */new Map;$focusedChip=I.Null;$draggedChip=I.Null;#t=[];#e=[];#s=[];constructor(t){super(t)}build(t){return super.build(t),this.$combobox=this.findAbove(t=>I.isInstanceof(t,me)),this.$combobox&&(this.$combobox.$chips=this),this}toDOM(){const t=this.$combobox?.values()??[];return I.isEqual(t,this.#e)||(this.#e=[...t],I.forEach(this.children,t=>t.removeNode()),this.#s=I.map(this.$combobox?.values(),t=>{const e=this.chipMap.get(t);return e?(e.builded||e.build(),e.toDOM()):[]})?.flat()??[],this.node?.replaceWith(this.node,...this.#s)),[this.node,...this.#s]}switch(t){const e=this.$focusedChip,s=this.visibleChildren,i=e?s.indexOf(e):"left"===t?0:-1;let o="left"===t?i-1:i+1;(o<0||o>=s.length)&&(o="left"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedChip?.blur(),e?.focus()}dragover(t){if(!this.$draggedChip?.node)return;if(!this.$combobox)return;const e=I.map(this.#e,t=>this.chipMap.get(t)).reduce((e,s)=>{const i=s.node.getBoundingClientRect(),o=t.x-i.left-i.width/2,r=t.y-i.top-i.height/2,n=Math.pow(o,2)+Math.pow(r,2);return n<e.offset?{offset:n,$chip:s}:e},{offset:Number.POSITIVE_INFINITY,$chip:void 0}).$chip;if(e&&e!==this.$draggedChip){const s=e.node.getBoundingClientRect(),i=this.$draggedChip.value(),o=e.value(),r=this.$combobox.values();r.splice(r.indexOf(i),1),t.x<s.left+s.width/2?(this.$combobox.$trigger?.node?.insertBefore(this.$draggedChip.node,e.node),r.splice(r.indexOf(o),0,i)):(this.$combobox.$trigger?.node?.insertBefore(this.$draggedChip.node,e.node?.nextSibling??null),r.splice(r.indexOf(o)+1,0,i)),this.#t=r}}dragend(){this.#t.length&&(this.$combobox?.values(this.#t),this.$combobox?.dispatch("combobox_input",[])),this.#t=[],this.$draggedChip?.removeClass("dragging"),this.$draggedChip=null}mutate(){super.mutate(),this.chipMap.clear(),I.forEach(this.children,t=>{I.isInstanceof(t,De)&&this.chipMap.set(t.value(),t)}),this.#e=[],this.toDOM()}}const Me=class extends f{constructor(t,e){super("combobox-chip",{draggable:!0,...t},e),u(this,"$chips",I.Null),g(this,l),this.on("dragstart",()=>{this.$chips&&(this.$chips.$draggedChip=this,this.addClass("dragging"))})}build(t){return super.build(t),this.$chips=this.findAbove(t=>I.isInstanceof(t,Ne)),this.$chips?.chipMap.set(this.value(),this),this}props({value:t,...e}){super.props(e),this.value(t)}value(t){if(!arguments.length)return b(this,l);I.isUndefined(t)||$.resolve(t,t=>{this.$chips?.chipMap.delete(t),this.$chips?.chipMap.set(t,this),m(this,l,t)})}delete(){this.$chips?.$combobox?.select(b(this,l),!1)}focus(){this.attr("focus",""),this.$chips&&(this.$chips.$focusedChip=this)}blur(){this.attr("focus",I.Null),this.$chips&&(this.$chips.$focusedChip=I.Null)}};l=new WeakMap,u(Me,"tagname","combobox-chip"),$.style(Me,P(Me.tagname,{display:"inline-flex",placeItems:"center",fontSize:"var(--text-xs)",padding:"0 calc(var(--spacing) * 1.5)",background:"var(--secondary-bg)",borderRadius:"calc(var(--radius) * .6)",height:"calc(var(--spacing) * 5.25)",marginBlock:"calc(var(--spacing))",cursor:"grab","&:active":{cursor:"grabbing"},"&[focus]":{outline:"2px solid var(--input)"},"&.dragging":{background:"var(--input)"},'button[ui="combobox-chip-remove"]':{background:"unset",border:"unset",color:"oklch(from var(--fg) l c h / .9)",paddingInlineStart:"calc(var(--spacing) * 1.5)",icon:{height:"calc(var(--spacing) * 3.25)",width:"calc(var(--spacing) * 3.25)"}}}));let De=Me;class Ce extends f{static tagname="button";$chip=I.Null;constructor(t,e){super("button",{ui:"combobox-chip-remove",tabindex:"-1",...t},()=>{e?e(this):$($t,{svg:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'})}),this.on("click",()=>{this.$chip?.$chips?.$combobox?.select(this.$chip.value(),!1)})}build(t){return super.build(t),this.$chip=this.findAbove(t=>I.isInstanceof(t,De)),this}}class ze extends f{static $container=I.Null;constructor(t,e){super("toast",t,e)}static popup({position:t,...e},s){if(!v())return;this.$container=this.$container??new Oe({});const i=new ze(e,s),o=this.$container.list(t??"top");this.$container.append(o),o.append(i),i.build();const r=this.$container.toDOM();document.body.contains(this.$container.node)||document.body.append(...r),setTimeout(()=>{i.remove(),i.removeNode(),i.dispose()},3e3)}}const Se=class extends f{listMap={};constructor(t,e){super("toast-container",t,e)}list(t){return this.listMap[t]=this.listMap[t]??new Ee({position:t}).build()}};u(Se,"tagname","toast-container"),$.style(Se,P(Se.tagname,{position:"fixed",inset:"0 0 0 0",pointerEvents:"none"}));let Oe=Se;const Ae=class extends f{constructor(t,e){super("toast-list",t,e)}};u(Ae,"tagname","toast-list"),$.style(Ae,P(Ae.tagname,{display:"flex",flexDirection:"column",gap:"calc(var(--spacing) * 2)",pointerEvents:"auto",position:"absolute",'&[position="top"]':{top:"0",placeSelf:"center"},'&[position="top-left"]':{top:"0",placeSelf:"start"},'&[position="top-right"]':{top:"0",placeSelf:"end"},'&[position="bottom"]':{bottom:"0",placeSelf:"center"},'&[position="bottom-left"]':{bottom:"0",placeSelf:"start"},'&[position="bottom-right"]':{bottom:"0",placeSelf:"end"}}));let Ee=Ae;const He=class extends f{disconnect=I.Null;$content=I.Null;$list=I.Null;$input=I.Null;constructor(t,e){super("searchbar",t,e)}open(){this.hasAttr("opened")||(this.attr("opened",""),v()&&this.$content&&(this.disconnect=ht(this.$input?.node,this.$content.node),document.body.append(...this.$content.toDOM())))}close(){this.attr("opened",I.Null),v()&&(this.$content?.removeNode(),this.disconnect?.(),this.disconnect=I.Null)}toDOM(t=!0){return super.toDOM(!1),t&&this.$input&&(this.node?.append(...this.$input.toDOM()),this.$content?.toDOM()),[this.node]}};u(He,"tagname","searchbar"),$.style(He,P(He.tagname,{}));let We=He;const Re=class extends Kt{$searchbar=I.Null;constructor(t,e){super({ui:"searchbar-input",...t},e),this.on("focus",t=>this.$searchbar?.$list?.visibleChildren.length&&this.$searchbar.open()),this.on("blur",t=>this.$searchbar?.close()),this.on("keydown",t=>{switch(t.key){case"ArrowDown":return t.preventDefault(),void this.$searchbar?.$list?.switch("down");case"ArrowUp":return t.preventDefault(),void this.$searchbar?.$list?.switch("up")}}),this.on("keyup",t=>{switch(t.key){case"Escape":return t.preventDefault(),this.$searchbar?.close(),void this.$searchbar?.$input?.node?.blur();case"Enter":return t.preventDefault(),void this.$searchbar?.$list?.$focusedItem?.select()}})}build(t){return super.build(t),this.$searchbar=this.findAbove(t=>I.isInstanceof(t,We)),this.$searchbar&&(this.$searchbar.$input=this),this}};$.style(Re,P('input[ui="searchbar-input"]',{...Zt,width:"100%"}));let Le=Re;const Te=class extends f{$searchbar=I.Null;constructor(t,e){super("searchbar-content",t,e),this.listen("mutate",()=>{this.$searchbar?.$list?.visibleChildren.length?this.$searchbar.open():this.$searchbar?.close()})}build(t){return super.build(t),this.$searchbar=this.findAbove(t=>I.isInstanceof(t,We)),this.$searchbar&&(this.$searchbar.$content=this),this}};u(Te,"tagname","searchbar-content"),$.style(Te,P(Te.tagname,ot));let Ve=Te;class Be extends f{$searchbar=I.Null;$focusedItem=I.Null;constructor(t,e){super("combobox-list",t,e)}build(t){return super.build(t),this.$searchbar=this.findAbove(t=>I.isInstanceof(t,We)),this.$searchbar&&(this.$searchbar.$list=this),this}switch(t){const e=this.$focusedItem,s=this.visibleChildren,i=e?s.indexOf(e):"up"===t?0:-1;let o="up"===t?i-1:i+1;(o<0||o>=s.length)&&(o="up"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedItem?.blur(),e?.focus()}}const Fe=class extends f{$list=I.Null;constructor(t,e){super("searchbar-item",t,e),this.on("click",()=>this.select()),this.on("mousedown",t=>t.preventDefault())}build(t){return super.build(t),this.$list=this.findAbove(t=>I.isInstanceof(t,Be)),this}focus(){this.attr("focus",""),this.node?.scrollIntoView({block:"nearest"}),this.$list&&(this.$list.$focusedItem=this)}blur(){this.attr("focus",I.Null),this.$list&&(this.$list.$focusedItem=null)}select(){this.dispatch("searchbar_item_select",[]),this.$list?.$searchbar?.hasAttr("autoclose")&&this.$list.$searchbar.close()}};u(Fe,"tagname","searchbar-item"),$.style(Fe,P(Fe.tagname,at));let Ue=Fe;const _e=class extends f{constructor(t,e){super("textarea",t,e)}};u(_e,"tagname","textarea"),$.style(_e,P(_e.tagname,{...Zt,padding:"calc(var(--spacing) * 2.5)",minHeight:"calc(var(--spacing) * 5 + 2rem)",maxHeight:"calc(var(--spacing) * 5 + 10rem)",fieldSizing:"content",resize:"none",height:"unset"}));let Ye=_e;const je=class extends f{constructor(t,e){super("textblock",t,e)}};u(je,"tagname","textblock"),$.style(je,P(je.tagname,{display:"block",whiteSpace:"pre",fontSize:"var(--text-sm)"}));let qe=je;export{_ as Accordion,Y as AccordionContainer,j as AccordionContent,q as AccordionTrigger,Mt as Badge,It as Button,Ct as Card,At as CardContent,Rt as CardDescription,St as CardHeader,Ht as CardTitle,me as Combobox,De as ComboboxChip,Ce as ComboboxChipRemoveButton,Ne as ComboboxChips,ye as ComboboxContent,be as ComboboxCreateItem,Ie as ComboboxEmpty,xe as ComboboxInput,ue as ComboboxItem,he as ComboboxList,fe as ComboboxTrigger,qt as ContextMenu,Gt as ContextMenuItem,Bt as DescriptionContent,Yt as DescriptionDetail,Tt as DescriptionList,Ut as DescriptionTerm,Xt as Field,ie as FieldDescription,re as FieldError,ee as FieldLabel,$t as Icon,Kt as Input,R as Label,W as Radio,A as RadioGroup,H as RadioItem,We as Searchbar,Ve as SearchbarContent,Le as SearchbarInput,Ue as SearchbarItem,Be as SearchbarList,pt as Select,kt as SelectArrow,nt as SelectContent,vt as SelectGroup,lt as SelectItem,gt as SelectTrigger,mt as SelectValue,C as Slide,S as Slideshow,ae as Switch,it as TabContent,et as TabTrigger,tt as Tabs,st as TabsContainer,Ye as TextArea,qe as TextBlock,ze as Toast,le as Toggle,J as Waterfall,Q as WaterfallItem,M as slideInOut};
|
|
1
|
+
var t,e,s,i,o,n,r,a,c,l,h,u,d,p=Object.defineProperty,g=t=>{throw TypeError(t)},b=(t,e,s)=>((t,e,s)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),m=(t,e,s)=>e.has(t)||g("Cannot "+s),v=(t,e,s)=>(m(t,e,"read from private field"),s?s.call(t):e.get(t)),f=(t,e,s)=>e.has(t)?g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),x=(t,e,s,i)=>(m(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),y=(t,e,s,i)=>({set _(i){x(t,e,i,s)},get _(){return v(t,e,i)}});import{onclient as k,ElementProto as w,onserver as I,TextProto as N,ProxyProto as M}from"@amateras/core";import{Utils as z,UID as D}from"@amateras/utils";const C=t=>(e,s,i)=>{if(e.slide=s,!k())return;let o=s.toDOM();e.node?.append(...o);let n={duration:t?.duration??500,easing:t?.easing??"ease"},r=z.match(t?.direction,t=>t.case("up",()=>[["0 100%","0 0"],["0 0","0 -100%"]]).case("down",()=>[["0 -100%","0 0"],["0 0","0 100%"]]).case("left",()=>[["100% 0","0 0"],["0 0","-100% 0"]]).case("right",()=>[["-100% 0","0 0"],["0 0","100% 0"]]).default(()=>[["100% 0","0 0"],["0 0","-100% 0"]]));s.node?.animate({translate:r[0]},n);const a=i?.node?.animate({translate:r[1]},n);a&&(a.onfinish=()=>i?.node?.remove())},S=(t,e)=>`@layer ui { ${A(t,e)} }`,A=(t,e)=>{let s=[];for(let[i,o]of z.entries(e))z.isObject(o)?s.push(A(i,o)):s.push(`${z.camelToDashedStyle(i)}: ${o};`);return`${t} { ${s.join(" ")} }`},O=class extends w{constructor(t,e){super("slide",t,e)}};$.style(O,S("slide",{display:"block",height:"100%",width:"100%",position:"relative"}));let E=O;const W=class extends w{constructor({index:s,interval:i,autoplay:o,autopause:n,animation:r,...a},c){super("slideshow",a,c),b(this,"slide",z.Null),b(this,"index"),b(this,"timer",z.Null),b(this,"interval"),b(this,"autoplay"),b(this,"autopause"),b(this,"animation"),f(this,t,0),f(this,e,z.Null),b(this,"playing",!1),this.index=s??0,this.interval=i??5,this.autoplay=o??!1,this.autopause=n??!0,this.animation=r??z.Null,this.listen("dispose",()=>this.pause()),this.listen("dom",()=>{this.autoplay&&this.play()})}build(){return super.build(),this.switch(this.index),this}toString(){return this.parseHTML({children:this.slide?.toString()})}toDOM(t=!0){return super.toDOM(!1),this.node&&!v(this,e)&&(x(this,e,new ResizeObserver(()=>{this.autopause&&(this.inDOM()?this.play():this.pause())})),v(this,e).observe(this.node)),t&&this.slide&&this.node?.append(...this.slide.toDOM()),[this.node]}play(){this.playing||(this.playing=!0,this.timer=setInterval(()=>{y(this,t)._++,v(this,t)>=100*this.interval&&(this.next(),x(this,t,0))},10))}pause(){this.playing=!1,this.timer&&clearTimeout(this.timer)}next(){let t=this.children.length,e=this.index+1;e>=t&&(e=0),this.switch(e)}prev(){let t=this.children.length,e=this.index-1;e<=0&&(e=t-1),this.switch(e)}switch(t){this.index=t;let e=this.children.at(t);this.slide!==e&&e&&(this.animation?this.animation(this,e,this.slide):(this.append(e),this.slide=e,this.node?.replaceChildren(...e.toDOM())),e.node?.dispatchEvent(new Event("showslide")))}};t=new WeakMap,e=new WeakMap,$.style(W,S("slideshow",{display:"block",position:"relative",overflow:"clip"}));let R=W;const T=class extends w{value;constructor({value:t,...e},s){super("radio-group",e,s),this.value=t,this.on("input",t=>{this.value=z.is(t.target,HTMLInputElement)?.value})}};$.style(T,"radio-group{display:block}");let H=T;const L=class extends w{inputId;name;value;constructor({inputId:t,name:e,value:s,...i},o){super("radio-item",i,o),this.inputId=t??`input-${D.persistInProto(this,"radio-item")}`,this.name=e??z.Null,this.value=s}};$.style(L,"radio-item{display:block}");let B=L;class F extends w{constructor(t,e){super("input",{type:"radio",...t},e)}build(t){let e=this.findAbove(t=>z.is(t,B));return e&&(this.attr("id",e.inputId),this.attr("name",e.name)),super.build(t)}}class U extends w{constructor(t,e){super("label",t,e)}build(t){let e=this.findAbove(t=>z.is(t,B));return e&&this.attr("for",e.inputId),super.build(t)}}const[_,V,j,Y,q]=["accordion","accordion-item","accordion-trigger","accordion-content","accordion-container"],X=class extends w{$trigger=z.Null;$container=z.Null;constructor(t,e){super(_,t,e)}open(){this.attr("opened","")}close(){this.attr("opened",null)}switch(){""===this.attr("opened")?this.close():this.open()}};$.style(X,[`${_},${V},${j}{display:block}`,`${q}{display:grid;grid-template-rows:0fr}`,`${_}[opened] ${q}{grid-template-rows:1fr}`,`${Y}{overflow:hidden}`]);let P=X;class G extends w{constructor(t,e){super(q,t,e)}build(t){let e=this.findAbove(t=>z.is(t,P));return e&&(e.$container=this),super.build(t)}}class J extends w{constructor(t,e){super(Y,t,e)}}class K extends w{constructor(t,e){super(j,t,e)}build(t){let e=this.findAbove(t=>z.is(t,P));return e&&(e.$trigger=this,this.on("click",()=>e.switch())),super.build(t)}}const Q=class extends w{gap;columns;size;observer=null;constructor({gap:t,columns:e,autosize:s,size:i,...o},n){super("waterfall",o,n),this.gap=t??0,this.columns=e??1,this.size=i??0,k()&&(this.observer=new ResizeObserver(t=>{this.inDOM()&&requestAnimationFrame(()=>this.resize())})),this.listen("dom",t=>this.observer?.observe(t)),this.listen("waterfall_resize",()=>this.resize()),this.listen("mutate",()=>this.resize()),I()&&this.attr("style",`display: flex; flex-direction: column; gap: ${t}px`)}resize(){if(!this.node)return;const t=[],e=this.node.offsetWidth;let s=this.columns;this.size&&(s=Math.trunc(e/(this.size+this.gap))||1);const i=(e-this.gap*(s-1))/s;for(let o=0;o<s;o++)t.push({items:[],height:0,width:i,left:o*(i+this.gap)});z.forEach(this.children,e=>{if(!e.node)return;e.node.offsetHeight&&(e.height=e.node.offsetHeight);const s=t.sort((t,e)=>t.height-e.height)[0];e.style({width:`${i}px`,translate:`${s.left}px ${s.height}px`}),s.height+=e.height+this.gap}),this.style({height:`${t.sort((t,e)=>e.height-t.height)[0].height}px`})}};$.style(Q,S("waterfall",{display:"block",position:"relative"}));let Z=Q;const tt=class extends w{ratio=0;height=0;constructor(t,e){super("waterfall-item",t,e)}toDOM(t=!0){let e=super.toDOM(t);const s=this.findAbove(t=>z.is(t,Z));return this.node?.querySelectorAll("img").forEach(t=>s?.observer?.observe(t)),e}};$.style(tt,S("waterfall-item",{display:"block",position:k()?"absolute":"static"}));let et=tt;const st=class extends w{targetId;$container=z.Null;triggers=/* @__PURE__ */new Map;constructor({targetId:t,...e},s){super("tabs",e,s),this.targetId=t??z.Null}switch(t){this.targetId!==t&&(this.targetId=t,this.$container?.renderContent())}};$.style(st,S("tabs",{display:"block"}));let it=st;const ot=class extends w{tabId;tabs=z.Null;constructor({tabId:t,...e},s){super("tab-trigger",e,s),this.tabId=t,this.on("click",()=>this.tabs?.switch(this.tabId))}build(t){return super.build(t),this.tabs=this.findAbove(t=>z.is(t,it)),this.tabs?.triggers.set(this.tabId,this),this}};$.style(ot,S("tab-trigger",{cursor:"pointer"}));let nt=ot;const rt=class extends w{tabs=null;constructor({...t},e){super("tab-container",t,e)}build(t){return super.build(!1),this.tabs=this.findAbove(t=>z.is(t,it)),this.tabs&&(this.tabs.$container=this),this.renderContent(),this}toString(){return this.parseHTML({children:this.renderContent()?.toString()})}mutate(){this.renderContent()}getContent(t){return this.children.find(e=>e.tabId===t)}renderContent(){const t=this.tabs?.targetId,e=t?this.getContent(t):this.children.at(0);return e&&(e.builded||e.build(),this.node?.replaceChildren(...e.toDOM()),this.tabs?.triggers.forEach(t=>{t.attr("active",t.tabId===e.tabId?"":z.Null)})),e}};$.style(rt,S("tab-container",{display:"block"}));let at=rt;const ct=class extends w{tabId;tabs=null;virtual=!0;constructor({tabId:t,...e},s){super("tab-content",e,s),this.tabId=t}};$.style(ct,S("tab-content",{display:"block"}));let lt=ct;const ht={position:"absolute",maxHeight:"50dvh",overflowY:"auto",display:"flex",flexDirection:"column",boxSizing:"border-box",border:"1px solid var(--input)",background:"oklch(from var(--bg) l c h)",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)",borderRadius:"var(--radius)",userSelect:"none",scrollbarWidth:"thin",scrollbarColor:"var(--input) transparent"},ut=class t extends w{$select=z.Null;$focusedItem=z.Null;constructor(e,s){super(t.tagname,e,s)}build(t){return super.build(t),this.$select=this.findAbove(t=>z.isInstanceof(t,$t)),this.$select&&(this.$select.$content=this),this}switch(t){const e=this.$focusedItem,s=this.visibleChildren,i=e?s.indexOf(e):"up"===t?0:-1;let o="up"===t?i-1:i+1;(o<0||o>=s.length)&&(o="up"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedItem?.blur(),e?.focus()}};b(ut,"tagname","select-content"),$.style(ut,S(ut.tagname,ht));let dt=ut;const pt={display:"flex",gap:"calc(var(--spacing) * 1.25)",boxSizing:"border-box",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)",borderRadius:"var(--radius)",fontSize:"0.875rem",fontWeight:"500",lineHeight:"1","&:hover, :not(:has(select-item:hover)) &[focus]":{background:"oklch(from var(--input) l c h / .1)"},"&[focus]":{outline:"none"}},gt=class t extends w{constructor(e,i){super(t.tagname,{tabindex:0,...e},i),b(this,"$select",z.Null),b(this,"$content",z.Null),f(this,s,z.Null),this.on("mousedown",t=>t.preventDefault()),this.on("click",()=>{this.$select?.close(),this.select()})}props({value:t,...e}){super.props(e),this.value(t)}build(t){return super.build(t),this.$select=this.findAbove(t=>z.isInstanceof(t,$t)),this.$content=this.findAbove(t=>z.isInstanceof(t,dt)),this.$select&&this.$select.value()===v(this,s)&&(this.$select.selected=this),this.$select?.itemMap.set(v(this,s),this),this}value(t){if(!arguments.length)return v(this,s);z.isUndefined(t)||$.resolve(t,t=>{x(this,s,t)})}select(){this.$select&&this.$select.value(this.value())}focus(t=!0){this.$content?.$focusedItem?.blur(),this.attr("focus","");const e=this.$content?.node;e&&e.scrollHeight>e.clientHeight&&this.node?.scrollIntoView({block:"nearest"}),this.$content&&(this.$content.$focusedItem=this)}blur(){this.attr("focus",z.Null),this.$content&&(this.$content.$focusedItem=null)}};s=new WeakMap,b(gt,"tagname","select-item"),$.style(gt,S(gt.tagname,pt));let bt=gt;const mt=(t,e,s)=>{let i={top:0,left:0,height:0,width:0,bottom:0},o=new ResizeObserver(()=>vt(t,e,i)),n=()=>vt(t,e,i);return o.observe(t),addEventListener("resize",n),vt(t,e,i),()=>{o.disconnect(),removeEventListener("resize",n)}},vt=(t,e,s)=>{let i=t.getBoundingClientRect(),o={top:i.top+i.height+scrollY,left:i.left,width:i.width,height:e.offsetHeight,bottom:innerHeight-i.top-scrollY},n=o.top+o.height>scrollY+innerHeight&&o.top-i.height-o.height>scrollY,{top:r,left:a,width:c,height:l,bottom:h}=o;z.isEqual(s,o,["top","left","height","width","bottom"])||(z.assign(s,{top:r,left:a,width:c,height:l,bottom:h}),n?(e.style.bottom=`${h}px`,e.style.top=""):(e.style.top=`${r}px`,e.style.bottom=""),e.style.left=`${a}px`,e.style.width=`${c}px`)},ft=class t extends w{constructor(e,s){super(t.tagname,e,s),b(this,"$trigger",z.Null),b(this,"$content",z.Null),f(this,i,z.Null),b(this,"selected",z.Null),b(this,"itemMap",/* @__PURE__ */new Map),b(this,"$value",z.Null),b(this,"disconnect",z.Null),f(this,o,!1),this.listen("i18nupdate",()=>this.$value?.render())}props({value:t,disabled:e,...s}){super.props(s),this.disabled(e),this.value(t)}disabled(t){if(!arguments.length)return""===this.attr("disabled");z.isUndefined(t)||$.resolve(t,t=>{this.attr("disabled",t?"":z.Null)})}value(t){if(!arguments.length)return v(this,i);z.isUndefined(t)||$.resolve(t,t=>{x(this,i,t);let e=this.itemMap.get(t);this.selected=e??z.Null,this.$value?.render(),this.dispatch("selectvalue",[this,t],{bubbles:!0})})}open(){this.attr("opened",""),k()&&this.$content&&(this.disconnect=mt(this.$trigger?.node,this.$content.node),document.body.append(...this.$content.toDOM()),this.selected?.focus())}close(){this.attr("opened",z.Null),k()&&(this.$content?.removeNode(),this.disconnect?.(),this.disconnect=z.Null)}toDOM(t=!0){const e=super.toDOM(!1);return!v(this,o)&&t&&this.$trigger&&(x(this,o,!0),this.node?.append(...this.$trigger.toDOM()),this.$content?.toDOM(),this.$value?.render()),e}toString(){let t=this.$trigger?.toString()??"";return this.parseHTML({children:t})}};i=new WeakMap,o=new WeakMap,b(ft,"tagname","select-proto"),$.style(ft,S(ft.tagname,{display:"inline-block",width:"10rem",userSelect:"none"}));let $t=ft;const xt=class t extends w{$select=z.Null;constructor(e,s){super(t.tagname,{tabindex:0,...e},s),this.on("click",t=>z.isNull(this.$select?.attr("opened"))?this.$select.open():this.$select?.close()),this.on("blur",t=>this.$select?.close()),this.on("keydown",t=>{switch(t.key){case"ArrowDown":if(t.preventDefault(),!this.$select?.hasAttr("opened"))return this.$select?.open();this.$select?.$content?.switch("down");break;case"ArrowUp":if(t.preventDefault(),!this.$select?.hasAttr("opened"))return this.$select?.open();this.$select?.$content?.switch("up");break;case" ":t.preventDefault()}}),this.on("keyup",t=>{switch(t.key){case"Escape":t.preventDefault(),this.$select?.close();break;case" ":case"Enter":if(t.preventDefault(),!this.$select?.hasAttr("opened"))return this.$select?.open();this.$select?.$content?.$focusedItem?.select(),this.$select?.close()}})}build(t){return super.build(t),this.$select=this.findAbove(t=>z.isInstanceof(t,$t)),this.$select&&(this.$select.$trigger=this),this}};b(xt,"tagname","select-trigger"),$.style(xt,S(xt.tagname,{display:"flex",gap:"0.5rem",placeContent:"space-between",placeItems:"center",boxSizing:"border-box",border:"1px solid var(--input)",background:"color-mix(in oklch, var(--input) 30%, transparent)",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 2.5)",borderRadius:"var(--radius)",fontSize:"0.875rem",fontWeight:"var(--font-weight-medium)",lineHeight:"1","&:hover":{background:"color-mix(in oklch, var(--input) 50%, transparent)"},"&:focus":{outline:"0.1rem solid var(--border)"},"*":{pointerEvents:"none"}}));let yt=xt;class kt extends w{static tagname="select-value";$select=z.Null;$placeholder=z.Null;$text=new N("");constructor(t,e){super(kt.tagname,t,e)}props({placeholder:t,...e}){super.props(e),this.placeholder(t??z.Null)}build(t){return super.build(t),this.$select=this.findAbove(t=>z.isInstanceof(t,$t)),this.$select&&(this.$select.$value=this),this}placeholder(t){$.resolve(t,t=>{z.isString(t)?$.context(this,()=>this.$placeholder=new N(t)):this.$placeholder=t,this.render()})}render(){let t=z.Null;this.$select?.selected?(t=this.$text,this.$text.content=this.$select.selected.text):this.$placeholder&&(t=this.$placeholder),t&&(t.builded||t.build(),this.replaceProtos(t),this.node?.replaceChildren(...t.toDOM()))}}class wt extends w{constructor(t,e){super("selector-group",t,e)}}const It=class t extends w{constructor(e,s){super(t.tagname,e,s)}props({size:t,svg:e,...s}){super.props(s),this.svg(e),this.size(t)}svg(t){$.resolve(t,t=>{this.innerHTML(t)})}size(t){$.resolve(t,t=>{this.style({height:t,width:t})})}};b(It,"tagname","icon"),$.style(It,S(It.tagname,{display:"inline-block",verticalAlign:"middle",height:"1rem",width:"1rem",svg:{display:"block",height:"auto",width:"100%"}}));let Nt=It;const Mt=class extends Nt{constructor(t){super({svg:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down-icon lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>',...t})}};$.style(Mt,S(`select-proto[opened] ${Mt.tagname}`,{rotate:"180deg"}));let zt=Mt;const Dt="@media (hover: hover) and (pointer: fine)",Ct=class extends w{constructor(t,e){super("button",{ui:"button",...t},e)}};b(Ct,"tagname","button"),$.style(Ct,S('button[ui="button"]',{display:"inline-flex",placeContent:"center",placeItems:"center",padding:"0 calc(var(--spacing) * 2.5)",borderRadius:"var(--radius)",height:"calc(var(--spacing) * 8)",lineHeight:"1rem",transition:"0.2s all ease",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",outline:"0.1rem solid oklch(from var(--border) l c h / 0)",userSelect:"none",gap:"calc(var(--spacing) * 2.5)",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .9)","&:focus-visible":{outline:"0.1rem solid var(--border)"},"&:not([disabled]):active":{translate:"0 0.125rem"},[Dt]:{"&:not([disabled]):hover":{background:"oklch(from var(--input) l c h / .1)"}},'&[variant="primary"]':{border:"none",color:"oklch(from var(--primary-fg) l c h)",background:"var(--primary-bg)",[Dt]:{"&:not([disabled]):hover":{background:"oklch(from var(--primary-bg) l c h / .8)"}}},'&[variant="secondary"]':{border:"none",color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)",[Dt]:{"&:not([disabled]):hover":{background:"oklch(from var(--secondary-bg) l c h / .8)"}}},'&[variant="destructive"]':{border:"none",color:"oklch(from var(--destructive-fg) l c h)",background:"oklch(from var(--destructive-bg) l c h / .3)",[Dt]:{"&:not([disabled]):hover":{background:"oklch(from var(--destructive-bg) l c h / .5)"}}},'&[variant="ghost"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)",[Dt]:{"&:not([disabled]):hover":{background:"oklch(from var(--input) l c h / .1)"}}},'&[variant="link"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)",[Dt]:{"&:not([disabled]):hover":{textDecoration:"underline",textUnderlineOffset:"0.2rem"}}},'&[size="icon"]':{width:"calc(var(--spacing) * 8)",padding:"0"},'&[size="xs"]':{padding:"calc(var(--spacing) * 2)",fontSize:"var(--text-xs)",lineHeight:"var(--text-xs)",height:"calc(var(--spacing) * 6)"},'&[size="icon-xs"]':{width:"calc(var(--spacing) * 6)",height:"calc(var(--spacing) * 6)",padding:"0",svg:{width:"calc(var(--spacing) * 3)",height:"calc(var(--spacing) * 3)"}},'&[size="sm"]':{height:"calc(var(--spacing) * 7)"},'&[size="icon-sm"]':{width:"calc(var(--spacing) * 7)",height:"calc(var(--spacing) * 7)",padding:"0"},'&[size="lg"]':{height:"calc(var(--spacing) * 9)"},'&[size="icon-lg"]':{width:"calc(var(--spacing) * 9)",height:"calc(var(--spacing) * 9)",padding:"0"},'&[size="custom"]':{padding:"calc(var(--spacing) * 2)",height:"unset"},"&[disabled]":{opacity:".5"}}));let St=Ct;const At=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(At,"tagname","badge"),$.style(At,S(At.tagname,{display:"inline-flex",placeContent:"center",placeItems:"center",padding:"0 calc(var(--spacing) * 2)",borderRadius:"calc(var(--radius) * 2.6)",height:"calc(var(--spacing) * 5)",lineHeight:"var(--text-xs)",transition:"0.2s all ease",fontSize:"var(--text-xs)",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",outline:"0.1rem solid oklch(from var(--border) l c h / 0)",whiteSpace:"nowrap",gap:"var(--spacing)",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .9)","&:focus-visible":{outline:"0.1rem solid var(--border)"},"&[hover]:hover":{background:"oklch(from var(--input) l c h / .1)",color:"oklch(from var(--fg) l c h / 1)"},'&[variant="primary"]':{border:"none",color:"oklch(from var(--primary-fg) l c h)",background:"var(--primary-bg)"},'&[variant="secondary"]':{border:"none",color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)","&[hover]:hover":{background:"oklch(from var(--secondary-bg) l c h / .8)"}},'&[variant="destructive"]':{border:"none",color:"oklch(from var(--destructive-fg) l c h)",background:"oklch(from var(--destructive-bg) l c h / .3)","&[hover]:hover":{background:"oklch(from var(--destructive-bg) l c h / .5)"}},'&[variant="ghost"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)","&[hover]:hover":{background:"oklch(from var(--input) l c h / .1)"}},'&[variant="link"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)","&[hover]:hover":{textDecoration:"underline",textUnderlineOffset:"0.2rem"}},'&[size="sm"]':{padding:"0 calc(var(--spacing) * 1)",fontSize:"var(--text-xs2)",lineHeight:"var(--text-xs2)",height:"calc(var(--spacing) * 4)"}}));let Ot=At;const Et=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Et,"tagname","card"),$.style(Et,S(Et.tagname,{display:"flex",flexDirection:"column",gap:"calc(var(--spacing) * 4)",paddingBlock:"calc(var(--spacing) * 4)",background:"var(--secondary-bg)",borderRadius:"calc(var(--radius) * 1.4)",overflow:"hidden","&:has(> card-footer)":{paddingBottom:"0"}}));let Wt=Et;const Rt=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Rt,"tagname","card-header"),$.style(Rt,S(Rt.tagname,{display:"flex",width:"100%",flexDirection:"column",gap:"var(--spacing)",paddingInline:"calc(var(--spacing) * 4)"}));let Tt=Rt;const Ht=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Ht,"tagname","card-content"),$.style(Ht,S(Ht.tagname,{display:"block",paddingInline:"calc(var(--spacing) * 4)"}));let Lt=Ht;const Bt=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Bt,"tagname","card-footer"),$.style(Bt,S(Bt.tagname,{display:"block",paddingInline:"calc(var(--spacing) * 4)",paddingBlock:"calc(var(--spacing) * 4)",background:"color-mix(in oklab, var(--muted) 5%, transparent)"}));let Ft=Bt;const Ut=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Ut,"tagname","h3"),$.style(Ut,S(`card ${Ut.tagname}`,{fontWeight:"var(--font-weight-medium)",lineHeight:"1.375",fontSize:"var(--text-md)",color:"var(--fg)"}));let _t=Ut;const Vt=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Vt,"tagname","card-description"),$.style(Vt,S(`card ${Vt.tagname}`,{fontWeight:"var(--font-weight-medium)",lineHeight:"var(--line-height-sm)",fontSize:"var(--text-sm)",color:"var(--muted)"}));let jt=Vt;const Yt=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Yt,"tagname","dl"),$.style(Yt,S(Yt.tagname,{display:"flex",flexDirection:"column",margin:"0"}));let qt=Yt;const Xt=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Xt,"tagname","dc"),$.style(Xt,S(Xt.tagname,{paddingBlock:"1rem",borderBottom:"1px solid color-mix(in oklch, var(--input) 50%, transparent)","&:last-child":{borderBottom:"none"}}));let Pt=Xt;const Gt=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Gt,"tagname","dt"),$.style(Gt,S(Gt.tagname,{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)"}));let Jt=Gt;const Kt=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(Kt,"tagname","dd"),$.style(Kt,S(Kt.tagname,{margin:"0",fontSize:"var(--text-sm)",color:"var(--muted)"}));let Qt=Kt;const Zt=class t extends w{$content=z.Null;constructor(e,s){super(t.tagname,e,s)}open({x:t,y:e,position:s,size:i}){if(k()){this.build(),this.on("pointerdown",t=>{t.target!==this.$content?.node&&(t.target&&this.$content?.node?.contains(t.target)||this.close())}),document.body.append(...this.toDOM());const o=this.$content?.node;if(!o)return;const n=t+o.offsetWidth>innerWidth,r=e+o.offsetHeight>innerHeight;innerWidth<800&&document.documentElement.hasAttribute("touch")?(this.attr("touch",""),this.$content?.style({bottom:"0",width:"100dvw"}),o.animate({translate:["0 100%","0 0"]},{duration:300,easing:"ease",fill:"both"})):s?this.$content?.style({top:"top"===s?"":`${e}px`,bottom:"top"===s?innerHeight-e+"px":"",left:n?"":`${t}px`,right:n?"calc(var(--spacing) * 4)":"",width:i?`${i}px`:""}):this.$content?.style({top:r?"":`${e}px`,bottom:r?"calc(var(--spacing) * 4)":"",left:n?"":`${t}px`,right:n?"calc(var(--spacing) * 4)":"",width:i?`${i}px`:""})}}close(t=!0){const e=()=>{this.removeNode(),t&&this.dispose()};if(this.hasAttr("touch")){if(!this.$content?.node)return;this.style({background:"transparent"});const t=this.$content.node.animate({translate:["0 0","0 100%"]},{duration:300,easing:"ease",fill:"both"});t.addEventListener("finish",e),t.addEventListener("cancel",e)}else e()}};b(Zt,"tagname","context-menu"),$.style(Zt,S(Zt.tagname,{position:"fixed",inset:"0",transition:"all .3s ease",zIndex:"999","&[touch]":{background:"oklch(from var(--bg) calc(l - 0.1) c h / .5)"}})),$.style(Zt,A("html:has(context-menu)",{scrollbarGutter:"stable",overflowY:"hidden",overflowX:"hidden",height:"100dvh"}));let te=Zt;const ee=class t extends w{$menu=z.Null;constructor(e,s){super(t.tagname,e,s),this.on("click",()=>this.$menu?.close())}build(t){return super.build(t),this.$menu=this.findAbove(t=>z.isInstanceof(t,te)),this.$menu&&(this.$menu.$content=this),this}};b(ee,"tagname","context-menu-content"),$.style(ee,S(ee.tagname,{...ht,background:"oklch(from var(--secondary-bg) l c h)","context-menu[touch] &":{borderRadius:"calc(var(--radius) * 2)",padding:"calc(var(--spacing) * 4)",gap:"0.1rem",border:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0","& > context-menu-item:first-child, & > :first-child context-menu-item":{borderTopLeftRadius:"calc(var(--radius) * 2)",borderTopRightRadius:"calc(var(--radius) * 2)"},"& > context-menu-item:last-child, & > :last-child context-menu-item":{borderBottomLeftRadius:"calc(var(--radius) * 2)",borderBottomRightRadius:"calc(var(--radius) * 2)"}}}));let se=ee;const ie=class t extends w{$menu=z.Null;constructor(e,s){super(t.tagname,e,s),this.on("click",()=>requestAnimationFrame(()=>this.$menu?.close()))}build(t){return super.build(t),this.$menu=this.findAbove(t=>z.isInstanceof(t,te)),this}};b(ie,"tagname","context-menu-item"),$.style(ie,S(ie.tagname,{display:"block",boxSizing:"border-box",padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)",borderRadius:"var(--radius)",fontSize:"var(--text-md)",fontWeight:"500",lineHeight:"1",cursor:"pointer","context-menu[touch] &":{fontSize:"var(--text-md)",padding:"calc(var(--spacing) * 4)",background:"color-mix(in oklch, var(--secondary-bg), var(--input) 40%)",transition:"all .3s ease",borderRadius:"0","html:not([touch]) &:hover":{background:"color-mix(in oklch, var(--secondary-bg), var(--input) 20%)"},"&:active":{scale:".99 .99",background:"color-mix(in oklch, var(--secondary-bg), var(--input) 20%)"}},"&:hover, :not(:has(select-item:hover)) &:focus":{background:"oklch(from var(--input) l c h / .1)"},"&:focus":{outline:"none"},"&:has(> a)":{padding:"0",a:{padding:"calc(var(--spacing) * 2) calc(var(--spacing) * 1.25)"}}}));let oe=ie;const ne={borderRadius:"var(--radius)",height:"calc(var(--spacing) * 8)",transition:"0.2s all ease",fontFamily:"inherit",fontSize:"var(--text-sm)",padding:"0 calc(var(--spacing) * 2.5)",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .9)",outline:"0.2rem solid transparent","&:focus-visible":{outlineColor:"var(--border)"},"&:disabled":{opacity:".5"},"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{"-webkit-appearance":"none",margin:"0"},"&[type=number]":{"-moz-appearance":"textfield",appearance:"textfield"}},re=class t extends w{constructor(e,s){super(t.tagname,{ui:"input",...e},s)}};b(re,"tagname","input"),$.style(re,S('input[ui="input"]',{...ne}));let ae=re;const ce=class t extends w{constructor(e,s){super(t.tagname,e,s)}props({for:t,...e}){super.props(e),this.for(t)}build(t){return super.build(t),this.setFor(),this}for(t){if(!arguments.length)return this.attr("for");z.isUndefined(t)||$.resolve(t,t=>{this.attr("for",t),this.setFor()})}setFor(){const t=this.for();this.findBelow(e=>{z.isInstanceof(e,w)&&("input"===e.tagname&&e.attr("id",t),"label"===e.tagname&&e.attr("for",t))})}};b(ce,"tagname","field"),$.style(ce,S(ce.tagname,{display:"flex",flexDirection:"column",gap:"calc(var(--spacing) * 2)",width:"100%",'&[direction="horizontal"]':{flexDirection:"row",placeItems:"center",width:"unset"},"&:has(field-error)":{'input[ui="input"], textarea[ui="textarea"]':{borderColor:"var(--destructive-fg)","&:focus-visible":{outlineColor:"color-mix(in oklch, var(--destructive-fg) 30%, transparent)"}}}}));let le=ce;const he=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(he,"tagname","label"),$.style(he,S(he.tagname,{"field &":{display:"flex",gap:"var(--spacing)",placeItems:"center",userSelect:"none",color:"var(--fg)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",flexShrink:"0"},"field[disabled] &":{pointerEvents:"none"}}));let ue=he;const de=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(de,"tagname","field-description"),$.style(de,S(de.tagname,{"field &":{display:"block",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)"},"field[disabled] &":{pointerEvents:"none"}}));let pe=de;const ge=class t extends w{constructor(e,s){super(t.tagname,e,s)}};b(ge,"tagname","field-error"),$.style(ge,S(ge.tagname,{fontSize:"var(--text-sm)",color:"var(--destructive-fg)",display:"block"}));let be=ge;const me=class extends w{constructor(t,e){super("input",{type:"checkbox",ui:"switch",...t},e)}};b(me,"tagname","input"),$.style(me,S('input[ui="switch"]',{appearance:"none",display:"inline-flex",height:"calc(var(--spacing) * 5)",width:"calc(var(--spacing) * 9)",background:"color-mix(in oklab, var(--input) 80%, transparent)",border:"none",placeItems:"center",borderRadius:"calc(var(--spacing) * 5)",transition:"all .3s ease",padding:"0",flexShrink:"0",margin:"0","&::after":{content:'""',display:"block",height:"calc(var(--spacing) * 5)",width:"calc(var(--spacing) * 5)",background:"var(--fg)",borderRadius:"var(--radius-round)",transition:"all .3s ease"},"&:checked":{background:"var(--primary-bg)","&::after":{height:"calc(var(--spacing) * 4.5)",width:"calc(var(--spacing) * 4.5)",translate:"calc(115% - var(--spacing)) 0",background:"var(--bg)"}}}));let ve=me;const fe=class extends w{constructor(t,e){super("button",{ui:"toggle",...t},e),this.on("click",t=>this.checked(!this.checked()))}props({checked:t,...e}){super.props(e),this.checked(t)}checked(t){if(!arguments.length)return!z.isNull(this.attr("checked"));z.isUndefined(t)||$.resolve(t,t=>{this.attr("checked",t?"":z.Null),this.node?.dispatchEvent(new Event("input"))})}};b(fe,"tagname","button"),$.style(fe,S('button[ui="toggle"]',{display:"inline-flex",placeContent:"center",placeItems:"center",padding:"0 calc(var(--spacing) * 2.5)",borderRadius:"var(--radius)",height:"calc(var(--spacing) * 8)",lineHeight:"1rem",transition:"0.1s all ease",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",outline:"0.1rem solid oklch(from var(--border) l c h / 0)",userSelect:"none",gap:"calc(var(--spacing) * 2.5)",flexShrink:"0",border:"1px solid oklch(from var(--input) l c h / .2)",background:"oklch(from var(--input) l c h / .025)",color:"oklch(from var(--fg) l c h / .8)",[Dt]:{"&:not([disabled]):hover":{background:"oklch(from var(--input) l c h / .1)",color:"oklch(from var(--fg) l c h)"}},"&[checked]":{color:"oklch(from var(--primary-fg) l c h)",background:"oklch(from var(--primary-bg) l c h / .8)",[Dt]:{"&:not([disabled]):hover":{background:"oklch(from var(--primary-bg) l c h)",color:"oklch(from var(--primary-fg) l c h)"}}},'&[variant="primary"]':{"&[checked]":{color:"oklch(from var(--primary-fg) l c h)",background:"var(--primary-bg)"}},'&[variant="secondary"]':{"&[checked]":{color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)"}},'&[variant="destructive"]':{"&[checked]":{color:"oklch(from var(--destructive-fg) l c h)",background:"oklch(from var(--destructive-bg) l c h / .3)"}},'&[variant="ghost"]':{border:"none",color:"oklch(from var(--fg) l c h)",background:"oklch(from var(--input) l c h / 0)","&[checked]":{color:"oklch(from var(--secondary-fg) l c h)",background:"var(--secondary-bg)"}},'&[size="icon"]':{width:"calc(var(--spacing) * 8)",padding:"0"},'&[size="xs"]':{padding:"calc(var(--spacing) * 2)",fontSize:"var(--text-xs)",lineHeight:"var(--text-xs)",height:"calc(var(--spacing) * 6)"},'&[size="icon-xs"]':{width:"calc(var(--spacing) * 6)",height:"calc(var(--spacing) * 6)",padding:"0",svg:{width:"calc(var(--spacing) * 3)",height:"calc(var(--spacing) * 3)"}},'&[size="sm"]':{height:"calc(var(--spacing) * 7)"},'&[size="icon-sm"]':{width:"calc(var(--spacing) * 7)",height:"calc(var(--spacing) * 7)",padding:"0"},'&[size="lg"]':{height:"calc(var(--spacing) * 9)"},'&[size="icon-lg"]':{width:"calc(var(--spacing) * 9)",height:"calc(var(--spacing) * 9)",padding:"0"},"&[disabled]":{opacity:".5"}}));let $e=fe;class xe extends w{$combobox=z.Null;$focusedItem=z.Null;$createItem=z.Null;virtual=!0;constructor(t,e){super("combobox-list",t,e)}build(t){return super.build(t),this.$combobox=this.findAbove(t=>z.isInstanceof(t,Me)),this.$combobox&&(this.$combobox.$list=this),this.$combobox?.$chips?.toDOM(),this}filter(t){if(!this.$combobox)return;const e=[];this.$createItem&&(this.$createItem.visible=!!t.trim()&&!z.arrayFrom(this.$combobox.itemMap.values()).find(e=>e.text===t.trim())),z.forEach(this.$combobox.itemMap,([s,i])=>{i.visible=!1,i.text.toLowerCase().includes(t.toLowerCase())&&(i.visible=!0,e.push(i))}),this.$combobox?.$content?.$empty&&(this.$combobox.$content.$empty.visible=!this.$createItem?.visible&&!e.length),this.$combobox.$content?.toDOM()}switch(t){const e=this.$focusedItem,s=this.visibleChildren,i=e?s.indexOf(e):"up"===t?0:-1;let o="up"===t?i-1:i+1;(o<0||o>=s.length)&&(o="up"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedItem?.blur(),e?.focus()}focusFirstItem(){this.$createItem?.visible&&this.visibleChildren[1]?this.focus(1):this.focus(0)}mutate(){if(super.mutate(),this.$combobox?.itemMap.clear(),z.forEach(this.children,t=>{z.isInstanceof(t,ke)&&this.$combobox?.itemMap.set(t.value(),t)}),!this.$combobox)return;const t=this.$combobox.values(),e=t.filter(t=>this.$combobox?.itemMap.has(t));z.isEqual(t,e)||(this.$combobox?.values(e),this.$combobox?.dispatch("combobox_input",[]))}}const ye=class extends w{constructor(t,e){super("combobox-item",t,()=>{e?.(this),$(Nt,{ui:"combobox-item-check",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-icon lucide-check"><path d="M20 6 9 17l-5-5"/></svg>'})}),b(this,"$combobox",z.Null),b(this,"$list",z.Null),f(this,n,z.Null),f(this,r,!1),this.on("mousedown",t=>t.preventDefault()),this.on("click",()=>{this.$combobox?.select(v(this,n),!this.selected())})}build(t){return super.build(t),this.$combobox=this.findAbove(t=>z.isInstanceof(t,Me)),this.$list=this.findAbove(t=>z.isInstanceof(t,xe)),this.$combobox?.itemMap.set(v(this,n),this),this.$combobox?.values().includes(v(this,n))&&this.selected(!0),this}props({value:t,label:e,selected:s,...i}){super.props(i),this.value(t),this.selected(s)}value(t){if(!arguments.length)return v(this,n);z.isUndefined(t)||$.resolve(t,t=>{this.$combobox?.itemMap.delete(v(this,n)),this.$combobox?.itemMap.set(t,this),x(this,n,t)})}selected(t){if(!arguments.length)return v(this,r);z.isUndefined(t)||$.resolve(t,t=>{x(this,r,t),this.attr("selected",t?"":null)})}focus(){this.attr("focus",""),this.node?.scrollIntoView({block:"nearest"}),this.$list&&(this.$list.$focusedItem=this)}blur(){this.attr("focus",z.Null),this.$list&&(this.$list.$focusedItem=null)}};n=new WeakMap,r=new WeakMap,b(ye,"tagname","combobox-item"),$.style(ye,S(ye.tagname,{...pt,'icon[ui="combobox-item-check"]':{visibility:"hidden",marginInlineStart:"auto"},'&[selected] icon[ui="combobox-item-check"]':{visibility:"visible"}}));let ke=ye;const we=class extends w{$combobox=z.Null;$list=z.Null;constructor(t,e){super("combobox-create-item",t,e),this.on("mousedown",t=>t.preventDefault()),this.on("click",t=>{this.dispatch("combobox_create",[this.$combobox?.$input?.node?.value],{bubbles:!0}),this.$combobox?.$input?.clearValue()})}build(t){return super.build(t),this.$combobox=this.findAbove(t=>z.isInstanceof(t,Me)),this.$list=this.findAbove(t=>z.isInstanceof(t,xe)),this.$list&&(this.$list.$createItem=this),this}focus(){this.attr("focus",""),this.$list&&(this.$list.$focusedItem=this)}blur(){this.attr("focus",z.Null),this.$list&&(this.$list.$focusedItem=null)}};b(we,"tagname","combobox-create-item"),$.style(we,S(we.tagname,pt));let Ie=we;const Ne=class extends w{constructor(t,e){super("combobox",t,e),b(this,"$trigger",z.Null),b(this,"$content",z.Null),b(this,"$list",z.Null),b(this,"$chips",z.Null),b(this,"$input",z.Null),b(this,"itemMap",/* @__PURE__ */new Map),f(this,a,/* @__PURE__ */new Set),f(this,c,!1),b(this,"disconnect",z.Null)}toDOM(t=!0){const e=super.toDOM(!1);return!v(this,c)&&t&&this.$trigger&&(this.node?.append(...this.$trigger.toDOM()),this.$content?.toDOM(),x(this,c,!0)),e}props({values:t,...e}){super.props(e),this.values(t)}open(){this.attr("opened",""),k()&&this.$content&&(this.disconnect=mt(this.$trigger?.node,this.$content.node),document.body.append(...this.$content.toDOM()),this.$input&&this.$list?.filter(this.$input.node?.value??""))}close(){this.attr("opened",z.Null),k()&&(this.$content?.removeNode(),this.disconnect?.(),this.disconnect=z.Null)}select(t,e=!0){const s=this.itemMap.get(t);s&&(s.selected(e),e?(v(this,a).add(t),this.dispatch("combobox_select",[t])):(v(this,a).delete(t),this.dispatch("combobox_unselect",[t])),this.$chips?.toDOM(),this.dispatch("combobox_input",[]))}get selected(){return z.map(v(this,a),t=>this.itemMap.get(t))}values(t){if(!arguments.length)return z.arrayFrom(v(this,a));z.isUndefined(t)||$.resolve(t,t=>{x(this,a,new Set(t)),z.forEach(this.itemMap.values(),t=>{t.selected(v(this,a).has(t.value()))}),this.$chips?.toDOM()})}};a=new WeakMap,c=new WeakMap,b(Ne,"tagname","combobox"),$.style(Ne,S(Ne.tagname,{display:"inline-block",width:"10rem",userSelect:"none"}));let Me=Ne;const ze=class extends w{$combobox=z.Null;constructor(t,e){super("combobox-trigger",t,e),this.on("dragover",t=>this.$combobox?.$chips?.dragover(t)),this.on("dragend",t=>this.$combobox?.$chips?.dragend())}build(t){return super.build(t),this.$combobox=this.findAbove(t=>z.isInstanceof(t,Me)),this.$combobox&&(this.$combobox.$trigger=this),this}};b(ze,"tagname","combobox-trigger"),$.style(ze,S(ze.tagname,{display:"flex",flexWrap:"wrap",columnGap:"calc(var(--spacing) * 1.25)",placeItems:"center",boxSizing:"border-box",border:"1px solid var(--input)",background:"color-mix(in oklch, var(--input) 30%, transparent)",borderRadius:"var(--radius)",fontSize:"0.875rem",fontWeight:"var(--font-weight-medium)",lineHeight:"1",padding:"0 calc(var(--spacing) * 1.25)","&:hover":{background:"color-mix(in oklch, var(--input) 50%, transparent)"},"&:focus-within":{outline:"0.1rem solid var(--border)"}}));let De=ze;const Ce=class extends w{$combobox=z.Null;constructor(t,e){super("input",{ui:"combobox-input",autocomplete:"off",...t},e),this.on("focus",t=>z.isNull(this.$combobox?.attr("opened"))&&this.$combobox.open()),this.on("blur",t=>{this.$combobox?.close(),this.$combobox?.$chips?.$focusedChip?.blur()}),this.on("input",t=>{this.$combobox?.$list?.filter(t.currentTarget.value),this.$combobox?.$list?.focusFirstItem()}),this.on("keydown",t=>{switch(t.key){case"ArrowDown":return t.preventDefault(),void this.$combobox?.$list?.switch("down");case"ArrowUp":return t.preventDefault(),void this.$combobox?.$list?.switch("up");case"Backspace":return void(0===t.currentTarget.value.length&&this.$combobox?.$chips?.visibleChildren.at(-1)?.delete());case"ArrowRight":return void(0===t.currentTarget.value.length&&this.$combobox?.$chips?.switch("right"));case"ArrowLeft":return void(0===t.currentTarget.value.length&&this.$combobox?.$chips?.switch("left"))}}),this.on("keyup",t=>{switch(t.key){case"Escape":return t.preventDefault(),this.$combobox?.close(),void this.$combobox?.$trigger?.node?.focus();case"Delete":{const t=this.$combobox?.$chips?.$focusedChip;return this.$combobox?.$chips?.switch("right"),void t?.delete()}case"Tab":case"Enter":{t.preventDefault();const e=this.$combobox?.$list?.$focusedItem;if(!e)return;return z.isInstanceof(e,ke)?this.$combobox?.select(e.value()):this.dispatch("combobox_create",[t.currentTarget.value],{bubbles:!0}),void this.clearValue()}}t.currentTarget.value.length&&this.$combobox?.$chips?.$focusedChip?.blur()})}build(t){return super.build(t),this.$combobox=this.findAbove(t=>z.isInstanceof(t,Me)),this.$combobox&&(this.$combobox.$input=this),this}clearValue(){this.node&&(this.node.value=""),this.$combobox?.$list?.filter("")}};$.style(Ce,S('input[ui="combobox-input"]',{display:"inline",border:"unset",background:"unset",color:"oklch(from var(--fg) l c h / .9)",fontSize:"0.875rem",fontWeight:"var(--font-weight-medium)",fontFamily:"inherit",lineHeight:"1",height:"calc(var(--spacing) * 8)",flex:"1",minWidth:"2rem",padding:"0 calc(var(--spacing) * 1.25)",outline:"unset","&:focus":{outline:"unset"}}));let Se=Ce;const Ae=class extends w{$combobox=z.Null;$empty=z.Null;constructor(t,e){super("combobox-content",t,e)}build(t){return super.build(t),this.$combobox=this.findAbove(t=>z.isInstanceof(t,Me)),this.$combobox&&(this.$combobox.$content=this),this}};b(Ae,"tagname","combobox-content"),$.style(Ae,S(Ae.tagname,ht));let Oe=Ae;const Ee=class extends w{$content=z.Null;constructor(t,e){super("combobox-empty",t,e)}build(t){return super.build(t),this.$content=this.findAbove(t=>z.isInstanceof(t,Oe)),this.$content&&(this.$content.$empty=this),this}};b(Ee,"tagname","combobox-empty"),$.style(Ee,S(Ee.tagname,{...pt}));let We=Ee;class Re extends M{$combobox=z.Null;chipMap=/* @__PURE__ */new Map;$focusedChip=z.Null;$draggedChip=z.Null;#t=[];#e=[];#s=[];constructor(t){super(t)}build(t){return super.build(t),this.$combobox=this.findAbove(t=>z.isInstanceof(t,Me)),this.$combobox&&(this.$combobox.$chips=this),this}toDOM(){const t=this.$combobox?.values()??[];return z.isEqual(t,this.#e)||(this.#e=[...t],z.forEach(this.children,t=>t.removeNode()),this.#s=z.map(this.$combobox?.values(),t=>{const e=this.chipMap.get(t);return e?(e.builded||e.build(),e.toDOM()):[]})?.flat()??[],this.node?.replaceWith(this.node,...this.#s)),[this.node,...this.#s]}switch(t){const e=this.$focusedChip,s=this.visibleChildren,i=e?s.indexOf(e):"left"===t?0:-1;let o="left"===t?i-1:i+1;(o<0||o>=s.length)&&(o="left"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedChip?.blur(),e?.focus()}dragover(t){if(!this.$draggedChip?.node)return;if(!this.$combobox)return;const e=z.map(this.#e,t=>this.chipMap.get(t)).reduce((e,s)=>{const i=s.node.getBoundingClientRect(),o=t.x-i.left-i.width/2,n=t.y-i.top-i.height/2,r=Math.pow(o,2)+Math.pow(n,2);return r<e.offset?{offset:r,$chip:s}:e},{offset:Number.POSITIVE_INFINITY,$chip:void 0}).$chip;if(e&&e!==this.$draggedChip){const s=e.node.getBoundingClientRect(),i=this.$draggedChip.value(),o=e.value(),n=this.$combobox.values();n.splice(n.indexOf(i),1),t.x<s.left+s.width/2?(this.$combobox.$trigger?.node?.insertBefore(this.$draggedChip.node,e.node),n.splice(n.indexOf(o),0,i)):(this.$combobox.$trigger?.node?.insertBefore(this.$draggedChip.node,e.node?.nextSibling??null),n.splice(n.indexOf(o)+1,0,i)),this.#t=n}}dragend(){this.#t.length&&(this.$combobox?.values(this.#t),this.$combobox?.dispatch("combobox_input",[])),this.#t=[],this.$draggedChip?.removeClass("dragging"),this.$draggedChip=null}mutate(){super.mutate(),this.chipMap.clear(),z.forEach(this.children,t=>{z.isInstanceof(t,He)&&this.chipMap.set(t.value(),t)}),this.#e=[],this.toDOM()}}const Te=class extends w{constructor(t,e){super("combobox-chip",{draggable:!0,...t},e),b(this,"$chips",z.Null),f(this,l),this.on("dragstart",()=>{this.$chips&&(this.$chips.$draggedChip=this,this.addClass("dragging"))})}build(t){return super.build(t),this.$chips=this.findAbove(t=>z.isInstanceof(t,Re)),this.$chips?.chipMap.set(this.value(),this),this}props({value:t,...e}){super.props(e),this.value(t)}value(t){if(!arguments.length)return v(this,l);z.isUndefined(t)||$.resolve(t,t=>{this.$chips?.chipMap.delete(t),this.$chips?.chipMap.set(t,this),x(this,l,t)})}delete(){this.$chips?.$combobox?.select(v(this,l),!1)}focus(){this.attr("focus",""),this.$chips&&(this.$chips.$focusedChip=this)}blur(){this.attr("focus",z.Null),this.$chips&&(this.$chips.$focusedChip=z.Null)}};l=new WeakMap,b(Te,"tagname","combobox-chip"),$.style(Te,S(Te.tagname,{display:"inline-flex",placeItems:"center",fontSize:"var(--text-xs)",padding:"0 calc(var(--spacing) * 1.5)",background:"var(--secondary-bg)",borderRadius:"calc(var(--radius) * .6)",height:"calc(var(--spacing) * 5.25)",marginBlock:"calc(var(--spacing))",cursor:"grab",gap:"var(--spacing)","&:active":{cursor:"grabbing"},"&[focus]":{outline:"2px solid var(--input)"},"&.dragging":{background:"var(--input)"}}));let He=Te;const Le=class extends w{$chip=z.Null;constructor(t,e){super("button",{ui:"combobox-chip-remove",tabindex:"-1",...t},()=>{e?e(this):$(Nt,{svg:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'})}),this.on("click",()=>{this.$chip?.$chips?.$combobox?.select(this.$chip.value(),!1)})}build(t){return super.build(t),this.$chip=this.findAbove(t=>z.isInstanceof(t,He)),this}};b(Le,"tagname","button"),$.style(Le,S('button[ui="combobox-chip-remove"]',{background:"unset",border:"unset",color:"oklch(from var(--fg) l c h / .9)",padding:"0",icon:{height:"calc(var(--spacing) * 3.25)",width:"calc(var(--spacing) * 3.25)"}}));let Be=Le;class Fe extends w{static $container=z.Null;constructor(t,e){super("toast",t,e)}static popup({position:t,...e},s){if(!k())return;this.$container=this.$container??new _e({});const i=new Fe(e,s),o=this.$container.list(t??"top");this.$container.append(o),o.append(i),i.build();const n=this.$container.toDOM();document.body.contains(this.$container.node)||document.body.append(...n),setTimeout(()=>{i.remove(),i.removeNode(),i.dispose()},3e3)}}const Ue=class extends w{listMap={};constructor(t,e){super("toast-container",t,e)}list(t){return this.listMap[t]=this.listMap[t]??new je({position:t}).build()}};b(Ue,"tagname","toast-container"),$.style(Ue,S(Ue.tagname,{position:"fixed",inset:"0 0 0 0",pointerEvents:"none"}));let _e=Ue;const Ve=class extends w{constructor(t,e){super("toast-list",t,e)}};b(Ve,"tagname","toast-list"),$.style(Ve,S(Ve.tagname,{display:"flex",flexDirection:"column",gap:"calc(var(--spacing) * 2)",pointerEvents:"auto",position:"absolute",'&[position="top"]':{top:"0",placeSelf:"center"},'&[position="top-left"]':{top:"0",placeSelf:"start"},'&[position="top-right"]':{top:"0",placeSelf:"end"},'&[position="bottom"]':{bottom:"0",placeSelf:"center"},'&[position="bottom-left"]':{bottom:"0",placeSelf:"start"},'&[position="bottom-right"]':{bottom:"0",placeSelf:"end"}}));let je=Ve;const Ye=class extends w{disconnect=z.Null;$content=z.Null;$list=z.Null;$input=z.Null;constructor(t,e){super("searchbar",t,e)}open(){this.hasAttr("opened")||(this.attr("opened",""),k()&&this.$content&&(this.disconnect=mt(this.$input?.node,this.$content.node),document.body.append(...this.$content.toDOM())))}close(){this.attr("opened",z.Null),k()&&(this.$content?.removeNode(),this.disconnect?.(),this.disconnect=z.Null)}toDOM(t=!0){return super.toDOM(!1),t&&this.$input&&(this.node?.append(...this.$input.toDOM()),this.$content?.toDOM()),[this.node]}};b(Ye,"tagname","searchbar"),$.style(Ye,S(Ye.tagname,{}));let qe=Ye;const Xe=class extends ae{$searchbar=z.Null;constructor(t,e){super({ui:"searchbar-input",...t},e),this.on("focus",t=>this.$searchbar?.$list?.visibleChildren.length&&this.$searchbar.open()),this.on("blur",t=>this.$searchbar?.close()),this.on("keydown",t=>{switch(t.key){case"ArrowDown":return t.preventDefault(),void this.$searchbar?.$list?.switch("down");case"ArrowUp":return t.preventDefault(),void this.$searchbar?.$list?.switch("up")}}),this.on("keyup",t=>{switch(t.key){case"Escape":return t.preventDefault(),this.$searchbar?.close(),void this.$searchbar?.$input?.node?.blur();case"Enter":return t.preventDefault(),void this.$searchbar?.$list?.$focusedItem?.select()}})}build(t){return super.build(t),this.$searchbar=this.findAbove(t=>z.isInstanceof(t,qe)),this.$searchbar&&(this.$searchbar.$input=this),this}};$.style(Xe,S('input[ui="searchbar-input"]',{...ne,width:"100%"}));let Pe=Xe;const Ge=class extends w{$searchbar=z.Null;constructor(t,e){super("searchbar-content",t,e),this.listen("mutate",()=>{this.$searchbar?.$list?.visibleChildren.length?this.$searchbar.open():this.$searchbar?.close()})}build(t){return super.build(t),this.$searchbar=this.findAbove(t=>z.isInstanceof(t,qe)),this.$searchbar&&(this.$searchbar.$content=this),this}};b(Ge,"tagname","searchbar-content"),$.style(Ge,S(Ge.tagname,ht));let Je=Ge;class Ke extends w{$searchbar=z.Null;$focusedItem=z.Null;constructor(t,e){super("combobox-list",t,e)}build(t){return super.build(t),this.$searchbar=this.findAbove(t=>z.isInstanceof(t,qe)),this.$searchbar&&(this.$searchbar.$list=this),this}switch(t){const e=this.$focusedItem,s=this.visibleChildren,i=e?s.indexOf(e):"up"===t?0:-1;let o="up"===t?i-1:i+1;(o<0||o>=s.length)&&(o="up"===t?-1:0),this.focus(o)}focus(t){let e=this.visibleChildren.at(t);this.$focusedItem?.blur(),e?.focus()}}const Qe=class extends w{$list=z.Null;constructor(t,e){super("searchbar-item",t,e),this.on("click",()=>this.select()),this.on("mousedown",t=>t.preventDefault())}build(t){return super.build(t),this.$list=this.findAbove(t=>z.isInstanceof(t,Ke)),this}focus(){this.attr("focus",""),this.node?.scrollIntoView({block:"nearest"}),this.$list&&(this.$list.$focusedItem=this)}blur(){this.attr("focus",z.Null),this.$list&&(this.$list.$focusedItem=null)}select(){this.dispatch("searchbar_item_select",[]),this.$list?.$searchbar?.hasAttr("autoclose")&&this.$list.$searchbar.close()}};b(Qe,"tagname","searchbar-item"),$.style(Qe,S(Qe.tagname,pt));let Ze=Qe;const ts=class extends w{constructor(t,e){super("textarea",{ui:"textarea",...t},e)}};b(ts,"tagname","textarea"),$.style(ts,S('textarea[ui="textarea"]',{...ne,padding:"calc(var(--spacing) * 2.5)",minHeight:"calc(var(--spacing) * 5 + 2rem)",maxHeight:"calc(var(--spacing) * 5 + 10rem)",fieldSizing:"content",resize:"none",height:"unset"}));let es=ts;const ss=class extends w{constructor(t,e){super("textblock",t,e)}};b(ss,"tagname","textblock"),$.style(ss,S(ss.tagname,{display:"block",whiteSpace:"pre",fontSize:"var(--text-sm)",textWrap:"auto"}));let is=ss;const os=class extends w{constructor(t,e){super("container",{type:"inline-size",...t},e),this.style({containerName:t.name,containerType:t.type??"inline-size"})}};b(os,"tagname","container"),$.style(os,S(os.tagname,{containerName:"attr(name type(*))",containerType:"attr(type type(*))"}));let ns=os;const rs=class t extends w{constructor(e,s){super(t.tagname,e,s),b(this,"$content",z.Null),b(this,"$container",z.Null),b(this,"index",0),b(this,"itemList",/* @__PURE__ */new Set),b(this,"timer",z.Null),f(this,h,3),f(this,u,0),b(this,"playing",!1),b(this,"transformIndex",0),b(this,"animation",z.Null),f(this,d,z.Null),b(this,"$targetItem",z.Null),this.on("mouseenter",t=>this.hasAttr("hoverpause")&&this.pause()),this.on("mouseleave",t=>this.autoplay()&&this.play()),this.listen("dom",()=>{this.jumpTo(this.index),this.node&&!v(this,d)&&(x(this,d,new ResizeObserver(()=>{this.inDOM()&&this.autoplay()?this.play():this.pause()})),v(this,d).observe(this.node)),this.autoplay()&&this.play()}),this.touchHandler()}props({interval:t,hoverpause:e,autoplay:s,loop:i,...o}){super.props(o),this.autoplay(s),this.loop(i),this.interval(t),this.hoverpause(e)}autoplay(t){if(!arguments.length)return this.hasAttr("autoplay");z.isUndefined(t)||$.resolve(t,t=>{this.attr("autoplay",t?"":z.Null)})}loop(t){if(!arguments.length)return this.hasAttr("loop");z.isUndefined(t)||$.resolve(t,t=>{this.attr("loop",t?"":z.Null)})}hoverpause(t){if(!arguments.length)return this.hasAttr("hoverpause");z.isUndefined(t)||$.resolve(t,t=>{this.attr("hoverpause",t?"":z.Null)})}interval(t){if(!arguments.length)return v(this,h);z.isUndefined(t)||$.resolve(t,t=>{x(this,h,t)})}play(){this.playing||(this.playing=!0,this.timer=setInterval(()=>{this.inDOM()||this.pause(),y(this,u)._++,v(this,u)>=100*v(this,h)&&(this.switch("next"),x(this,u,0))},10))}pause(){this.playing=!1,this.timer&&clearTimeout(this.timer)}stop(){this.pause(),x(this,u,0)}targetItems(t){const e=z.arrayFrom(this.itemList),s=e.at(t),i=e.at(t-1),o=e.at(t+1>=e.length?0:t+1);return z.tuple(i,s,o)}setItemsStyle(t){const[e,s,i]=this.targetItems(t),o=this.attr("gap")??"0px",n=(t,e)=>t?.style({transform:`translate(calc((100% + ${o}) * ${this.transformIndex+e}))`});n(s,0),(0!==t||this.itemList.size>2&&this.loop())&&n(e,-1),(t!==this.itemList.size-1||this.itemList.size>2&&this.loop())&&n(i,1)}switch(t){const e=this.$content?.node,s=this.$container?.node;if(!e||!s)return;const i=z.arrayFrom(this.itemList);if(!(i.length<=1)){if("next"===t){if(this.index+1>=i.length){if(!this.loop())return;this.index=0}else this.index++;i.length<=2&&0===this.index?this.transformIndex=0:this.transformIndex++}else{if(this.index-1<0){if(!this.loop())return;this.index=i.length-1}else this.index--;this.transformIndex--}this.jump(!0)}}jumpTo(t){const e=this.$content?.node;if(!e)return;const s=z.arrayFrom(this.itemList);t>=s.length||(this.index=t<0?s.length+t:t,this.jump())}jump(t=!1){this.setItemsStyle(this.index);const e=this.targetItems(this.index);z.forEach(this.itemList,t=>t.visible=!1),z.forEach(e,t=>t&&(t.visible=!0)),this.toDOM(),t&&this.animateTo(this.transformIndex),this.$targetItem=e[1]??z.Null,this.dispatch("carousel_switch",[this],{bubbles:!0}),this.$targetItem?.dispatch("carousel_target",[],{bubbles:!0}),this.stop(),this.autoplay()&&this.play()}animateTo(t){const e=this.$content?.node;if(!e)return;this.inDOM()&&(this.animation?.commitStyles(),this.animation?.cancel());const s=e.computedStyleMap().get("transform")?.toString(),i=this.attr("gap")??"0px";this.animation=e.animate({transform:[s??"",`translateX( calc((-100% - ${i}) * ${t}) )`]},{duration:500,easing:"ease",fill:"both"})}touchHandler(){this.on("pointerdown",t=>{if("mouse"===t.pointerType)return;this.pause(),this.animation?.commitStyles(),this.animation?.cancel();let e={x:0,y:0},s={x:0};const i=t=>{e={x:e.x+t.movementX,y:e.y+t.movementY},s={x:t.movementX,y:t.movementY};const i=this.$content?.node;if(!i)return;const o=function(t){if(!t||"none"===t)return{x:0,y:0,scaleX:1,scaleY:1,angle:0};const e=t.split("(")[1].split(")")[0].split(",").map(Number),[s,i,o,n,r,a]=e;return{x:r,y:a,scaleX:Math.sqrt(s*s+i*i),scaleY:Math.sqrt(o*o+n*n),angle:Math.round(Math.atan2(i,s)*(180/Math.PI))}}(window.getComputedStyle(i).transform);i.style.transform=`translate(${o.x+t.movementX}px)`},o=t=>{n(),this.autoplay()&&this.play();const i=e.x<-100||s.x<-10,o=e.x>100||s.x>10;if(!this.loop()){if(0===this.index&&o)return this.animateTo(this.transformIndex);if(this.index===this.itemList.size-1&&i)return this.animateTo(this.transformIndex)}if(1===this.itemList.size)return this.animateTo(this.transformIndex);!i||2===this.itemList.size&&1===this.index?!o||2===this.itemList.size&&0===this.index?this.animateTo(this.transformIndex):this.switch("prev"):this.switch("next")},n=()=>{this.off("pointermove",i),this.off("pointerup",o),this.off("pointercancel",o)};this.on("pointermove",i),this.on("pointerup",o),this.on("pointercancel",o)})}};h=new WeakMap,u=new WeakMap,d=new WeakMap,b(rs,"tagname","carousel"),$.style(rs,S(rs.tagname,{display:"block",position:"relative",touchAction:"pan-y","html:not([touch]) &:not([nopage]):hover":{"button.carousel-prev, button.carousel-next":{visibility:"visible"}}}));let as=rs;const cs=class t extends w{$carousel=z.Null;constructor(e,s){super(t.tagname,e,s)}build(t){return super.build(t),this.$carousel=this.findAbove(t=>z.isInstanceof(t,as)),this.$carousel&&(this.$carousel.$container=this),this}};b(cs,"tagname","carousel-container"),$.style(cs,S(cs.tagname,{display:"block",height:"100%",overflow:"hidden",position:"relative",margin:"auto"}));let ls=cs;const hs=class t extends w{$carousel=z.Null;virtual=!0;constructor(e,s){super(t.tagname,e,s)}build(t){if(super.build(t),this.$carousel=this.findAbove(t=>z.isInstanceof(t,as)),this.$carousel){this.$carousel.$content=this;const t=z.arrayFrom(this.$carousel.itemList).at(this.$carousel.index);t&&(this.$carousel.$targetItem=t,t.visible=!0)}return this.nopage(),this}mutate(){super.mutate(),this.$carousel?.itemList.clear(),z.forEach(this.children,(t,e)=>{e===this.$carousel?.index&&(this.$carousel.$targetItem=t,t.visible=!0),this.$carousel?.itemList.add(t)}),this.nopage()}nopage(){this.$carousel&&this.$carousel.attr("nopage",this.$carousel.itemList.size<=1?"":z.Null)}};b(hs,"tagname","carousel-content"),$.style(hs,S(hs.tagname,{display:"grid",height:"100%",gridTemplateColumns:"1fr",gridTemplateRows:"1fr",willChange:"transfrom"}));let us=hs;const ds=class t extends w{$carousel=z.Null;visible=!1;constructor(e,s){super(t.tagname,e,s)}build(t){return super.build(t),this.$carousel=this.findAbove(t=>z.isInstanceof(t,as)),this.$carousel&&this.$carousel.itemList.add(this),this}};b(ds,"tagname","carousel-item"),$.style(ds,S(ds.tagname,{position:"relative",height:"100%",width:"100%",flexShrink:"0",gridArea:"1 / 1 / 2 / 2",willChange:"transfrom",overflow:"hidden"}));let ps=ds;const gs=class extends St{$carousel=z.Null;constructor(t,e){super(t,e),this.on("click",()=>this.$carousel?.switch("next")),this.addClass("carousel-next")}build(t){return super.build(t),this.$carousel=this.findAbove(t=>z.isInstanceof(t,as)),this.checkDisabled(),this.$carousel?.listen("carousel_switch",()=>this.checkDisabled()),this}checkDisabled(){!this.$carousel?.loop()&&this.$carousel.index>=this.$carousel.itemList.size-1?this.attr("disabled",""):this.attr("disabled",z.Null)}};$.style(gs,S("button.carousel-next",{position:"absolute",inset:"0",width:"calc(var(--spacing) * 8)",marginBlock:"auto",marginInline:"auto 1rem",visibility:"hidden"}));let bs=gs;const ms=class extends St{$carousel=z.Null;constructor(t,e){super(t,e),this.on("click",()=>this.$carousel?.switch("prev")),this.addClass("carousel-prev")}build(t){return super.build(t),this.$carousel=this.findAbove(t=>z.isInstanceof(t,as)),this.checkDisabled(),this.$carousel?.listen("carousel_switch",()=>this.checkDisabled()),this}checkDisabled(){this.$carousel?.loop()||0!==this.$carousel?.index?this.attr("disabled",z.Null):this.attr("disabled","")}};$.style(ms,S("button.carousel-prev",{position:"absolute",inset:"0",width:"calc(var(--spacing) * 8)",marginBlock:"auto",marginInline:"1rem auto",visibility:"hidden"}));let vs=ms;const fs=class t extends w{$value=z.Null;constructor(e,s){super(t.tagname,e,()=>{$(ys),s?.(this)})}props({value:t,...e}){super.props(e),this.value(t)}value(t){if(!arguments.length)return Number(this.attr("value"));z.isUndefined(t)||$.resolve(t,t=>{this.attr("value",`${t}`),this.$value?.style({translate:`-${Math.min(Math.max(100-t,0),100)}% 0`})})}};b(fs,"tagname","progress-bar"),$.style(fs,S(fs.tagname,{display:"block",height:"var(--spacing)",background:"color-mix(in srgb, var(--input), transparent 30%)",borderRadius:"var(--radius)",overflow:"hidden"}));let $s=fs;const xs=class t extends w{$progress=z.Null;constructor(e){super(t.tagname,e)}build(t){return super.build(t),this.$progress=this.findAbove(t=>z.is(t,$s)),this.$progress&&(this.$progress.$value=this,this.$progress.value(this.$progress.value())),this}};b(xs,"tagname","progress-value"),$.style(xs,S(xs.tagname,{display:"block",height:"var(--spacing)",background:"var(--primary-bg)",borderRadius:"var(--radius)",transition:"all .3s ease"}));let ys=xs;export{P as Accordion,G as AccordionContainer,J as AccordionContent,K as AccordionTrigger,Ot as Badge,St as Button,Wt as Card,Lt as CardContent,jt as CardDescription,Ft as CardFooter,Tt as CardHeader,_t as CardTitle,as as Carousel,ls as CarouselContainer,us as CarouselContent,ps as CarouselItem,bs as CarouselNext,vs as CarouselPrev,Me as Combobox,He as ComboboxChip,Be as ComboboxChipRemoveButton,Re as ComboboxChips,Oe as ComboboxContent,Ie as ComboboxCreateItem,We as ComboboxEmpty,Se as ComboboxInput,ke as ComboboxItem,xe as ComboboxList,De as ComboboxTrigger,ns as Container,te as ContextMenu,se as ContextMenuContent,oe as ContextMenuItem,Pt as DescriptionContent,Qt as DescriptionDetail,qt as DescriptionList,Jt as DescriptionTerm,le as Field,pe as FieldDescription,be as FieldError,ue as FieldLabel,Nt as Icon,ae as Input,U as Label,$s as Progress,F as Radio,H as RadioGroup,B as RadioItem,qe as Searchbar,Je as SearchbarContent,Pe as SearchbarInput,Ze as SearchbarItem,Ke as SearchbarList,$t as Select,zt as SelectArrow,dt as SelectContent,wt as SelectGroup,bt as SelectItem,yt as SelectTrigger,kt as SelectValue,E as Slide,R as Slideshow,ve as Switch,lt as TabContent,nt as TabTrigger,it as Tabs,at as TabsContainer,es as TextArea,is as TextBlock,Fe as Toast,$e as Toggle,Z as Waterfall,et as WaterfallItem,C as slideInOut};
|