@bquery/bquery 1.8.2 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +255 -27
  2. package/dist/{a11y-DVBCy09c.js → a11y-DG2i4iZN.js} +3 -3
  3. package/dist/{a11y-DVBCy09c.js.map → a11y-DG2i4iZN.js.map} +1 -1
  4. package/dist/a11y.es.mjs +1 -1
  5. package/dist/{component-L3-JfOFz.js → component-DRotf1hl.js} +19 -18
  6. package/dist/{component-L3-JfOFz.js.map → component-DRotf1hl.js.map} +1 -1
  7. package/dist/component.es.mjs +1 -1
  8. package/dist/concurrency/errors.d.ts +29 -0
  9. package/dist/concurrency/errors.d.ts.map +1 -0
  10. package/dist/concurrency/high-level.d.ts +85 -0
  11. package/dist/concurrency/high-level.d.ts.map +1 -0
  12. package/dist/concurrency/index.d.ts +19 -0
  13. package/dist/concurrency/index.d.ts.map +1 -0
  14. package/dist/concurrency/internal.d.ts +26 -0
  15. package/dist/concurrency/internal.d.ts.map +1 -0
  16. package/dist/concurrency/pipeline.d.ts +30 -0
  17. package/dist/concurrency/pipeline.d.ts.map +1 -0
  18. package/dist/concurrency/pool.d.ts +48 -0
  19. package/dist/concurrency/pool.d.ts.map +1 -0
  20. package/dist/concurrency/reactive.d.ts +107 -0
  21. package/dist/concurrency/reactive.d.ts.map +1 -0
  22. package/dist/concurrency/rpc.d.ts +46 -0
  23. package/dist/concurrency/rpc.d.ts.map +1 -0
  24. package/dist/concurrency/support.d.ts +23 -0
  25. package/dist/concurrency/support.d.ts.map +1 -0
  26. package/dist/concurrency/task.d.ts +31 -0
  27. package/dist/concurrency/task.d.ts.map +1 -0
  28. package/dist/concurrency/types.d.ts +343 -0
  29. package/dist/concurrency/types.d.ts.map +1 -0
  30. package/dist/concurrency-BU1wPEsZ.js +826 -0
  31. package/dist/concurrency-BU1wPEsZ.js.map +1 -0
  32. package/dist/concurrency.es.mjs +29 -0
  33. package/dist/{constraints-D5RHQLmP.js → constraints-CqjhmpZC.js} +1 -1
  34. package/dist/{constraints-D5RHQLmP.js.map → constraints-CqjhmpZC.js.map} +1 -1
  35. package/dist/core-CongXJuo.js +87 -0
  36. package/dist/core-CongXJuo.js.map +1 -0
  37. package/dist/{custom-directives-Dr4C5lVV.js → custom-directives-BjFzFhuf.js} +1 -1
  38. package/dist/{custom-directives-Dr4C5lVV.js.map → custom-directives-BjFzFhuf.js.map} +1 -1
  39. package/dist/{devtools-BhB2iDPT.js → devtools-C5FExMwv.js} +2 -2
  40. package/dist/{devtools-BhB2iDPT.js.map → devtools-C5FExMwv.js.map} +1 -1
  41. package/dist/devtools.es.mjs +1 -1
  42. package/dist/{dnd-NwZBYh4l.js → dnd-BAqzPlSo.js} +1 -1
  43. package/dist/{dnd-NwZBYh4l.js.map → dnd-BAqzPlSo.js.map} +1 -1
  44. package/dist/dnd.es.mjs +1 -1
  45. package/dist/effect-Cc51IH91.js +87 -0
  46. package/dist/effect-Cc51IH91.js.map +1 -0
  47. package/dist/{env-CTdvLaH2.js → env-PvwYHnJq.js} +1 -1
  48. package/dist/{env-CTdvLaH2.js.map → env-PvwYHnJq.js.map} +1 -1
  49. package/dist/{forms-UcRHsYxC.js → forms-Dx1Scvh0.js} +30 -29
  50. package/dist/{forms-UcRHsYxC.js.map → forms-Dx1Scvh0.js.map} +1 -1
  51. package/dist/forms.es.mjs +1 -1
  52. package/dist/full.d.ts +6 -4
  53. package/dist/full.d.ts.map +1 -1
  54. package/dist/full.es.mjs +240 -206
  55. package/dist/full.iife.js +117 -33
  56. package/dist/full.iife.js.map +1 -1
  57. package/dist/full.umd.js +117 -33
  58. package/dist/full.umd.js.map +1 -1
  59. package/dist/{i18n-kuF6Ekj6.js → i18n-Cazyk9RD.js} +3 -3
  60. package/dist/{i18n-kuF6Ekj6.js.map → i18n-Cazyk9RD.js.map} +1 -1
  61. package/dist/i18n.es.mjs +1 -1
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.es.mjs +274 -240
  65. package/dist/media/index.d.ts +10 -3
  66. package/dist/media/index.d.ts.map +1 -1
  67. package/dist/media/observers.d.ts +99 -0
  68. package/dist/media/observers.d.ts.map +1 -0
  69. package/dist/media/types.d.ts +125 -0
  70. package/dist/media/types.d.ts.map +1 -1
  71. package/dist/media-dAKIGPk3.js +514 -0
  72. package/dist/media-dAKIGPk3.js.map +1 -0
  73. package/dist/media.es.mjs +12 -9
  74. package/dist/{motion-BJsAuULb.js → motion-BBMso9Ir.js} +1 -1
  75. package/dist/{motion-BJsAuULb.js.map → motion-BBMso9Ir.js.map} +1 -1
  76. package/dist/motion.es.mjs +1 -1
  77. package/dist/mount-C8O2vXkQ.js +450 -0
  78. package/dist/mount-C8O2vXkQ.js.map +1 -0
  79. package/dist/{platform-Dw2gE3zI.js → platform-BPHIXbw8.js} +17 -16
  80. package/dist/{platform-Dw2gE3zI.js.map → platform-BPHIXbw8.js.map} +1 -1
  81. package/dist/platform.es.mjs +1 -1
  82. package/dist/{plugin-C2WuC8SF.js → plugin-DjTqWg-P.js} +2 -2
  83. package/dist/{plugin-C2WuC8SF.js.map → plugin-DjTqWg-P.js.map} +1 -1
  84. package/dist/plugin.es.mjs +1 -1
  85. package/dist/reactive/index.d.ts +2 -2
  86. package/dist/reactive/index.d.ts.map +1 -1
  87. package/dist/reactive/signal.d.ts +2 -1
  88. package/dist/reactive/signal.d.ts.map +1 -1
  89. package/dist/reactive/watch.d.ts +49 -0
  90. package/dist/reactive/watch.d.ts.map +1 -1
  91. package/dist/reactive/websocket.d.ts +6 -3
  92. package/dist/reactive/websocket.d.ts.map +1 -1
  93. package/dist/reactive-BAd2hfl8.js +1171 -0
  94. package/dist/reactive-BAd2hfl8.js.map +1 -0
  95. package/dist/reactive.es.mjs +41 -37
  96. package/dist/readonly-C0ZwS1Tf.js +35 -0
  97. package/dist/readonly-C0ZwS1Tf.js.map +1 -0
  98. package/dist/{registry-B08iilIh.js → registry-Cr6VH8CR.js} +1 -1
  99. package/dist/{registry-B08iilIh.js.map → registry-Cr6VH8CR.js.map} +1 -1
  100. package/dist/{router-CQikC9Ed.js → router-CCepRMpC.js} +29 -28
  101. package/dist/{router-CQikC9Ed.js.map → router-CCepRMpC.js.map} +1 -1
  102. package/dist/router.es.mjs +1 -1
  103. package/dist/{ssr-_dAcGdzu.js → ssr-D-1IPcfw.js} +4 -4
  104. package/dist/{ssr-_dAcGdzu.js.map → ssr-D-1IPcfw.js.map} +1 -1
  105. package/dist/ssr.es.mjs +1 -1
  106. package/dist/{store-Cb3gPRve.js → store-CjmEeX9-.js} +6 -6
  107. package/dist/{store-Cb3gPRve.js.map → store-CjmEeX9-.js.map} +1 -1
  108. package/dist/store.es.mjs +2 -2
  109. package/dist/{testing-C5Sjfsna.js → testing-TdfaL7VE.js} +8 -8
  110. package/dist/{testing-C5Sjfsna.js.map → testing-TdfaL7VE.js.map} +1 -1
  111. package/dist/testing.es.mjs +1 -1
  112. package/dist/{untrack-D0fnO5k2.js → untrack-bjWDNdyE.js} +11 -10
  113. package/dist/{untrack-D0fnO5k2.js.map → untrack-bjWDNdyE.js.map} +1 -1
  114. package/dist/view/directives/aria.d.ts +7 -0
  115. package/dist/view/directives/aria.d.ts.map +1 -0
  116. package/dist/view/directives/error.d.ts +7 -0
  117. package/dist/view/directives/error.d.ts.map +1 -0
  118. package/dist/view/directives/index.d.ts +2 -0
  119. package/dist/view/directives/index.d.ts.map +1 -1
  120. package/dist/view/mount.d.ts.map +1 -1
  121. package/dist/view/process.d.ts +2 -0
  122. package/dist/view/process.d.ts.map +1 -1
  123. package/dist/view.es.mjs +12 -11
  124. package/package.json +18 -14
  125. package/src/concurrency/errors.ts +57 -0
  126. package/src/concurrency/high-level.ts +387 -0
  127. package/src/concurrency/index.ts +63 -0
  128. package/src/concurrency/internal.ts +100 -0
  129. package/src/concurrency/pipeline.ts +133 -0
  130. package/src/concurrency/pool.ts +450 -0
  131. package/src/concurrency/reactive.ts +339 -0
  132. package/src/concurrency/rpc.ts +380 -0
  133. package/src/concurrency/support.ts +44 -0
  134. package/src/concurrency/task.ts +318 -0
  135. package/src/concurrency/types.ts +431 -0
  136. package/src/full.ts +77 -0
  137. package/src/index.ts +3 -0
  138. package/src/media/index.ts +20 -2
  139. package/src/media/observers.ts +418 -0
  140. package/src/media/types.ts +136 -0
  141. package/src/reactive/index.ts +3 -0
  142. package/src/reactive/signal.ts +2 -1
  143. package/src/reactive/watch.ts +138 -0
  144. package/src/reactive/websocket.ts +31 -8
  145. package/src/view/directives/aria.ts +72 -0
  146. package/src/view/directives/error.ts +56 -0
  147. package/src/view/directives/index.ts +2 -0
  148. package/src/view/mount.ts +4 -0
  149. package/src/view/process.ts +6 -0
  150. package/dist/core-DdtZHzsS.js +0 -168
  151. package/dist/core-DdtZHzsS.js.map +0 -1
  152. package/dist/media-i-fB5WxI.js +0 -340
  153. package/dist/media-i-fB5WxI.js.map +0 -1
  154. package/dist/mount-B4Y8bk8Z.js +0 -403
  155. package/dist/mount-B4Y8bk8Z.js.map +0 -1
  156. package/dist/reactive-DwkhUJfP.js +0 -1148
  157. package/dist/reactive-DwkhUJfP.js.map +0 -1
package/dist/full.iife.js CHANGED
@@ -1,10 +1,94 @@
1
- var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Module"});var Ht="bquery-sanitizer",rs=new Set(["a","abbr","address","article","aside","b","bdi","bdo","blockquote","br","button","caption","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","input","ins","kbd","label","legend","li","main","mark","nav","ol","optgroup","option","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","wbr"]),Ut=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),ns=new Set(["document","window","location","top","self","parent","frames","history","navigator","screen","alert","confirm","prompt","eval","function","cookie","domain","referrer","body","head","forms","images","links","scripts","children","parentnode","firstchild","lastchild","innerhtml","outerhtml","textcontent"]),ss=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),os=["on","formaction","xlink:","xmlns:"],Qt=["javascript:","data:","vbscript:","file:"],is=(e,t,r)=>{const n=e.toLowerCase();for(const s of os)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},as=e=>{const t=e.toLowerCase().trim();return!ns.has(t)},ls=e=>e.replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),Vt=e=>{const t=ls(e);for(const r of Qt)if(t.startsWith(r))return!1;return!0},cs=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!Vt(n))return!1}return!0},us=e=>{try{const t=e.trim();if(t.startsWith("//"))return!0;const r=t.toLowerCase();return/^[a-z][a-z0-9+.-]*:/i.test(t)&&!r.startsWith("http://")&&!r.startsWith("https://")?!0:!r.startsWith("http://")&&!r.startsWith("https://")?!1:typeof window>"u"||!window.location?!0:new URL(t,window.location.href).origin!==window.location.origin}catch{return!0}},fs=e=>new DOMParser().parseFromString(e,"text/html"),Wt=e=>{const t=(typeof e=="string"?e:String(e??"")).trim(),r=document.createDocumentFragment();if(t.length===0)return r;if(!(t.includes("<")||t.includes(">")))return r.appendChild(document.createTextNode(t)),r;const n=fs(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},We=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:o=!1}=t,i=new Set([...rs,...r.map(c=>c.toLowerCase())].filter(c=>!Ut.has(c))),a=new Set([...ss,...n.map(c=>c.toLowerCase())]),l=Wt(e);if(o)return l.textContent??"";const f=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT),u=[];for(;f.nextNode();){const c=f.currentNode,m=c.tagName.toLowerCase();if(Ut.has(m)){u.push(c);continue}if(!i.has(m)){u.push(c);continue}const g=[];for(const b of Array.from(c.attributes)){const v=b.name.toLowerCase();if(!is(v,a,s)){g.push(b.name);continue}if((v==="id"||v==="name")&&!as(b.value)){g.push(b.name);continue}if((v==="href"||v==="src"||v==="action")&&!Vt(b.value)){g.push(b.name);continue}v==="srcset"&&!cs(b.value)&&g.push(b.name)}for(const b of g)c.removeAttribute(b);if(m==="a"){const b=c.getAttribute("href"),v=c.getAttribute("target")?.toLowerCase()==="_blank",w=b&&us(b);if(v||w){const E=c.getAttribute("rel"),L=new Set(E?E.split(/\s+/).filter(Boolean):[]);L.add("noopener"),L.add("noreferrer"),c.setAttribute("rel",Array.from(L).join(" "))}}}for(const c of u)c.remove();const h=c=>{const m=document.createElement("div");return m.appendChild(c.cloneNode(!0)),m.innerHTML},d=h(l),p=h(Wt(d));return d!==p?l.textContent??"":p},Kt=Symbol("bquery.trusted-html.brand"),ut=Symbol("bquery.trusted-html"),Yt=e=>e,ds=e=>{const t=String(e);return Object.freeze({[Kt]:!0,[ut]:t,toString:()=>t})},hs=e=>typeof e=="object"&&e!==null&&Kt in e&&ut in e,ms=e=>e[ut],Gt=1024,Jt=8192,ps=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>Gt)throw new RangeError(`generateNonce length must not exceed ${Gt}`);if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function")throw new Error("generateNonce requires crypto.getRandomValues (not available in this environment)");if(typeof globalThis.btoa!="function")throw new Error("generateNonce requires btoa (not available in this environment)");const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);let r="";for(let n=0;n<t.length;n+=Jt){const s=t.subarray(n,Math.min(n+Jt,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},vs=e=>{if(typeof document>"u")return!1;const t=document.querySelector('meta[http-equiv="Content-Security-Policy"]');return t?(t.getAttribute("content")??"").includes(e):!1},Ke=null,Xt=!1,ys=()=>typeof window<"u"&&typeof window.trustedTypes<"u",Zt=()=>{if(Ke)return Ke;if(Xt||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;Xt=!0;try{return Ke=e.trustedTypes.createPolicy(Ht,{createHTML:t=>We(t)}),Ke}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${Ht}": ${r}`),null}},gs=e=>{const t=Zt();return t?t.createHTML(e):We(e)},J=(e,t={})=>Yt(We(e,t)),er=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return e.replace(/[&<>"'`]/g,r=>t[r])},bs=e=>We(e,{stripAllTags:!0}),tr=e=>Array.isArray(e)?e:[e],q=(e,t)=>{for(const r of e)t(r)},fe=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},Ye=(e,t)=>fe(e)?t==="width"?e.clientWidth:e.clientHeight:0,Ge=(e,t,r)=>{if(!fe(e))return 0;const n=t==="width"?e.offsetWidth:e.offsetHeight;if(!r)return n;const s=e.ownerDocument?.defaultView;if(!s||typeof s.getComputedStyle!="function")return n;const o=s.getComputedStyle(e),i=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-left":"margin-top")),a=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-right":"margin-bottom")),l=Number.isNaN(i)?0:i,f=Number.isNaN(a)?0:a;return n+l+f},rr=e=>J(e),ws=(e,t)=>{e.innerHTML=J(t)},nr=e=>{const t=document.createElement("template");return t.innerHTML=J(e),t.content.firstElementChild??document.createElement("div")},sr=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,J(t));return}const n=tr(t);q(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})};function de(e){return Object.prototype.toString.call(e)==="[object Object]"}function x(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function Es(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function he(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))x(n)||(de(s)&&de(t[n])?t[n]=he(t[n],s):t[n]=s);return t}function Ss(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function As(e,t){const r={...e};for(const n of t)delete r[n];return r}function Cs(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ts=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},or=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!Ts(n))continue;const s=n.name;if(!(!s||n.disabled||x(s))){if(n.tagName.toLowerCase()==="input"){const o=n,i=o.type.toLowerCase();if(i==="checkbox"||i==="radio"){o.checked&&t.push([s,o.value]);continue}if(i==="file"||i==="submit"||i==="button"||i==="reset"||i==="image")continue;t.push([s,o.value]);continue}if(n.tagName.toLowerCase()==="select"){const o=n;if(o.multiple)for(const i of Array.from(o.selectedOptions))t.push([s,i.value]);else t.push([s,o.value]);continue}t.push([s,n.value])}}return t},ir=e=>{if(typeof FormData=="function")try{const t=[];for(const[r,n]of new FormData(e).entries())x(r)||typeof n!="string"||t.push([r,n]);return t.length>0?t:or(e)}catch{}return or(e)},me=class Bt{constructor(t){this.element=t,this.delegatedHandlers=new Map}get raw(){return this.element}get node(){return this.element}addClass(...t){return this.element.classList.add(...t),this}removeClass(...t){return this.element.classList.remove(...t),this}toggleClass(t,r){return this.element.classList.toggle(t,r),this}attr(t,r){return r===void 0?this.element.getAttribute(t)??"":(this.element.setAttribute(t,r),this)}removeAttr(t){return this.element.removeAttribute(t),this}toggleAttr(t,r){const n=this.element.hasAttribute(t);return r??!n?this.element.setAttribute(t,""):this.element.removeAttribute(t),this}prop(t,r){return r===void 0?this.element[t]:(this.element[t]=r,this)}data(t,r){const n=t.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`);return r===void 0?this.element.getAttribute(`data-${n}`)??"":(this.element.setAttribute(`data-${n}`,r),this)}text(t){return t===void 0?this.element.textContent??"":(this.element.textContent=t,this)}html(t){return ws(this.element,t),this}htmlUnsafe(t){return this.element.innerHTML=t,this}css(t,r){if(typeof t=="string"){if(r!==void 0)return this.element.style.setProperty(t,r),this;const n=this.element.ownerDocument?.defaultView;return!n||typeof n.getComputedStyle!="function"?"":n.getComputedStyle(this.element).getPropertyValue(t)}for(const[n,s]of Object.entries(t))this.element.style.setProperty(n,s);return this}append(t){return this.insertContent(t,"beforeend"),this}prepend(t){return this.insertContent(t,"afterbegin"),this}before(t){return this.insertContent(t,"beforebegin"),this}after(t){return this.insertContent(t,"afterend"),this}wrap(t){const r=typeof t=="string"?document.createElement(t):t;return this.element.parentNode?.insertBefore(r,this.element),r.appendChild(this.element),this}unwrap(){const t=this.element.parentElement;return t&&t.parentNode&&(t.parentNode.insertBefore(this.element,t),t.remove()),this}replaceWith(t){const r=typeof t=="string"?nr(t):t;return this.element.replaceWith(r),new Bt(r)}detach(){return this.remove()}index(){const t=this.element.parentElement;return t?Array.from(t.children).indexOf(this.element):-1}contents(){return Array.from(this.element.childNodes)}offsetParent(){return fe(this.element)?this.element.offsetParent:null}position(){if(!fe(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}innerWidth(){return Ye(this.element,"width")}innerHeight(){return Ye(this.element,"height")}outerWidth(t=!1){return Ge(this.element,"width",t)}outerHeight(t=!1){return Ge(this.element,"height",t)}scrollTo(t={behavior:"smooth"}){return this.element.scrollIntoView(t),this}remove(){return this.element.remove(),this}empty(){return this.element.innerHTML="",this}clone(t=!0){return new Bt(this.element.cloneNode(t))}find(t){return Array.from(this.element.querySelectorAll(t))}findOne(t){return this.element.querySelector(t)}closest(t){return this.element.closest(t)}parent(){return this.element.parentElement}children(){return Array.from(this.element.children)}siblings(){const t=this.element.parentElement;return t?Array.from(t.children).filter(r=>r!==this.element):[]}next(){return this.element.nextElementSibling}prev(){return this.element.previousElementSibling}on(t,r){return this.element.addEventListener(t,r),this}once(t,r){return this.element.addEventListener(t,r,{once:!0}),this}off(t,r){return this.element.removeEventListener(t,r),this}trigger(t,r){return this.element.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0})),this}delegate(t,r,n){const s=`${t}:${r}`,o=i=>{const a=i.target.closest(r);a&&this.element.contains(a)&&n(i,a)};return this.delegatedHandlers.has(s)||this.delegatedHandlers.set(s,new Map),this.delegatedHandlers.get(s).set(n,o),this.element.addEventListener(t,o),this}undelegate(t,r,n){const s=`${t}:${r}`,o=this.delegatedHandlers.get(s);if(o){const i=o.get(n);i&&(this.element.removeEventListener(t,i),o.delete(n),o.size===0&&this.delegatedHandlers.delete(s))}return this}matches(t){return this.element.matches(t)}is(t){return this.matches(t)}hasClass(t){return this.element.classList.contains(t)}show(t=""){return this.element.removeAttribute("hidden"),this.element.style.display=t,this}hide(){return this.element.style.display="none",this}toggle(t){const r=this.element.style.display==="none";return t??r?this.show():this.hide()}focus(){return this.element.focus(),this}blur(){return this.element.blur(),this}val(t){const r=this.element;return t===void 0?r.value??"":(r.value=t,this)}serialize(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return{};const r=Object.create(null);for(const[n,s]of ir(t))if(Object.prototype.hasOwnProperty.call(r,n)){const o=r[n];Array.isArray(o)?o.push(s):r[n]=[o,s]}else r[n]=s;return r}serializeString(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return"";const r=new URLSearchParams;for(const[n,s]of ir(t))r.append(n,s);return r.toString()}rect(){return this.element.getBoundingClientRect()}offset(){const t=this.element;return{width:t.offsetWidth,height:t.offsetHeight,top:t.offsetTop,left:t.offsetLeft}}insertContent(t,r){sr(this.element,t,r)}},Je=class G{constructor(t){this.elements=t,this.delegatedHandlers=new WeakMap}get length(){return this.elements.length}first(){return this.elements[0]}eq(t){const r=this.elements[t];return r?new me(r):void 0}firstEl(){return this.eq(0)}lastEl(){return this.eq(this.elements.length-1)}each(t){return this.elements.forEach((r,n)=>{t(new me(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new G(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new me(t))}addClass(...t){return q(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return q(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return q(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(q(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return q(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return q(this.elements,n=>{const s=n.hasAttribute(t);r??!s?n.setAttribute(t,""):n.removeAttribute(t)}),this}text(t){return t===void 0?this.first()?.textContent??"":(q(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=rr(t);return q(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return q(this.elements,r=>{r.innerHTML=t}),this}append(t){return this.insertAll(t,"beforeend"),this}prepend(t){return this.insertAll(t,"afterbegin"),this}before(t){return this.insertAll(t,"beforebegin"),this}after(t){return this.insertAll(t,"afterend"),this}css(t,r){if(typeof t=="string"){if(r!==void 0)return q(this.elements,o=>{o.style.setProperty(t,r)}),this;const n=this.first();if(!n)return"";const s=n.ownerDocument?.defaultView;return!s||typeof s.getComputedStyle!="function"?"":s.getComputedStyle(n).getPropertyValue(t)}return q(this.elements,n=>{for(const[s,o]of Object.entries(t))n.style.setProperty(s,o)}),this}wrap(t){return this.elements.forEach((r,n)=>{const s=typeof t=="string"?document.createElement(t):n===0?t:t.cloneNode(!0);r.parentNode?.insertBefore(s,r),s.appendChild(r)}),this}unwrap(){const t=new Set;for(const r of this.elements)r.parentElement&&t.add(r.parentElement);return t.forEach(r=>{const n=r.parentNode;if(n){for(;r.firstChild;)n.insertBefore(r.firstChild,r);r.remove()}}),this}replaceWith(t){const r=[];return this.elements.forEach((n,s)=>{const o=typeof t=="string"?nr(t):s===0?t:t.cloneNode(!0);n.replaceWith(o),r.push(o)}),new G(r)}detach(){return this.remove()}index(){const t=this.first();return t?.parentElement?Array.from(t.parentElement.children).indexOf(t):-1}contents(){return Array.from(this.first()?.childNodes??[])}offsetParent(){const t=this.first();return fe(t)?t.offsetParent:null}position(){const t=this.first();return fe(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}innerWidth(){return Ye(this.first(),"width")}innerHeight(){return Ye(this.first(),"height")}outerWidth(t=!1){return Ge(this.first(),"width",t)}outerHeight(t=!1){return Ge(this.first(),"height",t)}show(t=""){return q(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return q(this.elements,t=>{t.style.display="none"}),this}on(t,r){return q(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return q(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return q(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return q(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return q(this.elements,o=>{const i=l=>{const f=l.target.closest(r);f&&o.contains(f)&&n(l,f)};this.delegatedHandlers.has(o)||this.delegatedHandlers.set(o,new Map);const a=this.delegatedHandlers.get(o);a.has(s)||a.set(s,new Map),a.get(s).set(n,i),o.addEventListener(t,i)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return q(this.elements,o=>{const i=this.delegatedHandlers.get(o);if(!i)return;const a=i.get(s);if(!a)return;const l=a.get(n);l&&(o.removeEventListener(t,l),a.delete(n),a.size===0&&i.delete(s),i.size===0&&this.delegatedHandlers.delete(o))}),this}find(t){const r=new Set,n=[];for(const s of this.elements){const o=s.querySelectorAll(t);for(let i=0;i<o.length;i++)r.has(o[i])||(r.add(o[i]),n.push(o[i]))}return new G(n)}closest(t){const r=new Set,n=[];for(const s of this.elements){const o=s.closest(t);o&&!r.has(o)&&(r.add(o),n.push(o))}return new G(n)}parent(){const t=new Set,r=[];for(const n of this.elements){const s=n.parentElement;s&&!t.has(s)&&(t.add(s),r.push(s))}return new G(r)}children(){const t=new Set,r=[];for(const n of this.elements)for(const s of Array.from(n.children))t.has(s)||(t.add(s),r.push(s));return new G(r)}siblings(){const t=new Set(this.elements),r=new Set,n=[];for(const s of this.elements){const o=s.parentElement;if(o)for(const i of Array.from(o.children))!t.has(i)&&!r.has(i)&&(r.add(i),n.push(i))}return new G(n)}next(){const t=new Set,r=[];for(const n of this.elements){const s=n.nextElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new G(r)}prev(){const t=new Set,r=[];for(const n of this.elements){const s=n.previousElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new G(r)}remove(){return q(this.elements,t=>t.remove()),this}empty(){return q(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=rr(t);q(this.elements,o=>{o.insertAdjacentHTML(r,s)});return}const n=tr(t);this.elements.forEach((s,o)=>{sr(s,o===0?n:n.map(i=>i.cloneNode(!0)),r)})}},ks=e=>{if(typeof e!="string")return new me(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new me(t)},Ls=e=>Array.isArray(e)?new Je(e):e instanceof NodeList?new Je(Array.from(e)):new Je(Array.from(document.querySelectorAll(e)));function $s(e){return e==null?[]:Array.isArray(e)?e:[e]}function Os(e){return Array.from(new Set(e))}function Rs(e,t){if(t<=0)return[];const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Ms(e){return e.filter(Boolean)}function Ds(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function ar(e,t){let r;return Object.assign((...n)=>{r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,e(...n)},t)},{cancel:()=>{r!==void 0&&(clearTimeout(r),r=void 0)}})}function Ns(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function Ps(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function Is(){}function _s(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function qs(e){return new Promise(t=>setTimeout(t,e))}function xs(e,t){try{return JSON.parse(e)}catch{return t}}function js(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function zs(e,t){return Math.floor(Math.random()*(t-e+1))+e}function Fs(e,t,r){return Math.min(Math.max(e,t),r)}function Bs(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function Hs(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function Us(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Qs(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function Vs(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function Ws(e,t,r="…"){if(t<=0)return"";if(e.length<=t)return e;const n=Math.max(0,t-r.length);return`${e.slice(0,n)}${r}`}function Ks(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function Ys(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gs(e){return typeof Element<"u"&&e instanceof Element}function Js(e){return!!(e&&typeof e=="object"&&"elements"in e)}function Xs(e){return typeof e=="function"}function Zs(e){return typeof e=="string"}function eo(e){return typeof e=="number"&&!Number.isNaN(e)}function to(e){return typeof e=="boolean"}function ro(e){return Array.isArray(e)}function no(e){return e instanceof Date}function Ce(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function so(e){return typeof e=="object"&&e!==null}var oo={clone:Es,merge:he,pick:Ss,omit:As,hasOwn:Cs,debounce:ar,throttle:Ns,once:Ps,noop:Is,uid:_s,isElement:Gs,isCollection:Js,isEmpty:js,isPlainObject:de,isFunction:Xs,isString:Zs,isNumber:eo,isBoolean:to,isArray:ro,isDate:no,isPromise:Ce,isObject:so,parseJson:xs,sleep:qs,randomInt:zs,clamp:Fs,inRange:Bs,toNumber:Hs,capitalize:Us,toKebabCase:Qs,toCamelCase:Vs,truncate:Ws,slugify:Ks,escapeRegExp:Ys,ensureArray:$s,unique:Os,chunk:Rs,compact:Ms,flatten:Ds},pe=[],Te=0,ft=new Set,Xe=new WeakMap,dt=(e,t)=>{pe.push(e);try{return t()}finally{pe.pop()}},lr=()=>pe[pe.length-1],ht=e=>{pe.push(void 0);try{return e()}finally{pe.pop()}},cr=e=>{if(Te>0){ft.add(e);return}e()},io=()=>{for(const e of Array.from(ft)){ft.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},ao=()=>{Te+=1},lo=()=>{Te<=0||(Te-=1,Te===0&&io())},ur=(e,t)=>{let r=Xe.get(e);r||(r=new Set,Xe.set(e,r)),r.add(t)},co=(e,t)=>{const r=Xe.get(e);r&&r.delete(t)},ke=e=>{const t=Xe.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},Le=e=>{ao();try{e()}finally{lo()}},fr={fetch:{headers:{},parseAs:"json"},cookies:{path:"/",sameSite:"Lax",secure:!1},announcer:{politeness:"polite",atomic:!0,delay:16,clearDelay:1e3},pageMeta:{},transitions:{skipOnReducedMotion:!1,classes:[],types:[]},components:{prefix:"bq"}},$e=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>$e(t));if(de(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=$e(n);return t}return e},mt=$e(fr),uo=e=>(mt=$e(he(fr,mt,e)),X()),X=()=>$e(mt),Oe=[],Ze=e=>typeof e=="object"&&e!==null&&"_addDisposer"in e,fo=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",ho=e=>{const t=typeof e.constructor=="function"?e.constructor.name:void 0;return typeof e=="function"&&(Symbol.toStringTag in e&&e[Symbol.toStringTag]==="AsyncFunction"||t==="AsyncFunction")},Re=()=>{for(let e=Oe.length-1;e>=0;e--)if(Oe[e].active)return Oe[e]},mo=class{constructor(){this.disposers=[],this._active=!0}get active(){return this._active}_addDisposer(e){this._active&&this.disposers.push(e)}run(e){if(!this._active)throw new Error("bQuery reactive: Cannot run in a stopped effectScope");if(ho(e))throw new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");Oe.push(this);try{const t=e();if(fo(t))throw this.stop(),new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");return t}finally{Oe.pop()}}stop(){if(this._active){this._active=!1;for(let e=this.disposers.length-1;e>=0;e--)try{this.disposers[e]()}catch(t){console.error("bQuery reactive: Error in scope cleanup",t)}this.disposers.length=0}}},po=()=>{const e=new mo,t=Re();return Ze(t)&&t._addDisposer(()=>e.stop()),e},vo=()=>Re(),yo=e=>{const t=Re();if(!t||!t.active||!Ze(t))throw new Error("bQuery reactive: onScopeDispose() must be called inside an active effectScope");t._addDisposer(e)},Me=class{constructor(e){this.compute=e,this.hasCachedValue=!1,this.dirty=!0,this.disposed=!1,this.subscribers=new Set,this.markDirty=()=>{if(this.disposed)return;this.dirty=!0;const t=Array.from(this.subscribers);for(const r of t)cr(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=ht(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=lr();return e&&(this.subscribers.add(e),ur(e,this)),this.dirty&&(this.dirty=!1,ke(this.markDirty),this.cachedValue=dt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=ht(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,ke(this.markDirty),this.cachedValue=dt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue)}unsubscribe(e){this.subscribers.delete(e)}dispose(){this.disposed=!0,this.dirty&&(this.hasCachedValue=!1),this.dirty=!1,ke(this.markDirty),this.subscribers.clear()}},P=e=>{const t=new Me(e),r=Re();return Ze(r)&&r._addDisposer(()=>t.dispose()),t},j=e=>{let t,r=!1;const n=Re(),s=()=>{if(t){try{t()}catch(l){console.error("bQuery reactive: Error in effect cleanup",l)}t=void 0}},o=()=>{s(),ke(a)},i=()=>{r||(r=!0,o())};Ze(n)&&n._addDisposer(i);const a=()=>{if(!r){s(),ke(a);try{t=dt(a,e)}catch(l){console.error("bQuery reactive: Error in effect",l)}r&&o()}};return a(),i},De=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=lr();return e&&(this.subscribers.add(e),ur(e,this)),this._value}set value(e){if(Object.is(this._value,e))return;this._value=e;const t=Array.from(this.subscribers);for(const r of t)cr(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)co(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},M=e=>new De(e),ae=e=>ht(e),go=e=>{if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);try{return new Error(JSON.stringify(e))}catch{return new Error(String(e))}},bo=e=>typeof e=="function"?e():e.value,dr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},wo=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),Eo=(e,t)=>e==null||wo(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),So=e=>typeof e=="function"?e():e,Ao=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},Co=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return e instanceof URL?new URL(e.toString(),n):new URL(e,n)},To=async(e,t)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const r=await e.text();if(r)try{return JSON.parse(r)}catch(n){const s=e.url?` for ${e.url}`:"";throw new Error(`Failed to parse JSON response${s} (status ${e.status}): ${n instanceof Error?n.message:String(n)}`)}},pt=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},ko=(e,t,r)=>{const n=t instanceof Request?pt(t.method):void 0;return e??n??(r?"POST":void 0)},Lo=(e,t,r)=>e||(t instanceof Request?void 0:r),$o=e=>{const t=pt(e.method);let r;if(t!=="GET"&&t!=="HEAD"&&!e.bodyUsed)try{r=e.clone().body??void 0}catch{r=void 0}return{method:t,headers:e.headers,body:r,cache:e.cache,credentials:e.credentials,integrity:e.integrity,keepalive:e.keepalive,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,signal:e.signal}},hr=(e,t={})=>{const r=t.immediate??!0,n=M(t.defaultValue),s=M(null),o=M("idle"),i=P(()=>o.value==="pending");let a=0,l=!1,f=()=>{};const u=()=>{a+=1,n.value=t.defaultValue,s.value=null,o.value="idle"},h=()=>{l||(l=!0,a+=1,f())},d=async()=>{if(l)return n.peek();const p=++a;o.value="pending",s.value=null;try{const c=await e(),m=t.transform?t.transform(c):c;return l||p!==a?n.peek():(n.value=m,o.value="success",t.onSuccess?.(m),m)}catch(c){const m=go(c);return l||p!==a||(s.value=m,o.value="error",t.onError?.(m)),n.peek()}};if(t.watch?.length){let p=!1;f=j(()=>{for(const c of t.watch??[])bo(c);if(!p){p=!0,r&&ae(()=>d());return}ae(()=>d())})}else r&&d();return{data:n,error:s,status:o,pending:i,execute:d,refresh:d,abort:()=>{},clear:u,dispose:h}},Oo=e=>e>=200&&e<300,mr=(e,t)=>e instanceof DOMException&&e.name===t,et=e=>mr(e,"TimeoutError"),pr=e=>mr(e,"AbortError"),Ro=e=>{if(pr(e)||et(e)||e.code==="ABORT"||e.code==="TIMEOUT")return!1;const t=e.status;return t===void 0||t>=500},Mo=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},Do=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),No=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s=!1,o;const i=()=>{s||(s=!0,clearTimeout(o),t?.removeEventListener("abort",i),n(t?.reason??new DOMException("The operation was aborted.","AbortError")))};o=setTimeout(()=>{s||(s=!0,t?.removeEventListener("abort",i),r())},e),t?.addEventListener("abort",i,{once:!0})}),W=(e,t={})=>{const r=X().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch,o=t.validateStatus??Oo;let i=null;const a=(f,u)=>{const h=u||et(f)||et(i?.signal.reason);return Object.assign(new Error(h?`Request timeout of ${t.timeout}ms exceeded`:"Request aborted"),{code:h?"TIMEOUT":"ABORT"})},l=hr(async()=>{const f=So(e),u=typeof f=="string"||f instanceof URL?Co(f,t.baseUrl??r?.baseUrl):f instanceof Request&&t.query?new URL(f.url):null;u&&t.query&&Ao(u,t.query);const h=dr(r?.headers,f instanceof Request?f.headers:void 0,t.headers),d=t.body!=null,p=pt(t.method),c=ko(p,f,d),m=c==="GET"||c==="HEAD"?c:null;if(d&&m)throw new Error(`Cannot send a request body with ${m} requests`);const g=Lo(p,f,c),b=Mo(t.retry),v=(b?.count??0)+1,w=new AbortController;i=w;let E,L=!1,A;t.signal&&(t.signal.aborted?w.abort(t.signal.reason):(A=()=>w.abort(t.signal?.reason),t.signal.addEventListener("abort",A,{once:!0}))),t.timeout&&t.timeout>0&&(E=setTimeout(()=>{L=!0,w.abort(new DOMException("Request timeout","TimeoutError"))},t.timeout));const S={...t,method:g,headers:h};delete S.baseUrl,delete S.query,delete S.parseAs,delete S.fetcher,delete S.defaultValue,delete S.immediate,delete S.watch,delete S.transform,delete S.onSuccess,delete S.onError,delete S.timeout,delete S.retry,delete S.validateStatus;let C=u??f;f instanceof Request&&u&&u.toString()!==f.url&&(C=new Request(u.toString(),$o(f)));const R=()=>{const $=new Headers(h);return{...S,headers:$,body:Eo(t.body,$),signal:w.signal}};if(v>1&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream)throw new Error("Cannot retry requests with ReadableStream bodies");if(v>1&&typeof Request<"u"&&C instanceof Request&&C.body!==null)throw new Error("Cannot retry requests with non-replayable Request bodies");let k;try{for(let $=0;$<v;$++)try{const T=await s(C,R());if(!o(T.status))throw Object.assign(new Error(`Request failed with status ${T.status}`),{response:T,status:T.status,statusText:T.statusText});return await To(T,n)}catch(T){const O=T instanceof Error?T:new Error(String(T));if(w.signal.aborted||pr(O)||et(O))throw a(w.signal.aborted?w.signal.reason:O,L);if(k=O,!(b&&(b.retryOn??Ro)(O,$))||$>=v-1)throw O;await No(Do(b.delay,$),w.signal)}throw k}finally{E!==void 0&&clearTimeout(E),t.signal&&A&&t.signal.removeEventListener("abort",A),i===w&&(i=null)}},t);return l.abort=()=>{i&&i.abort(new DOMException("Request aborted","AbortError"))},l};function Po(e={}){return(t,r={})=>{const n=e,s=he({},n.query??{},r.query??{});return W(t,{...n,...r,headers:dr(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var oe=class extends Error{constructor(e,t,r,n){super(e),this.name="HttpError",this.config=t,this.code=r,this.response=n}};function vr(){const e=[];let t=0;return{use(r,n){const s=t++;return e.push({id:s,fulfilled:r,rejected:n}),s},eject(r){const n=e.findIndex(s=>s?.id===r);n!==-1&&(e[n]=null)},clear(){e.length=0},forEach(r){for(const n of e)n&&r(n)}}}var Io=e=>e>=200&&e<300,_o=e=>{if(e.code==="PARSE")return!1;if(e.code==="TIMEOUT"||e.code==="NETWORK")return!0;const t=e.response?.status;return t!==void 0&&t>=500},qo=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},xo=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),jo=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s;const o=()=>{clearTimeout(s),t?.removeEventListener("abort",o),n(t?.reason??new DOMException("The operation was aborted.","AbortError"))};s=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),t&&t.addEventListener("abort",o,{once:!0})}),yr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},zo=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),Fo=(e,t)=>e==null||zo(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),Bo=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},Ho=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return new URL(e,n)},Uo=async(e,t,r)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const n=await e.text();if(n)try{return JSON.parse(n)}catch(s){throw new oe(`Failed to parse JSON response${e.url?` for ${e.url}`:""} (status ${e.status}): ${s instanceof Error?s.message:String(s)}`,r,"PARSE",{data:n,status:e.status,statusText:e.statusText,headers:e.headers,config:r})}},Qo=(e,t)=>{const r=e.body;if(!r)return e;const n=parseInt(e.headers.get("content-length")??"0",10)||0;let s=0;const o=r.getReader(),i=new ReadableStream({async pull(a){const{done:l,value:f}=await o.read();if(l){a.close();return}s+=f.byteLength,t({loaded:s,total:n,percent:n>0?Math.round(s/n*100):void 0}),a.enqueue(f)},cancel(a){o.cancel(a)}});return new Response(i,{status:e.status,statusText:e.statusText,headers:e.headers})},Vo=async e=>{const t=X().fetch,r=e.parseAs??t?.parseAs??"json",n=e.fetcher??fetch,s=e.validateStatus??Io,o=Ho(e.url??"/",e.baseUrl??t?.baseUrl);e.query&&Bo(o,e.query);const i=yr(t?.headers,e.headers),a=Fo(e.body,i),l={};e.method&&(l.method=e.method.toUpperCase()),l.headers=i,a!=null&&(l.body=a),e.cache&&(l.cache=e.cache),e.credentials&&(l.credentials=e.credentials),e.integrity&&(l.integrity=e.integrity),e.keepalive!==void 0&&(l.keepalive=e.keepalive),e.mode&&(l.mode=e.mode),e.redirect&&(l.redirect=e.redirect),e.referrer&&(l.referrer=e.referrer),e.referrerPolicy&&(l.referrerPolicy=e.referrerPolicy);let f,u=e.signal,h;if(e.timeout&&e.timeout>0){const d=new AbortController;e.signal&&(h=()=>d.abort(e.signal?.reason),e.signal.addEventListener("abort",h,{once:!0})),f=setTimeout(()=>{d.abort(new DOMException("Request timeout","TimeoutError"))},e.timeout),u=d.signal}u&&(l.signal=u);try{let d=await n(o.toString(),l);if(e.onDownloadProgress&&(d=Qo(d,e.onDownloadProgress)),!s(d.status))throw new oe(`Request failed with status ${d.status}`,e,"ERR_BAD_RESPONSE",{data:void 0,status:d.status,statusText:d.statusText,headers:d.headers,config:e});return{data:await Uo(d,r,e),status:d.status,statusText:d.statusText,headers:d.headers,config:e}}catch(d){if(d instanceof oe)throw d;if(d instanceof DOMException&&(d.name==="AbortError"||d.name==="TimeoutError")){const p=d.name==="TimeoutError"||d.message==="Request timeout";throw new oe(p?`Request timeout of ${e.timeout}ms exceeded`:"Request aborted",e,p?"TIMEOUT":"ABORT")}throw new oe(d instanceof Error?d.message:String(d),e,"NETWORK")}finally{f!==void 0&&clearTimeout(f),e.signal&&h&&e.signal.removeEventListener("abort",h)}};function vt(e={}){const t=vr(),r=vr(),n=i=>{const a=he({},e.query??{},i.query??{});return{...e,...i,headers:yr(e.headers,i.headers),query:Object.keys(a).length>0?a:void 0}},s=async i=>{let a=i;const l=[];t.forEach(d=>l.push(d));for(const{fulfilled:d,rejected:p}of l)try{d&&(a=await d(a))}catch(c){if(p){const m=await p(c);if(de(m))a=m;else throw c}else throw c}const f=qo(a.retry);let u;const h=(f?.count??0)+1;for(let d=0;d<h;d++)try{let p=await Vo(a);const c=[];r.forEach(m=>c.push(m));for(const{fulfilled:m,rejected:g}of c)try{m&&(p=await m(p))}catch(b){if(g){const v=await g(b);if(v&&typeof v=="object"&&"data"in v)p=v;else throw b}else throw b}return p}catch(p){const c=p instanceof oe?p:new oe(p instanceof Error?p.message:String(p),a,"NETWORK");if(u=c,!(f&&(f.retryOn??_o)(c,d))||d>=h-1){const g=[];r.forEach(v=>g.push(v));let b=c;for(const{rejected:v}of g)if(v)try{const w=await v(b);if(w&&typeof w=="object"&&"data"in w)return w;w!=null&&(b=w)}catch(w){w!=null&&(b=w)}throw b instanceof Error||(b=c),b}const m=f?xo(f.delay,d):0;f?.onRetry?.(c,d+1),await jo(m,a.signal)}throw u},o=i=>s(n(i));return{request:o,get:(i,a={})=>o({...a,url:i,method:"GET"}),post:(i,a,l={})=>o({...l,url:i,method:"POST",body:a}),put:(i,a,l={})=>o({...l,url:i,method:"PUT",body:a}),patch:(i,a,l={})=>o({...l,url:i,method:"PATCH",body:a}),delete:(i,a={})=>o({...a,url:i,method:"DELETE"}),head:(i,a={})=>o({...a,url:i,method:"HEAD"}),options:(i,a={})=>o({...a,url:i,method:"OPTIONS"}),interceptors:{request:t,response:r},defaults:e}}var Wo=vt();function Ko(e={}){const{concurrency:t=6}=e;if(!Number.isInteger(t)||t<1)throw new Error("Request queue concurrency must be a positive integer");const r=[];let n=0;const s=()=>{for(;n<t&&r.length>0;){const o=r.shift();n++,Promise.resolve().then(o.execute).then(o.resolve,o.reject).finally(()=>{n--,s()})}};return{add(o){return new Promise((i,a)=>{r.push({execute:o,resolve:i,reject:a}),s()})},get pending(){return n},get size(){return r.length},clear(){const o=r.splice(0);for(const i of o)i.reject(new Error("Request queue cleared"))}}}var Yo=(e,t)=>{const r=P(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},Go=(e,t={})=>{const{initialPage:r=1,...n}=t,s=M(r),o=W(()=>e(s.value),{...n,watch:n.watch});return{...o,page:s,next:async()=>(s.value=s.peek()+1,o.execute()),prev:async()=>{const f=s.peek();return f>1&&(s.value=f-1),o.execute()},goTo:async f=>(s.value=Math.max(1,f),o.execute())}},Jo=(e,t)=>{const{getNextCursor:r,transform:n,initialCursor:s,immediate:o=!0,onSuccess:i,onError:a,...l}=t,f=M([]),u=M(t.defaultValue),h=M(null),d=M("idle"),p=P(()=>d.value==="pending"),c=M(s),m=P(()=>f.value.length===0||c.value!==void 0);let g=!1,b=0;const v=S=>n?n(S):S,w=async()=>{if(g)return u.peek();const S=++b;d.value="pending",h.value=null;try{const C=W(e(c.peek()),{...l,immediate:!1,watch:void 0}),R=await C.execute(),k=C.error.peek();if(C.dispose(),g||S!==b)return u.peek();if(k)return h.value=k,d.value="error",a?.(k),u.peek();if(R!==void 0){const $=R,T=[...f.peek(),$];f.value=T,c.value=r($,T);const O=v(T);return u.value=O,d.value="success",i?.(O),O}return d.value="success",u.peek()}catch(C){if(g||S!==b)return u.peek();const R=C instanceof Error?C:new Error(String(C));return h.value=R,d.value="error",a?.(R),u.peek()}},E=async()=>(f.value=[],c.value=s,u.value=t.defaultValue,h.value=null,d.value="idle",b+=1,w()),L=()=>{b+=1,f.value=[],c.value=s,u.value=t.defaultValue,h.value=null,d.value="idle"},A=()=>{g||(g=!0,b+=1)};return o&&w(),{data:u,pages:f,error:h,status:d,pending:p,hasMore:m,fetchNextPage:w,refresh:E,clear:L,dispose:A}},Xo=(e,t)=>{let r=!1,n=null;try{if(n=globalThis.localStorage,n){const i=`__bquery_test_${Math.random().toString(36).slice(2,9)}__`,a="__test__";try{n.setItem(i,a),n.getItem(i),r=!0}finally{try{n.removeItem(i)}catch{}}}}catch{r=!1}let s=t;if(r&&n)try{const i=n.getItem(e);i!==null&&(s=JSON.parse(i))}catch{}const o=M(s);return r&&n&&j(()=>{try{n.setItem(e,JSON.stringify(o.value))}catch{}}),o},Zo=(e,t)=>{const{interval:r,enabled:n=!0,pauseOnHidden:s=!0,pauseOnOffline:o=!0,immediate:i=!0,...a}=t;if(!Number.isFinite(r)||r<1)throw new Error("Polling interval must be a finite number of at least 1");const l=M(!1),f=M(!1),u=M(!1),h=typeof n=="function"?n:()=>n,d=P(()=>h()&&!l.value&&!(s&&f.value)&&!(o&&u.value)),p=W(e,{...a,immediate:i&&h()});let c,m=[];const g=()=>{b(),c=setInterval(()=>{p.execute()},r)},b=()=>{c!==void 0&&(clearInterval(c),c=void 0)},v=j(()=>{const L=d.value;ae(()=>{L?g():b()})});if(s&&typeof document<"u"){f.value=document.hidden;const L=()=>{f.value=document.hidden};document.addEventListener("visibilitychange",L),m.push(()=>document.removeEventListener("visibilitychange",L))}if(o&&typeof window<"u"){const L=()=>{u.value=!1},A=()=>{u.value=!0};window.addEventListener("online",L),window.addEventListener("offline",A),m.push(()=>{window.removeEventListener("online",L),window.removeEventListener("offline",A)}),u.value=typeof navigator<"u"&&navigator.onLine!==void 0?!navigator.onLine:!1}const w=p.dispose;return{...p,pause:()=>{l.value=!0},resume:()=>{l.value=!1},isActive:d,dispose:()=>{b(),v();for(const L of m)L();m=[],w()}}},gr=Symbol("bquery.readonlySignal"),br=e=>typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,gr),U=e=>Object.defineProperties({},{value:{get(){return e.value},enumerable:!0},peek:{value(){return e.peek()},enumerable:!0},[gr]:{value:!0,enumerable:!1,configurable:!1,writable:!1}}),ei=(e,t={})=>{const{optimistic:r=!1,onMutationSuccess:n,onMutationError:s,...o}=t,i=W(e,{...o}),a=M(!1),l=P(()=>a.value);let f=!1;const u=()=>{const g=typeof e=="function"?e():e;return g instanceof URL?g.toString():g},h=()=>{const{defaultValue:g,transform:b,onSuccess:v,onError:w,...E}=o;return E},d=async(g,b,v,w)=>{if(f)return i.data.peek();const E=i.data.peek();r&&w!==void 0&&(i.data.value=w),a.value=!0,i.error.value=null;try{const L=W(u(),{...h(),method:b,body:v??void 0,immediate:!1,watch:void 0}),A=await L.execute(),S=L.error.peek();return L.dispose(),f?i.data.peek():S?(r&&w!==void 0&&(i.data.value=E),i.error.value=S,i.status.value="error",a.value=!1,s?.(S,g),i.data.peek()):(b!=="DELETE"&&A!==void 0&&(i.data.value=A),a.value=!1,i.status.value="success",n?.(A,g),A)}catch(L){if(f)return i.data.peek();r&&w!==void 0&&(i.data.value=E);const A=L instanceof Error?L:new Error(String(L));return i.error.value=A,i.status.value="error",a.value=!1,s?.(A,g),i.data.peek()}},p={fetch:()=>i.execute(),create:g=>d("create","POST",g),update:g=>{const b=i.data.peek();return d("update","PUT",g,r&&b!==void 0?{...b,...g}:void 0)},patch:g=>{const b=i.data.peek();return d("patch","PATCH",g,r&&b!==void 0?{...b,...g}:void 0)},remove:async()=>{await d("remove","DELETE"),!f&&i.error.peek()==null&&(i.data.value=void 0)}},c=i.dispose,m=()=>{f||(f=!0,c())};return{data:i.data,error:i.error,status:i.status,pending:i.pending,isMutating:l,actions:p,refresh:i.execute,clear:i.clear,dispose:m}},ti=(e,t={})=>{const{method:r="POST",...n}=t,s=M(void 0),o=M(null),i=M("idle"),a=P(()=>i.value==="pending");return{data:s,error:o,status:i,pending:a,submit:async u=>{i.value="pending",o.value=null;try{const h=W(e,{...n,method:r,body:u,immediate:!1,watch:void 0}),d=await h.execute(),p=h.error.peek();if(h.dispose(),p){o.value=p,i.value="error";return}return s.value=d,i.value="success",d}catch(h){o.value=h instanceof Error?h:new Error(String(h)),i.value="error";return}},clear:()=>{s.value=void 0,o.value=null,i.value="idle"}}},ri=(e,t={})=>{const r=vt({...t});let n=e;for(;n.endsWith("/");)n=n.slice(0,-1);return{list:s=>r.get(n,s),get:(s,o)=>r.get(`${n}/${encodeURIComponent(String(s))}`,o),create:(s,o)=>r.post(n,s,o),update:(s,o,i)=>r.put(`${n}/${encodeURIComponent(String(s))}`,o,i),patch:(s,o,i)=>r.patch(`${n}/${encodeURIComponent(String(s))}`,o,i),remove:(s,o)=>r.delete(`${n}/${encodeURIComponent(String(s))}`,o),http:r}},ni=(e,t={})=>{const{getId:r=v=>v.id,optimistic:n=!1,onMutationSuccess:s,onMutationError:o,...i}=t,a=W(e,{...i}),l=M(!1),f=P(()=>l.value);let u=!1;const h=()=>{const v=typeof e=="function"?e():e;return v instanceof URL?v.toString():v},d=()=>{let v=h();for(;v.endsWith("/");)v=v.slice(0,-1);return v},p=()=>{const{defaultValue:v,transform:w,onSuccess:E,onError:L,...A}=i;return A},c=async(v,w,E,L,A,S)=>{if(!u){n&&A&&A(),l.value=!0,a.error.value=null;try{const C=W(`${d()}${E}`,{...p(),method:w,body:L??void 0,immediate:!1,watch:void 0}),R=await C.execute(),k=C.error.peek();if(C.dispose(),u)return;if(k){n&&S&&S(),a.error.value=k,a.status.value="error",l.value=!1,o?.(k,v);return}return l.value=!1,a.status.value="success",s?.(v),R}catch(C){if(u)return;n&&S&&S();const R=C instanceof Error?C:new Error(String(C));a.error.value=R,a.status.value="error",l.value=!1,o?.(R,v);return}}},m={fetch:()=>a.execute(),add:async v=>{const w=a.data.peek(),E=v,L=w?.length??0,A=await c("add","POST","",v,n?()=>{a.data.value=[...w??[],E]}:void 0,n?()=>{a.data.value=w}:void 0);if(A!==void 0&&!u){const S=a.data.peek()??[];if(n){const C=[...S];L<C.length&&C[L]===E?C[L]=A:C.push(A),a.data.value=C}else a.data.value=[...S,A]}return A},update:async(v,w)=>{const E=a.data.peek(),L=await c("update","PUT",`/${encodeURIComponent(String(v))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===v?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(L!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===v?L:S)}return L},patch:async(v,w)=>{const E=a.data.peek(),L=await c("patch","PATCH",`/${encodeURIComponent(String(v))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===v?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(L!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===v?L:S)}return L},remove:async v=>{const w=a.data.peek();if(await c("remove","DELETE",`/${encodeURIComponent(String(v))}`,void 0,n&&w?()=>{a.data.value=w.filter(E=>r(E)!==v)}:void 0,n?()=>{a.data.value=w}:void 0),!n&&!u&&a.error.peek()==null){const E=a.data.peek()??[];a.data.value=E.filter(L=>r(L)!==v)}}},g=a.dispose,b=()=>{u||(u=!0,g())};return{data:a.data,error:a.error,status:a.status,pending:a.pending,isMutating:f,actions:m,refresh:a.execute,clear:a.clear,dispose:b}},yt=new Map;function si(e,t){const r=yt.get(e);if(r)return r;const n=t().finally(()=>{yt.delete(e)});return yt.set(e,n),n}var Ne=e=>e instanceof De,gt=e=>e instanceof Me,oi=e=>e instanceof De||e instanceof Me||br(e)?e.value:e,ii=(e,t,r={})=>{const{immediate:n=!1,equals:s=Object.is}=r;let o,i=!0;return j(()=>{const a=e.value;if(i){i=!1,o=a,n&&t(a,void 0);return}s(a,o)||(t(a,o),o=a)})};function wr(e){return e===!1?!1:e===!0||e===void 0?{}:e}var ai=e=>e?e===!0?{}:e:!1,Er=(e,t)=>{const r=t.delay??1e3,n=t.factor??2,s=t.maxDelay??3e4;return Math.min(r*n**e,s)},Sr=(e,t={})=>{const{protocols:r,immediate:n=!0,historySize:s=0,onOpen:o,onMessage:i,onClose:a,onError:l,onReconnect:f}=t,u=t.serialize??(N=>JSON.stringify(N)),h=t.deserialize??(N=>{const B=N.data;if(typeof B=="string")try{return JSON.parse(B)}catch{return B}return B}),d=M("CLOSED"),p=M(void 0),c=M(null),m=M([]),g=M(0),b=M(0),v=M(0),w=P(()=>d.value==="OPEN");let E=null,L=!1,A=!1,S,C,R,k=0,$=!1,T=0;const O=[],D=wr(t.autoReconnect),I=ai(t.heartbeat),z=()=>{if(!I)return;_();const N=I.interval??3e4,B=I.pongTimeout??1e4,V=I.message??"ping";C=setInterval(()=>{E?.readyState===WebSocket.OPEN&&(T=Date.now(),E.send(V),R!==void 0&&clearTimeout(R),R=setTimeout(()=>{E?.close(4e3,"Heartbeat timeout")},B))},N)},_=()=>{C!==void 0&&(clearInterval(C),C=void 0),R!==void 0&&(clearTimeout(R),R=void 0)},H=()=>{R!==void 0&&(clearTimeout(R),R=void 0),T>0&&(b.value=Date.now()-T,T=0)},se=N=>{if(L||A||!D)return;const B=D.maxAttempts??1/0;if(k>=B||D.shouldReconnect&&!D.shouldReconnect(N,k))return;const V=Er(k,D);S=setTimeout(()=>{k++,g.value=k,$=!0,Ft()},V)},Ae=()=>{S!==void 0&&(clearTimeout(S),S=void 0)},zt=()=>{if(!E||E.readyState!==WebSocket.OPEN)return;let N=0;for(;N<O.length&&E.readyState===WebSocket.OPEN;N++)E.send(O[N]);N>0&&O.splice(0,N)},Ve=()=>{const N=typeof e=="function"?e():e;return N instanceof URL?N.toString():N},Ft=()=>{if(!L){Ae(),E&&(_(),T=0,E.onopen=null,E.onmessage=null,E.onclose=null,E.onerror=null,(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&E.close(),E=null),A=!1,d.value="CONNECTING",c.value=null;try{E=new WebSocket(Ve(),r)}catch{d.value="CLOSED";return}E.onopen=N=>{d.value="OPEN";const B=$,V=k;k=0,g.value=0,$=!1,zt(),z(),o?.(N),B&&f?.(V)},E.onmessage=N=>{if(I){const V=I.responseMessage;(V===void 0||N.data===V)&&H()}const B=h(N);if(p.value=B,s>0){const V=[...m.peek(),B];m.value=V.length>s?V.slice(-s):V}i?.(B,N)},E.onclose=N=>{d.value="CLOSED",_(),A||(v.value=Date.now()),a?.(N),!A&&!L&&se(N)},E.onerror=N=>{c.value=N,l?.(N)}}},es=(N,B)=>{A=!0,Ae(),_(),E&&(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&(d.value="CLOSING",E.close(N,B))},yu=N=>{L||ts(u(N))},ts=N=>{L||(E?.readyState===WebSocket.OPEN?E.send(N):O.push(N))},gu=()=>{L||(L=!0,es(),O.length=0,E=null)};return n&&Ft(),{status:d,data:p,error:c,history:m,isConnected:w,reconnectAttempts:g,latency:b,lastDisconnectedAt:v,send:yu,sendRaw:ts,open:Ft,close:es,dispose:gu}},li=(e,t={},r={})=>{const n=r.getChannel??(u=>u.channel),s=r.wrap??((u,h)=>({channel:u,data:h})),o=new Map,i=new Map,a=Sr(e,{...t,onMessage:(u,h)=>{const d=n(u);if(d!==void 0){const p=o.get(d);p&&(p.value=u)}t.onMessage?.(u,h)}});return{subscribe:u=>{let h=o.get(u);h||(h=M(void 0),o.set(u,h)),i.set(u,(i.get(u)??0)+1);let d=!1;return{data:h,unsubscribe:()=>{if(d)return;d=!0;const p=(i.get(u)??1)-1;p<=0?(i.delete(u),o.delete(u)):i.set(u,p)}}},publish:(u,h)=>{a.send(s(u,h))},ws:a}},ci=(e,t={})=>{const{immediate:r=!0,events:n=[],eventSourceInit:s,onOpen:o,onMessage:i,onError:a}=t,l=t.deserialize??($=>{try{return JSON.parse($)}catch{return $}}),f=M("CLOSED"),u=M(void 0),h=M(void 0),d=M(null),p=P(()=>f.value==="OPEN"),c=wr(t.autoReconnect);let m=null,g=!1,b=!1,v,w=0;const E=()=>{const $=typeof e=="function"?e():e;return $ instanceof URL?$.toString():$},L=$=>T=>{const O=l(T.data);u.value=O,h.value=$,i?.(O,T)},A=()=>{v!==void 0&&(clearTimeout(v),v=void 0)},S=()=>{if(g||b||!c)return;const $=c.maxAttempts??1/0;if(w>=$)return;const T=Er(w,c);v=setTimeout(()=>{w++,C()},T)},C=()=>{if(!g){A(),m&&(m.close(),m=null),b=!1,f.value="CONNECTING",d.value=null;try{m=new EventSource(E(),s)}catch{f.value="CLOSED";return}m.onopen=$=>{f.value="OPEN",w=0,o?.($)},m.onerror=$=>{d.value=$,a?.($),m?.readyState===EventSource.CLOSED&&(f.value="CLOSED",!b&&!g&&S())},m.addEventListener("message",L("message"));for(const $ of n)m.addEventListener($,L($))}},R=()=>{b=!0,A(),m&&(m.close(),m=null),f.value="CLOSED"},k=()=>{g||(g=!0,R())};return r&&C(),{status:f,data:u,eventName:h,error:d,isConnected:p,open:C,close:R,dispose:k}},ui=(e,t)=>{const{type:r}=t;if(r===String)return e;if(r===Number)return Number(e);if(r===Boolean){const n=e.trim().toLowerCase();return n===""||n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:!!e}if(r===Object||r===Array)try{return JSON.parse(e)}catch{return e}if(typeof r=="function"){const n=r,s=r;if(t.construct===!0)return Reflect.construct(s,[e]);if(t.construct===!1)return n(e);const o=r.prototype!==void 0&&r.prototype!==null,i=(o?Object.getOwnPropertyNames(r.prototype):[]).length>1,a=o&&r.prototype.constructor!==r,l=/^class\s/.test(Function.prototype.toString.call(r));if(i||a||l)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const f=n(e);if(f===void 0&&o)try{return Reflect.construct(s,[e])}catch{return f}return f}catch(f){if(f instanceof TypeError&&/cannot be invoked without 'new'|is not a function/i.test(f.message))return Reflect.construct(s,[e]);throw f}}return e},bt=()=>{try{const e=globalThis;if(typeof e.__BQUERY_DEV__=="boolean")return e.__BQUERY_DEV__;const t=e.process?.env?.NODE_ENV;if(typeof t=="string")return t!=="production";const r=e.process?.versions?.node;if(typeof r=="string"&&r.length>0)return!0;const n=e.process?.release?.name;return n==="node"||n==="io.js"}catch{return!1}},Pe;function ie(e){const t=Pe;return Pe=e,t}function Ar(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){bt()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function fi(e){const t=Pe;if(!t)throw new Error("bQuery component: useSignal() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=M(e);return t.addDisposer(()=>r.dispose()),r}function di(e){const t=Pe;if(!t)throw new Error("bQuery component: useComputed() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=P(e);return t.addDisposer(()=>r.dispose()),r}function hi(e){const t=Pe;if(!t)throw new Error("bQuery component: useEffect() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=j(e);return t.addDisposer(r),r}var mi=["slot"],pi=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],Cr=(e,t)=>{const r=[...mi,...t.sanitize?.allowTags??[]],n=[...pi,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),i=(f=>f===!1?!1:f==="closed"?"closed":"open")(t.shadow),a=Array.from(new Set([...Object.keys(t.props??{}),...t.observeAttributes??[]]));class l extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.missingRequiredProps=new Set,this.hasMounted=!1,i!==!1?this.renderRootNode=this.attachShadow({mode:i}):this.renderRootNode=this,this.syncProps()}static get observedAttributes(){return a}connectedCallback(){try{if(!this.hasMounted&&this.missingRequiredProps.size>0)return;if(this.hasMounted){this.scope=Ar();const u=ie(this.scope);try{t.connected?.call(this)}catch(h){this.handleError(h)}finally{ie(u)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(u){this.handleError(u)}}mount(){if(this.hasMounted)return;const u=ie(this.ensureScope());let h=!1;try{t.beforeMount?.call(this),t.connected?.call(this)}catch(d){h=!0,this.handleError(d)}finally{ie(u)}if(h){this.scope?.dispose(),this.scope=void 0;return}this.render(),this.setupSignalSubscriptions(),this.hasMounted=!0}disconnectedCallback(){try{this.signalEffectCleanup?.(),this.signalEffectCleanup=void 0,this.scope?.dispose(),this.scope=void 0,t.disconnected?.call(this)}catch(u){this.handleError(u)}}attributeChangedCallback(u,h,d){try{const p=this.cloneProps();if(this.syncProps(),t.onAttributeChanged){const c=ie(this.ensureScope());try{t.onAttributeChanged.call(this,u,h,d)}finally{ie(c)}}this.hasMounted?this.render(!0,p,{name:u,oldValue:h,newValue:d}):this.isConnected&&this.missingRequiredProps.size===0&&this.mount()}catch(p){this.handleError(p)}}adoptedCallback(){if(!t.onAdopted)return;const u=ie(this.ensureScope());try{t.onAdopted.call(this)}catch(h){this.handleError(h)}finally{ie(u)}}handleError(u){t.onError?t.onError.call(this,u):console.error(`bQuery component error in <${e}>:`,u)}ensureScope(){return this.scope??(this.scope=Ar())}setState(u,h){this.state[u]=h,this.render(!0,this.cloneProps(),void 0,!1)}getState(u){return this.state[u]}setupSignalSubscriptions(u=!1){if(this.signalEffectCleanup||s.length===0)return;let h=!0;this.signalEffectCleanup=j(()=>{try{for(const p of s)p.value;if(h){if(h=!1,u&&this.hasMounted&&this.isConnected){const p=this.cloneProps();ae(()=>{this.render(!0,p,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const d=this.cloneProps();ae(()=>{this.render(!0,d,void 0,!1)})}catch(d){this.handleError(d)}})}syncProps(){const u=t.props??{};for(const[h,d]of Object.entries(u)){const p=this.getAttribute(h);let c;if(p==null?d.required&&d.default===void 0?(this.missingRequiredProps.add(h),c=void 0):c=d.default??void 0:(this.missingRequiredProps.has(h)&&this.missingRequiredProps.delete(h),c=ui(p,d)),d.validator&&c!==void 0&&!d.validator(c))throw new Error(`bQuery component: validation failed for prop "${h}" with value ${JSON.stringify(c)}`);this.props[h]=c}}cloneProps(){return{...this.props}}render(u=!1,h,d,p=!0){try{if(u&&p&&t.beforeUpdate){if(!h)throw new Error("bQuery component: previous props are required for update renders");if(t.beforeUpdate.call(this,this.props,h)===!1)return}const c=(v,w)=>{this.dispatchEvent(new CustomEvent(v,{detail:w,bubbles:!0,composed:!0}))},m=this.renderRootNode,g=J(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:c}),{allowTags:r,allowAttributes:n});let b=null;if(t.styles&&(b=m.querySelector("style[data-bquery-component-style]")),m.innerHTML=g,t.styles){const v=b??document.createElement("style");b||v.setAttribute("data-bquery-component-style",""),v.textContent=t.styles,m.prepend(v)}u&&t.updated?.call(this,d)}catch(c){this.handleError(c)}}}return l};function vi(e,t){return Cr(e,t)}function ve(e,t){const r=Cr(e,t);customElements.get(e)||customElements.define(e,r)}var Tr=Symbol("bquery.booleanAttribute"),yi=/^[^\0-\x20"'/>=]+$/,kr=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[Tr]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},Lr=e=>kr(e)?e.enabled?e.name:"":String(e??""),gi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},bi=e=>kr(e)?e.enabled?e.name:"":Lr(e).replace(/[&<>"'`]/g,t=>gi[t]),wi=(e,t)=>{if(!yi.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[Tr]:!0,enabled:!!t,name:e})},ye=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${Lr(t[s])}`,""),Ei=(e,...t)=>{const r=n=>hs(n)?ms(n):bi(n);return Yt(e.reduce((n,s,o)=>`${n}${s}${o<t.length?r(t[o]):""}`,""))},tt=`
1
+ var bQuery=(function(g){Object.defineProperty(g,Symbol.toStringTag,{value:"Module"});var lr="bquery-sanitizer",Vs=new Set(["a","abbr","address","article","aside","b","bdi","bdo","blockquote","br","button","caption","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","input","ins","kbd","label","legend","li","main","mark","nav","ol","optgroup","option","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","wbr"]),cr=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),Ks=new Set(["document","window","location","top","self","parent","frames","history","navigator","screen","alert","confirm","prompt","eval","function","cookie","domain","referrer","body","head","forms","images","links","scripts","children","parentnode","firstchild","lastchild","innerhtml","outerhtml","textcontent"]),Ys=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),Gs=["on","formaction","xlink:","xmlns:"],ur=["javascript:","data:","vbscript:","file:"],Js=(e,t,r)=>{const n=e.toLowerCase();for(const s of Gs)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},Xs=e=>{const t=e.toLowerCase().trim();return!Ks.has(t)},Zs=e=>e.replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),fr=e=>{const t=Zs(e);for(const r of ur)if(t.startsWith(r))return!1;return!0},eo=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!fr(n))return!1}return!0},to=e=>{try{const t=e.trim();if(t.startsWith("//"))return!0;const r=t.toLowerCase();return/^[a-z][a-z0-9+.-]*:/i.test(t)&&!r.startsWith("http://")&&!r.startsWith("https://")?!0:!r.startsWith("http://")&&!r.startsWith("https://")?!1:typeof window>"u"||!window.location?!0:new URL(t,window.location.href).origin!==window.location.origin}catch{return!0}},ro=e=>new DOMParser().parseFromString(e,"text/html"),dr=e=>{const t=(typeof e=="string"?e:String(e??"")).trim(),r=document.createDocumentFragment();if(t.length===0)return r;if(!(t.includes("<")||t.includes(">")))return r.appendChild(document.createTextNode(t)),r;const n=ro(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},et=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:o=!1}=t,i=new Set([...Vs,...r.map(u=>u.toLowerCase())].filter(u=>!cr.has(u))),a=new Set([...Ys,...n.map(u=>u.toLowerCase())]),l=dr(e);if(o)return l.textContent??"";const c=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT),f=[];for(;c.nextNode();){const u=c.currentNode,h=u.tagName.toLowerCase();if(cr.has(h)){f.push(u);continue}if(!i.has(h)){f.push(u);continue}const v=[];for(const b of Array.from(u.attributes)){const y=b.name.toLowerCase();if(!Js(y,a,s)){v.push(b.name);continue}if((y==="id"||y==="name")&&!Xs(b.value)){v.push(b.name);continue}if((y==="href"||y==="src"||y==="action")&&!fr(b.value)){v.push(b.name);continue}y==="srcset"&&!eo(b.value)&&v.push(b.name)}for(const b of v)u.removeAttribute(b);if(h==="a"){const b=u.getAttribute("href"),y=u.getAttribute("target")?.toLowerCase()==="_blank",w=b&&to(b);if(y||w){const E=u.getAttribute("rel"),k=new Set(E?E.split(/\s+/).filter(Boolean):[]);k.add("noopener"),k.add("noreferrer"),u.setAttribute("rel",Array.from(k).join(" "))}}}for(const u of f)u.remove();const m=u=>{const h=document.createElement("div");return h.appendChild(u.cloneNode(!0)),h.innerHTML},d=m(l),p=m(dr(d));return d!==p?l.textContent??"":p},hr=Symbol("bquery.trusted-html.brand"),kt=Symbol("bquery.trusted-html"),mr=e=>e,no=e=>{const t=String(e);return Object.freeze({[hr]:!0,[kt]:t,toString:()=>t})},so=e=>typeof e=="object"&&e!==null&&hr in e&&kt in e,oo=e=>e[kt],pr=1024,vr=8192,io=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>pr)throw new RangeError(`generateNonce length must not exceed ${pr}`);if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function")throw new Error("generateNonce requires crypto.getRandomValues (not available in this environment)");if(typeof globalThis.btoa!="function")throw new Error("generateNonce requires btoa (not available in this environment)");const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);let r="";for(let n=0;n<t.length;n+=vr){const s=t.subarray(n,Math.min(n+vr,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},ao=e=>{if(typeof document>"u")return!1;const t=document.querySelector('meta[http-equiv="Content-Security-Policy"]');return t?(t.getAttribute("content")??"").includes(e):!1},tt=null,yr=!1,lo=()=>typeof window<"u"&&typeof window.trustedTypes<"u",gr=()=>{if(tt)return tt;if(yr||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;yr=!0;try{return tt=e.trustedTypes.createPolicy(lr,{createHTML:t=>et(t)}),tt}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${lr}": ${r}`),null}},co=e=>{const t=gr();return t?t.createHTML(e):et(e)},X=(e,t={})=>mr(et(e,t)),br=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return e.replace(/[&<>"'`]/g,r=>t[r])},uo=e=>et(e,{stripAllTags:!0}),wr=e=>Array.isArray(e)?e:[e],z=(e,t)=>{for(const r of e)t(r)},ve=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},rt=(e,t)=>ve(e)?t==="width"?e.clientWidth:e.clientHeight:0,nt=(e,t,r)=>{if(!ve(e))return 0;const n=t==="width"?e.offsetWidth:e.offsetHeight;if(!r)return n;const s=e.ownerDocument?.defaultView;if(!s||typeof s.getComputedStyle!="function")return n;const o=s.getComputedStyle(e),i=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-left":"margin-top")),a=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-right":"margin-bottom")),l=Number.isNaN(i)?0:i,c=Number.isNaN(a)?0:a;return n+l+c},Er=e=>X(e),fo=(e,t)=>{e.innerHTML=X(t)},Sr=e=>{const t=document.createElement("template");return t.innerHTML=X(e),t.content.firstElementChild??document.createElement("div")},Ar=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,X(t));return}const n=wr(t);z(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})};function ye(e){return Object.prototype.toString.call(e)==="[object Object]"}function x(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function ho(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function ge(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))x(n)||(ye(s)&&ye(t[n])?t[n]=ge(t[n],s):t[n]=s);return t}function mo(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function po(e,t){const r={...e};for(const n of t)delete r[n];return r}function vo(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var yo=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},kr=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!yo(n))continue;const s=n.name;if(!(!s||n.disabled||x(s))){if(n.tagName.toLowerCase()==="input"){const o=n,i=o.type.toLowerCase();if(i==="checkbox"||i==="radio"){o.checked&&t.push([s,o.value]);continue}if(i==="file"||i==="submit"||i==="button"||i==="reset"||i==="image")continue;t.push([s,o.value]);continue}if(n.tagName.toLowerCase()==="select"){const o=n;if(o.multiple)for(const i of Array.from(o.selectedOptions))t.push([s,i.value]);else t.push([s,o.value]);continue}t.push([s,n.value])}}return t},Tr=e=>{if(typeof FormData=="function")try{const t=[];for(const[r,n]of new FormData(e).entries())x(r)||typeof n!="string"||t.push([r,n]);return t.length>0?t:kr(e)}catch{}return kr(e)},be=class ar{constructor(t){this.element=t,this.delegatedHandlers=new Map}get raw(){return this.element}get node(){return this.element}addClass(...t){return this.element.classList.add(...t),this}removeClass(...t){return this.element.classList.remove(...t),this}toggleClass(t,r){return this.element.classList.toggle(t,r),this}attr(t,r){return r===void 0?this.element.getAttribute(t)??"":(this.element.setAttribute(t,r),this)}removeAttr(t){return this.element.removeAttribute(t),this}toggleAttr(t,r){const n=this.element.hasAttribute(t);return r??!n?this.element.setAttribute(t,""):this.element.removeAttribute(t),this}prop(t,r){return r===void 0?this.element[t]:(this.element[t]=r,this)}data(t,r){const n=t.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`);return r===void 0?this.element.getAttribute(`data-${n}`)??"":(this.element.setAttribute(`data-${n}`,r),this)}text(t){return t===void 0?this.element.textContent??"":(this.element.textContent=t,this)}html(t){return fo(this.element,t),this}htmlUnsafe(t){return this.element.innerHTML=t,this}css(t,r){if(typeof t=="string"){if(r!==void 0)return this.element.style.setProperty(t,r),this;const n=this.element.ownerDocument?.defaultView;return!n||typeof n.getComputedStyle!="function"?"":n.getComputedStyle(this.element).getPropertyValue(t)}for(const[n,s]of Object.entries(t))this.element.style.setProperty(n,s);return this}append(t){return this.insertContent(t,"beforeend"),this}prepend(t){return this.insertContent(t,"afterbegin"),this}before(t){return this.insertContent(t,"beforebegin"),this}after(t){return this.insertContent(t,"afterend"),this}wrap(t){const r=typeof t=="string"?document.createElement(t):t;return this.element.parentNode?.insertBefore(r,this.element),r.appendChild(this.element),this}unwrap(){const t=this.element.parentElement;return t&&t.parentNode&&(t.parentNode.insertBefore(this.element,t),t.remove()),this}replaceWith(t){const r=typeof t=="string"?Sr(t):t;return this.element.replaceWith(r),new ar(r)}detach(){return this.remove()}index(){const t=this.element.parentElement;return t?Array.from(t.children).indexOf(this.element):-1}contents(){return Array.from(this.element.childNodes)}offsetParent(){return ve(this.element)?this.element.offsetParent:null}position(){if(!ve(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}innerWidth(){return rt(this.element,"width")}innerHeight(){return rt(this.element,"height")}outerWidth(t=!1){return nt(this.element,"width",t)}outerHeight(t=!1){return nt(this.element,"height",t)}scrollTo(t={behavior:"smooth"}){return this.element.scrollIntoView(t),this}remove(){return this.element.remove(),this}empty(){return this.element.innerHTML="",this}clone(t=!0){return new ar(this.element.cloneNode(t))}find(t){return Array.from(this.element.querySelectorAll(t))}findOne(t){return this.element.querySelector(t)}closest(t){return this.element.closest(t)}parent(){return this.element.parentElement}children(){return Array.from(this.element.children)}siblings(){const t=this.element.parentElement;return t?Array.from(t.children).filter(r=>r!==this.element):[]}next(){return this.element.nextElementSibling}prev(){return this.element.previousElementSibling}on(t,r){return this.element.addEventListener(t,r),this}once(t,r){return this.element.addEventListener(t,r,{once:!0}),this}off(t,r){return this.element.removeEventListener(t,r),this}trigger(t,r){return this.element.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0})),this}delegate(t,r,n){const s=`${t}:${r}`,o=i=>{const a=i.target.closest(r);a&&this.element.contains(a)&&n(i,a)};return this.delegatedHandlers.has(s)||this.delegatedHandlers.set(s,new Map),this.delegatedHandlers.get(s).set(n,o),this.element.addEventListener(t,o),this}undelegate(t,r,n){const s=`${t}:${r}`,o=this.delegatedHandlers.get(s);if(o){const i=o.get(n);i&&(this.element.removeEventListener(t,i),o.delete(n),o.size===0&&this.delegatedHandlers.delete(s))}return this}matches(t){return this.element.matches(t)}is(t){return this.matches(t)}hasClass(t){return this.element.classList.contains(t)}show(t=""){return this.element.removeAttribute("hidden"),this.element.style.display=t,this}hide(){return this.element.style.display="none",this}toggle(t){const r=this.element.style.display==="none";return t??r?this.show():this.hide()}focus(){return this.element.focus(),this}blur(){return this.element.blur(),this}val(t){const r=this.element;return t===void 0?r.value??"":(r.value=t,this)}serialize(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return{};const r=Object.create(null);for(const[n,s]of Tr(t))if(Object.prototype.hasOwnProperty.call(r,n)){const o=r[n];Array.isArray(o)?o.push(s):r[n]=[o,s]}else r[n]=s;return r}serializeString(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return"";const r=new URLSearchParams;for(const[n,s]of Tr(t))r.append(n,s);return r.toString()}rect(){return this.element.getBoundingClientRect()}offset(){const t=this.element;return{width:t.offsetWidth,height:t.offsetHeight,top:t.offsetTop,left:t.offsetLeft}}insertContent(t,r){Ar(this.element,t,r)}},st=class J{constructor(t){this.elements=t,this.delegatedHandlers=new WeakMap}get length(){return this.elements.length}first(){return this.elements[0]}eq(t){const r=this.elements[t];return r?new be(r):void 0}firstEl(){return this.eq(0)}lastEl(){return this.eq(this.elements.length-1)}each(t){return this.elements.forEach((r,n)=>{t(new be(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new J(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new be(t))}addClass(...t){return z(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return z(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return z(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(z(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return z(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return z(this.elements,n=>{const s=n.hasAttribute(t);r??!s?n.setAttribute(t,""):n.removeAttribute(t)}),this}text(t){return t===void 0?this.first()?.textContent??"":(z(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=Er(t);return z(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return z(this.elements,r=>{r.innerHTML=t}),this}append(t){return this.insertAll(t,"beforeend"),this}prepend(t){return this.insertAll(t,"afterbegin"),this}before(t){return this.insertAll(t,"beforebegin"),this}after(t){return this.insertAll(t,"afterend"),this}css(t,r){if(typeof t=="string"){if(r!==void 0)return z(this.elements,o=>{o.style.setProperty(t,r)}),this;const n=this.first();if(!n)return"";const s=n.ownerDocument?.defaultView;return!s||typeof s.getComputedStyle!="function"?"":s.getComputedStyle(n).getPropertyValue(t)}return z(this.elements,n=>{for(const[s,o]of Object.entries(t))n.style.setProperty(s,o)}),this}wrap(t){return this.elements.forEach((r,n)=>{const s=typeof t=="string"?document.createElement(t):n===0?t:t.cloneNode(!0);r.parentNode?.insertBefore(s,r),s.appendChild(r)}),this}unwrap(){const t=new Set;for(const r of this.elements)r.parentElement&&t.add(r.parentElement);return t.forEach(r=>{const n=r.parentNode;if(n){for(;r.firstChild;)n.insertBefore(r.firstChild,r);r.remove()}}),this}replaceWith(t){const r=[];return this.elements.forEach((n,s)=>{const o=typeof t=="string"?Sr(t):s===0?t:t.cloneNode(!0);n.replaceWith(o),r.push(o)}),new J(r)}detach(){return this.remove()}index(){const t=this.first();return t?.parentElement?Array.from(t.parentElement.children).indexOf(t):-1}contents(){return Array.from(this.first()?.childNodes??[])}offsetParent(){const t=this.first();return ve(t)?t.offsetParent:null}position(){const t=this.first();return ve(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}innerWidth(){return rt(this.first(),"width")}innerHeight(){return rt(this.first(),"height")}outerWidth(t=!1){return nt(this.first(),"width",t)}outerHeight(t=!1){return nt(this.first(),"height",t)}show(t=""){return z(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return z(this.elements,t=>{t.style.display="none"}),this}on(t,r){return z(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return z(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return z(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return z(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return z(this.elements,o=>{const i=l=>{const c=l.target.closest(r);c&&o.contains(c)&&n(l,c)};this.delegatedHandlers.has(o)||this.delegatedHandlers.set(o,new Map);const a=this.delegatedHandlers.get(o);a.has(s)||a.set(s,new Map),a.get(s).set(n,i),o.addEventListener(t,i)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return z(this.elements,o=>{const i=this.delegatedHandlers.get(o);if(!i)return;const a=i.get(s);if(!a)return;const l=a.get(n);l&&(o.removeEventListener(t,l),a.delete(n),a.size===0&&i.delete(s),i.size===0&&this.delegatedHandlers.delete(o))}),this}find(t){const r=new Set,n=[];for(const s of this.elements){const o=s.querySelectorAll(t);for(let i=0;i<o.length;i++)r.has(o[i])||(r.add(o[i]),n.push(o[i]))}return new J(n)}closest(t){const r=new Set,n=[];for(const s of this.elements){const o=s.closest(t);o&&!r.has(o)&&(r.add(o),n.push(o))}return new J(n)}parent(){const t=new Set,r=[];for(const n of this.elements){const s=n.parentElement;s&&!t.has(s)&&(t.add(s),r.push(s))}return new J(r)}children(){const t=new Set,r=[];for(const n of this.elements)for(const s of Array.from(n.children))t.has(s)||(t.add(s),r.push(s));return new J(r)}siblings(){const t=new Set(this.elements),r=new Set,n=[];for(const s of this.elements){const o=s.parentElement;if(o)for(const i of Array.from(o.children))!t.has(i)&&!r.has(i)&&(r.add(i),n.push(i))}return new J(n)}next(){const t=new Set,r=[];for(const n of this.elements){const s=n.nextElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new J(r)}prev(){const t=new Set,r=[];for(const n of this.elements){const s=n.previousElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new J(r)}remove(){return z(this.elements,t=>t.remove()),this}empty(){return z(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=Er(t);z(this.elements,o=>{o.insertAdjacentHTML(r,s)});return}const n=wr(t);this.elements.forEach((s,o)=>{Ar(s,o===0?n:n.map(i=>i.cloneNode(!0)),r)})}},go=e=>{if(typeof e!="string")return new be(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new be(t)},bo=e=>Array.isArray(e)?new st(e):e instanceof NodeList?new st(Array.from(e)):new st(Array.from(document.querySelectorAll(e)));function wo(e){return e==null?[]:Array.isArray(e)?e:[e]}function Eo(e){return Array.from(new Set(e))}function So(e,t){if(t<=0)return[];const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Ao(e){return e.filter(Boolean)}function ko(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function Tt(e,t){let r;return Object.assign((...n)=>{r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,e(...n)},t)},{cancel:()=>{r!==void 0&&(clearTimeout(r),r=void 0)}})}function Cr(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function To(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function Co(){}function Ro(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function Oo(e){return new Promise(t=>setTimeout(t,e))}function Lo(e,t){try{return JSON.parse(e)}catch{return t}}function $o(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function Po(e,t){return Math.floor(Math.random()*(t-e+1))+e}function Mo(e,t,r){return Math.min(Math.max(e,t),r)}function No(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function Do(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function Io(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function _o(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function qo(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function zo(e,t,r="…"){if(t<=0)return"";if(e.length<=t)return e;const n=Math.max(0,t-r.length);return`${e.slice(0,n)}${r}`}function xo(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function jo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fo(e){return typeof Element<"u"&&e instanceof Element}function Uo(e){return!!(e&&typeof e=="object"&&"elements"in e)}function Bo(e){return typeof e=="function"}function Wo(e){return typeof e=="string"}function Ho(e){return typeof e=="number"&&!Number.isNaN(e)}function Qo(e){return typeof e=="boolean"}function Vo(e){return Array.isArray(e)}function Ko(e){return e instanceof Date}function Le(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function Yo(e){return typeof e=="object"&&e!==null}var Go={clone:ho,merge:ge,pick:mo,omit:po,hasOwn:vo,debounce:Tt,throttle:Cr,once:To,noop:Co,uid:Ro,isElement:Fo,isCollection:Uo,isEmpty:$o,isPlainObject:ye,isFunction:Bo,isString:Wo,isNumber:Ho,isBoolean:Qo,isArray:Vo,isDate:Ko,isPromise:Le,isObject:Yo,parseJson:Lo,sleep:Oo,randomInt:Po,clamp:Mo,inRange:No,toNumber:Do,capitalize:Io,toKebabCase:_o,toCamelCase:qo,truncate:zo,slugify:xo,escapeRegExp:jo,ensureArray:wo,unique:Eo,chunk:So,compact:Ao,flatten:ko},we=[],$e=0,Ct=new Set,ot=new WeakMap,Rt=(e,t)=>{we.push(e);try{return t()}finally{we.pop()}},Rr=()=>we[we.length-1],Ot=e=>{we.push(void 0);try{return e()}finally{we.pop()}},Or=e=>{if($e>0){Ct.add(e);return}e()},Jo=()=>{for(const e of Array.from(Ct)){Ct.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},Xo=()=>{$e+=1},Zo=()=>{$e<=0||($e-=1,$e===0&&Jo())},Lr=(e,t)=>{let r=ot.get(e);r||(r=new Set,ot.set(e,r)),r.add(t)},ei=(e,t)=>{const r=ot.get(e);r&&r.delete(t)},Pe=e=>{const t=ot.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},ce=e=>{Xo();try{e()}finally{Zo()}},$r={fetch:{headers:{},parseAs:"json"},cookies:{path:"/",sameSite:"Lax",secure:!1},announcer:{politeness:"polite",atomic:!0,delay:16,clearDelay:1e3},pageMeta:{},transitions:{skipOnReducedMotion:!1,classes:[],types:[]},components:{prefix:"bq"}},Me=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>Me(t));if(ye(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=Me(n);return t}return e},Lt=Me($r),ti=e=>(Lt=Me(ge($r,Lt,e)),Z()),Z=()=>Me(Lt),Ne=[],it=e=>typeof e=="object"&&e!==null&&"_addDisposer"in e,ri=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",ni=e=>{const t=typeof e.constructor=="function"?e.constructor.name:void 0;return typeof e=="function"&&(Symbol.toStringTag in e&&e[Symbol.toStringTag]==="AsyncFunction"||t==="AsyncFunction")},De=()=>{for(let e=Ne.length-1;e>=0;e--)if(Ne[e].active)return Ne[e]},si=class{constructor(){this.disposers=[],this._active=!0}get active(){return this._active}_addDisposer(e){this._active&&this.disposers.push(e)}run(e){if(!this._active)throw new Error("bQuery reactive: Cannot run in a stopped effectScope");if(ni(e))throw new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");Ne.push(this);try{const t=e();if(ri(t))throw this.stop(),new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");return t}finally{Ne.pop()}}stop(){if(this._active){this._active=!1;for(let e=this.disposers.length-1;e>=0;e--)try{this.disposers[e]()}catch(t){console.error("bQuery reactive: Error in scope cleanup",t)}this.disposers.length=0}}},oi=()=>{const e=new si,t=De();return it(t)&&t._addDisposer(()=>e.stop()),e},Pr=()=>De(),Mr=e=>{const t=De();if(!t||!t.active||!it(t))throw new Error("bQuery reactive: onScopeDispose() must be called inside an active effectScope");t._addDisposer(e)},Ie=class{constructor(e){this.compute=e,this.hasCachedValue=!1,this.dirty=!0,this.disposed=!1,this.subscribers=new Set,this.markDirty=()=>{if(this.disposed)return;this.dirty=!0;const t=Array.from(this.subscribers);for(const r of t)Or(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=Ot(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=Rr();return e&&(this.subscribers.add(e),Lr(e,this)),this.dirty&&(this.dirty=!1,Pe(this.markDirty),this.cachedValue=Rt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=Ot(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,Pe(this.markDirty),this.cachedValue=Rt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue)}unsubscribe(e){this.subscribers.delete(e)}dispose(){this.disposed=!0,this.dirty&&(this.hasCachedValue=!1),this.dirty=!1,Pe(this.markDirty),this.subscribers.clear()}},D=e=>{const t=new Ie(e),r=De();return it(r)&&r._addDisposer(()=>t.dispose()),t},j=e=>{let t,r=!1;const n=De(),s=()=>{if(t){try{t()}catch(l){console.error("bQuery reactive: Error in effect cleanup",l)}t=void 0}},o=()=>{s(),Pe(a)},i=()=>{r||(r=!0,o())};it(n)&&n._addDisposer(i);const a=()=>{if(!r){s(),Pe(a);try{t=Rt(a,e)}catch(l){console.error("bQuery reactive: Error in effect",l)}r&&o()}};return a(),i},_e=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=Rr();return e&&(this.subscribers.add(e),Lr(e,this)),this._value}set value(e){if(Object.is(this._value,e))return;this._value=e;const t=Array.from(this.subscribers);for(const r of t)Or(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)ei(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},$=e=>new _e(e),ue=e=>Ot(e),ii=e=>{if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);try{return new Error(JSON.stringify(e))}catch{return new Error(String(e))}},ai=e=>typeof e=="function"?e():e.value,Nr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},li=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),ci=(e,t)=>e==null||li(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),ui=e=>typeof e=="function"?e():e,fi=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},di=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return e instanceof URL?new URL(e.toString(),n):new URL(e,n)},hi=async(e,t)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const r=await e.text();if(r)try{return JSON.parse(r)}catch(n){const s=e.url?` for ${e.url}`:"";throw new Error(`Failed to parse JSON response${s} (status ${e.status}): ${n instanceof Error?n.message:String(n)}`)}},$t=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},mi=(e,t,r)=>{const n=t instanceof Request?$t(t.method):void 0;return e??n??(r?"POST":void 0)},pi=(e,t,r)=>e||(t instanceof Request?void 0:r),vi=e=>{const t=$t(e.method);let r;if(t!=="GET"&&t!=="HEAD"&&!e.bodyUsed)try{r=e.clone().body??void 0}catch{r=void 0}return{method:t,headers:e.headers,body:r,cache:e.cache,credentials:e.credentials,integrity:e.integrity,keepalive:e.keepalive,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,signal:e.signal}},Dr=(e,t={})=>{const r=t.immediate??!0,n=$(t.defaultValue),s=$(null),o=$("idle"),i=D(()=>o.value==="pending");let a=0,l=!1,c=()=>{};const f=()=>{a+=1,n.value=t.defaultValue,s.value=null,o.value="idle"},m=()=>{l||(l=!0,a+=1,c())},d=async()=>{if(l)return n.peek();const p=++a;o.value="pending",s.value=null;try{const u=await e(),h=t.transform?t.transform(u):u;return l||p!==a?n.peek():(n.value=h,o.value="success",t.onSuccess?.(h),h)}catch(u){const h=ii(u);return l||p!==a||(s.value=h,o.value="error",t.onError?.(h)),n.peek()}};if(t.watch?.length){let p=!1;c=j(()=>{for(const u of t.watch??[])ai(u);if(!p){p=!0,r&&ue(()=>d());return}ue(()=>d())})}else r&&d();return{data:n,error:s,status:o,pending:i,execute:d,refresh:d,abort:()=>{},clear:f,dispose:m}},yi=e=>e>=200&&e<300,Ir=(e,t)=>e instanceof DOMException&&e.name===t,at=e=>Ir(e,"TimeoutError"),_r=e=>Ir(e,"AbortError"),gi=e=>{if(_r(e)||at(e)||e.code==="ABORT"||e.code==="TIMEOUT")return!1;const t=e.status;return t===void 0||t>=500},bi=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},wi=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),Ei=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s=!1,o;const i=()=>{s||(s=!0,clearTimeout(o),t?.removeEventListener("abort",i),n(t?.reason??new DOMException("The operation was aborted.","AbortError")))};o=setTimeout(()=>{s||(s=!0,t?.removeEventListener("abort",i),r())},e),t?.addEventListener("abort",i,{once:!0})}),K=(e,t={})=>{const r=Z().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch,o=t.validateStatus??yi;let i=null;const a=(c,f)=>{const m=f||at(c)||at(i?.signal.reason);return Object.assign(new Error(m?`Request timeout of ${t.timeout}ms exceeded`:"Request aborted"),{code:m?"TIMEOUT":"ABORT"})},l=Dr(async()=>{const c=ui(e),f=typeof c=="string"||c instanceof URL?di(c,t.baseUrl??r?.baseUrl):c instanceof Request&&t.query?new URL(c.url):null;f&&t.query&&fi(f,t.query);const m=Nr(r?.headers,c instanceof Request?c.headers:void 0,t.headers),d=t.body!=null,p=$t(t.method),u=mi(p,c,d),h=u==="GET"||u==="HEAD"?u:null;if(d&&h)throw new Error(`Cannot send a request body with ${h} requests`);const v=pi(p,c,u),b=bi(t.retry),y=(b?.count??0)+1,w=new AbortController;i=w;let E,k=!1,A;t.signal&&(t.signal.aborted?w.abort(t.signal.reason):(A=()=>w.abort(t.signal?.reason),t.signal.addEventListener("abort",A,{once:!0}))),t.timeout&&t.timeout>0&&(E=setTimeout(()=>{k=!0,w.abort(new DOMException("Request timeout","TimeoutError"))},t.timeout));const S={...t,method:v,headers:m};delete S.baseUrl,delete S.query,delete S.parseAs,delete S.fetcher,delete S.defaultValue,delete S.immediate,delete S.watch,delete S.transform,delete S.onSuccess,delete S.onError,delete S.timeout,delete S.retry,delete S.validateStatus;let T=f??c;c instanceof Request&&f&&f.toString()!==c.url&&(T=new Request(f.toString(),vi(c)));const P=()=>{const O=new Headers(m);return{...S,headers:O,body:ci(t.body,O),signal:w.signal}};if(y>1&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream)throw new Error("Cannot retry requests with ReadableStream bodies");if(y>1&&typeof Request<"u"&&T instanceof Request&&T.body!==null)throw new Error("Cannot retry requests with non-replayable Request bodies");let R;try{for(let O=0;O<y;O++)try{const C=await s(T,P());if(!o(C.status))throw Object.assign(new Error(`Request failed with status ${C.status}`),{response:C,status:C.status,statusText:C.statusText});return await hi(C,n)}catch(C){const L=C instanceof Error?C:new Error(String(C));if(w.signal.aborted||_r(L)||at(L))throw a(w.signal.aborted?w.signal.reason:L,k);if(R=L,!(b&&(b.retryOn??gi)(L,O))||O>=y-1)throw L;await Ei(wi(b.delay,O),w.signal)}throw R}finally{E!==void 0&&clearTimeout(E),t.signal&&A&&t.signal.removeEventListener("abort",A),i===w&&(i=null)}},t);return l.abort=()=>{i&&i.abort(new DOMException("Request aborted","AbortError"))},l};function Si(e={}){return(t,r={})=>{const n=e,s=ge({},n.query??{},r.query??{});return K(t,{...n,...r,headers:Nr(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var ie=class extends Error{constructor(e,t,r,n){super(e),this.name="HttpError",this.config=t,this.code=r,this.response=n}};function qr(){const e=[];let t=0;return{use(r,n){const s=t++;return e.push({id:s,fulfilled:r,rejected:n}),s},eject(r){const n=e.findIndex(s=>s?.id===r);n!==-1&&(e[n]=null)},clear(){e.length=0},forEach(r){for(const n of e)n&&r(n)}}}var Ai=e=>e>=200&&e<300,ki=e=>{if(e.code==="PARSE")return!1;if(e.code==="TIMEOUT"||e.code==="NETWORK")return!0;const t=e.response?.status;return t!==void 0&&t>=500},Ti=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},Ci=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),Ri=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s;const o=()=>{clearTimeout(s),t?.removeEventListener("abort",o),n(t?.reason??new DOMException("The operation was aborted.","AbortError"))};s=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),t&&t.addEventListener("abort",o,{once:!0})}),zr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},Oi=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),Li=(e,t)=>e==null||Oi(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),$i=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},Pi=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return new URL(e,n)},Mi=async(e,t,r)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const n=await e.text();if(n)try{return JSON.parse(n)}catch(s){throw new ie(`Failed to parse JSON response${e.url?` for ${e.url}`:""} (status ${e.status}): ${s instanceof Error?s.message:String(s)}`,r,"PARSE",{data:n,status:e.status,statusText:e.statusText,headers:e.headers,config:r})}},Ni=(e,t)=>{const r=e.body;if(!r)return e;const n=parseInt(e.headers.get("content-length")??"0",10)||0;let s=0;const o=r.getReader(),i=new ReadableStream({async pull(a){const{done:l,value:c}=await o.read();if(l){a.close();return}s+=c.byteLength,t({loaded:s,total:n,percent:n>0?Math.round(s/n*100):void 0}),a.enqueue(c)},cancel(a){o.cancel(a)}});return new Response(i,{status:e.status,statusText:e.statusText,headers:e.headers})},Di=async e=>{const t=Z().fetch,r=e.parseAs??t?.parseAs??"json",n=e.fetcher??fetch,s=e.validateStatus??Ai,o=Pi(e.url??"/",e.baseUrl??t?.baseUrl);e.query&&$i(o,e.query);const i=zr(t?.headers,e.headers),a=Li(e.body,i),l={};e.method&&(l.method=e.method.toUpperCase()),l.headers=i,a!=null&&(l.body=a),e.cache&&(l.cache=e.cache),e.credentials&&(l.credentials=e.credentials),e.integrity&&(l.integrity=e.integrity),e.keepalive!==void 0&&(l.keepalive=e.keepalive),e.mode&&(l.mode=e.mode),e.redirect&&(l.redirect=e.redirect),e.referrer&&(l.referrer=e.referrer),e.referrerPolicy&&(l.referrerPolicy=e.referrerPolicy);let c,f=e.signal,m;if(e.timeout&&e.timeout>0){const d=new AbortController;e.signal&&(m=()=>d.abort(e.signal?.reason),e.signal.addEventListener("abort",m,{once:!0})),c=setTimeout(()=>{d.abort(new DOMException("Request timeout","TimeoutError"))},e.timeout),f=d.signal}f&&(l.signal=f);try{let d=await n(o.toString(),l);if(e.onDownloadProgress&&(d=Ni(d,e.onDownloadProgress)),!s(d.status))throw new ie(`Request failed with status ${d.status}`,e,"ERR_BAD_RESPONSE",{data:void 0,status:d.status,statusText:d.statusText,headers:d.headers,config:e});return{data:await Mi(d,r,e),status:d.status,statusText:d.statusText,headers:d.headers,config:e}}catch(d){if(d instanceof ie)throw d;if(d instanceof DOMException&&(d.name==="AbortError"||d.name==="TimeoutError")){const p=d.name==="TimeoutError"||d.message==="Request timeout";throw new ie(p?`Request timeout of ${e.timeout}ms exceeded`:"Request aborted",e,p?"TIMEOUT":"ABORT")}throw new ie(d instanceof Error?d.message:String(d),e,"NETWORK")}finally{c!==void 0&&clearTimeout(c),e.signal&&m&&e.signal.removeEventListener("abort",m)}};function Pt(e={}){const t=qr(),r=qr(),n=i=>{const a=ge({},e.query??{},i.query??{});return{...e,...i,headers:zr(e.headers,i.headers),query:Object.keys(a).length>0?a:void 0}},s=async i=>{let a=i;const l=[];t.forEach(d=>l.push(d));for(const{fulfilled:d,rejected:p}of l)try{d&&(a=await d(a))}catch(u){if(p){const h=await p(u);if(ye(h))a=h;else throw u}else throw u}const c=Ti(a.retry);let f;const m=(c?.count??0)+1;for(let d=0;d<m;d++)try{let p=await Di(a);const u=[];r.forEach(h=>u.push(h));for(const{fulfilled:h,rejected:v}of u)try{h&&(p=await h(p))}catch(b){if(v){const y=await v(b);if(y&&typeof y=="object"&&"data"in y)p=y;else throw b}else throw b}return p}catch(p){const u=p instanceof ie?p:new ie(p instanceof Error?p.message:String(p),a,"NETWORK");if(f=u,!(c&&(c.retryOn??ki)(u,d))||d>=m-1){const v=[];r.forEach(y=>v.push(y));let b=u;for(const{rejected:y}of v)if(y)try{const w=await y(b);if(w&&typeof w=="object"&&"data"in w)return w;w!=null&&(b=w)}catch(w){w!=null&&(b=w)}throw b instanceof Error||(b=u),b}const h=c?Ci(c.delay,d):0;c?.onRetry?.(u,d+1),await Ri(h,a.signal)}throw f},o=i=>s(n(i));return{request:o,get:(i,a={})=>o({...a,url:i,method:"GET"}),post:(i,a,l={})=>o({...l,url:i,method:"POST",body:a}),put:(i,a,l={})=>o({...l,url:i,method:"PUT",body:a}),patch:(i,a,l={})=>o({...l,url:i,method:"PATCH",body:a}),delete:(i,a={})=>o({...a,url:i,method:"DELETE"}),head:(i,a={})=>o({...a,url:i,method:"HEAD"}),options:(i,a={})=>o({...a,url:i,method:"OPTIONS"}),interceptors:{request:t,response:r},defaults:e}}var Ii=Pt();function _i(e={}){const{concurrency:t=6}=e;if(!Number.isInteger(t)||t<1)throw new Error("Request queue concurrency must be a positive integer");const r=[];let n=0;const s=()=>{for(;n<t&&r.length>0;){const o=r.shift();n++,Promise.resolve().then(o.execute).then(o.resolve,o.reject).finally(()=>{n--,s()})}};return{add(o){return new Promise((i,a)=>{r.push({execute:o,resolve:i,reject:a}),s()})},get pending(){return n},get size(){return r.length},clear(){const o=r.splice(0);for(const i of o)i.reject(new Error("Request queue cleared"))}}}var qi=(e,t)=>{const r=D(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},zi=(e,t={})=>{const{initialPage:r=1,...n}=t,s=$(r),o=K(()=>e(s.value),{...n,watch:n.watch});return{...o,page:s,next:async()=>(s.value=s.peek()+1,o.execute()),prev:async()=>{const c=s.peek();return c>1&&(s.value=c-1),o.execute()},goTo:async c=>(s.value=Math.max(1,c),o.execute())}},xi=(e,t)=>{const{getNextCursor:r,transform:n,initialCursor:s,immediate:o=!0,onSuccess:i,onError:a,...l}=t,c=$([]),f=$(t.defaultValue),m=$(null),d=$("idle"),p=D(()=>d.value==="pending"),u=$(s),h=D(()=>c.value.length===0||u.value!==void 0);let v=!1,b=0;const y=S=>n?n(S):S,w=async()=>{if(v)return f.peek();const S=++b;d.value="pending",m.value=null;try{const T=K(e(u.peek()),{...l,immediate:!1,watch:void 0}),P=await T.execute(),R=T.error.peek();if(T.dispose(),v||S!==b)return f.peek();if(R)return m.value=R,d.value="error",a?.(R),f.peek();if(P!==void 0){const O=P,C=[...c.peek(),O];c.value=C,u.value=r(O,C);const L=y(C);return f.value=L,d.value="success",i?.(L),L}return d.value="success",f.peek()}catch(T){if(v||S!==b)return f.peek();const P=T instanceof Error?T:new Error(String(T));return m.value=P,d.value="error",a?.(P),f.peek()}},E=async()=>(c.value=[],u.value=s,f.value=t.defaultValue,m.value=null,d.value="idle",b+=1,w()),k=()=>{b+=1,c.value=[],u.value=s,f.value=t.defaultValue,m.value=null,d.value="idle"},A=()=>{v||(v=!0,b+=1)};return o&&w(),{data:f,pages:c,error:m,status:d,pending:p,hasMore:h,fetchNextPage:w,refresh:E,clear:k,dispose:A}},ji=(e,t)=>{let r=!1,n=null;try{if(n=globalThis.localStorage,n){const i=`__bquery_test_${Math.random().toString(36).slice(2,9)}__`,a="__test__";try{n.setItem(i,a),n.getItem(i),r=!0}finally{try{n.removeItem(i)}catch{}}}}catch{r=!1}let s=t;if(r&&n)try{const i=n.getItem(e);i!==null&&(s=JSON.parse(i))}catch{}const o=$(s);return r&&n&&j(()=>{try{n.setItem(e,JSON.stringify(o.value))}catch{}}),o},Fi=(e,t)=>{const{interval:r,enabled:n=!0,pauseOnHidden:s=!0,pauseOnOffline:o=!0,immediate:i=!0,...a}=t;if(!Number.isFinite(r)||r<1)throw new Error("Polling interval must be a finite number of at least 1");const l=$(!1),c=$(!1),f=$(!1),m=typeof n=="function"?n:()=>n,d=D(()=>m()&&!l.value&&!(s&&c.value)&&!(o&&f.value)),p=K(e,{...a,immediate:i&&m()});let u,h=[];const v=()=>{b(),u=setInterval(()=>{p.execute()},r)},b=()=>{u!==void 0&&(clearInterval(u),u=void 0)},y=j(()=>{const k=d.value;ue(()=>{k?v():b()})});if(s&&typeof document<"u"){c.value=document.hidden;const k=()=>{c.value=document.hidden};document.addEventListener("visibilitychange",k),h.push(()=>document.removeEventListener("visibilitychange",k))}if(o&&typeof window<"u"){const k=()=>{f.value=!1},A=()=>{f.value=!0};window.addEventListener("online",k),window.addEventListener("offline",A),h.push(()=>{window.removeEventListener("online",k),window.removeEventListener("offline",A)}),f.value=typeof navigator<"u"&&navigator.onLine!==void 0?!navigator.onLine:!1}const w=p.dispose;return{...p,pause:()=>{l.value=!0},resume:()=>{l.value=!1},isActive:d,dispose:()=>{b(),y();for(const k of h)k();h=[],w()}}},xr=Symbol("bquery.readonlySignal"),jr=e=>typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,xr),I=e=>Object.defineProperties({},{value:{get(){return e.value},enumerable:!0},peek:{value(){return e.peek()},enumerable:!0},[xr]:{value:!0,enumerable:!1,configurable:!1,writable:!1}}),Ui=(e,t={})=>{const{optimistic:r=!1,onMutationSuccess:n,onMutationError:s,...o}=t,i=K(e,{...o}),a=$(!1),l=D(()=>a.value);let c=!1;const f=()=>{const v=typeof e=="function"?e():e;return v instanceof URL?v.toString():v},m=()=>{const{defaultValue:v,transform:b,onSuccess:y,onError:w,...E}=o;return E},d=async(v,b,y,w)=>{if(c)return i.data.peek();const E=i.data.peek();r&&w!==void 0&&(i.data.value=w),a.value=!0,i.error.value=null;try{const k=K(f(),{...m(),method:b,body:y??void 0,immediate:!1,watch:void 0}),A=await k.execute(),S=k.error.peek();return k.dispose(),c?i.data.peek():S?(r&&w!==void 0&&(i.data.value=E),i.error.value=S,i.status.value="error",a.value=!1,s?.(S,v),i.data.peek()):(b!=="DELETE"&&A!==void 0&&(i.data.value=A),a.value=!1,i.status.value="success",n?.(A,v),A)}catch(k){if(c)return i.data.peek();r&&w!==void 0&&(i.data.value=E);const A=k instanceof Error?k:new Error(String(k));return i.error.value=A,i.status.value="error",a.value=!1,s?.(A,v),i.data.peek()}},p={fetch:()=>i.execute(),create:v=>d("create","POST",v),update:v=>{const b=i.data.peek();return d("update","PUT",v,r&&b!==void 0?{...b,...v}:void 0)},patch:v=>{const b=i.data.peek();return d("patch","PATCH",v,r&&b!==void 0?{...b,...v}:void 0)},remove:async()=>{await d("remove","DELETE"),!c&&i.error.peek()==null&&(i.data.value=void 0)}},u=i.dispose,h=()=>{c||(c=!0,u())};return{data:i.data,error:i.error,status:i.status,pending:i.pending,isMutating:l,actions:p,refresh:i.execute,clear:i.clear,dispose:h}},Bi=(e,t={})=>{const{method:r="POST",...n}=t,s=$(void 0),o=$(null),i=$("idle"),a=D(()=>i.value==="pending");return{data:s,error:o,status:i,pending:a,submit:async f=>{i.value="pending",o.value=null;try{const m=K(e,{...n,method:r,body:f,immediate:!1,watch:void 0}),d=await m.execute(),p=m.error.peek();if(m.dispose(),p){o.value=p,i.value="error";return}return s.value=d,i.value="success",d}catch(m){o.value=m instanceof Error?m:new Error(String(m)),i.value="error";return}},clear:()=>{s.value=void 0,o.value=null,i.value="idle"}}},Wi=(e,t={})=>{const r=Pt({...t});let n=e;for(;n.endsWith("/");)n=n.slice(0,-1);return{list:s=>r.get(n,s),get:(s,o)=>r.get(`${n}/${encodeURIComponent(String(s))}`,o),create:(s,o)=>r.post(n,s,o),update:(s,o,i)=>r.put(`${n}/${encodeURIComponent(String(s))}`,o,i),patch:(s,o,i)=>r.patch(`${n}/${encodeURIComponent(String(s))}`,o,i),remove:(s,o)=>r.delete(`${n}/${encodeURIComponent(String(s))}`,o),http:r}},Hi=(e,t={})=>{const{getId:r=y=>y.id,optimistic:n=!1,onMutationSuccess:s,onMutationError:o,...i}=t,a=K(e,{...i}),l=$(!1),c=D(()=>l.value);let f=!1;const m=()=>{const y=typeof e=="function"?e():e;return y instanceof URL?y.toString():y},d=()=>{let y=m();for(;y.endsWith("/");)y=y.slice(0,-1);return y},p=()=>{const{defaultValue:y,transform:w,onSuccess:E,onError:k,...A}=i;return A},u=async(y,w,E,k,A,S)=>{if(!f){n&&A&&A(),l.value=!0,a.error.value=null;try{const T=K(`${d()}${E}`,{...p(),method:w,body:k??void 0,immediate:!1,watch:void 0}),P=await T.execute(),R=T.error.peek();if(T.dispose(),f)return;if(R){n&&S&&S(),a.error.value=R,a.status.value="error",l.value=!1,o?.(R,y);return}return l.value=!1,a.status.value="success",s?.(y),P}catch(T){if(f)return;n&&S&&S();const P=T instanceof Error?T:new Error(String(T));a.error.value=P,a.status.value="error",l.value=!1,o?.(P,y);return}}},h={fetch:()=>a.execute(),add:async y=>{const w=a.data.peek(),E=y,k=w?.length??0,A=await u("add","POST","",y,n?()=>{a.data.value=[...w??[],E]}:void 0,n?()=>{a.data.value=w}:void 0);if(A!==void 0&&!f){const S=a.data.peek()??[];if(n){const T=[...S];k<T.length&&T[k]===E?T[k]=A:T.push(A),a.data.value=T}else a.data.value=[...S,A]}return A},update:async(y,w)=>{const E=a.data.peek(),k=await u("update","PUT",`/${encodeURIComponent(String(y))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===y?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(k!==void 0&&!f){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===y?k:S)}return k},patch:async(y,w)=>{const E=a.data.peek(),k=await u("patch","PATCH",`/${encodeURIComponent(String(y))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===y?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(k!==void 0&&!f){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===y?k:S)}return k},remove:async y=>{const w=a.data.peek();if(await u("remove","DELETE",`/${encodeURIComponent(String(y))}`,void 0,n&&w?()=>{a.data.value=w.filter(E=>r(E)!==y)}:void 0,n?()=>{a.data.value=w}:void 0),!n&&!f&&a.error.peek()==null){const E=a.data.peek()??[];a.data.value=E.filter(k=>r(k)!==y)}}},v=a.dispose,b=()=>{f||(f=!0,v())};return{data:a.data,error:a.error,status:a.status,pending:a.pending,isMutating:c,actions:h,refresh:a.execute,clear:a.clear,dispose:b}},Mt=new Map;function Qi(e,t){const r=Mt.get(e);if(r)return r;const n=t().finally(()=>{Mt.delete(e)});return Mt.set(e,n),n}var fe=e=>e instanceof _e,qe=e=>e instanceof Ie,Vi=e=>e instanceof _e||e instanceof Ie||jr(e)?e.value:e,Nt=(e,t,r={})=>{const{immediate:n=!1,equals:s=Object.is}=r;let o,i=!0;return j(()=>{const a=e.value;if(i){i=!1,o=a,n&&t(a,void 0);return}s(a,o)||(t(a,o),o=a)})},Ki=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=Number.isFinite(r)?Math.max(0,r):0;let a=!1,l,c;const f=()=>{m.cancel(),a=!1,c=void 0},m=Tt(()=>{if(a){try{t(l,c)}catch(p){console.error("bQuery reactive: Error in watchDebounce callback",p)}a=!1,c=void 0}},i);s&&t(e.peek(),void 0);const d=Nt(e,(p,u)=>{a||(c=u),l=p,a=!0,m()},{equals:o});return Pr()&&Mr(f),()=>{d(),f()}},Yi=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=Cr((l,c)=>{t(l,c)},Number.isFinite(r)?Math.max(0,r):0);s&&i(e.peek(),void 0);const a=Nt(e,(l,c)=>{i(l,c)},{equals:o});return()=>{a(),i.cancel()}};function Fr(e){return e===!1?!1:e===!0||e===void 0?{}:e}var Gi=e=>e?e===!0?{}:e:!1,Ur=(e,t)=>{const r=t.delay??1e3,n=t.factor??2,s=t.maxDelay??3e4;return Math.min(r*n**e,s)},Dt=(e,t)=>{if(typeof t=="string"||t instanceof Blob||t instanceof ArrayBuffer){e.send(t);return}if(ArrayBuffer.isView(t)){e.send(t);return}if(typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer){e.send(t);return}throw new TypeError("Unsupported WebSocket payload type.")},Br=(e,t={})=>{const{protocols:r,immediate:n=!0,historySize:s=0,onOpen:o,onMessage:i,onClose:a,onError:l,onReconnect:c}=t,f=t.serialize??(N=>JSON.stringify(N)),m=t.deserialize??(N=>{const W=N.data;if(typeof W=="string")try{return JSON.parse(W)}catch{return W}return W}),d=$("CLOSED"),p=$(void 0),u=$(null),h=$([]),v=$(0),b=$(0),y=$(0),w=D(()=>d.value==="OPEN");let E=null,k=!1,A=!1,S,T,P,R=0,O=!1,C=0;const L=[],M=Fr(t.autoReconnect),_=Gi(t.heartbeat),U=()=>{if(!_)return;q();const N=_.interval??3e4,W=_.pongTimeout??1e4,V=_.message??"ping";T=setInterval(()=>{E?.readyState===WebSocket.OPEN&&(C=Date.now(),Dt(E,V),P!==void 0&&clearTimeout(P),P=setTimeout(()=>{E?.close(4e3,"Heartbeat timeout")},W))},N)},q=()=>{T!==void 0&&(clearInterval(T),T=void 0),P!==void 0&&(clearTimeout(P),P=void 0)},Q=()=>{P!==void 0&&(clearTimeout(P),P=void 0),C>0&&(b.value=Date.now()-C,C=0)},oe=N=>{if(k||A||!M)return;const W=M.maxAttempts??1/0;if(R>=W||M.shouldReconnect&&!M.shouldReconnect(N,R))return;const V=Ur(R,M);S=setTimeout(()=>{R++,v.value=R,O=!0,ir()},V)},Oe=()=>{S!==void 0&&(clearTimeout(S),S=void 0)},or=()=>{if(!E||E.readyState!==WebSocket.OPEN)return;let N=0;for(;N<L.length&&E.readyState===WebSocket.OPEN;N++)Dt(E,L[N]);N>0&&L.splice(0,N)},Ze=()=>{const N=typeof e=="function"?e():e;return N instanceof URL?N.toString():N},ir=()=>{if(!k){Oe(),E&&(q(),C=0,E.onopen=null,E.onmessage=null,E.onclose=null,E.onerror=null,(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&E.close(),E=null),A=!1,d.value="CONNECTING",u.value=null;try{E=new WebSocket(Ze(),r)}catch{d.value="CLOSED";return}E.onopen=N=>{d.value="OPEN";const W=O,V=R;R=0,v.value=0,O=!1,or(),U(),o?.(N),W&&c?.(V)},E.onmessage=N=>{if(_){const V=_.responseMessage;(V===void 0||N.data===V)&&Q()}const W=m(N);if(p.value=W,s>0){const V=[...h.peek(),W];h.value=V.length>s?V.slice(-s):V}i?.(W,N)},E.onclose=N=>{d.value="CLOSED",q(),A||(y.value=Date.now()),a?.(N),!A&&!k&&oe(N)},E.onerror=N=>{u.value=N,l?.(N)}}},Ws=(N,W)=>{A=!0,Oe(),q(),E&&(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&(d.value="CLOSING",E.close(N,W))},qf=N=>{k||Hs(f(N))},Hs=N=>{k||(E?.readyState===WebSocket.OPEN?Dt(E,N):L.push(N))},zf=()=>{k||(k=!0,Ws(),L.length=0,E=null)};return n&&ir(),{status:d,data:p,error:u,history:h,isConnected:w,reconnectAttempts:v,latency:b,lastDisconnectedAt:y,send:qf,sendRaw:Hs,open:ir,close:Ws,dispose:zf}},Ji=(e,t={},r={})=>{const n=r.getChannel??(f=>f.channel),s=r.wrap??((f,m)=>({channel:f,data:m})),o=new Map,i=new Map,a=Br(e,{...t,onMessage:(f,m)=>{const d=n(f);if(d!==void 0){const p=o.get(d);p&&(p.value=f)}t.onMessage?.(f,m)}});return{subscribe:f=>{let m=o.get(f);m||(m=$(void 0),o.set(f,m)),i.set(f,(i.get(f)??0)+1);let d=!1;return{data:m,unsubscribe:()=>{if(d)return;d=!0;const p=(i.get(f)??1)-1;p<=0?(i.delete(f),o.delete(f)):i.set(f,p)}}},publish:(f,m)=>{a.send(s(f,m))},ws:a}},Xi=(e,t={})=>{const{immediate:r=!0,events:n=[],eventSourceInit:s,onOpen:o,onMessage:i,onError:a}=t,l=t.deserialize??(O=>{try{return JSON.parse(O)}catch{return O}}),c=$("CLOSED"),f=$(void 0),m=$(void 0),d=$(null),p=D(()=>c.value==="OPEN"),u=Fr(t.autoReconnect);let h=null,v=!1,b=!1,y,w=0;const E=()=>{const O=typeof e=="function"?e():e;return O instanceof URL?O.toString():O},k=O=>C=>{const L=l(C.data);f.value=L,m.value=O,i?.(L,C)},A=()=>{y!==void 0&&(clearTimeout(y),y=void 0)},S=()=>{if(v||b||!u)return;const O=u.maxAttempts??1/0;if(w>=O)return;const C=Ur(w,u);y=setTimeout(()=>{w++,T()},C)},T=()=>{if(!v){A(),h&&(h.close(),h=null),b=!1,c.value="CONNECTING",d.value=null;try{h=new EventSource(E(),s)}catch{c.value="CLOSED";return}h.onopen=O=>{c.value="OPEN",w=0,o?.(O)},h.onerror=O=>{d.value=O,a?.(O),h?.readyState===EventSource.CLOSED&&(c.value="CLOSED",!b&&!v&&S())},h.addEventListener("message",k("message"));for(const O of n)h.addEventListener(O,k(O))}},P=()=>{b=!0,A(),h&&(h.close(),h=null),c.value="CLOSED"},R=()=>{v||(v=!0,P())};return r&&T(),{status:c,data:f,eventName:m,error:d,isConnected:p,open:T,close:P,dispose:R}},F=class extends Error{constructor(e,t,r){super(e),this.name="TaskWorkerError",this.code=t,r!==void 0&&(this.cause=r)}},It=class extends F{constructor(e="Concurrency tasks are not supported in this environment.",t){super(e,"UNSUPPORTED",t),this.name="TaskWorkerUnsupportedError"}},de=class extends F{constructor(e,t){super(e,"SERIALIZATION",t),this.name="TaskWorkerSerializationError"}},lt=class extends F{constructor(e,t){super(e,"TIMEOUT",t),this.name="TaskWorkerTimeoutError"}},ae=class extends F{constructor(e="The worker task was aborted.",t){super(e,"ABORT",t),this.name="TaskWorkerAbortError"}},Zi=new Set(["ABORT","BUSY","METHOD_NOT_FOUND","QUEUE_CLEARED","QUEUE_FULL","SERIALIZATION","TERMINATED","TIMEOUT","UNSUPPORTED","WORKER"]),ea=/\{\s*\[native code\]\s*\}$/u,ta=e=>typeof e=="string"&&Zi.has(e),ct=e=>{if(!(typeof e!="number"||!Number.isFinite(e)||e<=0))return e},ze=e=>{const t=Function.prototype.toString.call(e).trim();if(!t||ea.test(t))throw new de("Task handlers must be standalone user-defined functions or arrow functions.");try{if(typeof new Function(`return (${t});`)()!="function")throw new TypeError("Task handler did not revive as a function.")}catch(r){throw new de("Task handlers must be standalone functions that can be reconstructed in a worker context.",r)}return t},Wr=(e,t)=>{const r=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(r);try{return new Worker(n,t?{name:t}:void 0)}finally{URL.revokeObjectURL(n)}},Hr=e=>{const t=e?.message||"Worker task failed.",r=ta(e?.code)?e.code:"WORKER",n=r==="TIMEOUT"?new lt(t):new F(t,r);return n.name=e?.name||n.name,e?.stack&&(n.stack=e.stack),n};function Qr(){const e=typeof globalThis.Worker=="function",t=typeof globalThis.Blob=="function",r=typeof globalThis.URL<"u"&&globalThis.URL!==null&&typeof globalThis.URL.createObjectURL=="function"&&typeof globalThis.URL.revokeObjectURL=="function";return{worker:e,blob:t,objectUrl:r,abortController:typeof globalThis.AbortController=="function",supported:e&&t&&r}}function _t(){return Qr().supported}var Vr="bq:rpc",ra=e=>{const t=Object.keys(e);if(t.length===0)throw new de("RPC workers require at least one standalone method handler.");return t.map(r=>{const n=e[r];if(typeof n!="function")throw new de(`RPC handler "${r}" must be a standalone function.`);return[r,ze(n)]})},na=e=>`'use strict';
2
+ const serializeError = (error) => {
3
+ if (error && typeof error === 'object') {
4
+ return {
5
+ code: typeof error.code === 'string' ? error.code : undefined,
6
+ message: typeof error.message === 'string' ? error.message : 'Worker RPC call failed.',
7
+ name: typeof error.name === 'string' ? error.name : 'Error',
8
+ stack: typeof error.stack === 'string' ? error.stack : undefined,
9
+ };
10
+ }
11
+
12
+ return {
13
+ message: typeof error === 'string' ? error : 'Worker RPC call failed.',
14
+ name: 'Error',
15
+ };
16
+ };
17
+
18
+ const handlers = Object.create(null);
19
+ ${e.map(([t,r])=>`handlers[${JSON.stringify(t)}] = (${r});`).join(`
20
+ `)}
21
+
22
+ const hasOwn = Object.prototype.hasOwnProperty;
23
+
24
+ self.onmessage = async (event) => {
25
+ const message = event.data;
26
+ if (!message || message.type !== '${Vr}') {
27
+ return;
28
+ }
29
+
30
+ const method = typeof message.method === 'string' ? message.method : '';
31
+ if (!hasOwn.call(handlers, method)) {
32
+ self.postMessage({
33
+ error: {
34
+ code: 'METHOD_NOT_FOUND',
35
+ message: 'Unknown RPC method "' + String(method) + '".',
36
+ name: 'TaskWorkerError',
37
+ },
38
+ id: message.id,
39
+ type: 'bq:error',
40
+ });
41
+ return;
42
+ }
43
+
44
+ try {
45
+ const result = await handlers[method](message.payload);
46
+ self.postMessage({ id: message.id, result, type: 'bq:result' });
47
+ } catch (error) {
48
+ self.postMessage({ error: serializeError(error), id: message.id, type: 'bq:error' });
49
+ }
50
+ };`;function ut(e,t={}){if(!_t())throw new It;const r=na(ra(e)),n=ct(t.timeout);let s=!1,o=null,i=null,a=0,l;const c=()=>{i&&(i.timeoutId!==void 0&&clearTimeout(i.timeoutId),i.abortHandler&&l?.removeEventListener("abort",i.abortHandler),i=null,l=void 0)},f=()=>{o&&(o.onmessage=null,o.onerror=null,o.terminate(),o=null)},m=u=>{if(!i)return;const h=i;c(),h.reject(u)},d=()=>{if(s)throw new F("The RPC worker has already been terminated.","TERMINATED");if(o)return o;const u=Wr(r,t.name);return u.onmessage=h=>{const v=i;if(!v)return;const b=h.data;if(!(!b||b.id!==v.id)){if(c(),b.type==="bq:error"){v.reject(Hr(b.error));return}v.resolve(b.result)}},u.onerror=h=>{const v=new F(h.message||"Worker RPC execution failed.","WORKER");f(),m(v)},o=u,u},p=u=>{f(),m(u)};return{get busy(){return i!==null},get state(){return s?"terminated":i?"running":"idle"},call(u,h,v={}){if(s)return Promise.reject(new F("The RPC worker has already been terminated.","TERMINATED"));if(i)return Promise.reject(new F("This RPC worker is already processing a request. Wait for the current call to finish or create another worker.","BUSY"));if(v.signal?.aborted)return Promise.reject(new ae);const b=d(),y=ct(v.timeout)??n,w=a++;return new Promise((E,k)=>{const A={id:w,reject:k,resolve:E};v.signal&&(A.abortHandler=()=>{p(new ae)},l=v.signal,v.signal.addEventListener("abort",A.abortHandler,{once:!0})),y!==void 0&&(A.timeoutId=setTimeout(()=>{p(new lt(`Worker RPC call exceeded the timeout of ${y}ms.`))},y)),i=A;try{b.postMessage({id:w,method:u,payload:h,type:Vr},v.transfer??[])}catch(S){f(),m(new de("Failed to serialize the RPC payload or transfer list for worker execution.",S))}})},terminate(){s||(s=!0,f(),m(new F("The RPC worker was terminated.","TERMINATED")))}}}async function sa(e,t,r,n={}){const s=ut(e,n);try{return await s.call(t,r,n)}finally{s.terminate()}}var Kr="bq:run",oa=e=>`'use strict';
51
+ const serializeError = (error) => {
52
+ if (error && typeof error === 'object') {
53
+ return {
54
+ code: typeof error.code === 'string' ? error.code : undefined,
55
+ message: typeof error.message === 'string' ? error.message : 'Worker task failed.',
56
+ name: typeof error.name === 'string' ? error.name : 'Error',
57
+ stack: typeof error.stack === 'string' ? error.stack : undefined,
58
+ };
59
+ }
60
+
61
+ return {
62
+ message: typeof error === 'string' ? error : 'Worker task failed.',
63
+ name: 'Error',
64
+ };
65
+ };
66
+
67
+ const handler = (${e});
68
+
69
+ if (typeof handler !== 'function') {
70
+ throw new TypeError('The worker task handler must evaluate to a function.');
71
+ }
72
+
73
+ self.onmessage = async (event) => {
74
+ const message = event.data;
75
+ if (!message || message.type !== '${Kr}') {
76
+ return;
77
+ }
78
+
79
+ try {
80
+ const result = await handler(message.payload);
81
+ self.postMessage({ id: message.id, result, type: 'bq:result' });
82
+ } catch (error) {
83
+ self.postMessage({ error: serializeError(error), id: message.id, type: 'bq:error' });
84
+ }
85
+ };`;function ft(e,t={}){if(!_t())throw new It;const r=oa(ze(e)),n=ct(t.timeout);let s=!1,o=null,i=null,a=0;const l=()=>{i&&(i.timeoutId!==void 0&&clearTimeout(i.timeoutId),i.abortHandler&&c?.removeEventListener("abort",i.abortHandler),i=null,c=void 0)};let c;const f=()=>{o&&(o.onmessage=null,o.onerror=null,o.terminate(),o=null)},m=u=>{if(!i)return;const h=i;l(),h.reject(u)},d=()=>{if(s)throw new F("The task worker has already been terminated.","TERMINATED");if(o)return o;const u=Wr(r,t.name);return u.onmessage=h=>{const v=i;if(!v)return;const b=h.data;if(!(!b||b.id!==v.id)){if(l(),b.type==="bq:error"){v.reject(Hr(b.error));return}v.resolve(b.result)}},u.onerror=h=>{const v=new F(h.message||"Worker execution failed.","WORKER");f(),m(v)},o=u,u},p=u=>{f(),m(u)};return{get busy(){return i!==null},get state(){return s?"terminated":i?"running":"idle"},run(u,h={}){if(s)return Promise.reject(new F("The task worker has already been terminated.","TERMINATED"));if(i)return Promise.reject(new F("This task worker is already running a task. Create another worker or wait for the current task to finish.","BUSY"));if(h.signal?.aborted)return Promise.reject(new ae);const v=d(),b=ct(h.timeout)??n,y=a++;return new Promise((w,E)=>{const k={id:y,reject:E,resolve:w};h.signal&&(k.abortHandler=()=>{p(new ae)},c=h.signal,h.signal.addEventListener("abort",k.abortHandler,{once:!0})),b!==void 0&&(k.timeoutId=setTimeout(()=>{p(new lt(`Worker task exceeded the timeout of ${b}ms.`))},b)),i=k;try{v.postMessage({id:y,payload:u,type:Kr},h.transfer??[])}catch(A){f(),m(new de("Failed to serialize the task input or transfer list for worker execution.",A))}})},terminate(){s||(s=!0,f(),m(new F("The task worker was terminated.","TERMINATED")))}}}async function Yr(e,t,r={}){const n=ft(e,r);try{return await n.run(t,r)}finally{n.terminate()}}var ia=4,Gr=(e,t)=>{if(e===void 0)return ia;if(!Number.isInteger(e)||e<1)throw new RangeError(`${t} concurrency must be a positive integer.`);return e},Jr=(e,t)=>{if(e===void 0)return Number.POSITIVE_INFINITY;if(e===Number.POSITIVE_INFINITY)return e;if(!Number.isInteger(e)||e<0)throw new RangeError(`${t} maxQueue must be a non-negative integer or Infinity.`);return e},dt=e=>{e.abortHandler&&e.signal&&e.signal.removeEventListener("abort",e.abortHandler),e.abortHandler=void 0,e.signal=void 0},Xr=({abortedWhileQueuedMessage:e,clearMessage:t,concurrency:r,createWorkers:n,queueFullMessage:s,terminatedMessage:o,workerTerminatedMessage:i,runWorker:a,maxQueue:l})=>{const c=[],f=n(r);let m=!1,d=0;const p=()=>{if(!(m||c.length===0))for(const h of f){if(c.length===0)return;if(h.busy)continue;const v=c.shift();if(v.signal?.aborted){dt(v),v.reject(new ae(e));continue}dt(v),d++,a(h,v.job,v.options).then(v.resolve,v.reject).finally(()=>{d--,p()})}},u=h=>{const v=c.splice(0);for(const b of v)dt(b),b.reject(h)};return{get state(){return m?"terminated":d>0||c.length>0?"running":"idle"},get busy(){return d>0||c.length>0},concurrency:r,get pending(){return d},get size(){return c.length},enqueue(h,v={}){return m?Promise.reject(new F(i,"TERMINATED")):v.signal?.aborted?Promise.reject(new ae):new Promise((b,y)=>{const w={job:h,options:v,reject:y,resolve:b},E=f.find(k=>!k.busy);if(E){d++,a(E,h,v).then(b,y).finally(()=>{d--,p()});return}if(c.length>=l){y(new F(s,"QUEUE_FULL"));return}v.signal&&(w.signal=v.signal,w.abortHandler=()=>{const k=c.indexOf(w);k!==-1&&(c.splice(k,1),dt(w),y(new ae(e)))},v.signal.addEventListener("abort",w.abortHandler,{once:!0})),c.push(w)})},clear(){m||c.length===0||u(new F(t,"QUEUE_CLEARED"))},terminate(){if(!m){m=!0,u(new F(o,"TERMINATED"));for(const h of f)"terminate"in h&&typeof h.terminate=="function"&&h.terminate()}}}},Zr=(e,t)=>e?t===1?[e]:Array.from({length:t},(r,n)=>`${e}-${n+1}`):Array.from({length:t},()=>{});function ht(e,t={}){const{concurrency:r,maxQueue:n,...s}=t,o=Xr({abortedWhileQueuedMessage:"The queued task was aborted before execution started.",clearMessage:"The task pool queue was cleared.",concurrency:Gr(r,"Task pool"),createWorkers(i){const a=[],l=Zr(s.name,i);try{for(let c=0;c<i;c++)a.push(ft(e,{...s,name:l[c]}))}catch(c){for(const f of a)f.terminate();throw c}return a},queueFullMessage:"The task pool queue is full. Increase maxQueue, wait for pending tasks, or raise pool concurrency.",terminatedMessage:"The task pool was terminated.",workerTerminatedMessage:"The task pool has already been terminated.",runWorker(i,a,l){return i.run(a,l)},maxQueue:Jr(n,"Task pool")});return{get state(){return o.state},get busy(){return o.busy},get concurrency(){return o.concurrency},get pending(){return o.pending},get size(){return o.size},run(i,a){return o.enqueue(i,a)},clear(){o.clear()},terminate(){o.terminate()}}}function en(e,t={}){const{concurrency:r,maxQueue:n,...s}=t,o=Xr({abortedWhileQueuedMessage:"The queued RPC call was aborted before execution started.",clearMessage:"The RPC pool queue was cleared.",concurrency:Gr(r,"RPC pool"),createWorkers(i){const a=[],l=Zr(s.name,i);try{for(let c=0;c<i;c++)a.push(ut(e,{...s,name:l[c]}))}catch(c){for(const f of a)f.terminate();throw c}return a},queueFullMessage:"The RPC pool queue is full. Increase maxQueue, wait for pending calls, or raise pool concurrency.",terminatedMessage:"The RPC pool was terminated.",workerTerminatedMessage:"The RPC pool has already been terminated.",runWorker(i,a,l){return i.call(a.method,a.input,l)},maxQueue:Jr(n,"RPC pool")});return{get state(){return o.state},get busy(){return o.busy},get concurrency(){return o.concurrency},get pending(){return o.pending},get size(){return o.size},call(i,a,l){return o.enqueue({input:a,method:i},l)},clear(){o.clear()},terminate(){o.terminate()}}}var aa=async e=>{const t=new Function(`return (${e.handlerSource});`)();if(typeof t!="function")throw new TypeError("The serialized task handler did not revive as a function.");return await t(e.input)},la=async e=>{const t=new Function(`return (${e.handlerSource});`)();if(typeof t!="function")throw new TypeError("The serialized collection handler did not revive as a function.");const r=[];for(const n of e.items)r.push({index:n.index,value:await t(n.value,n.index)});return r},ca=async e=>{const t=new Function(`return (${e.reducerSource});`)();if(typeof t!="function")throw new TypeError("The serialized reducer did not revive as a function.");let r=e.initialValue;for(let n=0;n<e.values.length;n++)r=await t(r,e.values[n],n);return r},tn=(e,t)=>{if(e===void 0)return 1;if(!Number.isInteger(e)||e<1)throw new RangeError(`${t} batchSize must be a positive integer.`);return e},rn=e=>ht(aa,e),nn=e=>({handlerSource:ze(e.handler),input:e.input}),xe=async(e,t,r={},n)=>{if(e.length===0)return[];const s=ze(t),{batchSize:o,signal:i,...a}=r,l=tn(o,n),c=ht(la,a),f=[];for(let m=0;m<e.length;m+=l){const d=Math.min(m+l,e.length),p=[];for(let u=m;u<d;u+=1)p.push({index:u,value:e[u]});f.push({items:p,handlerSource:s})}try{const m=await Promise.all(f.map(p=>c.run(p,i?{signal:i}:void 0))),d=new Array(e.length);for(const p of m)for(const u of p)d[u.index]=u.value;return d}finally{c.terminate()}};async function ua(e,t={}){if(e.length===0)return[];const r=rn(t);try{return await Promise.all(e.map(n=>r.run(nn(n),n.options)))}finally{r.terminate()}}async function fa(e,t,r={}){if(e.length===0)return[];const n=tn(t,"batchTasks"),s=rn(r),o=[];try{for(let i=0;i<e.length;i+=n){const a=e.slice(i,i+n),l=await Promise.all(a.map(c=>s.run(nn(c),c.options)));o.push(...l)}return o}finally{s.terminate()}}async function sn(e,t,r={}){return xe(e,t,r,"map")}async function on(e,t,r={}){const n=await xe(e,t,r,"filter"),s=[];for(let o=0;o<e.length;o+=1)n[o]&&(o in e?s.push(e[o]):s.length+=1);return s}async function an(e,t,r={}){return e.length===0?!1:(await xe(e,t,r,"some")).some(Boolean)}async function ln(e,t,r={}){return e.length===0?!0:(await xe(e,t,r,"every")).every(Boolean)}async function cn(e,t,r={}){if(e.length===0)return;const n=(await xe(e,t,r,"find")).findIndex(Boolean);return n===-1?void 0:e[n]}async function un(e,t,r,n={}){return e.length===0?r:Yr(ca,{initialValue:r,reducerSource:ze(t),values:e},n)}var je=(e,t={})=>({...e,...t}),da=(e,t={})=>({signal:"signal"in t?t.signal:e.signal,timeout:"timeout"in t?t.timeout:e.timeout,transfer:t.transfer}),ha=class Qs{constructor(t,r){this.valuesPromise=t,this.defaults=r}createNext(t){return new Qs(this.valuesPromise.then(r=>t(r)),this.defaults)}map(t,r){const n=je(this.defaults,r);return this.createNext(s=>sn(s,t,n))}filter(t,r){const n=je(this.defaults,r);return this.createNext(s=>on(s,t,n))}toArray(){return this.valuesPromise.then(t=>t.slice())}some(t,r){const n=je(this.defaults,r);return this.valuesPromise.then(s=>an(s,t,n))}every(t,r){const n=je(this.defaults,r);return this.valuesPromise.then(s=>ln(s,t,n))}find(t,r){const n=je(this.defaults,r);return this.valuesPromise.then(s=>cn(s,t,n))}reduce(t,r,n){const s=da(this.defaults,n);return this.valuesPromise.then(o=>un(o,t,r,s))}};function ma(e,t={}){return new ha(Promise.resolve(e.slice()),t)}var fn=(e,t)=>{ce(()=>{t.state.value=e.state,t.busy.value=e.busy})},dn=(e,t)=>{ce(()=>{t.state.value=e.state,t.busy.value=e.busy,t.concurrency.value=e.concurrency,t.pending.value=e.pending,t.size.value=e.size})},hn=e=>({busy:$(e.busy),state:$(e.state)}),mn=e=>({busy:$(e.busy),concurrency:$(e.concurrency),pending:$(e.pending),size:$(e.size),state:$(e.state)}),mt=(e,t)=>(t(),e.finally(()=>{t(),queueMicrotask(t)}));function pa(e,t={}){const r=ft(e,t),n=hn(r),s=()=>{fn(r,n)};return{get busy(){return r.busy},get state(){return r.state},busy$:I(n.busy),state$:I(n.state),run(o,i={}){return mt(r.run(o,i),s)},terminate(){r.terminate(),s()}}}function va(e,t={}){const r=ut(e,t),n=hn(r),s=()=>{fn(r,n)};return{get busy(){return r.busy},get state(){return r.state},busy$:I(n.busy),state$:I(n.state),call(o,i,a={}){return mt(r.call(o,i,a),s)},terminate(){r.terminate(),s()}}}function ya(e,t={}){const r=ht(e,t),n=mn(r),s=()=>{dn(r,n)};return{get busy(){return r.busy},get concurrency(){return r.concurrency},get pending(){return r.pending},get size(){return r.size},get state(){return r.state},busy$:I(n.busy),concurrency$:I(n.concurrency),pending$:I(n.pending),size$:I(n.size),state$:I(n.state),run(o,i={}){return mt(r.run(o,i),s)},clear(){r.clear(),s()},terminate(){r.terminate(),s()}}}function ga(e,t={}){const r=en(e,t),n=mn(r),s=()=>{dn(r,n)};return{get busy(){return r.busy},get concurrency(){return r.concurrency},get pending(){return r.pending},get size(){return r.size},get state(){return r.state},busy$:I(n.busy),concurrency$:I(n.concurrency),pending$:I(n.pending),size$:I(n.size),state$:I(n.state),call(o,i,a={}){return mt(r.call(o,i,a),s)},clear(){r.clear(),s()},terminate(){r.terminate(),s()}}}var ba=(e,t)=>{const{type:r}=t;if(r===String)return e;if(r===Number)return Number(e);if(r===Boolean){const n=e.trim().toLowerCase();return n===""||n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:!!e}if(r===Object||r===Array)try{return JSON.parse(e)}catch{return e}if(typeof r=="function"){const n=r,s=r;if(t.construct===!0)return Reflect.construct(s,[e]);if(t.construct===!1)return n(e);const o=r.prototype!==void 0&&r.prototype!==null,i=(o?Object.getOwnPropertyNames(r.prototype):[]).length>1,a=o&&r.prototype.constructor!==r,l=/^class\s/.test(Function.prototype.toString.call(r));if(i||a||l)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const c=n(e);if(c===void 0&&o)try{return Reflect.construct(s,[e])}catch{return c}return c}catch(c){if(c instanceof TypeError&&/cannot be invoked without 'new'|is not a function/i.test(c.message))return Reflect.construct(s,[e]);throw c}}return e},qt=()=>{try{const e=globalThis;if(typeof e.__BQUERY_DEV__=="boolean")return e.__BQUERY_DEV__;const t=e.process?.env?.NODE_ENV;if(typeof t=="string")return t!=="production";const r=e.process?.versions?.node;if(typeof r=="string"&&r.length>0)return!0;const n=e.process?.release?.name;return n==="node"||n==="io.js"}catch{return!1}},Fe;function le(e){const t=Fe;return Fe=e,t}function pn(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){qt()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function wa(e){const t=Fe;if(!t)throw new Error("bQuery component: useSignal() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=$(e);return t.addDisposer(()=>r.dispose()),r}function Ea(e){const t=Fe;if(!t)throw new Error("bQuery component: useComputed() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=D(e);return t.addDisposer(()=>r.dispose()),r}function Sa(e){const t=Fe;if(!t)throw new Error("bQuery component: useEffect() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=j(e);return t.addDisposer(r),r}var Aa=["slot"],ka=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],vn=(e,t)=>{const r=[...Aa,...t.sanitize?.allowTags??[]],n=[...ka,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),i=(c=>c===!1?!1:c==="closed"?"closed":"open")(t.shadow),a=Array.from(new Set([...Object.keys(t.props??{}),...t.observeAttributes??[]]));class l extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.missingRequiredProps=new Set,this.hasMounted=!1,i!==!1?this.renderRootNode=this.attachShadow({mode:i}):this.renderRootNode=this,this.syncProps()}static get observedAttributes(){return a}connectedCallback(){try{if(!this.hasMounted&&this.missingRequiredProps.size>0)return;if(this.hasMounted){this.scope=pn();const f=le(this.scope);try{t.connected?.call(this)}catch(m){this.handleError(m)}finally{le(f)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(f){this.handleError(f)}}mount(){if(this.hasMounted)return;const f=le(this.ensureScope());let m=!1;try{t.beforeMount?.call(this),t.connected?.call(this)}catch(d){m=!0,this.handleError(d)}finally{le(f)}if(m){this.scope?.dispose(),this.scope=void 0;return}this.render(),this.setupSignalSubscriptions(),this.hasMounted=!0}disconnectedCallback(){try{this.signalEffectCleanup?.(),this.signalEffectCleanup=void 0,this.scope?.dispose(),this.scope=void 0,t.disconnected?.call(this)}catch(f){this.handleError(f)}}attributeChangedCallback(f,m,d){try{const p=this.cloneProps();if(this.syncProps(),t.onAttributeChanged){const u=le(this.ensureScope());try{t.onAttributeChanged.call(this,f,m,d)}finally{le(u)}}this.hasMounted?this.render(!0,p,{name:f,oldValue:m,newValue:d}):this.isConnected&&this.missingRequiredProps.size===0&&this.mount()}catch(p){this.handleError(p)}}adoptedCallback(){if(!t.onAdopted)return;const f=le(this.ensureScope());try{t.onAdopted.call(this)}catch(m){this.handleError(m)}finally{le(f)}}handleError(f){t.onError?t.onError.call(this,f):console.error(`bQuery component error in <${e}>:`,f)}ensureScope(){return this.scope??(this.scope=pn())}setState(f,m){this.state[f]=m,this.render(!0,this.cloneProps(),void 0,!1)}getState(f){return this.state[f]}setupSignalSubscriptions(f=!1){if(this.signalEffectCleanup||s.length===0)return;let m=!0;this.signalEffectCleanup=j(()=>{try{for(const p of s)p.value;if(m){if(m=!1,f&&this.hasMounted&&this.isConnected){const p=this.cloneProps();ue(()=>{this.render(!0,p,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const d=this.cloneProps();ue(()=>{this.render(!0,d,void 0,!1)})}catch(d){this.handleError(d)}})}syncProps(){const f=t.props??{};for(const[m,d]of Object.entries(f)){const p=this.getAttribute(m);let u;if(p==null?d.required&&d.default===void 0?(this.missingRequiredProps.add(m),u=void 0):u=d.default??void 0:(this.missingRequiredProps.has(m)&&this.missingRequiredProps.delete(m),u=ba(p,d)),d.validator&&u!==void 0&&!d.validator(u))throw new Error(`bQuery component: validation failed for prop "${m}" with value ${JSON.stringify(u)}`);this.props[m]=u}}cloneProps(){return{...this.props}}render(f=!1,m,d,p=!0){try{if(f&&p&&t.beforeUpdate){if(!m)throw new Error("bQuery component: previous props are required for update renders");if(t.beforeUpdate.call(this,this.props,m)===!1)return}const u=(y,w)=>{this.dispatchEvent(new CustomEvent(y,{detail:w,bubbles:!0,composed:!0}))},h=this.renderRootNode,v=X(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:u}),{allowTags:r,allowAttributes:n});let b=null;if(t.styles&&(b=h.querySelector("style[data-bquery-component-style]")),h.innerHTML=v,t.styles){const y=b??document.createElement("style");b||y.setAttribute("data-bquery-component-style",""),y.textContent=t.styles,h.prepend(y)}f&&t.updated?.call(this,d)}catch(u){this.handleError(u)}}}return l};function Ta(e,t){return vn(e,t)}function Ee(e,t){const r=vn(e,t);customElements.get(e)||customElements.define(e,r)}var yn=Symbol("bquery.booleanAttribute"),Ca=/^[^\0-\x20"'/>=]+$/,gn=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[yn]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},bn=e=>gn(e)?e.enabled?e.name:"":String(e??""),Ra={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Oa=e=>gn(e)?e.enabled?e.name:"":bn(e).replace(/[&<>"'`]/g,t=>Ra[t]),La=(e,t)=>{if(!Ca.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[yn]:!0,enabled:!!t,name:e})},Se=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${bn(t[s])}`,""),$a=(e,...t)=>{const r=n=>so(n)?oo(n):Oa(n);return mr(e.reduce((n,s,o)=>`${n}${s}${o<t.length?r(t[o]):""}`,""))},pt=`
2
86
  :host {
3
87
  color: inherit;
4
88
  font: inherit;
5
89
  }
6
- `,$r=`
7
- ${tt}
90
+ `,wn=`
91
+ ${pt}
8
92
  .field {
9
93
  display: inline-flex;
10
94
  flex-direction: column;
@@ -38,8 +122,8 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
38
122
  color: #94a3b8;
39
123
  cursor: not-allowed;
40
124
  }
41
- `,F=e=>er(e),wt=new WeakMap,Et=(e,t)=>wt.get(e)?.[t],St=(e,t,r)=>{const n=wt.get(e)??{};n[t]=r,wt.set(e,n)},Si=(e,t,r)=>{if(r.label!==t.label||r.type!==t.type||r.placeholder!==t.placeholder||r.name!==t.name||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("input.control");return!s||s.type!==t.type||s.placeholder!==t.placeholder||s.name!==t.name||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},Ai=(e,t,r)=>{if(r.label!==t.label||r.placeholder!==t.placeholder||r.name!==t.name||r.rows!==t.rows||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("textarea.control");return!s||s.placeholder!==t.placeholder||s.name!==t.name||Number(s.rows)!==t.rows||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},Ci=e=>["<textarea",' part="control"',' class="control"',` placeholder="${F(e.placeholder)}"`,` name="${F(e.name)}"`,` rows="${e.rows}"`,e.disabled?" disabled":"",`>${F(e.value)}</textarea>`].join(""),Ti=(e={})=>{const t=e.prefix??X().components?.prefix??"bq",r={button:`${t}-button`,card:`${t}-card`,input:`${t}-input`,textarea:`${t}-textarea`,checkbox:`${t}-checkbox`};return ve(r.button,{props:{label:{type:String,default:""},variant:{type:String,default:"primary"},size:{type:String,default:"md"},type:{type:String,default:"button"},disabled:{type:Boolean,default:!1}},styles:`
42
- ${tt}
125
+ `,B=e=>br(e),zt=new WeakMap,xt=(e,t)=>zt.get(e)?.[t],jt=(e,t,r)=>{const n=zt.get(e)??{};n[t]=r,zt.set(e,n)},Pa=(e,t,r)=>{if(r.label!==t.label||r.type!==t.type||r.placeholder!==t.placeholder||r.name!==t.name||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("input.control");return!s||s.type!==t.type||s.placeholder!==t.placeholder||s.name!==t.name||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},Ma=(e,t,r)=>{if(r.label!==t.label||r.placeholder!==t.placeholder||r.name!==t.name||r.rows!==t.rows||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("textarea.control");return!s||s.placeholder!==t.placeholder||s.name!==t.name||Number(s.rows)!==t.rows||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},Na=e=>["<textarea",' part="control"',' class="control"',` placeholder="${B(e.placeholder)}"`,` name="${B(e.name)}"`,` rows="${e.rows}"`,e.disabled?" disabled":"",`>${B(e.value)}</textarea>`].join(""),Da=(e={})=>{const t=e.prefix??Z().components?.prefix??"bq",r={button:`${t}-button`,card:`${t}-card`,input:`${t}-input`,textarea:`${t}-textarea`,checkbox:`${t}-checkbox`};return Ee(r.button,{props:{label:{type:String,default:""},variant:{type:String,default:"primary"},size:{type:String,default:"md"},type:{type:String,default:"button"},disabled:{type:Boolean,default:!1}},styles:`
126
+ ${pt}
43
127
  button {
44
128
  appearance: none;
45
129
  border: 0;
@@ -76,18 +160,18 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
76
160
  cursor: not-allowed;
77
161
  opacity: 0.6;
78
162
  }
79
- `,render:({props:n})=>ye`
163
+ `,render:({props:n})=>Se`
80
164
  <button
81
165
  part="button"
82
- type="${F(n.type)}"
83
- data-variant="${F(n.variant)}"
84
- data-size="${F(n.size)}"
166
+ type="${B(n.type)}"
167
+ data-variant="${B(n.variant)}"
168
+ data-size="${B(n.size)}"
85
169
  ${n.disabled?"disabled":""}
86
170
  >
87
- <slot>${F(n.label)}</slot>
171
+ <slot>${B(n.label)}</slot>
88
172
  </button>
89
- `}),ve(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
90
- ${tt}
173
+ `}),Ee(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
174
+ ${pt}
91
175
  article {
92
176
  background: #fff;
93
177
  border: 1px solid #e2e8f0;
@@ -111,37 +195,37 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
111
195
  footer {
112
196
  margin-top: 0.75rem;
113
197
  }
114
- `,render:({props:n})=>ye`
198
+ `,render:({props:n})=>Se`
115
199
  <article part="card" data-elevated="${String(n.elevated)}">
116
- ${n.title?`<header part="header">${F(n.title)}</header>`:""}
200
+ ${n.title?`<header part="header">${B(n.title)}</header>`:""}
117
201
  <section part="body"><slot></slot></section>
118
- ${n.footer?`<footer part="footer">${F(n.footer)}</footer>`:""}
202
+ ${n.footer?`<footer part="footer">${B(n.footer)}</footer>`:""}
119
203
  </article>
120
- `}),ve(r.input,{props:{label:{type:String,default:""},type:{type:String,default:"text"},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},disabled:{type:Boolean,default:!1}},styles:$r,beforeUpdate(n,s){return!Si(this,n,s)},connected(){const n=s=>{const o=s.target;o?.matches("input")&&(s.stopPropagation(),this.setAttribute("value",o.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:o.value},bubbles:!0,composed:!0})))};St(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=Et(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ye`
204
+ `}),Ee(r.input,{props:{label:{type:String,default:""},type:{type:String,default:"text"},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},disabled:{type:Boolean,default:!1}},styles:wn,beforeUpdate(n,s){return!Pa(this,n,s)},connected(){const n=s=>{const o=s.target;o?.matches("input")&&(s.stopPropagation(),this.setAttribute("value",o.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:o.value},bubbles:!0,composed:!0})))};jt(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=xt(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>Se`
121
205
  <label part="field" class="field">
122
- ${n.label?`<span part="label" class="label">${F(n.label)}</span>`:""}
206
+ ${n.label?`<span part="label" class="label">${B(n.label)}</span>`:""}
123
207
  <input
124
208
  part="control"
125
209
  class="control"
126
- type="${F(n.type)}"
127
- value="${F(n.value)}"
128
- placeholder="${F(n.placeholder)}"
129
- name="${F(n.name)}"
210
+ type="${B(n.type)}"
211
+ value="${B(n.value)}"
212
+ placeholder="${B(n.placeholder)}"
213
+ name="${B(n.name)}"
130
214
  ${n.disabled?"disabled":""}
131
215
  />
132
216
  </label>
133
- `}),ve(r.textarea,{props:{label:{type:String,default:""},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},rows:{type:Number,default:4},disabled:{type:Boolean,default:!1}},styles:`${$r}
217
+ `}),Ee(r.textarea,{props:{label:{type:String,default:""},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},rows:{type:Number,default:4},disabled:{type:Boolean,default:!1}},styles:`${wn}
134
218
  textarea.control {
135
219
  min-height: 6rem;
136
220
  resize: vertical;
137
221
  }
138
- `,beforeUpdate(n,s){return!Ai(this,n,s)},connected(){const n=s=>{const o=s.target;o?.matches("textarea")&&(s.stopPropagation(),this.setAttribute("value",o.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:o.value},bubbles:!0,composed:!0})))};St(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=Et(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ye`
222
+ `,beforeUpdate(n,s){return!Ma(this,n,s)},connected(){const n=s=>{const o=s.target;o?.matches("textarea")&&(s.stopPropagation(),this.setAttribute("value",o.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:o.value},bubbles:!0,composed:!0})))};jt(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=xt(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>Se`
139
223
  <label part="field" class="field">
140
- ${n.label?`<span part="label" class="label">${F(n.label)}</span>`:""}
141
- ${Ci(n)}
224
+ ${n.label?`<span part="label" class="label">${B(n.label)}</span>`:""}
225
+ ${Na(n)}
142
226
  </label>
143
- `}),ve(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
144
- ${tt}
227
+ `}),Ee(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
228
+ ${pt}
145
229
  label {
146
230
  align-items: center;
147
231
  color: #0f172a;
@@ -157,7 +241,7 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
157
241
  input:disabled {
158
242
  cursor: not-allowed;
159
243
  }
160
- `,connected(){const n=s=>{const o=s.target;o?.matches('input[type="checkbox"]')&&(s.stopPropagation(),o.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:o.checked},bubbles:!0,composed:!0})))};St(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=Et(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>ye`
244
+ `,connected(){const n=s=>{const o=s.target;o?.matches('input[type="checkbox"]')&&(s.stopPropagation(),o.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:o.checked},bubbles:!0,composed:!0})))};jt(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=xt(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>Se`
161
245
  <label part="label">
162
246
  <input
163
247
  part="control"
@@ -165,14 +249,14 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
165
249
  ${n.checked?"checked":""}
166
250
  ${n.disabled?"disabled":""}
167
251
  />
168
- <span part="text"><slot>${F(n.label)}</slot></span>
252
+ <span part="text"><slot>${B(n.label)}</slot></span>
169
253
  </label>
170
- `}),r},At=null,Z=()=>At!==null?At:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,ki=e=>{At=e},Or=e=>typeof e=="string"||typeof e=="number",Rr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ge=(e,t)=>{const r=e.style;if(Array.isArray(t)){const n=t[t.length-1];if(!n)return;for(const[s,o]of Object.entries(n))if(!(s==="offset"||s==="easing"||s==="composite")&&Or(o)){const i=s.startsWith("--")?s:Rr(s);r.setProperty(i,String(o))}return}for(const[n,s]of Object.entries(t)){if(n==="offset"||n==="easing"||n==="composite")continue;const o=Array.isArray(s)?s[s.length-1]:s;if(Or(o)){const i=n.startsWith("--")?n:Rr(n);r.setProperty(i,String(o))}}},rt=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:o=!0,onFinish:i}=t;if(o&&Z())return s&&ge(e,r),i?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&ge(e,r),i?.(),Promise.resolve()):new Promise(l=>{const f=a.animate(r,n);let u=!1;const h=()=>{u||(u=!0,s&&(typeof f.commitStyles=="function"?f.commitStyles():ge(e,r)),f.cancel(),i?.(),l())};f.onfinish=h,f.finished&&f.finished.then(h).catch(h)})},ee=e=>Math.min(1,Math.max(0,e)),Mr=e=>ee(e),Dr=e=>ee(e*e),Nr=e=>ee(1-(1-e)*(1-e)),Pr=e=>ee(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),Ir=e=>ee(e*e*e),_r=e=>ee(1-Math.pow(1-e,3)),qr=e=>ee(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),xr=e=>ee(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),jr=e=>ee(e===1?1:1-Math.pow(2,-10*e)),Li={linear:Mr,easeInQuad:Dr,easeOutQuad:Nr,easeInOutQuad:Pr,easeInCubic:Ir,easeOutCubic:_r,easeInOutCubic:qr,easeOutBack:xr,easeOutExpo:jr},Ct=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},Tt=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:o}=r,i=Ct(e);if(i.width===0||i.height===0)return o?.(),Promise.resolve();const a=t.left-i.left,l=t.top-i.top,f=t.width/i.width,u=t.height/i.height;if(a===0&&l===0&&f===1&&u===1)return o?.(),Promise.resolve();const h=e;return typeof h.animate!="function"?(o?.(),Promise.resolve()):(h.style.transform=`translate(${a}px, ${l}px) scale(${f}, ${u})`,h.style.transformOrigin="top left",h.offsetHeight,new Promise(d=>{const p=h.animate([{transform:`translate(${a}px, ${l}px) scale(${f}, ${u})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let c=!1;const m=()=>{c||(c=!0,h.style.transform="",h.style.transformOrigin="",o?.(),d())};p.onfinish=m,p.finished&&p.finished.then(m).catch(m)}))},$i=async(e,t,r={})=>{await zr(e,t,r)},zr=async(e,t,r={})=>{const{stagger:n,...s}=r,o=new Map;for(const l of e)o.set(l,Ct(l));t();const i=e.length,a=e.map((l,f)=>{const u=o.get(l);if(!u)return Promise.resolve();const h=n?n(f,i):0;return h>0?new Promise(d=>setTimeout(d,h)).then(()=>Tt(l,u,s)):Tt(l,u,s)});await Promise.all(a)},Oi={fadeIn:(e=0,t=1)=>[{opacity:e},{opacity:t}],fadeOut:(e=1,t=0)=>[{opacity:e},{opacity:t}],slideInUp:(e=16)=>[{opacity:0,transform:`translateY(${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInDown:(e=16)=>[{opacity:0,transform:`translateY(-${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInLeft:(e=16)=>[{opacity:0,transform:`translateX(${e}px)`},{opacity:1,transform:"translateX(0)"}],slideInRight:(e=16)=>[{opacity:0,transform:`translateX(-${e}px)`},{opacity:1,transform:"translateX(0)"}],scaleIn:(e=.95,t=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`}],scaleOut:(e=1,t=.95)=>[{opacity:1,transform:`scale(${e})`},{opacity:0,transform:`scale(${t})`}],pop:(e=.9,t=1.02,r=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`,offset:.6},{opacity:1,transform:`scale(${r})`}],rotateIn:(e=6)=>[{opacity:0,transform:`rotate(${e}deg) scale(0.98)`},{opacity:1,transform:"rotate(0deg) scale(1)"}]},Ri=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:o=!0,onComplete:i}=r,a=e,l=t;if(typeof window>"u"||typeof document>"u"||typeof a.getBoundingClientRect!="function"||typeof l.getBoundingClientRect!="function"||typeof a.style>"u"||typeof l.style>"u")return i?.(),Promise.resolve();const f=e.getBoundingClientRect(),u=l.style.display,h=l.style.visibility,d=l.style.transform,p=l.style.opacity,c=typeof getComputedStyle=="function"?getComputedStyle(l).display:u||"block",m=c==="none"?"block":u||c||"block",g=()=>{l.style.transform=d,l.style.opacity=p};l.style.visibility="hidden",l.style.display=m;const b=t.getBoundingClientRect();if(l.style.visibility=h,a.style.display="none",c==="none"?l.style.display=m:u==="none"?l.style.display="":l.style.display=u,o&&Z())return g(),i?.(),Promise.resolve();const v=f.left-b.left,w=f.top-b.top,E=f.width/(b.width||1),L=f.height/(b.height||1);if(v===0&&w===0&&E===1&&L===1)return g(),i?.(),Promise.resolve();const A=[{transform:`translate(${v}px, ${w}px) scale(${E}, ${L})`,opacity:"0.5"},{transform:"translate(0, 0) scale(1, 1)",opacity:"1"}];return typeof l.animate!="function"?(g(),i?.(),Promise.resolve()):new Promise(S=>{const C=l.animate(A,{duration:n,easing:s,fill:"forwards"});let R=!1;const k=()=>{R||(R=!0,g(),C.cancel(),i?.(),S())};C.onfinish=k,C.finished&&C.finished.then(k).catch(k)})},Mi=(e,t={})=>{if(typeof window>"u"||typeof window.addEventListener!="function"||typeof window.removeEventListener!="function"||typeof requestAnimationFrame!="function"||typeof cancelAnimationFrame!="function")return()=>{};const{speed:r=.5,direction:n="vertical",respectReducedMotion:s=!0}=t,o=e,i=o.style.transform;if(s&&Z())return()=>{};let a=!1,l=!1,f=null;const u=()=>{l||(l=!0,window.removeEventListener("scroll",d),f!==null&&(cancelAnimationFrame(f),f=null),a=!1,o.style.transform=i)},h=()=>{if(l)return;if(s&&Z()){u();return}const p=window.scrollY,c=window.scrollX;let m=0,g=0;(n==="vertical"||n==="both")&&(g=p*r),(n==="horizontal"||n==="both")&&(m=c*r);const b=`translate3d(${m}px, ${g}px, 0)`;o.style.transform=i?`${i} ${b}`:b},d=()=>{if(!l){if(s&&Z()){u();return}a||(a=!0,f=requestAnimationFrame(()=>{f=null,h(),a=!1}))}};return h(),window.addEventListener("scroll",d,{passive:!0}),u},Di=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),Ni=(e,t)=>{const r=Di(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:o,once:i=!0,onEnter:a,...l}=t;if(typeof IntersectionObserver>"u")return r.forEach(u=>{a?.(u),rt(u,l)}),()=>{};const f=new IntersectionObserver(u=>{u.forEach(h=>{if(!h.isIntersecting)return;const d=h.target;a?.(d),rt(d,l),i&&f.unobserve(d)})},{root:n,rootMargin:s,threshold:o});return r.forEach(u=>f.observe(u)),()=>f.disconnect()},Pi={stiffness:100,damping:10,mass:1,precision:.01},Ii=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:o}={...Pi,...t};let i=e,a=0,l=e,f=null,u=null,h=null;const d=new Set,p=()=>{for(const m of d)m(i)},c=m=>{const g=h!==null?(m-h)/1e3:.016666666666666666,b=Math.min(g,1/30);h=m;const v=i-l,w=(-r*v+-n*a)/s;if(a+=w*b,i+=a*b,p(),Math.abs(a)<o&&Math.abs(v)<o){i=l,a=0,f=null,p(),u?.(),u=null;return}f=requestAnimationFrame(c)};return{to(m){return l=m,f!==null&&cancelAnimationFrame(f),u?.(),h=null,new Promise(g=>{u=g,f=requestAnimationFrame(c)})},current(){return i},stop(){f!==null&&(cancelAnimationFrame(f),f=null),a=0,h=null,u?.(),u=null},onChange(m){return d.add(m),()=>d.delete(m)}}},_i={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},qi=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(o,i=0)=>{const a=typeof n=="number"?n:n==="center"?(i-1)/2:n==="end"?i-1:0,l=Math.abs(o-a),f=i>1?Math.max(a,i-1-a):1,u=f===0?0:l/f;return r+(s?s(u)*f:l)*e}},kt=e=>{if(typeof e=="number")return e;if(typeof e=="string"){const t=e.trim();if(t.endsWith("ms")){const n=Number.parseFloat(t.slice(0,-2));return Number.isFinite(n)?n:0}if(t.endsWith("s")){const n=Number.parseFloat(t.slice(0,-1));return Number.isFinite(n)?n*1e3:0}const r=Number.parseFloat(t);return Number.isFinite(r)?r:0}return 0},xi=(e,t)=>{if(typeof e=="number")return e;if(typeof e=="string"){const r=/^([+-])=(\d+(?:\.\d+)?)$/.exec(e);if(r){const n=Number.parseFloat(r[2]);return Number.isFinite(n)?r[1]==="+"?t+n:t-n:t}}return t},ji=e=>{const t=kt(e?.duration),r=kt(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},Fr=e=>{let t=0;return e.map(r=>{const n=xi(r.at,t),s=kt(r.options?.delay),o=Math.max(0,n+s),i=ji(r.options),a=o+i;return t=Math.max(t,a),{step:r,start:o,end:a,duration:i}})},zi=async(e,t={})=>{const{stagger:r,onFinish:n}=t,s=e.length;for(let o=0;o<e.length;o+=1){const i=e[o],a=r?r(o,s):0;a>0&&await new Promise(l=>setTimeout(l,a)),await rt(i.target,i)}n?.()},Fi=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],o=0,i=!1,a=!1;const{commitStyles:l=!0,respectReducedMotion:f=!0,onFinish:u}=t,h=()=>{if(!a){if(a=!0,l)for(const p of s){const{animation:c,step:m}=p;typeof c.commitStyles=="function"?c.commitStyles():ge(m.target,m.keyframes),c.cancel()}n.forEach(p=>p()),u?.()}},d=()=>{s.forEach(({animation:c})=>c.cancel()),s=[],a=!1;const p=Fr(r);if(o=p.length?Math.max(...p.map(c=>c.end)):0,f&&Z()){l&&p.forEach(({step:c})=>ge(c.target,c.keyframes)),i=!0;return}if(p.some(({step:c})=>typeof c.target.animate!="function")){l&&p.forEach(({step:c})=>ge(c.target,c.keyframes)),i=!0;return}i=!1,s=p.map(({step:c,start:m})=>{const{delay:g,...b}=c.options??{};return{animation:c.target.animate(c.keyframes,{...b,delay:m,fill:b.fill??"both"}),step:c,start:m}})};return{add(p){r.push(p)},duration(){if(!r.length)return 0;if(!s.length){const p=Fr(r);return Math.max(...p.map(c=>c.end))}return o},async play(){if(d(),i||s.length===0){h();return}const p=s.map(c=>c.animation.finished.catch(()=>{}));await Promise.all(p),h()},pause(){i||s.forEach(({animation:p})=>p.pause())},resume(){i||s.forEach(({animation:p})=>p.play())},stop(){s.forEach(({animation:p})=>p.cancel()),s=[],i=!1},seek(p){i||s.forEach(({animation:c})=>{c.currentTime=p})},onFinish(p){return n.add(p),()=>n.delete(p)}}},Br=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Bi=async e=>{const t=X().transitions,r=typeof e=="function"?{update:e,classes:t?.classes,types:t?.types,skipOnReducedMotion:t?.skipOnReducedMotion}:{...e,classes:e.classes??t?.classes,types:e.types??t?.types,skipOnReducedMotion:e.skipOnReducedMotion??t?.skipOnReducedMotion},n=r.update;if(typeof document>"u"){await n();return}const s=document,o=document.documentElement,i=Br(r.classes),a=Br(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&Z()){await n(),r.onFinish?.();return}i.forEach(l=>o.classList.add(l));try{const l=s.startViewTransition(()=>n()),f=l.types;if(f)for(const u of a)f.add(u);await l.ready,r.onReady?.(),await l.finished,r.onFinish?.()}finally{i.forEach(l=>o.classList.remove(l))}},Hi=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:o=!1,cursorChar:i="|",loop:a=!1,loopDelay:l=1e3,respectReducedMotion:f=!0,onComplete:u}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const h=e;let d=!1,p=null,c=null,m=null,g=null;const b=()=>{if(!o)return;c=document.createElement("span"),c.setAttribute("aria-hidden","true"),c.textContent=i,h.appendChild(c);let E=!0;m=setInterval(()=>{c&&(E=!E,c.style.opacity=E?"1":"0")},530)},v=()=>{m!==null&&(clearInterval(m),m=null),c&&c.parentNode&&(c.parentNode.removeChild(c),c=null)},w=()=>{d||(d=!0,p!==null&&(clearTimeout(p),p=null),v(),g?.(),g=null)};return f&&Z()?(h.textContent=t,u?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(E=>{g=E;const L=()=>{let A=0;h.textContent="",b();const S=document.createTextNode("");c?h.insertBefore(S,c):h.appendChild(S);const C=()=>{d||(A<t.length?(S.data=t.slice(0,A+1),A++,p=setTimeout(C,n)):(u?.(),a&&!d?p=setTimeout(()=>{d||(v(),L())},l):(v(),E(),g=null)))};p=setTimeout(C,s)};L()})}},Ui=class{constructor(e){this.bucketName=e,this.dbPromise=null,this.storeName="blobs"}openDB(){if(this.dbPromise)return this.dbPromise;const e=`bquery-bucket-${this.bucketName}`;return this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)},n.onsuccess=()=>t(n.result),n.onerror=()=>r(n.error)}),this.dbPromise}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.storeName,e).objectStore(this.storeName));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async put(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},Qi={async open(e){return new Ui(e)}},Vi=class{constructor(e){this.cache=e}async add(e){await this.cache.add(e)}async addAll(e){await this.cache.addAll(e)}async put(e,t){await this.cache.put(e,t)}async match(e){return this.cache.match(e)}async remove(e){return this.cache.delete(e)}async keys(){return(await this.cache.keys()).map(e=>e.url)}},Wi={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new Vi(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},Ki=e=>{if(typeof document>"u")return null;const t=`${encodeURIComponent(e)}=`,r=document.cookie?document.cookie.split(";"):[];for(const n of r){const s=n.trim();if(s.startsWith(t)){const o=s.slice(t.length);try{return decodeURIComponent(o)}catch{return o}}}return null},Yi=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},Gi=(e,t)=>{if(typeof document>"u")return;const r=[`${encodeURIComponent(e)}=`,"Expires=Thu, 01 Jan 1970 00:00:00 GMT"];t.path&&r.push(`Path=${t.path}`),t.domain&&r.push(`Domain=${t.domain}`),t.sameSite&&r.push(`SameSite=${t.sameSite}`),t.secure&&r.push("Secure"),document.cookie=r.join("; ")},Ji=(e,t,r)=>{if(typeof document>"u")return;const n=r.serialize?r.serialize(t):typeof t=="string"?t:JSON.stringify(t),s=[`${encodeURIComponent(e)}=${encodeURIComponent(n)}`];r.path&&s.push(`Path=${r.path}`),r.domain&&s.push(`Domain=${r.domain}`),typeof r.maxAge=="number"&&s.push(`Max-Age=${r.maxAge}`),r.expires&&s.push(`Expires=${r.expires.toUTCString()}`),r.sameSite&&s.push(`SameSite=${r.sameSite}`),r.secure&&s.push("Secure"),document.cookie=s.join("; ")},Xi=(e,t={})=>{const r=X().cookies,n={path:r?.path??"/",sameSite:r?.sameSite??"Lax",secure:r?.secure??!1,watch:!0,...t};n.sameSite==="None"&&(n.secure=!0);const s=Ki(e);let o=n.defaultValue??null;if(s!==null)try{o=n.deserialize?n.deserialize(s):Yi(s)?JSON.parse(s):s??o}catch(l){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,l),o=s??o}const i=M(o);if(typeof document>"u"||n.watch===!1)return i;let a=!1;return j(()=>{const l=i.value;if(!a){a=!0;return}if(l==null){Gi(e,n);return}Ji(e,l,n)}),i},Zi={isSupported(){return"Notification"in window},getPermission(){return this.isSupported()?Notification.permission:"denied"},async requestPermission(){return this.isSupported()?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"},send(e,t){return this.isSupported()?Notification.permission!=="granted"?(console.warn("bQuery: Notification permission not granted"),null):new Notification(e,t):(console.warn("bQuery: Notifications not supported in this browser"),null)}},ea=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),ta=(e={})=>{const t=X().announcer,r={politeness:t?.politeness??"polite",atomic:t?.atomic??!0,delay:t?.delay??16,clearDelay:t?.clearDelay??1e3,...e},n=M("");if(typeof document>"u")return{element:null,message:n,announce(m){n.value=m},clear(){n.value=""},destroy(){n.value=""}};const s=r.id?document.getElementById(r.id):null,o=s??document.createElement("div"),i=!s;if(r.id&&(o.id=r.id),r.className&&(o.className=r.className),o.setAttribute("aria-live",r.politeness),o.setAttribute("aria-atomic",String(r.atomic)),o.setAttribute("role",r.politeness==="assertive"?"alert":"status"),o.setAttribute("data-bquery-announcer","true"),o.getAttribute("style")||o.setAttribute("style",ea),i){const m=r.container??document.body??document.documentElement;if(!m)return{element:null,message:n,announce(g){n.value=g},clear(){n.value=""},destroy(){n.value=""}};m.appendChild(o)}const a=j(()=>{o.textContent=n.value});let l,f,u=!1;const h=()=>{l&&(clearTimeout(l),l=void 0),f&&(clearTimeout(f),f=void 0)};return{element:o,message:n,announce:(m,g={})=>{if(u)return;const b=g.politeness??r.politeness,v=g.delay??r.delay,w=g.clearDelay??r.clearDelay;h(),o.setAttribute("aria-live",b),o.setAttribute("role",b==="assertive"?"alert":"status"),n.value="",l=setTimeout(()=>{u||(n.value=m,w>0&&(f=setTimeout(()=>{u||(n.value="")},w)))},v)},clear:()=>{u||(h(),n.value="")},destroy:()=>{u||(u=!0,h(),n.value="",a(),i&&o.remove())}}},Hr=(e,t)=>{const r=new Map;for(const[n,s]of Object.entries(t))r.set(n,e.getAttribute(n)),e.setAttribute(n,s);return()=>{for(const[n,s]of r.entries())s==null?e.removeAttribute(n):e.setAttribute(n,s)}},Ur=(e,t)=>{const r=document.createElement(e);r.setAttribute("data-bquery-page-meta","true");for(const[n,s]of Object.entries(t))s!==void 0&&r.setAttribute(n,s);return r},ra=e=>{if(typeof document>"u")return()=>{};const t=X().pageMeta,r=e.title?t?.titleTemplate?t.titleTemplate(e.title):e.title:void 0,n=[],s=[],o=document.title;r!==void 0&&(document.title=r);const i=[...e.meta??[]];e.description&&i.unshift({name:"description",content:e.description});for(const a of i){const l=Ur("meta",{name:a.name,property:a.property,"http-equiv":a.httpEquiv,content:a.content});document.head.appendChild(l),n.push(l)}for(const a of e.link??[]){const l=Ur("link",{rel:a.rel,href:a.href,type:a.type,media:a.media,crossorigin:a.crossOrigin});document.head.appendChild(l),n.push(l)}return e.htmlAttributes&&s.push(Hr(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(Hr(document.body,e.bodyAttributes)),()=>{document.title=o;for(const a of s.reverse())a();for(const a of n)a.remove()}},Qr=class{constructor(e){this.storage=e}async get(e){const t=this.storage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return t}}async set(e,t){const r=typeof t=="string"?t:JSON.stringify(t);this.storage.setItem(e,r)}async remove(e){this.storage.removeItem(e)}async clear(){this.storage.clear()}async keys(){const e=[];for(let t=0;t<this.storage.length;t++){const r=this.storage.key(t);r!==null&&e.push(r)}return e}},na=class extends Qr{constructor(){super(localStorage)}},sa=class extends Qr{constructor(){super(sessionStorage)}},oa=class{constructor(e){this.options=e,this.dbPromise=null}openDB(){return this.dbPromise?this.dbPromise:(this.dbPromise=new Promise((e,t)=>{const r=indexedDB.open(this.options.name,this.options.version??1);r.onupgradeneeded=()=>{const n=r.result;n.objectStoreNames.contains(this.options.store)||n.createObjectStore(this.options.store)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)}),this.dbPromise)}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.options.store,e).objectStore(this.options.store));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async set(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async clear(){await this.withStore("readwrite",e=>e.clear())}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},ia={local(){return new na},session(){return new sa},indexedDB(e){return new oa(e)}},Vr=null,te=M({path:"",params:{},query:{},matched:null,hash:""}),Wr=P(()=>te.value),Ie=M(0),nt=M(!1),aa=U(nt),Kr=()=>{Ie.value===0&&(nt.value=!0),Ie.value+=1},Yr=()=>{const e=Math.max(0,Ie.value-1);Ie.value=e,e===0&&(nt.value=!1)},la=()=>{Ie.value=0,nt.value=!1},le=()=>Vr,Gr=e=>{Vr=e},_e=async(e,t={})=>{const r=le();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},ca=()=>{const e=le();e?e.back():history.back()},ua=()=>{const e=le();e?e.forward():history.forward()},fa="active",da=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),ha=typeof HTMLElement<"u"?HTMLElement:class{},Jr=class extends ha{constructor(...e){super(...e),this._cleanup=null,this._trackedActiveClasses=new Map,this._handleClick=t=>{t instanceof MouseEvent&&(t.defaultPrevented||t.button===0&&(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),this._navigate())))},this._handleKeydown=t=>{t instanceof KeyboardEvent&&t.key==="Enter"&&(t.preventDefault(),this._navigate())}}static get observedAttributes(){return["to","replace","exact","active-class"]}get to(){const e=this.getAttribute("to");return e==null||e.trim()===""?"/":e}set to(e){this.setAttribute("to",e)}get replace(){return this.hasAttribute("replace")}set replace(e){e?this.setAttribute("replace",""):this.removeAttribute("replace")}get exact(){return this.hasAttribute("exact")}set exact(e){e?this.setAttribute("exact",""):this.removeAttribute("exact")}get activeClass(){return this.getAttribute("active-class")??fa}set activeClass(e){this.setAttribute("active-class",e)}connectedCallback(){this.getAttribute("role")||this.setAttribute("role","link"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this._handleClick),this.addEventListener("keydown",this._handleKeydown),this._setupActiveTracking()}disconnectedCallback(){this.removeEventListener("click",this._handleClick),this.removeEventListener("keydown",this._handleKeydown),this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses()}attributeChangedCallback(e,t,r){(e==="to"||e==="exact"||e==="active-class")&&this.isConnected&&this._setupActiveTracking()}_setupActiveTracking(){this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses();const e=this.to,t=this.exact,r=da(this.activeClass);this._trackedActiveClasses=new Map(r.map(n=>[n,this.classList.contains(n)])),this._cleanup=j(()=>{const n=te.value.path,s=t?n===e:e==="/"?n==="/":n===e||n.startsWith(e.endsWith("/")?e:e+"/");for(const o of r){const i=this._trackedActiveClasses.get(o)??!1;this.classList.toggle(o,s||i)}s?this.setAttribute("aria-current","page"):this.removeAttribute("aria-current")})}_clearTrackedActiveClasses(){for(const[e,t]of this._trackedActiveClasses)this.classList.toggle(e,t);this._trackedActiveClasses.clear()}_navigate(){const e=this.to;e&&le()&&_e(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},ma=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",Jr)},pa=(e,t={})=>r=>{r.preventDefault(),_e(e,t).catch(n=>{console.error("Navigation failed:",n)})},va=e=>{const t=e??(typeof document<"u"?document.body:null);if(!t)return()=>{};const r=n=>{if(!(n instanceof MouseEvent)||n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey||typeof Element>"u"||!(n.target instanceof Element))return;const s=n.target.closest("a");if(!s||!(s instanceof(s.ownerDocument.defaultView?.HTMLAnchorElement??HTMLAnchorElement))||s.target||s.hasAttribute("download")||typeof window>"u"||s.origin!==window.location.origin)return;const o=le();if(!o){n.preventDefault(),_e(s.pathname+s.search+s.hash).catch(f=>{console.error("Navigation failed:",f)});return}const i=o.base,a=o.hash;let l;if(a&&s.hash&&s.hash.startsWith("#/"))l=s.hash.slice(1);else{let f=s.pathname;i&&i!=="/"&&f.startsWith(i)&&(f=f.slice(i.length)||"/"),l=f+s.search+s.hash}n.preventDefault(),_e(l).catch(f=>{console.error("Navigation failed:",f)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},ya=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{if(x(n))return;const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},ga=128,Xr=new Map,Zr=new Map,en=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=ga)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},ba=e=>{const t=[];let r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){n++;continue}if(s==="["&&!r){r=!0;continue}if(s==="]"&&r){r=!1;continue}if(!r){if(s==="("){t.push(!1);continue}if(s===")"){const o=t.pop()??!1,i=e[n+1];if(o&&(i==="+"||i==="*"||i==="?"||i==="{"))return!0;o&&t.length>0&&(t[t.length-1]=!0);continue}if(t.length>0){if(s==="?"&&n>0&&e[n-1]==="(")continue;(s==="+"||s==="*"||s==="?"||s==="{")&&(t[t.length-1]=!0)}}}return!1},wa=e=>{let t="",r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){if(!r&&e[n+1]>="1"&&e[n+1]<="9")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);if(!r&&e[n+1]==="k"&&e[n+2]==="<")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);t+=s+e[n+1],n++;continue}if(s==="["&&!r){r=!0,t+=s;continue}if(s==="]"&&r){r=!1,t+=s;continue}if(!r&&s==="("){if(n+1<e.length&&e[n+1]==="?"){if(e[n+2]==="<"){if(e[n+3]==="="||e[n+3]==="!"){t+="(";continue}const o=e.indexOf(">",n+3);if(o===-1)throw new Error(`bQuery router: Invalid route constraint named capture group: "${e}".`);t+="(?:",n=o;continue}t+="(";continue}t+="(?:";continue}t+=s}return t},Lt=e=>{const t=Xr.get(e);if(t!==void 0)return t;const r=wa(e);return en(Xr,e,r),r},tn=e=>{const t=Lt(e),r=Zr.get(t);if(r)return r;if(ba(t))throw new Error(`bQuery router: Route constraint contains a potentially catastrophic (ReDoS) pattern. Nested quantifiers are not allowed: "${e}".`);try{const n=new RegExp(`^(?:${t})$`);return en(Zr,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},qe=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),rn=e=>qe(e)||e!==void 0&&e>="0"&&e<="9",nn=(e,t)=>{let r=1,n="",s=t+1,o=!1;for(;s<e.length;){const i=e[s];if(i==="\\"&&s+1<e.length){n+=i+e[s+1],s+=2;continue}if(i==="["&&!o)o=!0;else if(i==="]"&&o)o=!1;else if(!o&&i==="(")r++;else if(!o&&i===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=i,s++}return null},Ea=(e,t)=>{const r=nn(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},sn=new Set,on=(e,t)=>{if(e[t]!==":"||!qe(e[t+1]))return null;let r=t+2;for(;r<e.length&&rn(e[r]);)r++;let n=r,s;if(e[r]==="("){const o=Ea(e,r);s=o.constraint,n=o.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},Sa=e=>{if(!sn.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&qe(e[t+1])){const r=on(e,t);r?.constraint&&Lt(r.constraint),t=r?.nextIndex??t+1;continue}t++}sn.add(e)}},Aa=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},an=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&qe(e[r+1]));)r++;return e.slice(t,r)},ln=(e,t,r,n)=>{const s=[];let o=t;for(;o<=r;){const i=e.indexOf(n,o);if(i===-1||i>r)break;s.push(i),o=i+1}return s.reverse()},Ca=(e,t)=>{const r=new Map,n=(s,o)=>{const i=`${s}:${o}`;if(r.has(i))return r.get(i)??null;if(s===e.length){const u=o===t.length?{}:null;return r.set(i,u),u}const a=e[s];if(a==="*"){if(s===e.length-1){const p={};return r.set(i,p),p}const u=an(e,s+1),h=u.length>0?ln(t,o,t.length,u):null,d=(h?p=>{for(const c of h){const m=p(c);if(m)return m}return null}:p=>{for(let c=t.length;c>=o;c--){const m=p(c);if(m)return m}return null})(p=>{const c=n(s+1,p);return c?(r.set(i,c),c):null});return d||(r.set(i,null),null)}const l=on(e,s);if(l){const u=l.constraint?tn(l.constraint):void 0,h=l.constraint?t.length:Aa(t,o),d=an(e,l.nextIndex),p=d.length>0?ln(t,o,h,d):null,c=(p?m=>{for(const g of p){if(g<=o)continue;const b=m(g);if(b)return b}return null}:m=>{for(let g=h;g>o;g--){const b=m(g);if(b)return b}return null})(m=>{const g=t.slice(o,m);if(u&&!u.test(g))return null;const b=n(l.nextIndex,m);if(b){const v={[l.name]:g,...b};return r.set(i,v),v}return null});return c||(r.set(i,null),null)}if(o>=t.length||a!==t[o])return r.set(i,null),null;const f=n(s+1,o+1);return r.set(i,f),f};return n(0,0)},Ta=(e,t)=>{for(const r of t){Sa(r.path);const n=Ca(r.path,e);if(n)return{matched:r,params:n}}return null},st=(e,t,r,n)=>{const s=Ta(e,n);return{path:e,params:s?.params??{},query:ya(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},cn=(e,t="")=>{const r=[];for(const n of e){const s=n.path==="*"?"*":`${t}${n.path}`.replace(/\/+/g,"/");r.push({...n,path:s}),n.children&&r.push(...cn(n.children,s))}return r},ka=(e,t={})=>{const r=le();if(!r)throw new Error("bQuery router: No router initialized.");const n=r.routes.find(o=>o.name===e);if(!n)throw new Error(`bQuery router: Route "${e}" not found.`);let s="";for(let o=0;o<n.path.length;){if(n.path[o]===":"&&qe(n.path[o+1])){let i=o+2;for(;i<n.path.length&&rn(n.path[i]);)i++;let a=i,l=null;if(n.path[i]==="("){const h=nn(n.path,i);if(!h)throw new Error(`bQuery router: Invalid constraint syntax in path "${n.path}" for route "${e}".`);l=h.constraint,a=h.endIndex}const f=n.path.slice(o+1,i),u=t[f];if(u===void 0)throw new Error(`bQuery router: Missing required param "${f}" for route "${e}".`);if(l&&!tn(l).test(u))throw new Error(`bQuery router: Param "${f}" with value "${u}" does not satisfy the route constraint "${l}" for route "${e}".`);s+=encodeURIComponent(u),o=a;continue}s+=n.path[o],o++}return s},La=(e,t=!1)=>{const r=te.value.path;return t?r===e:r.startsWith(e)},$a=(e,t=!1)=>P(()=>{const r=te.value.path;return t?r===e:r.startsWith(e)}),Oa=100,Ra=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},Ma=e=>{const t=le();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:o=!1}=e,i=[],a=[],l=cn(r),f=new Map;let u="0",h=0,d=null;if(o&&typeof history<"u"&&"scrollRestoration"in history){d=history.scrollRestoration,history.scrollRestoration!=="manual"&&(history.scrollRestoration="manual");const S=history.state&&typeof history.state=="object"?history.state:{};if(typeof S.__bqScrollKey!="string"){const C=s?window.location.hash||"#/":`${window.location.pathname}${window.location.search}${window.location.hash}`;history.replaceState({...S,__bqScrollKey:u},"",C)}}const p=()=>history.state&&history.state.__bqScrollKey||u,c=()=>`${Date.now()}-${h++}`,m=(S=p())=>{if(o)for(f.has(S)&&f.delete(S),f.set(S,{x:window.scrollX,y:window.scrollY});f.size>Oa;){const C=f.keys().next().value;if(C===void 0)break;f.delete(C)}},g=(S=p())=>{if(!o)return;const C=f.get(S);C?window.scrollTo(C.x,C.y):window.scrollTo(0,0)},b=()=>{const S=history.state&&typeof history.state=="object"?{...history.state}:{};return o&&(S.__bqScrollKey=u),S},v=()=>{if(s){const[C,R=""]=(window.location.hash.slice(1)||"/").split("#"),[k,$=""]=C.split("?");return{pathname:k,search:$?`?${$}`:"",hash:R?`#${R}`:""}}let S=window.location.pathname;return n&&(S===n||S.startsWith(n+"/"))&&(S=S.slice(n.length)||"/"),{pathname:S,search:window.location.search,hash:window.location.hash}},w=()=>{const{pathname:S,search:C,hash:R}=v();te.value=st(S,C,R,l)},E=async(S,C,R=new Set)=>{Kr();try{const{pathname:k,search:$,hash:T}=v(),O=st(k,$,T,l),D=new URL(S,window.location.origin),I=`${D.pathname}${D.search}${D.hash}`;if(R.has(I))throw new Error(`bQuery router: redirect loop detected for path "${I}"`);R.add(I);const z=st(D.pathname,D.search,D.hash,l);if(z.matched?.redirectTo){await E(z.matched.redirectTo,C,R);return}if(z.matched?.beforeEnter&&await z.matched.beforeEnter(z,O)===!1)return;for(const Ve of i)if(await Ve(z,O)===!1)return;m();const _=o?p():void 0,H=C==="replaceState"&&_?_:c(),se=s?`#${S}`:`${n}${S}`,Ae=o&&history.state&&typeof history.state=="object"?Ra(history.state):{},zt=o?{...Ae,__bqScrollKey:H}:{};history[C](zt,"",se),u=H,w(),o&&C==="pushState"&&window.scrollTo(0,0);for(const Ve of a)Ve(te.value,O)}finally{Yr()}},L=async S=>{Kr();try{const{pathname:C,search:R,hash:k}=v(),$=te.value,T=st(C,R,k,l);if(T.matched?.redirectTo){await E(T.matched.redirectTo,"replaceState");return}if(T.matched?.beforeEnter&&await T.matched.beforeEnter(T,$)===!1){const O=new URLSearchParams(Object.entries($.query).flatMap(([_,H])=>Array.isArray(H)?H.map(se=>[_,se]):[[_,H]])).toString(),D=O?`?${O}`:"",I=$.hash?`#${$.hash}`:"",z=s?`#${$.path}${D}${I}`:`${n}${$.path}${D}${I}`;history.replaceState(b(),"",z);return}for(const O of i)if(await O(T,$)===!1){const D=new URLSearchParams(Object.entries($.query).flatMap(([H,se])=>Array.isArray(se)?se.map(Ae=>[H,Ae]):[[H,se]])).toString(),I=D?`?${D}`:"",z=$.hash?`#${$.hash}`:"",_=s?`#${$.path}${I}${z}`:`${n}${$.path}${I}${z}`;history.replaceState(b(),"",_);return}m(u),u=S.state?.__bqScrollKey??p(),w(),g(u);for(const O of a)O(te.value,$)}finally{Yr()}};window.addEventListener("popstate",L),w();const A={push:S=>E(S,"pushState"),replace:S=>E(S,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:S=>history.go(S),beforeEach:S=>(i.push(S),()=>{const C=i.indexOf(S);C>-1&&i.splice(C,1)}),afterEach:S=>(a.push(S),()=>{const C=a.indexOf(S);C>-1&&a.splice(C,1)}),currentRoute:Wr,routes:l,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",L),i.length=0,a.length=0,f.clear(),d!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=d),la(),Gr(null)}};return Gr(A),A},be=P(()=>te.value),Da={route:be,path:P(()=>be.value.path),params:P(()=>be.value.params),query:P(()=>be.value.query),hash:P(()=>be.value.hash),matched:P(()=>be.value.matched)},Na=()=>Da,Pa=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},Ia=(e,t)=>{const r=Pa();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},_a=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},qa=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},un=[],xa=e=>{un.push(e)},ja=(e,t)=>{for(const r of un){const n=r({store:e,options:t});n&&Object.assign(e,n)}},xe=new Map,fn=e=>xe.has(e),za=(e,t)=>{xe.set(e,t)},we=e=>xe.get(e),$t=()=>Array.from(xe.keys()),Fa=e=>{xe.delete(e),_a(e)},dn=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,ce=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ce);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,ce(n)]));if(e instanceof Set)return new Set(Array.from(e).map(ce));const t={};for(const r of Object.keys(e))t[r]=ce(e[r]);return t},Ee=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e.entries())if(!t.has(s)||!Ee(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.values()){let o=!1;for(const i of t.values())if(Ee(s,i)){o=!0;break}if(!o)return!1}return!0}if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>Ee(s,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(s=>Ee(e[s],t[s]))},Ba=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const o=e[s],i=t[s];r.get(s)===i&&dn(o)&&dn(i)&&!Ee(o,i)&&n.push(s)}return n},je=()=>bt(),Ot=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if(fn(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),we(t);const o=r(),i=new Map;for(const v of Object.keys(o))i.set(v,M(o[v]));const a=[],l=[],f=(v,w,E)=>{!je()||typeof console>"u"||typeof console.error!="function"||console.error(`[bQuery store "${t}"] Error in $onAction ${v} for action "${w}"`,E)},u=new WeakSet,h=(v,w)=>{!je()||typeof console>"u"||typeof console.warn!="function"||u.has(v)||(u.add(v),console.warn(`[bQuery store "${t}"] Async $onAction listener detected for action "${w}". If it awaits, register after()/onError() before the first await; late registrations will not affect the current action.`))},d=(v,w,E,L)=>{try{const A=E();Ce(A)&&(v==="listener"&&L&&h(L,w),A.catch(S=>{f(v,w,S)}))}catch(A){f(v,w,A)}},p=()=>ae(()=>({...m})),c=()=>{const v=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(a.length===0&&!v)return;const w=p();for(const E of a)E(w);qa(t,w)},m=new Proxy({},{get:(v,w)=>{const E=w;if(i.has(E))return i.get(E).value},ownKeys:()=>Array.from(i.keys()),getOwnPropertyDescriptor:(v,w)=>{if(i.has(w))return{enumerable:!0,configurable:!0}},has:(v,w)=>i.has(w)}),g=new Map,b={};for(const v of Object.keys(o))Object.defineProperty(b,v,{get:()=>i.get(v).value,set:w=>{i.get(v).value=w,c()},enumerable:!0,configurable:!1});for(const v of Object.keys(n)){const w=n[v],E=P(()=>w(m,new Proxy({},{get:(L,A)=>{const S=A;if(g.has(S))return g.get(S).value}})));g.set(v,E),Object.defineProperty(b,v,{get:()=>E.value,enumerable:!0,configurable:!1})}for(const v of Object.keys(s)){const w=s[v],E=v;b[E]=function(...L){const A=new Proxy(b,{get:(T,O)=>typeof O=="string"&&i.has(O)?i.get(O).value:T[O],set:(T,O,D)=>typeof O=="string"&&i.has(O)?(i.get(O).value=D,c(),!0):Reflect.set(T,O,D)});if(l.length===0)return w.apply(A,L);const S=[],C=[],R=[...l],k={name:E,store:b,args:L,after:T=>{S.push(O=>T(O))},onError:T=>{C.push(T)}};for(const T of R)d("listener",E,()=>T(k),T);let $;try{$=w.apply(A,L)}catch(T){for(const O of C)d("onError",E,()=>O(T));throw T}if(Ce($))return $.then(T=>{for(const O of S)d("after",E,()=>O(T));return T},T=>{for(const O of C)d("onError",E,()=>O(T));throw T});for(const T of S)d("after",E,()=>T($));return $}}return Object.defineProperties(b,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const v=r();Le(()=>{for(const[w,E]of i)E.value=v[w]}),c()},writable:!1,enumerable:!1},$subscribe:{value:v=>(a.push(v),()=>{const w=a.indexOf(v);w>-1&&a.splice(w,1)}),writable:!1,enumerable:!1},$onAction:{value:v=>(l.push(v),()=>{const w=l.indexOf(v);w>-1&&l.splice(w,1)}),writable:!1,enumerable:!1},$patch:{value:v=>{Le(()=>{if(typeof v=="function"){const w=je(),E=w?ce(p()):null,L=w?new Map(Array.from(i.entries()).map(([S,C])=>[S,C.value])):null,A=p();if(v(A),w&&E&&L){const S=Ba(E,A,L);S.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${S.map(String).join(", ")}.
254
+ `}),r},Ft=null,ee=()=>Ft!==null?Ft:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ia=e=>{Ft=e},En=e=>typeof e=="string"||typeof e=="number",Sn=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Ae=(e,t)=>{const r=e.style;if(Array.isArray(t)){const n=t[t.length-1];if(!n)return;for(const[s,o]of Object.entries(n))if(!(s==="offset"||s==="easing"||s==="composite")&&En(o)){const i=s.startsWith("--")?s:Sn(s);r.setProperty(i,String(o))}return}for(const[n,s]of Object.entries(t)){if(n==="offset"||n==="easing"||n==="composite")continue;const o=Array.isArray(s)?s[s.length-1]:s;if(En(o)){const i=n.startsWith("--")?n:Sn(n);r.setProperty(i,String(o))}}},vt=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:o=!0,onFinish:i}=t;if(o&&ee())return s&&Ae(e,r),i?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&Ae(e,r),i?.(),Promise.resolve()):new Promise(l=>{const c=a.animate(r,n);let f=!1;const m=()=>{f||(f=!0,s&&(typeof c.commitStyles=="function"?c.commitStyles():Ae(e,r)),c.cancel(),i?.(),l())};c.onfinish=m,c.finished&&c.finished.then(m).catch(m)})},te=e=>Math.min(1,Math.max(0,e)),An=e=>te(e),kn=e=>te(e*e),Tn=e=>te(1-(1-e)*(1-e)),Cn=e=>te(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),Rn=e=>te(e*e*e),On=e=>te(1-Math.pow(1-e,3)),Ln=e=>te(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),$n=e=>te(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),Pn=e=>te(e===1?1:1-Math.pow(2,-10*e)),_a={linear:An,easeInQuad:kn,easeOutQuad:Tn,easeInOutQuad:Cn,easeInCubic:Rn,easeOutCubic:On,easeInOutCubic:Ln,easeOutBack:$n,easeOutExpo:Pn},Ut=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},Bt=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:o}=r,i=Ut(e);if(i.width===0||i.height===0)return o?.(),Promise.resolve();const a=t.left-i.left,l=t.top-i.top,c=t.width/i.width,f=t.height/i.height;if(a===0&&l===0&&c===1&&f===1)return o?.(),Promise.resolve();const m=e;return typeof m.animate!="function"?(o?.(),Promise.resolve()):(m.style.transform=`translate(${a}px, ${l}px) scale(${c}, ${f})`,m.style.transformOrigin="top left",m.offsetHeight,new Promise(d=>{const p=m.animate([{transform:`translate(${a}px, ${l}px) scale(${c}, ${f})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let u=!1;const h=()=>{u||(u=!0,m.style.transform="",m.style.transformOrigin="",o?.(),d())};p.onfinish=h,p.finished&&p.finished.then(h).catch(h)}))},qa=async(e,t,r={})=>{await Mn(e,t,r)},Mn=async(e,t,r={})=>{const{stagger:n,...s}=r,o=new Map;for(const l of e)o.set(l,Ut(l));t();const i=e.length,a=e.map((l,c)=>{const f=o.get(l);if(!f)return Promise.resolve();const m=n?n(c,i):0;return m>0?new Promise(d=>setTimeout(d,m)).then(()=>Bt(l,f,s)):Bt(l,f,s)});await Promise.all(a)},za={fadeIn:(e=0,t=1)=>[{opacity:e},{opacity:t}],fadeOut:(e=1,t=0)=>[{opacity:e},{opacity:t}],slideInUp:(e=16)=>[{opacity:0,transform:`translateY(${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInDown:(e=16)=>[{opacity:0,transform:`translateY(-${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInLeft:(e=16)=>[{opacity:0,transform:`translateX(${e}px)`},{opacity:1,transform:"translateX(0)"}],slideInRight:(e=16)=>[{opacity:0,transform:`translateX(-${e}px)`},{opacity:1,transform:"translateX(0)"}],scaleIn:(e=.95,t=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`}],scaleOut:(e=1,t=.95)=>[{opacity:1,transform:`scale(${e})`},{opacity:0,transform:`scale(${t})`}],pop:(e=.9,t=1.02,r=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`,offset:.6},{opacity:1,transform:`scale(${r})`}],rotateIn:(e=6)=>[{opacity:0,transform:`rotate(${e}deg) scale(0.98)`},{opacity:1,transform:"rotate(0deg) scale(1)"}]},xa=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:o=!0,onComplete:i}=r,a=e,l=t;if(typeof window>"u"||typeof document>"u"||typeof a.getBoundingClientRect!="function"||typeof l.getBoundingClientRect!="function"||typeof a.style>"u"||typeof l.style>"u")return i?.(),Promise.resolve();const c=e.getBoundingClientRect(),f=l.style.display,m=l.style.visibility,d=l.style.transform,p=l.style.opacity,u=typeof getComputedStyle=="function"?getComputedStyle(l).display:f||"block",h=u==="none"?"block":f||u||"block",v=()=>{l.style.transform=d,l.style.opacity=p};l.style.visibility="hidden",l.style.display=h;const b=t.getBoundingClientRect();if(l.style.visibility=m,a.style.display="none",u==="none"?l.style.display=h:f==="none"?l.style.display="":l.style.display=f,o&&ee())return v(),i?.(),Promise.resolve();const y=c.left-b.left,w=c.top-b.top,E=c.width/(b.width||1),k=c.height/(b.height||1);if(y===0&&w===0&&E===1&&k===1)return v(),i?.(),Promise.resolve();const A=[{transform:`translate(${y}px, ${w}px) scale(${E}, ${k})`,opacity:"0.5"},{transform:"translate(0, 0) scale(1, 1)",opacity:"1"}];return typeof l.animate!="function"?(v(),i?.(),Promise.resolve()):new Promise(S=>{const T=l.animate(A,{duration:n,easing:s,fill:"forwards"});let P=!1;const R=()=>{P||(P=!0,v(),T.cancel(),i?.(),S())};T.onfinish=R,T.finished&&T.finished.then(R).catch(R)})},ja=(e,t={})=>{if(typeof window>"u"||typeof window.addEventListener!="function"||typeof window.removeEventListener!="function"||typeof requestAnimationFrame!="function"||typeof cancelAnimationFrame!="function")return()=>{};const{speed:r=.5,direction:n="vertical",respectReducedMotion:s=!0}=t,o=e,i=o.style.transform;if(s&&ee())return()=>{};let a=!1,l=!1,c=null;const f=()=>{l||(l=!0,window.removeEventListener("scroll",d),c!==null&&(cancelAnimationFrame(c),c=null),a=!1,o.style.transform=i)},m=()=>{if(l)return;if(s&&ee()){f();return}const p=window.scrollY,u=window.scrollX;let h=0,v=0;(n==="vertical"||n==="both")&&(v=p*r),(n==="horizontal"||n==="both")&&(h=u*r);const b=`translate3d(${h}px, ${v}px, 0)`;o.style.transform=i?`${i} ${b}`:b},d=()=>{if(!l){if(s&&ee()){f();return}a||(a=!0,c=requestAnimationFrame(()=>{c=null,m(),a=!1}))}};return m(),window.addEventListener("scroll",d,{passive:!0}),f},Fa=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),Ua=(e,t)=>{const r=Fa(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:o,once:i=!0,onEnter:a,...l}=t;if(typeof IntersectionObserver>"u")return r.forEach(f=>{a?.(f),vt(f,l)}),()=>{};const c=new IntersectionObserver(f=>{f.forEach(m=>{if(!m.isIntersecting)return;const d=m.target;a?.(d),vt(d,l),i&&c.unobserve(d)})},{root:n,rootMargin:s,threshold:o});return r.forEach(f=>c.observe(f)),()=>c.disconnect()},Ba={stiffness:100,damping:10,mass:1,precision:.01},Wa=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:o}={...Ba,...t};let i=e,a=0,l=e,c=null,f=null,m=null;const d=new Set,p=()=>{for(const h of d)h(i)},u=h=>{const v=m!==null?(h-m)/1e3:.016666666666666666,b=Math.min(v,1/30);m=h;const y=i-l,w=(-r*y+-n*a)/s;if(a+=w*b,i+=a*b,p(),Math.abs(a)<o&&Math.abs(y)<o){i=l,a=0,c=null,p(),f?.(),f=null;return}c=requestAnimationFrame(u)};return{to(h){return l=h,c!==null&&cancelAnimationFrame(c),f?.(),m=null,new Promise(v=>{f=v,c=requestAnimationFrame(u)})},current(){return i},stop(){c!==null&&(cancelAnimationFrame(c),c=null),a=0,m=null,f?.(),f=null},onChange(h){return d.add(h),()=>d.delete(h)}}},Ha={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},Qa=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(o,i=0)=>{const a=typeof n=="number"?n:n==="center"?(i-1)/2:n==="end"?i-1:0,l=Math.abs(o-a),c=i>1?Math.max(a,i-1-a):1,f=c===0?0:l/c;return r+(s?s(f)*c:l)*e}},Wt=e=>{if(typeof e=="number")return e;if(typeof e=="string"){const t=e.trim();if(t.endsWith("ms")){const n=Number.parseFloat(t.slice(0,-2));return Number.isFinite(n)?n:0}if(t.endsWith("s")){const n=Number.parseFloat(t.slice(0,-1));return Number.isFinite(n)?n*1e3:0}const r=Number.parseFloat(t);return Number.isFinite(r)?r:0}return 0},Va=(e,t)=>{if(typeof e=="number")return e;if(typeof e=="string"){const r=/^([+-])=(\d+(?:\.\d+)?)$/.exec(e);if(r){const n=Number.parseFloat(r[2]);return Number.isFinite(n)?r[1]==="+"?t+n:t-n:t}}return t},Ka=e=>{const t=Wt(e?.duration),r=Wt(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},Nn=e=>{let t=0;return e.map(r=>{const n=Va(r.at,t),s=Wt(r.options?.delay),o=Math.max(0,n+s),i=Ka(r.options),a=o+i;return t=Math.max(t,a),{step:r,start:o,end:a,duration:i}})},Ya=async(e,t={})=>{const{stagger:r,onFinish:n}=t,s=e.length;for(let o=0;o<e.length;o+=1){const i=e[o],a=r?r(o,s):0;a>0&&await new Promise(l=>setTimeout(l,a)),await vt(i.target,i)}n?.()},Ga=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],o=0,i=!1,a=!1;const{commitStyles:l=!0,respectReducedMotion:c=!0,onFinish:f}=t,m=()=>{if(!a){if(a=!0,l)for(const p of s){const{animation:u,step:h}=p;typeof u.commitStyles=="function"?u.commitStyles():Ae(h.target,h.keyframes),u.cancel()}n.forEach(p=>p()),f?.()}},d=()=>{s.forEach(({animation:u})=>u.cancel()),s=[],a=!1;const p=Nn(r);if(o=p.length?Math.max(...p.map(u=>u.end)):0,c&&ee()){l&&p.forEach(({step:u})=>Ae(u.target,u.keyframes)),i=!0;return}if(p.some(({step:u})=>typeof u.target.animate!="function")){l&&p.forEach(({step:u})=>Ae(u.target,u.keyframes)),i=!0;return}i=!1,s=p.map(({step:u,start:h})=>{const{delay:v,...b}=u.options??{};return{animation:u.target.animate(u.keyframes,{...b,delay:h,fill:b.fill??"both"}),step:u,start:h}})};return{add(p){r.push(p)},duration(){if(!r.length)return 0;if(!s.length){const p=Nn(r);return Math.max(...p.map(u=>u.end))}return o},async play(){if(d(),i||s.length===0){m();return}const p=s.map(u=>u.animation.finished.catch(()=>{}));await Promise.all(p),m()},pause(){i||s.forEach(({animation:p})=>p.pause())},resume(){i||s.forEach(({animation:p})=>p.play())},stop(){s.forEach(({animation:p})=>p.cancel()),s=[],i=!1},seek(p){i||s.forEach(({animation:u})=>{u.currentTime=p})},onFinish(p){return n.add(p),()=>n.delete(p)}}},Dn=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Ja=async e=>{const t=Z().transitions,r=typeof e=="function"?{update:e,classes:t?.classes,types:t?.types,skipOnReducedMotion:t?.skipOnReducedMotion}:{...e,classes:e.classes??t?.classes,types:e.types??t?.types,skipOnReducedMotion:e.skipOnReducedMotion??t?.skipOnReducedMotion},n=r.update;if(typeof document>"u"){await n();return}const s=document,o=document.documentElement,i=Dn(r.classes),a=Dn(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&ee()){await n(),r.onFinish?.();return}i.forEach(l=>o.classList.add(l));try{const l=s.startViewTransition(()=>n()),c=l.types;if(c)for(const f of a)c.add(f);await l.ready,r.onReady?.(),await l.finished,r.onFinish?.()}finally{i.forEach(l=>o.classList.remove(l))}},Xa=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:o=!1,cursorChar:i="|",loop:a=!1,loopDelay:l=1e3,respectReducedMotion:c=!0,onComplete:f}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const m=e;let d=!1,p=null,u=null,h=null,v=null;const b=()=>{if(!o)return;u=document.createElement("span"),u.setAttribute("aria-hidden","true"),u.textContent=i,m.appendChild(u);let E=!0;h=setInterval(()=>{u&&(E=!E,u.style.opacity=E?"1":"0")},530)},y=()=>{h!==null&&(clearInterval(h),h=null),u&&u.parentNode&&(u.parentNode.removeChild(u),u=null)},w=()=>{d||(d=!0,p!==null&&(clearTimeout(p),p=null),y(),v?.(),v=null)};return c&&ee()?(m.textContent=t,f?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(E=>{v=E;const k=()=>{let A=0;m.textContent="",b();const S=document.createTextNode("");u?m.insertBefore(S,u):m.appendChild(S);const T=()=>{d||(A<t.length?(S.data=t.slice(0,A+1),A++,p=setTimeout(T,n)):(f?.(),a&&!d?p=setTimeout(()=>{d||(y(),k())},l):(y(),E(),v=null)))};p=setTimeout(T,s)};k()})}},Za=class{constructor(e){this.bucketName=e,this.dbPromise=null,this.storeName="blobs"}openDB(){if(this.dbPromise)return this.dbPromise;const e=`bquery-bucket-${this.bucketName}`;return this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)},n.onsuccess=()=>t(n.result),n.onerror=()=>r(n.error)}),this.dbPromise}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.storeName,e).objectStore(this.storeName));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async put(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},el={async open(e){return new Za(e)}},tl=class{constructor(e){this.cache=e}async add(e){await this.cache.add(e)}async addAll(e){await this.cache.addAll(e)}async put(e,t){await this.cache.put(e,t)}async match(e){return this.cache.match(e)}async remove(e){return this.cache.delete(e)}async keys(){return(await this.cache.keys()).map(e=>e.url)}},rl={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new tl(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},nl=e=>{if(typeof document>"u")return null;const t=`${encodeURIComponent(e)}=`,r=document.cookie?document.cookie.split(";"):[];for(const n of r){const s=n.trim();if(s.startsWith(t)){const o=s.slice(t.length);try{return decodeURIComponent(o)}catch{return o}}}return null},sl=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},ol=(e,t)=>{if(typeof document>"u")return;const r=[`${encodeURIComponent(e)}=`,"Expires=Thu, 01 Jan 1970 00:00:00 GMT"];t.path&&r.push(`Path=${t.path}`),t.domain&&r.push(`Domain=${t.domain}`),t.sameSite&&r.push(`SameSite=${t.sameSite}`),t.secure&&r.push("Secure"),document.cookie=r.join("; ")},il=(e,t,r)=>{if(typeof document>"u")return;const n=r.serialize?r.serialize(t):typeof t=="string"?t:JSON.stringify(t),s=[`${encodeURIComponent(e)}=${encodeURIComponent(n)}`];r.path&&s.push(`Path=${r.path}`),r.domain&&s.push(`Domain=${r.domain}`),typeof r.maxAge=="number"&&s.push(`Max-Age=${r.maxAge}`),r.expires&&s.push(`Expires=${r.expires.toUTCString()}`),r.sameSite&&s.push(`SameSite=${r.sameSite}`),r.secure&&s.push("Secure"),document.cookie=s.join("; ")},al=(e,t={})=>{const r=Z().cookies,n={path:r?.path??"/",sameSite:r?.sameSite??"Lax",secure:r?.secure??!1,watch:!0,...t};n.sameSite==="None"&&(n.secure=!0);const s=nl(e);let o=n.defaultValue??null;if(s!==null)try{o=n.deserialize?n.deserialize(s):sl(s)?JSON.parse(s):s??o}catch(l){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,l),o=s??o}const i=$(o);if(typeof document>"u"||n.watch===!1)return i;let a=!1;return j(()=>{const l=i.value;if(!a){a=!0;return}if(l==null){ol(e,n);return}il(e,l,n)}),i},ll={isSupported(){return"Notification"in window},getPermission(){return this.isSupported()?Notification.permission:"denied"},async requestPermission(){return this.isSupported()?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"},send(e,t){return this.isSupported()?Notification.permission!=="granted"?(console.warn("bQuery: Notification permission not granted"),null):new Notification(e,t):(console.warn("bQuery: Notifications not supported in this browser"),null)}},cl=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),ul=(e={})=>{const t=Z().announcer,r={politeness:t?.politeness??"polite",atomic:t?.atomic??!0,delay:t?.delay??16,clearDelay:t?.clearDelay??1e3,...e},n=$("");if(typeof document>"u")return{element:null,message:n,announce(h){n.value=h},clear(){n.value=""},destroy(){n.value=""}};const s=r.id?document.getElementById(r.id):null,o=s??document.createElement("div"),i=!s;if(r.id&&(o.id=r.id),r.className&&(o.className=r.className),o.setAttribute("aria-live",r.politeness),o.setAttribute("aria-atomic",String(r.atomic)),o.setAttribute("role",r.politeness==="assertive"?"alert":"status"),o.setAttribute("data-bquery-announcer","true"),o.getAttribute("style")||o.setAttribute("style",cl),i){const h=r.container??document.body??document.documentElement;if(!h)return{element:null,message:n,announce(v){n.value=v},clear(){n.value=""},destroy(){n.value=""}};h.appendChild(o)}const a=j(()=>{o.textContent=n.value});let l,c,f=!1;const m=()=>{l&&(clearTimeout(l),l=void 0),c&&(clearTimeout(c),c=void 0)};return{element:o,message:n,announce:(h,v={})=>{if(f)return;const b=v.politeness??r.politeness,y=v.delay??r.delay,w=v.clearDelay??r.clearDelay;m(),o.setAttribute("aria-live",b),o.setAttribute("role",b==="assertive"?"alert":"status"),n.value="",l=setTimeout(()=>{f||(n.value=h,w>0&&(c=setTimeout(()=>{f||(n.value="")},w)))},y)},clear:()=>{f||(m(),n.value="")},destroy:()=>{f||(f=!0,m(),n.value="",a(),i&&o.remove())}}},In=(e,t)=>{const r=new Map;for(const[n,s]of Object.entries(t))r.set(n,e.getAttribute(n)),e.setAttribute(n,s);return()=>{for(const[n,s]of r.entries())s==null?e.removeAttribute(n):e.setAttribute(n,s)}},_n=(e,t)=>{const r=document.createElement(e);r.setAttribute("data-bquery-page-meta","true");for(const[n,s]of Object.entries(t))s!==void 0&&r.setAttribute(n,s);return r},fl=e=>{if(typeof document>"u")return()=>{};const t=Z().pageMeta,r=e.title?t?.titleTemplate?t.titleTemplate(e.title):e.title:void 0,n=[],s=[],o=document.title;r!==void 0&&(document.title=r);const i=[...e.meta??[]];e.description&&i.unshift({name:"description",content:e.description});for(const a of i){const l=_n("meta",{name:a.name,property:a.property,"http-equiv":a.httpEquiv,content:a.content});document.head.appendChild(l),n.push(l)}for(const a of e.link??[]){const l=_n("link",{rel:a.rel,href:a.href,type:a.type,media:a.media,crossorigin:a.crossOrigin});document.head.appendChild(l),n.push(l)}return e.htmlAttributes&&s.push(In(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(In(document.body,e.bodyAttributes)),()=>{document.title=o;for(const a of s.reverse())a();for(const a of n)a.remove()}},qn=class{constructor(e){this.storage=e}async get(e){const t=this.storage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return t}}async set(e,t){const r=typeof t=="string"?t:JSON.stringify(t);this.storage.setItem(e,r)}async remove(e){this.storage.removeItem(e)}async clear(){this.storage.clear()}async keys(){const e=[];for(let t=0;t<this.storage.length;t++){const r=this.storage.key(t);r!==null&&e.push(r)}return e}},dl=class extends qn{constructor(){super(localStorage)}},hl=class extends qn{constructor(){super(sessionStorage)}},ml=class{constructor(e){this.options=e,this.dbPromise=null}openDB(){return this.dbPromise?this.dbPromise:(this.dbPromise=new Promise((e,t)=>{const r=indexedDB.open(this.options.name,this.options.version??1);r.onupgradeneeded=()=>{const n=r.result;n.objectStoreNames.contains(this.options.store)||n.createObjectStore(this.options.store)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)}),this.dbPromise)}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.options.store,e).objectStore(this.options.store));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async set(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async clear(){await this.withStore("readwrite",e=>e.clear())}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},pl={local(){return new dl},session(){return new hl},indexedDB(e){return new ml(e)}},zn=null,re=$({path:"",params:{},query:{},matched:null,hash:""}),xn=D(()=>re.value),Ue=$(0),yt=$(!1),vl=I(yt),jn=()=>{Ue.value===0&&(yt.value=!0),Ue.value+=1},Fn=()=>{const e=Math.max(0,Ue.value-1);Ue.value=e,e===0&&(yt.value=!1)},yl=()=>{Ue.value=0,yt.value=!1},he=()=>zn,Un=e=>{zn=e},Be=async(e,t={})=>{const r=he();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},gl=()=>{const e=he();e?e.back():history.back()},bl=()=>{const e=he();e?e.forward():history.forward()},wl="active",El=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),Sl=typeof HTMLElement<"u"?HTMLElement:class{},Bn=class extends Sl{constructor(...e){super(...e),this._cleanup=null,this._trackedActiveClasses=new Map,this._handleClick=t=>{t instanceof MouseEvent&&(t.defaultPrevented||t.button===0&&(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),this._navigate())))},this._handleKeydown=t=>{t instanceof KeyboardEvent&&t.key==="Enter"&&(t.preventDefault(),this._navigate())}}static get observedAttributes(){return["to","replace","exact","active-class"]}get to(){const e=this.getAttribute("to");return e==null||e.trim()===""?"/":e}set to(e){this.setAttribute("to",e)}get replace(){return this.hasAttribute("replace")}set replace(e){e?this.setAttribute("replace",""):this.removeAttribute("replace")}get exact(){return this.hasAttribute("exact")}set exact(e){e?this.setAttribute("exact",""):this.removeAttribute("exact")}get activeClass(){return this.getAttribute("active-class")??wl}set activeClass(e){this.setAttribute("active-class",e)}connectedCallback(){this.getAttribute("role")||this.setAttribute("role","link"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this._handleClick),this.addEventListener("keydown",this._handleKeydown),this._setupActiveTracking()}disconnectedCallback(){this.removeEventListener("click",this._handleClick),this.removeEventListener("keydown",this._handleKeydown),this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses()}attributeChangedCallback(e,t,r){(e==="to"||e==="exact"||e==="active-class")&&this.isConnected&&this._setupActiveTracking()}_setupActiveTracking(){this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses();const e=this.to,t=this.exact,r=El(this.activeClass);this._trackedActiveClasses=new Map(r.map(n=>[n,this.classList.contains(n)])),this._cleanup=j(()=>{const n=re.value.path,s=t?n===e:e==="/"?n==="/":n===e||n.startsWith(e.endsWith("/")?e:e+"/");for(const o of r){const i=this._trackedActiveClasses.get(o)??!1;this.classList.toggle(o,s||i)}s?this.setAttribute("aria-current","page"):this.removeAttribute("aria-current")})}_clearTrackedActiveClasses(){for(const[e,t]of this._trackedActiveClasses)this.classList.toggle(e,t);this._trackedActiveClasses.clear()}_navigate(){const e=this.to;e&&he()&&Be(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},Al=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",Bn)},kl=(e,t={})=>r=>{r.preventDefault(),Be(e,t).catch(n=>{console.error("Navigation failed:",n)})},Tl=e=>{const t=e??(typeof document<"u"?document.body:null);if(!t)return()=>{};const r=n=>{if(!(n instanceof MouseEvent)||n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey||typeof Element>"u"||!(n.target instanceof Element))return;const s=n.target.closest("a");if(!s||!(s instanceof(s.ownerDocument.defaultView?.HTMLAnchorElement??HTMLAnchorElement))||s.target||s.hasAttribute("download")||typeof window>"u"||s.origin!==window.location.origin)return;const o=he();if(!o){n.preventDefault(),Be(s.pathname+s.search+s.hash).catch(c=>{console.error("Navigation failed:",c)});return}const i=o.base,a=o.hash;let l;if(a&&s.hash&&s.hash.startsWith("#/"))l=s.hash.slice(1);else{let c=s.pathname;i&&i!=="/"&&c.startsWith(i)&&(c=c.slice(i.length)||"/"),l=c+s.search+s.hash}n.preventDefault(),Be(l).catch(c=>{console.error("Navigation failed:",c)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},Cl=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{if(x(n))return;const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},Rl=128,Wn=new Map,Hn=new Map,Qn=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=Rl)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},Ol=e=>{const t=[];let r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){n++;continue}if(s==="["&&!r){r=!0;continue}if(s==="]"&&r){r=!1;continue}if(!r){if(s==="("){t.push(!1);continue}if(s===")"){const o=t.pop()??!1,i=e[n+1];if(o&&(i==="+"||i==="*"||i==="?"||i==="{"))return!0;o&&t.length>0&&(t[t.length-1]=!0);continue}if(t.length>0){if(s==="?"&&n>0&&e[n-1]==="(")continue;(s==="+"||s==="*"||s==="?"||s==="{")&&(t[t.length-1]=!0)}}}return!1},Ll=e=>{let t="",r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){if(!r&&e[n+1]>="1"&&e[n+1]<="9")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);if(!r&&e[n+1]==="k"&&e[n+2]==="<")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);t+=s+e[n+1],n++;continue}if(s==="["&&!r){r=!0,t+=s;continue}if(s==="]"&&r){r=!1,t+=s;continue}if(!r&&s==="("){if(n+1<e.length&&e[n+1]==="?"){if(e[n+2]==="<"){if(e[n+3]==="="||e[n+3]==="!"){t+="(";continue}const o=e.indexOf(">",n+3);if(o===-1)throw new Error(`bQuery router: Invalid route constraint named capture group: "${e}".`);t+="(?:",n=o;continue}t+="(";continue}t+="(?:";continue}t+=s}return t},Ht=e=>{const t=Wn.get(e);if(t!==void 0)return t;const r=Ll(e);return Qn(Wn,e,r),r},Vn=e=>{const t=Ht(e),r=Hn.get(t);if(r)return r;if(Ol(t))throw new Error(`bQuery router: Route constraint contains a potentially catastrophic (ReDoS) pattern. Nested quantifiers are not allowed: "${e}".`);try{const n=new RegExp(`^(?:${t})$`);return Qn(Hn,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},We=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),Kn=e=>We(e)||e!==void 0&&e>="0"&&e<="9",Yn=(e,t)=>{let r=1,n="",s=t+1,o=!1;for(;s<e.length;){const i=e[s];if(i==="\\"&&s+1<e.length){n+=i+e[s+1],s+=2;continue}if(i==="["&&!o)o=!0;else if(i==="]"&&o)o=!1;else if(!o&&i==="(")r++;else if(!o&&i===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=i,s++}return null},$l=(e,t)=>{const r=Yn(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},Gn=new Set,Jn=(e,t)=>{if(e[t]!==":"||!We(e[t+1]))return null;let r=t+2;for(;r<e.length&&Kn(e[r]);)r++;let n=r,s;if(e[r]==="("){const o=$l(e,r);s=o.constraint,n=o.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},Pl=e=>{if(!Gn.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&We(e[t+1])){const r=Jn(e,t);r?.constraint&&Ht(r.constraint),t=r?.nextIndex??t+1;continue}t++}Gn.add(e)}},Ml=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},Xn=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&We(e[r+1]));)r++;return e.slice(t,r)},Zn=(e,t,r,n)=>{const s=[];let o=t;for(;o<=r;){const i=e.indexOf(n,o);if(i===-1||i>r)break;s.push(i),o=i+1}return s.reverse()},Nl=(e,t)=>{const r=new Map,n=(s,o)=>{const i=`${s}:${o}`;if(r.has(i))return r.get(i)??null;if(s===e.length){const f=o===t.length?{}:null;return r.set(i,f),f}const a=e[s];if(a==="*"){if(s===e.length-1){const p={};return r.set(i,p),p}const f=Xn(e,s+1),m=f.length>0?Zn(t,o,t.length,f):null,d=(m?p=>{for(const u of m){const h=p(u);if(h)return h}return null}:p=>{for(let u=t.length;u>=o;u--){const h=p(u);if(h)return h}return null})(p=>{const u=n(s+1,p);return u?(r.set(i,u),u):null});return d||(r.set(i,null),null)}const l=Jn(e,s);if(l){const f=l.constraint?Vn(l.constraint):void 0,m=l.constraint?t.length:Ml(t,o),d=Xn(e,l.nextIndex),p=d.length>0?Zn(t,o,m,d):null,u=(p?h=>{for(const v of p){if(v<=o)continue;const b=h(v);if(b)return b}return null}:h=>{for(let v=m;v>o;v--){const b=h(v);if(b)return b}return null})(h=>{const v=t.slice(o,h);if(f&&!f.test(v))return null;const b=n(l.nextIndex,h);if(b){const y={[l.name]:v,...b};return r.set(i,y),y}return null});return u||(r.set(i,null),null)}if(o>=t.length||a!==t[o])return r.set(i,null),null;const c=n(s+1,o+1);return r.set(i,c),c};return n(0,0)},Dl=(e,t)=>{for(const r of t){Pl(r.path);const n=Nl(r.path,e);if(n)return{matched:r,params:n}}return null},gt=(e,t,r,n)=>{const s=Dl(e,n);return{path:e,params:s?.params??{},query:Cl(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},es=(e,t="")=>{const r=[];for(const n of e){const s=n.path==="*"?"*":`${t}${n.path}`.replace(/\/+/g,"/");r.push({...n,path:s}),n.children&&r.push(...es(n.children,s))}return r},Il=(e,t={})=>{const r=he();if(!r)throw new Error("bQuery router: No router initialized.");const n=r.routes.find(o=>o.name===e);if(!n)throw new Error(`bQuery router: Route "${e}" not found.`);let s="";for(let o=0;o<n.path.length;){if(n.path[o]===":"&&We(n.path[o+1])){let i=o+2;for(;i<n.path.length&&Kn(n.path[i]);)i++;let a=i,l=null;if(n.path[i]==="("){const m=Yn(n.path,i);if(!m)throw new Error(`bQuery router: Invalid constraint syntax in path "${n.path}" for route "${e}".`);l=m.constraint,a=m.endIndex}const c=n.path.slice(o+1,i),f=t[c];if(f===void 0)throw new Error(`bQuery router: Missing required param "${c}" for route "${e}".`);if(l&&!Vn(l).test(f))throw new Error(`bQuery router: Param "${c}" with value "${f}" does not satisfy the route constraint "${l}" for route "${e}".`);s+=encodeURIComponent(f),o=a;continue}s+=n.path[o],o++}return s},_l=(e,t=!1)=>{const r=re.value.path;return t?r===e:r.startsWith(e)},ql=(e,t=!1)=>D(()=>{const r=re.value.path;return t?r===e:r.startsWith(e)}),zl=100,xl=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},jl=e=>{const t=he();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:o=!1}=e,i=[],a=[],l=es(r),c=new Map;let f="0",m=0,d=null;if(o&&typeof history<"u"&&"scrollRestoration"in history){d=history.scrollRestoration,history.scrollRestoration!=="manual"&&(history.scrollRestoration="manual");const S=history.state&&typeof history.state=="object"?history.state:{};if(typeof S.__bqScrollKey!="string"){const T=s?window.location.hash||"#/":`${window.location.pathname}${window.location.search}${window.location.hash}`;history.replaceState({...S,__bqScrollKey:f},"",T)}}const p=()=>history.state&&history.state.__bqScrollKey||f,u=()=>`${Date.now()}-${m++}`,h=(S=p())=>{if(o)for(c.has(S)&&c.delete(S),c.set(S,{x:window.scrollX,y:window.scrollY});c.size>zl;){const T=c.keys().next().value;if(T===void 0)break;c.delete(T)}},v=(S=p())=>{if(!o)return;const T=c.get(S);T?window.scrollTo(T.x,T.y):window.scrollTo(0,0)},b=()=>{const S=history.state&&typeof history.state=="object"?{...history.state}:{};return o&&(S.__bqScrollKey=f),S},y=()=>{if(s){const[T,P=""]=(window.location.hash.slice(1)||"/").split("#"),[R,O=""]=T.split("?");return{pathname:R,search:O?`?${O}`:"",hash:P?`#${P}`:""}}let S=window.location.pathname;return n&&(S===n||S.startsWith(n+"/"))&&(S=S.slice(n.length)||"/"),{pathname:S,search:window.location.search,hash:window.location.hash}},w=()=>{const{pathname:S,search:T,hash:P}=y();re.value=gt(S,T,P,l)},E=async(S,T,P=new Set)=>{jn();try{const{pathname:R,search:O,hash:C}=y(),L=gt(R,O,C,l),M=new URL(S,window.location.origin),_=`${M.pathname}${M.search}${M.hash}`;if(P.has(_))throw new Error(`bQuery router: redirect loop detected for path "${_}"`);P.add(_);const U=gt(M.pathname,M.search,M.hash,l);if(U.matched?.redirectTo){await E(U.matched.redirectTo,T,P);return}if(U.matched?.beforeEnter&&await U.matched.beforeEnter(U,L)===!1)return;for(const Ze of i)if(await Ze(U,L)===!1)return;h();const q=o?p():void 0,Q=T==="replaceState"&&q?q:u(),oe=s?`#${S}`:`${n}${S}`,Oe=o&&history.state&&typeof history.state=="object"?xl(history.state):{},or=o?{...Oe,__bqScrollKey:Q}:{};history[T](or,"",oe),f=Q,w(),o&&T==="pushState"&&window.scrollTo(0,0);for(const Ze of a)Ze(re.value,L)}finally{Fn()}},k=async S=>{jn();try{const{pathname:T,search:P,hash:R}=y(),O=re.value,C=gt(T,P,R,l);if(C.matched?.redirectTo){await E(C.matched.redirectTo,"replaceState");return}if(C.matched?.beforeEnter&&await C.matched.beforeEnter(C,O)===!1){const L=new URLSearchParams(Object.entries(O.query).flatMap(([q,Q])=>Array.isArray(Q)?Q.map(oe=>[q,oe]):[[q,Q]])).toString(),M=L?`?${L}`:"",_=O.hash?`#${O.hash}`:"",U=s?`#${O.path}${M}${_}`:`${n}${O.path}${M}${_}`;history.replaceState(b(),"",U);return}for(const L of i)if(await L(C,O)===!1){const M=new URLSearchParams(Object.entries(O.query).flatMap(([Q,oe])=>Array.isArray(oe)?oe.map(Oe=>[Q,Oe]):[[Q,oe]])).toString(),_=M?`?${M}`:"",U=O.hash?`#${O.hash}`:"",q=s?`#${O.path}${_}${U}`:`${n}${O.path}${_}${U}`;history.replaceState(b(),"",q);return}h(f),f=S.state?.__bqScrollKey??p(),w(),v(f);for(const L of a)L(re.value,O)}finally{Fn()}};window.addEventListener("popstate",k),w();const A={push:S=>E(S,"pushState"),replace:S=>E(S,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:S=>history.go(S),beforeEach:S=>(i.push(S),()=>{const T=i.indexOf(S);T>-1&&i.splice(T,1)}),afterEach:S=>(a.push(S),()=>{const T=a.indexOf(S);T>-1&&a.splice(T,1)}),currentRoute:xn,routes:l,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",k),i.length=0,a.length=0,c.clear(),d!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=d),yl(),Un(null)}};return Un(A),A},ke=D(()=>re.value),Fl={route:ke,path:D(()=>ke.value.path),params:D(()=>ke.value.params),query:D(()=>ke.value.query),hash:D(()=>ke.value.hash),matched:D(()=>ke.value.matched)},Ul=()=>Fl,Bl=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},Wl=(e,t)=>{const r=Bl();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},Hl=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},Ql=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},ts=[],Vl=e=>{ts.push(e)},Kl=(e,t)=>{for(const r of ts){const n=r({store:e,options:t});n&&Object.assign(e,n)}},He=new Map,rs=e=>He.has(e),Yl=(e,t)=>{He.set(e,t)},Te=e=>He.get(e),Qt=()=>Array.from(He.keys()),Gl=e=>{He.delete(e),Hl(e)},ns=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,me=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(me);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,me(n)]));if(e instanceof Set)return new Set(Array.from(e).map(me));const t={};for(const r of Object.keys(e))t[r]=me(e[r]);return t},Ce=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e.entries())if(!t.has(s)||!Ce(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.values()){let o=!1;for(const i of t.values())if(Ce(s,i)){o=!0;break}if(!o)return!1}return!0}if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>Ce(s,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(s=>Ce(e[s],t[s]))},Jl=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const o=e[s],i=t[s];r.get(s)===i&&ns(o)&&ns(i)&&!Ce(o,i)&&n.push(s)}return n},Qe=()=>qt(),Vt=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if(rs(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),Te(t);const o=r(),i=new Map;for(const y of Object.keys(o))i.set(y,$(o[y]));const a=[],l=[],c=(y,w,E)=>{!Qe()||typeof console>"u"||typeof console.error!="function"||console.error(`[bQuery store "${t}"] Error in $onAction ${y} for action "${w}"`,E)},f=new WeakSet,m=(y,w)=>{!Qe()||typeof console>"u"||typeof console.warn!="function"||f.has(y)||(f.add(y),console.warn(`[bQuery store "${t}"] Async $onAction listener detected for action "${w}". If it awaits, register after()/onError() before the first await; late registrations will not affect the current action.`))},d=(y,w,E,k)=>{try{const A=E();Le(A)&&(y==="listener"&&k&&m(k,w),A.catch(S=>{c(y,w,S)}))}catch(A){c(y,w,A)}},p=()=>ue(()=>({...h})),u=()=>{const y=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(a.length===0&&!y)return;const w=p();for(const E of a)E(w);Ql(t,w)},h=new Proxy({},{get:(y,w)=>{const E=w;if(i.has(E))return i.get(E).value},ownKeys:()=>Array.from(i.keys()),getOwnPropertyDescriptor:(y,w)=>{if(i.has(w))return{enumerable:!0,configurable:!0}},has:(y,w)=>i.has(w)}),v=new Map,b={};for(const y of Object.keys(o))Object.defineProperty(b,y,{get:()=>i.get(y).value,set:w=>{i.get(y).value=w,u()},enumerable:!0,configurable:!1});for(const y of Object.keys(n)){const w=n[y],E=D(()=>w(h,new Proxy({},{get:(k,A)=>{const S=A;if(v.has(S))return v.get(S).value}})));v.set(y,E),Object.defineProperty(b,y,{get:()=>E.value,enumerable:!0,configurable:!1})}for(const y of Object.keys(s)){const w=s[y],E=y;b[E]=function(...k){const A=new Proxy(b,{get:(C,L)=>typeof L=="string"&&i.has(L)?i.get(L).value:C[L],set:(C,L,M)=>typeof L=="string"&&i.has(L)?(i.get(L).value=M,u(),!0):Reflect.set(C,L,M)});if(l.length===0)return w.apply(A,k);const S=[],T=[],P=[...l],R={name:E,store:b,args:k,after:C=>{S.push(L=>C(L))},onError:C=>{T.push(C)}};for(const C of P)d("listener",E,()=>C(R),C);let O;try{O=w.apply(A,k)}catch(C){for(const L of T)d("onError",E,()=>L(C));throw C}if(Le(O))return O.then(C=>{for(const L of S)d("after",E,()=>L(C));return C},C=>{for(const L of T)d("onError",E,()=>L(C));throw C});for(const C of S)d("after",E,()=>C(O));return O}}return Object.defineProperties(b,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const y=r();ce(()=>{for(const[w,E]of i)E.value=y[w]}),u()},writable:!1,enumerable:!1},$subscribe:{value:y=>(a.push(y),()=>{const w=a.indexOf(y);w>-1&&a.splice(w,1)}),writable:!1,enumerable:!1},$onAction:{value:y=>(l.push(y),()=>{const w=l.indexOf(y);w>-1&&l.splice(w,1)}),writable:!1,enumerable:!1},$patch:{value:y=>{ce(()=>{if(typeof y=="function"){const w=Qe(),E=w?me(p()):null,k=w?new Map(Array.from(i.entries()).map(([S,T])=>[S,T.value])):null,A=p();if(y(A),w&&E&&k){const S=Jl(E,A,k);S.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${S.map(String).join(", ")}.
171
255
  Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.
172
256
  To fix this, either:
173
257
  1. Replace the entire object: state.user = { ...state.user, name: "New" }
174
258
  2. Use $patchDeep() for automatic deep cloning
175
- See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,C]of Object.entries(A))i.has(S)&&(i.get(S).value=C)}else for(const[w,E]of Object.entries(v))i.has(w)&&(i.get(w).value=E)}),c()},writable:!1,enumerable:!1},$patchDeep:{value:v=>{Le(()=>{if(typeof v=="function"){const w=ce(p());v(w);for(const[E,L]of Object.entries(w))i.has(E)&&(i.get(E).value=L)}else for(const[w,E]of Object.entries(v))i.has(w)&&(i.get(w).value=ce(E))}),c()},writable:!1,enumerable:!1},$state:{get:()=>p(),enumerable:!1}}),za(t,b),ja(b,e),Ia(t,b),b},Ha=(e,t)=>()=>fn(e)?we(e):Ot({id:e,...t}),Ua=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Qa=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Va=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},Wa="__version",Ka={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},hn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},Ya=(e,t)=>{const r={...e};for(const[n,s]of Object.entries(t))x(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s);return r},Ga=()=>{try{return globalThis.localStorage}catch{return}},Ja=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??Ga(),o=r.serializer??Ka,i=r.version,a=r.migrate,l=n+Wa;let f=s!==void 0&&i!==void 0,u=!1,h=!1;const d=m=>{if(!s||i===void 0)return!1;try{return s.setItem(l,String(i)),!0}catch(g){return m&&je()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(m,g),!1}},p=e.state,c=Ot({...e,state:()=>{const m=p();if(!s)return m;try{const g=s.getItem(n);if(!g)return m;const b=o.deserialize(g);if(!hn(b))return m;let v=b;if(i!==void 0&&a){const w=s.getItem(l),E=w!==null?Number(w):0,L=Number.isFinite(E)?E:0;if(L!==i){f=!1,u=!0;const A=a(v,L);if(!hn(A))return m;v=A;let S=!1;try{s.setItem(n,o.serialize(v)),S=!0,h=!0}catch(C){je()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`,C)}S&&d(`[bQuery store "${e.id}"] Failed to persist migrated version:`)&&(u=!1)}else f=!1}return Ya(m,v)}catch{return m}}});return f&&s?d():u&&h&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(u=!1),c.$subscribe(m=>{if(s)try{s.setItem(n,o.serialize(m)),u&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after a successful state write:`)&&(u=!1)}catch{}}),c},Xa=(e,t,r,n={})=>{const s=n.equals??(n.deep?Ee:Object.is);let o=t(e.$state);return n.immediate&&r(o,void 0),e.$subscribe(i=>{const a=t(i);if(!s(a,o)){const l=o;o=a,r(a,l)}})},mn=500,pn=class{constructor(e){this.cache=new Map,this.maxSize=e}get(e){const t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}get size(){return this.cache.size}},vn=new pn(mn),yn=new pn(mn),Za=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return Ne(n)||gt(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),Q=(e,t)=>{try{const r=Za(t);let n=vn.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),vn.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},ot=(e,t)=>{try{let r=yn.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),yn.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},gn=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",o=0,i=null;for(let a=0;a<r.length;a++){const l=r[a];if(l==='"'||l==="'"||l==="`"){let f=0,u=a-1;for(;u>=0&&r[u]==="\\";)f++,u--;f%2===0&&(i===null?i=l:i===l&&(i=null)),s+=l;continue}if(i!==null){s+=l;continue}l==="("||l==="["||l==="{"?(o++,s+=l):l===")"||l==="]"||l==="}"?(o--,s+=l):l===","&&o===0?(n.push(s.trim()),s=""):s+=l}s.trim()&&n.push(s.trim());for(const a of n){let l=-1,f=0,u=null;for(let h=0;h<a.length;h++){const d=a[h];if(d==='"'||d==="'"||d==="`"){let p=0,c=h-1;for(;c>=0&&a[c]==="\\";)p++,c--;p%2===0&&(u===null?u=d:u===d&&(u=null));continue}if(u===null){if(d==="("||d==="["||d==="{")f++;else if(d===")"||d==="]"||d==="}")f--;else if(d===":"&&f===0){l=h;break}}}if(l>-1){const h=a.slice(0,l).trim().replace(/^['"]|['"]$/g,"");if(x(h))continue;t[h]=a.slice(l+1).trim()}}return t},el=e=>(t,r,n,s)=>{const o=j(()=>{const i=Q(r,n);i==null||i===!1?t.removeAttribute(e):i===!0?t.setAttribute(e,""):t.setAttribute(e,String(i))});s.push(o)},tl=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set;if(t.trimStart().startsWith("{")){const a=gn(t);for(const[l,f]of Object.entries(a)){const u=Q(f,r);e.classList.toggle(l,!!u),i.add(l)}}else if(/^\s*\[/.test(t)){const a=Q(t,r);if(Array.isArray(a))for(const l of a)l&&(e.classList.add(l),i.add(l))}else{const a=Q(t,r);typeof a=="string"?a.split(/\s+/).forEach(l=>{l&&(e.classList.add(l),i.add(l))}):Array.isArray(a)&&a.forEach(l=>{l&&(e.classList.add(l),i.add(l))})}for(const a of s)i.has(a)||e.classList.remove(a);s=i});n.push(o)},rl=(e,t,r,n,s,o)=>{if(!r)return t;const i={...o,[n]:e};return s&&(i[s]=t),Q(r,i)},nl=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,o,i,a)=>{const l=s.parentNode;if(!l)return;const f=o.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!f){console.error(`bQuery view: Invalid bq-for expression "${o}"`);return}const[,u,h,d]=f,p=s.getAttribute(":key")||s.getAttribute(`${t}-key`),c=s.cloneNode(!0);c.removeAttribute(`${t}-for`),c.removeAttribute(":key"),c.removeAttribute(`${t}-key`);const m=document.createComment(`bq-for: ${o}`);l.replaceChild(m,s);let g=new Map,b=[];const v=(A,S,C)=>{const R=c.cloneNode(!0),k=[],$=M(A),T=h?M(S):null,O={...i,[u]:$};return h&&T&&(O[h]=T),r(R,O,t,k),n(R,O,t,k),{key:C,element:R,cleanups:k,item:A,index:S,itemSignal:$,indexSignal:T}},w=A=>{for(const S of A.cleanups)S();A.element.remove()},E=(A,S,C)=>{Object.is(A.item,S)||(A.item=S,A.itemSignal.value=S),A.index!==C&&(A.index=C,A.indexSignal&&(A.indexSignal.value=C))},L=j(()=>{const A=Q(d,i);if(!Array.isArray(A)){for(const O of g.values())w(O);g.clear(),b=[];return}const S=[],C=new Map,R=new Set;A.forEach((O,D)=>{let I=rl(O,D,p,u,h,i);R.has(I)&&(console.warn(`bq-for: Duplicate key "${String(I)}" detected at index ${D}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),I={__bqDuplicateKey:I,__bqIndex:D}),R.add(I),S.push(I),C.set(I,{item:O,index:D})});const k=[];for(const O of b)C.has(O)||k.push(O);for(const O of k){const D=g.get(O);D&&(w(D),g.delete(O))}const $=new Map;let T=m;for(let O=0;O<S.length;O++){const D=S[O],{item:I,index:z}=C.get(D);let _=g.get(D);_?(E(_,I,z),$.set(D,_),T.nextSibling!==_.element&&T.after(_.element),T=_.element):(_=v(I,z,D),$.set(D,_),T.after(_.element),T=_.element)}g=$,b=S});a.push(()=>{L();for(const A of g.values())for(const S of A.cleanups)S();g.clear()})}},sl=e=>(t,r,n,s)=>{const o=j(()=>{const i=Q(r,n),a=String(i??"");t.innerHTML=e?J(a):a});s.push(o)},ol=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let o=!0;const i=j(()=>{const a=Q(t,r);a&&!o?(s.replaceWith(e),o=!0):!a&&o&&(e.replaceWith(s),o=!1)});n.push(i)},il=(e,t,r,n)=>{const s=e,o=ot(t,r);if(!Ne(o)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const i=o,a=s.type==="checkbox",l=s.type==="radio",f=()=>{a?s.checked=!!i.value:l?s.checked=i.value===s.value:s.value=String(i.value??"")},u=j(()=>{f()});n.push(u);const h=s.tagName==="SELECT"?"change":"input",d=()=>{a?i.value=s.checked:l?s.checked&&(i.value=s.value):i.value=s.value};s.addEventListener(h,d),n.push(()=>s.removeEventListener(h,d))},al=e=>(t,r,n,s)=>{const o=i=>{const a={...n,$event:i,$el:t};if(!r.includes("(")){const l=ot(r,a);if(typeof l=="function"){l(i);return}return}ot(r,a)};t.addEventListener(e,o),s.push(()=>t.removeEventListener(e,o))};function ll(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var cl=(e,t,r,n)=>{const s=ot(t,r);Ne(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&ll(s)&&(s.value=e,n.push(()=>{s.value=null}))},ul=(e,t,r,n)=>{const s=e;let o=s.style.display;if(!o||o==="none"){const a=s.ownerDocument.defaultView?.getComputedStyle(s).display??"";o=a!=="none"?a:""}const i=j(()=>{const a=Q(t,r);s.style.display=a?o:"none"});n.push(i)},fl=(e,t,r,n)=>{const s=e;let o=new Set;const i=j(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const l=gn(t);for(const[f,u]of Object.entries(l)){const h=Q(u,r),d=f.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(d,String(h??"")),a.add(d)}}else{const l=Q(t,r);if(l&&typeof l=="object")for(const[f,u]of Object.entries(l)){const h=f.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(h,String(u??"")),a.add(h)}}for(const l of o)a.has(l)||s.style.removeProperty(l);o=a});n.push(i)},dl=(e,t,r,n)=>{const s=j(()=>{const o=Q(t,r);e.textContent=String(o??"")});n.push(s)},Rt=null,hl=e=>{Rt=e},ml=e=>Rt?Rt(e):void 0,it=(e,t,r,n,s)=>{const o=Array.from(e.attributes);for(const i of o){const{name:a,value:l}=i;if(!a.startsWith(`${r}-`))continue;const f=a.slice(r.length+1);if(f==="for"){s.for(e,l,t,n);return}if(f==="text")s.text(e,l,t,n);else if(f==="html")s.html(e,l,t,n);else if(f==="if")s.if(e,l,t,n);else if(f==="show")s.show(e,l,t,n);else if(f==="class")s.class(e,l,t,n);else if(f==="style")s.style(e,l,t,n);else if(f==="model")s.model(e,l,t,n);else if(f==="ref")s.ref(e,l,t,n);else if(f.startsWith("bind:")){const u=f.slice(5);s.bind(u)(e,l,t,n)}else if(f.startsWith("on:")){const u=f.slice(3);s.on(u)(e,l,t,n)}else{const u=ml(f);u?u(e,l,t,n):bt()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery][view] Unknown directive "${a}" (parsed as "${f}") on <${e.tagName.toLowerCase()}>. This may be a typo or a missing custom directive registration.`)}}},Mt=(e,t,r,n,s)=>{const o=Array.from(e.children);for(const i of o)i.hasAttribute(`${r}-for`)?it(i,t,r,n,s):(it(i,t,r,n,s),Mt(i,t,r,n,s))},Dt=(e,t,r={})=>{const{prefix:n="bq",sanitize:s=!0}=r,o=typeof e=="string"?document.querySelector(e):e;if(!o)throw new Error(`bQuery view: Element "${e}" not found.`);if(o.hasAttribute(`${n}-for`))throw new Error(`bQuery view: Cannot mount on element with ${n}-for directive. Wrap the ${n}-for element in a container instead.`);const i=[],a={text:dl,html:sl(s),if:ol,show:ul,class:tl,style:fl,model:il,ref:cl,for:nl({prefix:n,processElement:(f,u,h,d)=>it(f,u,h,d,a),processChildren:(f,u,h,d)=>Mt(f,u,h,d,a)}),bind:el,on:al};return((f,u,h)=>{const d=f.hasAttribute(`${n}-for`);it(f,u,n,h,a),d||Mt(f,u,n,h,a)})(o,t,i),{el:o,context:t,update:f=>{Object.assign(t,f)},destroy:()=>{for(const f of i)f();i.length=0}}},pl=(e,t={})=>r=>{const n=document.createElement("div");n.innerHTML=e.trim();const s=n.firstElementChild;if(!s)throw new Error("bQuery view: Template must contain a single root element.");if(n.childElementCount>1)throw new Error(`bQuery view: Template must contain exactly one root element, found ${n.childElementCount}.`);const{prefix:o="bq"}=t;if(s.hasAttribute(`${o}-for`)||s.hasAttribute(`${o}-if`)){const i=s.hasAttribute(`${o}-for`)?"for":"if";throw new Error(`bQuery view: Template root element cannot have ${o}-${i} directive. Wrap the ${o}-${i} element in a container instead.`)}return Dt(s,r,t)},vl=e=>e===!0||e===void 0,yl=async(e,t)=>{const r=e(t),n=Ce(r)?await r:r;return vl(n)?void 0:n},gl=e=>{const t=e.initialValue,r=M(t),n=M(""),s=M(!1),o=P(()=>!Object.is(r.value,t));return{value:r,error:n,isDirty:o,isTouched:s,isPristine:P(()=>!o.value),touch:()=>{s.value=!0},reset:()=>{r.value=t,n.value="",s.value=!1}}},bn=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await yl(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},bl=e=>{const t=Object.entries(e.fields),r={},n={};for(const[c,m]of t){const g=gl(m);r[c]=g,n[c]=g.error}const s=M(!1),o=P(()=>{for(const c of Object.keys(r))if(r[c].error.value!=="")return!1;return!0}),i=P(()=>{for(const c of Object.keys(r))if(r[c].isDirty.value)return!0;return!1}),a=async c=>{const m=r[c],g=e.fields[c];!m||!g||await bn(m,g.validators)},l=async()=>{let c=!1;for(const[m,g]of t){const b=r[m];await bn(b,g.validators)&&(c=!0)}if(e.crossValidators&&e.crossValidators.length>0){const m=h();for(const g of e.crossValidators){const b=await g(m);if(b){for(const[v,w]of Object.entries(b))if(w){const E=r[v];E&&(E.error.value===""&&(E.error.value=w),c=!0)}}}}return!c},f=async()=>{if(!s.value){s.value=!0;try{if(!await l())return;e.onSubmit&&await e.onSubmit(h())}finally{s.value=!1}}},u=()=>{for(const c of Object.keys(r))r[c].reset()},h=()=>{const c={};for(const m of Object.keys(r))c[m]=r[m].value.value;return c};return{fields:r,errors:n,isValid:o,isDirty:i,isSubmitting:s,handleSubmit:f,validateField:a,validate:l,reset:u,getValues:h,setValues:c=>{for(const[m,g]of Object.entries(c)){if(x(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.value.value=g)}},setErrors:c=>{for(const[m,g]of Object.entries(c)){if(x(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.error.value=g??"")}}}},wl=e=>e===!0||e===void 0,El=async(e,t)=>{const r=e(t),n=Ce(r)?await r:r;return wl(n)?void 0:n},Sl=(e,t={})=>{let r;Al(e)?r=e:r=M(br(e)||Cl(e)?e.peek():e);const n=r.peek(),s=M(t.initialError??""),o=M(!1),i=M(!1),a=P(()=>!Object.is(r.value,n)),l=P(()=>!a.value),f=P(()=>s.value===""),u=t.validateOn??"manual",h=Math.max(0,t.debounceMs??0);let d=0,p=!1,c=!1,m=!1,g;const b=A=>{console.error("bQuery forms: Error in scheduled field validation",A)},v=async()=>{const A=++d,S=t.validators;if(!S||S.length===0)return s.value="",i.value=!1,!0;i.value=!0;try{const C=r.peek();for(const R of S){const k=await El(R,C);if(A!==d)return s.peek()==="";if(k)return s.value=k,!1}return A===d&&(s.value=""),!0}finally{A===d&&(i.value=!1)}},w=ar(()=>{v().catch(b)},h),E=()=>{if(!m){if(h>0){w();return}v().catch(b)}};return(u==="change"||u==="both")&&(g=j(()=>{if(r.value,!p){p=!0;return}if(c){c=!1;return}E()})),{value:r,error:s,isDirty:a,isTouched:o,isPristine:l,isValid:f,isValidating:i,touch:()=>{o.value=!0,(u==="blur"||u==="both")&&E()},reset:()=>{d+=1,w.cancel(),Object.is(r.peek(),n)||(c=!0),r.value=n,s.value=t.initialError??"",o.value=!1,i.value=!1},validate:async()=>(w.cancel(),v()),destroy:()=>{m||(m=!0,d+=1,w.cancel(),g?.(),g=void 0,a.dispose(),l.dispose(),f.dispose(),i.value=!1)}}},Al=e=>e instanceof De,Cl=e=>e instanceof Me,Tl=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,kl=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},Ll=(e,t)=>{const r=t??`Must be at most ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length<=e?!0:r},$l=(e,t="Invalid format")=>{const r=e.global||e.sticky?new RegExp(e.source,e.flags.replace(/[gy]/g,"")):e;return n=>{const s=typeof n=="string"?n:String(n??"");return r.lastIndex=0,r.test(s)?!0:t}},Ol=(e="Invalid email address")=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r=>{const n=typeof r=="string"?r:String(r??"");return n===""||t.test(n)?!0:e}},Rl=(e="Invalid URL")=>t=>{const r=typeof t=="string"?t:String(t??"");if(r==="")return!0;try{return new URL(r),!0}catch{return e}},Ml=(e,t)=>{const r=t??`Must be at least ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))>=e?!0:r},Dl=(e,t)=>{const r=t??`Must be at most ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))<=e?!0:r},Nl=(e,t)=>r=>e(r)?!0:t,Pl=(e,t)=>async r=>await e(r)?!0:t,Il=(e,t="Fields do not match")=>r=>Object.is(r,e.value)?!0:t,wn=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},En=(e,t,r)=>{const{locale:n,...s}=r??{},o=typeof e=="number"?new Date(e):e;try{return new Intl.DateTimeFormat(t,s).format(o)}catch{return o.toLocaleString()}},Sn=(e,t)=>{const r=t.split(".");let n=e;for(const s of r){if(typeof n=="string"||n[s]===void 0)return;n=n[s]}return typeof n=="string"?n:void 0},_l=(e,t)=>e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r),ql=(e,t)=>{if(!e.includes("|")||!("count"in t))return e;const r=Number(t.count),n=e.split("|").map(s=>s.trim());return n.length===3?r===0?n[0]:r===1?n[1]:n[2]:n.length===2?r===1?n[0]:n[1]:r===0&&n.length>0?n[0]:r===1&&n.length>1?n[1]:n[n.length-1]},An=(e,t,r,n)=>{let s;return e&&(s=Sn(e,t)),s===void 0&&n&&(s=Sn(n,t)),s===void 0?t:_l(ql(s,r),r)},Cn=(e,t)=>{const r=he(e,t),n=s=>{if(Array.isArray(s))return s.map(i=>n(i));if(!de(s))return s;const o=Object.create(null);for(const[i,a]of Object.entries(s))x(i)||(o[i]=n(a));return o};return n(r)},xl=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=v=>Cn(Object.create(null),v),o=Object.create(null);for(const[v,w]of Object.entries(r))x(v)||(o[v]=s(w));const i=M(t),a=new Map,l=new Set(Object.keys(o));return{$locale:i,t:(v,w={})=>{const E=o[i.value];return An(E,v,w,n?o[n]:void 0)},tc:(v,w={})=>P(()=>{const E=o[i.value];return An(E,v,w,n?o[n]:void 0)}),loadLocale:(v,w)=>{x(v)||a.set(v,w)},ensureLocale:async v=>{if(x(v)||l.has(v))return;const w=a.get(v);if(!w)throw new Error(`bQuery i18n: No messages or loader registered for locale "${v}".`);const E=await w();o[v]=s(E.default??E),l.add(v)},n:(v,w)=>wn(v,w?.locale??i.value,w),d:(v,w)=>En(v,w?.locale??i.value,w),getMessages:v=>{if(!x(v))return o[v]},mergeMessages:(v,w)=>{x(v)||(o[v]||(o[v]=Object.create(null),l.add(v)),o[v]=Cn(o[v],s(w)))},availableLocales:()=>{const v=new Set([...l,...a.keys()]);return Array.from(v).sort()}}},at=new Map,ze=new Map,jl=50,zl=e=>{const t=at.get(e);if(t&&t.isConnected)return t;const r=document.createElement("div");return r.setAttribute("aria-live",e),r.setAttribute("aria-atomic","true"),r.setAttribute("role",e==="assertive"?"alert":"status"),Object.assign(r.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),document.body.appendChild(r),at.set(e,r),r},Fl=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=zl(t),n=ze.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{ze.delete(t),r.isConnected&&(r.textContent=e)},jl);ze.set(t,s)},Bl=()=>{for(const e of ze.values())clearTimeout(e);ze.clear();for(const[,e]of at)e.remove();at.clear()},K=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),Hl=e=>{const t=[],r=e.querySelectorAll("img");for(const n of r)n.hasAttribute("alt")?n.getAttribute("alt")===""&&!n.hasAttribute("role")&&t.push(K("info",'Image has empty alt text. Consider adding role="presentation" if decorative.',n,"img-decorative")):t.push(K("error",'Image is missing an alt attribute. Add alt="" for decorative images or a descriptive alt text.',n,"img-alt"));return t},Ul=e=>{const t=[],r=e.querySelectorAll("input, select, textarea");for(const n of r){const s=n.getAttribute("type");if(s==="hidden"||s==="submit"||s==="button"||s==="reset")continue;const o=n.getAttribute("id"),i=o?!!e.querySelector(`label[for="${o}"]`):!1,a=n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby"),l=n.hasAttribute("title"),f=n.closest("label")!==null;!i&&!a&&!l&&!f&&t.push(K("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},Ql=e=>{const t=[],r=e.querySelectorAll("button");for(const s of r){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title");!o&&!i&&!a&&t.push(K("error","Button has no accessible name. Add text content, aria-label, or title.",s,"button-name"))}const n=e.querySelectorAll("a[href]");for(const s of n){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title"),l=s.querySelector("img[alt]")!==null;!o&&!i&&!a&&!l&&t.push(K("error","Link has no accessible name. Add text content, aria-label, or title.",s,"link-name"))}return t},Vl=e=>{const t=[],r=e.querySelectorAll("h1, h2, h3, h4, h5, h6");let n=0;for(const s of r){const o=parseInt(s.tagName.charAt(1),10);n>0&&o>n+1&&t.push(K("warning",`Heading level skipped: <${s.tagName.toLowerCase()}> follows <h${n}>. Don't skip heading levels.`,s,"heading-order")),(s.textContent??"").trim().length===0&&t.push(K("warning","Heading element is empty.",s,"heading-empty")),n=o}return t},Wl=e=>{const t=[],r=e.querySelectorAll("[aria-labelledby]");for(const s of r){const o=(s.getAttribute("aria-labelledby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(K("error",`aria-labelledby references "${i}" which does not exist in the document.`,s,"aria-labelledby-ref"))}const n=e.querySelectorAll("[aria-describedby]");for(const s of n){const o=(s.getAttribute("aria-describedby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(K("error",`aria-describedby references "${i}" which does not exist in the document.`,s,"aria-describedby-ref"))}return t},Kl=e=>{const t=[];return(e===document.body||e===document.documentElement)&&(e.querySelector("main")||e.querySelector('[role="main"]')||t.push(K("warning",'Page is missing a <main> landmark. Add <main> or role="main" to the primary content area.',e,"landmark-main"))),t},Yl=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...Hl(t),...Ul(t),...Ql(t),...Vl(t),...Wl(t),...Kl(t)],n=r.filter(s=>s.severity==="error").length;return{findings:r,errors:n,warnings:r.filter(s=>s.severity==="warning").length,passed:n===0}},Tn=(e,t)=>{if(typeof e.addEventListener=="function")return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)};const r=e;if(typeof r.addListener=="function")return r.addListener(t),()=>{r.removeListener?.(t)}},kn=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},Gl=()=>{const e=M("light");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function")try{const r=window.matchMedia("(prefers-color-scheme: dark)");e.value=r.matches?"dark":"light";const s=Tn(r,o=>{e.value=o.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return kn(U(e),t)},Jl=()=>{const e=M("no-preference");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function"){let r,n,s;const o=()=>{!r||!n||!s||(r.matches?e.value="more":n.matches?e.value="less":s.matches?e.value="custom":e.value="no-preference")};try{r=window.matchMedia("(prefers-contrast: more)"),n=window.matchMedia("(prefers-contrast: less)"),s=window.matchMedia("(prefers-contrast: custom)"),o();const i=[r,n,s].map(a=>Tn(a,()=>{o()})).filter(a=>a!==void 0);i.length>0&&(t=()=>{for(const a of i)a();e.dispose()})}catch{}}return kn(U(e),t)},Xl=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:o}=r;let i=0;const a=new Map,l=()=>Array.from(e.querySelectorAll(t)),f=c=>{for(const m of c)a.has(m)||a.set(m,m.getAttribute("tabindex"))},u=c=>{const m=l();if(m.length===0)return;f(m);const g=Math.max(0,Math.min(c,m.length-1));for(let b=0;b<m.length;b++)m[b].setAttribute("tabindex",b===g?"0":"-1");i=g,m[g].focus(),o?.(m[g],g)},h=c=>{if(c==="Home"||c==="End")return!0;switch(s){case"horizontal":return c==="ArrowLeft"||c==="ArrowRight";case"vertical":return c==="ArrowUp"||c==="ArrowDown";case"both":return c==="ArrowLeft"||c==="ArrowRight"||c==="ArrowUp"||c==="ArrowDown";default:return!1}},d=c=>{if(!h(c.key))return;const m=l();if(m.length===0)return;c.preventDefault();let g=i;switch(c.key){case"ArrowDown":case"ArrowRight":g=i+1,g>=m.length&&(g=n?0:m.length-1);break;case"ArrowUp":case"ArrowLeft":g=i-1,g<0&&(g=n?m.length-1:0);break;case"Home":g=0;break;case"End":g=m.length-1;break}u(g)},p=l();f(p);for(let c=0;c<p.length;c++)p[c].setAttribute("tabindex",c===0?"0":"-1");return e.addEventListener("keydown",d),{destroy:()=>{e.removeEventListener("keydown",d);for(const[c,m]of a)m===null?c.removeAttribute("tabindex"):c.setAttribute("tabindex",m);a.clear()},focusItem:c=>{u(c)},activeIndex:()=>i}},Nt=`
259
+ See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,T]of Object.entries(A))i.has(S)&&(i.get(S).value=T)}else for(const[w,E]of Object.entries(y))i.has(w)&&(i.get(w).value=E)}),u()},writable:!1,enumerable:!1},$patchDeep:{value:y=>{ce(()=>{if(typeof y=="function"){const w=me(p());y(w);for(const[E,k]of Object.entries(w))i.has(E)&&(i.get(E).value=k)}else for(const[w,E]of Object.entries(y))i.has(w)&&(i.get(w).value=me(E))}),u()},writable:!1,enumerable:!1},$state:{get:()=>p(),enumerable:!1}}),Yl(t,b),Kl(b,e),Wl(t,b),b},Xl=(e,t)=>()=>rs(e)?Te(e):Vt({id:e,...t}),Zl=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},ec=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},tc=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},rc="__version",nc={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},ss=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},sc=(e,t)=>{const r={...e};for(const[n,s]of Object.entries(t))x(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s);return r},oc=()=>{try{return globalThis.localStorage}catch{return}},ic=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??oc(),o=r.serializer??nc,i=r.version,a=r.migrate,l=n+rc;let c=s!==void 0&&i!==void 0,f=!1,m=!1;const d=h=>{if(!s||i===void 0)return!1;try{return s.setItem(l,String(i)),!0}catch(v){return h&&Qe()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(h,v),!1}},p=e.state,u=Vt({...e,state:()=>{const h=p();if(!s)return h;try{const v=s.getItem(n);if(!v)return h;const b=o.deserialize(v);if(!ss(b))return h;let y=b;if(i!==void 0&&a){const w=s.getItem(l),E=w!==null?Number(w):0,k=Number.isFinite(E)?E:0;if(k!==i){c=!1,f=!0;const A=a(y,k);if(!ss(A))return h;y=A;let S=!1;try{s.setItem(n,o.serialize(y)),S=!0,m=!0}catch(T){Qe()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`,T)}S&&d(`[bQuery store "${e.id}"] Failed to persist migrated version:`)&&(f=!1)}else c=!1}return sc(h,y)}catch{return h}}});return c&&s?d():f&&m&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(f=!1),u.$subscribe(h=>{if(s)try{s.setItem(n,o.serialize(h)),f&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after a successful state write:`)&&(f=!1)}catch{}}),u},ac=(e,t,r,n={})=>{const s=n.equals??(n.deep?Ce:Object.is);let o=t(e.$state);return n.immediate&&r(o,void 0),e.$subscribe(i=>{const a=t(i);if(!s(a,o)){const l=o;o=a,r(a,l)}})},os=500,is=class{constructor(e){this.cache=new Map,this.maxSize=e}get(e){const t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}get size(){return this.cache.size}},as=new is(os),ls=new is(os),lc=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return fe(n)||qe(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),H=(e,t)=>{try{const r=lc(t);let n=as.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),as.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},bt=(e,t)=>{try{let r=ls.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),ls.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Kt=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",o=0,i=null;for(let a=0;a<r.length;a++){const l=r[a];if(l==='"'||l==="'"||l==="`"){let c=0,f=a-1;for(;f>=0&&r[f]==="\\";)c++,f--;c%2===0&&(i===null?i=l:i===l&&(i=null)),s+=l;continue}if(i!==null){s+=l;continue}l==="("||l==="["||l==="{"?(o++,s+=l):l===")"||l==="]"||l==="}"?(o--,s+=l):l===","&&o===0?(n.push(s.trim()),s=""):s+=l}s.trim()&&n.push(s.trim());for(const a of n){let l=-1,c=0,f=null;for(let m=0;m<a.length;m++){const d=a[m];if(d==='"'||d==="'"||d==="`"){let p=0,u=m-1;for(;u>=0&&a[u]==="\\";)p++,u--;p%2===0&&(f===null?f=d:f===d&&(f=null));continue}if(f===null){if(d==="("||d==="["||d==="{")c++;else if(d===")"||d==="]"||d==="}")c--;else if(d===":"&&c===0){l=m;break}}}if(l>-1){const m=a.slice(0,l).trim().replace(/^['"]|['"]$/g,"");if(x(m))continue;t[m]=a.slice(l+1).trim()}}return t},cc=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),uc=e=>{const t=e.trim(),r=t.toLowerCase();return r.startsWith("aria-")?r:`aria-${cc(/^aria[A-Z]/.test(t)?t.slice(4):t).replace(/^-/,"")}`},fc=e=>e==null||e==="",dc=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set,a=Object.create(null);if(t.trimStart().startsWith("{")){const l=Kt(t);for(const[c,f]of Object.entries(l))a[c]=H(f,r)}else{const l=H(t,r);if(l&&typeof l=="object"&&!Array.isArray(l))for(const[c,f]of Object.entries(l))x(c)||(a[c]=f)}for(const[l,c]of Object.entries(a)){const f=uc(l);if(fc(c)){e.removeAttribute(f);continue}e.setAttribute(f,c===!0?"true":String(c)),i.add(f)}for(const l of s)i.has(l)||e.removeAttribute(l);s=i});n.push(o)},hc=e=>(t,r,n,s)=>{const o=j(()=>{const i=H(r,n);i==null||i===!1?t.removeAttribute(e):i===!0?t.setAttribute(e,""):t.setAttribute(e,String(i))});s.push(o)},mc=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set;if(t.trimStart().startsWith("{")){const a=Kt(t);for(const[l,c]of Object.entries(a)){const f=H(c,r);e.classList.toggle(l,!!f),i.add(l)}}else if(/^\s*\[/.test(t)){const a=H(t,r);if(Array.isArray(a))for(const l of a)l&&(e.classList.add(l),i.add(l))}else{const a=H(t,r);typeof a=="string"?a.split(/\s+/).forEach(l=>{l&&(e.classList.add(l),i.add(l))}):Array.isArray(a)&&a.forEach(l=>{l&&(e.classList.add(l),i.add(l))})}for(const a of s)i.has(a)||e.classList.remove(a);s=i});n.push(o)},pc=e=>{if(fe(e)||qe(e))return String(e.value??"");if(e&&typeof e=="object"&&"error"in e){const t=e.error;return fe(t)||qe(t)?String(t.value??""):String(t??"")}return String(e??"")},vc=(e,t,r,n)=>{const s=e,o=!s.hasAttribute("aria-hidden");s.hasAttribute("role")||s.setAttribute("role","alert"),s.hasAttribute("aria-live")||s.setAttribute("aria-live","assertive");const i=j(()=>{const a=pc(H(t,r)).trim(),l=a.length>0;s.textContent=a,s.hidden=!l,o&&(l?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden","true"))});n.push(i)},yc=(e,t,r,n,s,o)=>{if(!r)return t;const i={...o,[n]:e};return s&&(i[s]=t),H(r,i)},gc=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,o,i,a)=>{const l=s.parentNode;if(!l)return;const c=o.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!c){console.error(`bQuery view: Invalid bq-for expression "${o}"`);return}const[,f,m,d]=c,p=s.getAttribute(":key")||s.getAttribute(`${t}-key`),u=s.cloneNode(!0);u.removeAttribute(`${t}-for`),u.removeAttribute(":key"),u.removeAttribute(`${t}-key`);const h=document.createComment(`bq-for: ${o}`);l.replaceChild(h,s);let v=new Map,b=[];const y=(A,S,T)=>{const P=u.cloneNode(!0),R=[],O=$(A),C=m?$(S):null,L={...i,[f]:O};return m&&C&&(L[m]=C),r(P,L,t,R),n(P,L,t,R),{key:T,element:P,cleanups:R,item:A,index:S,itemSignal:O,indexSignal:C}},w=A=>{for(const S of A.cleanups)S();A.element.remove()},E=(A,S,T)=>{Object.is(A.item,S)||(A.item=S,A.itemSignal.value=S),A.index!==T&&(A.index=T,A.indexSignal&&(A.indexSignal.value=T))},k=j(()=>{const A=H(d,i);if(!Array.isArray(A)){for(const L of v.values())w(L);v.clear(),b=[];return}const S=[],T=new Map,P=new Set;A.forEach((L,M)=>{let _=yc(L,M,p,f,m,i);P.has(_)&&(console.warn(`bq-for: Duplicate key "${String(_)}" detected at index ${M}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),_={__bqDuplicateKey:_,__bqIndex:M}),P.add(_),S.push(_),T.set(_,{item:L,index:M})});const R=[];for(const L of b)T.has(L)||R.push(L);for(const L of R){const M=v.get(L);M&&(w(M),v.delete(L))}const O=new Map;let C=h;for(let L=0;L<S.length;L++){const M=S[L],{item:_,index:U}=T.get(M);let q=v.get(M);q?(E(q,_,U),O.set(M,q),C.nextSibling!==q.element&&C.after(q.element),C=q.element):(q=y(_,U,M),O.set(M,q),C.after(q.element),C=q.element)}v=O,b=S});a.push(()=>{k();for(const A of v.values())for(const S of A.cleanups)S();v.clear()})}},bc=e=>(t,r,n,s)=>{const o=j(()=>{const i=H(r,n),a=String(i??"");t.innerHTML=e?X(a):a});s.push(o)},wc=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let o=!0;const i=j(()=>{const a=H(t,r);a&&!o?(s.replaceWith(e),o=!0):!a&&o&&(e.replaceWith(s),o=!1)});n.push(i)},Ec=(e,t,r,n)=>{const s=e,o=bt(t,r);if(!fe(o)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const i=o,a=s.type==="checkbox",l=s.type==="radio",c=()=>{a?s.checked=!!i.value:l?s.checked=i.value===s.value:s.value=String(i.value??"")},f=j(()=>{c()});n.push(f);const m=s.tagName==="SELECT"?"change":"input",d=()=>{a?i.value=s.checked:l?s.checked&&(i.value=s.value):i.value=s.value};s.addEventListener(m,d),n.push(()=>s.removeEventListener(m,d))},Sc=e=>(t,r,n,s)=>{const o=i=>{const a={...n,$event:i,$el:t};if(!r.includes("(")){const l=bt(r,a);if(typeof l=="function"){l(i);return}return}bt(r,a)};t.addEventListener(e,o),s.push(()=>t.removeEventListener(e,o))};function Ac(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var kc=(e,t,r,n)=>{const s=bt(t,r);fe(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&Ac(s)&&(s.value=e,n.push(()=>{s.value=null}))},Tc=(e,t,r,n)=>{const s=e;let o=s.style.display;if(!o||o==="none"){const a=s.ownerDocument.defaultView?.getComputedStyle(s).display??"";o=a!=="none"?a:""}const i=j(()=>{const a=H(t,r);s.style.display=a?o:"none"});n.push(i)},Cc=(e,t,r,n)=>{const s=e;let o=new Set;const i=j(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const l=Kt(t);for(const[c,f]of Object.entries(l)){const m=H(f,r),d=c.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(d,String(m??"")),a.add(d)}}else{const l=H(t,r);if(l&&typeof l=="object")for(const[c,f]of Object.entries(l)){const m=c.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(m,String(f??"")),a.add(m)}}for(const l of o)a.has(l)||s.style.removeProperty(l);o=a});n.push(i)},Rc=(e,t,r,n)=>{const s=j(()=>{const o=H(t,r);e.textContent=String(o??"")});n.push(s)},Yt=null,Oc=e=>{Yt=e},Lc=e=>Yt?Yt(e):void 0,wt=(e,t,r,n,s)=>{const o=Array.from(e.attributes);for(const i of o){const{name:a,value:l}=i;if(!a.startsWith(`${r}-`))continue;const c=a.slice(r.length+1);if(c==="for"){s.for(e,l,t,n);return}if(c==="text")s.text(e,l,t,n);else if(c==="error")s.error(e,l,t,n);else if(c==="aria")s.aria(e,l,t,n);else if(c==="html")s.html(e,l,t,n);else if(c==="if")s.if(e,l,t,n);else if(c==="show")s.show(e,l,t,n);else if(c==="class")s.class(e,l,t,n);else if(c==="style")s.style(e,l,t,n);else if(c==="model")s.model(e,l,t,n);else if(c==="ref")s.ref(e,l,t,n);else if(c.startsWith("bind:")){const f=c.slice(5);s.bind(f)(e,l,t,n)}else if(c.startsWith("on:")){const f=c.slice(3);s.on(f)(e,l,t,n)}else{const f=Lc(c);f?f(e,l,t,n):qt()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery][view] Unknown directive "${a}" (parsed as "${c}") on <${e.tagName.toLowerCase()}>. This may be a typo or a missing custom directive registration.`)}}},Gt=(e,t,r,n,s)=>{const o=Array.from(e.children);for(const i of o)i.hasAttribute(`${r}-for`)?wt(i,t,r,n,s):(wt(i,t,r,n,s),Gt(i,t,r,n,s))},Jt=(e,t,r={})=>{const{prefix:n="bq",sanitize:s=!0}=r,o=typeof e=="string"?document.querySelector(e):e;if(!o)throw new Error(`bQuery view: Element "${e}" not found.`);if(o.hasAttribute(`${n}-for`))throw new Error(`bQuery view: Cannot mount on element with ${n}-for directive. Wrap the ${n}-for element in a container instead.`);const i=[],a={text:Rc,error:vc,aria:dc,html:bc(s),if:wc,show:Tc,class:mc,style:Cc,model:Ec,ref:kc,for:gc({prefix:n,processElement:(c,f,m,d)=>wt(c,f,m,d,a),processChildren:(c,f,m,d)=>Gt(c,f,m,d,a)}),bind:hc,on:Sc};return((c,f,m)=>{const d=c.hasAttribute(`${n}-for`);wt(c,f,n,m,a),d||Gt(c,f,n,m,a)})(o,t,i),{el:o,context:t,update:c=>{Object.assign(t,c)},destroy:()=>{for(const c of i)c();i.length=0}}},$c=(e,t={})=>r=>{const n=document.createElement("div");n.innerHTML=e.trim();const s=n.firstElementChild;if(!s)throw new Error("bQuery view: Template must contain a single root element.");if(n.childElementCount>1)throw new Error(`bQuery view: Template must contain exactly one root element, found ${n.childElementCount}.`);const{prefix:o="bq"}=t;if(s.hasAttribute(`${o}-for`)||s.hasAttribute(`${o}-if`)){const i=s.hasAttribute(`${o}-for`)?"for":"if";throw new Error(`bQuery view: Template root element cannot have ${o}-${i} directive. Wrap the ${o}-${i} element in a container instead.`)}return Jt(s,r,t)},Pc=e=>e===!0||e===void 0,Mc=async(e,t)=>{const r=e(t),n=Le(r)?await r:r;return Pc(n)?void 0:n},Nc=e=>{const t=e.initialValue,r=$(t),n=$(""),s=$(!1),o=D(()=>!Object.is(r.value,t));return{value:r,error:n,isDirty:o,isTouched:s,isPristine:D(()=>!o.value),touch:()=>{s.value=!0},reset:()=>{r.value=t,n.value="",s.value=!1}}},cs=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await Mc(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},Dc=e=>{const t=Object.entries(e.fields),r={},n={};for(const[u,h]of t){const v=Nc(h);r[u]=v,n[u]=v.error}const s=$(!1),o=D(()=>{for(const u of Object.keys(r))if(r[u].error.value!=="")return!1;return!0}),i=D(()=>{for(const u of Object.keys(r))if(r[u].isDirty.value)return!0;return!1}),a=async u=>{const h=r[u],v=e.fields[u];!h||!v||await cs(h,v.validators)},l=async()=>{let u=!1;for(const[h,v]of t){const b=r[h];await cs(b,v.validators)&&(u=!0)}if(e.crossValidators&&e.crossValidators.length>0){const h=m();for(const v of e.crossValidators){const b=await v(h);if(b){for(const[y,w]of Object.entries(b))if(w){const E=r[y];E&&(E.error.value===""&&(E.error.value=w),u=!0)}}}}return!u},c=async()=>{if(!s.value){s.value=!0;try{if(!await l())return;e.onSubmit&&await e.onSubmit(m())}finally{s.value=!1}}},f=()=>{for(const u of Object.keys(r))r[u].reset()},m=()=>{const u={};for(const h of Object.keys(r))u[h]=r[h].value.value;return u};return{fields:r,errors:n,isValid:o,isDirty:i,isSubmitting:s,handleSubmit:c,validateField:a,validate:l,reset:f,getValues:m,setValues:u=>{for(const[h,v]of Object.entries(u)){if(x(h)||!Object.prototype.hasOwnProperty.call(r,h))continue;const b=r[h];b&&(b.value.value=v)}},setErrors:u=>{for(const[h,v]of Object.entries(u)){if(x(h)||!Object.prototype.hasOwnProperty.call(r,h))continue;const b=r[h];b&&(b.error.value=v??"")}}}},Ic=e=>e===!0||e===void 0,_c=async(e,t)=>{const r=e(t),n=Le(r)?await r:r;return Ic(n)?void 0:n},qc=(e,t={})=>{let r;zc(e)?r=e:r=$(jr(e)||xc(e)?e.peek():e);const n=r.peek(),s=$(t.initialError??""),o=$(!1),i=$(!1),a=D(()=>!Object.is(r.value,n)),l=D(()=>!a.value),c=D(()=>s.value===""),f=t.validateOn??"manual",m=Math.max(0,t.debounceMs??0);let d=0,p=!1,u=!1,h=!1,v;const b=A=>{console.error("bQuery forms: Error in scheduled field validation",A)},y=async()=>{const A=++d,S=t.validators;if(!S||S.length===0)return s.value="",i.value=!1,!0;i.value=!0;try{const T=r.peek();for(const P of S){const R=await _c(P,T);if(A!==d)return s.peek()==="";if(R)return s.value=R,!1}return A===d&&(s.value=""),!0}finally{A===d&&(i.value=!1)}},w=Tt(()=>{y().catch(b)},m),E=()=>{if(!h){if(m>0){w();return}y().catch(b)}};return(f==="change"||f==="both")&&(v=j(()=>{if(r.value,!p){p=!0;return}if(u){u=!1;return}E()})),{value:r,error:s,isDirty:a,isTouched:o,isPristine:l,isValid:c,isValidating:i,touch:()=>{o.value=!0,(f==="blur"||f==="both")&&E()},reset:()=>{d+=1,w.cancel(),Object.is(r.peek(),n)||(u=!0),r.value=n,s.value=t.initialError??"",o.value=!1,i.value=!1},validate:async()=>(w.cancel(),y()),destroy:()=>{h||(h=!0,d+=1,w.cancel(),v?.(),v=void 0,a.dispose(),l.dispose(),c.dispose(),i.value=!1)}}},zc=e=>e instanceof _e,xc=e=>e instanceof Ie,jc=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,Fc=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},Uc=(e,t)=>{const r=t??`Must be at most ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length<=e?!0:r},Bc=(e,t="Invalid format")=>{const r=e.global||e.sticky?new RegExp(e.source,e.flags.replace(/[gy]/g,"")):e;return n=>{const s=typeof n=="string"?n:String(n??"");return r.lastIndex=0,r.test(s)?!0:t}},Wc=(e="Invalid email address")=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r=>{const n=typeof r=="string"?r:String(r??"");return n===""||t.test(n)?!0:e}},Hc=(e="Invalid URL")=>t=>{const r=typeof t=="string"?t:String(t??"");if(r==="")return!0;try{return new URL(r),!0}catch{return e}},Qc=(e,t)=>{const r=t??`Must be at least ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))>=e?!0:r},Vc=(e,t)=>{const r=t??`Must be at most ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))<=e?!0:r},Kc=(e,t)=>r=>e(r)?!0:t,Yc=(e,t)=>async r=>await e(r)?!0:t,Gc=(e,t="Fields do not match")=>r=>Object.is(r,e.value)?!0:t,us=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},fs=(e,t,r)=>{const{locale:n,...s}=r??{},o=typeof e=="number"?new Date(e):e;try{return new Intl.DateTimeFormat(t,s).format(o)}catch{return o.toLocaleString()}},ds=(e,t)=>{const r=t.split(".");let n=e;for(const s of r){if(typeof n=="string"||n[s]===void 0)return;n=n[s]}return typeof n=="string"?n:void 0},Jc=(e,t)=>e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r),Xc=(e,t)=>{if(!e.includes("|")||!("count"in t))return e;const r=Number(t.count),n=e.split("|").map(s=>s.trim());return n.length===3?r===0?n[0]:r===1?n[1]:n[2]:n.length===2?r===1?n[0]:n[1]:r===0&&n.length>0?n[0]:r===1&&n.length>1?n[1]:n[n.length-1]},hs=(e,t,r,n)=>{let s;return e&&(s=ds(e,t)),s===void 0&&n&&(s=ds(n,t)),s===void 0?t:Jc(Xc(s,r),r)},ms=(e,t)=>{const r=ge(e,t),n=s=>{if(Array.isArray(s))return s.map(i=>n(i));if(!ye(s))return s;const o=Object.create(null);for(const[i,a]of Object.entries(s))x(i)||(o[i]=n(a));return o};return n(r)},Zc=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=y=>ms(Object.create(null),y),o=Object.create(null);for(const[y,w]of Object.entries(r))x(y)||(o[y]=s(w));const i=$(t),a=new Map,l=new Set(Object.keys(o));return{$locale:i,t:(y,w={})=>{const E=o[i.value];return hs(E,y,w,n?o[n]:void 0)},tc:(y,w={})=>D(()=>{const E=o[i.value];return hs(E,y,w,n?o[n]:void 0)}),loadLocale:(y,w)=>{x(y)||a.set(y,w)},ensureLocale:async y=>{if(x(y)||l.has(y))return;const w=a.get(y);if(!w)throw new Error(`bQuery i18n: No messages or loader registered for locale "${y}".`);const E=await w();o[y]=s(E.default??E),l.add(y)},n:(y,w)=>us(y,w?.locale??i.value,w),d:(y,w)=>fs(y,w?.locale??i.value,w),getMessages:y=>{if(!x(y))return o[y]},mergeMessages:(y,w)=>{x(y)||(o[y]||(o[y]=Object.create(null),l.add(y)),o[y]=ms(o[y],s(w)))},availableLocales:()=>{const y=new Set([...l,...a.keys()]);return Array.from(y).sort()}}},Et=new Map,Ve=new Map,eu=50,tu=e=>{const t=Et.get(e);if(t&&t.isConnected)return t;const r=document.createElement("div");return r.setAttribute("aria-live",e),r.setAttribute("aria-atomic","true"),r.setAttribute("role",e==="assertive"?"alert":"status"),Object.assign(r.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),document.body.appendChild(r),Et.set(e,r),r},ru=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=tu(t),n=Ve.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{Ve.delete(t),r.isConnected&&(r.textContent=e)},eu);Ve.set(t,s)},nu=()=>{for(const e of Ve.values())clearTimeout(e);Ve.clear();for(const[,e]of Et)e.remove();Et.clear()},Y=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),su=e=>{const t=[],r=e.querySelectorAll("img");for(const n of r)n.hasAttribute("alt")?n.getAttribute("alt")===""&&!n.hasAttribute("role")&&t.push(Y("info",'Image has empty alt text. Consider adding role="presentation" if decorative.',n,"img-decorative")):t.push(Y("error",'Image is missing an alt attribute. Add alt="" for decorative images or a descriptive alt text.',n,"img-alt"));return t},ou=e=>{const t=[],r=e.querySelectorAll("input, select, textarea");for(const n of r){const s=n.getAttribute("type");if(s==="hidden"||s==="submit"||s==="button"||s==="reset")continue;const o=n.getAttribute("id"),i=o?!!e.querySelector(`label[for="${o}"]`):!1,a=n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby"),l=n.hasAttribute("title"),c=n.closest("label")!==null;!i&&!a&&!l&&!c&&t.push(Y("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},iu=e=>{const t=[],r=e.querySelectorAll("button");for(const s of r){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title");!o&&!i&&!a&&t.push(Y("error","Button has no accessible name. Add text content, aria-label, or title.",s,"button-name"))}const n=e.querySelectorAll("a[href]");for(const s of n){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title"),l=s.querySelector("img[alt]")!==null;!o&&!i&&!a&&!l&&t.push(Y("error","Link has no accessible name. Add text content, aria-label, or title.",s,"link-name"))}return t},au=e=>{const t=[],r=e.querySelectorAll("h1, h2, h3, h4, h5, h6");let n=0;for(const s of r){const o=parseInt(s.tagName.charAt(1),10);n>0&&o>n+1&&t.push(Y("warning",`Heading level skipped: <${s.tagName.toLowerCase()}> follows <h${n}>. Don't skip heading levels.`,s,"heading-order")),(s.textContent??"").trim().length===0&&t.push(Y("warning","Heading element is empty.",s,"heading-empty")),n=o}return t},lu=e=>{const t=[],r=e.querySelectorAll("[aria-labelledby]");for(const s of r){const o=(s.getAttribute("aria-labelledby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(Y("error",`aria-labelledby references "${i}" which does not exist in the document.`,s,"aria-labelledby-ref"))}const n=e.querySelectorAll("[aria-describedby]");for(const s of n){const o=(s.getAttribute("aria-describedby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(Y("error",`aria-describedby references "${i}" which does not exist in the document.`,s,"aria-describedby-ref"))}return t},cu=e=>{const t=[];return(e===document.body||e===document.documentElement)&&(e.querySelector("main")||e.querySelector('[role="main"]')||t.push(Y("warning",'Page is missing a <main> landmark. Add <main> or role="main" to the primary content area.',e,"landmark-main"))),t},uu=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...su(t),...ou(t),...iu(t),...au(t),...lu(t),...cu(t)],n=r.filter(s=>s.severity==="error").length;return{findings:r,errors:n,warnings:r.filter(s=>s.severity==="warning").length,passed:n===0}},ps=(e,t)=>{if(typeof e.addEventListener=="function")return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)};const r=e;if(typeof r.addListener=="function")return r.addListener(t),()=>{r.removeListener?.(t)}},vs=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},fu=()=>{const e=$("light");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function")try{const r=window.matchMedia("(prefers-color-scheme: dark)");e.value=r.matches?"dark":"light";const s=ps(r,o=>{e.value=o.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return vs(I(e),t)},du=()=>{const e=$("no-preference");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function"){let r,n,s;const o=()=>{!r||!n||!s||(r.matches?e.value="more":n.matches?e.value="less":s.matches?e.value="custom":e.value="no-preference")};try{r=window.matchMedia("(prefers-contrast: more)"),n=window.matchMedia("(prefers-contrast: less)"),s=window.matchMedia("(prefers-contrast: custom)"),o();const i=[r,n,s].map(a=>ps(a,()=>{o()})).filter(a=>a!==void 0);i.length>0&&(t=()=>{for(const a of i)a();e.dispose()})}catch{}}return vs(I(e),t)},hu=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:o}=r;let i=0;const a=new Map,l=()=>Array.from(e.querySelectorAll(t)),c=u=>{for(const h of u)a.has(h)||a.set(h,h.getAttribute("tabindex"))},f=u=>{const h=l();if(h.length===0)return;c(h);const v=Math.max(0,Math.min(u,h.length-1));for(let b=0;b<h.length;b++)h[b].setAttribute("tabindex",b===v?"0":"-1");i=v,h[v].focus(),o?.(h[v],v)},m=u=>{if(u==="Home"||u==="End")return!0;switch(s){case"horizontal":return u==="ArrowLeft"||u==="ArrowRight";case"vertical":return u==="ArrowUp"||u==="ArrowDown";case"both":return u==="ArrowLeft"||u==="ArrowRight"||u==="ArrowUp"||u==="ArrowDown";default:return!1}},d=u=>{if(!m(u.key))return;const h=l();if(h.length===0)return;u.preventDefault();let v=i;switch(u.key){case"ArrowDown":case"ArrowRight":v=i+1,v>=h.length&&(v=n?0:h.length-1);break;case"ArrowUp":case"ArrowLeft":v=i-1,v<0&&(v=n?h.length-1:0);break;case"Home":v=0;break;case"End":v=h.length-1;break}f(v)},p=l();c(p);for(let u=0;u<p.length;u++)p[u].setAttribute("tabindex",u===0?"0":"-1");return e.addEventListener("keydown",d),{destroy:()=>{e.removeEventListener("keydown",d);for(const[u,h]of a)h===null?u.removeAttribute("tabindex"):u.setAttribute("tabindex",h);a.clear()},focusItem:u=>{f(u)},activeIndex:()=>i}},Xt=`
176
260
  position: absolute;
177
261
  top: -9999px;
178
262
  left: -9999px;
@@ -185,9 +269,9 @@ See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,C]of Object.en
185
269
  border-radius: 0 0 4px 0;
186
270
  outline: 2px solid #4A90D9;
187
271
  outline-offset: 2px;
188
- `,Zl=`
272
+ `,mu=`
189
273
  top: 0;
190
274
  left: 0;
191
- `,Ln=0,Se=new Map,ec=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,tc=()=>({destroy:()=>{},element:null}),rc=(e,t={})=>{if(!ec())return tc();const{text:r="Skip to main content",className:n="bq-skip-link"}=t;let s,o;const i=m=>{try{return document.querySelector(m)}catch{return null}},a=()=>{if(!s)return;const m=Se.get(s),g=(m?.count??0)-1;g<=0?(Se.delete(s),m?.target.isConnected&&m.target.id===s&&m.target.removeAttribute("id")):Se.set(s,{count:g,target:m.target}),s=void 0},l=()=>{if(!o)return;const{target:m,hadTabIndex:g,previousTabIndex:b}=o;m.isConnected&&(g?m.setAttribute("tabindex",b??""):m.removeAttribute("tabindex")),o=void 0},f=m=>{if(o?.target!==m){if(l(),m.hasAttribute("tabindex")){o={target:m,hadTabIndex:!0,previousTabIndex:m.getAttribute("tabindex")};return}m.tabIndex===-1&&(o={target:m,hadTabIndex:!1,previousTabIndex:null},m.setAttribute("tabindex","-1"))}},u=(m,g)=>{if(s===g)return;a();const b=Se.get(g);Se.set(g,{count:(b?.count??0)+1,target:m}),s=g},h=()=>{if(e.startsWith("#")){const g=e.slice(1),b=g?document.getElementById(g):null;return b||i(e)}const m=document.getElementById(e);return m||i(e)},d=m=>{if(m.id)return Se.get(m.id)?.target===m&&u(m,m.id),m.id;let g;do Ln+=1,g=`bq-skip-target-${Ln}`;while(document.getElementById(g)!==null);return m.id=g,u(m,g),g},p=document.createElement("a"),c=h();return p.href=e.startsWith("#")?e:c?`#${d(c)}`:`#${e}`,p.textContent=r,p.className=n,p.setAttribute("style",Nt),p.addEventListener("focus",()=>{p.setAttribute("style",Nt+Zl)}),p.addEventListener("blur",()=>{p.setAttribute("style",Nt)}),p.addEventListener("click",m=>{m.preventDefault();const g=h();g&&(p.href=`#${d(g)}`,f(g),g.focus())}),document.body.firstChild?document.body.insertBefore(p,document.body.firstChild):document.body.appendChild(p),{destroy:()=>{l(),a(),p.remove()},element:p}},nc=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"details > summary","audio[controls]","video[controls]"].join(", "),Pt=e=>Array.from(e.querySelectorAll(nc)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),$n=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,sc=(e,t={})=>{const{escapeDeactivates:r=!0,onEscape:n,initialFocus:s,returnFocus:o}=t;if(typeof document>"u"||typeof document.addEventListener!="function"||typeof document.removeEventListener!="function"){let h=!1;return{get active(){return h},release:()=>{h=!1}}}const i=document.activeElement;let a=!0;const l=h=>{if(!a)return;if(h.key==="Escape"&&r){h.preventDefault(),u.release(),n?.();return}if(h.key!=="Tab")return;const d=Pt(e);if(d.length===0){h.preventDefault();return}const p=d[0],c=d[d.length-1];h.shiftKey?(document.activeElement===p||!e.contains(document.activeElement))&&(h.preventDefault(),c.focus()):(document.activeElement===c||!e.contains(document.activeElement))&&(h.preventDefault(),p.focus())};document.addEventListener("keydown",l,!0);const f=$n(s,e);if(f)f.focus();else{const h=Pt(e);h.length>0&&h[0].focus()}const u={get active(){return a},release:()=>{if(!a)return;a=!1,document.removeEventListener("keydown",l,!0);const h=$n(o,document.body);h?h.focus():i&&i.focus&&i.focus()}};return u},oc=e=>{e.release()},Fe=new Map,On=()=>{const e=Array.from(Fe.values());return e[e.length-1]},ic=(e,t)=>{if(typeof t=="object")return t;let r=null;if(t==="parent"?r=e.parentElement:r=document.querySelector(t),!r)return null;const n=r.getBoundingClientRect(),s=e.getBoundingClientRect(),o=parseFloat(e.style.left||"0"),i=parseFloat(e.style.top||"0"),a=Number.isNaN(o)?0:o,l=Number.isNaN(i)?0:i;return{left:n.left-s.left+a,top:n.top-s.top+l,right:n.right-s.right+a+(n.width-s.width),bottom:n.bottom-s.bottom+l+(n.height-s.height)}},ac=(e,t)=>t?{x:Math.max(t.left,Math.min(t.right,e.x)),y:Math.max(t.top,Math.min(t.bottom,e.y))}:e,lc=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:o=!1,ghostClass:i="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:l,onDrag:f,onDragEnd:u}=t;let h=!t.disabled,d=!1,p={x:0,y:0},c={x:0,y:0},m={x:0,y:0},g=null,b=null;const v=e.style.touchAction,w=e.style.userSelect,E=k=>({element:e,position:{...c},delta:{x:c.x-m.x,y:c.y-m.y},event:k}),L=()=>{const k=e.cloneNode(!0),$=e.getBoundingClientRect();return k.classList.add(i),k.style.position="fixed",k.style.left=`${$.left}px`,k.style.top=`${$.top}px`,k.style.width=`${$.width}px`,k.style.height=`${$.height}px`,k.style.pointerEvents="none",k.style.zIndex="999999",k.style.opacity="0.7",k.style.margin="0",document.body.appendChild(k),k},A=()=>{g&&(g.remove(),g=null),b=null},S=k=>{if(h&&!(s&&!k.target.closest(s))){if(k.preventDefault(),d=!0,p={x:k.clientX,y:k.clientY},m={...c},e.classList.add(a),e.setPointerCapture(k.pointerId),o){const $=e.getBoundingClientRect();b={x:$.left,y:$.top},g=L()}Fe.set(e,{element:e,position:c}),l?.(E(k))}},C=k=>{if(!d)return;k.preventDefault(),m={...c};let $=c.x+(k.clientX-p.x),T=c.y+(k.clientY-p.y);p={x:k.clientX,y:k.clientY},r==="x"&&(T=c.y),r==="y"&&($=c.x);let O={x:$,y:T};if(n){const D=ic(e,n);O=ac(O,D)}if(c=O,Fe.set(e,{element:e,position:c}),o&&g){const D=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};g.style.left=`${D.x+c.x}px`,g.style.top=`${D.y+c.y}px`}else e.style.transform=`translate(${c.x}px, ${c.y}px)`;f?.(E(k))},R=k=>{if(d){d=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(k.pointerId))&&e.releasePointerCapture(k.pointerId)}catch{}finally{A(),Fe.delete(e),u?.(E(k))}}};return e.addEventListener("pointerdown",S),e.addEventListener("pointermove",C),e.addEventListener("pointerup",R),e.addEventListener("pointercancel",R),e.style.touchAction="none",e.style.userSelect="none",{destroy:()=>{e.removeEventListener("pointerdown",S),e.removeEventListener("pointermove",C),e.removeEventListener("pointerup",R),e.removeEventListener("pointercancel",R),A(),Fe.delete(e),e.style.touchAction=v,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{h=!1},enable:()=>{h=!0},get enabled(){return h}}},cc={passive:!0},Be=new Set,He=null,re=null,Rn=()=>Array.from(Be),uc=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",fc=e=>{for(const t of Rn())t.handlePointerMove(e)},dc=()=>{re=null;const e=He;He=null,e&&fc(e)},Mn=e=>{He=e,re===null&&(re=requestAnimationFrame(dc))},Dn=e=>{re!==null&&(cancelAnimationFrame(re),re=null,He=null);for(const t of Rn())t.handlePointerUp(e)},hc=e=>{Be.size===0&&(document.addEventListener("pointermove",Mn,cc),document.addEventListener("pointerup",Dn)),Be.add(e)},mc=e=>{Be.delete(e),Be.size===0&&(document.removeEventListener("pointermove",Mn),document.removeEventListener("pointerup",Dn),re!==null&&(cancelAnimationFrame(re),re=null),He=null)},Nn=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,pc=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:o,onDragLeave:i,onDrop:a}=t;if(!uc())return{destroy:()=>{}};let l=!1,f=null;const u=(b,v)=>({zone:e,dragged:b,event:v}),h=b=>{const v=e.getBoundingClientRect();return b.clientX>=v.left&&b.clientX<=v.right&&b.clientY>=v.top&&b.clientY<=v.bottom},d=()=>On()?.element??f,p=(b,v=f)=>{l&&(l=!1,e.classList.remove(r),v&&i?.(u(v,b)),f=null)},g={handlePointerMove:b=>{const v=On()?.element??null,w=h(b);if(!(v!==null&&v!==e&&Nn(v,n))||!w){p(b,v??f);return}l?o?.(u(v,b)):(l=!0,f=v,e.classList.add(r),s?.(u(v,b)))},handlePointerUp:b=>{const v=d(),w=h(b),E=v!==null&&v!==e&&Nn(v,n);w&&E&&v&&a?.(u(v,b)),l&&(l=!1,e.classList.remove(r)),f=null}};return hc(g),{destroy:()=>{mc(g),e.classList.remove(r),f=null}}},Pn=(e,t)=>Array.from(e.querySelectorAll(t)),vc=(e,t,r,n)=>{let s=null;for(let o=0;o<e.length;o++){const i=e[o];if(i===n)continue;const a=i.getBoundingClientRect(),l=t-(r==="y"?a.top+a.height/2:a.left+a.width/2);(s===null||l<0&&l>s.distance||s.distance>=0&&l<0&&Math.abs(l)<Math.abs(s.distance))&&l<0&&(s={element:i,index:o,distance:l})}return s?{element:s.element,index:s.index}:null},yc=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:o="bq-sort-placeholder",sortingClass:i="bq-sorting",animationDuration:a=200,onSortStart:l,onSortMove:f,onSortEnd:u}=t;let h=!t.disabled,d=!1,p=null,c=null,m=-1,g=0,b=0,v=0,w=0;const E=(R,k,$)=>({container:e,item:R,oldIndex:k,newIndex:$}),L=R=>{if(!h)return;const k=R.target,$=Pn(e,r);let T=null;for(const D of $)if(D.contains(k)){T=D;break}if(!T||s&&!k.closest(s))return;R.preventDefault(),d=!0,p=T,m=$.indexOf(T),g=R.clientY,b=R.clientX;const O=T.getBoundingClientRect();v=O.top,w=O.left,c=document.createElement("div"),c.classList.add(o),c.style.width=`${O.width}px`,c.style.height=`${O.height}px`,c.style.boxSizing="border-box",T.classList.add(i),T.style.position="fixed",T.style.width=`${O.width}px`,T.style.height=`${O.height}px`,T.style.left=`${O.left}px`,T.style.top=`${O.top}px`,T.style.zIndex="999999",T.style.pointerEvents="none",T.style.margin="0",T.parentNode?.insertBefore(c,T),e.setPointerCapture(R.pointerId),l?.(E(T,m,m))},A=R=>{if(!d||!p||!c)return;R.preventDefault();const k=R.clientX-b,$=R.clientY-g;n==="y"?p.style.top=`${v+$}px`:p.style.left=`${w+k}px`;const T=vc(Pn(e,r),n==="y"?R.clientY:R.clientX,n,p);T?e.insertBefore(c,T.element):e.appendChild(c);const O=Array.from(e.children).indexOf(c);f?.(E(p,m,O))},S=R=>{if(!d||!p||!c)return;d=!1;const k=p,$=Array.from(e.children).indexOf(c),T=c.getBoundingClientRect(),O=k.getBoundingClientRect();if(a>0){const D=T.left-O.left,I=T.top-O.top;k.style.transition=`transform ${a}ms ease`,k.style.transform=`translate(${D}px, ${I}px)`;let z=!1,_=null;const H=()=>{z||(z=!0,_!==null&&(window.clearTimeout(_),_=null),C(),u?.(E(k,m,$)))};_=window.setTimeout(()=>{H()},a+50),k.addEventListener("transitionend",H,{once:!0})}else C(),u?.(E(k,m,$));e.releasePointerCapture(R.pointerId)},C=()=>{!p||!c||(c.parentNode?.insertBefore(p,c),c.remove(),c=null,p.classList.remove(i),p.style.position="",p.style.width="",p.style.height="",p.style.left="",p.style.top="",p.style.zIndex="",p.style.pointerEvents="",p.style.margin="",p.style.transition="",p.style.transform="",p=null)};return e.addEventListener("pointerdown",L),e.addEventListener("pointermove",A),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",L),e.removeEventListener("pointermove",A),e.removeEventListener("pointerup",S),e.removeEventListener("pointercancel",S),e.style.touchAction="",d&&C()},disable:()=>{h=!1},enable:()=>{h=!0},get enabled(){return h}}},gc=e=>{const t=M(!1);let r;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const o=window.matchMedia(e);t.value=o.matches;const i=a=>{t.value=a.matches};if(typeof o.addEventListener=="function")o.addEventListener("change",i),r=()=>{o.removeEventListener("change",i)};else if(typeof o.addListener=="function"){const a=o;a.addListener(i),r=()=>{a.removeListener(i)}}}catch{}const n=U(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},bc=e=>{const t={},r=[];for(const o of Object.keys(e)){const i=e[o],a=M(!1);let l;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const h=window.matchMedia(`(min-width: ${i}px)`);a.value=h.matches;const d=p=>{a.value=p.matches};if(typeof h.addEventListener=="function")h.addEventListener("change",d),l=()=>{h.removeEventListener("change",d)};else{const p=h;typeof p.addListener=="function"&&(p.addListener(d),l=()=>{p.removeListener?.(d)})}}catch{}const f=U(a);let u=!1;Object.defineProperty(f,"destroy",{enumerable:!1,configurable:!0,value(){u||(u=!0,l?.(),a.dispose())}}),r.push(f.destroy),t[o]=f}let n=!1;const s=Object.defineProperty(t,"destroyAll",{enumerable:!1,configurable:!0,value(){n||(n=!0,r.forEach(o=>{o()}))}});return Object.prototype.hasOwnProperty.call(t,"destroy")||Object.defineProperty(s,"destroy",{enumerable:!1,configurable:!0,value:s.destroyAll}),s},In=(e,t)=>t>=e?"portrait":"landscape",wc=()=>{const e=M({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?In(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:In(window.innerWidth,window.innerHeight)}};window.addEventListener("resize",s),t=()=>{window.removeEventListener("resize",s)}}const r=U(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value:()=>{n||(n=!0,t?.(),e.dispose())}}),r},_n=()=>{const e=typeof navigator<"u"&&navigator.onLine!==void 0?navigator.onLine:!0,t=(typeof navigator<"u"?navigator:void 0)?.connection;return{online:e,effectiveType:t?.effectiveType??"unknown",downlink:t?.downlink??0,rtt:t?.rtt??0}},Ec=()=>{const e=M(_n());let t;if(typeof window<"u"){const s=()=>{e.value=_n()};window.addEventListener("online",s),window.addEventListener("offline",s);const o=typeof navigator<"u"?navigator:void 0;o?.connection&&typeof o.connection.addEventListener=="function"&&o.connection.addEventListener("change",s),t=()=>{window.removeEventListener("online",s),window.removeEventListener("offline",s),o?.connection&&typeof o.connection.removeEventListener=="function"&&o.connection.removeEventListener("change",s)}}const r=U(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},Sc={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},Ac=()=>{const e=M({...Sc});let t,r=!1;typeof navigator<"u"&&"getBattery"in navigator&&typeof navigator.getBattery=="function"&&navigator.getBattery().then(s=>{if(r)return;const o=()=>{e.value={supported:!0,charging:s.charging,chargingTime:s.chargingTime,dischargingTime:s.dischargingTime,level:s.level}};o(),s.addEventListener("chargingchange",o),s.addEventListener("chargingtimechange",o),s.addEventListener("dischargingtimechange",o),s.addEventListener("levelchange",o),t=()=>{s.removeEventListener("chargingchange",o),s.removeEventListener("chargingtimechange",o),s.removeEventListener("dischargingtimechange",o),s.removeEventListener("levelchange",o)}}).catch(()=>{});const n=U(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},qn={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},Cc=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,o=M({...qn});let i;if(typeof navigator<"u"&&"geolocation"in navigator){o.value={...qn,supported:!0,loading:!0};const f={enableHighAccuracy:t,maximumAge:r,timeout:n===1/0?void 0:n},u=d=>{o.value={supported:!0,loading:!1,latitude:d.coords.latitude,longitude:d.coords.longitude,accuracy:d.coords.accuracy,altitude:d.coords.altitude,altitudeAccuracy:d.coords.altitudeAccuracy,heading:d.coords.heading,speed:d.coords.speed,timestamp:d.timestamp,error:null}},h=d=>{o.value={...o.value,loading:!1,error:d.message}};if(s){const d=navigator.geolocation.watchPosition(u,h,f);i=()=>{navigator.geolocation.clearWatch(d)}}else navigator.geolocation.getCurrentPosition(u,h,f)}const a=U(o);let l=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){l||(l=!0,i?.(),o.dispose())}}),a},Tc={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},kc={alpha:null,beta:null,gamma:null,absolute:!1},Lc=()=>{const e=M({...Tc});let t;if(typeof window<"u"){const s=o=>{e.value={acceleration:{x:o.acceleration?.x??null,y:o.acceleration?.y??null,z:o.acceleration?.z??null},accelerationIncludingGravity:{x:o.accelerationIncludingGravity?.x??null,y:o.accelerationIncludingGravity?.y??null,z:o.accelerationIncludingGravity?.z??null},rotationRate:{alpha:o.rotationRate?.alpha??null,beta:o.rotationRate?.beta??null,gamma:o.rotationRate?.gamma??null},interval:o.interval??0}};window.addEventListener("devicemotion",s),t=()=>{window.removeEventListener("devicemotion",s)}}const r=U(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},$c=()=>{const e=M({...kc});let t;if(typeof window<"u"){const s=o=>{e.value={alpha:o.alpha??null,beta:o.beta??null,gamma:o.gamma??null,absolute:o.absolute??!1}};window.addEventListener("deviceorientation",s),t=()=>{window.removeEventListener("deviceorientation",s)}}const r=U(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},xn="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",Oc={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(xn);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(xn);return navigator.clipboard.writeText(e)}},Ue=new Set,ne=new Map,It=()=>{hl(e=>ne.get(e))};It();var jn=e=>{ne.clear();for(const[t,r]of e)ne.set(t,r)},Rc=e=>({directive(t,r){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin directive: name must be a non-empty string");if(t.startsWith("bq-")){const n=t.slice(3);throw new Error(`bQuery plugin directive: name "${t}" must be provided without the "bq-" prefix`+(n?` (use "${n}")`:""))}if(typeof r!="function")throw new Error(`bQuery plugin directive: handler for "${t}" must be a function`);if(ne.has(t))throw new Error(`bQuery plugin directive: a directive named "${t}" is already registered`);ne.set(t,r)},component(t,r,n){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin component: tagName must be a non-empty string");if(!t.includes("-"))throw new Error(`bQuery plugin component: tagName "${t}" must be a valid custom element name containing a hyphen`);if(typeof r!="function")throw new Error(`bQuery plugin component: constructor for "${t}" must be a function`);if(typeof customElements>"u"){typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery] plugin component "${t}" was not registered because customElements is not available in this environment.`);return}!customElements.get(t)&&!e.some(s=>s.tagName===t)&&e.push({tagName:t,constructor:r,options:n})}}),Mc=(e,t)=>{if(It(),!e||typeof e!="object")throw new Error("bQuery plugin: use() expects a plugin object with { name, install }");if(typeof e.name!="string"||e.name.length===0)throw new Error('bQuery plugin: plugin must have a non-empty "name" property');if(typeof e.install!="function")throw new Error(`bQuery plugin: plugin "${e.name}" must have an "install" function`);if(Ue.has(e.name))return;const r=[],n=Rc(r),s=new Map(ne);try{e.install(n,t)}catch(o){throw jn(s),o}try{for(const o of r)customElements.get(o.tagName)||customElements.define(o.tagName,o.constructor,o.options)}catch(o){throw jn(s),o}Ue.add(e.name)},Dc=e=>Ue.has(e),Nc=()=>[...Ue],Pc=e=>ne.get(e),Ic=()=>[...ne.entries()].map(([e,t])=>({name:e,handler:t})),_c=()=>{Ue.clear(),ne.clear(),It()},Qe=!1,_t={},ue=[],lt=new Map,zn=0,qc=(e,t)=>{Qe=e,_t=t??{},e||(ue.length=0,lt.clear(),zn=0)},xc=()=>Qe,jc=(e,t,r)=>{if(Qe){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");lt.set(e,{peek:t,subscriberCount:r})}},zc=e=>{lt.delete(e)},Fc=()=>`signal_${zn++}`,Fn=()=>{const e=[];for(const[t,r]of lt)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},Bn=()=>{try{return $t().map(e=>{const t=we(e),r={};if(t&&typeof t=="object"&&"$state"in t){const n=t.$state;n&&typeof n=="object"&&Object.assign(r,n)}return{id:e,state:r}})}catch{return[]}},Hn=()=>{if(typeof document>"u")return[];const e=[],t=new Set,r=document.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n].tagName.toLowerCase();if(s.includes("-")&&!t.has(s)&&typeof customElements<"u"&&customElements.get(s)){t.add(s);const o=document.querySelectorAll(s);e.push({tagName:s,instanceCount:o.length})}}return e},Bc=(e,t)=>{if(!Qe)return;const r={timestamp:Date.now(),type:e,detail:t};ue.push(r),_t.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},Hc=()=>ue,Uc=()=>{ue.length=0},Qc=()=>({enabled:Qe,options:{..._t},timeline:[...ue]}),Vc=()=>{const e=Fn();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},Wc=()=>{const e=Bn();if(e.length===0){console.log("[bq:devtools] No stores registered.");return}console.table(e.map(t=>({id:t.id,state:JSON.stringify(t.state)})))},Kc=()=>{const e=Hn();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},Yc=e=>{const t=typeof e=="number"&&e>0?ue.slice(-e):ue;if(t.length===0){console.log("[bq:devtools] Timeline is empty.");return}console.table(t.map(r=>({time:new Date(r.timestamp).toISOString(),type:r.type,detail:r.detail})))},Un=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),Gc=(e,t)=>{let r=1,n="",s=t+1;for(;s<e.length;){const o=e[s];if(o==="\\"&&s+1<e.length){n+=o+e[s+1],s+=2;continue}if(o==="(")r++;else if(o===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=o,s++}return null},Qn=new Map,Jc=e=>{const t=Lt(e),r=Qn.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return Qn.set(t,n),n};function Xc(e,t={}){if(!e||!e.includes("-"))throw new Error(`bQuery testing: "${e}" is not a valid custom element tag name (must contain a hyphen)`);const{props:r,slots:n,container:s=document.body}=t,o=document.createElement(e);if(r)for(const[a,l]of Object.entries(r))l!=null&&o.setAttribute(a,String(l));if(n)if(typeof n=="string")o.innerHTML=n;else{const a=[];for(const[l,f]of Object.entries(n))if(l==="default")a.push(f);else{const u=l.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");a.push(`<div slot="${u}">${f}</div>`)}o.innerHTML=a.join("")}return s.appendChild(o),{el:o,unmount:()=>{o.parentNode&&o.parentNode.removeChild(o)}}}function Vn(){Le(()=>{})}function Zc(e){const t=M(e);return Object.defineProperty(t,"initialValue",{value:e,writable:!1,enumerable:!0}),t.set=function(r){t.value=r},t.reset=function(){t.value=e},t}function eu(e,t){let r=e;t&&r.startsWith(t)&&(r=r.slice(t.length)||"/");let n="";const s=r.indexOf("#");s>=0&&(n=r.slice(s+1),r=r.slice(0,s));const o={},i=r.indexOf("?");if(i>=0){const a=r.slice(i+1);r=r.slice(0,i);for(const l of a.split("&")){const f=l.indexOf("="),u=f>=0?decodeURIComponent(l.slice(0,f)):decodeURIComponent(l),h=f>=0?decodeURIComponent(l.slice(f+1)):"",d=o[u];d!==void 0?Array.isArray(d)?d.push(h):o[u]=[d,h]:o[u]=h}}return{path:r||"/",query:o,hash:n}}function tu(e,t){for(const r of t){const n=ru(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function ru(e,t){if(e==="*")return{};const r=new Map,n=(o,i)=>{const a=o.indexOf("/",i);return a===-1?o.length:a},s=(o,i)=>{const a=`${o}:${i}`;if(r.has(a))return r.get(a)??null;if(o===e.length){const u=i===t.length?{}:null;return r.set(a,u),u}const l=e[o];if(l==="*"){for(let u=t.length;u>=i;u--){const h=s(o+1,u);if(h)return r.set(a,h),h}return r.set(a,null),null}if(l===":"&&Un(e[o+1])){let u=o+2;for(;u<e.length&&Un(e[u]);)u++;const h=e.slice(o+1,u);let d=u,p,c=!1;if(e[u]==="("){const g=Gc(e,u);g&&(p=g.constraint,d=g.endIndex)}e[d]==="*"&&(c=!0,d++);const m=c||p?t.length:n(t,i);for(let g=m;g>i;g--){const b=t.slice(i,g);if(p&&!Jc(p).test(b))continue;const v=s(d,g);if(v){const w={[h]:b,...v};return r.set(a,w),w}}return r.set(a,null),null}if(i>=t.length||l!==t[i])return r.set(a,null),null;const f=s(o+1,i+1);return r.set(a,f),f};return s(0,0)}function nu(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=i=>{const{path:a,query:l,hash:f}=eu(i,r),{matched:u,params:h}=tu(a,t);return{path:a,params:h,query:l,matched:u,hash:f}},o=M(s(n));return{push(i){o.value=s(i)},replace(i){o.value=s(i)},get currentRoute(){return o},get routes(){return t},destroy(){o.dispose()}}}function su(e,t,r={}){if(!e)throw new Error("bQuery testing: fireEvent requires a valid element");if(!t)throw new Error("bQuery testing: fireEvent requires an event name");const{bubbles:n=!0,cancelable:s=!0,composed:o=!0,detail:i}=r;let a;i!==void 0?a=new CustomEvent(t,{bubbles:n,cancelable:s,composed:o,detail:i}):a=new Event(t,{bubbles:n,cancelable:s,composed:o});const l=e.dispatchEvent(a);return Vn(),l}async function ou(e,t={}){if(typeof e!="function")throw new Error("bQuery testing: waitFor requires a predicate function");const{timeout:r=1e3,interval:n=10}=t,s=Date.now();for(;;){try{if(await e())return}catch{}if(Date.now()-s>=r)throw new Error(`bQuery testing: waitFor timed out after ${r}ms — predicate never returned true`);await new Promise(o=>setTimeout(o,n))}}var iu=(e,t,r={})=>{const{hydrate:n=!0,...s}=r;if(!n)throw new Error("bQuery ssr: hydrateMount() requires { hydrate: true } when options are provided.");return Dt(e,t,s)},ct=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),qt=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},Wn=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),au=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Kn=(e={})=>{const{scriptId:t="__BQUERY_STORE_STATE__",globalKey:r="__BQUERY_INITIAL_STATE__",storeIds:n,serialize:s=JSON.stringify}=e;if(x(r))throw new Error(`serializeStoreState: invalid globalKey "${r}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`serializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);const o=n??$t(),i=Object.create(null);for(const u of o){if(x(u))continue;const h=we(u);h&&(i[u]=qt(h.$state))}const a=s(i);if(typeof a!="string")throw new Error("serializeStoreState: custom serialize function must return a string.");if(s!==JSON.stringify){let u;try{u=JSON.parse(a)}catch{throw new Error("serializeStoreState: custom serialize function returned invalid JSON.")}if(!ct(u))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const l=Wn(a),f=Wn(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${au(t)}">window[${f}]=${l}<\/script>`}},lu=(e="__BQUERY_INITIAL_STATE__",t="__BQUERY_STORE_STATE__")=>{if(x(e))throw new Error(`deserializeStoreState: invalid globalKey "${e}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`deserializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);if(typeof window>"u")return{};const r=window[e];if(!r)return{};try{delete window[e]}catch{window[e]=void 0}if(typeof document<"u"&&typeof document.getElementById=="function"){const s=document.getElementById(t);s&&s.remove()}if(!ct(r))return{};for(const s of Object.values(r))if(!ct(s))return{};const n=Object.create(null);for(const[s,o]of Object.entries(r))x(s)||!ct(o)||(n[s]=qt(o));return n},Yn=(e,t)=>{const r=we(e);r&&typeof r.$patch=="function"&&r.$patch(qt(t))},cu=e=>{for(const[t,r]of Object.entries(e))Yn(t,r)},uu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Gn=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),fu=e=>Gn(e).replace(/"/g,"&quot;"),du=e=>{const t=e.toLowerCase();return t==="href"||t==="src"||t==="xlink:href"||t==="formaction"||t==="action"||t==="poster"||t==="background"||t==="cite"||t==="data"},hu=e=>e.trim().replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),mu=e=>{const t=hu(e);return Qt.some(r=>t.startsWith(r))},Jn=e=>{if(e.nodeType===Node.TEXT_NODE)return Gn(e.textContent??"");if(e.nodeType!==Node.ELEMENT_NODE)return"";const t=e,r=t.tagName.toLowerCase();if(r==="script")return"";let n="";for(const o of t.attributes){const i=o.name.toLowerCase();i.startsWith("on")||du(i)&&mu(o.value)||(n+=` ${o.name}="${fu(o.value)}"`)}if(uu.has(r))return`<${r}${n}>`;let s="";for(const o of t.childNodes)s+=Jn(o);return`<${r}${n}>${s}</${r}>`},Xn=e=>Ne(e)||gt(e)?e.value:e,Y=(e,t)=>{const r=e.trim();if(r.startsWith("!"))return!Y(r.slice(1).trim(),t);if(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);if(/^-?\d+(\.\d+)?$/.test(r))return Number(r);if(r==="true")return!0;if(r==="false")return!1;if(r==="null")return null;if(r!=="undefined"){if(/^[\w$]+(?:\.[\w$]+)*$/.test(r)){const n=r.split(".");let s=t;for(const o of n){if(s==null)return;s===t?s=Xn(s[o]):s=s[o]}return s}try{const n=Object.keys(t),s=n.map(o=>Xn(t[o]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},pu=e=>{const t=e.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);return t?{itemName:t[1],indexName:t[2]||void 0,listExpr:t[3].trim()}:null},xt=(e,t,r,n)=>{const s=e.getAttribute(`${r}-if`);if(s!==null&&!Y(s,t))return!1;const o=e.getAttribute(`${r}-show`);if(o!==null&&!Y(o,t)){const d=e;d.style?d.style.display="none":e.setAttribute("style","display: none;")}const i=e.getAttribute(`${r}-text`);if(i!==null){const d=Y(i,t);e.textContent=String(d??"")}const a=e.getAttribute(`${r}-html`);if(a!==null){const d=Y(a,t);e.innerHTML=String(J(String(d??"")))}const l=e.getAttribute(`${r}-class`);if(l!==null){const d=l.trim();if(d.startsWith("{")){const p=d.slice(1,-1).trim().split(",");for(const c of p){const m=c.indexOf(":");if(m>-1){const g=c.slice(0,m).trim().replace(/^['"]|['"]$/g,"");Y(c.slice(m+1).trim(),t)&&e.classList.add(g)}}}else{const p=Y(l,t);typeof p=="string"?p.split(/\s+/).filter(Boolean).forEach(c=>e.classList.add(c)):Array.isArray(p)&&p.filter(Boolean).forEach(c=>e.classList.add(c))}}const f=e.getAttribute(`${r}-style`);if(f!==null){const d=Y(f,t);if(d&&typeof d=="object"){const p=e;for(const[c,m]of Object.entries(d)){const g=c.replace(/([A-Z])/g,"-$1").toLowerCase();p.style.setProperty(g,String(m))}}}const u=Array.from(e.attributes);for(const d of u)if(d.name.startsWith(`${r}-bind:`)){const p=d.name.slice(`${r}-bind:`.length),c=Y(d.value,t);c===!1||c===null||c===void 0?e.removeAttribute(p):c===!0?e.setAttribute(p,""):e.setAttribute(p,String(c))}const h=e.getAttribute(`${r}-for`);if(h!==null){const d=pu(h);if(d){const p=Y(d.listExpr,t);if(Array.isArray(p)&&e.parentNode){const c=e.parentNode;for(let m=0;m<p.length;m++){const g=p[m],b=e.cloneNode(!0);b.removeAttribute(`${r}-for`),b.removeAttribute(":key"),b.removeAttribute(`${r}-key`);const v={...t,[d.itemName]:g};d.indexName&&(v[d.indexName]=m),xt(b,v,r,n),jt(b,v,r,n),c.insertBefore(b,e)}return c.removeChild(e),!0}}}return!0},jt=(e,t,r,n)=>{const s=Array.from(e.children);for(const o of s){if(o.hasAttribute(`${r}-for`)){xt(o,t,r,n)||o.remove();continue}if(!xt(o,t,r,n)){o.remove();continue}jt(o,t,r,n)}},Zn=(e,t)=>{const r=Array.from(e.attributes);for(const n of r)(n.name.startsWith(`${t}-`)||n.name.startsWith(":")||n.name===":key")&&e.removeAttribute(n.name);for(const n of Array.from(e.children))Zn(n,t)},vu=(e,t,r={})=>{const{prefix:n="bq",stripDirectives:s=!1,includeStoreState:o=!1}=r;if(!e||typeof e!="string")throw new Error("bQuery SSR: template must be a non-empty string.");if(typeof DOMParser>"u")throw new Error("bQuery SSR: DOMParser is not available in this environment. Provide a DOMParser-compatible implementation before calling renderToString().");const i=new DOMParser().parseFromString(e.trim(),"text/html"),a=i.body||i.documentElement;if(!a)throw new Error("bQuery SSR: Failed to parse template.");if(jt(a,t,n,i),s)for(const u of Array.from(a.children))Zn(u,n);let l="";for(const u of a.childNodes)l+=Jn(u);let f;return o&&(f=Kn({storeIds:Array.isArray(o)?o:void 0}).stateJson),{html:l,storeState:f}};return y.$=ks,y.$$=Ls,y.BQueryCollection=Je,y.BQueryElement=me,y.BqLinkElement=Jr,y.Computed=Me,y.HttpError=oe,y.Signal=De,y.animate=rt,y.announceToScreenReader=Fl,y.auditA11y=Yl,y.back=ca,y.batch=Le,y.bool=wi,y.breakpoints=bc,y.buckets=Qi,y.cache=Wi,y.capturePosition=Ct,y.clearAnnouncements=Bl,y.clearTimeline=Uc,y.clipboard=Oc,y.component=ve,y.computed=P,y.createForm=bl,y.createHttp=vt,y.createI18n=xl,y.createPersistedStore=Ja,y.createRequestQueue=Ko,y.createRestClient=ri,y.createRouter=Ma,y.createStore=Ot,y.createTemplate=pl,y.createTrustedHtml=gs,y.createUseFetch=Po,y.currentRoute=Wr,y.custom=Nl,y.customAsync=Pl,y.deduplicateRequest=si,y.defineBqueryConfig=uo,y.defineComponent=vi,y.definePageMeta=ra,y.defineStore=Ha,y.deserializeStoreState=lu,y.destroyStore=Fa,y.draggable=lc,y.droppable=pc,y.easeInCubic=Ir,y.easeInOutCubic=qr,y.easeInOutQuad=Pr,y.easeInQuad=Dr,y.easeOutBack=xr,y.easeOutCubic=_r,y.easeOutExpo=jr,y.easeOutQuad=Nr,y.easingPresets=Li,y.effect=j,y.effectScope=po,y.email=Ol,y.enableDevtools=qc,y.escapeHtml=er,y.fireEvent=su,y.flip=Tt,y.flipElements=zr,y.flipList=$i,y.flushEffects=Vn,y.formatDate=En,y.formatNumber=wn,y.forward=ua,y.generateNonce=ps,y.generateSignalLabel=Fc,y.getBqueryConfig=X,y.getCurrentScope=vo,y.getCustomDirective=Pc,y.getCustomDirectives=Ic,y.getDevtoolsState=Qc,y.getFocusableElements=Pt,y.getInstalledPlugins=Nc,y.getStore=we,y.getTimeline=Hc,y.getTrustedTypesPolicy=Zt,y.hasCSPDirective=vs,y.html=ye,y.http=Wo,y.hydrateMount=iu,y.hydrateStore=Yn,y.hydrateStores=cu,y.inspectComponents=Hn,y.inspectSignals=Fn,y.inspectStores=Bn,y.interceptLinks=va,y.isActive=La,y.isActiveSignal=$a,y.isComputed=gt,y.isDevtoolsEnabled=xc,y.isInstalled=Dc,y.isNavigating=aa,y.isSignal=Ne,y.isTrustedTypesSupported=ys,y.keyframePresets=Oi,y.linear=Mr,y.link=pa,y.linkedSignal=Yo,y.listStores=$t,y.logComponents=Kc,y.logSignals=Vc,y.logStores=Wc,y.logTimeline=Yc,y.mapActions=Va,y.mapGetters=Qa,y.mapState=Ua,y.matchField=Il,y.max=Dl,y.maxLength=Ll,y.mediaQuery=gc,y.min=Ml,y.minLength=kl,y.mockRouter=nu,y.mockSignal=Zc,y.morphElement=Ri,y.mount=Dt,y.navigate=_e,y.notifications=Zi,y.onScopeDispose=yo,y.parallax=Mi,y.pattern=$l,y.persistedSignal=Xo,y.prefersColorScheme=Gl,y.prefersContrast=Jl,y.prefersReducedMotion=Z,y.readonly=U,y.recordEvent=Bc,y.registerBqLink=ma,y.registerDefaultComponents=Ti,y.registerPlugin=xa,y.releaseFocus=oc,y.renderComponent=Xc,y.renderToString=vu,y.required=Tl,y.resetPlugins=_c,y.resolve=ka,y.rovingTabIndex=Xl,y.safeHtml=Ei,y.sanitize=J,y.sanitizeHtml=J,y.scrollAnimate=Ni,y.sequence=zi,y.serializeStoreState=Kn,y.setReducedMotion=ki,y.signal=M,y.skipLink=rc,y.sortable=yc,y.spring=Ii,y.springPresets=_i,y.stagger=qi,y.storage=ia,y.stripTags=bs,y.timeline=Fi,y.toValue=oi,y.trackSignal=jc,y.transition=Bi,y.trapFocus=sc,y.trusted=ds,y.typewriter=Hi,y.untrack=ae,y.untrackSignal=zc,y.url=Rl,y.use=Mc,y.useAnnouncer=ta,y.useAsyncData=hr,y.useBattery=Ac,y.useComputed=di,y.useCookie=Xi,y.useDeviceMotion=Lc,y.useDeviceOrientation=$c,y.useEffect=hi,y.useEventSource=ci,y.useFetch=W,y.useFormField=Sl,y.useGeolocation=Cc,y.useInfiniteFetch=Jo,y.useNetworkStatus=Ec,y.usePaginatedFetch=Go,y.usePolling=Zo,y.useResource=ei,y.useResourceList=ni,y.useRoute=Na,y.useSignal=fi,y.useSubmit=ti,y.useViewport=wc,y.useWebSocket=Sr,y.useWebSocketChannel=li,y.utils=oo,y.waitFor=ou,y.watch=ii,y.watchStore=Xa,y})({});
275
+ `,ys=0,Re=new Map,pu=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,vu=()=>({destroy:()=>{},element:null}),yu=(e,t={})=>{if(!pu())return vu();const{text:r="Skip to main content",className:n="bq-skip-link"}=t;let s,o;const i=h=>{try{return document.querySelector(h)}catch{return null}},a=()=>{if(!s)return;const h=Re.get(s),v=(h?.count??0)-1;v<=0?(Re.delete(s),h?.target.isConnected&&h.target.id===s&&h.target.removeAttribute("id")):Re.set(s,{count:v,target:h.target}),s=void 0},l=()=>{if(!o)return;const{target:h,hadTabIndex:v,previousTabIndex:b}=o;h.isConnected&&(v?h.setAttribute("tabindex",b??""):h.removeAttribute("tabindex")),o=void 0},c=h=>{if(o?.target!==h){if(l(),h.hasAttribute("tabindex")){o={target:h,hadTabIndex:!0,previousTabIndex:h.getAttribute("tabindex")};return}h.tabIndex===-1&&(o={target:h,hadTabIndex:!1,previousTabIndex:null},h.setAttribute("tabindex","-1"))}},f=(h,v)=>{if(s===v)return;a();const b=Re.get(v);Re.set(v,{count:(b?.count??0)+1,target:h}),s=v},m=()=>{if(e.startsWith("#")){const v=e.slice(1),b=v?document.getElementById(v):null;return b||i(e)}const h=document.getElementById(e);return h||i(e)},d=h=>{if(h.id)return Re.get(h.id)?.target===h&&f(h,h.id),h.id;let v;do ys+=1,v=`bq-skip-target-${ys}`;while(document.getElementById(v)!==null);return h.id=v,f(h,v),v},p=document.createElement("a"),u=m();return p.href=e.startsWith("#")?e:u?`#${d(u)}`:`#${e}`,p.textContent=r,p.className=n,p.setAttribute("style",Xt),p.addEventListener("focus",()=>{p.setAttribute("style",Xt+mu)}),p.addEventListener("blur",()=>{p.setAttribute("style",Xt)}),p.addEventListener("click",h=>{h.preventDefault();const v=m();v&&(p.href=`#${d(v)}`,c(v),v.focus())}),document.body.firstChild?document.body.insertBefore(p,document.body.firstChild):document.body.appendChild(p),{destroy:()=>{l(),a(),p.remove()},element:p}},gu=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"details > summary","audio[controls]","video[controls]"].join(", "),Zt=e=>Array.from(e.querySelectorAll(gu)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),gs=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,bu=(e,t={})=>{const{escapeDeactivates:r=!0,onEscape:n,initialFocus:s,returnFocus:o}=t;if(typeof document>"u"||typeof document.addEventListener!="function"||typeof document.removeEventListener!="function"){let m=!1;return{get active(){return m},release:()=>{m=!1}}}const i=document.activeElement;let a=!0;const l=m=>{if(!a)return;if(m.key==="Escape"&&r){m.preventDefault(),f.release(),n?.();return}if(m.key!=="Tab")return;const d=Zt(e);if(d.length===0){m.preventDefault();return}const p=d[0],u=d[d.length-1];m.shiftKey?(document.activeElement===p||!e.contains(document.activeElement))&&(m.preventDefault(),u.focus()):(document.activeElement===u||!e.contains(document.activeElement))&&(m.preventDefault(),p.focus())};document.addEventListener("keydown",l,!0);const c=gs(s,e);if(c)c.focus();else{const m=Zt(e);m.length>0&&m[0].focus()}const f={get active(){return a},release:()=>{if(!a)return;a=!1,document.removeEventListener("keydown",l,!0);const m=gs(o,document.body);m?m.focus():i&&i.focus&&i.focus()}};return f},wu=e=>{e.release()},Ke=new Map,bs=()=>{const e=Array.from(Ke.values());return e[e.length-1]},Eu=(e,t)=>{if(typeof t=="object")return t;let r=null;if(t==="parent"?r=e.parentElement:r=document.querySelector(t),!r)return null;const n=r.getBoundingClientRect(),s=e.getBoundingClientRect(),o=parseFloat(e.style.left||"0"),i=parseFloat(e.style.top||"0"),a=Number.isNaN(o)?0:o,l=Number.isNaN(i)?0:i;return{left:n.left-s.left+a,top:n.top-s.top+l,right:n.right-s.right+a+(n.width-s.width),bottom:n.bottom-s.bottom+l+(n.height-s.height)}},Su=(e,t)=>t?{x:Math.max(t.left,Math.min(t.right,e.x)),y:Math.max(t.top,Math.min(t.bottom,e.y))}:e,Au=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:o=!1,ghostClass:i="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:l,onDrag:c,onDragEnd:f}=t;let m=!t.disabled,d=!1,p={x:0,y:0},u={x:0,y:0},h={x:0,y:0},v=null,b=null;const y=e.style.touchAction,w=e.style.userSelect,E=R=>({element:e,position:{...u},delta:{x:u.x-h.x,y:u.y-h.y},event:R}),k=()=>{const R=e.cloneNode(!0),O=e.getBoundingClientRect();return R.classList.add(i),R.style.position="fixed",R.style.left=`${O.left}px`,R.style.top=`${O.top}px`,R.style.width=`${O.width}px`,R.style.height=`${O.height}px`,R.style.pointerEvents="none",R.style.zIndex="999999",R.style.opacity="0.7",R.style.margin="0",document.body.appendChild(R),R},A=()=>{v&&(v.remove(),v=null),b=null},S=R=>{if(m&&!(s&&!R.target.closest(s))){if(R.preventDefault(),d=!0,p={x:R.clientX,y:R.clientY},h={...u},e.classList.add(a),e.setPointerCapture(R.pointerId),o){const O=e.getBoundingClientRect();b={x:O.left,y:O.top},v=k()}Ke.set(e,{element:e,position:u}),l?.(E(R))}},T=R=>{if(!d)return;R.preventDefault(),h={...u};let O=u.x+(R.clientX-p.x),C=u.y+(R.clientY-p.y);p={x:R.clientX,y:R.clientY},r==="x"&&(C=u.y),r==="y"&&(O=u.x);let L={x:O,y:C};if(n){const M=Eu(e,n);L=Su(L,M)}if(u=L,Ke.set(e,{element:e,position:u}),o&&v){const M=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};v.style.left=`${M.x+u.x}px`,v.style.top=`${M.y+u.y}px`}else e.style.transform=`translate(${u.x}px, ${u.y}px)`;c?.(E(R))},P=R=>{if(d){d=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(R.pointerId))&&e.releasePointerCapture(R.pointerId)}catch{}finally{A(),Ke.delete(e),f?.(E(R))}}};return e.addEventListener("pointerdown",S),e.addEventListener("pointermove",T),e.addEventListener("pointerup",P),e.addEventListener("pointercancel",P),e.style.touchAction="none",e.style.userSelect="none",{destroy:()=>{e.removeEventListener("pointerdown",S),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",P),e.removeEventListener("pointercancel",P),A(),Ke.delete(e),e.style.touchAction=y,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},ku={passive:!0},Ye=new Set,Ge=null,ne=null,ws=()=>Array.from(Ye),Tu=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",Cu=e=>{for(const t of ws())t.handlePointerMove(e)},Ru=()=>{ne=null;const e=Ge;Ge=null,e&&Cu(e)},Es=e=>{Ge=e,ne===null&&(ne=requestAnimationFrame(Ru))},Ss=e=>{ne!==null&&(cancelAnimationFrame(ne),ne=null,Ge=null);for(const t of ws())t.handlePointerUp(e)},Ou=e=>{Ye.size===0&&(document.addEventListener("pointermove",Es,ku),document.addEventListener("pointerup",Ss)),Ye.add(e)},Lu=e=>{Ye.delete(e),Ye.size===0&&(document.removeEventListener("pointermove",Es),document.removeEventListener("pointerup",Ss),ne!==null&&(cancelAnimationFrame(ne),ne=null),Ge=null)},As=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,$u=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:o,onDragLeave:i,onDrop:a}=t;if(!Tu())return{destroy:()=>{}};let l=!1,c=null;const f=(b,y)=>({zone:e,dragged:b,event:y}),m=b=>{const y=e.getBoundingClientRect();return b.clientX>=y.left&&b.clientX<=y.right&&b.clientY>=y.top&&b.clientY<=y.bottom},d=()=>bs()?.element??c,p=(b,y=c)=>{l&&(l=!1,e.classList.remove(r),y&&i?.(f(y,b)),c=null)},v={handlePointerMove:b=>{const y=bs()?.element??null,w=m(b);if(!(y!==null&&y!==e&&As(y,n))||!w){p(b,y??c);return}l?o?.(f(y,b)):(l=!0,c=y,e.classList.add(r),s?.(f(y,b)))},handlePointerUp:b=>{const y=d(),w=m(b),E=y!==null&&y!==e&&As(y,n);w&&E&&y&&a?.(f(y,b)),l&&(l=!1,e.classList.remove(r)),c=null}};return Ou(v),{destroy:()=>{Lu(v),e.classList.remove(r),c=null}}},ks=(e,t)=>Array.from(e.querySelectorAll(t)),Pu=(e,t,r,n)=>{let s=null;for(let o=0;o<e.length;o++){const i=e[o];if(i===n)continue;const a=i.getBoundingClientRect(),l=t-(r==="y"?a.top+a.height/2:a.left+a.width/2);(s===null||l<0&&l>s.distance||s.distance>=0&&l<0&&Math.abs(l)<Math.abs(s.distance))&&l<0&&(s={element:i,index:o,distance:l})}return s?{element:s.element,index:s.index}:null},Mu=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:o="bq-sort-placeholder",sortingClass:i="bq-sorting",animationDuration:a=200,onSortStart:l,onSortMove:c,onSortEnd:f}=t;let m=!t.disabled,d=!1,p=null,u=null,h=-1,v=0,b=0,y=0,w=0;const E=(P,R,O)=>({container:e,item:P,oldIndex:R,newIndex:O}),k=P=>{if(!m)return;const R=P.target,O=ks(e,r);let C=null;for(const M of O)if(M.contains(R)){C=M;break}if(!C||s&&!R.closest(s))return;P.preventDefault(),d=!0,p=C,h=O.indexOf(C),v=P.clientY,b=P.clientX;const L=C.getBoundingClientRect();y=L.top,w=L.left,u=document.createElement("div"),u.classList.add(o),u.style.width=`${L.width}px`,u.style.height=`${L.height}px`,u.style.boxSizing="border-box",C.classList.add(i),C.style.position="fixed",C.style.width=`${L.width}px`,C.style.height=`${L.height}px`,C.style.left=`${L.left}px`,C.style.top=`${L.top}px`,C.style.zIndex="999999",C.style.pointerEvents="none",C.style.margin="0",C.parentNode?.insertBefore(u,C),e.setPointerCapture(P.pointerId),l?.(E(C,h,h))},A=P=>{if(!d||!p||!u)return;P.preventDefault();const R=P.clientX-b,O=P.clientY-v;n==="y"?p.style.top=`${y+O}px`:p.style.left=`${w+R}px`;const C=Pu(ks(e,r),n==="y"?P.clientY:P.clientX,n,p);C?e.insertBefore(u,C.element):e.appendChild(u);const L=Array.from(e.children).indexOf(u);c?.(E(p,h,L))},S=P=>{if(!d||!p||!u)return;d=!1;const R=p,O=Array.from(e.children).indexOf(u),C=u.getBoundingClientRect(),L=R.getBoundingClientRect();if(a>0){const M=C.left-L.left,_=C.top-L.top;R.style.transition=`transform ${a}ms ease`,R.style.transform=`translate(${M}px, ${_}px)`;let U=!1,q=null;const Q=()=>{U||(U=!0,q!==null&&(window.clearTimeout(q),q=null),T(),f?.(E(R,h,O)))};q=window.setTimeout(()=>{Q()},a+50),R.addEventListener("transitionend",Q,{once:!0})}else T(),f?.(E(R,h,O));e.releasePointerCapture(P.pointerId)},T=()=>{!p||!u||(u.parentNode?.insertBefore(p,u),u.remove(),u=null,p.classList.remove(i),p.style.position="",p.style.width="",p.style.height="",p.style.left="",p.style.top="",p.style.zIndex="",p.style.pointerEvents="",p.style.margin="",p.style.transition="",p.style.transform="",p=null)};return e.addEventListener("pointerdown",k),e.addEventListener("pointermove",A),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",k),e.removeEventListener("pointermove",A),e.removeEventListener("pointerup",S),e.removeEventListener("pointercancel",S),e.style.touchAction="",d&&T()},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},Nu=e=>{const t=$(!1);let r;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const o=window.matchMedia(e);t.value=o.matches;const i=a=>{t.value=a.matches};if(typeof o.addEventListener=="function")o.addEventListener("change",i),r=()=>{o.removeEventListener("change",i)};else if(typeof o.addListener=="function"){const a=o;a.addListener(i),r=()=>{a.removeListener(i)}}}catch{}const n=I(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},Du=e=>{const t={},r=[];for(const o of Object.keys(e)){const i=e[o],a=$(!1);let l;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const m=window.matchMedia(`(min-width: ${i}px)`);a.value=m.matches;const d=p=>{a.value=p.matches};if(typeof m.addEventListener=="function")m.addEventListener("change",d),l=()=>{m.removeEventListener("change",d)};else{const p=m;typeof p.addListener=="function"&&(p.addListener(d),l=()=>{p.removeListener?.(d)})}}catch{}const c=I(a);let f=!1;Object.defineProperty(c,"destroy",{enumerable:!1,configurable:!0,value(){f||(f=!0,l?.(),a.dispose())}}),r.push(c.destroy),t[o]=c}let n=!1;const s=Object.defineProperty(t,"destroyAll",{enumerable:!1,configurable:!0,value(){n||(n=!0,r.forEach(o=>{o()}))}});return Object.prototype.hasOwnProperty.call(t,"destroy")||Object.defineProperty(s,"destroy",{enumerable:!1,configurable:!0,value:s.destroyAll}),s},Ts=(e,t)=>t>=e?"portrait":"landscape",Iu=()=>{const e=$({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?Ts(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:Ts(window.innerWidth,window.innerHeight)}};window.addEventListener("resize",s),t=()=>{window.removeEventListener("resize",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value:()=>{n||(n=!0,t?.(),e.dispose())}}),r},Cs=()=>{const e=typeof navigator<"u"&&navigator.onLine!==void 0?navigator.onLine:!0,t=(typeof navigator<"u"?navigator:void 0)?.connection;return{online:e,effectiveType:t?.effectiveType??"unknown",downlink:t?.downlink??0,rtt:t?.rtt??0}},_u=()=>{const e=$(Cs());let t;if(typeof window<"u"){const s=()=>{e.value=Cs()};window.addEventListener("online",s),window.addEventListener("offline",s);const o=typeof navigator<"u"?navigator:void 0;o?.connection&&typeof o.connection.addEventListener=="function"&&o.connection.addEventListener("change",s),t=()=>{window.removeEventListener("online",s),window.removeEventListener("offline",s),o?.connection&&typeof o.connection.removeEventListener=="function"&&o.connection.removeEventListener("change",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},qu={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},zu=()=>{const e=$({...qu});let t,r=!1;typeof navigator<"u"&&"getBattery"in navigator&&typeof navigator.getBattery=="function"&&navigator.getBattery().then(s=>{if(r)return;const o=()=>{e.value={supported:!0,charging:s.charging,chargingTime:s.chargingTime,dischargingTime:s.dischargingTime,level:s.level}};o(),s.addEventListener("chargingchange",o),s.addEventListener("chargingtimechange",o),s.addEventListener("dischargingtimechange",o),s.addEventListener("levelchange",o),t=()=>{s.removeEventListener("chargingchange",o),s.removeEventListener("chargingtimechange",o),s.removeEventListener("dischargingtimechange",o),s.removeEventListener("levelchange",o)}}).catch(()=>{});const n=I(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},Rs={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},xu=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,o=$({...Rs});let i;if(typeof navigator<"u"&&"geolocation"in navigator){o.value={...Rs,supported:!0,loading:!0};const c={enableHighAccuracy:t,maximumAge:r,timeout:n===1/0?void 0:n},f=d=>{o.value={supported:!0,loading:!1,latitude:d.coords.latitude,longitude:d.coords.longitude,accuracy:d.coords.accuracy,altitude:d.coords.altitude,altitudeAccuracy:d.coords.altitudeAccuracy,heading:d.coords.heading,speed:d.coords.speed,timestamp:d.timestamp,error:null}},m=d=>{o.value={...o.value,loading:!1,error:d.message}};if(s){const d=navigator.geolocation.watchPosition(f,m,c);i=()=>{navigator.geolocation.clearWatch(d)}}else navigator.geolocation.getCurrentPosition(f,m,c)}const a=I(o);let l=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){l||(l=!0,i?.(),o.dispose())}}),a},ju={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},Fu={alpha:null,beta:null,gamma:null,absolute:!1},Uu=()=>{const e=$({...ju});let t;if(typeof window<"u"){const s=o=>{e.value={acceleration:{x:o.acceleration?.x??null,y:o.acceleration?.y??null,z:o.acceleration?.z??null},accelerationIncludingGravity:{x:o.accelerationIncludingGravity?.x??null,y:o.accelerationIncludingGravity?.y??null,z:o.accelerationIncludingGravity?.z??null},rotationRate:{alpha:o.rotationRate?.alpha??null,beta:o.rotationRate?.beta??null,gamma:o.rotationRate?.gamma??null},interval:o.interval??0}};window.addEventListener("devicemotion",s),t=()=>{window.removeEventListener("devicemotion",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},Bu=()=>{const e=$({...Fu});let t;if(typeof window<"u"){const s=o=>{e.value={alpha:o.alpha??null,beta:o.beta??null,gamma:o.gamma??null,absolute:o.absolute??!1}};window.addEventListener("deviceorientation",s),t=()=>{window.removeEventListener("deviceorientation",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},Os="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",Wu={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(Os);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(Os);return navigator.clipboard.writeText(e)}},Hu=(e,t)=>{let r;t==="border-box"?r=e.borderBoxSize:t==="device-pixel-content-box"?r=e.devicePixelContentBoxSize:r=e.contentBoxSize;const n=Array.isArray(r)?r[0]:r;return n&&typeof n.inlineSize=="number"&&typeof n.blockSize=="number"?{width:n.inlineSize,height:n.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}},Qu=(e,t)=>{const r=$({isIntersecting:!1,intersectionRatio:0,entry:null});let n,s=!1;if(typeof window<"u"&&typeof IntersectionObserver<"u")try{if(n=new IntersectionObserver(i=>{if(s)return;const a=i[i.length-1];a&&(r.value={isIntersecting:a.isIntersecting,intersectionRatio:a.intersectionRatio,entry:a})},{root:t?.root??null,rootMargin:t?.rootMargin??"0px",threshold:t?.threshold??0}),e){const i=Array.isArray(e)?e:[e];for(const a of i)n.observe(a)}}catch{n&&n.disconnect(),n=void 0}const o=I(r);return Object.defineProperties(o,{observe:{enumerable:!1,configurable:!0,value(i){if(!s)try{n?.observe(i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(i){s||n?.unobserve(i)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),o},Vu=(e,t)=>{const r=$({width:0,height:0,entry:null});let n,s=!1;const o=t?.box??"content-box",i=t?.box?{box:t.box}:void 0;if(typeof window<"u"&&typeof ResizeObserver<"u")try{if(n=new ResizeObserver(l=>{if(s)return;const c=l[l.length-1];if(c){const{width:f,height:m}=Hu(c,o);r.value={width:f,height:m,entry:c}}}),e){const l=Array.isArray(e)?e:[e];for(const c of l)n.observe(c,i)}}catch{n&&n.disconnect(),n=void 0}const a=I(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(l){s||n?.unobserve(l)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Ku=(e,t)=>{const r=$({mutations:[],count:0});let n,s=!1,o=0;const i={attributes:t?.attributes??!0,childList:t?.childList??!1,characterData:t?.characterData??!1,subtree:t?.subtree??!1,attributeOldValue:t?.attributeOldValue??!1,characterDataOldValue:t?.characterDataOldValue??!1,...t&&t.attributeFilter!==void 0?{attributeFilter:t.attributeFilter}:{}};if(!i.attributes&&!i.childList&&!i.characterData&&(i.attributes=!0),i.attributes||(i.attributeOldValue=!1,delete i.attributeFilter),i.characterData||(i.characterDataOldValue=!1),typeof window<"u"&&typeof MutationObserver<"u")try{n=new MutationObserver(l=>{s||(o+=1,r.value={mutations:l,count:o})}),e&&n.observe(e,i)}catch{n&&n.disconnect(),n=void 0}const a=I(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},takeRecords:{enumerable:!1,configurable:!0,value(){return n?.takeRecords()??[]}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Je=new Set,se=new Map,er=()=>{Oc(e=>se.get(e))};er();var Ls=e=>{se.clear();for(const[t,r]of e)se.set(t,r)},Yu=e=>({directive(t,r){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin directive: name must be a non-empty string");if(t.startsWith("bq-")){const n=t.slice(3);throw new Error(`bQuery plugin directive: name "${t}" must be provided without the "bq-" prefix`+(n?` (use "${n}")`:""))}if(typeof r!="function")throw new Error(`bQuery plugin directive: handler for "${t}" must be a function`);if(se.has(t))throw new Error(`bQuery plugin directive: a directive named "${t}" is already registered`);se.set(t,r)},component(t,r,n){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin component: tagName must be a non-empty string");if(!t.includes("-"))throw new Error(`bQuery plugin component: tagName "${t}" must be a valid custom element name containing a hyphen`);if(typeof r!="function")throw new Error(`bQuery plugin component: constructor for "${t}" must be a function`);if(typeof customElements>"u"){typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery] plugin component "${t}" was not registered because customElements is not available in this environment.`);return}!customElements.get(t)&&!e.some(s=>s.tagName===t)&&e.push({tagName:t,constructor:r,options:n})}}),Gu=(e,t)=>{if(er(),!e||typeof e!="object")throw new Error("bQuery plugin: use() expects a plugin object with { name, install }");if(typeof e.name!="string"||e.name.length===0)throw new Error('bQuery plugin: plugin must have a non-empty "name" property');if(typeof e.install!="function")throw new Error(`bQuery plugin: plugin "${e.name}" must have an "install" function`);if(Je.has(e.name))return;const r=[],n=Yu(r),s=new Map(se);try{e.install(n,t)}catch(o){throw Ls(s),o}try{for(const o of r)customElements.get(o.tagName)||customElements.define(o.tagName,o.constructor,o.options)}catch(o){throw Ls(s),o}Je.add(e.name)},Ju=e=>Je.has(e),Xu=()=>[...Je],Zu=e=>se.get(e),ef=()=>[...se.entries()].map(([e,t])=>({name:e,handler:t})),tf=()=>{Je.clear(),se.clear(),er()},Xe=!1,tr={},pe=[],St=new Map,$s=0,rf=(e,t)=>{Xe=e,tr=t??{},e||(pe.length=0,St.clear(),$s=0)},nf=()=>Xe,sf=(e,t,r)=>{if(Xe){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");St.set(e,{peek:t,subscriberCount:r})}},of=e=>{St.delete(e)},af=()=>`signal_${$s++}`,Ps=()=>{const e=[];for(const[t,r]of St)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},Ms=()=>{try{return Qt().map(e=>{const t=Te(e),r={};if(t&&typeof t=="object"&&"$state"in t){const n=t.$state;n&&typeof n=="object"&&Object.assign(r,n)}return{id:e,state:r}})}catch{return[]}},Ns=()=>{if(typeof document>"u")return[];const e=[],t=new Set,r=document.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n].tagName.toLowerCase();if(s.includes("-")&&!t.has(s)&&typeof customElements<"u"&&customElements.get(s)){t.add(s);const o=document.querySelectorAll(s);e.push({tagName:s,instanceCount:o.length})}}return e},lf=(e,t)=>{if(!Xe)return;const r={timestamp:Date.now(),type:e,detail:t};pe.push(r),tr.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},cf=()=>pe,uf=()=>{pe.length=0},ff=()=>({enabled:Xe,options:{...tr},timeline:[...pe]}),df=()=>{const e=Ps();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},hf=()=>{const e=Ms();if(e.length===0){console.log("[bq:devtools] No stores registered.");return}console.table(e.map(t=>({id:t.id,state:JSON.stringify(t.state)})))},mf=()=>{const e=Ns();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},pf=e=>{const t=typeof e=="number"&&e>0?pe.slice(-e):pe;if(t.length===0){console.log("[bq:devtools] Timeline is empty.");return}console.table(t.map(r=>({time:new Date(r.timestamp).toISOString(),type:r.type,detail:r.detail})))},Ds=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),vf=(e,t)=>{let r=1,n="",s=t+1;for(;s<e.length;){const o=e[s];if(o==="\\"&&s+1<e.length){n+=o+e[s+1],s+=2;continue}if(o==="(")r++;else if(o===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=o,s++}return null},Is=new Map,yf=e=>{const t=Ht(e),r=Is.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return Is.set(t,n),n};function gf(e,t={}){if(!e||!e.includes("-"))throw new Error(`bQuery testing: "${e}" is not a valid custom element tag name (must contain a hyphen)`);const{props:r,slots:n,container:s=document.body}=t,o=document.createElement(e);if(r)for(const[a,l]of Object.entries(r))l!=null&&o.setAttribute(a,String(l));if(n)if(typeof n=="string")o.innerHTML=n;else{const a=[];for(const[l,c]of Object.entries(n))if(l==="default")a.push(c);else{const f=l.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");a.push(`<div slot="${f}">${c}</div>`)}o.innerHTML=a.join("")}return s.appendChild(o),{el:o,unmount:()=>{o.parentNode&&o.parentNode.removeChild(o)}}}function _s(){ce(()=>{})}function bf(e){const t=$(e);return Object.defineProperty(t,"initialValue",{value:e,writable:!1,enumerable:!0}),t.set=function(r){t.value=r},t.reset=function(){t.value=e},t}function wf(e,t){let r=e;t&&r.startsWith(t)&&(r=r.slice(t.length)||"/");let n="";const s=r.indexOf("#");s>=0&&(n=r.slice(s+1),r=r.slice(0,s));const o={},i=r.indexOf("?");if(i>=0){const a=r.slice(i+1);r=r.slice(0,i);for(const l of a.split("&")){const c=l.indexOf("="),f=c>=0?decodeURIComponent(l.slice(0,c)):decodeURIComponent(l),m=c>=0?decodeURIComponent(l.slice(c+1)):"",d=o[f];d!==void 0?Array.isArray(d)?d.push(m):o[f]=[d,m]:o[f]=m}}return{path:r||"/",query:o,hash:n}}function Ef(e,t){for(const r of t){const n=Sf(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function Sf(e,t){if(e==="*")return{};const r=new Map,n=(o,i)=>{const a=o.indexOf("/",i);return a===-1?o.length:a},s=(o,i)=>{const a=`${o}:${i}`;if(r.has(a))return r.get(a)??null;if(o===e.length){const f=i===t.length?{}:null;return r.set(a,f),f}const l=e[o];if(l==="*"){for(let f=t.length;f>=i;f--){const m=s(o+1,f);if(m)return r.set(a,m),m}return r.set(a,null),null}if(l===":"&&Ds(e[o+1])){let f=o+2;for(;f<e.length&&Ds(e[f]);)f++;const m=e.slice(o+1,f);let d=f,p,u=!1;if(e[f]==="("){const v=vf(e,f);v&&(p=v.constraint,d=v.endIndex)}e[d]==="*"&&(u=!0,d++);const h=u||p?t.length:n(t,i);for(let v=h;v>i;v--){const b=t.slice(i,v);if(p&&!yf(p).test(b))continue;const y=s(d,v);if(y){const w={[m]:b,...y};return r.set(a,w),w}}return r.set(a,null),null}if(i>=t.length||l!==t[i])return r.set(a,null),null;const c=s(o+1,i+1);return r.set(a,c),c};return s(0,0)}function Af(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=i=>{const{path:a,query:l,hash:c}=wf(i,r),{matched:f,params:m}=Ef(a,t);return{path:a,params:m,query:l,matched:f,hash:c}},o=$(s(n));return{push(i){o.value=s(i)},replace(i){o.value=s(i)},get currentRoute(){return o},get routes(){return t},destroy(){o.dispose()}}}function kf(e,t,r={}){if(!e)throw new Error("bQuery testing: fireEvent requires a valid element");if(!t)throw new Error("bQuery testing: fireEvent requires an event name");const{bubbles:n=!0,cancelable:s=!0,composed:o=!0,detail:i}=r;let a;i!==void 0?a=new CustomEvent(t,{bubbles:n,cancelable:s,composed:o,detail:i}):a=new Event(t,{bubbles:n,cancelable:s,composed:o});const l=e.dispatchEvent(a);return _s(),l}async function Tf(e,t={}){if(typeof e!="function")throw new Error("bQuery testing: waitFor requires a predicate function");const{timeout:r=1e3,interval:n=10}=t,s=Date.now();for(;;){try{if(await e())return}catch{}if(Date.now()-s>=r)throw new Error(`bQuery testing: waitFor timed out after ${r}ms — predicate never returned true`);await new Promise(o=>setTimeout(o,n))}}var Cf=(e,t,r={})=>{const{hydrate:n=!0,...s}=r;if(!n)throw new Error("bQuery ssr: hydrateMount() requires { hydrate: true } when options are provided.");return Jt(e,t,s)},At=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),rr=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},qs=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),Rf=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),zs=(e={})=>{const{scriptId:t="__BQUERY_STORE_STATE__",globalKey:r="__BQUERY_INITIAL_STATE__",storeIds:n,serialize:s=JSON.stringify}=e;if(x(r))throw new Error(`serializeStoreState: invalid globalKey "${r}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`serializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);const o=n??Qt(),i=Object.create(null);for(const f of o){if(x(f))continue;const m=Te(f);m&&(i[f]=rr(m.$state))}const a=s(i);if(typeof a!="string")throw new Error("serializeStoreState: custom serialize function must return a string.");if(s!==JSON.stringify){let f;try{f=JSON.parse(a)}catch{throw new Error("serializeStoreState: custom serialize function returned invalid JSON.")}if(!At(f))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const l=qs(a),c=qs(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${Rf(t)}">window[${c}]=${l}<\/script>`}},Of=(e="__BQUERY_INITIAL_STATE__",t="__BQUERY_STORE_STATE__")=>{if(x(e))throw new Error(`deserializeStoreState: invalid globalKey "${e}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`deserializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);if(typeof window>"u")return{};const r=window[e];if(!r)return{};try{delete window[e]}catch{window[e]=void 0}if(typeof document<"u"&&typeof document.getElementById=="function"){const s=document.getElementById(t);s&&s.remove()}if(!At(r))return{};for(const s of Object.values(r))if(!At(s))return{};const n=Object.create(null);for(const[s,o]of Object.entries(r))x(s)||!At(o)||(n[s]=rr(o));return n},xs=(e,t)=>{const r=Te(e);r&&typeof r.$patch=="function"&&r.$patch(rr(t))},Lf=e=>{for(const[t,r]of Object.entries(e))xs(t,r)},$f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),js=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Pf=e=>js(e).replace(/"/g,"&quot;"),Mf=e=>{const t=e.toLowerCase();return t==="href"||t==="src"||t==="xlink:href"||t==="formaction"||t==="action"||t==="poster"||t==="background"||t==="cite"||t==="data"},Nf=e=>e.trim().replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),Df=e=>{const t=Nf(e);return ur.some(r=>t.startsWith(r))},Fs=e=>{if(e.nodeType===Node.TEXT_NODE)return js(e.textContent??"");if(e.nodeType!==Node.ELEMENT_NODE)return"";const t=e,r=t.tagName.toLowerCase();if(r==="script")return"";let n="";for(const o of t.attributes){const i=o.name.toLowerCase();i.startsWith("on")||Mf(i)&&Df(o.value)||(n+=` ${o.name}="${Pf(o.value)}"`)}if($f.has(r))return`<${r}${n}>`;let s="";for(const o of t.childNodes)s+=Fs(o);return`<${r}${n}>${s}</${r}>`},Us=e=>fe(e)||qe(e)?e.value:e,G=(e,t)=>{const r=e.trim();if(r.startsWith("!"))return!G(r.slice(1).trim(),t);if(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);if(/^-?\d+(\.\d+)?$/.test(r))return Number(r);if(r==="true")return!0;if(r==="false")return!1;if(r==="null")return null;if(r!=="undefined"){if(/^[\w$]+(?:\.[\w$]+)*$/.test(r)){const n=r.split(".");let s=t;for(const o of n){if(s==null)return;s===t?s=Us(s[o]):s=s[o]}return s}try{const n=Object.keys(t),s=n.map(o=>Us(t[o]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},If=e=>{const t=e.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);return t?{itemName:t[1],indexName:t[2]||void 0,listExpr:t[3].trim()}:null},nr=(e,t,r,n)=>{const s=e.getAttribute(`${r}-if`);if(s!==null&&!G(s,t))return!1;const o=e.getAttribute(`${r}-show`);if(o!==null&&!G(o,t)){const d=e;d.style?d.style.display="none":e.setAttribute("style","display: none;")}const i=e.getAttribute(`${r}-text`);if(i!==null){const d=G(i,t);e.textContent=String(d??"")}const a=e.getAttribute(`${r}-html`);if(a!==null){const d=G(a,t);e.innerHTML=String(X(String(d??"")))}const l=e.getAttribute(`${r}-class`);if(l!==null){const d=l.trim();if(d.startsWith("{")){const p=d.slice(1,-1).trim().split(",");for(const u of p){const h=u.indexOf(":");if(h>-1){const v=u.slice(0,h).trim().replace(/^['"]|['"]$/g,"");G(u.slice(h+1).trim(),t)&&e.classList.add(v)}}}else{const p=G(l,t);typeof p=="string"?p.split(/\s+/).filter(Boolean).forEach(u=>e.classList.add(u)):Array.isArray(p)&&p.filter(Boolean).forEach(u=>e.classList.add(u))}}const c=e.getAttribute(`${r}-style`);if(c!==null){const d=G(c,t);if(d&&typeof d=="object"){const p=e;for(const[u,h]of Object.entries(d)){const v=u.replace(/([A-Z])/g,"-$1").toLowerCase();p.style.setProperty(v,String(h))}}}const f=Array.from(e.attributes);for(const d of f)if(d.name.startsWith(`${r}-bind:`)){const p=d.name.slice(`${r}-bind:`.length),u=G(d.value,t);u===!1||u===null||u===void 0?e.removeAttribute(p):u===!0?e.setAttribute(p,""):e.setAttribute(p,String(u))}const m=e.getAttribute(`${r}-for`);if(m!==null){const d=If(m);if(d){const p=G(d.listExpr,t);if(Array.isArray(p)&&e.parentNode){const u=e.parentNode;for(let h=0;h<p.length;h++){const v=p[h],b=e.cloneNode(!0);b.removeAttribute(`${r}-for`),b.removeAttribute(":key"),b.removeAttribute(`${r}-key`);const y={...t,[d.itemName]:v};d.indexName&&(y[d.indexName]=h),nr(b,y,r,n),sr(b,y,r,n),u.insertBefore(b,e)}return u.removeChild(e),!0}}}return!0},sr=(e,t,r,n)=>{const s=Array.from(e.children);for(const o of s){if(o.hasAttribute(`${r}-for`)){nr(o,t,r,n)||o.remove();continue}if(!nr(o,t,r,n)){o.remove();continue}sr(o,t,r,n)}},Bs=(e,t)=>{const r=Array.from(e.attributes);for(const n of r)(n.name.startsWith(`${t}-`)||n.name.startsWith(":")||n.name===":key")&&e.removeAttribute(n.name);for(const n of Array.from(e.children))Bs(n,t)},_f=(e,t,r={})=>{const{prefix:n="bq",stripDirectives:s=!1,includeStoreState:o=!1}=r;if(!e||typeof e!="string")throw new Error("bQuery SSR: template must be a non-empty string.");if(typeof DOMParser>"u")throw new Error("bQuery SSR: DOMParser is not available in this environment. Provide a DOMParser-compatible implementation before calling renderToString().");const i=new DOMParser().parseFromString(e.trim(),"text/html"),a=i.body||i.documentElement;if(!a)throw new Error("bQuery SSR: Failed to parse template.");if(sr(a,t,n,i),s)for(const f of Array.from(a.children))Bs(f,n);let l="";for(const f of a.childNodes)l+=Fs(f);let c;return o&&(c=zs({storeIds:Array.isArray(o)?o:void 0}).stateJson),{html:l,storeState:c}};return g.$=go,g.$$=bo,g.BQueryCollection=st,g.BQueryElement=be,g.BqLinkElement=Bn,g.Computed=Ie,g.HttpError=ie,g.Signal=_e,g.TaskWorkerAbortError=ae,g.TaskWorkerError=F,g.TaskWorkerSerializationError=de,g.TaskWorkerTimeoutError=lt,g.TaskWorkerUnsupportedError=It,g.animate=vt,g.announceToScreenReader=ru,g.auditA11y=uu,g.back=gl,g.batch=ce,g.batchTasks=fa,g.bool=La,g.breakpoints=Du,g.buckets=el,g.cache=rl,g.callWorkerMethod=sa,g.capturePosition=Ut,g.clearAnnouncements=nu,g.clearTimeline=uf,g.clipboard=Wu,g.component=Ee,g.computed=D,g.createForm=Dc,g.createHttp=Pt,g.createI18n=Zc,g.createPersistedStore=ic,g.createReactiveRpcPool=ga,g.createReactiveRpcWorker=va,g.createReactiveTaskPool=ya,g.createReactiveTaskWorker=pa,g.createRequestQueue=_i,g.createRestClient=Wi,g.createRouter=jl,g.createRpcPool=en,g.createRpcWorker=ut,g.createStore=Vt,g.createTaskPool=ht,g.createTaskWorker=ft,g.createTemplate=$c,g.createTrustedHtml=co,g.createUseFetch=Si,g.currentRoute=xn,g.custom=Kc,g.customAsync=Yc,g.deduplicateRequest=Qi,g.defineBqueryConfig=ti,g.defineComponent=Ta,g.definePageMeta=fl,g.defineStore=Xl,g.deserializeStoreState=Of,g.destroyStore=Gl,g.draggable=Au,g.droppable=$u,g.easeInCubic=Rn,g.easeInOutCubic=Ln,g.easeInOutQuad=Cn,g.easeInQuad=kn,g.easeOutBack=$n,g.easeOutCubic=On,g.easeOutExpo=Pn,g.easeOutQuad=Tn,g.easingPresets=_a,g.effect=j,g.effectScope=oi,g.email=Wc,g.enableDevtools=rf,g.escapeHtml=br,g.every=ln,g.filter=on,g.find=cn,g.fireEvent=kf,g.flip=Bt,g.flipElements=Mn,g.flipList=qa,g.flushEffects=_s,g.formatDate=fs,g.formatNumber=us,g.forward=bl,g.generateNonce=io,g.generateSignalLabel=af,g.getBqueryConfig=Z,g.getConcurrencySupport=Qr,g.getCurrentScope=Pr,g.getCustomDirective=Zu,g.getCustomDirectives=ef,g.getDevtoolsState=ff,g.getFocusableElements=Zt,g.getInstalledPlugins=Xu,g.getStore=Te,g.getTimeline=cf,g.getTrustedTypesPolicy=gr,g.hasCSPDirective=ao,g.html=Se,g.http=Ii,g.hydrateMount=Cf,g.hydrateStore=xs,g.hydrateStores=Lf,g.inspectComponents=Ns,g.inspectSignals=Ps,g.inspectStores=Ms,g.interceptLinks=Tl,g.isActive=_l,g.isActiveSignal=ql,g.isComputed=qe,g.isConcurrencySupported=_t,g.isDevtoolsEnabled=nf,g.isInstalled=Ju,g.isNavigating=vl,g.isSignal=fe,g.isTrustedTypesSupported=lo,g.keyframePresets=za,g.linear=An,g.link=kl,g.linkedSignal=qi,g.listStores=Qt,g.logComponents=mf,g.logSignals=df,g.logStores=hf,g.logTimeline=pf,g.map=sn,g.mapActions=tc,g.mapGetters=ec,g.mapState=Zl,g.matchField=Gc,g.max=Vc,g.maxLength=Uc,g.mediaQuery=Nu,g.min=Qc,g.minLength=Fc,g.mockRouter=Af,g.mockSignal=bf,g.morphElement=xa,g.mount=Jt,g.navigate=Be,g.notifications=ll,g.onScopeDispose=Mr,g.parallax=ja,g.parallel=ua,g.pattern=Bc,g.persistedSignal=ji,g.pipeline=ma,g.prefersColorScheme=fu,g.prefersContrast=du,g.prefersReducedMotion=ee,g.readonly=I,g.recordEvent=lf,g.reduce=un,g.registerBqLink=Al,g.registerDefaultComponents=Da,g.registerPlugin=Vl,g.releaseFocus=wu,g.renderComponent=gf,g.renderToString=_f,g.required=jc,g.resetPlugins=tf,g.resolve=Il,g.rovingTabIndex=hu,g.runTask=Yr,g.safeHtml=$a,g.sanitize=X,g.sanitizeHtml=X,g.scrollAnimate=Ua,g.sequence=Ya,g.serializeStoreState=zs,g.setReducedMotion=Ia,g.signal=$,g.skipLink=yu,g.some=an,g.sortable=Mu,g.spring=Wa,g.springPresets=Ha,g.stagger=Qa,g.storage=pl,g.stripTags=uo,g.timeline=Ga,g.toValue=Vi,g.trackSignal=sf,g.transition=Ja,g.trapFocus=bu,g.trusted=no,g.typewriter=Xa,g.untrack=ue,g.untrackSignal=of,g.url=Hc,g.use=Gu,g.useAnnouncer=ul,g.useAsyncData=Dr,g.useBattery=zu,g.useComputed=Ea,g.useCookie=al,g.useDeviceMotion=Uu,g.useDeviceOrientation=Bu,g.useEffect=Sa,g.useEventSource=Xi,g.useFetch=K,g.useFormField=qc,g.useGeolocation=xu,g.useInfiniteFetch=xi,g.useIntersectionObserver=Qu,g.useMutationObserver=Ku,g.useNetworkStatus=_u,g.usePaginatedFetch=zi,g.usePolling=Fi,g.useResizeObserver=Vu,g.useResource=Ui,g.useResourceList=Hi,g.useRoute=Ul,g.useSignal=wa,g.useSubmit=Bi,g.useViewport=Iu,g.useWebSocket=Br,g.useWebSocketChannel=Ji,g.utils=Go,g.waitFor=Tf,g.watch=Nt,g.watchDebounce=Ki,g.watchStore=ac,g.watchThrottle=Yi,g})({});
192
276
 
193
277
  //# sourceMappingURL=full.iife.js.map