@bquery/bquery 1.7.0 → 1.8.2

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 (262) hide show
  1. package/README.md +760 -716
  2. package/dist/{a11y-C5QOVvRn.js → a11y-DVBCy09c.js} +3 -3
  3. package/dist/a11y-DVBCy09c.js.map +1 -0
  4. package/dist/a11y.es.mjs +1 -1
  5. package/dist/component/library.d.ts.map +1 -1
  6. package/dist/{component-CuuTijA6.js → component-L3-JfOFz.js} +5 -5
  7. package/dist/component-L3-JfOFz.js.map +1 -0
  8. package/dist/component.es.mjs +1 -1
  9. package/dist/{config-BW35FKuA.js → config-DhT9auRm.js} +1 -1
  10. package/dist/{config-BW35FKuA.js.map → config-DhT9auRm.js.map} +1 -1
  11. package/dist/{constraints-3lV9yyBw.js → constraints-D5RHQLmP.js} +1 -1
  12. package/dist/constraints-D5RHQLmP.js.map +1 -0
  13. package/dist/core/collection.d.ts +86 -0
  14. package/dist/core/collection.d.ts.map +1 -1
  15. package/dist/core/element.d.ts +28 -0
  16. package/dist/core/element.d.ts.map +1 -1
  17. package/dist/core/shared.d.ts +6 -0
  18. package/dist/core/shared.d.ts.map +1 -1
  19. package/dist/core-DdtZHzsS.js +168 -0
  20. package/dist/core-DdtZHzsS.js.map +1 -0
  21. package/dist/{core-Cjl7GUu8.js → core-EMYSLzaT.js} +289 -259
  22. package/dist/core-EMYSLzaT.js.map +1 -0
  23. package/dist/core.es.mjs +48 -47
  24. package/dist/{custom-directives-7wAShnnd.js → custom-directives-Dr4C5lVV.js} +1 -1
  25. package/dist/custom-directives-Dr4C5lVV.js.map +1 -0
  26. package/dist/{devtools-D2fQLhDN.js → devtools-BhB2iDPT.js} +2 -2
  27. package/dist/devtools-BhB2iDPT.js.map +1 -0
  28. package/dist/devtools.es.mjs +1 -1
  29. package/dist/{dnd-B8EgyzaI.js → dnd-NwZBYh4l.js} +1 -1
  30. package/dist/dnd-NwZBYh4l.js.map +1 -0
  31. package/dist/dnd.es.mjs +1 -1
  32. package/dist/{env-NeVmr4Gf.js → env-CTdvLaH2.js} +1 -1
  33. package/dist/env-CTdvLaH2.js.map +1 -0
  34. package/dist/forms/create-form.d.ts.map +1 -1
  35. package/dist/forms/index.d.ts +3 -2
  36. package/dist/forms/index.d.ts.map +1 -1
  37. package/dist/forms/types.d.ts +46 -0
  38. package/dist/forms/types.d.ts.map +1 -1
  39. package/dist/forms/use-field.d.ts +34 -0
  40. package/dist/forms/use-field.d.ts.map +1 -0
  41. package/dist/forms/validators.d.ts +25 -0
  42. package/dist/forms/validators.d.ts.map +1 -1
  43. package/dist/forms-UcRHsYxC.js +227 -0
  44. package/dist/forms-UcRHsYxC.js.map +1 -0
  45. package/dist/forms.es.mjs +14 -12
  46. package/dist/full.d.ts +17 -26
  47. package/dist/full.d.ts.map +1 -1
  48. package/dist/full.es.mjs +206 -181
  49. package/dist/full.iife.js +33 -33
  50. package/dist/full.iife.js.map +1 -1
  51. package/dist/full.umd.js +33 -33
  52. package/dist/full.umd.js.map +1 -1
  53. package/dist/function-Cybd57JV.js +33 -0
  54. package/dist/function-Cybd57JV.js.map +1 -0
  55. package/dist/{i18n-BnnhTFOS.js → i18n-kuF6Ekj6.js} +3 -3
  56. package/dist/i18n-kuF6Ekj6.js.map +1 -0
  57. package/dist/i18n.es.mjs +1 -1
  58. package/dist/index.es.mjs +251 -228
  59. package/dist/media/breakpoints.d.ts.map +1 -1
  60. package/dist/media/types.d.ts +2 -2
  61. package/dist/media/types.d.ts.map +1 -1
  62. package/dist/{media-Di2Ta22s.js → media-i-fB5WxI.js} +3 -3
  63. package/dist/media-i-fB5WxI.js.map +1 -0
  64. package/dist/media.es.mjs +1 -1
  65. package/dist/{motion-qPj_TYGv.js → motion-BJsAuULb.js} +2 -2
  66. package/dist/motion-BJsAuULb.js.map +1 -0
  67. package/dist/motion.es.mjs +1 -1
  68. package/dist/{mount-SM07RUa6.js → mount-B4Y8bk8Z.js} +5 -5
  69. package/dist/mount-B4Y8bk8Z.js.map +1 -0
  70. package/dist/{platform-CPbCprb6.js → platform-Dw2gE3zI.js} +3 -3
  71. package/dist/{platform-CPbCprb6.js.map → platform-Dw2gE3zI.js.map} +1 -1
  72. package/dist/platform.es.mjs +2 -2
  73. package/dist/plugin/registry.d.ts.map +1 -1
  74. package/dist/{plugin-cPoOHFLY.js → plugin-C2WuC8SF.js} +20 -18
  75. package/dist/plugin-C2WuC8SF.js.map +1 -0
  76. package/dist/plugin.es.mjs +1 -1
  77. package/dist/reactive/async-data.d.ts +28 -3
  78. package/dist/reactive/async-data.d.ts.map +1 -1
  79. package/dist/reactive/computed.d.ts +3 -0
  80. package/dist/reactive/computed.d.ts.map +1 -1
  81. package/dist/reactive/effect.d.ts +3 -0
  82. package/dist/reactive/effect.d.ts.map +1 -1
  83. package/dist/reactive/http.d.ts +194 -0
  84. package/dist/reactive/http.d.ts.map +1 -0
  85. package/dist/reactive/index.d.ts +2 -2
  86. package/dist/reactive/index.d.ts.map +1 -1
  87. package/dist/reactive/pagination.d.ts +126 -0
  88. package/dist/reactive/pagination.d.ts.map +1 -0
  89. package/dist/reactive/polling.d.ts +55 -0
  90. package/dist/reactive/polling.d.ts.map +1 -0
  91. package/dist/reactive/readonly.d.ts +20 -1
  92. package/dist/reactive/readonly.d.ts.map +1 -1
  93. package/dist/reactive/rest.d.ts +293 -0
  94. package/dist/reactive/rest.d.ts.map +1 -0
  95. package/dist/reactive/scope.d.ts +140 -0
  96. package/dist/reactive/scope.d.ts.map +1 -0
  97. package/dist/reactive/signal.d.ts +16 -2
  98. package/dist/reactive/signal.d.ts.map +1 -1
  99. package/dist/reactive/to-value.d.ts +57 -0
  100. package/dist/reactive/to-value.d.ts.map +1 -0
  101. package/dist/reactive/websocket.d.ts +285 -0
  102. package/dist/reactive/websocket.d.ts.map +1 -0
  103. package/dist/reactive-DwkhUJfP.js +1148 -0
  104. package/dist/reactive-DwkhUJfP.js.map +1 -0
  105. package/dist/reactive.es.mjs +38 -19
  106. package/dist/{registry-CWf368tT.js → registry-B08iilIh.js} +1 -1
  107. package/dist/{registry-CWf368tT.js.map → registry-B08iilIh.js.map} +1 -1
  108. package/dist/router/constraints.d.ts.map +1 -1
  109. package/dist/router/index.d.ts +1 -1
  110. package/dist/router/index.d.ts.map +1 -1
  111. package/dist/router/router.d.ts.map +1 -1
  112. package/dist/router/state.d.ts +25 -2
  113. package/dist/router/state.d.ts.map +1 -1
  114. package/dist/router-CQikC9Ed.js +492 -0
  115. package/dist/router-CQikC9Ed.js.map +1 -0
  116. package/dist/router.es.mjs +9 -8
  117. package/dist/ssr/hydrate.d.ts.map +1 -1
  118. package/dist/{ssr-B2qd_WBB.js → ssr-_dAcGdzu.js} +4 -4
  119. package/dist/ssr-_dAcGdzu.js.map +1 -0
  120. package/dist/ssr.es.mjs +1 -1
  121. package/dist/store/persisted.d.ts.map +1 -1
  122. package/dist/{store-DWpyH6p5.js → store-Cb3gPRve.js} +7 -7
  123. package/dist/store-Cb3gPRve.js.map +1 -0
  124. package/dist/store.es.mjs +2 -2
  125. package/dist/storybook.es.mjs.map +1 -1
  126. package/dist/{testing-CsqjNUyy.js → testing-C5Sjfsna.js} +8 -8
  127. package/dist/testing-C5Sjfsna.js.map +1 -0
  128. package/dist/testing.es.mjs +1 -1
  129. package/dist/{type-guards-Do9DWgNp.js → type-guards-BMX2c0LP.js} +1 -1
  130. package/dist/{type-guards-Do9DWgNp.js.map → type-guards-BMX2c0LP.js.map} +1 -1
  131. package/dist/untrack-D0fnO5k2.js +36 -0
  132. package/dist/untrack-D0fnO5k2.js.map +1 -0
  133. package/dist/view/custom-directives.d.ts.map +1 -1
  134. package/dist/view.es.mjs +4 -4
  135. package/package.json +178 -177
  136. package/src/a11y/announce.ts +131 -131
  137. package/src/a11y/audit.ts +314 -314
  138. package/src/a11y/index.ts +68 -68
  139. package/src/a11y/media-preferences.ts +255 -255
  140. package/src/a11y/roving-tab-index.ts +164 -164
  141. package/src/a11y/skip-link.ts +255 -255
  142. package/src/a11y/trap-focus.ts +184 -184
  143. package/src/a11y/types.ts +183 -183
  144. package/src/component/component.ts +599 -599
  145. package/src/component/html.ts +153 -153
  146. package/src/component/index.ts +52 -52
  147. package/src/component/library.ts +540 -542
  148. package/src/component/scope.ts +212 -212
  149. package/src/component/types.ts +310 -310
  150. package/src/core/collection.ts +876 -707
  151. package/src/core/element.ts +1015 -981
  152. package/src/core/env.ts +60 -60
  153. package/src/core/index.ts +49 -49
  154. package/src/core/shared.ts +77 -62
  155. package/src/core/utils/index.ts +148 -148
  156. package/src/devtools/devtools.ts +410 -410
  157. package/src/devtools/index.ts +48 -48
  158. package/src/devtools/types.ts +104 -104
  159. package/src/dnd/draggable.ts +296 -296
  160. package/src/dnd/droppable.ts +228 -228
  161. package/src/dnd/index.ts +62 -62
  162. package/src/dnd/sortable.ts +307 -307
  163. package/src/dnd/types.ts +293 -293
  164. package/src/forms/create-form.ts +320 -278
  165. package/src/forms/index.ts +70 -65
  166. package/src/forms/types.ts +203 -154
  167. package/src/forms/use-field.ts +231 -0
  168. package/src/forms/validators.ts +294 -265
  169. package/src/full.ts +554 -480
  170. package/src/i18n/formatting.ts +67 -67
  171. package/src/i18n/i18n.ts +200 -200
  172. package/src/i18n/index.ts +67 -67
  173. package/src/i18n/translate.ts +182 -182
  174. package/src/i18n/types.ts +171 -171
  175. package/src/index.ts +108 -108
  176. package/src/media/battery.ts +116 -116
  177. package/src/media/breakpoints.ts +129 -131
  178. package/src/media/clipboard.ts +80 -80
  179. package/src/media/device-sensors.ts +158 -158
  180. package/src/media/geolocation.ts +119 -119
  181. package/src/media/index.ts +76 -76
  182. package/src/media/media-query.ts +92 -92
  183. package/src/media/network.ts +115 -115
  184. package/src/media/types.ts +177 -177
  185. package/src/media/viewport.ts +84 -84
  186. package/src/motion/index.ts +57 -57
  187. package/src/motion/morph.ts +151 -151
  188. package/src/motion/parallax.ts +120 -120
  189. package/src/motion/reduced-motion.ts +66 -66
  190. package/src/motion/types.ts +271 -271
  191. package/src/motion/typewriter.ts +164 -164
  192. package/src/plugin/index.ts +37 -37
  193. package/src/plugin/registry.ts +284 -269
  194. package/src/plugin/types.ts +137 -137
  195. package/src/reactive/async-data.ts +250 -29
  196. package/src/reactive/computed.ts +144 -130
  197. package/src/reactive/effect.ts +29 -6
  198. package/src/reactive/http.ts +790 -0
  199. package/src/reactive/index.ts +60 -0
  200. package/src/reactive/pagination.ts +317 -0
  201. package/src/reactive/polling.ts +179 -0
  202. package/src/reactive/readonly.ts +52 -8
  203. package/src/reactive/rest.ts +859 -0
  204. package/src/reactive/scope.ts +276 -0
  205. package/src/reactive/signal.ts +61 -1
  206. package/src/reactive/to-value.ts +71 -0
  207. package/src/reactive/websocket.ts +849 -0
  208. package/src/router/bq-link.ts +279 -279
  209. package/src/router/constraints.ts +204 -201
  210. package/src/router/index.ts +49 -49
  211. package/src/router/match.ts +312 -312
  212. package/src/router/path-pattern.ts +52 -52
  213. package/src/router/query.ts +38 -38
  214. package/src/router/router.ts +421 -402
  215. package/src/router/state.ts +51 -3
  216. package/src/router/types.ts +139 -139
  217. package/src/router/use-route.ts +68 -68
  218. package/src/router/utils.ts +157 -157
  219. package/src/security/index.ts +12 -12
  220. package/src/ssr/hydrate.ts +84 -82
  221. package/src/ssr/index.ts +70 -70
  222. package/src/ssr/render.ts +508 -508
  223. package/src/ssr/serialize.ts +296 -296
  224. package/src/ssr/types.ts +81 -81
  225. package/src/store/create-store.ts +467 -467
  226. package/src/store/index.ts +27 -27
  227. package/src/store/persisted.ts +245 -249
  228. package/src/store/types.ts +247 -247
  229. package/src/store/utils.ts +135 -135
  230. package/src/storybook/index.ts +480 -480
  231. package/src/testing/index.ts +42 -42
  232. package/src/testing/testing.ts +593 -593
  233. package/src/testing/types.ts +170 -170
  234. package/src/view/custom-directives.ts +28 -30
  235. package/src/view/evaluate.ts +292 -292
  236. package/src/view/process.ts +108 -108
  237. package/dist/a11y-C5QOVvRn.js.map +0 -1
  238. package/dist/component-CuuTijA6.js.map +0 -1
  239. package/dist/constraints-3lV9yyBw.js.map +0 -1
  240. package/dist/core-Cjl7GUu8.js.map +0 -1
  241. package/dist/core-DnlyjbF2.js +0 -112
  242. package/dist/core-DnlyjbF2.js.map +0 -1
  243. package/dist/custom-directives-7wAShnnd.js.map +0 -1
  244. package/dist/devtools-D2fQLhDN.js.map +0 -1
  245. package/dist/dnd-B8EgyzaI.js.map +0 -1
  246. package/dist/env-NeVmr4Gf.js.map +0 -1
  247. package/dist/forms-C3yovgH9.js +0 -141
  248. package/dist/forms-C3yovgH9.js.map +0 -1
  249. package/dist/i18n-BnnhTFOS.js.map +0 -1
  250. package/dist/media-Di2Ta22s.js.map +0 -1
  251. package/dist/motion-qPj_TYGv.js.map +0 -1
  252. package/dist/mount-SM07RUa6.js.map +0 -1
  253. package/dist/plugin-cPoOHFLY.js.map +0 -1
  254. package/dist/reactive-Cfv0RK6x.js +0 -233
  255. package/dist/reactive-Cfv0RK6x.js.map +0 -1
  256. package/dist/router-BrthaP_z.js +0 -473
  257. package/dist/router-BrthaP_z.js.map +0 -1
  258. package/dist/ssr-B2qd_WBB.js.map +0 -1
  259. package/dist/store-DWpyH6p5.js.map +0 -1
  260. package/dist/testing-CsqjNUyy.js.map +0 -1
  261. package/dist/untrack-DJVQQ2WM.js +0 -33
  262. package/dist/untrack-DJVQQ2WM.js.map +0 -1
