fernwell 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
- /*! fernwell v0.4.0 | MIT | https://github.com/JacobKnaack/fernwell */
2
- "use strict";var Fernwell=(()=>{var he=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Kt=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var n in t)he(e,n,{get:t[n],enumerable:!0})},jt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vt(t))!Kt.call(e,i)&&i!==n&&he(e,i,{get:()=>t[i],enumerable:!(o=Ft(t,i))||o.enumerable});return e};var _t=e=>jt(he({},"__esModule",{value:!0}),e);var On={};T(On,{combobox:()=>Q,default:()=>G,icon:()=>Y,init:()=>qt,loading:()=>oe,menu:()=>ce,modal:()=>ee,nav:()=>ne,popover:()=>fe,table:()=>se,tabs:()=>Ee,theme:()=>J,toast:()=>ie,tooltip:()=>pe,version:()=>Bt});var J={};T(J,{get:()=>Le,getToken:()=>Jt,init:()=>be,resetTokens:()=>Xt,set:()=>X,setTokens:()=>Yt,toggle:()=>Qe});var Y={};T(Y,{init:()=>we,render:()=>z});var Zt={add:'<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',close:'<line x1="6" y1="6" x2="18" y2="18"/><line x1="18" y1="6" x2="6" y2="18"/>',check:'<polyline points="5,13 10,18 19,7"/>',edit:'<path d="M16.8 3.5a2.1 2.1 0 0 1 3 3L8.5 17.8 4 19l1.2-4.5Z"/><line x1="14.5" y1="5.8" x2="17.7" y2="9"/>',trash:'<path d="M4 7h16"/><path d="M9 7V4.6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1V7"/><path d="M6.5 7l.8 12.4A2 2 0 0 0 9.3 21h5.4a2 2 0 0 0 2-1.6L18 7"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>',save:'<path d="M5 4a1 1 0 0 1 1-1h9.2a1 1 0 0 1 .7.3l2.8 2.8a1 1 0 0 1 .3.7V20a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4Z"/><path d="M8 3v5h7V3"/><path d="M8 21v-6h8v6"/>',search:'<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.6" y2="16.6"/>',settings:'<circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/>',download:'<line x1="12" y1="3" x2="12" y2="15"/><polyline points="7,10 12,15 17,10"/><line x1="5" y1="21" x2="19" y2="21"/>',upload:'<line x1="12" y1="15" x2="12" y2="3"/><polyline points="7,8 12,3 17,8"/><line x1="5" y1="21" x2="19" y2="21"/>',share:'<circle cx="6" cy="12" r="2.3"/><circle cx="18" cy="6" r="2.3"/><circle cx="18" cy="18" r="2.3"/><line x1="8.1" y1="10.8" x2="15.9" y2="7.2"/><line x1="8.1" y1="13.2" x2="15.9" y2="16.8"/>',copy:'<rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"/>',menu:'<line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/>',more:'<circle cx="5" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1.4" fill="currentColor" stroke="none"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8"/>',bell:'<path d="M6 8a6 6 0 0 1 12 0c0 5 2 6 2 6H4s2-1 2-6"/><path d="M10 20a2 2 0 0 0 4 0"/>',heart:'<path d="M12 20s-7-4.4-9.5-8.5C.8 8 2 4.5 5.5 4.5c2 0 3.5 1 6.5 4 3-3 4.5-4 6.5-4 3.5 0 4.7 3.5 3 7-2.5 4.1-9.5 8.5-9.5 8.5Z"/>',star:'<polygon points="12,3 14.6,9.1 21.2,9.3 16,13.4 17.8,19.8 12,16.3 6.2,19.8 8,13.4 2.8,9.3 9.4,9.1"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><line x1="8" y1="3" x2="8" y2="7"/><line x1="16" y1="3" x2="16" y2="7"/><line x1="3" y1="10" x2="21" y2="10"/>',refresh:'<path d="M20 11A8 8 0 0 0 6.3 6.3L4 8.6"/><path d="M4 4v5h5"/><path d="M4 13a8 8 0 0 0 13.7 4.7L20 15.4"/><path d="M20 20v-5h-5"/>',filter:'<polygon points="4,4 20,4 14,12 14,19 10,21 10,12"/>',info:'<circle cx="12" cy="12" r="9"/><line x1="12" y1="11" x2="12" y2="16"/><circle cx="12" cy="8" r="1" fill="currentColor" stroke="none"/>',warning:'<path d="M12 3 22 20H2Z"/><line x1="12" y1="9.5" x2="12" y2="14.5"/><circle cx="12" cy="17.3" r="1" fill="currentColor" stroke="none"/>',lock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',eye:'<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>',"chevron-down":'<polyline points="6,9 12,15 18,9"/>',"arrow-left":'<line x1="19" y1="12" x2="5" y2="12"/><polyline points="12,5 5,12 12,19"/>',"arrow-right":'<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12,5 19,12 12,19"/>',folder:'<path d="M3.5 6.5a1 1 0 0 1 1-1H10l2 2.2h7.5a1 1 0 0 1 1 1V18a1 1 0 0 1-1 1H4.5a1 1 0 0 1-1-1Z"/>',bookmark:'<path d="M6 3h12a1 1 0 0 1 1 1v17l-7-4-7 4V4a1 1 0 0 1 1-1Z"/>',home:'<path d="M4 11.5 12 4l8 7.5"/><path d="M6 10v10a1 1 0 0 0 1 1h3.5v-6h2.8v6H17a1 1 0 0 0 1-1V10"/>',logout:'<path d="M9 4H5.5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1H9"/><line x1="14" y1="12" x2="21" y2="12"/><polyline points="17.5,8.5 21,12 17.5,15.5"/>',paperclip:'<path d="M21 11.5 12.4 20a4.3 4.3 0 0 1-6-6.1L15 5.3a2.9 2.9 0 0 1 4.1 4.1l-8.6 8.6a1.4 1.4 0 0 1-2-2l7.9-7.9"/>',envelope:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M4 6.5 12 13l8-6.5"/>',"chevron-up":'<polyline points="6,15 12,9 18,15"/>',"chevron-left":'<polyline points="15,6 9,12 15,18"/>',"chevron-right":'<polyline points="9,6 15,12 9,18"/>',"arrow-up":'<line x1="12" y1="19" x2="12" y2="5"/><polyline points="5,12 12,5 19,12"/>',"arrow-down":'<line x1="12" y1="5" x2="12" y2="19"/><polyline points="5,12 12,19 19,12"/>',unlock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 7.8-1.3"/>',"thumbs-up":'<path d="M7 11v9H4.5a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1H7Z"/><path d="M7 11l4.3-7.3a1.4 1.4 0 0 1 2.6.8L13 9h5.6a2 2 0 0 1 1.9 2.6l-2 6.5A2 2 0 0 1 16.6 19.5H10a3 3 0 0 1-3-3"/>',"thumbs-down":'<path d="M7 13V4h2.5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7Z"/><path d="M7 13l4.3 7.3a1.4 1.4 0 0 0 2.6-.8L13 15h5.6a2 2 0 0 0 1.9-2.6l-2-6.5A2 2 0 0 0 16.6 4.5H10a3 3 0 0 0-3 3"/>',"eye-closed":'<path d="M3.5 12S7 6 12 6s8.5 6 8.5 6-3.5 6-8.5 6-8.5-6-8.5-6Z"/><line x1="4" y1="19" x2="20" y2="5"/>',"help-circle":'<circle cx="12" cy="12" r="9"/><path d="M9.2 9.2a2.8 2.8 0 1 1 4.3 2.4c-.9.6-1.5 1.1-1.5 2.2"/><circle cx="12" cy="17" r="1" fill="currentColor" stroke="none"/>',chat:'<path d="M4 5.5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9.5L5 20.5V16.5H5a1 1 0 0 1-1-1Z"/>',kebab:'<circle cx="12" cy="5" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="19" r="1.4" fill="currentColor" stroke="none"/>',sun:'<circle cx="12" cy="12" r="4"/><line x1="12" y1="2" x2="12" y2="4.5"/><line x1="12" y1="19.5" x2="12" y2="22"/><line x1="2" y1="12" x2="4.5" y2="12"/><line x1="19.5" y1="12" x2="22" y2="12"/><line x1="4.9" y1="4.9" x2="6.6" y2="6.6"/><line x1="17.4" y1="17.4" x2="19.1" y2="19.1"/><line x1="4.9" y1="19.1" x2="6.6" y2="17.4"/><line x1="17.4" y1="6.6" x2="19.1" y2="4.9"/>',moon:'<path d="M20.5 14.2A8.5 8.5 0 1 1 9.8 3.5a7 7 0 0 0 10.7 10.7Z"/>'};function z(e){let t=Zt[e];return t?`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${t}</svg>`:""}function we(e=document){e.querySelectorAll("[data-fw-icon]").forEach(t=>{var i;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(i=t.dataset.fwIcon)!=null?i:"",o=z(n);o||console.warn(`fernwell: unknown icon "${n}"`),t.innerHTML=o,t.classList.add("fw-icon")})}var ye="fw-theme",Wt="fw:themechange",Ut="--fw-",ze="data-fw-tokens",Ye="data-fw-theme-init";function Te(){try{return window.localStorage}catch{return null}}function Le(){var t;let e=document.documentElement.getAttribute("data-theme");return e==="dark"||e==="light"?e:(t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}function X(e,{persist:t=!0}={}){var n;document.documentElement.setAttribute("data-theme",e),t&&((n=Te())==null||n.setItem(ye,e)),document.querySelectorAll("[data-fw-theme-toggle]").forEach(o=>et(o,e)),document.dispatchEvent(new CustomEvent(Wt,{detail:e}))}function Qe(){let e=Le()==="dark"?"light":"dark";return X(e),e}function et(e,t){e.setAttribute("aria-pressed",String(t==="dark"));let n=t==="dark"?e.dataset.fwThemeIconDark:e.dataset.fwThemeIconLight,o=t==="dark"?e.dataset.fwThemeLabelDark:e.dataset.fwThemeLabelLight;if(n!==void 0){let i=`<span class="fw-icon" aria-hidden="true">${z(n)}</span>`;e.innerHTML=o!==void 0?`${i} ${o}`:i}else o!==void 0&&(e.textContent=o)}function Gt(e){let t=typeof requestAnimationFrame=="function"?requestAnimationFrame:n=>setTimeout(n,16);t(()=>t(e))}function be(e=document){var i,r,a,l;let t=(i=Te())==null?void 0:i.getItem(ye),n=t==="dark"||t==="light"?t:Le(),o=document.documentElement;o.setAttribute(Ye,""),X(n,{persist:!1}),Gt(()=>o.removeAttribute(Ye)),e.querySelectorAll("[data-fw-theme-toggle]").forEach(c=>{c.dataset.fwBound||(c.dataset.fwBound="1",et(c,n),c.addEventListener("click",()=>Qe()))}),(l=(r=window.matchMedia)==null?void 0:(a=r.call(window,"(prefers-color-scheme: dark)")).addEventListener)==null||l.call(a,"change",c=>{var d;(d=Te())!=null&&d.getItem(ye)||X(c.matches?"dark":"light",{persist:!1})})}var B=new Map;function tt(e){return e.startsWith("--")?e:`${Ut}${e}`}function zt(e){return Object.values(e).some(t=>t!==null&&typeof t=="object")}function Xe(e){return Object.entries(e).map(([t,n])=>`${tt(t)}:${n};`).join("")}function Je(e){let t=document.head.querySelector(`style[${ze}]`);if(t||!e)return t;let n=document.createElement("style");return n.setAttribute(ze,""),document.head.appendChild(n),n}function nt(){var t;if(B.size===0){(t=Je(!1))==null||t.remove();return}let e=[];B.forEach(({light:n,dark:o},i)=>{if(Object.keys(n).length&&e.push(`${i}{${Xe(n)}}`),Object.keys(o).length){let r=i===":root"?'[data-theme="dark"]':`[data-theme="dark"] ${i}, ${i}[data-theme="dark"]`;e.push(`${r}{${Xe(o)}}`)}}),Je(!0).textContent=e.join(`
3
- `)}function Yt(e,t={}){var i,r;let n=(i=t.scope)!=null?i:":root",o=(r=B.get(n))!=null?r:{light:{},dark:{}};zt(e)?(Object.assign(o.light,e.light),Object.assign(o.dark,e.dark)):(Object.assign(o.light,e),Object.assign(o.dark,e)),B.set(n,o),nt()}function Xt(e){e?B.delete(e):B.clear(),nt()}function Jt(e,t=document.documentElement){return getComputedStyle(t).getPropertyValue(tt(e)).trim()}var Q={};T(Q,{combobox:()=>ot,init:()=>xe});var Qt=0;function K(e){return e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function ot(e,t={}){var h,N,O,Ge;let n=(h=t.filter)!=null?h:((f,w)=>f.toLowerCase().includes(w)),o=(N=t.emptyText)!=null?N:"No matches",i=(O=t.options)!=null?O:en(e),r=[],a=-1,l=!1,c=e.getAttribute("list");c&&(e.dataset.fwList=c,e.removeAttribute("list"));let d=(Ge=e.closest(".fw-combobox"))!=null?Ge:tn(e),s=document.createElement("ul"),u=`fw-combobox-${++Qt}`;s.className="fw-combobox-list",s.id=u,s.setAttribute("role","listbox"),d.appendChild(s),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",u),e.autocomplete="off";function E(f){r=f,a=-1;let w=e.value.trim().toLowerCase();if(f.length===0){s.innerHTML=`<li class="fw-combobox-empty">${K(o)}</li>`;return}s.innerHTML=f.map((H,F)=>{let V=w?H.toLowerCase().indexOf(w):-1,$t=V>-1?`${K(H.slice(0,V))}<b>${K(H.slice(V,V+w.length))}</b>${K(H.slice(V+w.length))}`:K(H);return`<li class="fw-combobox-option" role="option" id="${u}-${F}" data-index="${F}" aria-selected="false">${$t}</li>`}).join("")}function m(){let f=e.value.trim().toLowerCase();E(f?i.filter(w=>n(w,f)):i),s.classList.add("is-open"),e.setAttribute("aria-expanded","true")}function p(){s.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),e.removeAttribute("aria-activedescendant"),a=-1}function v(f){let w=s.querySelectorAll(".fw-combobox-option");w.forEach(F=>{F.classList.remove("is-active"),F.setAttribute("aria-selected","false")});let H=w[f];H&&(H.classList.add("is-active"),H.setAttribute("aria-selected","true"),H.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",H.id)),a=f}function b(f){var w;e.value=f,p(),l=!0,e.focus(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),l=!1,(w=t.onSelect)==null||w.call(t,f)}let M=()=>{l||m()},y=()=>{l||m()},g=f=>{f.key==="ArrowDown"?(f.preventDefault(),s.classList.contains("is-open")||m(),v(Math.min(a+1,r.length-1))):f.key==="ArrowUp"?(f.preventDefault(),v(Math.max(a-1,0))):f.key==="Enter"?a>-1&&r[a]!==void 0&&(f.preventDefault(),b(r[a])):f.key==="Escape"&&p()},S=f=>{let w=f.target.closest(".fw-combobox-option");w&&(f.preventDefault(),b(r[Number(w.dataset.index)]))},$=f=>{d.contains(f.target)||p()};return e.addEventListener("input",M),e.addEventListener("focus",y),e.addEventListener("keydown",g),s.addEventListener("mousedown",S),document.addEventListener("click",$),{open:m,close:p,setOptions(f){i=f,s.classList.contains("is-open")&&m()},destroy(){e.removeEventListener("input",M),e.removeEventListener("focus",y),e.removeEventListener("keydown",g),s.removeEventListener("mousedown",S),document.removeEventListener("click",$),s.remove(),e.dataset.fwList&&e.setAttribute("list",e.dataset.fwList),delete e.dataset.fwBound}}}function en(e){var o;let t=(o=e.getAttribute("list"))!=null?o:e.dataset.fwList,n=t?document.getElementById(t):null;return n?Array.from(n.querySelectorAll("option")).map(i=>i.value||i.textContent||""):[]}function tn(e){var n;let t=document.createElement("div");return t.className="fw-combobox",(n=e.parentNode)==null||n.insertBefore(t,e),t.appendChild(e),t}function xe(e=document){e.querySelectorAll("input[data-fw-combobox]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",ot(t))})}var ee={};T(ee,{bindOutsideClickToClose:()=>He,close:()=>C,init:()=>Se,open:()=>ge,toggle:()=>on});var D="is-open",rt="fw-scroll-lock",P=[],Me=new WeakMap,nn='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Ae(e){return typeof e=="string"?document.getElementById(e):e}function ke(e){if(e.classList.contains("fw-modal-overlay"))return e;let t=e.id?document.querySelector(`[data-fw-drawer-overlay="${e.id}"]`):null;if(t)return t;let n=e.previousElementSibling;return n instanceof HTMLElement&&n.classList.contains("fw-drawer-overlay")?n:null}function ge(e,t=(n=>(n=document.activeElement)!=null?n:null)()){var r;let o=Ae(e);if(!o||o.classList.contains(D))return;o.classList.add(D),(r=ke(o))==null||r.classList.add(D),Me.set(o,t),P.push(o),document.body.classList.add(rt),o.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}));let i=o.querySelector(nn);i?i.focus({preventScroll:!0}):(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}function C(e){var o,i,r;let t=Ae(e);if(!t||!t.classList.contains(D))return;t.classList.remove(D),(o=ke(t))==null||o.classList.remove(D);let n=P.indexOf(t);n>-1&&P.splice(n,1),P.length===0&&document.body.classList.remove(rt),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),(r=(i=Me.get(t))==null?void 0:i.focus)==null||r.call(i,{preventScroll:!0}),Me.delete(t)}function on(e){let t=Ae(e);t&&(t.classList.contains(D)?C:ge)(t)}function He(e,t){let n=!1;e.addEventListener("mousedown",o=>{n=o.target===e}),e.addEventListener("click",o=>{o.target===e&&n&&t()})}var it=!1;function Se(e=document){e.querySelectorAll("[data-fw-open-modal], [data-fw-open-drawer]").forEach(t=>{var o,i;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(i=(o=t.dataset.fwOpenModal)!=null?o:t.dataset.fwOpenDrawer)!=null?i:"";t.addEventListener("click",()=>ge(n,t))}),e.querySelectorAll(".fw-modal-overlay").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",He(t,()=>C(t)),t.querySelectorAll("[data-fw-close-modal]").forEach(n=>n.addEventListener("click",()=>C(t))))}),e.querySelectorAll(".fw-drawer").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=ke(t);n&&He(n,()=>C(t)),t.querySelectorAll("[data-fw-close-drawer]").forEach(o=>o.addEventListener("click",()=>C(t)))}),it||(it=!0,document.addEventListener("keydown",t=>{t.key==="Escape"&&P.length&&C(P[P.length-1])}))}var ne={};T(ne,{close:()=>te,init:()=>De,open:()=>st});var Oe="is-open";function st(e){let t=Ce(e);t&&(t.classList.add(Oe),e.setAttribute("aria-expanded","true"))}function te(e){let t=Ce(e);t&&(t.classList.remove(Oe),e.setAttribute("aria-expanded","false"))}function Ce(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function De(e=document){e.querySelectorAll("[data-fw-nav-toggle]").forEach(t=>{var i,r;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=Ce(t);if(!n)return;let o=(r=(i=t.closest(".fw-nav"))!=null?i:t.parentElement)!=null?r:t;t.addEventListener("click",a=>{a.stopPropagation(),(n.classList.contains(Oe)?te:st)(t)}),document.addEventListener("click",a=>{!o.contains(a.target)&&!n.contains(a.target)&&te(t)}),document.addEventListener("keydown",a=>{a.key==="Escape"&&te(t)})})}var oe={};T(oe,{init:()=>Pe,resetAll:()=>dt,resetButtonLoading:()=>ct,setButtonLoading:()=>lt});var j="fw-btn-loading";function lt(e,t){var o,i;if(!e||e.classList.contains(j))return;e.dataset.fwOriginalHtml=e.innerHTML,e.disabled=!0,e.setAttribute("aria-busy","true"),e.classList.add(j);let n=(i=(o=t!=null?t:e.dataset.fwLoadingText)!=null?o:e.textContent)!=null?i:"";e.innerHTML='<span class="fw-spinner fw-spinner-sm" aria-hidden="true"></span>',e.appendChild(document.createTextNode(n))}function ct(e){!e||!e.classList.contains(j)||(e.disabled=!1,e.removeAttribute("aria-busy"),e.classList.remove(j),e.dataset.fwOriginalHtml!==void 0&&(e.innerHTML=e.dataset.fwOriginalHtml,delete e.dataset.fwOriginalHtml))}function dt(e=document){e.querySelectorAll(`.${j}`).forEach(ct)}var at=!1;function Pe(e=document){e.querySelectorAll("form[data-fw-loading]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",t.addEventListener("submit",()=>{let n=t.querySelector('button[type="submit"], button:not([type])');lt(n)}))}),at||(at=!0,window.addEventListener("pageshow",t=>{t.persisted&&dt()}))}var ie={};T(ie,{hide:()=>ut,show:()=>sn});var L=null,q=null;function rn(){return L&&L.isConnected||(L=document.createElement("div"),L.className="fw-toast",L.setAttribute("role","status"),L.setAttribute("aria-live","polite"),L.innerHTML='<span class="fw-toast-dot" aria-hidden="true"></span><span class="fw-toast-text"></span>',document.body.appendChild(L)),L}function sn(e,{variant:t="success",duration:n=4e3}={}){let o=rn();return o.className=`fw-toast${t==="success"?"":` fw-toast-${t}`}`,o.querySelector(".fw-toast-text").textContent=e,q&&clearTimeout(q),o.classList.remove("is-show"),o.offsetWidth,o.classList.add("is-show"),n>0&&(q=setTimeout(ut,n)),o}function ut(){L==null||L.classList.remove("is-show"),q&&clearTimeout(q),q=null}var se={};T(se,{getSelected:()=>Re,init:()=>$e,selectAll:()=>Et,setRowSelected:()=>vt,sort:()=>Ie});var an="is-selected";function Ne(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function ft(e,t){var o,i,r;let n=e.cells[t];return(r=(i=n==null?void 0:n.dataset.fwSortValue)!=null?i:(o=n==null?void 0:n.textContent)==null?void 0:o.trim())!=null?r:""}function ln(e,t){let n=Number(e),o=Number(t);return e!==""&&t!==""&&Number.isFinite(n)&&Number.isFinite(o)?n-o:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function pt(e){var t,n;return Array.from((n=(t=e.tHead)==null?void 0:t.querySelectorAll("th[data-fw-sort]"))!=null?n:[])}function mt(e){return e.getAttribute("aria-sort")==="ascending"?"descending":"ascending"}function Ie(e,t,n){let o=e.tBodies[0];if(!o)return;let i=Array.from(o.rows),r=i.filter(d=>d.cells.length>t),a=i.filter(d=>d.cells.length<=t),l=n==="ascending"?1:-1;r.sort((d,s)=>l*ln(ft(d,t),ft(s,t))),[...r,...a].forEach(d=>o.appendChild(d));let c=null;pt(e).forEach(d=>{let s=d.cellIndex===t;d.setAttribute("aria-sort",s?n:"none"),s&&(c=d)}),c&&Ne(e,"fw:sort",{column:t,direction:n,th:c})}function re(e){return Array.from(e.querySelectorAll("tbody input[data-fw-select-row]"))}function Be(e,t){e.classList.toggle(an,t),e.setAttribute("aria-selected",t?"true":"false")}function qe(e){let t=e.querySelector("[data-fw-select-all]");if(!t)return;let n=re(e),o=n.filter(i=>i.checked).length;t.checked=o>0&&o===n.length,t.indeterminate=o>0&&o<n.length}function Re(e){return re(e).filter(t=>t.checked).map(t=>t.closest("tr")).filter(t=>t!==null)}function vt(e,t){let n=e.querySelector("input[data-fw-select-row]");n&&(n.checked=t),Be(e,t);let o=e.closest("table");o&&(qe(o),Ne(o,"fw:select",{rows:Re(o),all:!1}))}function Et(e,t){re(e).forEach(n=>{n.checked=t;let o=n.closest("tr");o&&Be(o,t)}),qe(e),Ne(e,"fw:select",{rows:Re(e),all:!0})}function $e(e=document){e.querySelectorAll("table[data-fw-table]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",pt(t).forEach(n=>{n.hasAttribute("aria-sort")||n.setAttribute("aria-sort","none")}),t.addEventListener("click",n=>{let o=n.target.closest("th[data-fw-sort]");o&&t.contains(o)&&Ie(t,o.cellIndex,mt(o))}),t.addEventListener("keydown",n=>{if(n.key!=="Enter"&&n.key!==" ")return;let o=n.target;if(!o.matches("th[data-fw-sort], th[data-fw-sort] .fw-table-sort"))return;let i=o.closest("th[data-fw-sort]");i&&(n.preventDefault(),Ie(t,i.cellIndex,mt(i)))}),t.addEventListener("change",n=>{let o=n.target;if(o.matches("[data-fw-select-all]"))Et(t,o.checked);else if(o.matches("[data-fw-select-row]")){let i=o.closest("tr");i&&vt(i,o.checked)}}),re(t).forEach(n=>{let o=n.closest("tr");o&&n.checked&&Be(o,!0)}),qe(t))})}var ce={};T(ce,{close:()=>le,collapseAll:()=>mn,expandAll:()=>fn,init:()=>Fe,open:()=>ae,reveal:()=>yt,toggle:()=>un});var A=".fw-menu-group",wt=".fw-menu-link, .fw-menu-summary",cn="is-current";function dn(e,t){e.dispatchEvent(new CustomEvent("fw:toggle",{bubbles:!0,detail:t}))}function ae(e){e.open=!0}function le(e){e.open=!1}function un(e,t){e.open=t!=null?t:!e.open}function fn(e){e.querySelectorAll(A).forEach(ae)}function mn(e){e.querySelectorAll(A).forEach(le)}function yt(e){var n,o,i,r;let t=(o=(n=e.parentElement)==null?void 0:n.closest(A))!=null?o:null;for(;t;)ae(t),t=(r=(i=t.parentElement)==null?void 0:i.closest(A))!=null?r:null}function ht(e){e.querySelectorAll(A).forEach(t=>{let n=t.querySelector(":scope > .fw-menu-summary");if(!n)return;let o=!t.open&&t.querySelector("[aria-current]")!==null;n.classList.toggle(cn,o)})}function Tt(e){return e.matches(".fw-menu-summary")?e.closest(A):null}function Lt(e){var n,o,i;return(i=(o=((n=Tt(e))!=null?n:e).parentElement)==null?void 0:o.closest(A))!=null?i:null}function pn(e){var t,n;for(let o=Lt(e);o;o=(n=(t=o.parentElement)==null?void 0:t.closest(A))!=null?n:null)if(!o.open)return!1;return!0}function vn(e){return Array.from(e.querySelectorAll(wt)).filter(pn)}function I(e){return e?(e.focus(),!0):!1}function En(e){var n;let t=e.closest(".fw-menu-split");return(n=t==null?void 0:t.querySelector(":scope > .fw-menu-group > .fw-menu-summary"))!=null?n:null}function hn(e,t){var l;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;let n=t.target instanceof HTMLElement&&t.target.matches(wt)?t.target:null;if(!n||!e.contains(n))return;let o=vn(e),i=o.indexOf(n),r=Tt(n),a=!0;switch(t.key){case"ArrowDown":I(o[i+1]);break;case"ArrowUp":I(o[i-1]);break;case"Home":I(o[0]);break;case"End":I(o[o.length-1]);break;case"ArrowRight":r?r.open?r.contains((l=o[i+1])!=null?l:e)&&I(o[i+1]):ae(r):I(En(n));break;case"ArrowLeft":if(r!=null&&r.open)le(r);else{let c=Lt(n);I(c==null?void 0:c.querySelector(":scope > .fw-menu-summary"))}break;default:a=!1}a&&t.preventDefault()}function Fe(e=document){e.querySelectorAll("[data-fw-menu]").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.hasAttribute("data-fw-menu-exclusive");t.addEventListener("toggle",o=>{let i=o.target;!(i instanceof HTMLDetailsElement)||!i.matches(A)||(n&&i.open&&i.parentElement&&Array.from(i.parentElement.children).forEach(r=>{r!==i&&r instanceof HTMLDetailsElement&&r.matches(A)&&le(r)}),ht(t),dn(i,{group:i,open:i.open}))},!0),t.addEventListener("keydown",o=>hn(t,o)),t.querySelectorAll("[aria-current]").forEach(yt),ht(t)})}var fe={};T(fe,{init:()=>Ke,popover:()=>Ht});var wn={top:"bottom",bottom:"top",left:"right",right:"left"},R=10;function yn(e){switch(e){case"top-left":return{side:"top",align:"end"};case"top-right":return{side:"top",align:"start"};case"bottom-left":return{side:"bottom",align:"end"};case"bottom-right":return{side:"bottom",align:"start"};default:return{side:e,align:"center"}}}var Tn={start:"right",end:"left"};function Ln(e,t){return t==="center"?e:`${e}-${Tn[t]}`}function Ve(e,t,n,o){switch(e){case"top":return t.top;case"bottom":return o-t.bottom;case"left":return t.left;case"right":return n-t.right}}function bt(e,t,n,o){switch(e){case"top":return t.top-o-n.height;case"bottom":return t.bottom+o;case"left":return t.left-o-n.width;case"right":return t.right+o}}function xt(e,t,n,o){switch(e){case"start":return t;case"end":return t+n-o;case"center":return t+n/2-o/2}}function de(e,t,n){return Math.min(Math.max(e,t),n>t?n:t)}function ue(e,t,n={}){var y,g,S;let o=(y=n.placement)!=null?y:"bottom",i=(g=n.offset)!=null?g:8,r=(S=n.padding)!=null?S:8,a=e.getBoundingClientRect(),l=t.getBoundingClientRect(),c=window.innerWidth,d=window.innerHeight,{side:s,align:u}=yn(o),E=wn[s],m=s==="top"||s==="bottom"?l.height:l.width,p=Ve(s,a,c,d)-i<m&&Ve(E,a,c,d)-i>Ve(s,a,c,d)-i?E:s,v,b,M;return p==="top"||p==="bottom"?(v=bt(p,a,l,i),b=de(xt(u,a.left,a.width,l.width),r,c-l.width-r),M=de(a.left+a.width/2-b,R,Math.max(l.width-R,R))):(b=bt(p,a,l,i),v=de(xt("center",a.top,a.height,l.height),r,d-l.height-r),M=de(a.top+a.height/2-v,R,Math.max(l.height-R,R))),{placement:Ln(p,u),top:v,left:b,arrowOffset:M}}function Mt(e,t){let n=a=>!e.some(l=>l.contains(a)),o=!1,i=a=>{o=n(a.target)},r=a=>{o&&n(a.target)&&t()};return document.addEventListener("mousedown",i,!0),document.addEventListener("click",r,!0),()=>{document.removeEventListener("mousedown",i,!0),document.removeEventListener("click",r,!0)}}var bn='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Ht(e,t,n={}){var S,$;let o=(S=n.placement)!=null?S:"bottom",i=($=n.offset)!=null?$:8;e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-controls",t.id),e.setAttribute("aria-expanded","false"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.classList.add("fw-popover");let r=t.parentNode,a=t.nextSibling,l=!1,c=null,d=0;function s(){let h=ue(e,t,{placement:o,offset:i});t.style.top=`${h.top}px`,t.style.left=`${h.left}px`,t.setAttribute("data-placement",h.placement)}function u(){cancelAnimationFrame(d),d=requestAnimationFrame(s)}function E(h){h.key==="Escape"&&(h.stopPropagation(),v())}function m(h){let N=h.relatedTarget;N&&(t.contains(N)||e.contains(N))||setTimeout(()=>{if(!l)return;let O=document.activeElement;O===document.body||O===null||t.contains(O)||e.contains(O)||v()},0)}function p(){if(l)return;l=!0,t.parentNode!==document.body&&document.body.appendChild(t),s(),t.classList.add("is-open"),e.setAttribute("aria-expanded","true");let h=t.querySelector(bn);h?h.focus({preventScroll:!0}):(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})),c=Mt([e,t],v),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),t.addEventListener("keydown",E),t.addEventListener("focusout",m),t.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}))}function v(){if(!l)return;l=!1,t.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),c==null||c(),c=null,window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u),t.removeEventListener("keydown",E),t.removeEventListener("focusout",m),cancelAnimationFrame(d),a===null||a.parentNode===r?r.insertBefore(t,a):r.appendChild(t),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),e.focus({preventScroll:!0})}function b(){(l?v:p)()}let M=()=>b(),y=Array.from(t.querySelectorAll("[data-fw-popover-close]")),g=()=>v();return e.addEventListener("click",M),y.forEach(h=>h.addEventListener("click",g)),{open:p,close:v,toggle:b,destroy(){l&&v(),e.removeEventListener("click",M),y.forEach(h=>h.removeEventListener("click",g)),delete e.dataset.fwBound}}}function Ke(e=document){e.querySelectorAll("[data-fw-popover-trigger]").forEach(t=>{var i;if(t.dataset.fwBound)return;let n=(i=t.dataset.fwPopoverTrigger)!=null?i:"",o=document.getElementById(n);if(!o){console.warn(`fernwell: popover trigger references missing panel #${n}`);return}t.dataset.fwBound="1",Ht(t,o,{placement:t.dataset.fwPopoverPlacement||void 0,offset:t.dataset.fwPopoverOffset?Number(t.dataset.fwPopoverOffset):void 0})})}var pe={};T(pe,{init:()=>Ze,tooltip:()=>Ct});var xn=400,Mn=300,Hn=100,Z=new WeakMap,x=null,k=null,W=0,U=0,_e=0,kt=0;function An(){if(x&&x.isConnected)return x;let e=document.createElement("div");return e.className="fw-tooltip",e.id="fw-tooltip",e.setAttribute("role","tooltip"),document.body.appendChild(e),e.addEventListener("mouseenter",gt),e.addEventListener("mouseleave",()=>Ot()),x=e,e}function gt(){clearTimeout(U)}function St(){if(!k||!x)return;let e=Z.get(k);if(!e)return;let t=ue(k,x,{placement:e.placement,offset:e.offset});x.style.top=`${t.top}px`,x.style.left=`${t.left}px`,x.style.setProperty("--fw-tooltip-arrow-pos",`${t.arrowOffset}px`),x.setAttribute("data-placement",t.placement)}function me(){cancelAnimationFrame(_e),_e=requestAnimationFrame(St)}function At(e){var o;if(clearTimeout(W),gt(),!Z.get(e))return;k=e;let n=An();n.textContent=(o=e.dataset.fwTooltipText)!=null?o:"",St(),n.classList.add("is-open"),window.addEventListener("scroll",me,!0),window.addEventListener("resize",me)}function _(){clearTimeout(W),clearTimeout(U),x&&x.classList.remove("is-open"),window.removeEventListener("scroll",me,!0),window.removeEventListener("resize",me),cancelAnimationFrame(_e),k&&(kt=performance.now()),k=null}function je(e,t){clearTimeout(U),clearTimeout(W);let n=Z.get(e);n&&(t||performance.now()-kt<Mn?At(e):W=window.setTimeout(()=>At(e),n.delay))}function Ot(){clearTimeout(W),clearTimeout(U),U=window.setTimeout(_,Hn)}function Ct(e,t={}){var d,s,u;let n={placement:(d=t.placement)!=null?d:"top",offset:(s=t.offset)!=null?s:6,delay:(u=t.delay)!=null?u:xn};Z.set(e,n);let o=e.getAttribute("title");o!==null&&(e.dataset.fwTooltipText=o,e.removeAttribute("title")),e.setAttribute("aria-describedby","fw-tooltip");let i=()=>je(e,!1),r=()=>Ot(),a=()=>je(e,!0),l=()=>{k===e&&_()},c=E=>{E.key==="Escape"&&k===e&&_()};return e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",r),e.addEventListener("focus",a),e.addEventListener("blur",l),e.addEventListener("keydown",c),{show:()=>je(e,!0),hide:()=>{k===e&&_()},destroy(){k===e&&_(),e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",r),e.removeEventListener("focus",a),e.removeEventListener("blur",l),e.removeEventListener("keydown",c),e.removeAttribute("aria-describedby"),e.dataset.fwTooltipText!==void 0&&(e.setAttribute("title",e.dataset.fwTooltipText),delete e.dataset.fwTooltipText),Z.delete(e),delete e.dataset.fwBound}}}function Ze(e=document){e.querySelectorAll("[data-fw-tooltip]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",Ct(t,{placement:t.dataset.fwTooltipPlacement||void 0,offset:t.dataset.fwTooltipOffset?Number(t.dataset.fwTooltipOffset):void 0,delay:t.dataset.fwTooltipDelay?Number(t.dataset.fwTooltipDelay):void 0}))})}var Ee={};T(Ee,{init:()=>Ue,tabs:()=>Nt});function kn(e,t){e.dispatchEvent(new CustomEvent("fw:tabs-change",{bubbles:!0,detail:t}))}function ve(e){return e.getAttribute("aria-disabled")==="true"}function We(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function Dt(e){return e instanceof Element?e.closest('[role="tab"]'):null}function Pt(e,t,n){for(let o=1;o<=e.length;o++){let i=((t+n*o)%e.length+e.length)%e.length;if(!ve(e[i]))return e[i]}}function It(e){return e.find(t=>!ve(t))}function gn(e){for(let t=e.length-1;t>=0;t--)if(!ve(e[t]))return e[t]}function Nt(e,t={}){var d;let n=(d=t.activation)!=null?d:"automatic";function o(){return Array.from(e.querySelectorAll('[role="tab"]'))}function i(s,u=!1){if(ve(s))return;o().forEach(m=>{let p=m===s;m.setAttribute("aria-selected",String(p)),m.tabIndex=p?0:-1;let v=We(m);v&&(v.hidden=!p)}),u&&s.focus();let E=We(s);E&&kn(e,{tab:s,panel:E})}function r(s){o().forEach(u=>{u.tabIndex=u===s?0:-1}),s.focus()}function a(){var E;let s=o(),u=(E=s.find(m=>m.getAttribute("aria-selected")==="true"))!=null?E:It(s);s.forEach(m=>{let p=m===u;m.setAttribute("aria-selected",String(p)),m.tabIndex=p?0:-1;let v=We(m);v&&(v.hidden=!p)})}function l(s){let u=Dt(s.target);u&&e.contains(u)&&i(u,!1)}function c(s){let u=Dt(s.target);if(!u)return;let E=o(),m=E.indexOf(u);if(m===-1)return;if(s.key===" "||s.key==="Enter"){n==="manual"&&(s.preventDefault(),i(u,!1));return}let p=e.getAttribute("aria-orientation")==="vertical",v=getComputedStyle(e).direction==="rtl",b=p?"ArrowDown":v?"ArrowLeft":"ArrowRight",M=p?"ArrowUp":v?"ArrowRight":"ArrowLeft",y;if(s.key===b)y=Pt(E,m,1);else if(s.key===M)y=Pt(E,m,-1);else if(s.key==="Home")y=It(E);else if(s.key==="End")y=gn(E);else return;y&&(s.preventDefault(),n==="manual"?r(y):i(y,!0))}return e.addEventListener("click",l),e.addEventListener("keydown",c),a(),{activate:i,destroy(){e.removeEventListener("click",l),e.removeEventListener("keydown",c),delete e.dataset.fwBound}}}function Ue(e=document){e.querySelectorAll('[role="tablist"][data-fw-tabs]').forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.dataset.fwTabsActivation==="manual"?"manual":"automatic";Nt(t,{activation:n})})}var Bt="0.4.0";function qt(e=document){be(e),xe(e),Se(e),De(e),Pe(e),$e(e),Fe(e),we(e),Ke(e),Ze(e),Ue(e)}var Sn={version:Bt,init:qt,theme:J,combobox:Q,modal:ee,nav:ne,loading:oe,toast:ie,table:se,menu:ce,icon:Y,popover:fe,tooltip:pe,tabs:Ee},G=Sn;var Rt=typeof document!="undefined"?document.currentScript:null;typeof document!="undefined"&&!(Rt&&Rt.hasAttribute("data-fw-no-init"))&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>G.init()):G.init());return _t(On);})();
1
+ /*! fernwell v0.6.0 | MIT | https://github.com/JacobKnaack/fernwell */
2
+ "use strict";var Fernwell=(()=>{var Be=Object.defineProperty;var Pn=Object.getOwnPropertyDescriptor;var $n=Object.getOwnPropertyNames;var qn=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var n in t)Be(e,n,{get:t[n],enumerable:!0})},Rn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $n(t))!qn.call(e,r)&&r!==n&&Be(e,r,{get:()=>t[r],enumerable:!(o=Pn(t,r))||o.enumerable});return e};var Fn=e=>Rn(Be({},"__esModule",{value:!0}),e);var Bo={};g(Bo,{combobox:()=>be,default:()=>se,icon:()=>ae,init:()=>Cn,loading:()=>Ee,menu:()=>ke,modal:()=>we,nav:()=>ye,numberInput:()=>De,popover:()=>Se,table:()=>Le,tabs:()=>Ie,theme:()=>ve,toast:()=>xe,tokens:()=>me,tooltip:()=>Ne,version:()=>Nn});var ve={};g(ve,{get:()=>We,getToken:()=>Ke,init:()=>Ze,resetTokens:()=>je,set:()=>pe,setTokens:()=>Q,toggle:()=>Wt});var ae={};g(ae,{init:()=>Pe,render:()=>F});var jn={add:'<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',minus:'<line x1="5" y1="12" x2="19" y2="12"/>',close:'<line x1="6" y1="6" x2="18" y2="18"/><line x1="18" y1="6" x2="6" y2="18"/>',check:'<polyline points="5,13 10,18 19,7"/>',edit:'<path d="M16.8 3.5a2.1 2.1 0 0 1 3 3L8.5 17.8 4 19l1.2-4.5Z"/><line x1="14.5" y1="5.8" x2="17.7" y2="9"/>',trash:'<path d="M4 7h16"/><path d="M9 7V4.6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1V7"/><path d="M6.5 7l.8 12.4A2 2 0 0 0 9.3 21h5.4a2 2 0 0 0 2-1.6L18 7"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>',save:'<path d="M5 4a1 1 0 0 1 1-1h9.2a1 1 0 0 1 .7.3l2.8 2.8a1 1 0 0 1 .3.7V20a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4Z"/><path d="M8 3v5h7V3"/><path d="M8 21v-6h8v6"/>',search:'<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.6" y2="16.6"/>',settings:'<circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/>',download:'<line x1="12" y1="3" x2="12" y2="15"/><polyline points="7,10 12,15 17,10"/><line x1="5" y1="21" x2="19" y2="21"/>',upload:'<line x1="12" y1="15" x2="12" y2="3"/><polyline points="7,8 12,3 17,8"/><line x1="5" y1="21" x2="19" y2="21"/>',share:'<circle cx="6" cy="12" r="2.3"/><circle cx="18" cy="6" r="2.3"/><circle cx="18" cy="18" r="2.3"/><line x1="8.1" y1="10.8" x2="15.9" y2="7.2"/><line x1="8.1" y1="13.2" x2="15.9" y2="16.8"/>',copy:'<rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"/>',menu:'<line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/>',more:'<circle cx="5" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1.4" fill="currentColor" stroke="none"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8"/>',bell:'<path d="M6 8a6 6 0 0 1 12 0c0 5 2 6 2 6H4s2-1 2-6"/><path d="M10 20a2 2 0 0 0 4 0"/>',heart:'<path d="M12 20s-7-4.4-9.5-8.5C.8 8 2 4.5 5.5 4.5c2 0 3.5 1 6.5 4 3-3 4.5-4 6.5-4 3.5 0 4.7 3.5 3 7-2.5 4.1-9.5 8.5-9.5 8.5Z"/>',star:'<polygon points="12,3 14.6,9.1 21.2,9.3 16,13.4 17.8,19.8 12,16.3 6.2,19.8 8,13.4 2.8,9.3 9.4,9.1"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><line x1="8" y1="3" x2="8" y2="7"/><line x1="16" y1="3" x2="16" y2="7"/><line x1="3" y1="10" x2="21" y2="10"/>',refresh:'<path d="M20 11A8 8 0 0 0 6.3 6.3L4 8.6"/><path d="M4 4v5h5"/><path d="M4 13a8 8 0 0 0 13.7 4.7L20 15.4"/><path d="M20 20v-5h-5"/>',filter:'<polygon points="4,4 20,4 14,12 14,19 10,21 10,12"/>',info:'<circle cx="12" cy="12" r="9"/><line x1="12" y1="11" x2="12" y2="16"/><circle cx="12" cy="8" r="1" fill="currentColor" stroke="none"/>',warning:'<path d="M12 3 22 20H2Z"/><line x1="12" y1="9.5" x2="12" y2="14.5"/><circle cx="12" cy="17.3" r="1" fill="currentColor" stroke="none"/>',lock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',eye:'<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>',"chevron-down":'<polyline points="6,9 12,15 18,9"/>',"arrow-left":'<line x1="19" y1="12" x2="5" y2="12"/><polyline points="12,5 5,12 12,19"/>',"arrow-right":'<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12,5 19,12 12,19"/>',folder:'<path d="M3.5 6.5a1 1 0 0 1 1-1H10l2 2.2h7.5a1 1 0 0 1 1 1V18a1 1 0 0 1-1 1H4.5a1 1 0 0 1-1-1Z"/>',bookmark:'<path d="M6 3h12a1 1 0 0 1 1 1v17l-7-4-7 4V4a1 1 0 0 1 1-1Z"/>',home:'<path d="M4 11.5 12 4l8 7.5"/><path d="M6 10v10a1 1 0 0 0 1 1h3.5v-6h2.8v6H17a1 1 0 0 0 1-1V10"/>',logout:'<path d="M9 4H5.5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1H9"/><line x1="14" y1="12" x2="21" y2="12"/><polyline points="17.5,8.5 21,12 17.5,15.5"/>',paperclip:'<path d="M21 11.5 12.4 20a4.3 4.3 0 0 1-6-6.1L15 5.3a2.9 2.9 0 0 1 4.1 4.1l-8.6 8.6a1.4 1.4 0 0 1-2-2l7.9-7.9"/>',envelope:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M4 6.5 12 13l8-6.5"/>',"chevron-up":'<polyline points="6,15 12,9 18,15"/>',"chevron-left":'<polyline points="15,6 9,12 15,18"/>',"chevron-right":'<polyline points="9,6 15,12 9,18"/>',"arrow-up":'<line x1="12" y1="19" x2="12" y2="5"/><polyline points="5,12 12,5 19,12"/>',"arrow-down":'<line x1="12" y1="5" x2="12" y2="19"/><polyline points="5,12 12,19 19,12"/>',unlock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 7.8-1.3"/>',"thumbs-up":'<path d="M7 11v9H4.5a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1H7Z"/><path d="M7 11l4.3-7.3a1.4 1.4 0 0 1 2.6.8L13 9h5.6a2 2 0 0 1 1.9 2.6l-2 6.5A2 2 0 0 1 16.6 19.5H10a3 3 0 0 1-3-3"/>',"thumbs-down":'<path d="M7 13V4h2.5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7Z"/><path d="M7 13l4.3 7.3a1.4 1.4 0 0 0 2.6-.8L13 15h5.6a2 2 0 0 0 1.9-2.6l-2-6.5A2 2 0 0 0 16.6 4.5H10a3 3 0 0 0-3 3"/>',"eye-closed":'<path d="M3.5 12S7 6 12 6s8.5 6 8.5 6-3.5 6-8.5 6-8.5-6-8.5-6Z"/><line x1="4" y1="19" x2="20" y2="5"/>',"help-circle":'<circle cx="12" cy="12" r="9"/><path d="M9.2 9.2a2.8 2.8 0 1 1 4.3 2.4c-.9.6-1.5 1.1-1.5 2.2"/><circle cx="12" cy="17" r="1" fill="currentColor" stroke="none"/>',chat:'<path d="M4 5.5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9.5L5 20.5V16.5H5a1 1 0 0 1-1-1Z"/>',kebab:'<circle cx="12" cy="5" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="19" r="1.4" fill="currentColor" stroke="none"/>',sun:'<circle cx="12" cy="12" r="4"/><line x1="12" y1="2" x2="12" y2="4.5"/><line x1="12" y1="19.5" x2="12" y2="22"/><line x1="2" y1="12" x2="4.5" y2="12"/><line x1="19.5" y1="12" x2="22" y2="12"/><line x1="4.9" y1="4.9" x2="6.6" y2="6.6"/><line x1="17.4" y1="17.4" x2="19.1" y2="19.1"/><line x1="4.9" y1="19.1" x2="6.6" y2="17.4"/><line x1="17.4" y1="6.6" x2="19.1" y2="4.9"/>',moon:'<path d="M20.5 14.2A8.5 8.5 0 1 1 9.8 3.5a7 7 0 0 0 10.7 10.7Z"/>'},Ot=["xs","sm","md","lg","xl"],Nt=["thin","regular","bold"];function F(e){let t=jn[e];return t?`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${t}</svg>`:""}function Vn(e,t){if(t){if(!Ot.includes(t)){console.warn(`fernwell: unknown icon size "${t}" (expected ${Ot.join(", ")})`);return}e.classList.add(`fw-icon-${t}`)}}function Kn(e,t){if(!t)return;if(Nt.includes(t)){e.classList.add(`fw-icon-stroke-${t}`);return}let n=Number(t);if(!Number.isFinite(n)||n<=0){console.warn(`fernwell: unknown icon stroke "${t}" (expected ${Nt.join(", ")} or a positive number)`);return}e.style.setProperty("--fw-icon-stroke",String(n))}function Pe(e=document){e.querySelectorAll("[data-fw-icon]").forEach(t=>{var r;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(r=t.dataset.fwIcon)!=null?r:"",o=F(n);o||console.warn(`fernwell: unknown icon "${n}"`),t.innerHTML=o,t.classList.add("fw-icon"),Vn(t,t.dataset.fwIconSize),Kn(t,t.dataset.fwIconStroke)})}var me={};g(me,{getToken:()=>Ke,init:()=>_e,resetTokens:()=>je,restoreTokens:()=>zt,setTokens:()=>Q});var Ct=[{name:"primary-hover",light:"color-mix(in srgb, var(--fw-primary), var(--fw-text) 12%)",dark:"color-mix(in srgb, var(--fw-primary), var(--fw-text) 12%)",deps:["primary","text"]},{name:"primary-soft",light:"color-mix(in srgb, var(--fw-primary), white 35%)",dark:"color-mix(in srgb, var(--fw-primary), white 35%)",deps:["primary"]},{name:"secondary-hover",light:"color-mix(in srgb, var(--fw-secondary), var(--fw-text) 15%)",dark:"color-mix(in srgb, var(--fw-secondary), var(--fw-text) 15%)",deps:["secondary","text"]},{name:"secondary-bg",light:"color-mix(in srgb, var(--fw-secondary) 10%, var(--fw-surface))",dark:"color-mix(in srgb, var(--fw-secondary) 16%, transparent)",deps:["secondary","surface"]},{name:"success-bg",light:"color-mix(in srgb, var(--fw-success) 12%, var(--fw-surface))",dark:"color-mix(in srgb, var(--fw-success) 14%, transparent)",deps:["success","surface"]},{name:"warning-bg",light:"color-mix(in srgb, var(--fw-warning) 14%, var(--fw-surface))",dark:"color-mix(in srgb, var(--fw-warning) 16%, transparent)",deps:["warning","surface"]},{name:"danger-bg",light:"color-mix(in srgb, var(--fw-danger) 13%, var(--fw-surface))",dark:"color-mix(in srgb, var(--fw-danger) 14%, transparent)",deps:["danger","surface"]},{name:"info-bg",light:"color-mix(in srgb, var(--fw-info) 12%, var(--fw-surface))",dark:"color-mix(in srgb, var(--fw-info) 14%, transparent)",deps:["info","surface"]},{name:"on-secondary-soft",light:"color-mix(in srgb, var(--fw-on-secondary) 72%, transparent)",dark:"color-mix(in srgb, var(--fw-on-secondary) 72%, transparent)",deps:["on-secondary"]},{name:"on-secondary-fill",light:"color-mix(in srgb, var(--fw-on-secondary) 10%, transparent)",dark:"color-mix(in srgb, var(--fw-on-secondary) 10%, transparent)",deps:["on-secondary"]},{name:"on-secondary-line",light:"color-mix(in srgb, var(--fw-on-secondary) 16%, transparent)",dark:"color-mix(in srgb, var(--fw-on-secondary) 16%, transparent)",deps:["on-secondary"]},{name:"focus-ring",light:"0 0 0 4px color-mix(in srgb, var(--fw-primary) 25%, transparent)",dark:"0 0 0 4px color-mix(in srgb, var(--fw-primary) 25%, transparent)",deps:["primary"]},{name:"scrollbar-thumb",light:"var(--fw-text-soft)",dark:"var(--fw-text-soft)",deps:["text-soft"]},{name:"scrollbar-thumb-hover",light:"color-mix(in srgb, var(--fw-text-soft), var(--fw-text) 15%)",dark:"color-mix(in srgb, var(--fw-text-soft), var(--fw-text) 15%)",deps:["text-soft","text"]},{name:"shadow-primary",light:"0 6px 16px color-mix(in srgb, var(--fw-primary) 35%, transparent)",dark:"0 6px 16px color-mix(in srgb, var(--fw-primary) 22%, transparent)",deps:["primary"]},{name:"shadow-success",light:"0 6px 16px color-mix(in srgb, var(--fw-success) 28%, transparent)",dark:"0 6px 16px color-mix(in srgb, var(--fw-success) 22%, transparent)",deps:["success"]}];var Y="--fw-",It="data-fw-tokens",$e="fw-tokens",Dt="fw-tokens-css",_n="fw:tokenschange",ue=":root",N=new Map,le=new Map,fe=!1,zn=0,X=new Map,Fe=new WeakSet;function Vt(){try{return window.localStorage}catch{return null}}function Kt(e){return e.startsWith("--")?e:`${Y}${e}`}function Un(e){return e.startsWith(Y)?e.slice(Y.length):e}function ce(e){console.warn(`fernwell: ${e}`)}function _t(e){try{return document.querySelector(e),!0}catch{return!1}}function Wn(e){let t=0,n="";for(let o=0;o<e.length;o++){let r=e[o];if(r==="\\")o++;else if(n){if(r===n)n="";else if(r===`
3
+ `)return!1}else if(r==='"'||r==="'")n=r;else if(r==="(")t++;else if(r===")"&&--t<0)return!1}return t===0&&!n}function J(e){let t={};if(e===null||typeof e!="object")return t;for(let[n,o]of Object.entries(e))/^(--)?[\w-]+$/.test(n)?typeof o!="string"||/[{};]|\/\*/.test(o)||!Wn(o)?ce(`ignoring invalid value for token "${n}"`):t[Kt(n)]=o.trim():ce(`ignoring token with invalid name "${n}"`);return t}function Zn(e){return Object.values(e).some(t=>t!==null&&typeof t=="object")}function Gn(e){let t=[],n=0,o="",r=0;for(let i=0;i<e.length;i++){let s=e[i];s==="\\"?i++:o?s===o&&(o=""):s==='"'||s==="'"?o=s:s==="("||s==="["?n++:s===")"||s==="]"?n--:s===","&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t.filter(Boolean)}function Jn(e){return e===ue?'[data-theme="dark"]':Gn(e).map(t=>`[data-theme="dark"] ${t}, ${t}[data-theme="dark"]`).join(", ")}function Bt(e){return Object.entries(e).map(([t,n])=>`${t}:${n};`).join("")}function Pt(e,t){let n=new Set(Object.keys(e).map(Un)),o=new Set(n),r={};for(let i=!0;i;){i=!1;for(let s of Ct)n.has(s.name)||`${Y}${s.name}`in r||s.deps.some(c=>o.has(c))&&(r[`${Y}${s.name}`]=s[t],o.add(s.name),i=!0)}return r}function qe(e){let t=[];return e.forEach(({light:n,dark:o},r)=>{let i=r===ue,s=i?n:{...Pt(n,"light"),...n},c=i?o:{...Pt(o,"dark"),...o};Object.keys(s).length&&t.push(`${r}{${Bt(s)}}`),Object.keys(c).length&&t.push(`${Jn(r)}{${Bt(c)}}`)}),t}function $t(e){let t=document.head.querySelector(`style[${It}]`);if(t)return e&&t!==document.head.lastElementChild&&document.head.appendChild(t),t;if(!e)return null;let n=document.createElement("style");return n.setAttribute(It,""),document.head.appendChild(n),n}function Re(){let e=Vt();if(e)try{if(N.size===0){e.removeItem($e),e.removeItem(Dt);return}let t={};N.forEach((n,o)=>t[o]=n),e.setItem($e,JSON.stringify({v:1,scopes:t})),e.setItem(Dt,qe(N).join(`
4
+ `))}catch{}}function de(e){var n;let t=[...qe(N),...qe(le)];t.length===0?(n=$t(!1))==null||n.remove():$t(!0).textContent=t.join(`
5
+ `),document.dispatchEvent(new CustomEvent(_n,{detail:{scope:e}}))}function qt(e,t){let n=new Map(Object.keys(t).map(o=>[o,o in e?e[o]:void 0]));return Object.assign(e,t),()=>n.forEach((o,r)=>{e[r]===t[r]&&(o===void 0?delete e[r]:e[r]=o)})}function Q(e,t={}){var a,m;let n=(a=t.scope)!=null?a:ue;if(!_t(n))return ce(`ignoring tokens for invalid scope "${n}"`),()=>{};fe||Ve();let o,r;Zn(e)?(o=J(e.light),r=J(e.dark)):(o=J(e),r={...o});let i=t.persist?N:le,s=(m=i.get(n))!=null?m:{light:{},dark:{}},c=qt(s.light,o),d=qt(s.dark,r);i.set(n,s),t.persist&&Re(),de(n);let u=!1;return()=>{u||(u=!0,c(),d(),!Object.keys(s.light).length&&!Object.keys(s.dark).length&&i.get(n)===s&&i.delete(n),i===N&&Re(),de(n))}}function je(e){fe||Ve(),X.forEach((n,o)=>{(!e||n.scope===e)&&X.delete(o)});let t=e?N.delete(e):N.size>0;e?le.delete(e):(N.clear(),le.clear()),t&&Re(),de(e)}function zt(){Ve(),de()}function Ve(){var n;fe=!0,N.clear();let e=null;try{let o=(n=Vt())==null?void 0:n.getItem($e);o&&(e=JSON.parse(o))}catch{}let t=e==null?void 0:e.scopes;if((e==null?void 0:e.v)===1&&t&&typeof t=="object")for(let[o,r]of Object.entries(t)){if(!_t(o))continue;let i=J(r==null?void 0:r.light),s=J(r==null?void 0:r.dark);(Object.keys(i).length||Object.keys(s).length)&&N.set(o,{light:i,dark:s})}}function Ke(e,t=document.documentElement){return getComputedStyle(t).getPropertyValue(Kt(e)).trim()}function Rt(e,t){try{let n=JSON.parse(e!=null?e:"");if(n!==null&&typeof n=="object"&&!Array.isArray(n))return n}catch{}return ce(`${t} must be a JSON object of tokens`),null}function Yn(){X.forEach((e,t)=>{t.isConnected||(X.delete(t),Fe.add(t),e.undo())})}function Ft(e){return!!e.dataset.fwTokensBound&&!Fe.has(e)}function jt(e,t,n){e.dataset.fwTokensBound="1",Fe.delete(e),e.isConnected&&X.set(e,{scope:t,undo:n})}function _e(e=document){fe||zt(),Yn(),e.querySelectorAll('script[type="application/json"][data-fw-theme-tokens]').forEach(t=>{var s;if(Ft(t))return;let n=Rt(t.textContent,"data-fw-theme-tokens");if(t.dataset.fwTokensBound="1",!n)return;let o=t.hasAttribute("data-fw-persist"),r=(s=t.dataset.fwScope)!=null?s:ue,i=Q(n,{scope:r,persist:o});o||jt(t,r,i)}),e.querySelectorAll("[data-fw-theme-scope]").forEach(t=>{var i;if(Ft(t))return;let n=Rt(t.getAttribute("data-fw-theme-scope"),"data-fw-theme-scope");if(t.dataset.fwTokensBound="1",!n)return;let o=(i=t.getAttribute("data-fw-scope-id"))!=null?i:`fw-s${++zn}`;t.setAttribute("data-fw-scope-id",o);let r=`[data-fw-scope-id="${o}"]`;jt(t,r,Q(n,{scope:r}))})}var ze="fw-theme",Xn="fw:themechange",Ut="data-fw-theme-init";function Ue(){try{return window.localStorage}catch{return null}}function We(){var t;let e=document.documentElement.getAttribute("data-theme");return e==="dark"||e==="light"?e:(t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}function pe(e,{persist:t=!0}={}){var n;document.documentElement.setAttribute("data-theme",e),t&&((n=Ue())==null||n.setItem(ze,e)),document.querySelectorAll("[data-fw-theme-toggle]").forEach(o=>Zt(o,e)),document.dispatchEvent(new CustomEvent(Xn,{detail:e}))}function Wt(){let e=We()==="dark"?"light":"dark";return pe(e),e}function Zt(e,t){e.setAttribute("aria-pressed",String(t==="dark"));let n=t==="dark"?e.dataset.fwThemeIconDark:e.dataset.fwThemeIconLight,o=t==="dark"?e.dataset.fwThemeLabelDark:e.dataset.fwThemeLabelLight;if(n!==void 0){let r=`<span class="fw-icon" aria-hidden="true">${F(n)}</span>`;e.innerHTML=o!==void 0?`${r} ${o}`:r}else o!==void 0&&(e.textContent=o)}function Qn(e){let t=typeof requestAnimationFrame=="function"?requestAnimationFrame:n=>setTimeout(n,16);t(()=>t(e))}function Ze(e=document){var r,i,s,c;let t=(r=Ue())==null?void 0:r.getItem(ze),n=t==="dark"||t==="light"?t:We(),o=document.documentElement;o.setAttribute(Ut,""),pe(n,{persist:!1}),Qn(()=>o.removeAttribute(Ut)),e.querySelectorAll("[data-fw-theme-toggle]").forEach(d=>{d.dataset.fwBound||(d.dataset.fwBound="1",Zt(d,n),d.addEventListener("click",()=>Wt()))}),(c=(i=window.matchMedia)==null?void 0:(s=i.call(window,"(prefers-color-scheme: dark)")).addEventListener)==null||c.call(s,"change",d=>{var u;(u=Ue())!=null&&u.getItem(ze)||pe(d.matches?"dark":"light",{persist:!1})})}var be={};g(be,{combobox:()=>Gt,init:()=>Ge});var eo=0;function ee(e){return e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function Gt(e,t={}){var b,B,C,z;let n=(b=t.filter)!=null?b:((p,y)=>p.toLowerCase().includes(y)),o=(B=t.emptyText)!=null?B:"No matches",r=(C=t.options)!=null?C:to(e),i=[],s=-1,c=!1,d=e.getAttribute("list");d&&(e.dataset.fwList=d,e.removeAttribute("list"));let u=(z=e.closest(".fw-combobox"))!=null?z:no(e),a=document.createElement("ul"),m=`fw-combobox-${++eo}`;a.className="fw-combobox-list",a.id=m,a.setAttribute("role","listbox"),u.appendChild(a),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",m),e.autocomplete="off";function E(p){i=p,s=-1;let y=e.value.trim().toLowerCase();if(p.length===0){a.innerHTML=`<li class="fw-combobox-empty">${ee(o)}</li>`;return}a.innerHTML=p.map((A,$)=>{let P=y?A.toLowerCase().indexOf(y):-1,G=P>-1?`${ee(A.slice(0,P))}<b>${ee(A.slice(P,P+y.length))}</b>${ee(A.slice(P+y.length))}`:ee(A);return`<li class="fw-combobox-option" role="option" id="${m}-${$}" data-index="${$}" aria-selected="false">${G}</li>`}).join("")}function w(){let p=e.value.trim().toLowerCase();E(p?r.filter(y=>n(y,p)):r),a.classList.add("is-open"),e.setAttribute("aria-expanded","true")}function v(){a.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),e.removeAttribute("aria-activedescendant"),s=-1}function f(p){let y=a.querySelectorAll(".fw-combobox-option");y.forEach($=>{$.classList.remove("is-active"),$.setAttribute("aria-selected","false")});let A=y[p];A&&(A.classList.add("is-active"),A.setAttribute("aria-selected","true"),A.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",A.id)),s=p}function M(p){var y;e.value=p,v(),c=!0,e.focus(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),c=!1,(y=t.onSelect)==null||y.call(t,p)}let k=()=>{c||w()},T=()=>{c||w()},H=p=>{p.key==="ArrowDown"?(p.preventDefault(),a.classList.contains("is-open")||w(),f(Math.min(s+1,i.length-1))):p.key==="ArrowUp"?(p.preventDefault(),f(Math.max(s-1,0))):p.key==="Enter"?s>-1&&i[s]!==void 0&&(p.preventDefault(),M(i[s])):p.key==="Escape"&&v()},x=p=>{let y=p.target.closest(".fw-combobox-option");y&&(p.preventDefault(),M(i[Number(y.dataset.index)]))},L=p=>{u.contains(p.target)||v()};return e.addEventListener("input",k),e.addEventListener("focus",T),e.addEventListener("keydown",H),a.addEventListener("mousedown",x),document.addEventListener("click",L),{open:w,close:v,setOptions(p){r=p,a.classList.contains("is-open")&&w()},destroy(){e.removeEventListener("input",k),e.removeEventListener("focus",T),e.removeEventListener("keydown",H),a.removeEventListener("mousedown",x),document.removeEventListener("click",L),a.remove(),e.dataset.fwList&&e.setAttribute("list",e.dataset.fwList),delete e.dataset.fwBound}}}function to(e){var o;let t=(o=e.getAttribute("list"))!=null?o:e.dataset.fwList,n=t?document.getElementById(t):null;return n?Array.from(n.querySelectorAll("option")).map(r=>r.value||r.textContent||""):[]}function no(e){var n;let t=document.createElement("div");return t.className="fw-combobox",(n=e.parentNode)==null||n.insertBefore(t,e),t.appendChild(e),t}function Ge(e=document){e.querySelectorAll("input[data-fw-combobox]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",Gt(t))})}var we={};g(we,{bindOutsideClickToClose:()=>Ye,close:()=>j,init:()=>tt,open:()=>et,toggle:()=>ro});var V="is-open",Yt="fw-scroll-lock",K=[],Je=new WeakMap,oo='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Xe(e){return typeof e=="string"?document.getElementById(e):e}function Qe(e){if(e.classList.contains("fw-modal-overlay"))return e;let t=e.id?document.querySelector(`[data-fw-drawer-overlay="${e.id}"]`):null;if(t)return t;let n=e.previousElementSibling;return n instanceof HTMLElement&&n.classList.contains("fw-drawer-overlay")?n:null}function et(e,t=(n=>(n=document.activeElement)!=null?n:null)()){var i;let o=Xe(e);if(!o||o.classList.contains(V))return;o.classList.add(V),(i=Qe(o))==null||i.classList.add(V),Je.set(o,t),K.push(o),document.body.classList.add(Yt),o.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}));let r=o.querySelector(oo);r?r.focus({preventScroll:!0}):(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}function j(e){var o,r,i;let t=Xe(e);if(!t||!t.classList.contains(V))return;t.classList.remove(V),(o=Qe(t))==null||o.classList.remove(V);let n=K.indexOf(t);n>-1&&K.splice(n,1),K.length===0&&document.body.classList.remove(Yt),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),(i=(r=Je.get(t))==null?void 0:r.focus)==null||i.call(r,{preventScroll:!0}),Je.delete(t)}function ro(e){let t=Xe(e);t&&(t.classList.contains(V)?j:et)(t)}function Ye(e,t){let n=!1;e.addEventListener("mousedown",o=>{n=o.target===e}),e.addEventListener("click",o=>{o.target===e&&n&&t()})}var Jt=!1;function tt(e=document){e.querySelectorAll("[data-fw-open-modal], [data-fw-open-drawer]").forEach(t=>{var o,r;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=(r=(o=t.dataset.fwOpenModal)!=null?o:t.dataset.fwOpenDrawer)!=null?r:"";t.addEventListener("click",()=>et(n,t))}),e.querySelectorAll(".fw-modal-overlay").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",Ye(t,()=>j(t)),t.querySelectorAll("[data-fw-close-modal]").forEach(n=>n.addEventListener("click",()=>j(t))))}),e.querySelectorAll(".fw-drawer").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=Qe(t);n&&Ye(n,()=>j(t)),t.querySelectorAll("[data-fw-close-drawer]").forEach(o=>o.addEventListener("click",()=>j(t)))}),Jt||(Jt=!0,document.addEventListener("keydown",t=>{t.key==="Escape"&&K.length&&j(K[K.length-1])}))}var ye={};g(ye,{close:()=>he,init:()=>rt,open:()=>Xt});var nt="is-open";function Xt(e){let t=ot(e);t&&(t.classList.add(nt),e.setAttribute("aria-expanded","true"))}function he(e){let t=ot(e);t&&(t.classList.remove(nt),e.setAttribute("aria-expanded","false"))}function ot(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function rt(e=document){e.querySelectorAll("[data-fw-nav-toggle]").forEach(t=>{var r,i;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=ot(t);if(!n)return;let o=(i=(r=t.closest(".fw-nav"))!=null?r:t.parentElement)!=null?i:t;t.addEventListener("click",s=>{s.stopPropagation(),(n.classList.contains(nt)?he:Xt)(t)}),document.addEventListener("click",s=>{!o.contains(s.target)&&!n.contains(s.target)&&he(t)}),document.addEventListener("keydown",s=>{s.key==="Escape"&&he(t)})})}var Ee={};g(Ee,{init:()=>it,resetAll:()=>nn,resetButtonLoading:()=>tn,setButtonLoading:()=>en});var te="fw-btn-loading";function en(e,t){var o,r;if(!e||e.classList.contains(te))return;e.dataset.fwOriginalHtml=e.innerHTML,e.disabled=!0,e.setAttribute("aria-busy","true"),e.classList.add(te);let n=(r=(o=t!=null?t:e.dataset.fwLoadingText)!=null?o:e.textContent)!=null?r:"";e.innerHTML='<span class="fw-spinner fw-spinner-sm" aria-hidden="true"></span>',e.appendChild(document.createTextNode(n))}function tn(e){!e||!e.classList.contains(te)||(e.disabled=!1,e.removeAttribute("aria-busy"),e.classList.remove(te),e.dataset.fwOriginalHtml!==void 0&&(e.innerHTML=e.dataset.fwOriginalHtml,delete e.dataset.fwOriginalHtml))}function nn(e=document){e.querySelectorAll(`.${te}`).forEach(tn)}var Qt=!1;function it(e=document){e.querySelectorAll("form[data-fw-loading]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",t.addEventListener("submit",()=>{let n=t.querySelector('button[type="submit"], button:not([type])');en(n)}))}),Qt||(Qt=!0,window.addEventListener("pageshow",t=>{t.persisted&&nn()}))}var xe={};g(xe,{hide:()=>on,show:()=>so});var S=null,W=null;function io(){return S&&S.isConnected||(S=document.createElement("div"),S.className="fw-toast",S.setAttribute("role","status"),S.setAttribute("aria-live","polite"),S.innerHTML='<span class="fw-toast-dot" aria-hidden="true"></span><span class="fw-toast-text"></span>',document.body.appendChild(S)),S}function so(e,{variant:t="success",duration:n=4e3}={}){let o=io();return o.className=`fw-toast${t==="success"?"":` fw-toast-${t}`}`,o.querySelector(".fw-toast-text").textContent=e,W&&clearTimeout(W),o.classList.remove("is-show"),o.offsetWidth,o.classList.add("is-show"),n>0&&(W=setTimeout(on,n)),o}function on(){S==null||S.classList.remove("is-show"),W&&clearTimeout(W),W=null}var Le={};g(Le,{getSelected:()=>dt,init:()=>ut,selectAll:()=>cn,setRowSelected:()=>ln,sort:()=>st});var ao="is-selected";function at(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function rn(e,t){var o,r,i;let n=e.cells[t];return(i=(r=n==null?void 0:n.dataset.fwSortValue)!=null?r:(o=n==null?void 0:n.textContent)==null?void 0:o.trim())!=null?i:""}function lo(e,t){let n=Number(e),o=Number(t);return e!==""&&t!==""&&Number.isFinite(n)&&Number.isFinite(o)?n-o:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function an(e){var t,n;return Array.from((n=(t=e.tHead)==null?void 0:t.querySelectorAll("th[data-fw-sort]"))!=null?n:[])}function sn(e){return e.getAttribute("aria-sort")==="ascending"?"descending":"ascending"}function st(e,t,n){let o=e.tBodies[0];if(!o)return;let r=Array.from(o.rows),i=r.filter(u=>u.cells.length>t),s=r.filter(u=>u.cells.length<=t),c=n==="ascending"?1:-1;i.sort((u,a)=>c*lo(rn(u,t),rn(a,t))),[...i,...s].forEach(u=>o.appendChild(u));let d=null;an(e).forEach(u=>{let a=u.cellIndex===t;u.setAttribute("aria-sort",a?n:"none"),a&&(d=u)}),d&&at(e,"fw:sort",{column:t,direction:n,th:d})}function Te(e){return Array.from(e.querySelectorAll("tbody input[data-fw-select-row]"))}function lt(e,t){e.classList.toggle(ao,t),e.setAttribute("aria-selected",t?"true":"false")}function ct(e){let t=e.querySelector("[data-fw-select-all]");if(!t)return;let n=Te(e),o=n.filter(r=>r.checked).length;t.checked=o>0&&o===n.length,t.indeterminate=o>0&&o<n.length}function dt(e){return Te(e).filter(t=>t.checked).map(t=>t.closest("tr")).filter(t=>t!==null)}function ln(e,t){let n=e.querySelector("input[data-fw-select-row]");n&&(n.checked=t),lt(e,t);let o=e.closest("table");o&&(ct(o),at(o,"fw:select",{rows:dt(o),all:!1}))}function cn(e,t){Te(e).forEach(n=>{n.checked=t;let o=n.closest("tr");o&&lt(o,t)}),ct(e),at(e,"fw:select",{rows:dt(e),all:!0})}function ut(e=document){e.querySelectorAll("table[data-fw-table]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",an(t).forEach(n=>{n.hasAttribute("aria-sort")||n.setAttribute("aria-sort","none")}),t.addEventListener("click",n=>{let o=n.target.closest("th[data-fw-sort]");o&&t.contains(o)&&st(t,o.cellIndex,sn(o))}),t.addEventListener("keydown",n=>{if(n.key!=="Enter"&&n.key!==" ")return;let o=n.target;if(!o.matches("th[data-fw-sort], th[data-fw-sort] .fw-table-sort"))return;let r=o.closest("th[data-fw-sort]");r&&(n.preventDefault(),st(t,r.cellIndex,sn(r)))}),t.addEventListener("change",n=>{let o=n.target;if(o.matches("[data-fw-select-all]"))cn(t,o.checked);else if(o.matches("[data-fw-select-row]")){let r=o.closest("tr");r&&ln(r,o.checked)}}),Te(t).forEach(n=>{let o=n.closest("tr");o&&n.checked&&lt(o,!0)}),ct(t))})}var ke={};g(ke,{close:()=>Me,collapseAll:()=>po,expandAll:()=>mo,init:()=>ft,open:()=>ge,reveal:()=>fn,toggle:()=>fo});var I=".fw-menu-group",un=".fw-menu-link, .fw-menu-summary",co="is-current";function uo(e,t){e.dispatchEvent(new CustomEvent("fw:toggle",{bubbles:!0,detail:t}))}function ge(e){e.open=!0}function Me(e){e.open=!1}function fo(e,t){e.open=t!=null?t:!e.open}function mo(e){e.querySelectorAll(I).forEach(ge)}function po(e){e.querySelectorAll(I).forEach(Me)}function fn(e){var n,o,r,i;let t=(o=(n=e.parentElement)==null?void 0:n.closest(I))!=null?o:null;for(;t;)ge(t),t=(i=(r=t.parentElement)==null?void 0:r.closest(I))!=null?i:null}function dn(e){e.querySelectorAll(I).forEach(t=>{let n=t.querySelector(":scope > .fw-menu-summary");if(!n)return;let o=!t.open&&t.querySelector("[aria-current]")!==null;n.classList.toggle(co,o)})}function mn(e){return e.matches(".fw-menu-summary")?e.closest(I):null}function pn(e){var n,o,r;return(r=(o=((n=mn(e))!=null?n:e).parentElement)==null?void 0:o.closest(I))!=null?r:null}function vo(e){var t,n;for(let o=pn(e);o;o=(n=(t=o.parentElement)==null?void 0:t.closest(I))!=null?n:null)if(!o.open)return!1;return!0}function bo(e){return Array.from(e.querySelectorAll(un)).filter(vo)}function _(e){return e?(e.focus(),!0):!1}function wo(e){var n;let t=e.closest(".fw-menu-split");return(n=t==null?void 0:t.querySelector(":scope > .fw-menu-group > .fw-menu-summary"))!=null?n:null}function ho(e,t){var c;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;let n=t.target instanceof HTMLElement&&t.target.matches(un)?t.target:null;if(!n||!e.contains(n))return;let o=bo(e),r=o.indexOf(n),i=mn(n),s=!0;switch(t.key){case"ArrowDown":_(o[r+1]);break;case"ArrowUp":_(o[r-1]);break;case"Home":_(o[0]);break;case"End":_(o[o.length-1]);break;case"ArrowRight":i?i.open?i.contains((c=o[r+1])!=null?c:e)&&_(o[r+1]):ge(i):_(wo(n));break;case"ArrowLeft":if(i!=null&&i.open)Me(i);else{let d=pn(n);_(d==null?void 0:d.querySelector(":scope > .fw-menu-summary"))}break;default:s=!1}s&&t.preventDefault()}function ft(e=document){e.querySelectorAll("[data-fw-menu]").forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.hasAttribute("data-fw-menu-exclusive");t.addEventListener("toggle",o=>{let r=o.target;!(r instanceof HTMLDetailsElement)||!r.matches(I)||(n&&r.open&&r.parentElement&&Array.from(r.parentElement.children).forEach(i=>{i!==r&&i instanceof HTMLDetailsElement&&i.matches(I)&&Me(i)}),dn(t),uo(r,{group:r,open:r.open}))},!0),t.addEventListener("keydown",o=>ho(t,o)),t.querySelectorAll("[aria-current]").forEach(fn),dn(t)})}var Se={};g(Se,{init:()=>pt,popover:()=>hn});var yo={top:"bottom",bottom:"top",left:"right",right:"left"},Z=10;function Eo(e){switch(e){case"top-left":return{side:"top",align:"end"};case"top-right":return{side:"top",align:"start"};case"bottom-left":return{side:"bottom",align:"end"};case"bottom-right":return{side:"bottom",align:"start"};default:return{side:e,align:"center"}}}var xo={start:"right",end:"left"};function To(e,t){return t==="center"?e:`${e}-${xo[t]}`}function mt(e,t,n,o){switch(e){case"top":return t.top;case"bottom":return o-t.bottom;case"left":return t.left;case"right":return n-t.right}}function vn(e,t,n,o){switch(e){case"top":return t.top-o-n.height;case"bottom":return t.bottom+o;case"left":return t.left-o-n.width;case"right":return t.right+o}}function bn(e,t,n,o){switch(e){case"start":return t;case"end":return t+n-o;case"center":return t+n/2-o/2}}function He(e,t,n){return Math.min(Math.max(e,t),n>t?n:t)}function Ae(e,t,n={}){var T,H,x;let o=(T=n.placement)!=null?T:"bottom",r=(H=n.offset)!=null?H:8,i=(x=n.padding)!=null?x:8,s=e.getBoundingClientRect(),c=t.getBoundingClientRect(),d=window.innerWidth,u=window.innerHeight,{side:a,align:m}=Eo(o),E=yo[a],w=a==="top"||a==="bottom"?c.height:c.width,v=mt(a,s,d,u)-r<w&&mt(E,s,d,u)-r>mt(a,s,d,u)-r?E:a,f,M,k;return v==="top"||v==="bottom"?(f=vn(v,s,c,r),M=He(bn(m,s.left,s.width,c.width),i,d-c.width-i),k=He(s.left+s.width/2-M,Z,Math.max(c.width-Z,Z))):(M=vn(v,s,c,r),f=He(bn("center",s.top,s.height,c.height),i,u-c.height-i),k=He(s.top+s.height/2-f,Z,Math.max(c.height-Z,Z))),{placement:To(v,m),top:f,left:M,arrowOffset:k}}function wn(e,t){let n=s=>!e.some(c=>c.contains(s)),o=!1,r=s=>{o=n(s.target)},i=s=>{o&&n(s.target)&&t()};return document.addEventListener("mousedown",r,!0),document.addEventListener("click",i,!0),()=>{document.removeEventListener("mousedown",r,!0),document.removeEventListener("click",i,!0)}}var Lo='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function hn(e,t,n={}){var x,L;let o=(x=n.placement)!=null?x:"bottom",r=(L=n.offset)!=null?L:8;e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-controls",t.id),e.setAttribute("aria-expanded","false"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.classList.add("fw-popover");let i=t.parentNode,s=t.nextSibling,c=!1,d=null,u=0;function a(){let b=Ae(e,t,{placement:o,offset:r});t.style.top=`${b.top}px`,t.style.left=`${b.left}px`,t.setAttribute("data-placement",b.placement)}function m(){cancelAnimationFrame(u),u=requestAnimationFrame(a)}function E(b){b.key==="Escape"&&(b.stopPropagation(),f())}function w(b){let B=b.relatedTarget;B&&(t.contains(B)||e.contains(B))||setTimeout(()=>{if(!c)return;let C=document.activeElement;C===document.body||C===null||t.contains(C)||e.contains(C)||f()},0)}function v(){if(c)return;c=!0,t.parentNode!==document.body&&document.body.appendChild(t),a(),t.classList.add("is-open"),e.setAttribute("aria-expanded","true");let b=t.querySelector(Lo);b?b.focus({preventScroll:!0}):(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})),d=wn([e,t],f),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),t.addEventListener("keydown",E),t.addEventListener("focusout",w),t.dispatchEvent(new CustomEvent("fw:open",{bubbles:!0}))}function f(){if(!c)return;c=!1,t.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),d==null||d(),d=null,window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m),t.removeEventListener("keydown",E),t.removeEventListener("focusout",w),cancelAnimationFrame(u),s===null||s.parentNode===i?i.insertBefore(t,s):i.appendChild(t),t.dispatchEvent(new CustomEvent("fw:close",{bubbles:!0})),e.focus({preventScroll:!0})}function M(){(c?f:v)()}let k=()=>M(),T=Array.from(t.querySelectorAll("[data-fw-popover-close]")),H=()=>f();return e.addEventListener("click",k),T.forEach(b=>b.addEventListener("click",H)),{open:v,close:f,toggle:M,destroy(){c&&f(),e.removeEventListener("click",k),T.forEach(b=>b.removeEventListener("click",H)),delete e.dataset.fwBound}}}function pt(e=document){e.querySelectorAll("[data-fw-popover-trigger]").forEach(t=>{var r;if(t.dataset.fwBound)return;let n=(r=t.dataset.fwPopoverTrigger)!=null?r:"",o=document.getElementById(n);if(!o){console.warn(`fernwell: popover trigger references missing panel #${n}`);return}t.dataset.fwBound="1",hn(t,o,{placement:t.dataset.fwPopoverPlacement||void 0,offset:t.dataset.fwPopoverOffset?Number(t.dataset.fwPopoverOffset):void 0})})}var Ne={};g(Ne,{init:()=>wt,tooltip:()=>gn});var go=400,Mo=300,ko=100,oe=new WeakMap,O=null,D=null,re=0,ie=0,bt=0,En=0;function Ho(){if(O&&O.isConnected)return O;let e=document.createElement("div");return e.className="fw-tooltip",e.id="fw-tooltip",e.setAttribute("role","tooltip"),document.body.appendChild(e),e.addEventListener("mouseenter",xn),e.addEventListener("mouseleave",()=>Ln()),O=e,e}function xn(){clearTimeout(ie)}function Tn(){if(!D||!O)return;let e=oe.get(D);if(!e)return;let t=Ae(D,O,{placement:e.placement,offset:e.offset});O.style.top=`${t.top}px`,O.style.left=`${t.left}px`,O.style.setProperty("--fw-tooltip-arrow-pos",`${t.arrowOffset}px`),O.setAttribute("data-placement",t.placement)}function Oe(){cancelAnimationFrame(bt),bt=requestAnimationFrame(Tn)}function yn(e){var o;if(clearTimeout(re),xn(),!oe.get(e))return;D=e;let n=Ho();n.textContent=(o=e.dataset.fwTooltipText)!=null?o:"",Tn(),n.classList.add("is-open"),window.addEventListener("scroll",Oe,!0),window.addEventListener("resize",Oe)}function ne(){clearTimeout(re),clearTimeout(ie),O&&O.classList.remove("is-open"),window.removeEventListener("scroll",Oe,!0),window.removeEventListener("resize",Oe),cancelAnimationFrame(bt),D&&(En=performance.now()),D=null}function vt(e,t){clearTimeout(ie),clearTimeout(re);let n=oe.get(e);n&&(t||performance.now()-En<Mo?yn(e):re=window.setTimeout(()=>yn(e),n.delay))}function Ln(){clearTimeout(re),clearTimeout(ie),ie=window.setTimeout(ne,ko)}function gn(e,t={}){var u,a,m;let n={placement:(u=t.placement)!=null?u:"top",offset:(a=t.offset)!=null?a:6,delay:(m=t.delay)!=null?m:go};oe.set(e,n);let o=e.getAttribute("title");o!==null&&(e.dataset.fwTooltipText=o,e.removeAttribute("title")),e.setAttribute("aria-describedby","fw-tooltip");let r=()=>vt(e,!1),i=()=>Ln(),s=()=>vt(e,!0),c=()=>{D===e&&ne()},d=E=>{E.key==="Escape"&&D===e&&ne()};return e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",i),e.addEventListener("focus",s),e.addEventListener("blur",c),e.addEventListener("keydown",d),{show:()=>vt(e,!0),hide:()=>{D===e&&ne()},destroy(){D===e&&ne(),e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",i),e.removeEventListener("focus",s),e.removeEventListener("blur",c),e.removeEventListener("keydown",d),e.removeAttribute("aria-describedby"),e.dataset.fwTooltipText!==void 0&&(e.setAttribute("title",e.dataset.fwTooltipText),delete e.dataset.fwTooltipText),oe.delete(e),delete e.dataset.fwBound}}}function wt(e=document){e.querySelectorAll("[data-fw-tooltip]").forEach(t=>{t.dataset.fwBound||(t.dataset.fwBound="1",gn(t,{placement:t.dataset.fwTooltipPlacement||void 0,offset:t.dataset.fwTooltipOffset?Number(t.dataset.fwTooltipOffset):void 0,delay:t.dataset.fwTooltipDelay?Number(t.dataset.fwTooltipDelay):void 0}))})}var Ie={};g(Ie,{init:()=>yt,tabs:()=>An});function Ao(e,t){e.dispatchEvent(new CustomEvent("fw:tabs-change",{bubbles:!0,detail:t}))}function Ce(e){return e.getAttribute("aria-disabled")==="true"}function ht(e){let t=e.getAttribute("aria-controls");return t?document.getElementById(t):null}function Mn(e){return e instanceof Element?e.closest('[role="tab"]'):null}function kn(e,t,n){for(let o=1;o<=e.length;o++){let r=((t+n*o)%e.length+e.length)%e.length;if(!Ce(e[r]))return e[r]}}function Hn(e){return e.find(t=>!Ce(t))}function So(e){for(let t=e.length-1;t>=0;t--)if(!Ce(e[t]))return e[t]}function An(e,t={}){var u;let n=(u=t.activation)!=null?u:"automatic";function o(){return Array.from(e.querySelectorAll('[role="tab"]'))}function r(a,m=!1){if(Ce(a))return;o().forEach(w=>{let v=w===a;w.setAttribute("aria-selected",String(v)),w.tabIndex=v?0:-1;let f=ht(w);f&&(f.hidden=!v)}),m&&a.focus();let E=ht(a);E&&Ao(e,{tab:a,panel:E})}function i(a){o().forEach(m=>{m.tabIndex=m===a?0:-1}),a.focus()}function s(){var E;let a=o(),m=(E=a.find(w=>w.getAttribute("aria-selected")==="true"))!=null?E:Hn(a);a.forEach(w=>{let v=w===m;w.setAttribute("aria-selected",String(v)),w.tabIndex=v?0:-1;let f=ht(w);f&&(f.hidden=!v)})}function c(a){let m=Mn(a.target);m&&e.contains(m)&&r(m,!1)}function d(a){let m=Mn(a.target);if(!m)return;let E=o(),w=E.indexOf(m);if(w===-1)return;if(a.key===" "||a.key==="Enter"){n==="manual"&&(a.preventDefault(),r(m,!1));return}let v=e.getAttribute("aria-orientation")==="vertical",f=getComputedStyle(e).direction==="rtl",M=v?"ArrowDown":f?"ArrowLeft":"ArrowRight",k=v?"ArrowUp":f?"ArrowRight":"ArrowLeft",T;if(a.key===M)T=kn(E,w,1);else if(a.key===k)T=kn(E,w,-1);else if(a.key==="Home")T=Hn(E);else if(a.key==="End")T=So(E);else return;T&&(a.preventDefault(),n==="manual"?i(T):r(T,!0))}return e.addEventListener("click",c),e.addEventListener("keydown",d),s(),{activate:r,destroy(){e.removeEventListener("click",c),e.removeEventListener("keydown",d),delete e.dataset.fwBound}}}function yt(e=document){e.querySelectorAll('[role="tablist"][data-fw-tabs]').forEach(t=>{if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.dataset.fwTabsActivation==="manual"?"manual":"automatic";An(t,{activation:n})})}var De={};g(De,{init:()=>Tt,numberInput:()=>On});var Oo=400,No=60,Co=0;function Et(e){if(e==null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}function Sn(e){if(e===void 0)return 0;let t=String(e),n=t.indexOf(".");return n<0?0:t.length-n-1}function On(e,t={}){var gt,Mt,kt,Ht,At,St;let n=t.mode==="slider"?"slider":"stepper",o=n==="slider",r=(gt=t.min)!=null?gt:o?0:void 0,i=(Mt=t.max)!=null?Mt:o?100:void 0,s=(kt=t.step)!=null?kt:1,c=Number.isFinite(s)&&s>0?s:1,d=(Ht=t.unit)!=null?Ht:"",u=Math.max(Sn(c),Sn(r)),a=e.type,m=e.getAttribute("min"),E=e.getAttribute("max"),w=e.getAttribute("step");e.type=o?"range":"number",r!==void 0&&(e.min=String(r)),i!==void 0&&(e.max=String(i)),e.step=String(c),e.id||(e.id=`fw-number-${++Co}`);let v=e.closest(".fw-number"),f=v!=null?v:Io(e),M=!v;f.classList.add(o?"fw-number-slider":"fw-number-stepper"),e.classList.add("fw-number-input");let k=l=>Math.min(i!=null?i:1/0,Math.max(r!=null?r:-1/0,l)),T=l=>Number(l.toFixed(u)),H=()=>e.value.trim()===""?NaN:Number(e.value),x,L,b;if(o)b=document.createElement("output"),b.className="fw-number-value",b.setAttribute("for",e.id),f.appendChild(b);else{let l=e.getAttribute("aria-label");x=B("dec",F("minus"),(At=t.decreaseLabel)!=null?At:l?`Decrease ${l}`:"Decrease"),L=B("inc",F("add"),(St=t.increaseLabel)!=null?St:l?`Increase ${l}`:"Increase"),x.setAttribute("aria-controls",e.id),L.setAttribute("aria-controls",e.id),f.insertBefore(x,e),f.appendChild(L)}function B(l,h,q){let R=document.createElement("button");return R.type="button",R.className=`fw-number-btn fw-number-${l}`,R.setAttribute("aria-label",q),R.innerHTML=`<span class="fw-icon" aria-hidden="true">${h}</span>`,R}function C(){let l=H();if(o&&b){let h=Number.isFinite(l)?`${l}${d}`:"";b.textContent=h,e.setAttribute("aria-valuetext",h);let q=(i!=null?i:100)-(r!=null?r:0),R=Number.isFinite(l)&&q>0?(l-(r!=null?r:0))/q*100:0;e.style.setProperty("--fw-number-fill",`${Math.min(100,Math.max(0,R))}%`)}if(x&&L){let h=Number.isFinite(l)?l:void 0;x.setAttribute("aria-disabled",String(e.disabled||h!==void 0&&r!==void 0&&h<=r)),L.setAttribute("aria-disabled",String(e.disabled||h!==void 0&&i!==void 0&&h>=i))}}function z(l){return l.getAttribute("aria-disabled")==="true"}function p(l){if(!Number.isFinite(l))return;let h=T(k(l));h!==H()&&(e.value=String(h),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}function y(l){if(e.disabled||e.readOnly)return;let h=H();p((Number.isFinite(h)?h:k(0))+l*c)}let A=()=>{var h;C();let l=H();f.dispatchEvent(new CustomEvent("fw:number-change",{bubbles:!0,detail:{value:l,mode:n}})),(h=t.onChange)==null||h.call(t,l)},$=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;let h=!0;switch(l.key){case"ArrowUp":y(1);break;case"ArrowDown":y(-1);break;case"PageUp":y(10);break;case"PageDown":y(-10);break;default:h=!1}h&&l.preventDefault()},P,G,U=()=>{clearTimeout(P),clearInterval(G),P=G=void 0},Lt=l=>l===x?-1:1,Dn=l=>{let h=l.currentTarget;if(l.button>0||z(h))return;let q=Lt(h);y(q),U(),P=setTimeout(()=>{G=setInterval(()=>{if(z(h))return U();y(q)},No)},Oo)},Bn=l=>{let h=l.currentTarget;l.detail!==0||z(h)||y(Lt(h))};if(e.addEventListener("input",A),!o){e.addEventListener("keydown",$);for(let l of[x,L])l&&(l.addEventListener("pointerdown",Dn),l.addEventListener("pointerup",U),l.addEventListener("pointerleave",U),l.addEventListener("pointercancel",U),l.addEventListener("click",Bn))}return C(),{getValue:H,setValue:p,stepUp:(l=1)=>y(l),stepDown:(l=1)=>y(-l),destroy(){U(),e.removeEventListener("input",A),e.removeEventListener("keydown",$),x==null||x.remove(),L==null||L.remove(),b==null||b.remove(),e.style.removeProperty("--fw-number-fill"),e.removeAttribute("aria-valuetext"),e.classList.remove("fw-number-input"),f.classList.remove("fw-number-slider","fw-number-stepper"),e.type=a,xt(e,"min",m),xt(e,"max",E),xt(e,"step",w),M&&f.parentNode&&(f.parentNode.insertBefore(e,f),f.remove()),delete e.dataset.fwBound}}}function xt(e,t,n){n===null?e.removeAttribute(t):e.setAttribute(t,n)}function Io(e){var n;let t=document.createElement("div");return t.className="fw-number",(n=e.parentNode)==null||n.insertBefore(t,e),t.appendChild(e),t}function Tt(e=document){e.querySelectorAll("input[data-fw-number]").forEach(t=>{var o,r,i;if(t.dataset.fwBound)return;t.dataset.fwBound="1";let n=t.dataset;On(t,{mode:n.fwNumberMode==="slider"?"slider":"stepper",min:Et((o=n.fwNumberMin)!=null?o:t.getAttribute("min")),max:Et((r=n.fwNumberMax)!=null?r:t.getAttribute("max")),step:Et((i=n.fwNumberStep)!=null?i:t.getAttribute("step")),unit:n.fwNumberUnit})})}var Nn="0.6.0";function Cn(e=document){Ze(e),_e(e),Ge(e),tt(e),rt(e),it(e),ut(e),ft(e),Pe(e),pt(e),wt(e),yt(e),Tt(e)}var Do={version:Nn,init:Cn,theme:ve,tokens:me,combobox:be,modal:we,nav:ye,loading:Ee,toast:xe,table:Le,menu:ke,icon:ae,popover:Se,tooltip:Ne,tabs:Ie,numberInput:De},se=Do;var In=typeof document!="undefined"?document.currentScript:null;typeof document!="undefined"&&!(In&&In.hasAttribute("data-fw-no-init"))&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>se.init()):se.init());return Fn(Bo);})();
4
6
  Fernwell=Fernwell.default;
5
7
  //# sourceMappingURL=fernwell.iife.js.map