@tempots/beatui 0.63.0 → 0.65.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.
@@ -3,7 +3,7 @@ import { f as ae } from "./colors-pQZlNrwM.js";
3
3
  import { g as le } from "./timer-DzWb416P.js";
4
4
  import { ElementRect as Zt, AutoSelect as oe } from "@tempots/ui";
5
5
  import { a as W, b as O, f as Et, I as U, C as H, c as ce, d as kt, T as ie, g as ue, L as pe, e as Rt, h as de, B as vt } from "./translations-BUTBIDsS.js";
6
- import { C as mt, m as fe, d as me, I as Yt, E as he, P as ge, S as ct, s as be, e as xt, O as rt, f as Ut } from "./notice-DUpqtjgC.js";
6
+ import { C as mt, m as fe, d as me, I as Yt, E as he, P as ge, S as ct, s as be, e as xt, O as rt, f as Ut } from "./notice-CTONCH2t.js";
7
7
  function Xt(t) {
8
8
  if (typeof t != "string") return !1;
9
9
  const e = t.startsWith("#") ? t.slice(1) : t;
@@ -1 +1 @@
1
- "use strict";const t=require("@tempots/dom"),Ht=require("./colors-B9fcMxa_.cjs"),jt=require("./timer-DK_yKNwE.cjs"),at=require("@tempots/ui"),y=require("./translations-hMQlZmD4.cjs"),F=require("./notice-CDDmL_KD.cjs");function rt(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function ft(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,l,u]=r,s=parseInt(a,10),c=parseInt(l,10),o=parseInt(u,10);return s>=0&&s<=255&&c>=0&&c<=255&&o>=0&&o<=255}function ht(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,l,u,s]=r,c=parseInt(a,10),o=parseInt(l,10),i=parseInt(u,10),p=parseFloat(s);return c>=0&&c<=255&&o>=0&&o<=255&&i>=0&&i<=255&&p>=0&&p<=1}function gt(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,l,u]=r,s=parseInt(a,10),c=parseInt(l,10),o=parseInt(u,10);return s>=0&&s<=360&&c>=0&&c<=100&&o>=0&&o<=100}function Zt(e){return rt(e)||ft(e)||ht(e)||gt(e)}function bt(e){if(!rt(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(r=>r+r).join("")),`#${n.toLowerCase()}`}function G(e,n,r){const a=l=>{const u=Math.round(Math.max(0,Math.min(255,l))).toString(16);return u.length===1?"0"+u:u};return`#${a(e)}${a(n)}${a(r)}`}function z(e){const n=bt(e);if(!n)return null;const r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function qt(e,n){const r=z(e),a=z(n);if(!r||!a)return null;const l=(i,p,f)=>{const[g,d,x]=[i,p,f].map(V=>(V=V/255,V<=.03928?V/12.92:Math.pow((V+.055)/1.055,2.4)));return .2126*g+.7152*d+.0722*x},u=l(r.r,r.g,r.b),s=l(a.r,a.g,a.b),c=Math.max(u,s),o=Math.min(u,s);return(c+.05)/(o+.05)}function vt(e){if(!e)return[0,0,0,1];const r=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(r){const i=r[1];if(i.length===8){const p=parseInt(i.slice(0,2),16),f=parseInt(i.slice(2,4),16),g=parseInt(i.slice(4,6),16),d=parseInt(i.slice(6,8),16)/255;return[p,f,g,d]}if(i.length===6)return[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),1];if(i.length===4){const p=parseInt(i[0]+i[0],16),f=parseInt(i[1]+i[1],16),g=parseInt(i[2]+i[2],16),d=parseInt(i[3]+i[3],16)/255;return[p,f,g,d]}if(i.length===3){const p=parseInt(i[0]+i[0],16),f=parseInt(i[1]+i[1],16),g=parseInt(i[2]+i[2],16);return[p,f,g,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const l=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(l)return[parseInt(l[1],10),parseInt(l[2],10),parseInt(l[3],10),1];const u=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(u){const i=parseFloat(u[1]),p=parseFloat(u[2]),f=parseFloat(u[3]),g=u[4]!=null?parseFloat(u[4]):1,[d,x,V]=lt(i,p/100,f/100);return[d,x,V,g]}const s=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const i=parseFloat(s[1]),p=parseFloat(s[2])/100,f=parseFloat(s[3])/100,g=s[4]!=null?parseFloat(s[4]):1,[d,x,V]=Vt(i,p,f);return[d,x,V,g]}const c=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(c){const i=c[1],p=parseFloat(c[2]),f=parseFloat(c[3]),g=c[4]!=null?parseFloat(c[4]):1,d=i.endsWith("%")?Math.max(0,Math.min(1,parseFloat(i)/100)):Math.max(0,Math.min(1,parseFloat(i))),[x,V,I]=wt(d,p,f);return[x,V,I,g]}const o=z(e);return o?[o.r,o.g,o.b,1]:[0,0,0,1]}function xt(e,n,r,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function It(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function lt(e,n,r){e=(e%360+360)%360;const a=(1-Math.abs(2*r-1))*n,l=a*(1-Math.abs(e/60%2-1)),u=r-a/2;let s=0,c=0,o=0;return 0<=e&&e<60?[s,c,o]=[a,l,0]:60<=e&&e<120?[s,c,o]=[l,a,0]:120<=e&&e<180?[s,c,o]=[0,a,l]:180<=e&&e<240?[s,c,o]=[0,l,a]:240<=e&&e<300?[s,c,o]=[l,0,a]:[s,c,o]=[a,0,l],[Math.round((s+u)*255),Math.round((c+u)*255),Math.round((o+u)*255)]}function Vt(e,n,r){e=(e%360+360)%360;const a=n+r;a>1&&(n/=a,r/=a);const[l,u,s]=lt(e,1,.5).map(f=>f/255),c=1-n-r,o=l*c+n,i=u*c+n,p=s*c+n;return[Math.round(o*255),Math.round(i*255),Math.round(p*255)]}function Q(e,n,r){e/=255,n/=255,r/=255;const a=Math.max(e,n,r),l=Math.min(e,n,r);let u=0,s=0;const c=(a+l)/2,o=a-l;if(o!==0){switch(s=c>.5?o/(2-a-l):o/(a+l),a){case e:u=(n-r)/o+(n<r?6:0);break;case n:u=(r-e)/o+2;break;default:u=(e-n)/o+4}u*=60}return[Math.round(u),Math.round(s*100),Math.round(c*100)]}function yt(e,n,r){const[a]=Q(e,n,r),l=e/255,u=n/255,s=r/255,c=Math.min(l,u,s),o=1-Math.max(l,u,s);return[a,Math.round(c*100),Math.round(o*100)]}function q(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Y(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function wt(e,n,r){const a=r*Math.PI/180,l=Math.cos(a)*n,u=Math.sin(a)*n,s=e+.3963377774*l+.2158037573*u,c=e-.1055613458*l-.0638541728*u,o=e-.0894841775*l-1.291485548*u,i=s*s*s,p=c*c*c,f=o*o*o,g=4.0767416621*i-3.3077115913*p+.2309699292*f,d=-1.2684380046*i+2.6097574011*p-.3413193965*f,x=-.0041960863*i-.7034186147*p+1.707614701*f;return[Y(g),Y(d),Y(x)]}function Ct(e,n,r){const a=q(e),l=q(n),u=q(r),s=.4122214708*a+.5363325363*l+.0514459929*u,c=.2119034982*a+.6806995451*l+.1073969566*u,o=.0883024619*a+.2817188376*l+.6299787005*u,i=Math.cbrt(s),p=Math.cbrt(c),f=Math.cbrt(o),g=.2104542553*i+.793617785*p-.0040720468*f,d=1.9779984951*i-2.428592205*p+.4505937099*f,x=.0259040371*i+.7827717662*p-.808675766*f,V=Math.sqrt(d*d+x*x);let I=Math.atan2(x,d)*180/Math.PI;return I<0&&(I+=360),[g,V,I]}function R(e,n,r,a,l,u){switch(l){case"hex":if(u){const s=o=>o.toString(16).padStart(2,"0"),c=Math.max(0,Math.min(255,Math.round(a*255)));return`#${s(e)}${s(n)}${s(r)}${s(c)}`}return G(e,n,r);case"rgb":return`rgb(${e}, ${n}, ${r})`;case"rgba":return`rgba(${e}, ${n}, ${r}, ${Math.round(a*100)/100})`;case"hsl":{const[s,c,o]=Q(e,n,r);return`hsl(${s}, ${c}%, ${o}%)`}case"hsla":{const[s,c,o]=Q(e,n,r);return`hsla(${s}, ${c}%, ${o}%, ${Math.round(a*100)/100})`}case"hwb":{const[s,c,o]=yt(e,n,r);return a<1?`hwb(${s} ${c}% ${o}% / ${Math.round(a*100)/100})`:`hwb(${s} ${c}% ${o}%)`}case"oklch":{const[s,c,o]=Ct(e,n,r),i=(Math.round(s*1e3)/1e3).toFixed(3),p=(Math.round(c*1e3)/1e3).toFixed(3),f=(Math.round(o*10)/10).toFixed(1),g=Math.round(a*100)/100;return u||a<1?`oklch(${i} ${p} ${f} / ${g})`:`oklch(${i} ${p} ${f})`}}}function L(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}class Yt extends Error{constructor(n="Missing implementation"){super(n),this.name="MissingImplementationError"}}const Xt=e=>Gt(e).split("_").join(" "),Gt=e=>(e=e.replace(/::/g,"/"),e=e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2"),e=e.replace(/([a-z\d])([A-Z])/g,"$1_$2"),e=e.replace(/-/g,"_"),e.toLowerCase()),Qt=e=>e.substring(0,1).toUpperCase()+e.substring(1),Jt=e=>{if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u")return atob(e);throw new Yt("No implementation found for base64 decoding")};function X({onChange:e,value:n,accept:r="*/*",enableClick:a=!0,content:l,disabled:u=!1,allowMultiple:s}){return t.Use(y.BeatUII18n,c=>{const o=t.Value.deriveProp(n??[]),i=t.prop(!1),p=b=>{b.preventDefault(),b.stopPropagation(),i.value=!0},f=b=>{b.preventDefault(),b.stopPropagation(),(!b.currentTarget||!b.currentTarget.contains(b.relatedTarget))&&(i.value=!1)},g=b=>{b.preventDefault(),b.stopPropagation(),i.value=!1;const m=Array.from(b.dataTransfer?.files||[]);m.length>0&&(o.value=m,e(m,"dragdrop"))},d=b=>{t.Value.get(a)&&b.currentTarget.querySelector('input[type="file"]')?.click()};let x=null;const V=()=>{if(x==null)return;const b=Array.from(x.files??[]);b.length>0&&(o.value=b,e(b,"click")),x.value=""},I=b=>{t.Value.get(a)&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),d(b))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(a,b=>b?0:-1)),t.attr.style("position: relative;"),t.on.dragover(p),t.on.dragleave(f),t.on.drop(g),t.on.click(d),t.on.keydown(I),t.html.input(t.attr.type("file"),t.attr.disabled(u),t.attr.accept(r),t.attr.multiple(s),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(V),t.WithElement(b=>(x=b,o.on(m=>{const _=globalThis.DataTransfer;if(_!=null){const $=new _;m.forEach(k=>$.items.add(k)),b.files=$.files}}),t.Empty))),t.aria.label(t.bind(c.$.dropZoneInstructions)(a)),l({files:o,clear:()=>o.value=[],change:o.set}))})}function Kt(e,n){return e.length===n.length&&e.every((r,a)=>r===n[a])}function te(e,n){const r=["bc-segmented-input",`bc-segmented-input--size-${e}`];return n&&r.push("bc-segmented-input--disabled"),r.join(" ")}function ee({options:e,value:n,onChange:r,size:a="md",disabled:l=!1},...u){const s=Ht.f(e).map(([c,o])=>({key:c,label:o}));return t.WithElement(()=>{const c=Object.fromEntries(s.map((i,p)=>[i.key,p])),o=t.prop(s.map(()=>({left:0,width:0})),Kt);return t.html.div(t.attr.class(t.computedOf(a,l)((i,p)=>te(i??"md",p??!1))),t.html.div(t.attr.class("bc-segmented-input__container"),t.html.div(t.attr.class("bc-segmented-input__indicator"),t.style.width(t.computedOf(n,o)((i,p)=>{const{width:f}=p[c[i]??0];return`${f}px`})),t.style.left(t.computedOf(n,o)((i,p)=>{const{left:f}=p[c[i]??0];return`${f}px`}))),s.map(({label:i,key:p},f)=>t.html.button(t.attr.type("button"),t.on.click(g=>{g.preventDefault(),t.Value.get(l)||r?.(p)}),t.attr.disabled(l),t.attr.class("bc-segmented-input__segment"),t.attr.class(t.Value.map(n,g=>g===p?"bc-segmented-input__segment--active":"bc-segmented-input__segment--inactive")),at.ElementRect(g=>{function d(){o.update(V=>{const I=[...V];return I[f]={width:g.value.width,left:g.value.localLeft},I})}const x=jt.g(d);return t.OnDispose(x,g.on(d))}),i))),...u)})}function ne(e){const n=e.type.toLowerCase();return n.startsWith("image/")&&(n.includes("jpeg")||n.includes("jpg")||n.includes("png")||n.includes("gif")||n.includes("webp")||n.includes("svg"))}function ae(e){const n=e.type.toLowerCase();return n.startsWith("image/")?"vscode-icons:file-type-image":n.startsWith("video/")?"vscode-icons:file-type-video":n.startsWith("audio/")?"vscode-icons:file-type-audio":n.includes("pdf")?"vscode-icons:file-type-pdf2":n.includes("word")||n.includes("document")?"vscode-icons:file-type-word":n.includes("excel")||n.includes("spreadsheet")?"vscode-icons:file-type-excel":n.includes("powerpoint")||n.includes("presentation")?"vscode-icons:file-type-powerpoint":n.includes("zip")||n.includes("archive")?"vscode-icons:file-type-zip":n.includes("text")?"vscode-icons:file-type-text":n.includes("json")?"vscode-icons:file-type-json-official":n.includes("csv")?"vscode-icons:file-type-csv":n.includes("xml")?"vscode-icons:file-type-xml":n.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function tt(e){return t.When(e.map(ne),()=>{const n=t.prop(null);return e.on(r=>{n.value&&URL.revokeObjectURL(n.value);const a=URL.createObjectURL(r);n.value=a}),t.html.div(t.OnDispose(()=>{n.value&&URL.revokeObjectURL(n.value)}),t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(n),t.attr.alt(e.map(r=>r.name)),t.attr.class("bc-file-input__thumbnail")))},()=>y.Icon({icon:e.map(ae)}))}const _t=(e,...n)=>{const{value:r=t.prop([]),accept:a="*/*",maxFiles:l,maxFileSize:u,onChange:s,onBlur:c,disabled:o,hasError:i,mode:p="default",showFileList:f=!0,...g}=e,d=r,x=t.Value.map(p,v=>v==="input"),V=t.Value.map(p,v=>v==="compact"),I=v=>{let h=v;if(l!=null){const w=t.Value.get(l);h=h.slice(0,w)}if(u){const w=t.Value.get(u);h=h.filter(M=>M.size<=w)}s?.(h)},b=v=>{const w=d.value.filter((M,E)=>E!==v);s?.(w)},m=()=>{s?.([])},_=({files:v,clear:h,change:w})=>t.Use(y.BeatUII18n,M=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),y.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(M.$.filesInputInstructions)(l,u,M.$.fileSizeUnits.value))))),$=({files:v})=>t.Use(y.BeatUII18n,h=>t.html.div(t.attr.class("bc-file-input__compact-drop-zone"),t.When(v.map(w=>w.length>0),()=>t.html.div(t.attr.class("bc-file-input__compact-file-list"),t.ForEach(v,(w,M)=>{const E=M.index;return t.html.div(t.attr.class("bc-file-input__compact-file-item"),t.html.div(t.attr.class("bc-file-input__compact-file-icon"),tt(w)),t.html.div(t.attr.class("bc-file-input__compact-file-info"),t.html.div(t.attr.class("bc-file-input__compact-file-name"),t.attr.title(w.$.name),w.$.name),t.html.div(t.attr.class("bc-file-input__compact-file-meta"),t.computedOf(w.$.size,h.$.fileSizeUnits)((C,T)=>y.formatFileSize(C,{units:T}))," • ",t.computedOf(w.$.type,h.$.unknownType)((C,T)=>C||T))),F.CloseButton({size:"sm",label:h.$.removeFile,disabled:o,onClick:()=>b(E)},t.attr.class("bc-file-input__compact-remove-button")))})),()=>t.html.div(t.attr.class("bc-file-input__compact-placeholder"),y.Icon({icon:"mdi:cloud-upload-outline",size:"lg"}),t.html.div(t.attr.class("bc-file-input__compact-placeholder-text"),t.bind(h.$.filesInputInstructions)(l,u,h.$.fileSizeUnits.value)))))),k=({files:v})=>t.Use(y.BeatUII18n,h=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(v.map(w=>w.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(v,w=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),tt(w),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),w.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),y.Icon({icon:"mdi:cloud-upload-outline",size:"md"})," ",t.bind(h.$.filesInputInstructions)(l,u,h.$.fileSizeUnits.value)))));return t.Use(y.BeatUII18n,v=>y.InputContainer({baseContainer:t.Value.map(x,h=>!h),disabled:o,hasError:i,after:t.When(x,()=>t.When(d.map(({length:h})=>h>0),()=>F.CloseButton({size:"sm",label:v.$.clearAllFiles,disabled:o,onClick:m},t.attr.class("bc-file-input__compact-clear")))),...g,input:t.When(x,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--input"),X({value:d,accept:a,enableClick:!0,allowMultiple:t.Value.map(l??1/0,h=>h>1),disabled:o,onChange:I,content:k})),()=>t.When(V,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),X({value:d,accept:a,enableClick:!0,allowMultiple:t.Value.map(l??1/0,h=>h>1),disabled:o,onChange:I,content:$})),()=>t.html.div(t.attr.class("bc-file-input"),X({value:d,accept:a,enableClick:!0,allowMultiple:t.Value.map(l??1/0,h=>h>1),disabled:o,onChange:I,content:_}),t.When(f,()=>t.NotEmpty(d,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(d,(h,w)=>{const M=w.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),tt(h)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(h.$.name),h.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(h.$.size,v.$.fileSizeUnits)((E,C)=>y.formatFileSize(E,{units:C}))," • ",t.computedOf(h.$.type,v.$.unknownType)((E,C)=>E||C))),F.CloseButton({size:"sm",label:v.$.removeFile,disabled:o,onClick:()=>b(M)},t.attr.class("bc-file-input__remove-button")))})),t.When(d.map(({length:h})=>h>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(o),v.$.clearAllFiles,t.on.click(h=>{h.preventDefault(),h.stopPropagation(),m()}))))))))))},...n))};async function $t(e){return new Promise((n,r)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const l=a.result;n(l.split(",")[1])},a.onerror=l=>r(l)})}function re(e){return Promise.all(e.map($t))}function le(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function se(e){const n=Jt(e??""),r=n.length,a=new Uint8Array(r);for(let l=0;l<r;l++)a[l]=n.charCodeAt(l);return a}function kt(e){const{value:n,onChange:r,onInput:a,...l}=e,u=new Map,s=t.Value.toSignal(n).map(p=>p.map((f,g)=>{const d=u.get(f),x=se(f??""),V=d?.type||le(x),I=d?.name??`file-${g}`,b=x.buffer.slice(x.byteOffset,x.byteOffset+x.byteLength),m=new Blob([b],{type:V});return new File([m],I,{type:V})})),c=p=>f=>{p&&re(f).then(g=>{for(const[d,x]of g.entries())u.set(x,{name:f[d].name,type:f[d].type});p(g)})},o=c(r),i=c(a);return _t({...l,value:s,onChange:o,onInput:i})}function oe(e){const{value:n,onInput:r,onChange:a,...l}=e;return kt({...l,maxFiles:1,value:t.Value.map(n,u=>u==null?[]:[u]),onChange:u=>{a?.(u[0])},onInput:u=>{r?.(u[0])}})}function ue(e,n){const[r,a,l]=e,u=r<<16^a<<8^l,s=It(u),c=6+Math.floor(s()*5),o=.18+s()*.06,i=[];for(let d=0;d<c;d++){const x=d/c*Math.PI*2,V=n*(1+(s()*2-1)*o),I=Math.cos(x)*V,b=Math.sin(x)*V;i.push({x:I,y:b})}const p=(i[0].x+i[c-1].x)/2,f=(i[0].y+i[c-1].y)/2;let g=`M ${p.toFixed(3)} ${f.toFixed(3)}`;for(let d=0;d<c;d++){const x=i[d],V=i[(d+1)%c],I=(x.x+V.x)/2,b=(x.y+V.y)/2;g+=` Q ${x.x.toFixed(3)} ${x.y.toFixed(3)} ${I.toFixed(3)} ${b.toFixed(3)}`}return g+=" Z",g}const ce=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,displayValue:u,size:s,withAlpha:c}=e,o=t.Value.map(s??32,v=>v),i=t.Value.map(n,v=>vt(v??"#000000")),p=t.Value.map(i,([v,h,w])=>[v,h,w]),f=t.Value.map(i,([,,,v])=>v),g=t.prop(t.Value.get(f)??1),d=t.Value.map(c??!1,v=>v),x=t.Value.map(e.colorTextFormat??"rgb",v=>v),V=t.computedOf(p,g,x,d)(([v,h,w],M,E,C)=>R(v,h,w,M??1,L(E,C),C)),I=t.Value.map(e.colorTextFormat??"hex",v=>v),b=t.Value.map(o,v=>`${-v/2} ${-v/2} ${v} ${v}`),m=t.computedOf(p,o)((v,h)=>ue(v,h/2)),_=t.computedOf(p,g,d)(([v,h,w],M,E)=>E||M<1?xt(v,h,w,M):G(v,h,w)),$=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(d,v=>v?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(o)(v=>`min-width:${v+2}px;height:${v+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(b),t.svg.path(t.svgAttr.d(m),t.svgAttr.fill(_))),t.html.input(t.attr.type("color"),y.CommonInputAttributes(e),t.attr.value(t.Value.map(p,([v,h,w])=>G(v,h,w))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(v=>{const h=v.target.value;if(!a)return;const{r:w,g:M,b:E}=z(h)??{r:0,g:0,b:0},C=t.Value.get(g)??1,T=L(t.Value.get(I),t.Value.get(d)),S=R(w,M,E,C,T,t.Value.get(d));a(S)}):t.Empty,l!=null?t.on.input(v=>{const h=v.target.value;if(!l)return;const{r:w,g:M,b:E}=z(h)??{r:0,g:0,b:0},C=t.Value.get(g)??1,T=L(t.Value.get(I),t.Value.get(d)),S=R(w,M,E,C,T,t.Value.get(d));l(S)}):t.Empty)),k=t.When(d,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(g,v=>String(v??1))),t.attr.disabled(e.disabled),t.on.input(v=>{const h=parseFloat(v.target.value);g.set(h);const[w,M,E]=t.Value.get(p),C=L(t.Value.get(I),t.Value.get(d)),T=R(w,M,E,h,C,t.Value.get(d));l?.(T)}),t.on.change(v=>{const h=parseFloat(v.target.value);g.set(h);const[w,M,E]=t.Value.get(p),C=L(t.Value.get(I),t.Value.get(d)),T=R(w,M,E,h,C,t.Value.get(d));a?.(T)})));return y.InputContainer({baseContainer:!0,...e,growInput:!1,input:$,after:t.Fragment(t.When(u??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),V)),k,e.after)})},st="$$tts-exp-",Mt=(e,n)=>t.WithElement(r=>{const a=`${st}${e}`;return t.OnDispose(t.Value.on(n,l=>Reflect.set(r,a,l)))}),ie=(e,n)=>{const r=`${st}${e}`;return a=>{n(Reflect.get(a.target,r))}},Et=(e,n)=>{const r=`${st}${e}`;return a=>{const l=a.target,u=l.selectedIndex,s=l.options[u];n(Reflect.get(s,r))}};function pe(e,n,r){const a=["bc-card"];return e!=="default"&&a.push(`bc-card--${e}`),n!=="md"&&a.push(`bc-card--padding-${n}`),r!=="lg"&&a.push(`bc-card--rounded-${r}`),a.join(" ")}function de({variant:e="default",size:n="md",roundedness:r="lg"}={},...a){return t.html.div(t.attr.class(t.computedOf(e,n,r)((l,u,s)=>pe(l??"default",u??"md",s??"lg"))),...a)}function j(...e){return t.html.div(t.attr.class("bc-group"),...e)}const me=({startEditing:e,value:n,onChange:r,placeholder:a,disabled:l})=>{const u=t.Value.deriveProp(e??!1),s=t.prop(!1),c=t.Value.map(l??!1,o=>o);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(c,o=>o?"bc-editable-text--disabled":"")),t.aria.disabled(c),t.When(u,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),at.AutoSelect(),t.on.keydown(o=>{o.key==="Enter"?u.set(!1):o.key==="Escape"&&(s.set(!0),u.set(!1))}),t.on.blur(t.emitValue(o=>{if(u.set(!1),s.value){s.set(!1);return}r(o)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(c)||u.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,o=>o!=null&&o.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(c,o=>!o),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(y.BeatUII18n,o=>t.aria.label(o.$.editLabel)),t.on.click(()=>u.set(!0)),y.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Tt=(e,n,r)=>t.Ensure(e,a=>t.OneOfType(a,{value:l=>{const u=t.computedOf(l,r)((s,c)=>n(s.value,c));return t.html.option(t.attr.selected(u),Mt("value",l.$.value),l.$.label)},group:l=>t.html.optgroup(t.attr.label(l.$.group),t.ForEach(l.$.options,u=>Tt(u,n,r))),break:()=>t.html.hr()})),Ft=e=>{const{value:n,onBlur:r,onChange:a,options:l,unselectedLabel:u,equality:s=(i,p)=>i===p,after:c}=e;let o;return y.InputContainer({...e,after:t.Fragment(y.InputIcon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),c),input:t.html.select(t.WithElement(i=>{o=i;const p=new MutationObserver(f=>{const{removedNodes:g}=f[0];g.length>0&&(o.selectedIndex=0)});return p.observe(i,{childList:!0}),t.OnDispose(()=>p.disconnect())}),y.CommonInputAttributes(e),t.attr.class("bc-native-select bc-input"),t.Use(y.BeatUII18n,i=>t.html.option(t.attr.hidden("hidden"),t.coalesce(u,i.$.selectOne))),t.ForEach(l,i=>Tt(i,s,n)),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(Et("value",i=>a(i))):t.Empty)},t.on.click(()=>{o?.focus(),typeof o?.showPicker=="function"&&o.showPicker()}))};function At(e){const{controller:n,onChange:r,onBlur:a,...l}=e;return Ft({...l,value:n.signal,onChange:F.makeOnChangeHandler(n,r),onBlur:F.makeOnBlurHandler(n,a)})}function fe(e){return F.InputWrapper({...e,content:At(e)})}function St(e,n,r){const a=e.length.map(l=>l);return t.Fragment(t.Repeat(a,l=>{const u=e.item(l.index),s=[];return t.Fragment(t.OnDispose(()=>{s.forEach(c=>c())}),n({list:e,item:u,position:l,remove:()=>e.removeAt(l.index),move:c=>{switch(c){case"up":if(l.index===0)return;e.move(l.index,l.index-1);break;case"down":if(l.index===e.length.value-1)return;e.move(l.index,l.index+1);break;case"first":e.move(l.index,0);break;case"last":e.move(l.index,e.length.value-1)}},canMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(l.index>0);case"down":return e.length.map(i=>l.index<i-1)}})();return s.push(()=>o.dispose()),o},cannotMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(l.index===0);case"down":return e.length.map(i=>l.index===i-1)}})();return s.push(()=>o.dispose()),o}}))},r))}const it={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:e=>e.toUpperCase()},"*":{pattern:/^.$/}},he=e=>e instanceof RegExp;function Dt(e,n,r){if(e==null)return[];const a=r?{...it,...n}:n??it,l=(s,c)=>{const o=a[c];o?s.push({type:"pattern",name:c,...o}):s.push({type:"literal",char:c})},u=[];if(typeof e=="string"){for(const s of e)l(u,s);return u}for(const s of e)if(typeof s=="string")if(s.length<=1)l(u,s);else for(const c of s)l(u,c);else he(s)?u.push({type:"pattern",pattern:s}):typeof s=="object"&&s&&u.push(s);return u}function ge(e,n){return r=>{switch(e){case"digits":return/[0-9]/.test(r);case"letters":return/[A-Za-z]/.test(r);case"alphanumeric":return/[A-Za-z0-9]/.test(r);case"custom":return n?.(r)??!0;default:return!0}}}function pt(e,n,r,a,l,u){const s={raw:e,previousConformed:n,cursor:l??e.length,completed:!1},c=a.definitions??{},o=typeof r=="function"?r(e,s):r,i=Dt(o,c,a.useDefaultDefinitions??!0),p=ge(a.allowMode,a.allow),f=new Set;for(const C of i)C.type==="literal"&&f.add(C.char);if(a.prefix)for(const C of a.prefix)f.add(C);if(a.suffix)for(const C of a.suffix)f.add(C);const g=Array.from(e).filter(C=>p(C)&&!f.has(C));if(g.length===0)return{value:"",cursor:0,completed:!1};const d=[],x=[];let V=0,I=0,b=0,m=-1;for(const C of i){if(C.type==="literal"){d.push(C.char),x.push({kind:"literal",filled:!0});continue}I+=C.optional?0:1;const T=g[V];if(T==null)break;if(C.type==="any"){b++,d.push(C.transform?C.transform(T):T),x.push({kind:"slot",filled:!0}),m=x.length-1,V++;continue}if(C.type==="pattern")if(C.pattern.test(T)){b++;const S=C.transform?C.transform(T):T;d.push(S),x.push({kind:"slot",filled:!0}),m=x.length-1,V++}else{V++;continue}}const _=d.join(""),$=(a.prefix??"")+_+(a.suffix??"");let v=(a.prefix??"").length;if(m>=0){let C=m+1;if((u?.policy??"smart")!=="sticky")for(;C<x.length&&x[C].kind==="literal";)C++;v+=C}const h=a.completion?.mode==="min"?(a.completion.minChars??0)<=b:a.completion?.mode==="custom"?!!a.completion.isComplete?.($):I>0&&b>=I,w=a.pipe?.($,{...s,completed:h});let M,E=v;return w===!1?(M=n,E=n.length):typeof w=="string"?(M=w,E=w.length):typeof w=="object"&&w?(M=w.value,E=w.cursor??w.value.length):M=$,{value:M,cursor:E,completed:h}}function be(e,n){const r=n?.strategy??"none";return r==="custom"&&n?.unmask?n.unmask(e):r==="strip"?e.replace(/[^A-Za-z0-9]/g,""):e}const ot=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,onAccept:u,onComplete:s,mask:c,definitions:o,useDefaultDefinitions:i,extraLiterals:p,prefix:f,suffix:g,autofix:d,pipe:x,completion:V,unmask:I,allowMode:b,allow:m,placeholder:_,placeholderOptions:$}=e,k=t.computedOf(n,c,o,i,p,f,g,d,V,I,b,_,$)((h,w,M,E,C,T,S,P,H,N,B,Z,D)=>w?pt(h??"","",w,{definitions:M??{},useDefaultDefinitions:E??!0,extraLiterals:C??[],autofix:P??"none",completion:H??{mode:"mask"},pipe:x??(A=>A),unmask:N??{strategy:"none"},allowMode:B??"all",allow:m,prefix:T,suffix:S}).value:h??""),v=(h,w)=>{const M=h.value??"",E=t.Value.get(n)??"",C=c!=null?t.Value.get(c):null,T=o!=null?t.Value.get(o):void 0,S=i!=null?t.Value.get(i):void 0,P=p!=null?t.Value.get(p):void 0,H=d!=null?t.Value.get(d):void 0,N=V!=null?t.Value.get(V):void 0,B=I!=null?t.Value.get(I):void 0,Z=b!=null?t.Value.get(b):void 0,D=f!=null?t.Value.get(f):void 0,A=g!=null?t.Value.get(g):void 0,{value:O,cursor:K,completed:ut}=C?pt(M,E,C,{definitions:T??{},useDefaultDefinitions:S??!0,extraLiterals:P??[],autofix:H??"none",completion:N??{mode:"mask"},pipe:x??(Pt=>Pt),unmask:B??{strategy:"none"},allowMode:Z??"all",allow:m,prefix:D,suffix:A},h.selectionStart??M.length,e.cursor?t.Value.get(e.cursor):void 0):{value:M,cursor:M.length,completed:!0};if(O!==M){h.value=O;try{h.setSelectionRange(K,K)}catch{}}const ct=be(O,B);u?.({raw:ct,conformed:O,completed:ut,cursor:K}),w==="input"?l?.(O):(a?.(O),ut&&s?.({raw:ct,conformed:O}))};return t.Fragment(y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(k),t.attr.class("bc-input"),r!=null?t.on.blur(r):t.Empty,t.WithElement(h=>h instanceof HTMLInputElement?t.Fragment(t.on.input(()=>v(h,"input")),t.on.change(()=>v(h,"change")),t.on.keydown(w=>{if(w.key!=="Backspace"||!(e.cursor?t.Value.get(e.cursor)?.backspaceRubberBand??!0:!0))return;const E=h.selectionStart??0,C=h.selectionEnd??E;if(E!==C||E<=0)return;const T=h.value??"",S=c!=null?t.Value.get(c):null;if(!S)return;const P=o!=null?t.Value.get(o):void 0,H=i!=null?t.Value.get(i):!0,N=f!=null?t.Value.get(f):void 0,B=g!=null?t.Value.get(g):void 0,Z=Dt(typeof S=="function"?S(T,{raw:T,previousConformed:T,cursor:E,completed:!1}):S,P??{},H??!0),D=new Set;for(const A of Z)A.type==="literal"&&D.add(A.char);if(N)for(const A of N)D.add(A);if(B)for(const A of B)D.add(A);if(D.has(T[E-1])){let A=E-1;for(;A>=0&&D.has(T[A]);)A--;A>=0&&(w.preventDefault(),w.stopPropagation(),h.value=T.slice(0,A)+T.slice(A+1),v(h,"input"))}})):t.Empty))}))};function U(e,n,r){const a=t.Value.map(e,u=>u!=null),l=y.defaultMessages.clearValue;return t.Fragment(t.When(a,()=>t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(l),t.attr.title(l),t.attr.disabled(n??!1),y.Icon({icon:"mdi:close",size:"sm"}),t.on.click(u=>{u.stopPropagation(),r?.(null)}))))}const ve=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,after:u,disabled:s}=e,c=U(n,s,a??l);return y.InputContainer({...e,input:t.input.date(y.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,l!=null?t.on.input(t.emitValueAsNullableDate(l)):t.Empty),after:u!=null?t.Fragment(c,u):c})},xe=e=>{const n=e.getFullYear(),r=e.getMonth()+1,a=e.getDate(),l=e.getHours(),u=e.getMinutes(),s=e.getSeconds();return`${n}-${r.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${l.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`},Ie=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,after:u,disabled:s}=e,c=t.Value.map(n,i=>i!=null?xe(i):null),o=U(n,s,a??l);return y.InputContainer({...e,input:t.input["datetime-local"](y.CommonInputAttributes(e),t.attr.value(t.Value.map(c,i=>i??null)),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,l!=null?t.on.input(t.emitValueAsNullableDateTime(l)):t.Empty),after:u!=null?t.Fragment(o,u):o})},nt=e=>typeof e=="string"&&e.trim()===""?null:e,Ut=e=>e??"";function W(e){return n=>{const{value:r,onBlur:a,onChange:l,onInput:u,after:s,disabled:c,...o}=n,i=U(r,c,l??u);return e({...o,disabled:c,value:t.Value.map(r,Ut),onChange:l!=null?p=>l(nt(p)):void 0,onInput:u!=null?p=>u(nt(p)):void 0,onBlur:a,after:s!=null?t.Fragment(i,s):i})}}const Ve=W(F.EmailInput),ye=W(y.TextInput),we=W(F.PasswordInput),Bt=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,rows:u}=e;return y.InputContainer({baseContainer:!0,...e,input:t.html.textarea(t.attr.class(t.computedOf(e.size??"md")(s=>y.generateInputContainerInputClasses(!1,s??"md"))),y.CommonInputAttributes(e),t.attr.rows(u??3),t.attr.value(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,l!=null?t.on.input(t.emitValue(l)):t.Empty)})},Ce=W(Bt),_e=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c,after:o}=e,i=g=>{const d=a!=null?t.Value.get(a):void 0,x=l!=null?t.Value.get(l):void 0;return d!=null&&g<d?d:x!=null&&g>x?x:g},p=r!=null?t.Use(y.BeatUII18n,g=>{const d=t.computedOf(n,a)((b,m)=>m==null?!0:(b??0)>m),x=t.computedOf(n,l)((b,m)=>m==null?!0:(b??0)<m),V=b=>{const m=t.Value.get(n)??0,_=t.Value.get(r),$=b?.shiftKey?10:1,k=m-_*$,v=a!=null?t.Value.get(a):void 0;if(v!=null&&k<v)return;const h=i(k);h!==m&&s&&s(h)},I=b=>{const m=t.Value.get(n)??0,_=t.Value.get(r),$=b?.shiftKey?10:1,k=m+_*$,v=l!=null?t.Value.get(l):void 0;if(v!=null&&k>v)return;const h=i(k);h!==m&&s&&s(h)};return F.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(x,e.disabled??!1)((b,m)=>!b||m)),t.on.click(b=>I(b)),t.aria.label(g.$.incrementValue),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(d,e.disabled??!1)((b,m)=>!b||m)),t.on.click(b=>V(b)),t.aria.label(g.$.decrementValue),y.Icon({icon:"line-md:minus",size:"xs"})))}):null,f=o!=null&&p!=null?t.Fragment(p,o):o??p;return y.InputContainer({...e,input:t.input.number(a!=null?t.Fragment(t.attr.min(a),t.OnDispose(t.Value.on(a,g=>{g<t.Value.get(n)}))):t.Empty,l!=null?t.Fragment(t.attr.max(l),t.OnDispose(t.Value.on(l,g=>{g>t.Value.get(n)}))):t.Empty,y.CommonInputAttributes(e),t.attr.valueAsNumber(n),t.attr.step(r),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty,r!=null?t.on.wheel(g=>{g.preventDefault();const d=t.Value.get(n)??0,x=t.Value.get(r),V=g.shiftKey?10:1,I=g.deltaY<0?x*V:-x*V,b=i(d+I);b!==d&&s&&s(b)}):t.Empty),after:f})},dt=e=>{if(e==null||e==="")return null;const n=Number(e);return Number.isNaN(n)?null:n},$e=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c,after:o}=e,i=d=>{const x=a!=null?t.Value.get(a):void 0,V=l!=null?t.Value.get(l):void 0;return x!=null&&d<x?x:V!=null&&d>V?V:d},p=(()=>{if(r==null)return null;const d=t.computedOf(n,a)((m,_)=>{const $=m??0;return _==null?!0:$>_}),x=t.computedOf(n,l)((m,_)=>{const $=m??0;return _==null?!0:$<_}),V=m=>{const _=t.Value.get(n)??0,$=t.Value.get(r),k=m?.shiftKey?10:1,v=_-$*k,h=a!=null?t.Value.get(a):void 0;if(h!=null&&v<h)return;const w=i(v);w!==_&&s&&s(w)},I=m=>{const _=t.Value.get(n)??0,$=t.Value.get(r),k=m?.shiftKey?10:1,v=_+$*k,h=l!=null?t.Value.get(l):void 0;if(h!=null&&v>h)return;const w=i(v);w!==_&&s&&s(w)};return((m,_)=>F.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(x,e.disabled??!1)(($,k)=>!$||k)),t.on.click($=>I($)),t.aria.label(m),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(d,e.disabled??!1)(($,k)=>!$||k)),t.on.click($=>V($)),t.aria.label(_),y.Icon({icon:"line-md:minus",size:"xs"}))))(y.defaultMessages.incrementValue,y.defaultMessages.decrementValue)})(),f=U(n,e.disabled,s??c),g=o!=null&&p!=null?t.Fragment(p,f,o):o!=null?t.Fragment(f,o):p!=null?t.Fragment(p,f):f;return y.InputContainer({...e,input:t.input.number(a!=null?t.attr.min(a):t.Empty,l!=null?t.attr.max(l):t.Empty,y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,d=>d==null?"":String(d))),t.attr.step(r),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValue(d=>{const x=dt(d);s(x)})):t.Empty,c!=null?t.on.input(t.emitValue(d=>{const x=dt(d);c(x)})):t.Empty,r!=null?t.on.wheel(d=>{d.preventDefault();const x=t.Value.get(n)??0,V=t.Value.get(r),I=d.shiftKey?10:1,b=d.deltaY<0?V*I:-V*I,m=i(x+b);m!==x&&s&&s(m)}):t.Empty),after:g})},ke=({value:e,onChange:n,onInput:r,onBlur:a,offLabel:l,onLabel:u,disabled:s=!1,size:c="md",id:o,color:i="primary",tabIndex:p=0})=>{const f=o??F.sessionId("switch");function g(I,b){const m=["bc-switch",`bc-switch--size-${b}`,`bc-switch--${b}`];return I&&m.push("bc-switch--disabled"),m.join(" ")}function d(I){const b=I??"primary",m=new Map,_=y.backgroundValue(b,"solid","light"),$=y.backgroundValue(b,"solid","dark");return m.set("--switch-track-on-bg",_.backgroundColor),m.set("--switch-track-on-label",_.textColor),m.set("--switch-track-on-bg-dark",$.backgroundColor),m.set("--switch-track-on-label-dark",$.textColor),m.set("--switch-track-on-border-dark",y.borderColorValue(b,"dark")),Array.from(m.entries()).map(([k,v])=>`${k}: ${v}`).join("; ")}const x=()=>{t.Value.get(s)||(n?.(!t.Value.get(e)),r?.(!t.Value.get(e)))},V=I=>{t.Value.get(s)||(I.key===" "||I.key==="Enter")&&(I.preventDefault(),x())};return t.html.div(t.attr.class(t.computedOf(s??!1,c)((I,b)=>g(I??!1,b??"md"))),t.attr.style(t.computedOf(i)(I=>d(I))),t.attr.id(f),t.attr.role("switch"),t.attr.tabindex(t.computedOf(s??!1,p)((I,b)=>I?-1:b??0)),t.aria.checked(e),t.aria.disabled(s),t.on.click(x),t.on.keydown(V),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,I=>I?"bc-switch__track--on":"bc-switch__track--off")),l!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,I=>I?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),l):null,u!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,I=>I?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),u):null,at.ElementRect(I=>t.Use(y.Locale,({direction:b})=>t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,m=>m?"bc-switch__thumb--on":"bc-switch__thumb--off")),t.style.transform(t.computedOf(e,I,c,b)((m,{width:_},$,k)=>{const v=(()=>{switch($){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),h=k==="rtl"?`calc((var(--spacing-base) * ${v}) - ${_}px)`:`calc(${_}px - (var(--spacing-base) * ${v}))`;return m?`translateX(${h})`:"translateX(0)"})))))))},Ot=e=>{const n={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:a=>a.toLowerCase()};return ot({...e,mask:[n,n,n,n,n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,n,n,n,n,n,n,n,n],placeholder:e.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Me=W(Ot),Ee="line-md:star-alt-filled",Te="line-md:star-alt",Nt=e=>{const{value:n,onChange:r,disabled:a,max:l=5,fullColor:u="yellow",emptyColor:s="neutral",fullIcon:c=Ee,emptyIcon:o=Te,size:i="md",onBlur:p,rounding:f=1}=e,g=()=>{const m=t.Value.get(f);return m>0?m:1},d=m=>Math.min(Math.max(m,0),t.Value.get(l)),x=(m,_)=>{if(t.Value.get(a??!1))return;const k=m.currentTarget.getBoundingClientRect(),v=(m.clientX-k.left)/k.width,h=_-1+v,w=g(),M=Math.ceil(h/w)*w,E=d(M);r?.(E)},V=m=>{if(t.Value.get(a??!1))return;const _=g(),$=t.Value.get(n)??0;let k;switch(m.key){case"ArrowRight":case"ArrowUp":k=d($+_);break;case"ArrowLeft":case"ArrowDown":k=d($-_);break;case"Home":k=0;break;case"End":k=t.Value.get(l);break;default:return}m.preventDefault(),r?.(k)},I=t.Value.map(i,m=>`bc-icon--${m}`),b=({index:m,counter:_})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(I),y.Icon({icon:o,size:i,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(I),t.style.width(t.Value.map(n,$=>{const k=Math.floor($);return k>m?"100%":k<m?"0%":`${($-m)*100}%`})),y.Icon({icon:c,size:i,color:u,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit($=>x($,_),{preventDefault:!0,stopPropagation:!0})));return y.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(y.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,m=>m?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(l,m=>m??0)),t.aria.valuenow(t.Value.map(n,m=>m??0)),t.aria.valuetext(t.computedOf(n,l)((m,_)=>{const $=m??0,k=_??0;return`${String($)} / ${String(k)}`})),t.on.keydown(V),p!=null?t.on.blur(p):null,t.Repeat(l,b))})},Fe=e=>{const{value:n,onChange:r,onInput:a,onBlur:l,after:u,disabled:s,...c}=e,o=U(n,s,r??a);return Nt({...c,value:t.Value.map(n,i=>i??0),onChange:r,onInput:a,onBlur:l,after:u!=null?t.Fragment(o,u):o})},Ae=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c}=e;return y.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(l),t.attr.step(r),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty)})},Se=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c}=e,o=t.Value.map(n,p=>{if(p!=null)return p;const f=a!=null?t.Value.get(a):void 0;return typeof f=="number"?f:0}),i=U(n,e.disabled,s??c);return y.InputContainer({...e,focusableSelector:'input[type="range"]',after:i,input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(l),t.attr.step(r),t.attr.valueAsNumber(o),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(p=>{s(p)})):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(p=>{c(p)})):t.Empty)},t.Fragment())};let et=null;async function J(){const e=globalThis;return e.Temporal?e.Temporal:(et||(et=Promise.resolve().then(()=>require("./index.esm-DJRz9AE-.cjs")).then(n=>{const r=n.Temporal;return e.Temporal||(e.Temporal=r),r})),et)}const Rt=(e,n)=>n?t.Task(J,{then:e,pending:n.pending,error:n.error}):t.Task(J,e),De=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,Ue=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function Lt(e){return{mask:null,allowMode:"custom",allow:n=>/[0-9ptwdhms]/i.test(n),pipe:n=>{const r=n.toUpperCase();return r.length===0?r:!r.startsWith("P")||!De.test(r)?!1:r},completion:{mode:"custom",isComplete:n=>{const r=n.toUpperCase();if(!Ue.test(r))return!1;try{return e(r),!0}catch{return!1}}}}}const mt=(e,n)=>{if(e==null)return null;try{return e.Duration.from(n)}catch{return null}},Be=e=>{const{value:n,onChange:r,onInput:a,after:l,disabled:u,onBlur:s}=e,c=()=>{const p=U(n,u,r??a);return l!=null?t.Fragment(p,l):p},o=e.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return Rt(p=>ot({...e,value:t.Value.map(n,f=>f?.toString()??""),onChange:r?f=>r(f===""?null:p.Duration.from(f)):void 0,onInput:void 0,...Lt(p.Duration.from),placeholder:"P0DT0H0M0S",after:c()}),{pending:()=>{const p=f=>g=>{const x=g.currentTarget?.value??"";if(x===""){f(null);return}const V=globalThis.Temporal,I=mt(V,x);if(I!=null){f(I);return}J().then(b=>{const m=mt(b,x);m!=null&&f(m)}).catch(()=>{})};return y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,f=>f?.toString()??"")),t.attr.class("bc-input"),o,s!=null?t.on.blur(()=>s()):t.Empty,r!=null?t.on.change(p(r)):t.Empty,a!=null?t.on.input(p(a)):t.Empty),after:c()})}})},zt=e=>{const{value:n,onBlur:r,onChange:a,onInput:l}=e;return y.InputContainer({...e,input:t.input.url(y.CommonInputAttributes(e),t.attr.value(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,l!=null?t.on.input(t.emitValue(l)):t.Empty)})},Oe=W(zt),Wt=e=>{const{controller:n,element:r,separator:a,showMove:l=!0,showRemove:u=!0,showAdd:s=!0,createItem:c,addLabel:o,controlsLayout:i="aside",removeDisabled:p,addDisabled:f}=e,g=t.Value.toSignal(i).map(V=>V==="aside"),d=V=>{const I=t.When(l??!1,()=>t.html.div(t.attr.class("bc-group--align-center"),t.attr.class(g.map(m=>m?"bc-group--direction-column bc-group--gap-1":"bc-group--direction-row bc-group--gap-1")),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>V.move("up"),disabled:V.cannotMove("up")},t.Use(y.BeatUII18n,m=>y.Icon({size:"xs",icon:"line-md:arrow-up",title:m.$.incrementValue}))),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>V.move("down"),disabled:V.cannotMove("down")},t.Use(y.BeatUII18n,m=>y.Icon({size:"xs",icon:"line-md:arrow-down",title:m.$.decrementValue}))))),b=t.When(u,()=>t.Use(y.BeatUII18n,m=>F.CloseButton({size:"xs",label:t.Value.map(m.$.removeItem,_=>_.toLowerCase()),color:"danger",disabled:p,onClick:V.remove})));return m=>t.When(g,()=>j(t.attr.class("bc-group--gap-1 bc-group--align-center"),F.Stack(t.attr.class("bc-stack--grow"),m),F.Stack(t.attr.class("bc-stack--align-center"),t.When(n.signal.map(_=>_.length>1),()=>I),b)),()=>F.Stack(t.attr.class("bc-stack--gap-2"),m,j(t.attr.class("bc-group--gap-2 bc-group--justify-between"),t.When(n.signal.map(_=>_.length>1),()=>I,()=>t.html.div()),b)))},x=t.When(t.computedOf(s,c)((V,I)=>V&&I!=null),()=>j(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),y.Button({size:"sm",variant:"filled",onClick:()=>n.push(c()),disabled:t.computedOf(n.disabled,f??!1)((V,I)=>V||I)},t.Use(y.BeatUII18n,V=>j(t.attr.class("bc-group--gap-2"),y.Icon({icon:"line-md:plus"}),o??V.$.addLabel)))));return t.Fragment(St(n,V=>d(V)(r(V)),a),x)},Ne=(e,...n)=>{const{controller:r,element:a,separator:l,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:p,removeDisabled:f,addDisabled:g,...d}=e;return F.InputWrapper({...d,content:Wt({controller:r,element:a,separator:l,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:p,removeDisabled:f,addDisabled:g})},...n)};class Re extends F.Controller{branches;activeBranch;#e;#t=new Map;constructor(n,r,a,l,u,s,c=F.O){super(n,r,a,l,u,c),this.branches=s;const o=p=>{for(const f of s)if(f.detect(p))return f.key;return s[0]?.key??"unknown"};this.activeBranch=a.map(o,F.O);const i=p=>{if(this.#t.has(p))return this.#t.get(p);const f=s.find(d=>d.key===p);if(!f)throw new Error(`Unknown branch: ${p}`);const g=new F.Controller([...n,p],d=>{this.change(d)},this.signal.map(d=>f.detect(d)?d:f.defaultValue(),c),l.map(F.makeMapValidation([p])),{disabled:this.disabled,validationMode:this.parent.validationMode},c);return this.#t.set(p,g),g};this.#e=this.activeBranch.map(p=>i(p),F.O),this.onDispose(()=>{for(const p of this.#t.values())p.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(n){const r=this.branches.find(l=>l.key===n);if(!r)throw new Error(`Unknown branch: ${n}`);if(this.#t.has(n))return this.#t.get(n);const a=new F.Controller([...this.path,n],l=>{this.change(l)},this.signal.map(l=>r.detect(l)?l:r.defaultValue(),F.O),this.status.map(F.makeMapValidation([n])),{disabled:this.disabled,validationMode:this.parent.validationMode},F.O);return this.#t.set(n,a),a}switchToBranch(n,r=!1){const a=this.branches.find(s=>s.key===n);if(!a)throw new Error(`Unknown branch: ${n}`);const l=t.Value.get(this.signal);if(a.detect(l))return!0;if(a.convert){const s=a.convert(l);if(s.ok)return this.change(s.value),!0}if(r&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm("Changing type will clear the current value. Continue?"))return!1;const u=a.defaultValue();return this.change(u),!0}get activeBranchDefinition(){const n=t.Value.get(this.activeBranch);return this.branches.find(r=>r.key===n)}}function Le(e){return e.transform(n=>n??null,n=>n??void 0)}function ze(e){return e.transform(n=>n??"",n=>n===""?void 0:n)}function We(e){return e.transform(n=>n??void 0,n=>n??null)}exports.Base64Input=oe;exports.Base64sInput=kt;exports.BaseListControl=Wt;exports.BaseNativeSelectControl=At;exports.Card=de;exports.ColorSwatchInput=ce;exports.EditableText=me;exports.Expando=Mt;exports.FilesInput=_t;exports.Group=j;exports.ListControl=Ne;exports.ListInput=St;exports.MaskInput=ot;exports.NativeSelect=Ft;exports.NativeSelectControl=fe;exports.NullableDateInput=ve;exports.NullableDateTimeInput=Ie;exports.NullableDurationInput=Be;exports.NullableEmailInput=Ve;exports.NullableNumberInput=$e;exports.NullablePasswordInput=we;exports.NullableRatingInput=Fe;exports.NullableResetAfter=U;exports.NullableSliderInput=Se;exports.NullableTextArea=Ce;exports.NullableTextInput=ye;exports.NullableUUIDInput=Me;exports.NullableUrlInput=Oe;exports.NumberInput=_e;exports.RatingInput=Nt;exports.SegmentedInput=ee;exports.SliderInput=Ae;exports.Switch=ke;exports.TextArea=Bt;exports.UUIDInput=Ot;exports.UnionController=Re;exports.UnstyledDropZone=X;exports.UrlInput=zt;exports.WithTemporal=Rt;exports._t=Qt;exports.durationMaskConfig=Lt;exports.emitExpando=ie;exports.emitOptionExpando=Et;exports.emptyToNull=nt;exports.ensureTemporal=J;exports.fileToBase64=$t;exports.formatColor=R;exports.getContrastRatio=qt;exports.gt=Xt;exports.hexToRgb=z;exports.hslToRgb=lt;exports.hwbToRgb=Vt;exports.isValidColor=Zt;exports.isValidHexColor=rt;exports.isValidHslColor=gt;exports.isValidRgbColor=ft;exports.isValidRgbaColor=ht;exports.linearToSrgb=Y;exports.mulberry32=It;exports.normalizeHexColor=bt;exports.nullToEmpty=Ut;exports.oklchToRgb=wt;exports.parseAnyColor=vt;exports.resolveEffectiveFormat=L;exports.rgbToHex=G;exports.rgbToHsl=Q;exports.rgbToHwb=yt;exports.rgbToOklch=Ct;exports.srgbToLinear=q;exports.toRgbaString=xt;exports.transformEmptyStringToUndefined=ze;exports.transformNullToUndefined=Le;exports.transformUndefinedToNull=We;
1
+ "use strict";const t=require("@tempots/dom"),Ht=require("./colors-B9fcMxa_.cjs"),jt=require("./timer-DK_yKNwE.cjs"),at=require("@tempots/ui"),y=require("./translations-hMQlZmD4.cjs"),F=require("./notice-BuSRMaZb.cjs");function rt(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function ft(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,l,u]=r,s=parseInt(a,10),c=parseInt(l,10),o=parseInt(u,10);return s>=0&&s<=255&&c>=0&&c<=255&&o>=0&&o<=255}function ht(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,l,u,s]=r,c=parseInt(a,10),o=parseInt(l,10),i=parseInt(u,10),p=parseFloat(s);return c>=0&&c<=255&&o>=0&&o<=255&&i>=0&&i<=255&&p>=0&&p<=1}function gt(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,l,u]=r,s=parseInt(a,10),c=parseInt(l,10),o=parseInt(u,10);return s>=0&&s<=360&&c>=0&&c<=100&&o>=0&&o<=100}function Zt(e){return rt(e)||ft(e)||ht(e)||gt(e)}function bt(e){if(!rt(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(r=>r+r).join("")),`#${n.toLowerCase()}`}function G(e,n,r){const a=l=>{const u=Math.round(Math.max(0,Math.min(255,l))).toString(16);return u.length===1?"0"+u:u};return`#${a(e)}${a(n)}${a(r)}`}function z(e){const n=bt(e);if(!n)return null;const r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function qt(e,n){const r=z(e),a=z(n);if(!r||!a)return null;const l=(i,p,f)=>{const[g,d,x]=[i,p,f].map(V=>(V=V/255,V<=.03928?V/12.92:Math.pow((V+.055)/1.055,2.4)));return .2126*g+.7152*d+.0722*x},u=l(r.r,r.g,r.b),s=l(a.r,a.g,a.b),c=Math.max(u,s),o=Math.min(u,s);return(c+.05)/(o+.05)}function vt(e){if(!e)return[0,0,0,1];const r=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(r){const i=r[1];if(i.length===8){const p=parseInt(i.slice(0,2),16),f=parseInt(i.slice(2,4),16),g=parseInt(i.slice(4,6),16),d=parseInt(i.slice(6,8),16)/255;return[p,f,g,d]}if(i.length===6)return[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),1];if(i.length===4){const p=parseInt(i[0]+i[0],16),f=parseInt(i[1]+i[1],16),g=parseInt(i[2]+i[2],16),d=parseInt(i[3]+i[3],16)/255;return[p,f,g,d]}if(i.length===3){const p=parseInt(i[0]+i[0],16),f=parseInt(i[1]+i[1],16),g=parseInt(i[2]+i[2],16);return[p,f,g,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const l=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(l)return[parseInt(l[1],10),parseInt(l[2],10),parseInt(l[3],10),1];const u=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(u){const i=parseFloat(u[1]),p=parseFloat(u[2]),f=parseFloat(u[3]),g=u[4]!=null?parseFloat(u[4]):1,[d,x,V]=lt(i,p/100,f/100);return[d,x,V,g]}const s=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const i=parseFloat(s[1]),p=parseFloat(s[2])/100,f=parseFloat(s[3])/100,g=s[4]!=null?parseFloat(s[4]):1,[d,x,V]=Vt(i,p,f);return[d,x,V,g]}const c=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(c){const i=c[1],p=parseFloat(c[2]),f=parseFloat(c[3]),g=c[4]!=null?parseFloat(c[4]):1,d=i.endsWith("%")?Math.max(0,Math.min(1,parseFloat(i)/100)):Math.max(0,Math.min(1,parseFloat(i))),[x,V,I]=wt(d,p,f);return[x,V,I,g]}const o=z(e);return o?[o.r,o.g,o.b,1]:[0,0,0,1]}function xt(e,n,r,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function It(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function lt(e,n,r){e=(e%360+360)%360;const a=(1-Math.abs(2*r-1))*n,l=a*(1-Math.abs(e/60%2-1)),u=r-a/2;let s=0,c=0,o=0;return 0<=e&&e<60?[s,c,o]=[a,l,0]:60<=e&&e<120?[s,c,o]=[l,a,0]:120<=e&&e<180?[s,c,o]=[0,a,l]:180<=e&&e<240?[s,c,o]=[0,l,a]:240<=e&&e<300?[s,c,o]=[l,0,a]:[s,c,o]=[a,0,l],[Math.round((s+u)*255),Math.round((c+u)*255),Math.round((o+u)*255)]}function Vt(e,n,r){e=(e%360+360)%360;const a=n+r;a>1&&(n/=a,r/=a);const[l,u,s]=lt(e,1,.5).map(f=>f/255),c=1-n-r,o=l*c+n,i=u*c+n,p=s*c+n;return[Math.round(o*255),Math.round(i*255),Math.round(p*255)]}function Q(e,n,r){e/=255,n/=255,r/=255;const a=Math.max(e,n,r),l=Math.min(e,n,r);let u=0,s=0;const c=(a+l)/2,o=a-l;if(o!==0){switch(s=c>.5?o/(2-a-l):o/(a+l),a){case e:u=(n-r)/o+(n<r?6:0);break;case n:u=(r-e)/o+2;break;default:u=(e-n)/o+4}u*=60}return[Math.round(u),Math.round(s*100),Math.round(c*100)]}function yt(e,n,r){const[a]=Q(e,n,r),l=e/255,u=n/255,s=r/255,c=Math.min(l,u,s),o=1-Math.max(l,u,s);return[a,Math.round(c*100),Math.round(o*100)]}function q(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Y(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function wt(e,n,r){const a=r*Math.PI/180,l=Math.cos(a)*n,u=Math.sin(a)*n,s=e+.3963377774*l+.2158037573*u,c=e-.1055613458*l-.0638541728*u,o=e-.0894841775*l-1.291485548*u,i=s*s*s,p=c*c*c,f=o*o*o,g=4.0767416621*i-3.3077115913*p+.2309699292*f,d=-1.2684380046*i+2.6097574011*p-.3413193965*f,x=-.0041960863*i-.7034186147*p+1.707614701*f;return[Y(g),Y(d),Y(x)]}function Ct(e,n,r){const a=q(e),l=q(n),u=q(r),s=.4122214708*a+.5363325363*l+.0514459929*u,c=.2119034982*a+.6806995451*l+.1073969566*u,o=.0883024619*a+.2817188376*l+.6299787005*u,i=Math.cbrt(s),p=Math.cbrt(c),f=Math.cbrt(o),g=.2104542553*i+.793617785*p-.0040720468*f,d=1.9779984951*i-2.428592205*p+.4505937099*f,x=.0259040371*i+.7827717662*p-.808675766*f,V=Math.sqrt(d*d+x*x);let I=Math.atan2(x,d)*180/Math.PI;return I<0&&(I+=360),[g,V,I]}function R(e,n,r,a,l,u){switch(l){case"hex":if(u){const s=o=>o.toString(16).padStart(2,"0"),c=Math.max(0,Math.min(255,Math.round(a*255)));return`#${s(e)}${s(n)}${s(r)}${s(c)}`}return G(e,n,r);case"rgb":return`rgb(${e}, ${n}, ${r})`;case"rgba":return`rgba(${e}, ${n}, ${r}, ${Math.round(a*100)/100})`;case"hsl":{const[s,c,o]=Q(e,n,r);return`hsl(${s}, ${c}%, ${o}%)`}case"hsla":{const[s,c,o]=Q(e,n,r);return`hsla(${s}, ${c}%, ${o}%, ${Math.round(a*100)/100})`}case"hwb":{const[s,c,o]=yt(e,n,r);return a<1?`hwb(${s} ${c}% ${o}% / ${Math.round(a*100)/100})`:`hwb(${s} ${c}% ${o}%)`}case"oklch":{const[s,c,o]=Ct(e,n,r),i=(Math.round(s*1e3)/1e3).toFixed(3),p=(Math.round(c*1e3)/1e3).toFixed(3),f=(Math.round(o*10)/10).toFixed(1),g=Math.round(a*100)/100;return u||a<1?`oklch(${i} ${p} ${f} / ${g})`:`oklch(${i} ${p} ${f})`}}}function L(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}class Yt extends Error{constructor(n="Missing implementation"){super(n),this.name="MissingImplementationError"}}const Xt=e=>Gt(e).split("_").join(" "),Gt=e=>(e=e.replace(/::/g,"/"),e=e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2"),e=e.replace(/([a-z\d])([A-Z])/g,"$1_$2"),e=e.replace(/-/g,"_"),e.toLowerCase()),Qt=e=>e.substring(0,1).toUpperCase()+e.substring(1),Jt=e=>{if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u")return atob(e);throw new Yt("No implementation found for base64 decoding")};function X({onChange:e,value:n,accept:r="*/*",enableClick:a=!0,content:l,disabled:u=!1,allowMultiple:s}){return t.Use(y.BeatUII18n,c=>{const o=t.Value.deriveProp(n??[]),i=t.prop(!1),p=b=>{b.preventDefault(),b.stopPropagation(),i.value=!0},f=b=>{b.preventDefault(),b.stopPropagation(),(!b.currentTarget||!b.currentTarget.contains(b.relatedTarget))&&(i.value=!1)},g=b=>{b.preventDefault(),b.stopPropagation(),i.value=!1;const m=Array.from(b.dataTransfer?.files||[]);m.length>0&&(o.value=m,e(m,"dragdrop"))},d=b=>{t.Value.get(a)&&b.currentTarget.querySelector('input[type="file"]')?.click()};let x=null;const V=()=>{if(x==null)return;const b=Array.from(x.files??[]);b.length>0&&(o.value=b,e(b,"click")),x.value=""},I=b=>{t.Value.get(a)&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),d(b))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(a,b=>b?0:-1)),t.attr.style("position: relative;"),t.on.dragover(p),t.on.dragleave(f),t.on.drop(g),t.on.click(d),t.on.keydown(I),t.html.input(t.attr.type("file"),t.attr.disabled(u),t.attr.accept(r),t.attr.multiple(s),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(V),t.WithElement(b=>(x=b,o.on(m=>{const _=globalThis.DataTransfer;if(_!=null){const $=new _;m.forEach(k=>$.items.add(k)),b.files=$.files}}),t.Empty))),t.aria.label(t.bind(c.$.dropZoneInstructions)(a)),l({files:o,clear:()=>o.value=[],change:o.set}))})}function Kt(e,n){return e.length===n.length&&e.every((r,a)=>r===n[a])}function te(e,n){const r=["bc-segmented-input",`bc-segmented-input--size-${e}`];return n&&r.push("bc-segmented-input--disabled"),r.join(" ")}function ee({options:e,value:n,onChange:r,size:a="md",disabled:l=!1},...u){const s=Ht.f(e).map(([c,o])=>({key:c,label:o}));return t.WithElement(()=>{const c=Object.fromEntries(s.map((i,p)=>[i.key,p])),o=t.prop(s.map(()=>({left:0,width:0})),Kt);return t.html.div(t.attr.class(t.computedOf(a,l)((i,p)=>te(i??"md",p??!1))),t.html.div(t.attr.class("bc-segmented-input__container"),t.html.div(t.attr.class("bc-segmented-input__indicator"),t.style.width(t.computedOf(n,o)((i,p)=>{const{width:f}=p[c[i]??0];return`${f}px`})),t.style.left(t.computedOf(n,o)((i,p)=>{const{left:f}=p[c[i]??0];return`${f}px`}))),s.map(({label:i,key:p},f)=>t.html.button(t.attr.type("button"),t.on.click(g=>{g.preventDefault(),t.Value.get(l)||r?.(p)}),t.attr.disabled(l),t.attr.class("bc-segmented-input__segment"),t.attr.class(t.Value.map(n,g=>g===p?"bc-segmented-input__segment--active":"bc-segmented-input__segment--inactive")),at.ElementRect(g=>{function d(){o.update(V=>{const I=[...V];return I[f]={width:g.value.width,left:g.value.localLeft},I})}const x=jt.g(d);return t.OnDispose(x,g.on(d))}),i))),...u)})}function ne(e){const n=e.type.toLowerCase();return n.startsWith("image/")&&(n.includes("jpeg")||n.includes("jpg")||n.includes("png")||n.includes("gif")||n.includes("webp")||n.includes("svg"))}function ae(e){const n=e.type.toLowerCase();return n.startsWith("image/")?"vscode-icons:file-type-image":n.startsWith("video/")?"vscode-icons:file-type-video":n.startsWith("audio/")?"vscode-icons:file-type-audio":n.includes("pdf")?"vscode-icons:file-type-pdf2":n.includes("word")||n.includes("document")?"vscode-icons:file-type-word":n.includes("excel")||n.includes("spreadsheet")?"vscode-icons:file-type-excel":n.includes("powerpoint")||n.includes("presentation")?"vscode-icons:file-type-powerpoint":n.includes("zip")||n.includes("archive")?"vscode-icons:file-type-zip":n.includes("text")?"vscode-icons:file-type-text":n.includes("json")?"vscode-icons:file-type-json-official":n.includes("csv")?"vscode-icons:file-type-csv":n.includes("xml")?"vscode-icons:file-type-xml":n.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function tt(e){return t.When(e.map(ne),()=>{const n=t.prop(null);return e.on(r=>{n.value&&URL.revokeObjectURL(n.value);const a=URL.createObjectURL(r);n.value=a}),t.html.div(t.OnDispose(()=>{n.value&&URL.revokeObjectURL(n.value)}),t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(n),t.attr.alt(e.map(r=>r.name)),t.attr.class("bc-file-input__thumbnail")))},()=>y.Icon({icon:e.map(ae)}))}const _t=(e,...n)=>{const{value:r=t.prop([]),accept:a="*/*",maxFiles:l,maxFileSize:u,onChange:s,onBlur:c,disabled:o,hasError:i,mode:p="default",showFileList:f=!0,...g}=e,d=r,x=t.Value.map(p,v=>v==="input"),V=t.Value.map(p,v=>v==="compact"),I=v=>{let h=v;if(l!=null){const w=t.Value.get(l);h=h.slice(0,w)}if(u){const w=t.Value.get(u);h=h.filter(M=>M.size<=w)}s?.(h)},b=v=>{const w=d.value.filter((M,E)=>E!==v);s?.(w)},m=()=>{s?.([])},_=({files:v,clear:h,change:w})=>t.Use(y.BeatUII18n,M=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),y.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(M.$.filesInputInstructions)(l,u,M.$.fileSizeUnits.value))))),$=({files:v})=>t.Use(y.BeatUII18n,h=>t.html.div(t.attr.class("bc-file-input__compact-drop-zone"),t.When(v.map(w=>w.length>0),()=>t.html.div(t.attr.class("bc-file-input__compact-file-list"),t.ForEach(v,(w,M)=>{const E=M.index;return t.html.div(t.attr.class("bc-file-input__compact-file-item"),t.html.div(t.attr.class("bc-file-input__compact-file-icon"),tt(w)),t.html.div(t.attr.class("bc-file-input__compact-file-info"),t.html.div(t.attr.class("bc-file-input__compact-file-name"),t.attr.title(w.$.name),w.$.name),t.html.div(t.attr.class("bc-file-input__compact-file-meta"),t.computedOf(w.$.size,h.$.fileSizeUnits)((C,T)=>y.formatFileSize(C,{units:T}))," • ",t.computedOf(w.$.type,h.$.unknownType)((C,T)=>C||T))),F.CloseButton({size:"sm",label:h.$.removeFile,disabled:o,onClick:()=>b(E)},t.attr.class("bc-file-input__compact-remove-button")))})),()=>t.html.div(t.attr.class("bc-file-input__compact-placeholder"),y.Icon({icon:"mdi:cloud-upload-outline",size:"lg"}),t.html.div(t.attr.class("bc-file-input__compact-placeholder-text"),t.bind(h.$.filesInputInstructions)(l,u,h.$.fileSizeUnits.value)))))),k=({files:v})=>t.Use(y.BeatUII18n,h=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(v.map(w=>w.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(v,w=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),tt(w),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),w.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),y.Icon({icon:"mdi:cloud-upload-outline",size:"md"})," ",t.bind(h.$.filesInputInstructions)(l,u,h.$.fileSizeUnits.value)))));return t.Use(y.BeatUII18n,v=>y.InputContainer({baseContainer:t.Value.map(x,h=>!h),disabled:o,hasError:i,after:t.When(x,()=>t.When(d.map(({length:h})=>h>0),()=>F.CloseButton({size:"sm",label:v.$.clearAllFiles,disabled:o,onClick:m},t.attr.class("bc-file-input__compact-clear")))),...g,input:t.When(x,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--input"),X({value:d,accept:a,enableClick:!0,allowMultiple:t.Value.map(l??1/0,h=>h>1),disabled:o,onChange:I,content:k})),()=>t.When(V,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),X({value:d,accept:a,enableClick:!0,allowMultiple:t.Value.map(l??1/0,h=>h>1),disabled:o,onChange:I,content:$})),()=>t.html.div(t.attr.class("bc-file-input"),X({value:d,accept:a,enableClick:!0,allowMultiple:t.Value.map(l??1/0,h=>h>1),disabled:o,onChange:I,content:_}),t.When(f,()=>t.NotEmpty(d,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(d,(h,w)=>{const M=w.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),tt(h)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(h.$.name),h.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(h.$.size,v.$.fileSizeUnits)((E,C)=>y.formatFileSize(E,{units:C}))," • ",t.computedOf(h.$.type,v.$.unknownType)((E,C)=>E||C))),F.CloseButton({size:"sm",label:v.$.removeFile,disabled:o,onClick:()=>b(M)},t.attr.class("bc-file-input__remove-button")))})),t.When(d.map(({length:h})=>h>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(o),v.$.clearAllFiles,t.on.click(h=>{h.preventDefault(),h.stopPropagation(),m()}))))))))))},...n))};async function $t(e){return new Promise((n,r)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const l=a.result;n(l.split(",")[1])},a.onerror=l=>r(l)})}function re(e){return Promise.all(e.map($t))}function le(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function se(e){const n=Jt(e??""),r=n.length,a=new Uint8Array(r);for(let l=0;l<r;l++)a[l]=n.charCodeAt(l);return a}function kt(e){const{value:n,onChange:r,onInput:a,...l}=e,u=new Map,s=t.Value.toSignal(n).map(p=>p.map((f,g)=>{const d=u.get(f),x=se(f??""),V=d?.type||le(x),I=d?.name??`file-${g}`,b=x.buffer.slice(x.byteOffset,x.byteOffset+x.byteLength),m=new Blob([b],{type:V});return new File([m],I,{type:V})})),c=p=>f=>{p&&re(f).then(g=>{for(const[d,x]of g.entries())u.set(x,{name:f[d].name,type:f[d].type});p(g)})},o=c(r),i=c(a);return _t({...l,value:s,onChange:o,onInput:i})}function oe(e){const{value:n,onInput:r,onChange:a,...l}=e;return kt({...l,maxFiles:1,value:t.Value.map(n,u=>u==null?[]:[u]),onChange:u=>{a?.(u[0])},onInput:u=>{r?.(u[0])}})}function ue(e,n){const[r,a,l]=e,u=r<<16^a<<8^l,s=It(u),c=6+Math.floor(s()*5),o=.18+s()*.06,i=[];for(let d=0;d<c;d++){const x=d/c*Math.PI*2,V=n*(1+(s()*2-1)*o),I=Math.cos(x)*V,b=Math.sin(x)*V;i.push({x:I,y:b})}const p=(i[0].x+i[c-1].x)/2,f=(i[0].y+i[c-1].y)/2;let g=`M ${p.toFixed(3)} ${f.toFixed(3)}`;for(let d=0;d<c;d++){const x=i[d],V=i[(d+1)%c],I=(x.x+V.x)/2,b=(x.y+V.y)/2;g+=` Q ${x.x.toFixed(3)} ${x.y.toFixed(3)} ${I.toFixed(3)} ${b.toFixed(3)}`}return g+=" Z",g}const ce=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,displayValue:u,size:s,withAlpha:c}=e,o=t.Value.map(s??32,v=>v),i=t.Value.map(n,v=>vt(v??"#000000")),p=t.Value.map(i,([v,h,w])=>[v,h,w]),f=t.Value.map(i,([,,,v])=>v),g=t.prop(t.Value.get(f)??1),d=t.Value.map(c??!1,v=>v),x=t.Value.map(e.colorTextFormat??"rgb",v=>v),V=t.computedOf(p,g,x,d)(([v,h,w],M,E,C)=>R(v,h,w,M??1,L(E,C),C)),I=t.Value.map(e.colorTextFormat??"hex",v=>v),b=t.Value.map(o,v=>`${-v/2} ${-v/2} ${v} ${v}`),m=t.computedOf(p,o)((v,h)=>ue(v,h/2)),_=t.computedOf(p,g,d)(([v,h,w],M,E)=>E||M<1?xt(v,h,w,M):G(v,h,w)),$=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(d,v=>v?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(o)(v=>`min-width:${v+2}px;height:${v+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(b),t.svg.path(t.svgAttr.d(m),t.svgAttr.fill(_))),t.html.input(t.attr.type("color"),y.CommonInputAttributes(e),t.attr.value(t.Value.map(p,([v,h,w])=>G(v,h,w))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(v=>{const h=v.target.value;if(!a)return;const{r:w,g:M,b:E}=z(h)??{r:0,g:0,b:0},C=t.Value.get(g)??1,T=L(t.Value.get(I),t.Value.get(d)),S=R(w,M,E,C,T,t.Value.get(d));a(S)}):t.Empty,l!=null?t.on.input(v=>{const h=v.target.value;if(!l)return;const{r:w,g:M,b:E}=z(h)??{r:0,g:0,b:0},C=t.Value.get(g)??1,T=L(t.Value.get(I),t.Value.get(d)),S=R(w,M,E,C,T,t.Value.get(d));l(S)}):t.Empty)),k=t.When(d,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(g,v=>String(v??1))),t.attr.disabled(e.disabled),t.on.input(v=>{const h=parseFloat(v.target.value);g.set(h);const[w,M,E]=t.Value.get(p),C=L(t.Value.get(I),t.Value.get(d)),T=R(w,M,E,h,C,t.Value.get(d));l?.(T)}),t.on.change(v=>{const h=parseFloat(v.target.value);g.set(h);const[w,M,E]=t.Value.get(p),C=L(t.Value.get(I),t.Value.get(d)),T=R(w,M,E,h,C,t.Value.get(d));a?.(T)})));return y.InputContainer({baseContainer:!0,...e,growInput:!1,input:$,after:t.Fragment(t.When(u??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),V)),k,e.after)})},st="$$tts-exp-",Mt=(e,n)=>t.WithElement(r=>{const a=`${st}${e}`;return t.OnDispose(t.Value.on(n,l=>Reflect.set(r,a,l)))}),ie=(e,n)=>{const r=`${st}${e}`;return a=>{n(Reflect.get(a.target,r))}},Et=(e,n)=>{const r=`${st}${e}`;return a=>{const l=a.target,u=l.selectedIndex,s=l.options[u];n(Reflect.get(s,r))}};function pe(e,n,r){const a=["bc-card"];return e!=="default"&&a.push(`bc-card--${e}`),n!=="md"&&a.push(`bc-card--padding-${n}`),r!=="lg"&&a.push(`bc-card--rounded-${r}`),a.join(" ")}function de({variant:e="default",size:n="md",roundedness:r="lg"}={},...a){return t.html.div(t.attr.class(t.computedOf(e,n,r)((l,u,s)=>pe(l??"default",u??"md",s??"lg"))),...a)}function j(...e){return t.html.div(t.attr.class("bc-group"),...e)}const me=({startEditing:e,value:n,onChange:r,placeholder:a,disabled:l})=>{const u=t.Value.deriveProp(e??!1),s=t.prop(!1),c=t.Value.map(l??!1,o=>o);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(c,o=>o?"bc-editable-text--disabled":"")),t.aria.disabled(c),t.When(u,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),at.AutoSelect(),t.on.keydown(o=>{o.key==="Enter"?u.set(!1):o.key==="Escape"&&(s.set(!0),u.set(!1))}),t.on.blur(t.emitValue(o=>{if(u.set(!1),s.value){s.set(!1);return}r(o)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(c)||u.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,o=>o!=null&&o.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(c,o=>!o),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(y.BeatUII18n,o=>t.aria.label(o.$.editLabel)),t.on.click(()=>u.set(!0)),y.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Tt=(e,n,r)=>t.Ensure(e,a=>t.OneOfType(a,{value:l=>{const u=t.computedOf(l,r)((s,c)=>n(s.value,c));return t.html.option(t.attr.selected(u),Mt("value",l.$.value),l.$.label)},group:l=>t.html.optgroup(t.attr.label(l.$.group),t.ForEach(l.$.options,u=>Tt(u,n,r))),break:()=>t.html.hr()})),Ft=e=>{const{value:n,onBlur:r,onChange:a,options:l,unselectedLabel:u,equality:s=(i,p)=>i===p,after:c}=e;let o;return y.InputContainer({...e,after:t.Fragment(y.InputIcon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),c),input:t.html.select(t.WithElement(i=>{o=i;const p=new MutationObserver(f=>{const{removedNodes:g}=f[0];g.length>0&&(o.selectedIndex=0)});return p.observe(i,{childList:!0}),t.OnDispose(()=>p.disconnect())}),y.CommonInputAttributes(e),t.attr.class("bc-native-select bc-input"),t.Use(y.BeatUII18n,i=>t.html.option(t.attr.hidden("hidden"),t.coalesce(u,i.$.selectOne))),t.ForEach(l,i=>Tt(i,s,n)),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(Et("value",i=>a(i))):t.Empty)},t.on.click(()=>{o?.focus(),typeof o?.showPicker=="function"&&o.showPicker()}))};function At(e){const{controller:n,onChange:r,onBlur:a,...l}=e;return Ft({...l,value:n.signal,onChange:F.makeOnChangeHandler(n,r),onBlur:F.makeOnBlurHandler(n,a)})}function fe(e){return F.InputWrapper({...e,content:At(e)})}function St(e,n,r){const a=e.length.map(l=>l);return t.Fragment(t.Repeat(a,l=>{const u=e.item(l.index),s=[];return t.Fragment(t.OnDispose(()=>{s.forEach(c=>c())}),n({list:e,item:u,position:l,remove:()=>e.removeAt(l.index),move:c=>{switch(c){case"up":if(l.index===0)return;e.move(l.index,l.index-1);break;case"down":if(l.index===e.length.value-1)return;e.move(l.index,l.index+1);break;case"first":e.move(l.index,0);break;case"last":e.move(l.index,e.length.value-1)}},canMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(l.index>0);case"down":return e.length.map(i=>l.index<i-1)}})();return s.push(()=>o.dispose()),o},cannotMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(l.index===0);case"down":return e.length.map(i=>l.index===i-1)}})();return s.push(()=>o.dispose()),o}}))},r))}const it={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:e=>e.toUpperCase()},"*":{pattern:/^.$/}},he=e=>e instanceof RegExp;function Dt(e,n,r){if(e==null)return[];const a=r?{...it,...n}:n??it,l=(s,c)=>{const o=a[c];o?s.push({type:"pattern",name:c,...o}):s.push({type:"literal",char:c})},u=[];if(typeof e=="string"){for(const s of e)l(u,s);return u}for(const s of e)if(typeof s=="string")if(s.length<=1)l(u,s);else for(const c of s)l(u,c);else he(s)?u.push({type:"pattern",pattern:s}):typeof s=="object"&&s&&u.push(s);return u}function ge(e,n){return r=>{switch(e){case"digits":return/[0-9]/.test(r);case"letters":return/[A-Za-z]/.test(r);case"alphanumeric":return/[A-Za-z0-9]/.test(r);case"custom":return n?.(r)??!0;default:return!0}}}function pt(e,n,r,a,l,u){const s={raw:e,previousConformed:n,cursor:l??e.length,completed:!1},c=a.definitions??{},o=typeof r=="function"?r(e,s):r,i=Dt(o,c,a.useDefaultDefinitions??!0),p=ge(a.allowMode,a.allow),f=new Set;for(const C of i)C.type==="literal"&&f.add(C.char);if(a.prefix)for(const C of a.prefix)f.add(C);if(a.suffix)for(const C of a.suffix)f.add(C);const g=Array.from(e).filter(C=>p(C)&&!f.has(C));if(g.length===0)return{value:"",cursor:0,completed:!1};const d=[],x=[];let V=0,I=0,b=0,m=-1;for(const C of i){if(C.type==="literal"){d.push(C.char),x.push({kind:"literal",filled:!0});continue}I+=C.optional?0:1;const T=g[V];if(T==null)break;if(C.type==="any"){b++,d.push(C.transform?C.transform(T):T),x.push({kind:"slot",filled:!0}),m=x.length-1,V++;continue}if(C.type==="pattern")if(C.pattern.test(T)){b++;const S=C.transform?C.transform(T):T;d.push(S),x.push({kind:"slot",filled:!0}),m=x.length-1,V++}else{V++;continue}}const _=d.join(""),$=(a.prefix??"")+_+(a.suffix??"");let v=(a.prefix??"").length;if(m>=0){let C=m+1;if((u?.policy??"smart")!=="sticky")for(;C<x.length&&x[C].kind==="literal";)C++;v+=C}const h=a.completion?.mode==="min"?(a.completion.minChars??0)<=b:a.completion?.mode==="custom"?!!a.completion.isComplete?.($):I>0&&b>=I,w=a.pipe?.($,{...s,completed:h});let M,E=v;return w===!1?(M=n,E=n.length):typeof w=="string"?(M=w,E=w.length):typeof w=="object"&&w?(M=w.value,E=w.cursor??w.value.length):M=$,{value:M,cursor:E,completed:h}}function be(e,n){const r=n?.strategy??"none";return r==="custom"&&n?.unmask?n.unmask(e):r==="strip"?e.replace(/[^A-Za-z0-9]/g,""):e}const ot=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,onAccept:u,onComplete:s,mask:c,definitions:o,useDefaultDefinitions:i,extraLiterals:p,prefix:f,suffix:g,autofix:d,pipe:x,completion:V,unmask:I,allowMode:b,allow:m,placeholder:_,placeholderOptions:$}=e,k=t.computedOf(n,c,o,i,p,f,g,d,V,I,b,_,$)((h,w,M,E,C,T,S,P,H,N,B,Z,D)=>w?pt(h??"","",w,{definitions:M??{},useDefaultDefinitions:E??!0,extraLiterals:C??[],autofix:P??"none",completion:H??{mode:"mask"},pipe:x??(A=>A),unmask:N??{strategy:"none"},allowMode:B??"all",allow:m,prefix:T,suffix:S}).value:h??""),v=(h,w)=>{const M=h.value??"",E=t.Value.get(n)??"",C=c!=null?t.Value.get(c):null,T=o!=null?t.Value.get(o):void 0,S=i!=null?t.Value.get(i):void 0,P=p!=null?t.Value.get(p):void 0,H=d!=null?t.Value.get(d):void 0,N=V!=null?t.Value.get(V):void 0,B=I!=null?t.Value.get(I):void 0,Z=b!=null?t.Value.get(b):void 0,D=f!=null?t.Value.get(f):void 0,A=g!=null?t.Value.get(g):void 0,{value:O,cursor:K,completed:ut}=C?pt(M,E,C,{definitions:T??{},useDefaultDefinitions:S??!0,extraLiterals:P??[],autofix:H??"none",completion:N??{mode:"mask"},pipe:x??(Pt=>Pt),unmask:B??{strategy:"none"},allowMode:Z??"all",allow:m,prefix:D,suffix:A},h.selectionStart??M.length,e.cursor?t.Value.get(e.cursor):void 0):{value:M,cursor:M.length,completed:!0};if(O!==M){h.value=O;try{h.setSelectionRange(K,K)}catch{}}const ct=be(O,B);u?.({raw:ct,conformed:O,completed:ut,cursor:K}),w==="input"?l?.(O):(a?.(O),ut&&s?.({raw:ct,conformed:O}))};return t.Fragment(y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(k),t.attr.class("bc-input"),r!=null?t.on.blur(r):t.Empty,t.WithElement(h=>h instanceof HTMLInputElement?t.Fragment(t.on.input(()=>v(h,"input")),t.on.change(()=>v(h,"change")),t.on.keydown(w=>{if(w.key!=="Backspace"||!(e.cursor?t.Value.get(e.cursor)?.backspaceRubberBand??!0:!0))return;const E=h.selectionStart??0,C=h.selectionEnd??E;if(E!==C||E<=0)return;const T=h.value??"",S=c!=null?t.Value.get(c):null;if(!S)return;const P=o!=null?t.Value.get(o):void 0,H=i!=null?t.Value.get(i):!0,N=f!=null?t.Value.get(f):void 0,B=g!=null?t.Value.get(g):void 0,Z=Dt(typeof S=="function"?S(T,{raw:T,previousConformed:T,cursor:E,completed:!1}):S,P??{},H??!0),D=new Set;for(const A of Z)A.type==="literal"&&D.add(A.char);if(N)for(const A of N)D.add(A);if(B)for(const A of B)D.add(A);if(D.has(T[E-1])){let A=E-1;for(;A>=0&&D.has(T[A]);)A--;A>=0&&(w.preventDefault(),w.stopPropagation(),h.value=T.slice(0,A)+T.slice(A+1),v(h,"input"))}})):t.Empty))}))};function U(e,n,r){const a=t.Value.map(e,u=>u!=null),l=y.defaultMessages.clearValue;return t.Fragment(t.When(a,()=>t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(l),t.attr.title(l),t.attr.disabled(n??!1),y.Icon({icon:"mdi:close",size:"sm"}),t.on.click(u=>{u.stopPropagation(),r?.(null)}))))}const ve=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,after:u,disabled:s}=e,c=U(n,s,a??l);return y.InputContainer({...e,input:t.input.date(y.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,l!=null?t.on.input(t.emitValueAsNullableDate(l)):t.Empty),after:u!=null?t.Fragment(c,u):c})},xe=e=>{const n=e.getFullYear(),r=e.getMonth()+1,a=e.getDate(),l=e.getHours(),u=e.getMinutes(),s=e.getSeconds();return`${n}-${r.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${l.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`},Ie=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,after:u,disabled:s}=e,c=t.Value.map(n,i=>i!=null?xe(i):null),o=U(n,s,a??l);return y.InputContainer({...e,input:t.input["datetime-local"](y.CommonInputAttributes(e),t.attr.value(t.Value.map(c,i=>i??null)),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,l!=null?t.on.input(t.emitValueAsNullableDateTime(l)):t.Empty),after:u!=null?t.Fragment(o,u):o})},nt=e=>typeof e=="string"&&e.trim()===""?null:e,Ut=e=>e??"";function W(e){return n=>{const{value:r,onBlur:a,onChange:l,onInput:u,after:s,disabled:c,...o}=n,i=U(r,c,l??u);return e({...o,disabled:c,value:t.Value.map(r,Ut),onChange:l!=null?p=>l(nt(p)):void 0,onInput:u!=null?p=>u(nt(p)):void 0,onBlur:a,after:s!=null?t.Fragment(i,s):i})}}const Ve=W(F.EmailInput),ye=W(y.TextInput),we=W(F.PasswordInput),Bt=e=>{const{value:n,onBlur:r,onChange:a,onInput:l,rows:u}=e;return y.InputContainer({baseContainer:!0,...e,input:t.html.textarea(t.attr.class(t.computedOf(e.size??"md")(s=>y.generateInputContainerInputClasses(!1,s??"md"))),y.CommonInputAttributes(e),t.attr.rows(u??3),t.attr.value(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,l!=null?t.on.input(t.emitValue(l)):t.Empty)})},Ce=W(Bt),_e=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c,after:o}=e,i=g=>{const d=a!=null?t.Value.get(a):void 0,x=l!=null?t.Value.get(l):void 0;return d!=null&&g<d?d:x!=null&&g>x?x:g},p=r!=null?t.Use(y.BeatUII18n,g=>{const d=t.computedOf(n,a)((b,m)=>m==null?!0:(b??0)>m),x=t.computedOf(n,l)((b,m)=>m==null?!0:(b??0)<m),V=b=>{const m=t.Value.get(n)??0,_=t.Value.get(r),$=b?.shiftKey?10:1,k=m-_*$,v=a!=null?t.Value.get(a):void 0;if(v!=null&&k<v)return;const h=i(k);h!==m&&s&&s(h)},I=b=>{const m=t.Value.get(n)??0,_=t.Value.get(r),$=b?.shiftKey?10:1,k=m+_*$,v=l!=null?t.Value.get(l):void 0;if(v!=null&&k>v)return;const h=i(k);h!==m&&s&&s(h)};return F.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(x,e.disabled??!1)((b,m)=>!b||m)),t.on.click(b=>I(b)),t.aria.label(g.$.incrementValue),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(d,e.disabled??!1)((b,m)=>!b||m)),t.on.click(b=>V(b)),t.aria.label(g.$.decrementValue),y.Icon({icon:"line-md:minus",size:"xs"})))}):null,f=o!=null&&p!=null?t.Fragment(p,o):o??p;return y.InputContainer({...e,input:t.input.number(a!=null?t.Fragment(t.attr.min(a),t.OnDispose(t.Value.on(a,g=>{g<t.Value.get(n)}))):t.Empty,l!=null?t.Fragment(t.attr.max(l),t.OnDispose(t.Value.on(l,g=>{g>t.Value.get(n)}))):t.Empty,y.CommonInputAttributes(e),t.attr.valueAsNumber(n),t.attr.step(r),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty,r!=null?t.on.wheel(g=>{g.preventDefault();const d=t.Value.get(n)??0,x=t.Value.get(r),V=g.shiftKey?10:1,I=g.deltaY<0?x*V:-x*V,b=i(d+I);b!==d&&s&&s(b)}):t.Empty),after:f})},dt=e=>{if(e==null||e==="")return null;const n=Number(e);return Number.isNaN(n)?null:n},$e=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c,after:o}=e,i=d=>{const x=a!=null?t.Value.get(a):void 0,V=l!=null?t.Value.get(l):void 0;return x!=null&&d<x?x:V!=null&&d>V?V:d},p=(()=>{if(r==null)return null;const d=t.computedOf(n,a)((m,_)=>{const $=m??0;return _==null?!0:$>_}),x=t.computedOf(n,l)((m,_)=>{const $=m??0;return _==null?!0:$<_}),V=m=>{const _=t.Value.get(n)??0,$=t.Value.get(r),k=m?.shiftKey?10:1,v=_-$*k,h=a!=null?t.Value.get(a):void 0;if(h!=null&&v<h)return;const w=i(v);w!==_&&s&&s(w)},I=m=>{const _=t.Value.get(n)??0,$=t.Value.get(r),k=m?.shiftKey?10:1,v=_+$*k,h=l!=null?t.Value.get(l):void 0;if(h!=null&&v>h)return;const w=i(v);w!==_&&s&&s(w)};return((m,_)=>F.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(x,e.disabled??!1)(($,k)=>!$||k)),t.on.click($=>I($)),t.aria.label(m),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(d,e.disabled??!1)(($,k)=>!$||k)),t.on.click($=>V($)),t.aria.label(_),y.Icon({icon:"line-md:minus",size:"xs"}))))(y.defaultMessages.incrementValue,y.defaultMessages.decrementValue)})(),f=U(n,e.disabled,s??c),g=o!=null&&p!=null?t.Fragment(p,f,o):o!=null?t.Fragment(f,o):p!=null?t.Fragment(p,f):f;return y.InputContainer({...e,input:t.input.number(a!=null?t.attr.min(a):t.Empty,l!=null?t.attr.max(l):t.Empty,y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,d=>d==null?"":String(d))),t.attr.step(r),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValue(d=>{const x=dt(d);s(x)})):t.Empty,c!=null?t.on.input(t.emitValue(d=>{const x=dt(d);c(x)})):t.Empty,r!=null?t.on.wheel(d=>{d.preventDefault();const x=t.Value.get(n)??0,V=t.Value.get(r),I=d.shiftKey?10:1,b=d.deltaY<0?V*I:-V*I,m=i(x+b);m!==x&&s&&s(m)}):t.Empty),after:g})},ke=({value:e,onChange:n,onInput:r,onBlur:a,offLabel:l,onLabel:u,disabled:s=!1,size:c="md",id:o,color:i="primary",tabIndex:p=0})=>{const f=o??F.sessionId("switch");function g(I,b){const m=["bc-switch",`bc-switch--size-${b}`,`bc-switch--${b}`];return I&&m.push("bc-switch--disabled"),m.join(" ")}function d(I){const b=I??"primary",m=new Map,_=y.backgroundValue(b,"solid","light"),$=y.backgroundValue(b,"solid","dark");return m.set("--switch-track-on-bg",_.backgroundColor),m.set("--switch-track-on-label",_.textColor),m.set("--switch-track-on-bg-dark",$.backgroundColor),m.set("--switch-track-on-label-dark",$.textColor),m.set("--switch-track-on-border-dark",y.borderColorValue(b,"dark")),Array.from(m.entries()).map(([k,v])=>`${k}: ${v}`).join("; ")}const x=()=>{t.Value.get(s)||(n?.(!t.Value.get(e)),r?.(!t.Value.get(e)))},V=I=>{t.Value.get(s)||(I.key===" "||I.key==="Enter")&&(I.preventDefault(),x())};return t.html.div(t.attr.class(t.computedOf(s??!1,c)((I,b)=>g(I??!1,b??"md"))),t.attr.style(t.computedOf(i)(I=>d(I))),t.attr.id(f),t.attr.role("switch"),t.attr.tabindex(t.computedOf(s??!1,p)((I,b)=>I?-1:b??0)),t.aria.checked(e),t.aria.disabled(s),t.on.click(x),t.on.keydown(V),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,I=>I?"bc-switch__track--on":"bc-switch__track--off")),l!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,I=>I?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),l):null,u!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,I=>I?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),u):null,at.ElementRect(I=>t.Use(y.Locale,({direction:b})=>t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,m=>m?"bc-switch__thumb--on":"bc-switch__thumb--off")),t.style.transform(t.computedOf(e,I,c,b)((m,{width:_},$,k)=>{const v=(()=>{switch($){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),h=k==="rtl"?`calc((var(--spacing-base) * ${v}) - ${_}px)`:`calc(${_}px - (var(--spacing-base) * ${v}))`;return m?`translateX(${h})`:"translateX(0)"})))))))},Ot=e=>{const n={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:a=>a.toLowerCase()};return ot({...e,mask:[n,n,n,n,n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,n,n,n,n,n,n,n,n],placeholder:e.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Me=W(Ot),Ee="line-md:star-alt-filled",Te="line-md:star-alt",Nt=e=>{const{value:n,onChange:r,disabled:a,max:l=5,fullColor:u="yellow",emptyColor:s="neutral",fullIcon:c=Ee,emptyIcon:o=Te,size:i="md",onBlur:p,rounding:f=1}=e,g=()=>{const m=t.Value.get(f);return m>0?m:1},d=m=>Math.min(Math.max(m,0),t.Value.get(l)),x=(m,_)=>{if(t.Value.get(a??!1))return;const k=m.currentTarget.getBoundingClientRect(),v=(m.clientX-k.left)/k.width,h=_-1+v,w=g(),M=Math.ceil(h/w)*w,E=d(M);r?.(E)},V=m=>{if(t.Value.get(a??!1))return;const _=g(),$=t.Value.get(n)??0;let k;switch(m.key){case"ArrowRight":case"ArrowUp":k=d($+_);break;case"ArrowLeft":case"ArrowDown":k=d($-_);break;case"Home":k=0;break;case"End":k=t.Value.get(l);break;default:return}m.preventDefault(),r?.(k)},I=t.Value.map(i,m=>`bc-icon--${m}`),b=({index:m,counter:_})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(I),y.Icon({icon:o,size:i,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(I),t.style.width(t.Value.map(n,$=>{const k=Math.floor($);return k>m?"100%":k<m?"0%":`${($-m)*100}%`})),y.Icon({icon:c,size:i,color:u,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit($=>x($,_),{preventDefault:!0,stopPropagation:!0})));return y.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(y.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,m=>m?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(l,m=>m??0)),t.aria.valuenow(t.Value.map(n,m=>m??0)),t.aria.valuetext(t.computedOf(n,l)((m,_)=>{const $=m??0,k=_??0;return`${String($)} / ${String(k)}`})),t.on.keydown(V),p!=null?t.on.blur(p):null,t.Repeat(l,b))})},Fe=e=>{const{value:n,onChange:r,onInput:a,onBlur:l,after:u,disabled:s,...c}=e,o=U(n,s,r??a);return Nt({...c,value:t.Value.map(n,i=>i??0),onChange:r,onInput:a,onBlur:l,after:u!=null?t.Fragment(o,u):o})},Ae=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c}=e;return y.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(l),t.attr.step(r),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty)})},Se=e=>{const{value:n,step:r,min:a,max:l,onBlur:u,onChange:s,onInput:c}=e,o=t.Value.map(n,p=>{if(p!=null)return p;const f=a!=null?t.Value.get(a):void 0;return typeof f=="number"?f:0}),i=U(n,e.disabled,s??c);return y.InputContainer({...e,focusableSelector:'input[type="range"]',after:i,input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(l),t.attr.step(r),t.attr.valueAsNumber(o),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(p=>{s(p)})):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(p=>{c(p)})):t.Empty)},t.Fragment())};let et=null;async function J(){const e=globalThis;return e.Temporal?e.Temporal:(et||(et=Promise.resolve().then(()=>require("./index.esm-DJRz9AE-.cjs")).then(n=>{const r=n.Temporal;return e.Temporal||(e.Temporal=r),r})),et)}const Rt=(e,n)=>n?t.Task(J,{then:e,pending:n.pending,error:n.error}):t.Task(J,e),De=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,Ue=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function Lt(e){return{mask:null,allowMode:"custom",allow:n=>/[0-9ptwdhms]/i.test(n),pipe:n=>{const r=n.toUpperCase();return r.length===0?r:!r.startsWith("P")||!De.test(r)?!1:r},completion:{mode:"custom",isComplete:n=>{const r=n.toUpperCase();if(!Ue.test(r))return!1;try{return e(r),!0}catch{return!1}}}}}const mt=(e,n)=>{if(e==null)return null;try{return e.Duration.from(n)}catch{return null}},Be=e=>{const{value:n,onChange:r,onInput:a,after:l,disabled:u,onBlur:s}=e,c=()=>{const p=U(n,u,r??a);return l!=null?t.Fragment(p,l):p},o=e.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return Rt(p=>ot({...e,value:t.Value.map(n,f=>f?.toString()??""),onChange:r?f=>r(f===""?null:p.Duration.from(f)):void 0,onInput:void 0,...Lt(p.Duration.from),placeholder:"P0DT0H0M0S",after:c()}),{pending:()=>{const p=f=>g=>{const x=g.currentTarget?.value??"";if(x===""){f(null);return}const V=globalThis.Temporal,I=mt(V,x);if(I!=null){f(I);return}J().then(b=>{const m=mt(b,x);m!=null&&f(m)}).catch(()=>{})};return y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,f=>f?.toString()??"")),t.attr.class("bc-input"),o,s!=null?t.on.blur(()=>s()):t.Empty,r!=null?t.on.change(p(r)):t.Empty,a!=null?t.on.input(p(a)):t.Empty),after:c()})}})},zt=e=>{const{value:n,onBlur:r,onChange:a,onInput:l}=e;return y.InputContainer({...e,input:t.input.url(y.CommonInputAttributes(e),t.attr.value(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,l!=null?t.on.input(t.emitValue(l)):t.Empty)})},Oe=W(zt),Wt=e=>{const{controller:n,element:r,separator:a,showMove:l=!0,showRemove:u=!0,showAdd:s=!0,createItem:c,addLabel:o,controlsLayout:i="aside",removeDisabled:p,addDisabled:f}=e,g=t.Value.toSignal(i).map(V=>V==="aside"),d=V=>{const I=t.When(l??!1,()=>t.html.div(t.attr.class("bc-group--align-center"),t.attr.class(g.map(m=>m?"bc-group--direction-column bc-group--gap-1":"bc-group--direction-row bc-group--gap-1")),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>V.move("up"),disabled:V.cannotMove("up")},t.Use(y.BeatUII18n,m=>y.Icon({size:"xs",icon:"line-md:arrow-up",title:m.$.incrementValue}))),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>V.move("down"),disabled:V.cannotMove("down")},t.Use(y.BeatUII18n,m=>y.Icon({size:"xs",icon:"line-md:arrow-down",title:m.$.decrementValue}))))),b=t.When(u,()=>t.Use(y.BeatUII18n,m=>F.CloseButton({size:"xs",label:t.Value.map(m.$.removeItem,_=>_.toLowerCase()),color:"danger",disabled:p,onClick:V.remove})));return m=>t.When(g,()=>j(t.attr.class("bc-group--gap-1 bc-group--align-center"),F.Stack(t.attr.class("bc-stack--grow"),m),F.Stack(t.attr.class("bc-stack--align-center"),t.When(n.signal.map(_=>_.length>1),()=>I),b)),()=>F.Stack(t.attr.class("bc-stack--gap-2"),m,j(t.attr.class("bc-group--gap-2 bc-group--justify-between"),t.When(n.signal.map(_=>_.length>1),()=>I,()=>t.html.div()),b)))},x=t.When(t.computedOf(s,c)((V,I)=>V&&I!=null),()=>j(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),y.Button({size:"sm",variant:"filled",onClick:()=>n.push(c()),disabled:t.computedOf(n.disabled,f??!1)((V,I)=>V||I)},t.Use(y.BeatUII18n,V=>j(t.attr.class("bc-group--gap-2"),y.Icon({icon:"line-md:plus"}),o??V.$.addLabel)))));return t.Fragment(St(n,V=>d(V)(r(V)),a),x)},Ne=(e,...n)=>{const{controller:r,element:a,separator:l,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:p,removeDisabled:f,addDisabled:g,...d}=e;return F.InputWrapper({...d,content:Wt({controller:r,element:a,separator:l,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:p,removeDisabled:f,addDisabled:g})},...n)};class Re extends F.Controller{branches;activeBranch;#e;#t=new Map;constructor(n,r,a,l,u,s,c=F.O){super(n,r,a,l,u,c),this.branches=s;const o=p=>{for(const f of s)if(f.detect(p))return f.key;return s[0]?.key??"unknown"};this.activeBranch=a.map(o,F.O);const i=p=>{if(this.#t.has(p))return this.#t.get(p);const f=s.find(d=>d.key===p);if(!f)throw new Error(`Unknown branch: ${p}`);const g=new F.Controller([...n,p],d=>{this.change(d)},this.signal.map(d=>f.detect(d)?d:f.defaultValue(),c),l.map(F.makeMapValidation([p])),{disabled:this.disabled,validationMode:this.parent.validationMode},c);return this.#t.set(p,g),g};this.#e=this.activeBranch.map(p=>i(p),F.O),this.onDispose(()=>{for(const p of this.#t.values())p.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(n){const r=this.branches.find(l=>l.key===n);if(!r)throw new Error(`Unknown branch: ${n}`);if(this.#t.has(n))return this.#t.get(n);const a=new F.Controller([...this.path,n],l=>{this.change(l)},this.signal.map(l=>r.detect(l)?l:r.defaultValue(),F.O),this.status.map(F.makeMapValidation([n])),{disabled:this.disabled,validationMode:this.parent.validationMode},F.O);return this.#t.set(n,a),a}switchToBranch(n,r=!1){const a=this.branches.find(s=>s.key===n);if(!a)throw new Error(`Unknown branch: ${n}`);const l=t.Value.get(this.signal);if(a.detect(l))return!0;if(a.convert){const s=a.convert(l);if(s.ok)return this.change(s.value),!0}if(r&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm("Changing type will clear the current value. Continue?"))return!1;const u=a.defaultValue();return this.change(u),!0}get activeBranchDefinition(){const n=t.Value.get(this.activeBranch);return this.branches.find(r=>r.key===n)}}function Le(e){return e.transform(n=>n??null,n=>n??void 0)}function ze(e){return e.transform(n=>n??"",n=>n===""?void 0:n)}function We(e){return e.transform(n=>n??void 0,n=>n??null)}exports.Base64Input=oe;exports.Base64sInput=kt;exports.BaseListControl=Wt;exports.BaseNativeSelectControl=At;exports.Card=de;exports.ColorSwatchInput=ce;exports.EditableText=me;exports.Expando=Mt;exports.FilesInput=_t;exports.Group=j;exports.ListControl=Ne;exports.ListInput=St;exports.MaskInput=ot;exports.NativeSelect=Ft;exports.NativeSelectControl=fe;exports.NullableDateInput=ve;exports.NullableDateTimeInput=Ie;exports.NullableDurationInput=Be;exports.NullableEmailInput=Ve;exports.NullableNumberInput=$e;exports.NullablePasswordInput=we;exports.NullableRatingInput=Fe;exports.NullableResetAfter=U;exports.NullableSliderInput=Se;exports.NullableTextArea=Ce;exports.NullableTextInput=ye;exports.NullableUUIDInput=Me;exports.NullableUrlInput=Oe;exports.NumberInput=_e;exports.RatingInput=Nt;exports.SegmentedInput=ee;exports.SliderInput=Ae;exports.Switch=ke;exports.TextArea=Bt;exports.UUIDInput=Ot;exports.UnionController=Re;exports.UnstyledDropZone=X;exports.UrlInput=zt;exports.WithTemporal=Rt;exports._t=Qt;exports.durationMaskConfig=Lt;exports.emitExpando=ie;exports.emitOptionExpando=Et;exports.emptyToNull=nt;exports.ensureTemporal=J;exports.fileToBase64=$t;exports.formatColor=R;exports.getContrastRatio=qt;exports.gt=Xt;exports.hexToRgb=z;exports.hslToRgb=lt;exports.hwbToRgb=Vt;exports.isValidColor=Zt;exports.isValidHexColor=rt;exports.isValidHslColor=gt;exports.isValidRgbColor=ft;exports.isValidRgbaColor=ht;exports.linearToSrgb=Y;exports.mulberry32=It;exports.normalizeHexColor=bt;exports.nullToEmpty=Ut;exports.oklchToRgb=wt;exports.parseAnyColor=vt;exports.resolveEffectiveFormat=L;exports.rgbToHex=G;exports.rgbToHsl=Q;exports.rgbToHwb=yt;exports.rgbToOklch=Ct;exports.srgbToLinear=q;exports.toRgbaString=xt;exports.transformEmptyStringToUndefined=ze;exports.transformNullToUndefined=Le;exports.transformUndefinedToNull=We;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/beatui",
3
- "version": "0.63.0",
3
+ "version": "0.65.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -1,2 +0,0 @@
1
- "use strict";const s=require("@tempots/dom"),w=require("./translations-hMQlZmD4.cjs"),L=new Map;function D(e){const t=L.get(e)??0;return L.set(e,t+1),`${e}-${t}`}const v={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return v.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return v.isSuccess(e)?e.value:t()},getOrNull(e){return v.isSuccess(e)?e.value:null},getOrUndefined(e){return v.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(v.isSuccess(e))return e.value;throw v.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:r,notAsked:a=r})=>v.isSuccess(e)?t(e.value):v.isFailure(e)?n(e.error):v.isNotAsked(e)?a():r(e.previousValue),whenSuccess:(e,t)=>(v.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(v.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(v.isSuccess(n))t.push(n.value);else return n;return v.success(t)},ofPromise:async e=>{try{const t=await e;return v.success(t)}catch(t){return v.failure(t instanceof Error?t:new Error(String(t)))}}},O=(e,t)=>e===t||e!==e&&t!==t,S={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>S.isValid(e)?t():n(e.error),toResult:(e,t)=>S.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(S.isValid(e)&&t(),e),whenInvalid:(e,t)=>(S.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>v.success(t),t=>v.failure(t))},toValidation(e){return f.match(e,()=>S.valid,t=>S.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,r)=>f.match(e,a=>f.match(t,i=>f.success(n(a,i)),i=>f.failure(i)),a=>f.match(t,i=>f.failure(a),i=>f.failure(r(a,i)))),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function j({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:r="full",color:a="base",onClick:i,label:o},...l){return s.Use(w.BeatUII18n,c=>{const p=s.coalesce(o,c.$.closeModal);return w.Button({variant:"text",size:e,roundedness:r,disabled:n,color:a,onClick:i},s.attr.title(p),s.aria.label(p),...l,w.Icon({icon:t,size:e??"sm"}))})}function F(e){return`bc-label bc-label--${e}`}const ee=(...e)=>s.html.span(s.attr.class(F("emphasis")),...e),q=(...e)=>s.html.span(s.attr.class(F("default")),...e),U=(...e)=>s.html.span(s.attr.class(F("muted")),...e),te=(...e)=>s.html.span(s.attr.class(F("danger")),...e),se=e=>{const{value:t,onBlur:n,onChange:r,placeholder:a,disabled:i,id:o,checkedIcon:l,uncheckedIcon:c,iconSize:p="lg"}=e,h=o??D("checkbox"),m=`${h}-label`,k=()=>{if(s.Value.get(i??!1))return;const u=s.Value.get(t);r?.(!u)},g=u=>{s.Value.get(i??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),k())};return w.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(h),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,u=>u?-1:0)),s.aria.checked(t),s.aria.disabled(i),a!=null?s.aria.labelledby(m):s.Empty,s.on.keydown(g),n!=null?s.on.blur(n):s.Empty,w.Icon({icon:s.computedOf(t,l,c)((u,d,b)=>u?d??"akar-icons/check-box-fill":b??"akar-icons/box"),accessibility:"decorative",size:p})),a!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(m),s.attr.for(h),U(a)):s.Empty)},s.on.click(k))},W=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function ne(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function re(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function N(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const P=({fullWidth:e=!1,required:t,label:n,labelChildren:r,context:a,description:i,content:o,error:l,labelFor:c,hasError:p,disabled:h,layout:m,labelWidth:k},...g)=>{const u=p??l!=null,d=h??!1,b=m??"vertical",I=D("input-wrapper"),C=i?`${I}-description`:void 0,_=l!=null?`${I}-error`:void 0,A=s.computedOf(b)(y=>y!=="vertical");return s.html.div(s.attr.class(s.Value.map(b,y=>ne(y))),s.attr.class(s.Value.map(e,y=>y?"bc-input-wrapper--full-width":"")),s.When(s.computedOf(b,k??void 0)((y,E)=>N(y,E)!=null),()=>s.attr.style(s.Value.map(s.computedOf(b,k??void 0)((y,E)=>N(y,E)),y=>y))),n!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),c!=null?s.attr.for(c):s.Empty,s.html.span(s.attr.class(s.computedOf(u,d)((y,E)=>re(y??!1,E??!1))),n),n!=null&&t?W:s.Empty),s.When(s.computedOf(A,i)((y,E)=>y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),i))),a!=null?q(a):s.Empty,r):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,_].filter(Boolean).length>0?s.dataAttr.describedby([C,_].filter(Boolean).join(" ")):s.Empty,t?s.dataAttr.required("true"):s.Empty,s.When(u,()=>s.dataAttr.invalid("true")),o),s.When(s.computedOf(A,i)((y,E)=>!y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),i)),s.When(u,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(_),s.aria.live("polite"),s.attr.role("alert"),l)),...g)};function ae(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const ie=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:r,onBlur:a,onChange:i,onInput:o,placeholder:l}=t,c=r??w.InputIcon({icon:"line-md:email",size:e.size,color:"neutral"});return s.Use(w.BeatUII18n,p=>w.InputContainer({...e,before:c,input:s.input.email(w.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(l,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),a!=null?s.on.blur(s.emitValue(a)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,o!=null?s.on.input(s.emitValue(o)):s.Empty)}))},le=e=>{const{value:t,onBlur:n,onChange:r,onInput:a,before:i,after:o,hasError:l,disabled:c,autocomplete:p,placeholder:h,...m}=e,k={name:"password",disabled:c,...m},g=s.prop(!0),u=s.computedOf(g,p)((d,b)=>d?b??"current-password":"off");return s.Use(w.BeatUII18n,d=>{const b=s.computedOf(d.$.passwordPlaceholderText,g,h)((C,_,A)=>_?"•••••••••••••••":A??C),I=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>g.update(C=>!C)),s.When(g,()=>w.Icon({icon:"line-md:watch"}),()=>w.Icon({icon:"line-md:watch-off"})));return w.InputContainer({before:i,disabled:c,hasError:l,input:s.html.input(w.CommonInputAttributes({...k,autocomplete:u,placeholder:b}),s.When(g,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,r!=null?s.on.change(s.emitValue(r)):s.Empty,a!=null?s.on.input(s.emitValue(a)):s.Empty),after:o!=null?s.Fragment(I,o):I})})},z=(e,t)=>()=>{e.markTouched(),t?.()},M=(e,t)=>n=>{e.change(n),t?.(n)};function $(e,t){const{controller:n,onBlur:r,onChange:a,id:i,triggerOn:o,...l}=t;return e({id:i??n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,name:n.name,...l,onInput:o==="input"?M(n,a):void 0,onChange:o!=="input"?M(n,a):void 0,onBlur:z(n,r)})}function oe(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control"),o=n??i;return P({...r,hasError:r.controller.errorVisible,error:s.TextNode(r.controller.error.map(l=>l??"")),labelFor:o,content:$(l=>e({...l,id:i}),r)},...a)}function H(e,t){const{toInput:n,fromInput:r,controller:a,...i}=t,o=a.transform(n,r);return $(e,{...i,controller:o})}function ce(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control");return P({...r,labelFor:n??i,content:H(e,{...r,id:i})},...a)}function ue(e){return e.split(".").map(n=>{const r=n.match(/^\[(\d+)\]$/);return r?Number(r[1]):n})}function R(e){return typeof e=="number"?`[${e}]`:`.${e}`}function K(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(R)].join("")}function T(e){return function(n){if(n.type==="valid")return n;let r=n.error;for(const a of e)if(r=r?.dependencies?.[a],r==null)return S.valid;return S.invalid(r)}}class V{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,r,a,i,o=O){this.path=t,this.change=n,this.signal=r,this.status=a,this.#s=o,this.#t.set(r.value),this.error=a.map(l=>l?.type==="invalid"?l.error?.message:void 0),this.hasError=this.error.map(l=>l!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((l,c,p)=>p==="continuous"?!!l:!!l&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((l,c)=>!!l&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((l,c)=>!this.#s(l,c)),this.dependencyErrors=a.map(l=>l?.type==="invalid"?l.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((l,c)=>l||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((l,c)=>l||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return K(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=O)=>new J(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=O)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,r=[],a=O)=>new V([...this.path,...r],i=>this.change(n(i)),this.signal.map(t,a),this.status.map(T(r)),this.parent,a);asyncTransform=(t,n,r,a=[],i=O)=>new V([...this.path,...a],o=>{n(o).then(l=>this.change(l))},this.signal.mapAsync(t,r,void 0,i),this.status.map(T(a)),this.parent,i)}class G extends V{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){super(t,n,r.map(c=>c??{},o),a,i,o),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const l=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),l()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async o=>{this.change({...this.signal.value,[t]:o})},r=new V([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,r);const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class J extends V{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){const l=r.map(h=>h??[],o);super(t,n,l,a,i,o);const c=l.on(h=>{const m=this.#e.length-h.length;m>0&&(this.#e.splice(h.length,m).forEach((k,g)=>{const u=h.length+g;k.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#r.get(u)?.(),this.#r.delete(u),this.#a.delete(u)}),this.#o(),this.#i())});this.length=l.map(h=>h.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const p=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),l.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#r.values())h();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),p()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async o=>{const l=this.signal.value.slice();l[t]=o,this.change(l)},r=new V([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=r;const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const r=this.signal.value.slice();r.splice(t,n),this.change(r)};move=(t,n,r=1)=>{if(r<1||t===n)return;const a=this.signal.value.slice(),i=a.splice(t,r);a.splice(n,0,...i),this.change(a)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function Q(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function X(e){const t=e.filter(a=>a.path==null||a.path.length===0).map(a=>a.message),n=e.filter(a=>a.path!=null&&a.path.length>0).reduce((a,i)=>{const o=Q(i.path),l=o.pop();let c=a;for(const p of o)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[l]={message:i.message},a},{}),r=t.join(`
2
- `);return{...n,message:r!=""?r:void 0}}function Y({initialValue:e,onChange:t,validate:n,equals:r,validationMode:a,validateDebounceMs:i}){const o=s.Value.deriveProp(e),l=s.prop(S.valid),c=s.prop(!1),p=s.prop(a??"touchedOrSubmit"),h=d=>{l.set(d)};let m;const k=async d=>{if(n!=null){const b=await n(d);h(b)}},g=async d=>{o.set(d),t?.(d);const b=p.value;if(n!=null){if(b==="onSubmit")return;const I=i??0;I>0?(m&&clearTimeout(m),m=setTimeout(()=>{k(d)},I)):await k(d)}},u=new V([],g,o,l,{disabled:c,validationMode:p},r??O);return u.onDispose(()=>{c.dispose(),o.dispose(),l.dispose(),p.dispose(),m&&clearTimeout(m)}),{controller:u,setStatus:h}}function x(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function he(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function de(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function B(e){return e.issues!=null?S.invalid(X(e.issues)):S.valid}async function pe({task:e,errorMessage:t,errorPath:n=["root"],validation:r}){try{const a=await e();return r!=null?r(a):S.valid}catch(a){const i=t??(a instanceof Error?a.message:"Operation failed");return n.length===1&&n[0]==="root"?S.invalid({message:i}):S.invalid({dependencies:Z(n,i)})}}function Z(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...r]=e;return{[n]:{dependencies:Z(r,t)}}}function me({initialValue:e={},schema:t,onSubmit:n=async()=>S.valid,validationMode:r,validateDebounceMs:a}){const{controller:i,setStatus:o}=Y({initialValue:e,validationMode:r??"touchedOrSubmit",validateDebounceMs:a,validate:(r??"touchedOrSubmit")==="onSubmit"||t==null?void 0:async h=>B(await t["~standard"].validate(h))}),l=s.prop(!1),c=i.object();return c.onDispose(l.dispose),{controller:c,setStatus:o,submit:async h=>{if(l.set(!0),h?.preventDefault(),c.markAllTouched(),(r??"touchedOrSubmit")==="onSubmit"){const k=c.signal.value,g=t?.["~standard"].validate;if(g==null){l.set(!1);return}const u=B(await g(k));if(o(u),u.type==="invalid"){l.set(!1);return}}const m=await n(c.signal.value);l.set(!1),m.type==="invalid"&&o(m)},submitting:l}}function fe(e){switch(e){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function be(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function ge(e,t,n,r){const a=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&a.push("bc-notice--dismissible"),r&&r.length>0&&a.push(r),a.join(" ")}function ye({variant:e="info",tone:t="subtle",role:n,title:r,icon:a,closable:i=!1,onDismiss:o,class:l},...c){const p=s.prop(!0);return s.When(p,()=>{const h=s.Value.map(i,u=>!!u||o!=null),m=s.Value.map(e,u=>u??"info"),k=s.Value.map(t,u=>u??"subtle"),g=s.computedOf(n,m)((u,d)=>u??(d==="danger"?"alert":"status"));return s.Use(w.BeatUII18n,u=>s.html.div(s.attr.class(s.computedOf(m,k,h,l)((d,b,I,C)=>ge(d,b,I,C))),s.attr.role(s.Value.map(g,d=>d)),s.Unless(s.Value.map(a,d=>d===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),w.Icon({icon:s.computedOf(a,m)((d,b)=>d===void 0?fe(b):String(d)),size:"md",color:s.Value.map(m,be)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(r,d=>s.html.div(s.attr.class("bc-notice__title"),d)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(h,()=>j({size:"xs",label:u.$.closeModal,onClick:()=>{p.set(!1),o?.()}}))))})}exports.ArrayController=J;exports.BaseControl=$;exports.BaseMappedControl=H;exports.CheckboxInput=se;exports.CloseButton=j;exports.Control=oe;exports.Controller=V;exports.DangerLabel=te;exports.EmailInput=ie;exports.EmphasisLabel=ee;exports.InputWrapper=P;exports.Label=q;exports.MappedControl=ce;exports.MutedLabel=U;exports.Notice=ye;exports.O=O;exports.ObjectController=G;exports.PasswordInput=le;exports.RequiredSymbol=W;exports.Stack=ae;exports.a=S;exports.connectCommonAttributes=x;exports.connectNumberInput=de;exports.connectStringInput=he;exports.convertStandardSchemaIssues=X;exports.convertStandardSchemaPathToPath=Q;exports.makeMapValidation=T;exports.makeOnBlurHandler=z;exports.makeOnChangeHandler=M;exports.parsePath=ue;exports.pathToString=K;exports.sessionId=D;exports.standardSchemaResultToValidation=B;exports.taskToValidation=pe;exports.useController=Y;exports.useForm=me;exports.wrapSegment=R;