package/dist/full.umd.js CHANGED
@@ -1,10 +1,10 @@
1
- (function(y,se){typeof exports=="object"&&typeof module<"u"?se(exports):typeof define=="function"&&define.amd?define(["exports"],se):(y=typeof globalThis<"u"?globalThis:y||self,se(y.bQuery={}))})(this,function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Module"});var se="bquery-sanitizer",$n=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"]),kt=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),kn=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"]),Ln=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),Tn=["on","formaction","xlink:","xmlns:"],Lt=["javascript:","data:","vbscript:","file:"],On=(e,t,r)=>{const n=e.toLowerCase();for(const s of Tn)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},Rn=e=>{const t=e.toLowerCase().trim();return!kn.has(t)},Mn=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(),Tt=e=>{const t=Mn(e);for(const r of Lt)if(t.startsWith(r))return!1;return!0},Nn=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!Tt(n))return!1}return!0},_n=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}},Dn=e=>new DOMParser().parseFromString(e,"text/html"),Ot=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=Dn(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},De=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:i=!1}=t,o=new Set([...$n,...r.map(c=>c.toLowerCase())].filter(c=>!kt.has(c))),a=new Set([...Ln,...n.map(c=>c.toLowerCase())]),l=Ot(e);if(i)return l.textContent??"";const f=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT),u=[];for(;f.nextNode();){const c=f.currentNode,p=c.tagName.toLowerCase();if(kt.has(p)){u.push(c);continue}if(!o.has(p)){u.push(c);continue}const v=[];for(const b of Array.from(c.attributes)){const g=b.name.toLowerCase();if(!On(g,a,s)){v.push(b.name);continue}if((g==="id"||g==="name")&&!Rn(b.value)){v.push(b.name);continue}if((g==="href"||g==="src"||g==="action")&&!Tt(b.value)){v.push(b.name);continue}g==="srcset"&&!Nn(b.value)&&v.push(b.name)}for(const b of v)c.removeAttribute(b);if(p==="a"){const b=c.getAttribute("href"),g=c.getAttribute("target")?.toLowerCase()==="_blank",w=b&&_n(b);if(g||w){const S=c.getAttribute("rel"),M=new Set(S?S.split(/\s+/).filter(Boolean):[]);M.add("noopener"),M.add("noreferrer"),c.setAttribute("rel",Array.from(M).join(" "))}}}for(const c of u)c.remove();const m=c=>{const p=document.createElement("div");return p.appendChild(c.cloneNode(!0)),p.innerHTML},h=m(l),d=m(Ot(h));return h!==d?l.textContent??"":d},Rt=Symbol("bquery.trusted-html.brand"),Ye=Symbol("bquery.trusted-html"),Mt=e=>e,Pn=e=>{const t=String(e);return Object.freeze({[Rt]:!0,[Ye]:t,toString:()=>t})},In=e=>typeof e=="object"&&e!==null&&Rt in e&&Ye in e,qn=e=>e[Ye],Nt=1024,_t=8192,xn=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>Nt)throw new RangeError(`generateNonce length must not exceed ${Nt}`);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+=_t){const s=t.subarray(n,Math.min(n+_t,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},jn=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},Pe=null,Dt=!1,zn=()=>typeof window<"u"&&typeof window.trustedTypes<"u",Pt=()=>{if(Pe)return Pe;if(Dt||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;Dt=!0;try{return Pe=e.trustedTypes.createPolicy(se,{createHTML:t=>De(t)}),Pe}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${se}": ${r}`),null}},Fn=e=>{const t=Pt();return t?t.createHTML(e):De(e)},V=(e,t={})=>Mt(De(e,t)),It=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return e.replace(/[&<>"'`]/g,r=>t[r])},Bn=e=>De(e,{stripAllTags:!0}),qt=e=>Array.isArray(e)?e:[e],_=(e,t)=>{for(const r of e)t(r)},he=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},Ie=(e,t,r)=>{if(!he(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 i=s.getComputedStyle(e),o=Number.parseFloat(i.getPropertyValue(t==="width"?"margin-left":"margin-top")),a=Number.parseFloat(i.getPropertyValue(t==="width"?"margin-right":"margin-bottom")),l=Number.isNaN(o)?0:o,f=Number.isNaN(a)?0:a;return n+l+f},xt=e=>V(e),Hn=(e,t)=>{e.innerHTML=V(t)},jt=e=>{const t=document.createElement("template");return t.innerHTML=V(e),t.content.firstElementChild??document.createElement("div")},zt=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,V(t));return}const n=qt(t);_(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})};function me(e){return Object.prototype.toString.call(e)==="[object Object]"}function I(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function Qn(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function pe(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))I(n)||(me(s)&&me(t[n])?t[n]=pe(t[n],s):t[n]=s);return t}function Un(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function Vn(e,t){const r={...e};for(const n of t)delete r[n];return r}function Wn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Kn=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},Ft=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!Kn(n))continue;const s=n.name;if(!(!s||n.disabled||I(s))){if(n.tagName.toLowerCase()==="input"){const i=n,o=i.type.toLowerCase();if(o==="checkbox"||o==="radio"){i.checked&&t.push([s,i.value]);continue}if(o==="file"||o==="submit"||o==="button"||o==="reset"||o==="image")continue;t.push([s,i.value]);continue}if(n.tagName.toLowerCase()==="select"){const i=n;if(i.multiple)for(const o of Array.from(i.selectedOptions))t.push([s,o.value]);else t.push([s,i.value]);continue}t.push([s,n.value])}}return t},Bt=e=>{if(typeof FormData=="function")try{const t=[];for(const[r,n]of new FormData(e).entries())I(r)||typeof n!="string"||t.push([r,n]);return t.length>0?t:Ft(e)}catch{}return Ft(e)},ie=class $t{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 Hn(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"?jt(t):t;return this.element.replaceWith(r),new $t(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 he(this.element)?this.element.offsetParent:null}position(){if(!he(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}outerWidth(t=!1){return Ie(this.element,"width",t)}outerHeight(t=!1){return Ie(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 $t(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}`,i=o=>{const a=o.target.closest(r);a&&this.element.contains(a)&&n(o,a)};return this.delegatedHandlers.has(s)||this.delegatedHandlers.set(s,new Map),this.delegatedHandlers.get(s).set(n,i),this.element.addEventListener(t,i),this}undelegate(t,r,n){const s=`${t}:${r}`,i=this.delegatedHandlers.get(s);if(i){const o=i.get(n);o&&(this.element.removeEventListener(t,o),i.delete(n),i.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 Bt(t))if(Object.prototype.hasOwnProperty.call(r,n)){const i=r[n];Array.isArray(i)?i.push(s):r[n]=[i,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 Bt(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){zt(this.element,t,r)}},qe=class Ke{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 ie(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 ie(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new Ke(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new ie(t))}addClass(...t){return _(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return _(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return _(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(_(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return _(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return _(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??"":(_(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=xt(t);return _(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return _(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 _(this.elements,i=>{i.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 _(this.elements,n=>{for(const[s,i]of Object.entries(t))n.style.setProperty(s,i)}),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 i=typeof t=="string"?jt(t):s===0?t:t.cloneNode(!0);n.replaceWith(i),r.push(i)}),new Ke(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 he(t)?t.offsetParent:null}position(){const t=this.first();return he(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}outerWidth(t=!1){return Ie(this.first(),"width",t)}outerHeight(t=!1){return Ie(this.first(),"height",t)}show(t=""){return _(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return _(this.elements,t=>{t.style.display="none"}),this}on(t,r){return _(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return _(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return _(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return _(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return _(this.elements,i=>{const o=l=>{const f=l.target.closest(r);f&&i.contains(f)&&n(l,f)};this.delegatedHandlers.has(i)||this.delegatedHandlers.set(i,new Map);const a=this.delegatedHandlers.get(i);a.has(s)||a.set(s,new Map),a.get(s).set(n,o),i.addEventListener(t,o)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return _(this.elements,i=>{const o=this.delegatedHandlers.get(i);if(!o)return;const a=o.get(s);if(!a)return;const l=a.get(n);l&&(i.removeEventListener(t,l),a.delete(n),a.size===0&&o.delete(s),o.size===0&&this.delegatedHandlers.delete(i))}),this}find(t){const r=new Set,n=[];for(const s of this.elements){const i=s.querySelectorAll(t);for(let o=0;o<i.length;o++)r.has(i[o])||(r.add(i[o]),n.push(i[o]))}return new Ke(n)}remove(){return _(this.elements,t=>t.remove()),this}empty(){return _(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=xt(t);_(this.elements,i=>{i.insertAdjacentHTML(r,s)});return}const n=qt(t);this.elements.forEach((s,i)=>{zt(s,i===0?n:n.map(o=>o.cloneNode(!0)),r)})}},Yn=e=>{if(typeof e!="string")return new ie(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new ie(t)},Jn=e=>Array.isArray(e)?new qe(e):e instanceof NodeList?new qe(Array.from(e)):new qe(Array.from(document.querySelectorAll(e)));function Gn(e){return e==null?[]:Array.isArray(e)?e:[e]}function Xn(e){return Array.from(new Set(e))}function Zn(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 es(e){return e.filter(Boolean)}function ts(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function rs(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 ss(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function is(){}function os(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function as(e){return new Promise(t=>setTimeout(t,e))}function ls(e,t){try{return JSON.parse(e)}catch{return t}}function cs(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 us(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 ds(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 ms(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function ps(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function ys(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function gs(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 vs(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function bs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ws(e){return typeof Element<"u"&&e instanceof Element}function Es(e){return!!(e&&typeof e=="object"&&"elements"in e)}function Ss(e){return typeof e=="function"}function As(e){return typeof e=="string"}function Cs(e){return typeof e=="number"&&!Number.isNaN(e)}function $s(e){return typeof e=="boolean"}function ks(e){return Array.isArray(e)}function Ls(e){return e instanceof Date}function xe(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function Ts(e){return typeof e=="object"&&e!==null}var Os={clone:Qn,merge:pe,pick:Un,omit:Vn,hasOwn:Wn,debounce:rs,throttle:ns,once:ss,noop:is,uid:os,isElement:ws,isCollection:Es,isEmpty:cs,isPlainObject:me,isFunction:Ss,isString:As,isNumber:Cs,isBoolean:$s,isArray:ks,isDate:Ls,isPromise:xe,isObject:Ts,parseJson:ls,sleep:as,randomInt:us,clamp:fs,inRange:ds,toNumber:hs,capitalize:ms,toKebabCase:ps,toCamelCase:ys,truncate:gs,slugify:vs,escapeRegExp:bs,ensureArray:Gn,unique:Xn,chunk:Zn,compact:es,flatten:ts},oe=[],ye=0,Je=new Set,je=new WeakMap,Ge=(e,t)=>{oe.push(e);try{return t()}finally{oe.pop()}},Ht=()=>oe[oe.length-1],Xe=e=>{oe.push(void 0);try{return e()}finally{oe.pop()}},Qt=e=>{if(ye>0){Je.add(e);return}e()},Rs=()=>{for(const e of Array.from(Je)){Je.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},Ms=()=>{ye+=1},Ns=()=>{ye<=0||(ye-=1,ye===0&&Rs())},Ut=(e,t)=>{let r=je.get(e);r||(r=new Set,je.set(e,r)),r.add(t)},_s=(e,t)=>{const r=je.get(e);r&&r.delete(t)},ge=e=>{const t=je.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},ve=e=>{Ms();try{e()}finally{Ns()}},Vt={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"}},be=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>be(t));if(me(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=be(n);return t}return e},Ze=be(Vt),Ds=e=>(Ze=be(pe(Vt,Ze,e)),X()),X=()=>be(Ze),et=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)Qt(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=Xe(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=Ht();return e&&(this.subscribers.add(e),Ut(e,this)),this.dirty&&(this.dirty=!1,ge(this.markDirty),this.cachedValue=Ge(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=Xe(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,ge(this.markDirty),this.cachedValue=Ge(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,ge(this.markDirty),this.subscribers.clear()}},q=e=>new et(e),x=e=>{let t,r=!1;const n=()=>{if(t){try{t()}catch(i){console.error("bQuery reactive: Error in effect cleanup",i)}t=void 0}},s=()=>{if(!r){n(),ge(s);try{t=Ge(s,e)}catch(i){console.error("bQuery reactive: Error in effect",i)}}};return s(),()=>{r=!0,n(),ge(s)}},tt=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=Ht();return e&&(this.subscribers.add(e),Ut(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)Qt(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)_s(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},N=e=>new tt(e),ae=e=>Xe(e),Ps=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))}},Is=e=>typeof e=="function"?e():e.value,Wt=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},qs=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),xs=(e,t)=>e==null||qs(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),js=e=>typeof e=="function"?e():e,zs=(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))}},Fs=(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)},Bs=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)}`)}},rt=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},Hs=(e,t,r)=>{const n=t instanceof Request?rt(t.method):void 0;return e??n??(r?"POST":void 0)},Qs=(e,t,r)=>e||(t instanceof Request?void 0:r),Us=e=>{const t=rt(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}},Kt=(e,t={})=>{const r=t.immediate??!0,n=N(t.defaultValue),s=N(null),i=N("idle"),o=q(()=>i.value==="pending");let a=0,l=!1,f=()=>{};const u=()=>{a+=1,n.value=t.defaultValue,s.value=null,i.value="idle"},m=()=>{l||(l=!0,a+=1,f())},h=async()=>{if(l)return n.peek();const d=++a;i.value="pending",s.value=null;try{const c=await e(),p=t.transform?t.transform(c):c;return l||d!==a?n.peek():(n.value=p,i.value="success",t.onSuccess?.(p),p)}catch(c){const p=Ps(c);return l||d!==a||(s.value=p,i.value="error",t.onError?.(p)),n.peek()}};if(t.watch?.length){let d=!1;f=x(()=>{for(const c of t.watch??[])Is(c);if(!d){d=!0,r&&ae(()=>h());return}ae(()=>h())})}else r&&h();return{data:n,error:s,status:i,pending:o,execute:h,refresh:h,clear:u,dispose:m}},Yt=(e,t={})=>{const r=X().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch;return Kt(async()=>{const i=js(e),o=typeof i=="string"||i instanceof URL?Fs(i,t.baseUrl??r?.baseUrl):i instanceof Request&&t.query?new URL(i.url):null;o&&t.query&&zs(o,t.query);const a=Wt(r?.headers,i instanceof Request?i.headers:void 0,t.headers),l=t.body!=null,f=rt(t.method),u=Hs(f,i,l),m=u==="GET"||u==="HEAD"?u:null;if(l&&m)throw new Error(`Cannot send a request body with ${m} requests`);const h=Qs(f,i,u),d={...t,method:h,headers:a,body:xs(t.body,a)};delete d.baseUrl,delete d.query,delete d.parseAs,delete d.fetcher,delete d.defaultValue,delete d.immediate,delete d.watch,delete d.transform,delete d.onSuccess,delete d.onError;let c=o??i;i instanceof Request&&o&&o.toString()!==i.url&&(c=new Request(o.toString(),Us(i)));const p=await s(c,d);if(!p.ok)throw Object.assign(new Error(`Request failed with status ${p.status}`),{response:p,status:p.status,statusText:p.statusText});return Bs(p,n)},t)};function Vs(e={}){return(t,r={})=>{const n=e,s=pe({},n.query??{},r.query??{});return Yt(t,{...n,...r,headers:Wt(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var Ws=(e,t)=>{const r=q(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},Ks=(e,t)=>{let r=!1,n=null;try{if(n=globalThis.localStorage,n){const o=`__bquery_test_${Math.random().toString(36).slice(2,9)}__`,a="__test__";try{n.setItem(o,a),n.getItem(o),r=!0}finally{try{n.removeItem(o)}catch{}}}}catch{r=!1}let s=t;if(r&&n)try{const o=n.getItem(e);o!==null&&(s=JSON.parse(o))}catch{}const i=N(s);return r&&n&&x(()=>{try{n.setItem(e,JSON.stringify(i.value))}catch{}}),i},H=e=>({get value(){return e.value},peek(){return e.peek()}}),we=e=>e instanceof tt,nt=e=>e instanceof et,Ys=(e,t,r={})=>{const{immediate:n=!1,equals:s=Object.is}=r;let i,o=!0;return x(()=>{const a=e.value;if(o){o=!1,i=a,n&&t(a,void 0);return}s(a,i)||(t(a,i),i=a)})},Js=(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 i=r.prototype!==void 0&&r.prototype!==null,o=(i?Object.getOwnPropertyNames(r.prototype):[]).length>1,a=i&&r.prototype.constructor!==r,l=/^class\s/.test(Function.prototype.toString.call(r));if(o||a||l)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const f=n(e);if(f===void 0&&i)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},st=()=>{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}},Ee;function Z(e){const t=Ee;return Ee=e,t}function Jt(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){st()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function Gs(e){const t=Ee;if(!t)throw new Error("bQuery component: useSignal() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=N(e);return t.addDisposer(()=>r.dispose()),r}function Xs(e){const t=Ee;if(!t)throw new Error("bQuery component: useComputed() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=q(e);return t.addDisposer(()=>r.dispose()),r}function Zs(e){const t=Ee;if(!t)throw new Error("bQuery component: useEffect() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=x(e);return t.addDisposer(r),r}var ei=["slot"],ti=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],Gt=(e,t)=>{const r=[...ei,...t.sanitize?.allowTags??[]],n=[...ti,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),o=(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,o!==!1?this.renderRootNode=this.attachShadow({mode:o}):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=Jt();const u=Z(this.scope);try{t.connected?.call(this)}catch(m){this.handleError(m)}finally{Z(u)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(u){this.handleError(u)}}mount(){if(this.hasMounted)return;const u=Z(this.ensureScope());let m=!1;try{t.beforeMount?.call(this),t.connected?.call(this)}catch(h){m=!0,this.handleError(h)}finally{Z(u)}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(u){this.handleError(u)}}attributeChangedCallback(u,m,h){try{const d=this.cloneProps();if(this.syncProps(),t.onAttributeChanged){const c=Z(this.ensureScope());try{t.onAttributeChanged.call(this,u,m,h)}finally{Z(c)}}this.hasMounted?this.render(!0,d,{name:u,oldValue:m,newValue:h}):this.isConnected&&this.missingRequiredProps.size===0&&this.mount()}catch(d){this.handleError(d)}}adoptedCallback(){if(!t.onAdopted)return;const u=Z(this.ensureScope());try{t.onAdopted.call(this)}catch(m){this.handleError(m)}finally{Z(u)}}handleError(u){t.onError?t.onError.call(this,u):console.error(`bQuery component error in <${e}>:`,u)}ensureScope(){return this.scope??(this.scope=Jt())}setState(u,m){this.state[u]=m,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 m=!0;this.signalEffectCleanup=x(()=>{try{for(const d of s)d.value;if(m){if(m=!1,u&&this.hasMounted&&this.isConnected){const d=this.cloneProps();ae(()=>{this.render(!0,d,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const h=this.cloneProps();ae(()=>{this.render(!0,h,void 0,!1)})}catch(h){this.handleError(h)}})}syncProps(){const u=t.props??{};for(const[m,h]of Object.entries(u)){const d=this.getAttribute(m);let c;if(d==null?h.required&&h.default===void 0?(this.missingRequiredProps.add(m),c=void 0):c=h.default??void 0:(this.missingRequiredProps.has(m)&&this.missingRequiredProps.delete(m),c=Js(d,h)),h.validator&&c!==void 0&&!h.validator(c))throw new Error(`bQuery component: validation failed for prop "${m}" with value ${JSON.stringify(c)}`);this.props[m]=c}}cloneProps(){return{...this.props}}render(u=!1,m,h,d=!0){try{if(u&&d&&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 c=(g,w)=>{this.dispatchEvent(new CustomEvent(g,{detail:w,bubbles:!0,composed:!0}))},p=this.renderRootNode,v=V(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:c}),{allowTags:r,allowAttributes:n});let b=null;if(t.styles&&(b=p.querySelector("style[data-bquery-component-style]")),p.innerHTML=v,t.styles){const g=b??document.createElement("style");b||g.setAttribute("data-bquery-component-style",""),g.textContent=t.styles,p.prepend(g)}u&&t.updated?.call(this,h)}catch(c){this.handleError(c)}}}return l};function ri(e,t){return Gt(e,t)}function le(e,t){const r=Gt(e,t);customElements.get(e)||customElements.define(e,r)}var Xt=Symbol("bquery.booleanAttribute"),ni=/^[^\0-\x20"'/>=]+$/,Zt=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[Xt]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},er=e=>Zt(e)?e.enabled?e.name:"":String(e??""),si={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},ii=e=>Zt(e)?e.enabled?e.name:"":er(e).replace(/[&<>"'`]/g,t=>si[t]),oi=(e,t)=>{if(!ni.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[Xt]:!0,enabled:!!t,name:e})},ce=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${er(t[s])}`,""),ai=(e,...t)=>{const r=n=>In(n)?qn(n):ii(n);return Mt(e.reduce((n,s,i)=>`${n}${s}${i<t.length?r(t[i]):""}`,""))},ze=`
1
+ (function(y,fe){typeof exports=="object"&&typeof module<"u"?fe(exports):typeof define=="function"&&define.amd?define(["exports"],fe):(y=typeof globalThis<"u"?globalThis:y||self,fe(y.bQuery={}))})(this,function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Module"});var fe="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},Ke=(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"),ft=Symbol("bquery.trusted-html"),Yt=e=>e,ds=e=>{const t=String(e);return Object.freeze({[Kt]:!0,[ft]:t,toString:()=>t})},hs=e=>typeof e=="object"&&e!==null&&Kt in e&&ft in e,ms=e=>e[ft],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},Ye=null,Xt=!1,ys=()=>typeof window<"u"&&typeof window.trustedTypes<"u",Zt=()=>{if(Ye)return Ye;if(Xt||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;Xt=!0;try{return Ye=e.trustedTypes.createPolicy(fe,{createHTML:t=>Ke(t)}),Ye}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${fe}": ${r}`),null}},gs=e=>{const t=Zt();return t?t.createHTML(e):Ke(e)},J=(e,t={})=>Yt(Ke(e,t)),er=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return e.replace(/[&<>"'`]/g,r=>t[r])},bs=e=>Ke(e,{stripAllTags:!0}),tr=e=>Array.isArray(e)?e:[e],q=(e,t)=>{for(const r of e)t(r)},de=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},Ge=(e,t)=>de(e)?t==="width"?e.clientWidth:e.clientHeight:0,Je=(e,t,r)=>{if(!de(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 he(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 me(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))x(n)||(he(s)&&he(t[n])?t[n]=me(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)},pe=class Ht{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 Ht(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 de(this.element)?this.element.offsetParent:null}position(){if(!de(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}innerWidth(){return Ge(this.element,"width")}innerHeight(){return Ge(this.element,"height")}outerWidth(t=!1){return Je(this.element,"width",t)}outerHeight(t=!1){return Je(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 Ht(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)}},Xe=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 pe(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 pe(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 pe(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 de(t)?t.offsetParent:null}position(){const t=this.first();return de(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}innerWidth(){return Ge(this.first(),"width")}innerHeight(){return Ge(this.first(),"height")}outerWidth(t=!1){return Je(this.first(),"width",t)}outerHeight(t=!1){return Je(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 pe(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new pe(t)},Ls=e=>Array.isArray(e)?new Xe(e):e instanceof NodeList?new Xe(Array.from(e)):new Xe(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 Te(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:me,pick:Ss,omit:As,hasOwn:Cs,debounce:ar,throttle:Ns,once:Ps,noop:Is,uid:_s,isElement:Gs,isCollection:Js,isEmpty:js,isPlainObject:he,isFunction:Xs,isString:Zs,isNumber:eo,isBoolean:to,isArray:ro,isDate:no,isPromise:Te,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},ve=[],ke=0,dt=new Set,Ze=new WeakMap,ht=(e,t)=>{ve.push(e);try{return t()}finally{ve.pop()}},lr=()=>ve[ve.length-1],mt=e=>{ve.push(void 0);try{return e()}finally{ve.pop()}},cr=e=>{if(ke>0){dt.add(e);return}e()},io=()=>{for(const e of Array.from(dt)){dt.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},ao=()=>{ke+=1},lo=()=>{ke<=0||(ke-=1,ke===0&&io())},ur=(e,t)=>{let r=Ze.get(e);r||(r=new Set,Ze.set(e,r)),r.add(t)},co=(e,t)=>{const r=Ze.get(e);r&&r.delete(t)},Le=e=>{const t=Ze.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},$e=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"}},Oe=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>Oe(t));if(he(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=Oe(n);return t}return e},pt=Oe(fr),uo=e=>(pt=Oe(me(fr,pt,e)),X()),X=()=>Oe(pt),Re=[],et=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")},Me=()=>{for(let e=Re.length-1;e>=0;e--)if(Re[e].active)return Re[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");Re.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{Re.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=Me();return et(t)&&t._addDisposer(()=>e.stop()),e},vo=()=>Me(),yo=e=>{const t=Me();if(!t||!t.active||!et(t))throw new Error("bQuery reactive: onScopeDispose() must be called inside an active effectScope");t._addDisposer(e)},De=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=mt(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=lr();return e&&(this.subscribers.add(e),ur(e,this)),this.dirty&&(this.dirty=!1,Le(this.markDirty),this.cachedValue=ht(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=mt(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,Le(this.markDirty),this.cachedValue=ht(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,Le(this.markDirty),this.subscribers.clear()}},P=e=>{const t=new De(e),r=Me();return et(r)&&r._addDisposer(()=>t.dispose()),t},j=e=>{let t,r=!1;const n=Me(),s=()=>{if(t){try{t()}catch(l){console.error("bQuery reactive: Error in effect cleanup",l)}t=void 0}},o=()=>{s(),Le(a)},i=()=>{r||(r=!0,o())};et(n)&&n._addDisposer(i);const a=()=>{if(!r){s(),Le(a);try{t=ht(a,e)}catch(l){console.error("bQuery reactive: Error in effect",l)}r&&o()}};return a(),i},Ne=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 Ne(e),ae=e=>mt(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)}`)}},vt=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},ko=(e,t,r)=>{const n=t instanceof Request?vt(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=vt(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,tt=e=>mr(e,"TimeoutError"),pr=e=>mr(e,"AbortError"),Ro=e=>{if(pr(e)||tt(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||tt(f)||tt(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=vt(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)||tt(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=me({},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 yt(e={}){const t=vr(),r=vr(),n=i=>{const a=me({},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(he(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=yt();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=yt({...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}},gt=new Map;function si(e,t){const r=gt.get(e);if(r)return r;const n=t().finally(()=>{gt.delete(e)});return gt.set(e,n),n}var Pe=e=>e instanceof Ne,bt=e=>e instanceof De,oi=e=>e instanceof Ne||e instanceof De||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,Bt()},V)},Ce=()=>{S!==void 0&&(clearTimeout(S),S=void 0)},Ft=()=>{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)},We=()=>{const N=typeof e=="function"?e():e;return N instanceof URL?N.toString():N},Bt=()=>{if(!L){Ce(),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(We(),r)}catch{d.value="CLOSED";return}E.onopen=N=>{d.value="OPEN";const B=$,V=k;k=0,g.value=0,$=!1,Ft(),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,Ce(),_(),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&&Bt(),{status:d,data:p,error:c,history:m,isConnected:w,reconnectAttempts:g,latency:b,lastDisconnectedAt:v,send:yu,sendRaw:ts,open:Bt,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},wt=()=>{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}},Ie;function ie(e){const t=Ie;return Ie=e,t}function Ar(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){wt()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function fi(e){const t=Ie;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=Ie;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=Ie;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 ye(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})},ge=(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]):""}`,""))},rt=`
2
2
  :host {
3
3
  color: inherit;
4
4
  font: inherit;
5
5
  }
6
- `,tr=`
7
- ${ze}
6
+ `,$r=`
7
+ ${rt}
8
8
  .field {
9
9
  display: inline-flex;
10
10
  flex-direction: column;
@@ -38,8 +38,8 @@
38
38
  color: #94a3b8;
39
39
  cursor: not-allowed;
40
40
  }
41
- `,z=e=>It(e),it=new WeakMap,ot=(e,t)=>it.get(e)?.[t],at=(e,t,r)=>{const n=it.get(e)??{};n[t]=r,it.set(e,n)},li=(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)},ci=(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)},ui=e=>["<textarea",' part="control"',' class="control"',` placeholder="${z(e.placeholder)}"`,` name="${z(e.name)}"`,` rows="${e.rows}"`,e.disabled?" disabled":"",`>${z(e.value)}</textarea>`].join(""),fi=(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 le(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
- ${ze}
41
+ `,F=e=>er(e),Et=new WeakMap,St=(e,t)=>Et.get(e)?.[t],At=(e,t,r)=>{const n=Et.get(e)??{};n[t]=r,Et.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 ye(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
+ ${rt}
43
43
  button {
44
44
  appearance: none;
45
45
  border: 0;
@@ -76,18 +76,18 @@
76
76
  cursor: not-allowed;
77
77
  opacity: 0.6;
78
78
  }
79
- `,render:({props:n})=>ce`
79
+ `,render:({props:n})=>ge`
80
80
  <button
81
81
  part="button"
82
- type="${z(n.type)}"
83
- data-variant="${z(n.variant)}"
84
- data-size="${z(n.size)}"
82
+ type="${F(n.type)}"
83
+ data-variant="${F(n.variant)}"
84
+ data-size="${F(n.size)}"
85
85
  ${n.disabled?"disabled":""}
86
86
  >
87
- <slot>${z(n.label)}</slot>
87
+ <slot>${F(n.label)}</slot>
88
88
  </button>
89
- `}),le(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
90
- ${ze}
89
+ `}),ye(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
90
+ ${rt}
91
91
  article {
92
92
  background: #fff;
93
93
  border: 1px solid #e2e8f0;
@@ -111,37 +111,37 @@
111
111
  footer {
112
112
  margin-top: 0.75rem;
113
113
  }
114
- `,render:({props:n})=>ce`
114
+ `,render:({props:n})=>ge`
115
115
  <article part="card" data-elevated="${String(n.elevated)}">
116
- ${n.title?`<header part="header">${z(n.title)}</header>`:""}
116
+ ${n.title?`<header part="header">${F(n.title)}</header>`:""}
117
117
  <section part="body"><slot></slot></section>
118
- ${n.footer?`<footer part="footer">${z(n.footer)}</footer>`:""}
118
+ ${n.footer?`<footer part="footer">${F(n.footer)}</footer>`:""}
119
119
  </article>
120
- `}),le(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:tr,beforeUpdate(n,s){return!li(this,n,s)},connected(){const n=s=>{const i=s.target;i?.matches("input")&&(s.stopPropagation(),this.setAttribute("value",i.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:i.value},bubbles:!0,composed:!0})))};at(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=ot(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ce`
120
+ `}),ye(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})))};At(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=St(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ge`
121
121
  <label part="field" class="field">
122
- ${n.label?`<span part="label" class="label">${z(n.label)}</span>`:""}
122
+ ${n.label?`<span part="label" class="label">${F(n.label)}</span>`:""}
123
123
  <input
124
124
  part="control"
125
125
  class="control"
126
- type="${z(n.type)}"
127
- value="${z(n.value)}"
128
- placeholder="${z(n.placeholder)}"
129
- name="${z(n.name)}"
126
+ type="${F(n.type)}"
127
+ value="${F(n.value)}"
128
+ placeholder="${F(n.placeholder)}"
129
+ name="${F(n.name)}"
130
130
  ${n.disabled?"disabled":""}
131
131
  />
132
132
  </label>
133
- `}),le(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:`${tr}
133
+ `}),ye(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}
134
134
  textarea.control {
135
135
  min-height: 6rem;
136
136
  resize: vertical;
137
137
  }
138
- `,beforeUpdate(n,s){return!ci(this,n,s)},connected(){const n=s=>{const i=s.target;i?.matches("textarea")&&(s.stopPropagation(),this.setAttribute("value",i.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:i.value},bubbles:!0,composed:!0})))};at(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=ot(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ce`
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})))};At(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=St(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ge`
139
139
  <label part="field" class="field">
140
- ${n.label?`<span part="label" class="label">${z(n.label)}</span>`:""}
141
- ${ui(n)}
140
+ ${n.label?`<span part="label" class="label">${F(n.label)}</span>`:""}
141
+ ${Ci(n)}
142
142
  </label>
143
- `}),le(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
144
- ${ze}
143
+ `}),ye(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
144
+ ${rt}
145
145
  label {
146
146
  align-items: center;
147
147
  color: #0f172a;
@@ -157,7 +157,7 @@
157
157
  input:disabled {
158
158
  cursor: not-allowed;
159
159
  }
160
- `,connected(){const n=s=>{const i=s.target;i?.matches('input[type="checkbox"]')&&(s.stopPropagation(),i.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:i.checked},bubbles:!0,composed:!0})))};at(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=ot(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>ce`
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})))};At(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=St(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>ge`
161
161
  <label part="label">
162
162
  <input
163
163
  part="control"
@@ -165,14 +165,14 @@
165
165
  ${n.checked?"checked":""}
166
166
  ${n.disabled?"disabled":""}
167
167
  />
168
- <span part="text"><slot>${z(n.label)}</slot></span>
168
+ <span part="text"><slot>${F(n.label)}</slot></span>
169
169
  </label>
170
- `}),r},lt=null,W=()=>lt!==null?lt:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,di=e=>{lt=e},rr=e=>typeof e=="string"||typeof e=="number",nr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ue=(e,t)=>{const r=e.style;if(Array.isArray(t)){const n=t[t.length-1];if(!n)return;for(const[s,i]of Object.entries(n))if(!(s==="offset"||s==="easing"||s==="composite")&&rr(i)){const o=s.startsWith("--")?s:nr(s);r.setProperty(o,String(i))}return}for(const[n,s]of Object.entries(t)){if(n==="offset"||n==="easing"||n==="composite")continue;const i=Array.isArray(s)?s[s.length-1]:s;if(rr(i)){const o=n.startsWith("--")?n:nr(n);r.setProperty(o,String(i))}}},Fe=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:i=!0,onFinish:o}=t;if(i&&W())return s&&ue(e,r),o?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&ue(e,r),o?.(),Promise.resolve()):new Promise(l=>{const f=a.animate(r,n);let u=!1;const m=()=>{u||(u=!0,s&&(typeof f.commitStyles=="function"?f.commitStyles():ue(e,r)),f.cancel(),o?.(),l())};f.onfinish=m,f.finished&&f.finished.then(m).catch(m)})},K=e=>Math.min(1,Math.max(0,e)),sr=e=>K(e),ir=e=>K(e*e),or=e=>K(1-(1-e)*(1-e)),ar=e=>K(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),lr=e=>K(e*e*e),cr=e=>K(1-Math.pow(1-e,3)),ur=e=>K(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),fr=e=>K(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),dr=e=>K(e===1?1:1-Math.pow(2,-10*e)),hi={linear:sr,easeInQuad:ir,easeOutQuad:or,easeInOutQuad:ar,easeInCubic:lr,easeOutCubic:cr,easeInOutCubic:ur,easeOutBack:fr,easeOutExpo:dr},ct=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},ut=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:i}=r,o=ct(e);if(o.width===0||o.height===0)return i?.(),Promise.resolve();const a=t.left-o.left,l=t.top-o.top,f=t.width/o.width,u=t.height/o.height;if(a===0&&l===0&&f===1&&u===1)return i?.(),Promise.resolve();const m=e;return typeof m.animate!="function"?(i?.(),Promise.resolve()):(m.style.transform=`translate(${a}px, ${l}px) scale(${f}, ${u})`,m.style.transformOrigin="top left",m.offsetHeight,new Promise(h=>{const d=m.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 p=()=>{c||(c=!0,m.style.transform="",m.style.transformOrigin="",i?.(),h())};d.onfinish=p,d.finished&&d.finished.then(p).catch(p)}))},mi=async(e,t,r={})=>{await hr(e,t,r)},hr=async(e,t,r={})=>{const{stagger:n,...s}=r,i=new Map;for(const l of e)i.set(l,ct(l));t();const o=e.length,a=e.map((l,f)=>{const u=i.get(l);if(!u)return Promise.resolve();const m=n?n(f,o):0;return m>0?new Promise(h=>setTimeout(h,m)).then(()=>ut(l,u,s)):ut(l,u,s)});await Promise.all(a)},pi={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)"}]},yi=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:i=!0,onComplete:o}=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 o?.(),Promise.resolve();const f=e.getBoundingClientRect(),u=l.style.display,m=l.style.visibility,h=l.style.transform,d=l.style.opacity,c=typeof getComputedStyle=="function"?getComputedStyle(l).display:u||"block",p=c==="none"?"block":u||c||"block",v=()=>{l.style.transform=h,l.style.opacity=d};l.style.visibility="hidden",l.style.display=p;const b=t.getBoundingClientRect();if(l.style.visibility=m,a.style.display="none",c==="none"?l.style.display=p:u==="none"?l.style.display="":l.style.display=u,i&&W())return v(),o?.(),Promise.resolve();const g=f.left-b.left,w=f.top-b.top,S=f.width/(b.width||1),M=f.height/(b.height||1);if(g===0&&w===0&&S===1&&M===1)return v(),o?.(),Promise.resolve();const T=[{transform:`translate(${g}px, ${w}px) scale(${S}, ${M})`,opacity:"0.5"},{transform:"translate(0, 0) scale(1, 1)",opacity:"1"}];return typeof l.animate!="function"?(v(),o?.(),Promise.resolve()):new Promise(E=>{const k=l.animate(T,{duration:n,easing:s,fill:"forwards"});let O=!1;const C=()=>{O||(O=!0,v(),k.cancel(),o?.(),E())};k.onfinish=C,k.finished&&k.finished.then(C).catch(C)})},gi=(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,i=e,o=i.style.transform;if(s&&W())return()=>{};let a=!1,l=!1,f=null;const u=()=>{l||(l=!0,window.removeEventListener("scroll",h),f!==null&&(cancelAnimationFrame(f),f=null),a=!1,i.style.transform=o)},m=()=>{if(l)return;if(s&&W()){u();return}const d=window.scrollY,c=window.scrollX;let p=0,v=0;(n==="vertical"||n==="both")&&(v=d*r),(n==="horizontal"||n==="both")&&(p=c*r);const b=`translate3d(${p}px, ${v}px, 0)`;i.style.transform=o?`${o} ${b}`:b},h=()=>{if(!l){if(s&&W()){u();return}a||(a=!0,f=requestAnimationFrame(()=>{f=null,m(),a=!1}))}};return m(),window.addEventListener("scroll",h,{passive:!0}),u},vi=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),bi=(e,t)=>{const r=vi(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:i,once:o=!0,onEnter:a,...l}=t;if(typeof IntersectionObserver>"u")return r.forEach(u=>{a?.(u),Fe(u,l)}),()=>{};const f=new IntersectionObserver(u=>{u.forEach(m=>{if(!m.isIntersecting)return;const h=m.target;a?.(h),Fe(h,l),o&&f.unobserve(h)})},{root:n,rootMargin:s,threshold:i});return r.forEach(u=>f.observe(u)),()=>f.disconnect()},wi={stiffness:100,damping:10,mass:1,precision:.01},Ei=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:i}={...wi,...t};let o=e,a=0,l=e,f=null,u=null,m=null;const h=new Set,d=()=>{for(const p of h)p(o)},c=p=>{const v=m!==null?(p-m)/1e3:.016666666666666666,b=Math.min(v,1/30);m=p;const g=o-l,w=(-r*g+-n*a)/s;if(a+=w*b,o+=a*b,d(),Math.abs(a)<i&&Math.abs(g)<i){o=l,a=0,f=null,d(),u?.(),u=null;return}f=requestAnimationFrame(c)};return{to(p){return l=p,f!==null&&cancelAnimationFrame(f),u?.(),m=null,new Promise(v=>{u=v,f=requestAnimationFrame(c)})},current(){return o},stop(){f!==null&&(cancelAnimationFrame(f),f=null),a=0,m=null,u?.(),u=null},onChange(p){return h.add(p),()=>h.delete(p)}}},Si={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},Ai=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(i,o=0)=>{const a=typeof n=="number"?n:n==="center"?(o-1)/2:n==="end"?o-1:0,l=Math.abs(i-a),f=o>1?Math.max(a,o-1-a):1,u=f===0?0:l/f;return r+(s?s(u)*f:l)*e}},ft=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},Ci=(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},$i=e=>{const t=ft(e?.duration),r=ft(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},mr=e=>{let t=0;return e.map(r=>{const n=Ci(r.at,t),s=ft(r.options?.delay),i=Math.max(0,n+s),o=$i(r.options),a=i+o;return t=Math.max(t,a),{step:r,start:i,end:a,duration:o}})},ki=async(e,t={})=>{const{stagger:r,onFinish:n}=t,s=e.length;for(let i=0;i<e.length;i+=1){const o=e[i],a=r?r(i,s):0;a>0&&await new Promise(l=>setTimeout(l,a)),await Fe(o.target,o)}n?.()},Li=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],i=0,o=!1,a=!1;const{commitStyles:l=!0,respectReducedMotion:f=!0,onFinish:u}=t,m=()=>{if(!a){if(a=!0,l)for(const d of s){const{animation:c,step:p}=d;typeof c.commitStyles=="function"?c.commitStyles():ue(p.target,p.keyframes),c.cancel()}n.forEach(d=>d()),u?.()}},h=()=>{s.forEach(({animation:c})=>c.cancel()),s=[],a=!1;const d=mr(r);if(i=d.length?Math.max(...d.map(c=>c.end)):0,f&&W()){l&&d.forEach(({step:c})=>ue(c.target,c.keyframes)),o=!0;return}if(d.some(({step:c})=>typeof c.target.animate!="function")){l&&d.forEach(({step:c})=>ue(c.target,c.keyframes)),o=!0;return}o=!1,s=d.map(({step:c,start:p})=>{const{delay:v,...b}=c.options??{};return{animation:c.target.animate(c.keyframes,{...b,delay:p,fill:b.fill??"both"}),step:c,start:p}})};return{add(d){r.push(d)},duration(){if(!r.length)return 0;if(!s.length){const d=mr(r);return Math.max(...d.map(c=>c.end))}return i},async play(){if(h(),o||s.length===0){m();return}const d=s.map(c=>c.animation.finished.catch(()=>{}));await Promise.all(d),m()},pause(){o||s.forEach(({animation:d})=>d.pause())},resume(){o||s.forEach(({animation:d})=>d.play())},stop(){s.forEach(({animation:d})=>d.cancel()),s=[],o=!1},seek(d){o||s.forEach(({animation:c})=>{c.currentTime=d})},onFinish(d){return n.add(d),()=>n.delete(d)}}},pr=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Ti=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,i=document.documentElement,o=pr(r.classes),a=pr(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&W()){await n(),r.onFinish?.();return}o.forEach(l=>i.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{o.forEach(l=>i.classList.remove(l))}},Oi=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:i=!1,cursorChar:o="|",loop:a=!1,loopDelay:l=1e3,respectReducedMotion:f=!0,onComplete:u}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const m=e;let h=!1,d=null,c=null,p=null,v=null;const b=()=>{if(!i)return;c=document.createElement("span"),c.setAttribute("aria-hidden","true"),c.textContent=o,m.appendChild(c);let S=!0;p=setInterval(()=>{c&&(S=!S,c.style.opacity=S?"1":"0")},530)},g=()=>{p!==null&&(clearInterval(p),p=null),c&&c.parentNode&&(c.parentNode.removeChild(c),c=null)},w=()=>{h||(h=!0,d!==null&&(clearTimeout(d),d=null),g(),v?.(),v=null)};return f&&W()?(m.textContent=t,u?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(S=>{v=S;const M=()=>{let T=0;m.textContent="",b();const E=document.createTextNode("");c?m.insertBefore(E,c):m.appendChild(E);const k=()=>{h||(T<t.length?(E.data=t.slice(0,T+1),T++,d=setTimeout(k,n)):(u?.(),a&&!h?d=setTimeout(()=>{h||(g(),M())},l):(g(),S(),v=null)))};d=setTimeout(k,s)};M()})}},Ri=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 i=t(r.transaction(this.storeName,e).objectStore(this.storeName));i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.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))}},Mi={async open(e){return new Ri(e)}},Ni=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)}},_i={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new Ni(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},Di=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 i=s.slice(t.length);try{return decodeURIComponent(i)}catch{return i}}}return null},Pi=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},Ii=(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("; ")},qi=(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=Di(e);let i=n.defaultValue??null;if(s!==null)try{i=n.deserialize?n.deserialize(s):Pi(s)?JSON.parse(s):s??i}catch(l){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,l),i=s??i}const o=N(i);if(typeof document>"u"||n.watch===!1)return o;let a=!1;return x(()=>{const l=o.value;if(!a){a=!0;return}if(l==null){Ii(e,n);return}qi(e,l,n)}),o},ji={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)}},zi=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),Fi=(e={})=>{const t=X().announcer,r={politeness:t?.politeness??"polite",atomic:t?.atomic??!0,delay:t?.delay??16,clearDelay:t?.clearDelay??1e3,...e},n=N("");if(typeof document>"u")return{element:null,message:n,announce(p){n.value=p},clear(){n.value=""},destroy(){n.value=""}};const s=r.id?document.getElementById(r.id):null,i=s??document.createElement("div"),o=!s;if(r.id&&(i.id=r.id),r.className&&(i.className=r.className),i.setAttribute("aria-live",r.politeness),i.setAttribute("aria-atomic",String(r.atomic)),i.setAttribute("role",r.politeness==="assertive"?"alert":"status"),i.setAttribute("data-bquery-announcer","true"),i.getAttribute("style")||i.setAttribute("style",zi),o){const p=r.container??document.body??document.documentElement;if(!p)return{element:null,message:n,announce(v){n.value=v},clear(){n.value=""},destroy(){n.value=""}};p.appendChild(i)}const a=x(()=>{i.textContent=n.value});let l,f,u=!1;const m=()=>{l&&(clearTimeout(l),l=void 0),f&&(clearTimeout(f),f=void 0)};return{element:i,message:n,announce:(p,v={})=>{if(u)return;const b=v.politeness??r.politeness,g=v.delay??r.delay,w=v.clearDelay??r.clearDelay;m(),i.setAttribute("aria-live",b),i.setAttribute("role",b==="assertive"?"alert":"status"),n.value="",l=setTimeout(()=>{u||(n.value=p,w>0&&(f=setTimeout(()=>{u||(n.value="")},w)))},g)},clear:()=>{u||(m(),n.value="")},destroy:()=>{u||(u=!0,m(),n.value="",a(),o&&i.remove())}}},yr=(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)}},gr=(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},Bi=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=[],i=document.title;r!==void 0&&(document.title=r);const o=[...e.meta??[]];e.description&&o.unshift({name:"description",content:e.description});for(const a of o){const l=gr("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=gr("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(yr(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(yr(document.body,e.bodyAttributes)),()=>{document.title=i;for(const a of s.reverse())a();for(const a of n)a.remove()}},vr=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}},Hi=class extends vr{constructor(){super(localStorage)}},Qi=class extends vr{constructor(){super(sessionStorage)}},Ui=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 i=t(r.transaction(this.options.store,e).objectStore(this.options.store));i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.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))}},Vi={local(){return new Hi},session(){return new Qi},indexedDB(e){return new Ui(e)}},br=null,Y=N({path:"",params:{},query:{},matched:null,hash:""}),wr=q(()=>Y.value),ee=()=>br,Er=e=>{br=e},Se=async(e,t={})=>{const r=ee();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},Wi=()=>{const e=ee();e?e.back():history.back()},Ki=()=>{const e=ee();e?e.forward():history.forward()},Yi="active",Ji=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),Gi=typeof HTMLElement<"u"?HTMLElement:class{},Sr=class extends Gi{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")??Yi}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=Ji(this.activeClass);this._trackedActiveClasses=new Map(r.map(n=>[n,this.classList.contains(n)])),this._cleanup=x(()=>{const n=Y.value.path,s=t?n===e:e==="/"?n==="/":n===e||n.startsWith(e.endsWith("/")?e:e+"/");for(const i of r){const o=this._trackedActiveClasses.get(i)??!1;this.classList.toggle(i,s||o)}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&&ee()&&Se(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},Xi=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",Sr)},Zi=(e,t={})=>r=>{r.preventDefault(),Se(e,t).catch(n=>{console.error("Navigation failed:",n)})},eo=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 i=ee();if(!i){n.preventDefault(),Se(s.pathname+s.search+s.hash).catch(f=>{console.error("Navigation failed:",f)});return}const o=i.base,a=i.hash;let l;if(a&&s.hash&&s.hash.startsWith("#/"))l=s.hash.slice(1);else{let f=s.pathname;o&&o!=="/"&&f.startsWith(o)&&(f=f.slice(o.length)||"/"),l=f+s.search+s.hash}n.preventDefault(),Se(l).catch(f=>{console.error("Navigation failed:",f)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},to=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{if(I(n))return;const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},ro=128,Ar=new Map,Cr=new Map,$r=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=ro)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},no=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 i=t.pop()??!1,o=e[n+1];if(i&&(o==="+"||o==="*"||o==="?"||o==="{"))return!0;i&&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},so=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 i=e.indexOf(">",n+3);if(i===-1)throw new Error(`bQuery router: Invalid route constraint named capture group: "${e}".`);t+="(?:",n=i;continue}t+="(";continue}t+="(?:";continue}t+=s}return t},dt=e=>{const t=Ar.get(e);if(t!==void 0)return t;const r=so(e);return $r(Ar,e,r),r},kr=e=>{const t=dt(e),r=Cr.get(t);if(r)return r;if(no(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 $r(Cr,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},Ae=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),Lr=e=>Ae(e)||e!==void 0&&e>="0"&&e<="9",Tr=(e,t)=>{let r=1,n="",s=t+1,i=!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==="["&&!i)i=!0;else if(o==="]"&&i)i=!1;else if(!i&&o==="(")r++;else if(!i&&o===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=o,s++}return null},io=(e,t)=>{const r=Tr(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},Or=new Set,Rr=(e,t)=>{if(e[t]!==":"||!Ae(e[t+1]))return null;let r=t+2;for(;r<e.length&&Lr(e[r]);)r++;let n=r,s;if(e[r]==="("){const i=io(e,r);s=i.constraint,n=i.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},oo=e=>{if(!Or.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&Ae(e[t+1])){const r=Rr(e,t);r?.constraint&&dt(r.constraint),t=r?.nextIndex??t+1;continue}t++}Or.add(e)}},ao=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},Mr=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&Ae(e[r+1]));)r++;return e.slice(t,r)},Nr=(e,t,r,n)=>{const s=[];let i=t;for(;i<=r;){const o=e.indexOf(n,i);if(o===-1||o>r)break;s.push(o),i=o+1}return s.reverse()},lo=(e,t)=>{const r=new Map,n=(s,i)=>{const o=`${s}:${i}`;if(r.has(o))return r.get(o)??null;if(s===e.length){const u=i===t.length?{}:null;return r.set(o,u),u}const a=e[s];if(a==="*"){if(s===e.length-1){const d={};return r.set(o,d),d}const u=Mr(e,s+1),m=u.length>0?Nr(t,i,t.length,u):null,h=(m?d=>{for(const c of m){const p=d(c);if(p)return p}return null}:d=>{for(let c=t.length;c>=i;c--){const p=d(c);if(p)return p}return null})(d=>{const c=n(s+1,d);return c?(r.set(o,c),c):null});return h||(r.set(o,null),null)}const l=Rr(e,s);if(l){const u=l.constraint?kr(l.constraint):void 0,m=l.constraint?t.length:ao(t,i),h=Mr(e,l.nextIndex),d=h.length>0?Nr(t,i,m,h):null,c=(d?p=>{for(const v of d){if(v<=i)continue;const b=p(v);if(b)return b}return null}:p=>{for(let v=m;v>i;v--){const b=p(v);if(b)return b}return null})(p=>{const v=t.slice(i,p);if(u&&!u.test(v))return null;const b=n(l.nextIndex,p);if(b){const g={[l.name]:v,...b};return r.set(o,g),g}return null});return c||(r.set(o,null),null)}if(i>=t.length||a!==t[i])return r.set(o,null),null;const f=n(s+1,i+1);return r.set(o,f),f};return n(0,0)},co=(e,t)=>{for(const r of t){oo(r.path);const n=lo(r.path,e);if(n)return{matched:r,params:n}}return null},Be=(e,t,r,n)=>{const s=co(e,n);return{path:e,params:s?.params??{},query:to(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},_r=(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(..._r(n.children,s))}return r},uo=(e,t={})=>{const r=ee();if(!r)throw new Error("bQuery router: No router initialized.");const n=r.routes.find(i=>i.name===e);if(!n)throw new Error(`bQuery router: Route "${e}" not found.`);let s="";for(let i=0;i<n.path.length;){if(n.path[i]===":"&&Ae(n.path[i+1])){let o=i+2;for(;o<n.path.length&&Lr(n.path[o]);)o++;let a=o,l=null;if(n.path[o]==="("){const m=Tr(n.path,o);if(!m)throw new Error(`bQuery router: Invalid constraint syntax in path "${n.path}" for route "${e}".`);l=m.constraint,a=m.endIndex}const f=n.path.slice(i+1,o),u=t[f];if(u===void 0)throw new Error(`bQuery router: Missing required param "${f}" for route "${e}".`);if(l&&!kr(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),i=a;continue}s+=n.path[i],i++}return s},fo=(e,t=!1)=>{const r=Y.value.path;return t?r===e:r.startsWith(e)},ho=(e,t=!1)=>q(()=>{const r=Y.value.path;return t?r===e:r.startsWith(e)}),mo=100,po=e=>{const t={};for(const[r,n]of Object.entries(e))I(r)||(t[r]=n);return t},yo=e=>{const t=ee();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:i=!1}=e,o=[],a=[],l=_r(r),f=new Map;let u="0",m=0,h=null;if(i&&typeof history<"u"&&"scrollRestoration"in history){h=history.scrollRestoration,history.scrollRestoration!=="manual"&&(history.scrollRestoration="manual");const E=history.state&&typeof history.state=="object"?history.state:{};if(typeof E.__bqScrollKey!="string"){const k=s?window.location.hash||"#/":`${window.location.pathname}${window.location.search}${window.location.hash}`;history.replaceState({...E,__bqScrollKey:u},"",k)}}const d=()=>history.state&&history.state.__bqScrollKey||u,c=()=>`${Date.now()}-${m++}`,p=(E=d())=>{if(i)for(f.has(E)&&f.delete(E),f.set(E,{x:window.scrollX,y:window.scrollY});f.size>mo;){const k=f.keys().next().value;if(k===void 0)break;f.delete(k)}},v=(E=d())=>{if(!i)return;const k=f.get(E);k?window.scrollTo(k.x,k.y):window.scrollTo(0,0)},b=()=>{const E=history.state&&typeof history.state=="object"?{...history.state}:{};return i&&(E.__bqScrollKey=u),E},g=()=>{if(s){const[k,O=""]=(window.location.hash.slice(1)||"/").split("#"),[C,L=""]=k.split("?");return{pathname:C,search:L?`?${L}`:"",hash:O?`#${O}`:""}}let E=window.location.pathname;return n&&(E===n||E.startsWith(n+"/"))&&(E=E.slice(n.length)||"/"),{pathname:E,search:window.location.search,hash:window.location.hash}},w=()=>{const{pathname:E,search:k,hash:O}=g();Y.value=Be(E,k,O,l)},S=async(E,k,O=new Set)=>{const{pathname:C,search:L,hash:A}=g(),$=Be(C,L,A,l),R=new URL(E,window.location.origin),P=`${R.pathname}${R.search}${R.hash}`;if(O.has(P))throw new Error(`bQuery router: redirect loop detected for path "${P}"`);O.add(P);const j=Be(R.pathname,R.search,R.hash,l);if(j.matched?.redirectTo){await S(j.matched.redirectTo,k,O);return}if(j.matched?.beforeEnter&&await j.matched.beforeEnter(j,$)===!1)return;for(const Ct of o)if(await Ct(j,$)===!1)return;p();const D=i?d():void 0,B=k==="replaceState"&&D?D:c(),ne=s?`#${E}`:`${n}${E}`,At=i&&history.state&&typeof history.state=="object"?po(history.state):{},Kl=i?{...At,__bqScrollKey:B}:{};history[k](Kl,"",ne),u=B,w(),i&&k==="pushState"&&window.scrollTo(0,0);for(const Ct of a)Ct(Y.value,$)},M=async E=>{const{pathname:k,search:O,hash:C}=g(),L=Y.value,A=Be(k,O,C,l);if(A.matched?.redirectTo){await S(A.matched.redirectTo,"replaceState");return}if(A.matched?.beforeEnter&&await A.matched.beforeEnter(A,L)===!1){const $=new URLSearchParams(Object.entries(L.query).flatMap(([D,B])=>Array.isArray(B)?B.map(ne=>[D,ne]):[[D,B]])).toString(),R=$?`?${$}`:"",P=L.hash?`#${L.hash}`:"",j=s?`#${L.path}${R}${P}`:`${n}${L.path}${R}${P}`;history.replaceState(b(),"",j);return}for(const $ of o)if(await $(A,L)===!1){const R=new URLSearchParams(Object.entries(L.query).flatMap(([B,ne])=>Array.isArray(ne)?ne.map(At=>[B,At]):[[B,ne]])).toString(),P=R?`?${R}`:"",j=L.hash?`#${L.hash}`:"",D=s?`#${L.path}${P}${j}`:`${n}${L.path}${P}${j}`;history.replaceState(b(),"",D);return}p(u),u=E.state?.__bqScrollKey??d(),w(),v(u);for(const $ of a)$(Y.value,L)};window.addEventListener("popstate",M),w();const T={push:E=>S(E,"pushState"),replace:E=>S(E,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:E=>history.go(E),beforeEach:E=>(o.push(E),()=>{const k=o.indexOf(E);k>-1&&o.splice(k,1)}),afterEach:E=>(a.push(E),()=>{const k=a.indexOf(E);k>-1&&a.splice(k,1)}),currentRoute:wr,routes:l,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",M),o.length=0,a.length=0,f.clear(),h!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=h),Er(null)}};return Er(T),T},fe=q(()=>Y.value),go={route:fe,path:q(()=>fe.value.path),params:q(()=>fe.value.params),query:q(()=>fe.value.query),hash:q(()=>fe.value.hash),matched:q(()=>fe.value.matched)},vo=()=>go,bo=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},wo=(e,t)=>{const r=bo();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},Eo=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},So=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},Dr=[],Ao=e=>{Dr.push(e)},Co=(e,t)=>{for(const r of Dr){const n=r({store:e,options:t});n&&Object.assign(e,n)}},Ce=new Map,$o=e=>Ce.has(e),ko=(e,t)=>{Ce.set(e,t)},$e=e=>Ce.get(e),ht=()=>Array.from(Ce.keys()),Lo=e=>{Ce.delete(e),Eo(e)},Pr=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,te=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(te);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,te(n)]));if(e instanceof Set)return new Set(Array.from(e).map(te));const t={};for(const r of Object.keys(e))t[r]=te(e[r]);return t},ke=(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,i]of e.entries())if(!t.has(s)||!ke(i,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 i=!1;for(const o of t.values())if(ke(s,o)){i=!0;break}if(!i)return!1}return!0}if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,i)=>ke(s,t[i]));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=>ke(e[s],t[s]))},To=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const i=e[s],o=t[s];r.get(s)===o&&Pr(i)&&Pr(o)&&!ke(i,o)&&n.push(s)}return n},Le=()=>st(),Ir=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if($o(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),$e(t);const i=r(),o=new Map;for(const g of Object.keys(i))o.set(g,N(i[g]));const a=[],l=[],f=(g,w,S)=>{!Le()||typeof console>"u"||typeof console.error!="function"||console.error(`[bQuery store "${t}"] Error in $onAction ${g} for action "${w}"`,S)},u=new WeakSet,m=(g,w)=>{!Le()||typeof console>"u"||typeof console.warn!="function"||u.has(g)||(u.add(g),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.`))},h=(g,w,S,M)=>{try{const T=S();xe(T)&&(g==="listener"&&M&&m(M,w),T.catch(E=>{f(g,w,E)}))}catch(T){f(g,w,T)}},d=()=>ae(()=>({...p})),c=()=>{const g=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(a.length===0&&!g)return;const w=d();for(const S of a)S(w);So(t,w)},p=new Proxy({},{get:(g,w)=>{const S=w;if(o.has(S))return o.get(S).value},ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:(g,w)=>{if(o.has(w))return{enumerable:!0,configurable:!0}},has:(g,w)=>o.has(w)}),v=new Map,b={};for(const g of Object.keys(i))Object.defineProperty(b,g,{get:()=>o.get(g).value,set:w=>{o.get(g).value=w,c()},enumerable:!0,configurable:!1});for(const g of Object.keys(n)){const w=n[g],S=q(()=>w(p,new Proxy({},{get:(M,T)=>{const E=T;if(v.has(E))return v.get(E).value}})));v.set(g,S),Object.defineProperty(b,g,{get:()=>S.value,enumerable:!0,configurable:!1})}for(const g of Object.keys(s)){const w=s[g],S=g;b[S]=function(...M){const T=new Proxy(b,{get:(A,$)=>typeof $=="string"&&o.has($)?o.get($).value:A[$],set:(A,$,R)=>typeof $=="string"&&o.has($)?(o.get($).value=R,c(),!0):Reflect.set(A,$,R)});if(l.length===0)return w.apply(T,M);const E=[],k=[],O=[...l],C={name:S,store:b,args:M,after:A=>{E.push($=>A($))},onError:A=>{k.push(A)}};for(const A of O)h("listener",S,()=>A(C),A);let L;try{L=w.apply(T,M)}catch(A){for(const $ of k)h("onError",S,()=>$(A));throw A}if(xe(L))return L.then(A=>{for(const $ of E)h("after",S,()=>$(A));return A},A=>{for(const $ of k)h("onError",S,()=>$(A));throw A});for(const A of E)h("after",S,()=>A(L));return L}}return Object.defineProperties(b,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const g=r();ve(()=>{for(const[w,S]of o)S.value=g[w]}),c()},writable:!1,enumerable:!1},$subscribe:{value:g=>(a.push(g),()=>{const w=a.indexOf(g);w>-1&&a.splice(w,1)}),writable:!1,enumerable:!1},$onAction:{value:g=>(l.push(g),()=>{const w=l.indexOf(g);w>-1&&l.splice(w,1)}),writable:!1,enumerable:!1},$patch:{value:g=>{ve(()=>{if(typeof g=="function"){const w=Le(),S=w?te(d()):null,M=w?new Map(Array.from(o.entries()).map(([E,k])=>[E,k.value])):null,T=d();if(g(T),w&&S&&M){const E=To(S,T,M);E.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${E.map(String).join(", ")}.
170
+ `}),r},Ct=null,Z=()=>Ct!==null?Ct:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,ki=e=>{Ct=e},Or=e=>typeof e=="string"||typeof e=="number",Rr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),be=(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))}}},nt=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:o=!0,onFinish:i}=t;if(o&&Z())return s&&be(e,r),i?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&be(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():be(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},Tt=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},kt=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:o}=r,i=Tt(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,Tt(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(()=>kt(l,u,s)):kt(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),nt(u,l)}),()=>{};const f=new IntersectionObserver(u=>{u.forEach(h=>{if(!h.isIntersecting)return;const d=h.target;a?.(d),nt(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}},Lt=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=Lt(e?.duration),r=Lt(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=Lt(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 nt(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():be(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})=>be(c.target,c.keyframes)),i=!0;return}if(p.some(({step:c})=>typeof c.target.animate!="function")){l&&p.forEach(({step:c})=>be(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),_e=M(0),st=M(!1),aa=U(st),Kr=()=>{_e.value===0&&(st.value=!0),_e.value+=1},Yr=()=>{const e=Math.max(0,_e.value-1);_e.value=e,e===0&&(st.value=!1)},la=()=>{_e.value=0,st.value=!1},le=()=>Vr,Gr=e=>{Vr=e},qe=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()&&qe(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(),qe(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(),qe(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(),qe(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},$t=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=$t(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}},xe=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),rn=e=>xe(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]!==":"||!xe(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]===":"&&xe(e[t+1])){const r=on(e,t);r?.constraint&&$t(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]===":"&&xe(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},ot=(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]===":"&&xe(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=ot(S,C,R,l)},E=async(S,C,R=new Set)=>{Kr();try{const{pathname:k,search:$,hash:T}=v(),O=ot(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=ot(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 We of i)if(await We(z,O)===!1)return;m();const _=o?p():void 0,H=C==="replaceState"&&_?_:c(),se=s?`#${S}`:`${n}${S}`,Ce=o&&history.state&&typeof history.state=="object"?Ra(history.state):{},Ft=o?{...Ce,__bqScrollKey:H}:{};history[C](Ft,"",se),u=H,w(),o&&C==="pushState"&&window.scrollTo(0,0);for(const We of a)We(te.value,O)}finally{Yr()}},L=async S=>{Kr();try{const{pathname:C,search:R,hash:k}=v(),$=te.value,T=ot(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(Ce=>[H,Ce]):[[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},we=P(()=>te.value),Da={route:we,path:P(()=>we.value.path),params:P(()=>we.value.params),query:P(()=>we.value.query),hash:P(()=>we.value.hash),matched:P(()=>we.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)}},je=new Map,fn=e=>je.has(e),za=(e,t)=>{je.set(e,t)},Ee=e=>je.get(e),Ot=()=>Array.from(je.keys()),Fa=e=>{je.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},Se=(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)||!Se(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(Se(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)=>Se(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=>Se(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)&&!Se(o,i)&&n.push(s)}return n},ze=()=>wt(),Rt=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.`),Ee(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)=>{!ze()||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)=>{!ze()||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();Te(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(Te($))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();$e(()=>{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=>{$e(()=>{if(typeof v=="function"){const w=ze(),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(", ")}.
171
171
  Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.
172
172
  To fix this, either:
173
173
  1. Replace the entire object: state.user = { ...state.user, name: "New" }
174
174
  2. Use $patchDeep() for automatic deep cloning
175
- See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[E,k]of Object.entries(T))o.has(E)&&(o.get(E).value=k)}else for(const[w,S]of Object.entries(g))o.has(w)&&(o.get(w).value=S)}),c()},writable:!1,enumerable:!1},$patchDeep:{value:g=>{ve(()=>{if(typeof g=="function"){const w=te(d());g(w);for(const[S,M]of Object.entries(w))o.has(S)&&(o.get(S).value=M)}else for(const[w,S]of Object.entries(g))o.has(w)&&(o.get(w).value=te(S))}),c()},writable:!1,enumerable:!1},$state:{get:()=>d(),enumerable:!1}}),ko(t,b),Co(b,e),wo(t,b),b},Oo=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Ro=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},Mo="__version",No={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},qr=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},_o=(e,t)=>{const r={...e};for(const[n,s]of Object.entries(t))I(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s);return r},Do=()=>{try{return globalThis.localStorage}catch{return}},Po=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??Do(),i=r.serializer??No,o=r.version,a=r.migrate,l=n+Mo;let f=s!==void 0&&o!==void 0,u=!1,m=!1;const h=p=>{if(!s||o===void 0)return!1;try{return s.setItem(l,String(o)),!0}catch(v){return p&&Le()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(p,v),!1}},d=e.state,c=Ir({...e,state:()=>{const p=d();if(!s)return p;try{const v=s.getItem(n);if(!v)return p;const b=i.deserialize(v);if(!qr(b))return p;let g=b;if(o!==void 0&&a){const w=s.getItem(l),S=w!==null?Number(w):0,M=Number.isFinite(S)?S:0;if(M!==o){f=!1,u=!0;const T=a(g,M);if(!qr(T))return p;g=T;let E=!1;try{s.setItem(n,i.serialize(g)),E=!0,m=!0}catch(k){Le()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`,k)}E&&h(`[bQuery store "${e.id}"] Failed to persist migrated version:`)&&(u=!1)}else f=!1}return _o(p,g)}catch{return p}}});return f&&s?h():u&&m&&h(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(u=!1),c.$subscribe(p=>{if(s)try{s.setItem(n,i.serialize(p)),u&&h(`[bQuery store "${e.id}"] Failed to persist migrated version after a successful state write:`)&&(u=!1)}catch{}}),c},xr=500,jr=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}},zr=new jr(xr),Fr=new jr(xr),Io=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return we(n)||nt(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),F=(e,t)=>{try{const r=Io(t);let n=zr.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),zr.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},He=(e,t)=>{try{let r=Fr.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),Fr.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Br=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",i=0,o=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&&(o===null?o=l:o===l&&(o=null)),s+=l;continue}if(o!==null){s+=l;continue}l==="("||l==="["||l==="{"?(i++,s+=l):l===")"||l==="]"||l==="}"?(i--,s+=l):l===","&&i===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 m=0;m<a.length;m++){const h=a[m];if(h==='"'||h==="'"||h==="`"){let d=0,c=m-1;for(;c>=0&&a[c]==="\\";)d++,c--;d%2===0&&(u===null?u=h:u===h&&(u=null));continue}if(u===null){if(h==="("||h==="["||h==="{")f++;else if(h===")"||h==="]"||h==="}")f--;else if(h===":"&&f===0){l=m;break}}}if(l>-1){const m=a.slice(0,l).trim().replace(/^['"]|['"]$/g,"");if(I(m))continue;t[m]=a.slice(l+1).trim()}}return t},qo=e=>(t,r,n,s)=>{const i=x(()=>{const o=F(r,n);o==null||o===!1?t.removeAttribute(e):o===!0?t.setAttribute(e,""):t.setAttribute(e,String(o))});s.push(i)},xo=(e,t,r,n)=>{let s=new Set;const i=x(()=>{const o=new Set;if(t.trimStart().startsWith("{")){const a=Br(t);for(const[l,f]of Object.entries(a)){const u=F(f,r);e.classList.toggle(l,!!u),o.add(l)}}else if(/^\s*\[/.test(t)){const a=F(t,r);if(Array.isArray(a))for(const l of a)l&&(e.classList.add(l),o.add(l))}else{const a=F(t,r);typeof a=="string"?a.split(/\s+/).forEach(l=>{l&&(e.classList.add(l),o.add(l))}):Array.isArray(a)&&a.forEach(l=>{l&&(e.classList.add(l),o.add(l))})}for(const a of s)o.has(a)||e.classList.remove(a);s=o});n.push(i)},jo=(e,t,r,n,s,i)=>{if(!r)return t;const o={...i,[n]:e};return s&&(o[s]=t),F(r,o)},zo=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,i,o,a)=>{const l=s.parentNode;if(!l)return;const f=i.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!f){console.error(`bQuery view: Invalid bq-for expression "${i}"`);return}const[,u,m,h]=f,d=s.getAttribute(":key")||s.getAttribute(`${t}-key`),c=s.cloneNode(!0);c.removeAttribute(`${t}-for`),c.removeAttribute(":key"),c.removeAttribute(`${t}-key`);const p=document.createComment(`bq-for: ${i}`);l.replaceChild(p,s);let v=new Map,b=[];const g=(T,E,k)=>{const O=c.cloneNode(!0),C=[],L=N(T),A=m?N(E):null,$={...o,[u]:L};return m&&A&&($[m]=A),r(O,$,t,C),n(O,$,t,C),{key:k,element:O,cleanups:C,item:T,index:E,itemSignal:L,indexSignal:A}},w=T=>{for(const E of T.cleanups)E();T.element.remove()},S=(T,E,k)=>{Object.is(T.item,E)||(T.item=E,T.itemSignal.value=E),T.index!==k&&(T.index=k,T.indexSignal&&(T.indexSignal.value=k))},M=x(()=>{const T=F(h,o);if(!Array.isArray(T)){for(const $ of v.values())w($);v.clear(),b=[];return}const E=[],k=new Map,O=new Set;T.forEach(($,R)=>{let P=jo($,R,d,u,m,o);O.has(P)&&(console.warn(`bq-for: Duplicate key "${String(P)}" detected at index ${R}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),P={__bqDuplicateKey:P,__bqIndex:R}),O.add(P),E.push(P),k.set(P,{item:$,index:R})});const C=[];for(const $ of b)k.has($)||C.push($);for(const $ of C){const R=v.get($);R&&(w(R),v.delete($))}const L=new Map;let A=p;for(let $=0;$<E.length;$++){const R=E[$],{item:P,index:j}=k.get(R);let D=v.get(R);D?(S(D,P,j),L.set(R,D),A.nextSibling!==D.element&&A.after(D.element),A=D.element):(D=g(P,j,R),L.set(R,D),A.after(D.element),A=D.element)}v=L,b=E});a.push(()=>{M();for(const T of v.values())for(const E of T.cleanups)E();v.clear()})}},Fo=e=>(t,r,n,s)=>{const i=x(()=>{const o=F(r,n),a=String(o??"");t.innerHTML=e?V(a):a});s.push(i)},Bo=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let i=!0;const o=x(()=>{const a=F(t,r);a&&!i?(s.replaceWith(e),i=!0):!a&&i&&(e.replaceWith(s),i=!1)});n.push(o)},Ho=(e,t,r,n)=>{const s=e,i=He(t,r);if(!we(i)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const o=i,a=s.type==="checkbox",l=s.type==="radio",f=()=>{a?s.checked=!!o.value:l?s.checked=o.value===s.value:s.value=String(o.value??"")},u=x(()=>{f()});n.push(u);const m=s.tagName==="SELECT"?"change":"input",h=()=>{a?o.value=s.checked:l?s.checked&&(o.value=s.value):o.value=s.value};s.addEventListener(m,h),n.push(()=>s.removeEventListener(m,h))},Qo=e=>(t,r,n,s)=>{const i=o=>{const a={...n,$event:o,$el:t};if(!r.includes("(")){const l=He(r,a);if(typeof l=="function"){l(o);return}return}He(r,a)};t.addEventListener(e,i),s.push(()=>t.removeEventListener(e,i))};function Uo(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var Vo=(e,t,r,n)=>{const s=He(t,r);we(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&Uo(s)&&(s.value=e,n.push(()=>{s.value=null}))},Wo=(e,t,r,n)=>{const s=e;let i=s.style.display;if(!i||i==="none"){const a=s.ownerDocument.defaultView?.getComputedStyle(s).display??"";i=a!=="none"?a:""}const o=x(()=>{const a=F(t,r);s.style.display=a?i:"none"});n.push(o)},Ko=(e,t,r,n)=>{const s=e;let i=new Set;const o=x(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const l=Br(t);for(const[f,u]of Object.entries(l)){const m=F(u,r),h=f.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(h,String(m??"")),a.add(h)}}else{const l=F(t,r);if(l&&typeof l=="object")for(const[f,u]of Object.entries(l)){const m=f.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(m,String(u??"")),a.add(m)}}for(const l of i)a.has(l)||s.style.removeProperty(l);i=a});n.push(o)},Yo=(e,t,r,n)=>{const s=x(()=>{const i=F(t,r);e.textContent=String(i??"")});n.push(s)},mt=null,Jo=e=>{mt=e},Go=e=>mt?mt(e):void 0,Qe=(e,t,r,n,s)=>{const i=Array.from(e.attributes);for(const o of i){const{name:a,value:l}=o;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=Go(f);u?u(e,l,t,n):st()&&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.`)}}},pt=(e,t,r,n,s)=>{const i=Array.from(e.children);for(const o of i)o.hasAttribute(`${r}-for`)?Qe(o,t,r,n,s):(Qe(o,t,r,n,s),pt(o,t,r,n,s))},yt=(e,t,r={})=>{const{prefix:n="bq",sanitize:s=!0}=r,i=typeof e=="string"?document.querySelector(e):e;if(!i)throw new Error(`bQuery view: Element "${e}" not found.`);if(i.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 o=[],a={text:Yo,html:Fo(s),if:Bo,show:Wo,class:xo,style:Ko,model:Ho,ref:Vo,for:zo({prefix:n,processElement:(f,u,m,h)=>Qe(f,u,m,h,a),processChildren:(f,u,m,h)=>pt(f,u,m,h,a)}),bind:qo,on:Qo};return((f,u,m)=>{const h=f.hasAttribute(`${n}-for`);Qe(f,u,n,m,a),h||pt(f,u,n,m,a)})(i,t,o),{el:i,context:t,update:f=>{Object.assign(t,f)},destroy:()=>{for(const f of o)f();o.length=0}}},Xo=(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:i="bq"}=t;if(s.hasAttribute(`${i}-for`)||s.hasAttribute(`${i}-if`)){const o=s.hasAttribute(`${i}-for`)?"for":"if";throw new Error(`bQuery view: Template root element cannot have ${i}-${o} directive. Wrap the ${i}-${o} element in a container instead.`)}return yt(s,r,t)},Zo=e=>e===!0||e===void 0,ea=async(e,t)=>{const r=e(t),n=xe(r)?await r:r;return Zo(n)?void 0:n},ta=e=>{const t=e.initialValue,r=N(t),n=N(""),s=N(!1),i=q(()=>!Object.is(r.value,t));return{value:r,error:n,isDirty:i,isTouched:s,isPristine:q(()=>!i.value),touch:()=>{s.value=!0},reset:()=>{r.value=t,n.value="",s.value=!1}}},Hr=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await ea(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},ra=e=>{const t=Object.entries(e.fields),r={},n={};for(const[h,d]of t){const c=ta(d);r[h]=c,n[h]=c.error}const s=N(!1),i=q(()=>{for(const h of Object.keys(r))if(r[h].error.value!=="")return!1;return!0}),o=q(()=>{for(const h of Object.keys(r))if(r[h].isDirty.value)return!0;return!1}),a=async h=>{const d=r[h],c=e.fields[h];!d||!c||await Hr(d,c.validators)},l=async()=>{let h=!1;for(const[d,c]of t){const p=r[d];await Hr(p,c.validators)&&(h=!0)}if(e.crossValidators&&e.crossValidators.length>0){const d=m();for(const c of e.crossValidators){const p=await c(d);if(p){for(const[v,b]of Object.entries(p))if(b){const g=r[v];g&&(g.error.value===""&&(g.error.value=b),h=!0)}}}}return!h},f=async()=>{if(!s.value){s.value=!0;try{if(!await l())return;e.onSubmit&&await e.onSubmit(m())}finally{s.value=!1}}},u=()=>{for(const h of Object.keys(r))r[h].reset()},m=()=>{const h={};for(const d of Object.keys(r))h[d]=r[d].value.value;return h};return{fields:r,errors:n,isValid:i,isDirty:o,isSubmitting:s,handleSubmit:f,validateField:a,validate:l,reset:u,getValues:m}},na=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,sa=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},ia=(e,t)=>{const r=t??`Must be at most ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length<=e?!0:r},oa=(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}},aa=(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}},la=(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}},ca=(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},ua=(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},fa=(e,t)=>r=>e(r)?!0:t,da=(e,t)=>async r=>await e(r)?!0:t,Qr=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},Ur=(e,t,r)=>{const{locale:n,...s}=r??{},i=typeof e=="number"?new Date(e):e;try{return new Intl.DateTimeFormat(t,s).format(i)}catch{return i.toLocaleString()}},Vr=(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},ha=(e,t)=>e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r),ma=(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]},Wr=(e,t,r,n)=>{let s;return e&&(s=Vr(e,t)),s===void 0&&n&&(s=Vr(n,t)),s===void 0?t:ha(ma(s,r),r)},Kr=(e,t)=>{const r=pe(e,t),n=s=>{if(Array.isArray(s))return s.map(o=>n(o));if(!me(s))return s;const i=Object.create(null);for(const[o,a]of Object.entries(s))I(o)||(i[o]=n(a));return i};return n(r)},pa=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=g=>Kr(Object.create(null),g),i=Object.create(null);for(const[g,w]of Object.entries(r))I(g)||(i[g]=s(w));const o=N(t),a=new Map,l=new Set(Object.keys(i));return{$locale:o,t:(g,w={})=>{const S=i[o.value];return Wr(S,g,w,n?i[n]:void 0)},tc:(g,w={})=>q(()=>{const S=i[o.value];return Wr(S,g,w,n?i[n]:void 0)}),loadLocale:(g,w)=>{I(g)||a.set(g,w)},ensureLocale:async g=>{if(I(g)||l.has(g))return;const w=a.get(g);if(!w)throw new Error(`bQuery i18n: No messages or loader registered for locale "${g}".`);const S=await w();i[g]=s(S.default??S),l.add(g)},n:(g,w)=>Qr(g,w?.locale??o.value,w),d:(g,w)=>Ur(g,w?.locale??o.value,w),getMessages:g=>{if(!I(g))return i[g]},mergeMessages:(g,w)=>{I(g)||(i[g]||(i[g]=Object.create(null),l.add(g)),i[g]=Kr(i[g],s(w)))},availableLocales:()=>{const g=new Set([...l,...a.keys()]);return Array.from(g).sort()}}},Ue=new Map,Te=new Map,ya=50,ga=e=>{const t=Ue.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),Ue.set(e,r),r},va=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=ga(t),n=Te.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{Te.delete(t),r.isConnected&&(r.textContent=e)},ya);Te.set(t,s)},ba=()=>{for(const e of Te.values())clearTimeout(e);Te.clear();for(const[,e]of Ue)e.remove();Ue.clear()},Q=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),wa=e=>{const t=[],r=e.querySelectorAll("img");for(const n of r)n.hasAttribute("alt")?n.getAttribute("alt")===""&&!n.hasAttribute("role")&&t.push(Q("info",'Image has empty alt text. Consider adding role="presentation" if decorative.',n,"img-decorative")):t.push(Q("error",'Image is missing an alt attribute. Add alt="" for decorative images or a descriptive alt text.',n,"img-alt"));return t},Ea=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 i=n.getAttribute("id"),o=i?!!e.querySelector(`label[for="${i}"]`):!1,a=n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby"),l=n.hasAttribute("title"),f=n.closest("label")!==null;!o&&!a&&!l&&!f&&t.push(Q("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},Sa=e=>{const t=[],r=e.querySelectorAll("button");for(const s of r){const i=(s.textContent??"").trim().length>0,o=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title");!i&&!o&&!a&&t.push(Q("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 i=(s.textContent??"").trim().length>0,o=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title"),l=s.querySelector("img[alt]")!==null;!i&&!o&&!a&&!l&&t.push(Q("error","Link has no accessible name. Add text content, aria-label, or title.",s,"link-name"))}return t},Aa=e=>{const t=[],r=e.querySelectorAll("h1, h2, h3, h4, h5, h6");let n=0;for(const s of r){const i=parseInt(s.tagName.charAt(1),10);n>0&&i>n+1&&t.push(Q("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(Q("warning","Heading element is empty.",s,"heading-empty")),n=i}return t},Ca=e=>{const t=[],r=e.querySelectorAll("[aria-labelledby]");for(const s of r){const i=(s.getAttribute("aria-labelledby")??"").split(/\s+/);for(const o of i)o&&!document.getElementById(o)&&t.push(Q("error",`aria-labelledby references "${o}" which does not exist in the document.`,s,"aria-labelledby-ref"))}const n=e.querySelectorAll("[aria-describedby]");for(const s of n){const i=(s.getAttribute("aria-describedby")??"").split(/\s+/);for(const o of i)o&&!document.getElementById(o)&&t.push(Q("error",`aria-describedby references "${o}" which does not exist in the document.`,s,"aria-describedby-ref"))}return t},$a=e=>{const t=[];return(e===document.body||e===document.documentElement)&&(e.querySelector("main")||e.querySelector('[role="main"]')||t.push(Q("warning",'Page is missing a <main> landmark. Add <main> or role="main" to the primary content area.',e,"landmark-main"))),t},ka=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...wa(t),...Ea(t),...Sa(t),...Aa(t),...Ca(t),...$a(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}},Yr=(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)}},Jr=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},La=()=>{const e=N("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=Yr(r,i=>{e.value=i.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return Jr(H(e),t)},Ta=()=>{const e=N("no-preference");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function"){let r,n,s;const i=()=>{!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)"),i();const o=[r,n,s].map(a=>Yr(a,()=>{i()})).filter(a=>a!==void 0);o.length>0&&(t=()=>{for(const a of o)a();e.dispose()})}catch{}}return Jr(H(e),t)},Oa=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:i}=r;let o=0;const a=new Map,l=()=>Array.from(e.querySelectorAll(t)),f=c=>{for(const p of c)a.has(p)||a.set(p,p.getAttribute("tabindex"))},u=c=>{const p=l();if(p.length===0)return;f(p);const v=Math.max(0,Math.min(c,p.length-1));for(let b=0;b<p.length;b++)p[b].setAttribute("tabindex",b===v?"0":"-1");o=v,p[v].focus(),i?.(p[v],v)},m=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}},h=c=>{if(!m(c.key))return;const p=l();if(p.length===0)return;c.preventDefault();let v=o;switch(c.key){case"ArrowDown":case"ArrowRight":v=o+1,v>=p.length&&(v=n?0:p.length-1);break;case"ArrowUp":case"ArrowLeft":v=o-1,v<0&&(v=n?p.length-1:0);break;case"Home":v=0;break;case"End":v=p.length-1;break}u(v)},d=l();f(d);for(let c=0;c<d.length;c++)d[c].setAttribute("tabindex",c===0?"0":"-1");return e.addEventListener("keydown",h),{destroy:()=>{e.removeEventListener("keydown",h);for(const[c,p]of a)p===null?c.removeAttribute("tabindex"):c.setAttribute("tabindex",p);a.clear()},focusItem:c=>{u(c)},activeIndex:()=>o}},gt=`
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=>{$e(()=>{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)?Ee(e):Rt({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&&ze()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(m,g),!1}},p=e.state,c=Rt({...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){ze()&&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?Se: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 Pe(n)||bt(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}},it=(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=it(t,r);if(!Pe(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=it(r,a);if(typeof l=="function"){l(i);return}return}it(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=it(t,r);Pe(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)},Mt=null,hl=e=>{Mt=e},ml=e=>Mt?Mt(e):void 0,at=(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):wt()&&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.`)}}},Dt=(e,t,r,n,s)=>{const o=Array.from(e.children);for(const i of o)i.hasAttribute(`${r}-for`)?at(i,t,r,n,s):(at(i,t,r,n,s),Dt(i,t,r,n,s))},Nt=(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)=>at(f,u,h,d,a),processChildren:(f,u,h,d)=>Dt(f,u,h,d,a)}),bind:el,on:al};return((f,u,h)=>{const d=f.hasAttribute(`${n}-for`);at(f,u,n,h,a),d||Dt(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 Nt(s,r,t)},vl=e=>e===!0||e===void 0,yl=async(e,t)=>{const r=e(t),n=Te(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=Te(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 Ne,Cl=e=>e instanceof De,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=me(e,t),n=s=>{if(Array.isArray(s))return s.map(i=>n(i));if(!he(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()}}},lt=new Map,Fe=new Map,jl=50,zl=e=>{const t=lt.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),lt.set(e,r),r},Fl=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=zl(t),n=Fe.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{Fe.delete(t),r.isConnected&&(r.textContent=e)},jl);Fe.set(t,s)},Bl=()=>{for(const e of Fe.values())clearTimeout(e);Fe.clear();for(const[,e]of lt)e.remove();lt.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}},Pt=`
176
176
  position: absolute;
177
177
  top: -9999px;
178
178
  left: -9999px;
@@ -185,9 +185,9 @@ See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[E,k]of Object.en
185
185
  border-radius: 0 0 4px 0;
186
186
  outline: 2px solid #4A90D9;
187
187
  outline-offset: 2px;
188
- `,Ra=`
188
+ `,Zl=`
189
189
  top: 0;
190
190
  left: 0;
191
- `,Gr=0,de=new Map,Ma=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,Na=()=>({destroy:()=>{},element:null}),_a=(e,t={})=>{if(!Ma())return Na();const{text:r="Skip to main content",className:n="bq-skip-link"}=t;let s,i;const o=p=>{try{return document.querySelector(p)}catch{return null}},a=()=>{if(!s)return;const p=de.get(s),v=(p?.count??0)-1;v<=0?(de.delete(s),p?.target.isConnected&&p.target.id===s&&p.target.removeAttribute("id")):de.set(s,{count:v,target:p.target}),s=void 0},l=()=>{if(!i)return;const{target:p,hadTabIndex:v,previousTabIndex:b}=i;p.isConnected&&(v?p.setAttribute("tabindex",b??""):p.removeAttribute("tabindex")),i=void 0},f=p=>{if(i?.target!==p){if(l(),p.hasAttribute("tabindex")){i={target:p,hadTabIndex:!0,previousTabIndex:p.getAttribute("tabindex")};return}p.tabIndex===-1&&(i={target:p,hadTabIndex:!1,previousTabIndex:null},p.setAttribute("tabindex","-1"))}},u=(p,v)=>{if(s===v)return;a();const b=de.get(v);de.set(v,{count:(b?.count??0)+1,target:p}),s=v},m=()=>{if(e.startsWith("#")){const v=e.slice(1),b=v?document.getElementById(v):null;return b||o(e)}const p=document.getElementById(e);return p||o(e)},h=p=>{if(p.id)return de.get(p.id)?.target===p&&u(p,p.id),p.id;let v;do Gr+=1,v=`bq-skip-target-${Gr}`;while(document.getElementById(v)!==null);return p.id=v,u(p,v),v},d=document.createElement("a"),c=m();return d.href=e.startsWith("#")?e:c?`#${h(c)}`:`#${e}`,d.textContent=r,d.className=n,d.setAttribute("style",gt),d.addEventListener("focus",()=>{d.setAttribute("style",gt+Ra)}),d.addEventListener("blur",()=>{d.setAttribute("style",gt)}),d.addEventListener("click",p=>{p.preventDefault();const v=m();v&&(d.href=`#${h(v)}`,f(v),v.focus())}),document.body.firstChild?document.body.insertBefore(d,document.body.firstChild):document.body.appendChild(d),{destroy:()=>{l(),a(),d.remove()},element:d}},Da=["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(", "),vt=e=>Array.from(e.querySelectorAll(Da)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),Xr=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,Pa=(e,t={})=>{const{escapeDeactivates:r=!0,onEscape:n,initialFocus:s,returnFocus:i}=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 o=document.activeElement;let a=!0;const l=m=>{if(!a)return;if(m.key==="Escape"&&r){m.preventDefault(),u.release(),n?.();return}if(m.key!=="Tab")return;const h=vt(e);if(h.length===0){m.preventDefault();return}const d=h[0],c=h[h.length-1];m.shiftKey?(document.activeElement===d||!e.contains(document.activeElement))&&(m.preventDefault(),c.focus()):(document.activeElement===c||!e.contains(document.activeElement))&&(m.preventDefault(),d.focus())};document.addEventListener("keydown",l,!0);const f=Xr(s,e);if(f)f.focus();else{const m=vt(e);m.length>0&&m[0].focus()}const u={get active(){return a},release:()=>{if(!a)return;a=!1,document.removeEventListener("keydown",l,!0);const m=Xr(i,document.body);m?m.focus():o&&o.focus&&o.focus()}};return u},Ia=e=>{e.release()},Oe=new Map,Zr=()=>{const e=Array.from(Oe.values());return e[e.length-1]},qa=(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(),i=parseFloat(e.style.left||"0"),o=parseFloat(e.style.top||"0"),a=Number.isNaN(i)?0:i,l=Number.isNaN(o)?0:o;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)}},xa=(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,ja=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:i=!1,ghostClass:o="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:l,onDrag:f,onDragEnd:u}=t;let m=!t.disabled,h=!1,d={x:0,y:0},c={x:0,y:0},p={x:0,y:0},v=null,b=null;const g=e.style.touchAction,w=e.style.userSelect,S=C=>({element:e,position:{...c},delta:{x:c.x-p.x,y:c.y-p.y},event:C}),M=()=>{const C=e.cloneNode(!0),L=e.getBoundingClientRect();return C.classList.add(o),C.style.position="fixed",C.style.left=`${L.left}px`,C.style.top=`${L.top}px`,C.style.width=`${L.width}px`,C.style.height=`${L.height}px`,C.style.pointerEvents="none",C.style.zIndex="999999",C.style.opacity="0.7",C.style.margin="0",document.body.appendChild(C),C},T=()=>{v&&(v.remove(),v=null),b=null},E=C=>{if(m&&!(s&&!C.target.closest(s))){if(C.preventDefault(),h=!0,d={x:C.clientX,y:C.clientY},p={...c},e.classList.add(a),e.setPointerCapture(C.pointerId),i){const L=e.getBoundingClientRect();b={x:L.left,y:L.top},v=M()}Oe.set(e,{element:e,position:c}),l?.(S(C))}},k=C=>{if(!h)return;C.preventDefault(),p={...c};let L=c.x+(C.clientX-d.x),A=c.y+(C.clientY-d.y);d={x:C.clientX,y:C.clientY},r==="x"&&(A=c.y),r==="y"&&(L=c.x);let $={x:L,y:A};if(n){const R=qa(e,n);$=xa($,R)}if(c=$,Oe.set(e,{element:e,position:c}),i&&v){const R=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};v.style.left=`${R.x+c.x}px`,v.style.top=`${R.y+c.y}px`}else e.style.transform=`translate(${c.x}px, ${c.y}px)`;f?.(S(C))},O=C=>{if(h){h=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(C.pointerId))&&e.releasePointerCapture(C.pointerId)}catch{}finally{T(),Oe.delete(e),u?.(S(C))}}};return e.addEventListener("pointerdown",E),e.addEventListener("pointermove",k),e.addEventListener("pointerup",O),e.addEventListener("pointercancel",O),e.style.touchAction="none",e.style.userSelect="none",{destroy:()=>{e.removeEventListener("pointerdown",E),e.removeEventListener("pointermove",k),e.removeEventListener("pointerup",O),e.removeEventListener("pointercancel",O),T(),Oe.delete(e),e.style.touchAction=g,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},za={passive:!0},Re=new Set,Me=null,J=null,en=()=>Array.from(Re),Fa=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",Ba=e=>{for(const t of en())t.handlePointerMove(e)},Ha=()=>{J=null;const e=Me;Me=null,e&&Ba(e)},tn=e=>{Me=e,J===null&&(J=requestAnimationFrame(Ha))},rn=e=>{J!==null&&(cancelAnimationFrame(J),J=null,Me=null);for(const t of en())t.handlePointerUp(e)},Qa=e=>{Re.size===0&&(document.addEventListener("pointermove",tn,za),document.addEventListener("pointerup",rn)),Re.add(e)},Ua=e=>{Re.delete(e),Re.size===0&&(document.removeEventListener("pointermove",tn),document.removeEventListener("pointerup",rn),J!==null&&(cancelAnimationFrame(J),J=null),Me=null)},nn=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,Va=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:i,onDragLeave:o,onDrop:a}=t;if(!Fa())return{destroy:()=>{}};let l=!1,f=null;const u=(b,g)=>({zone:e,dragged:b,event:g}),m=b=>{const g=e.getBoundingClientRect();return b.clientX>=g.left&&b.clientX<=g.right&&b.clientY>=g.top&&b.clientY<=g.bottom},h=()=>Zr()?.element??f,d=(b,g=f)=>{l&&(l=!1,e.classList.remove(r),g&&o?.(u(g,b)),f=null)},v={handlePointerMove:b=>{const g=Zr()?.element??null,w=m(b);if(!(g!==null&&g!==e&&nn(g,n))||!w){d(b,g??f);return}l?i?.(u(g,b)):(l=!0,f=g,e.classList.add(r),s?.(u(g,b)))},handlePointerUp:b=>{const g=h(),w=m(b),S=g!==null&&g!==e&&nn(g,n);w&&S&&g&&a?.(u(g,b)),l&&(l=!1,e.classList.remove(r)),f=null}};return Qa(v),{destroy:()=>{Ua(v),e.classList.remove(r),f=null}}},sn=(e,t)=>Array.from(e.querySelectorAll(t)),Wa=(e,t,r,n)=>{let s=null;for(let i=0;i<e.length;i++){const o=e[i];if(o===n)continue;const a=o.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:o,index:i,distance:l})}return s?{element:s.element,index:s.index}:null},Ka=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:i="bq-sort-placeholder",sortingClass:o="bq-sorting",animationDuration:a=200,onSortStart:l,onSortMove:f,onSortEnd:u}=t;let m=!t.disabled,h=!1,d=null,c=null,p=-1,v=0,b=0,g=0,w=0;const S=(O,C,L)=>({container:e,item:O,oldIndex:C,newIndex:L}),M=O=>{if(!m)return;const C=O.target,L=sn(e,r);let A=null;for(const R of L)if(R.contains(C)){A=R;break}if(!A||s&&!C.closest(s))return;O.preventDefault(),h=!0,d=A,p=L.indexOf(A),v=O.clientY,b=O.clientX;const $=A.getBoundingClientRect();g=$.top,w=$.left,c=document.createElement("div"),c.classList.add(i),c.style.width=`${$.width}px`,c.style.height=`${$.height}px`,c.style.boxSizing="border-box",A.classList.add(o),A.style.position="fixed",A.style.width=`${$.width}px`,A.style.height=`${$.height}px`,A.style.left=`${$.left}px`,A.style.top=`${$.top}px`,A.style.zIndex="999999",A.style.pointerEvents="none",A.style.margin="0",A.parentNode?.insertBefore(c,A),e.setPointerCapture(O.pointerId),l?.(S(A,p,p))},T=O=>{if(!h||!d||!c)return;O.preventDefault();const C=O.clientX-b,L=O.clientY-v;n==="y"?d.style.top=`${g+L}px`:d.style.left=`${w+C}px`;const A=Wa(sn(e,r),n==="y"?O.clientY:O.clientX,n,d);A?e.insertBefore(c,A.element):e.appendChild(c);const $=Array.from(e.children).indexOf(c);f?.(S(d,p,$))},E=O=>{if(!h||!d||!c)return;h=!1;const C=d,L=Array.from(e.children).indexOf(c),A=c.getBoundingClientRect(),$=C.getBoundingClientRect();if(a>0){const R=A.left-$.left,P=A.top-$.top;C.style.transition=`transform ${a}ms ease`,C.style.transform=`translate(${R}px, ${P}px)`;let j=!1,D=null;const B=()=>{j||(j=!0,D!==null&&(window.clearTimeout(D),D=null),k(),u?.(S(C,p,L)))};D=window.setTimeout(()=>{B()},a+50),C.addEventListener("transitionend",B,{once:!0})}else k(),u?.(S(C,p,L));e.releasePointerCapture(O.pointerId)},k=()=>{!d||!c||(c.parentNode?.insertBefore(d,c),c.remove(),c=null,d.classList.remove(o),d.style.position="",d.style.width="",d.style.height="",d.style.left="",d.style.top="",d.style.zIndex="",d.style.pointerEvents="",d.style.margin="",d.style.transition="",d.style.transform="",d=null)};return e.addEventListener("pointerdown",M),e.addEventListener("pointermove",T),e.addEventListener("pointerup",E),e.addEventListener("pointercancel",E),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",M),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",E),e.removeEventListener("pointercancel",E),e.style.touchAction="",h&&k()},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},Ya=e=>{const t=N(!1);let r;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const i=window.matchMedia(e);t.value=i.matches;const o=a=>{t.value=a.matches};if(typeof i.addEventListener=="function")i.addEventListener("change",o),r=()=>{i.removeEventListener("change",o)};else if(typeof i.addListener=="function"){const a=i;a.addListener(o),r=()=>{a.removeListener(o)}}}catch{}const n=H(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},Ja=e=>{const t={},r=[];for(const i of Object.keys(e)){const o=e[i],a=N(!1);let l;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const m=window.matchMedia(`(min-width: ${o}px)`);a.value=m.matches;const h=d=>{a.value=d.matches};if(typeof m.addEventListener=="function")m.addEventListener("change",h),l=()=>{m.removeEventListener("change",h)};else{const d=m;typeof d.addListener=="function"&&(d.addListener(h),l=()=>{d.removeListener?.(h)})}}catch{}const f=H(a);let u=!1;Object.defineProperty(f,"destroy",{enumerable:!1,configurable:!0,value(){u||(u=!0,l?.(),a.dispose())}}),r.push(f.destroy),t[i]=f}let n=!1;const s=Object.defineProperty(t,"destroyAll",{enumerable:!1,configurable:!0,value(){n||(n=!0,r.forEach(i=>{i()}))}});return Object.prototype.hasOwnProperty.call(t,"destroy")||Object.defineProperty(s,"destroy",{enumerable:!1,configurable:!0,value:s.destroyAll}),s},on=(e,t)=>t>=e?"portrait":"landscape",Ga=()=>{const e=N({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?on(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:on(window.innerWidth,window.innerHeight)}};window.addEventListener("resize",s),t=()=>{window.removeEventListener("resize",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value:()=>{n||(n=!0,t?.(),e.dispose())}}),r},an=()=>{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}},Xa=()=>{const e=N(an());let t;if(typeof window<"u"){const s=()=>{e.value=an()};window.addEventListener("online",s),window.addEventListener("offline",s);const i=typeof navigator<"u"?navigator:void 0;i?.connection&&typeof i.connection.addEventListener=="function"&&i.connection.addEventListener("change",s),t=()=>{window.removeEventListener("online",s),window.removeEventListener("offline",s),i?.connection&&typeof i.connection.removeEventListener=="function"&&i.connection.removeEventListener("change",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},Za={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},el=()=>{const e=N({...Za});let t,r=!1;typeof navigator<"u"&&"getBattery"in navigator&&typeof navigator.getBattery=="function"&&navigator.getBattery().then(s=>{if(r)return;const i=()=>{e.value={supported:!0,charging:s.charging,chargingTime:s.chargingTime,dischargingTime:s.dischargingTime,level:s.level}};i(),s.addEventListener("chargingchange",i),s.addEventListener("chargingtimechange",i),s.addEventListener("dischargingtimechange",i),s.addEventListener("levelchange",i),t=()=>{s.removeEventListener("chargingchange",i),s.removeEventListener("chargingtimechange",i),s.removeEventListener("dischargingtimechange",i),s.removeEventListener("levelchange",i)}}).catch(()=>{});const n=H(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},ln={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},tl=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,i=N({...ln});let o;if(typeof navigator<"u"&&"geolocation"in navigator){i.value={...ln,supported:!0,loading:!0};const f={enableHighAccuracy:t,maximumAge:r,timeout:n===1/0?void 0:n},u=h=>{i.value={supported:!0,loading:!1,latitude:h.coords.latitude,longitude:h.coords.longitude,accuracy:h.coords.accuracy,altitude:h.coords.altitude,altitudeAccuracy:h.coords.altitudeAccuracy,heading:h.coords.heading,speed:h.coords.speed,timestamp:h.timestamp,error:null}},m=h=>{i.value={...i.value,loading:!1,error:h.message}};if(s){const h=navigator.geolocation.watchPosition(u,m,f);o=()=>{navigator.geolocation.clearWatch(h)}}else navigator.geolocation.getCurrentPosition(u,m,f)}const a=H(i);let l=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){l||(l=!0,o?.(),i.dispose())}}),a},rl={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},nl={alpha:null,beta:null,gamma:null,absolute:!1},sl=()=>{const e=N({...rl});let t;if(typeof window<"u"){const s=i=>{e.value={acceleration:{x:i.acceleration?.x??null,y:i.acceleration?.y??null,z:i.acceleration?.z??null},accelerationIncludingGravity:{x:i.accelerationIncludingGravity?.x??null,y:i.accelerationIncludingGravity?.y??null,z:i.accelerationIncludingGravity?.z??null},rotationRate:{alpha:i.rotationRate?.alpha??null,beta:i.rotationRate?.beta??null,gamma:i.rotationRate?.gamma??null},interval:i.interval??0}};window.addEventListener("devicemotion",s),t=()=>{window.removeEventListener("devicemotion",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},il=()=>{const e=N({...nl});let t;if(typeof window<"u"){const s=i=>{e.value={alpha:i.alpha??null,beta:i.beta??null,gamma:i.gamma??null,absolute:i.absolute??!1}};window.addEventListener("deviceorientation",s),t=()=>{window.removeEventListener("deviceorientation",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},cn="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",ol={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(cn);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(cn);return navigator.clipboard.writeText(e)}},Ne=new Set,G=new Map;Jo(e=>G.get(e));var un=e=>{G.clear();for(const[t,r]of e)G.set(t,r)},al=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(G.has(t))throw new Error(`bQuery plugin directive: a directive named "${t}" is already registered`);G.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})}}),ll=(e,t)=>{if(!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(Ne.has(e.name))return;const r=[],n=al(r),s=new Map(G);try{e.install(n,t)}catch(i){throw un(s),i}try{for(const i of r)customElements.get(i.tagName)||customElements.define(i.tagName,i.constructor,i.options)}catch(i){throw un(s),i}Ne.add(e.name)},cl=e=>Ne.has(e),ul=()=>[...Ne],fl=e=>G.get(e),dl=()=>[...G.entries()].map(([e,t])=>({name:e,handler:t})),hl=()=>{Ne.clear(),G.clear()},_e=!1,bt={},re=[],Ve=new Map,fn=0,ml=(e,t)=>{_e=e,bt=t??{},e||(re.length=0,Ve.clear(),fn=0)},pl=()=>_e,yl=(e,t,r)=>{if(_e){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");Ve.set(e,{peek:t,subscriberCount:r})}},gl=e=>{Ve.delete(e)},vl=()=>`signal_${fn++}`,dn=()=>{const e=[];for(const[t,r]of Ve)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},hn=()=>{try{return ht().map(e=>{const t=$e(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[]}},mn=()=>{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 i=document.querySelectorAll(s);e.push({tagName:s,instanceCount:i.length})}}return e},bl=(e,t)=>{if(!_e)return;const r={timestamp:Date.now(),type:e,detail:t};re.push(r),bt.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},wl=()=>re,El=()=>{re.length=0},Sl=()=>({enabled:_e,options:{...bt},timeline:[...re]}),Al=()=>{const e=dn();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},Cl=()=>{const e=hn();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)})))},$l=()=>{const e=mn();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},kl=e=>{const t=typeof e=="number"&&e>0?re.slice(-e):re;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})))},pn=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),Ll=(e,t)=>{let r=1,n="",s=t+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==="(")r++;else if(i===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=i,s++}return null},yn=new Map,Tl=e=>{const t=dt(e),r=yn.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return yn.set(t,n),n};function Ol(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,i=document.createElement(e);if(r)for(const[a,l]of Object.entries(r))l!=null&&i.setAttribute(a,String(l));if(n)if(typeof n=="string")i.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>`)}i.innerHTML=a.join("")}return s.appendChild(i),{el:i,unmount:()=>{i.parentNode&&i.parentNode.removeChild(i)}}}function gn(){ve(()=>{})}function Rl(e){const t=N(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 Ml(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 i={},o=r.indexOf("?");if(o>=0){const a=r.slice(o+1);r=r.slice(0,o);for(const l of a.split("&")){const f=l.indexOf("="),u=f>=0?decodeURIComponent(l.slice(0,f)):decodeURIComponent(l),m=f>=0?decodeURIComponent(l.slice(f+1)):"",h=i[u];h!==void 0?Array.isArray(h)?h.push(m):i[u]=[h,m]:i[u]=m}}return{path:r||"/",query:i,hash:n}}function Nl(e,t){for(const r of t){const n=_l(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function _l(e,t){if(e==="*")return{};const r=new Map,n=(i,o)=>{const a=i.indexOf("/",o);return a===-1?i.length:a},s=(i,o)=>{const a=`${i}:${o}`;if(r.has(a))return r.get(a)??null;if(i===e.length){const u=o===t.length?{}:null;return r.set(a,u),u}const l=e[i];if(l==="*"){for(let u=t.length;u>=o;u--){const m=s(i+1,u);if(m)return r.set(a,m),m}return r.set(a,null),null}if(l===":"&&pn(e[i+1])){let u=i+2;for(;u<e.length&&pn(e[u]);)u++;const m=e.slice(i+1,u);let h=u,d,c=!1;if(e[u]==="("){const v=Ll(e,u);v&&(d=v.constraint,h=v.endIndex)}e[h]==="*"&&(c=!0,h++);const p=c||d?t.length:n(t,o);for(let v=p;v>o;v--){const b=t.slice(o,v);if(d&&!Tl(d).test(b))continue;const g=s(h,v);if(g){const w={[m]:b,...g};return r.set(a,w),w}}return r.set(a,null),null}if(o>=t.length||l!==t[o])return r.set(a,null),null;const f=s(i+1,o+1);return r.set(a,f),f};return s(0,0)}function Dl(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=o=>{const{path:a,query:l,hash:f}=Ml(o,r),{matched:u,params:m}=Nl(a,t);return{path:a,params:m,query:l,matched:u,hash:f}},i=N(s(n));return{push(o){i.value=s(o)},replace(o){i.value=s(o)},get currentRoute(){return i},get routes(){return t},destroy(){i.dispose()}}}function Pl(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:i=!0,detail:o}=r;let a;o!==void 0?a=new CustomEvent(t,{bubbles:n,cancelable:s,composed:i,detail:o}):a=new Event(t,{bubbles:n,cancelable:s,composed:i});const l=e.dispatchEvent(a);return gn(),l}async function Il(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(i=>setTimeout(i,n))}}var ql=(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 yt(e,t,s)},We=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),wt=e=>{const t={};for(const[r,n]of Object.entries(e))I(r)||(t[r]=n);return t},vn=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),xl=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),bn=(e={})=>{const{scriptId:t="__BQUERY_STORE_STATE__",globalKey:r="__BQUERY_INITIAL_STATE__",storeIds:n,serialize:s=JSON.stringify}=e;if(I(r))throw new Error(`serializeStoreState: invalid globalKey "${r}" - prototype-pollution keys are not allowed.`);if(I(t))throw new Error(`serializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);const i=n??ht(),o=Object.create(null);for(const u of i){if(I(u))continue;const m=$e(u);m&&(o[u]=wt(m.$state))}const a=s(o);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(!We(u))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const l=vn(a),f=vn(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${xl(t)}">window[${f}]=${l}<\/script>`}},jl=(e="__BQUERY_INITIAL_STATE__",t="__BQUERY_STORE_STATE__")=>{if(I(e))throw new Error(`deserializeStoreState: invalid globalKey "${e}" - prototype-pollution keys are not allowed.`);if(I(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(!We(r))return{};for(const s of Object.values(r))if(!We(s))return{};const n=Object.create(null);for(const[s,i]of Object.entries(r))I(s)||!We(i)||(n[s]=wt(i));return n},wn=(e,t)=>{const r=$e(e);r&&typeof r.$patch=="function"&&r.$patch(wt(t))},zl=e=>{for(const[t,r]of Object.entries(e))wn(t,r)},Fl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),En=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Bl=e=>En(e).replace(/"/g,"&quot;"),Hl=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"},Ql=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(),Ul=e=>{const t=Ql(e);return Lt.some(r=>t.startsWith(r))},Sn=e=>{if(e.nodeType===Node.TEXT_NODE)return En(e.textContent??"");if(e.nodeType!==Node.ELEMENT_NODE)return"";const t=e,r=t.tagName.toLowerCase();if(r==="script")return"";let n="";for(const i of t.attributes){const o=i.name.toLowerCase();o.startsWith("on")||Hl(o)&&Ul(i.value)||(n+=` ${i.name}="${Bl(i.value)}"`)}if(Fl.has(r))return`<${r}${n}>`;let s="";for(const i of t.childNodes)s+=Sn(i);return`<${r}${n}>${s}</${r}>`},An=e=>we(e)||nt(e)?e.value:e,U=(e,t)=>{const r=e.trim();if(r.startsWith("!"))return!U(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 i of n){if(s==null)return;s===t?s=An(s[i]):s=s[i]}return s}try{const n=Object.keys(t),s=n.map(i=>An(t[i]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},Vl=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},Et=(e,t,r,n)=>{const s=e.getAttribute(`${r}-if`);if(s!==null&&!U(s,t))return!1;const i=e.getAttribute(`${r}-show`);if(i!==null&&!U(i,t)){const h=e;h.style?h.style.display="none":e.setAttribute("style","display: none;")}const o=e.getAttribute(`${r}-text`);if(o!==null){const h=U(o,t);e.textContent=String(h??"")}const a=e.getAttribute(`${r}-html`);if(a!==null){const h=U(a,t);e.innerHTML=String(V(String(h??"")))}const l=e.getAttribute(`${r}-class`);if(l!==null){const h=l.trim();if(h.startsWith("{")){const d=h.slice(1,-1).trim().split(",");for(const c of d){const p=c.indexOf(":");if(p>-1){const v=c.slice(0,p).trim().replace(/^['"]|['"]$/g,"");U(c.slice(p+1).trim(),t)&&e.classList.add(v)}}}else{const d=U(l,t);typeof d=="string"?d.split(/\s+/).filter(Boolean).forEach(c=>e.classList.add(c)):Array.isArray(d)&&d.filter(Boolean).forEach(c=>e.classList.add(c))}}const f=e.getAttribute(`${r}-style`);if(f!==null){const h=U(f,t);if(h&&typeof h=="object"){const d=e;for(const[c,p]of Object.entries(h)){const v=c.replace(/([A-Z])/g,"-$1").toLowerCase();d.style.setProperty(v,String(p))}}}const u=Array.from(e.attributes);for(const h of u)if(h.name.startsWith(`${r}-bind:`)){const d=h.name.slice(`${r}-bind:`.length),c=U(h.value,t);c===!1||c===null||c===void 0?e.removeAttribute(d):c===!0?e.setAttribute(d,""):e.setAttribute(d,String(c))}const m=e.getAttribute(`${r}-for`);if(m!==null){const h=Vl(m);if(h){const d=U(h.listExpr,t);if(Array.isArray(d)&&e.parentNode){const c=e.parentNode;for(let p=0;p<d.length;p++){const v=d[p],b=e.cloneNode(!0);b.removeAttribute(`${r}-for`),b.removeAttribute(":key"),b.removeAttribute(`${r}-key`);const g={...t,[h.itemName]:v};h.indexName&&(g[h.indexName]=p),Et(b,g,r,n),St(b,g,r,n),c.insertBefore(b,e)}return c.removeChild(e),!0}}}return!0},St=(e,t,r,n)=>{const s=Array.from(e.children);for(const i of s){if(i.hasAttribute(`${r}-for`)){Et(i,t,r,n)||i.remove();continue}if(!Et(i,t,r,n)){i.remove();continue}St(i,t,r,n)}},Cn=(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))Cn(n,t)},Wl=(e,t,r={})=>{const{prefix:n="bq",stripDirectives:s=!1,includeStoreState:i=!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 o=new DOMParser().parseFromString(e.trim(),"text/html"),a=o.body||o.documentElement;if(!a)throw new Error("bQuery SSR: Failed to parse template.");if(St(a,t,n,o),s)for(const u of Array.from(a.children))Cn(u,n);let l="";for(const u of a.childNodes)l+=Sn(u);let f;return i&&(f=bn({storeIds:Array.isArray(i)?i:void 0}).stateJson),{html:l,storeState:f}};y.$=Yn,y.$$=Jn,y.BQueryCollection=qe,y.BQueryElement=ie,y.BqLinkElement=Sr,y.Computed=et,y.Signal=tt,y.animate=Fe,y.announceToScreenReader=va,y.auditA11y=ka,y.back=Wi,y.batch=ve,y.bool=oi,y.breakpoints=Ja,y.buckets=Mi,y.cache=_i,y.capturePosition=ct,y.clearAnnouncements=ba,y.clearTimeline=El,y.clipboard=ol,y.component=le,y.computed=q,y.createForm=ra,y.createI18n=pa,y.createPersistedStore=Po,y.createRouter=yo,y.createStore=Ir,y.createTemplate=Xo,y.createTrustedHtml=Fn,y.createUseFetch=Vs,y.currentRoute=wr,y.custom=fa,y.customAsync=da,y.defineBqueryConfig=Ds,y.defineComponent=ri,y.definePageMeta=Bi,y.deserializeStoreState=jl,y.destroyStore=Lo,y.draggable=ja,y.droppable=Va,y.easeInCubic=lr,y.easeInOutCubic=ur,y.easeInOutQuad=ar,y.easeInQuad=ir,y.easeOutBack=fr,y.easeOutCubic=cr,y.easeOutExpo=dr,y.easeOutQuad=or,y.easingPresets=hi,y.effect=x,y.email=aa,y.enableDevtools=ml,y.escapeHtml=It,y.fireEvent=Pl,y.flip=ut,y.flipElements=hr,y.flipList=mi,y.flushEffects=gn,y.formatDate=Ur,y.formatNumber=Qr,y.forward=Ki,y.generateNonce=xn,y.generateSignalLabel=vl,y.getBqueryConfig=X,y.getCustomDirective=fl,y.getCustomDirectives=dl,y.getDevtoolsState=Sl,y.getFocusableElements=vt,y.getInstalledPlugins=ul,y.getStore=$e,y.getTimeline=wl,y.getTrustedTypesPolicy=Pt,y.hasCSPDirective=jn,y.html=ce,y.hydrateMount=ql,y.hydrateStore=wn,y.hydrateStores=zl,y.inspectComponents=mn,y.inspectSignals=dn,y.inspectStores=hn,y.interceptLinks=eo,y.isActive=fo,y.isActiveSignal=ho,y.isComputed=nt,y.isDevtoolsEnabled=pl,y.isInstalled=cl,y.isSignal=we,y.isTrustedTypesSupported=zn,y.keyframePresets=pi,y.linear=sr,y.link=Zi,y.linkedSignal=Ws,y.listStores=ht,y.logComponents=$l,y.logSignals=Al,y.logStores=Cl,y.logTimeline=kl,y.mapActions=Ro,y.mapState=Oo,y.max=ua,y.maxLength=ia,y.mediaQuery=Ya,y.min=ca,y.minLength=sa,y.mockRouter=Dl,y.mockSignal=Rl,y.morphElement=yi,y.mount=yt,y.navigate=Se,y.notifications=ji,y.parallax=gi,y.pattern=oa,y.persistedSignal=Ks,y.prefersColorScheme=La,y.prefersContrast=Ta,y.prefersReducedMotion=W,y.readonly=H,y.recordEvent=bl,y.registerBqLink=Xi,y.registerDefaultComponents=fi,y.registerPlugin=Ao,y.releaseFocus=Ia,y.renderComponent=Ol,y.renderToString=Wl,y.required=na,y.resetPlugins=hl,y.resolve=uo,y.rovingTabIndex=Oa,y.safeHtml=ai,y.sanitize=V,y.sanitizeHtml=V,y.scrollAnimate=bi,y.sequence=ki,y.serializeStoreState=bn,y.setReducedMotion=di,y.signal=N,y.skipLink=_a,y.sortable=Ka,y.spring=Ei,y.springPresets=Si,y.stagger=Ai,y.storage=Vi,y.stripTags=Bn,y.timeline=Li,y.trackSignal=yl,y.transition=Ti,y.trapFocus=Pa,y.trusted=Pn,y.typewriter=Oi,y.untrack=ae,y.untrackSignal=gl,y.url=la,y.use=ll,y.useAnnouncer=Fi,y.useAsyncData=Kt,y.useBattery=el,y.useComputed=Xs,y.useCookie=xi,y.useDeviceMotion=sl,y.useDeviceOrientation=il,y.useEffect=Zs,y.useFetch=Yt,y.useGeolocation=tl,y.useNetworkStatus=Xa,y.useRoute=vo,y.useSignal=Gs,y.useViewport=Ga,y.utils=Os,y.waitFor=Il,y.watch=Ys});
191
+ `,Ln=0,Ae=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=Ae.get(s),g=(m?.count??0)-1;g<=0?(Ae.delete(s),m?.target.isConnected&&m.target.id===s&&m.target.removeAttribute("id")):Ae.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=Ae.get(g);Ae.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 Ae.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",Pt),p.addEventListener("focus",()=>{p.setAttribute("style",Pt+Zl)}),p.addEventListener("blur",()=>{p.setAttribute("style",Pt)}),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(", "),It=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=It(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=It(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()},Be=new Map,On=()=>{const e=Array.from(Be.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()}Be.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,Be.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(),Be.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(),Be.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},He=new Set,Ue=null,re=null,Rn=()=>Array.from(He),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=Ue;Ue=null,e&&fc(e)},Mn=e=>{Ue=e,re===null&&(re=requestAnimationFrame(dc))},Dn=e=>{re!==null&&(cancelAnimationFrame(re),re=null,Ue=null);for(const t of Rn())t.handlePointerUp(e)},hc=e=>{He.size===0&&(document.addEventListener("pointermove",Mn,cc),document.addEventListener("pointerup",Dn)),He.add(e)},mc=e=>{He.delete(e),He.size===0&&(document.removeEventListener("pointermove",Mn),document.removeEventListener("pointerup",Dn),re!==null&&(cancelAnimationFrame(re),re=null),Ue=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)}},Qe=new Set,ne=new Map,_t=()=>{hl(e=>ne.get(e))};_t();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(_t(),!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(Qe.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}Qe.add(e.name)},Dc=e=>Qe.has(e),Nc=()=>[...Qe],Pc=e=>ne.get(e),Ic=()=>[...ne.entries()].map(([e,t])=>({name:e,handler:t})),_c=()=>{Qe.clear(),ne.clear(),_t()},Ve=!1,qt={},ue=[],ct=new Map,zn=0,qc=(e,t)=>{Ve=e,qt=t??{},e||(ue.length=0,ct.clear(),zn=0)},xc=()=>Ve,jc=(e,t,r)=>{if(Ve){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");ct.set(e,{peek:t,subscriberCount:r})}},zc=e=>{ct.delete(e)},Fc=()=>`signal_${zn++}`,Fn=()=>{const e=[];for(const[t,r]of ct)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},Bn=()=>{try{return Ot().map(e=>{const t=Ee(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(!Ve)return;const r={timestamp:Date.now(),type:e,detail:t};ue.push(r),qt.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},Hc=()=>ue,Uc=()=>{ue.length=0},Qc=()=>({enabled:Ve,options:{...qt},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=$t(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(){$e(()=>{})}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 Nt(e,t,s)},ut=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),xt=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??Ot(),i=Object.create(null);for(const u of o){if(x(u))continue;const h=Ee(u);h&&(i[u]=xt(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(!ut(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(!ut(r))return{};for(const s of Object.values(r))if(!ut(s))return{};const n=Object.create(null);for(const[s,o]of Object.entries(r))x(s)||!ut(o)||(n[s]=xt(o));return n},Yn=(e,t)=>{const r=Ee(e);r&&typeof r.$patch=="function"&&r.$patch(xt(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=>Pe(e)||bt(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},jt=(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),jt(b,v,r,n),zt(b,v,r,n),c.insertBefore(b,e)}return c.removeChild(e),!0}}}return!0},zt=(e,t,r,n)=>{const s=Array.from(e.children);for(const o of s){if(o.hasAttribute(`${r}-for`)){jt(o,t,r,n)||o.remove();continue}if(!jt(o,t,r,n)){o.remove();continue}zt(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(zt(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}};y.$=ks,y.$$=Ls,y.BQueryCollection=Xe,y.BQueryElement=pe,y.BqLinkElement=Jr,y.Computed=De,y.HttpError=oe,y.Signal=Ne,y.animate=nt,y.announceToScreenReader=Fl,y.auditA11y=Yl,y.back=ca,y.batch=$e,y.bool=wi,y.breakpoints=bc,y.buckets=Qi,y.cache=Wi,y.capturePosition=Tt,y.clearAnnouncements=Bl,y.clearTimeline=Uc,y.clipboard=Oc,y.component=ye,y.computed=P,y.createForm=bl,y.createHttp=yt,y.createI18n=xl,y.createPersistedStore=Ja,y.createRequestQueue=Ko,y.createRestClient=ri,y.createRouter=Ma,y.createStore=Rt,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=kt,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=It,y.getInstalledPlugins=Nc,y.getStore=Ee,y.getTimeline=Hc,y.getTrustedTypesPolicy=Zt,y.hasCSPDirective=vs,y.html=ge,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=bt,y.isDevtoolsEnabled=xc,y.isInstalled=Dc,y.isNavigating=aa,y.isSignal=Pe,y.isTrustedTypesSupported=ys,y.keyframePresets=Oi,y.linear=Mr,y.link=pa,y.linkedSignal=Yo,y.listStores=Ot,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=Nt,y.navigate=qe,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});
192
192
 
193
193
  //# sourceMappingURL=full.umd.js.map