@bquery/bquery 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/README.md +221 -40
  2. package/dist/{a11y-_9X-kt-_.js → a11y-DgUQ8-fI.js} +3 -3
  3. package/dist/{a11y-_9X-kt-_.js.map → a11y-DgUQ8-fI.js.map} +1 -1
  4. package/dist/a11y.es.mjs +1 -1
  5. package/dist/{component-L3-JfOFz.js → component-D8ydhe58.js} +20 -19
  6. package/dist/{component-L3-JfOFz.js.map → component-D8ydhe58.js.map} +1 -1
  7. package/dist/component.es.mjs +1 -1
  8. package/dist/concurrency/errors.d.ts +29 -0
  9. package/dist/concurrency/errors.d.ts.map +1 -0
  10. package/dist/concurrency/high-level.d.ts +85 -0
  11. package/dist/concurrency/high-level.d.ts.map +1 -0
  12. package/dist/concurrency/index.d.ts +19 -0
  13. package/dist/concurrency/index.d.ts.map +1 -0
  14. package/dist/concurrency/internal.d.ts +26 -0
  15. package/dist/concurrency/internal.d.ts.map +1 -0
  16. package/dist/concurrency/pipeline.d.ts +30 -0
  17. package/dist/concurrency/pipeline.d.ts.map +1 -0
  18. package/dist/concurrency/pool.d.ts +48 -0
  19. package/dist/concurrency/pool.d.ts.map +1 -0
  20. package/dist/concurrency/reactive.d.ts +107 -0
  21. package/dist/concurrency/reactive.d.ts.map +1 -0
  22. package/dist/concurrency/rpc.d.ts +46 -0
  23. package/dist/concurrency/rpc.d.ts.map +1 -0
  24. package/dist/concurrency/support.d.ts +23 -0
  25. package/dist/concurrency/support.d.ts.map +1 -0
  26. package/dist/concurrency/task.d.ts +31 -0
  27. package/dist/concurrency/task.d.ts.map +1 -0
  28. package/dist/concurrency/types.d.ts +343 -0
  29. package/dist/concurrency/types.d.ts.map +1 -0
  30. package/dist/concurrency-BU1wPEsZ.js +826 -0
  31. package/dist/concurrency-BU1wPEsZ.js.map +1 -0
  32. package/dist/concurrency.es.mjs +29 -0
  33. package/dist/{constraints-D5RHQLmP.js → constraints-Dlbx_m1b.js} +1 -1
  34. package/dist/{constraints-D5RHQLmP.js.map → constraints-Dlbx_m1b.js.map} +1 -1
  35. package/dist/core-CongXJuo.js +87 -0
  36. package/dist/core-CongXJuo.js.map +1 -0
  37. package/dist/{core-EMYSLzaT.js → core-tOP6QOrY.js} +2 -2
  38. package/dist/{core-EMYSLzaT.js.map → core-tOP6QOrY.js.map} +1 -1
  39. package/dist/core.es.mjs +1 -1
  40. package/dist/{custom-directives-Dr4C5lVV.js → custom-directives-5DlKqvd2.js} +1 -1
  41. package/dist/{custom-directives-Dr4C5lVV.js.map → custom-directives-5DlKqvd2.js.map} +1 -1
  42. package/dist/{devtools-BhB2iDPT.js → devtools-QosAqo0T.js} +2 -2
  43. package/dist/{devtools-BhB2iDPT.js.map → devtools-QosAqo0T.js.map} +1 -1
  44. package/dist/devtools.es.mjs +1 -1
  45. package/dist/{dnd-NwZBYh4l.js → dnd-d2OU4len.js} +1 -1
  46. package/dist/{dnd-NwZBYh4l.js.map → dnd-d2OU4len.js.map} +1 -1
  47. package/dist/dnd.es.mjs +1 -1
  48. package/dist/effect-Cc51IH91.js +87 -0
  49. package/dist/effect-Cc51IH91.js.map +1 -0
  50. package/dist/{env-CTdvLaH2.js → env-PvwYHnJq.js} +1 -1
  51. package/dist/{env-CTdvLaH2.js.map → env-PvwYHnJq.js.map} +1 -1
  52. package/dist/{forms-UhAeJEoO.js → forms-BLx4ZzT7.js} +41 -40
  53. package/dist/{forms-UhAeJEoO.js.map → forms-BLx4ZzT7.js.map} +1 -1
  54. package/dist/forms.es.mjs +1 -1
  55. package/dist/full.d.ts +6 -2
  56. package/dist/full.d.ts.map +1 -1
  57. package/dist/full.es.mjs +282 -214
  58. package/dist/full.iife.js +108 -20
  59. package/dist/full.iife.js.map +1 -1
  60. package/dist/full.umd.js +108 -20
  61. package/dist/full.umd.js.map +1 -1
  62. package/dist/{i18n-kuF6Ekj6.js → i18n--p7PM-9r.js} +3 -3
  63. package/dist/{i18n-kuF6Ekj6.js.map → i18n--p7PM-9r.js.map} +1 -1
  64. package/dist/i18n.es.mjs +1 -1
  65. package/dist/index.d.ts +2 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.es.mjs +320 -252
  68. package/dist/match-CrZRVC4z.js +174 -0
  69. package/dist/match-CrZRVC4z.js.map +1 -0
  70. package/dist/media/observers.d.ts.map +1 -1
  71. package/dist/{media-D4zLj9t-.js → media-gjbWNq50.js} +3 -3
  72. package/dist/{media-D4zLj9t-.js.map → media-gjbWNq50.js.map} +1 -1
  73. package/dist/media.es.mjs +1 -1
  74. package/dist/{motion-BJsAuULb.js → motion-BBMso9Ir.js} +1 -1
  75. package/dist/{motion-BJsAuULb.js.map → motion-BBMso9Ir.js.map} +1 -1
  76. package/dist/motion.es.mjs +1 -1
  77. package/dist/{mount-B-JvH6Y0.js → mount-0A9qtcRJ.js} +11 -10
  78. package/dist/{mount-B-JvH6Y0.js.map → mount-0A9qtcRJ.js.map} +1 -1
  79. package/dist/{platform-Dw2gE3zI.js → platform-BPHIXbw8.js} +17 -16
  80. package/dist/{platform-Dw2gE3zI.js.map → platform-BPHIXbw8.js.map} +1 -1
  81. package/dist/platform.es.mjs +1 -1
  82. package/dist/{plugin-C2WuC8SF.js → plugin-SZEirbwq.js} +2 -2
  83. package/dist/{plugin-C2WuC8SF.js.map → plugin-SZEirbwq.js.map} +1 -1
  84. package/dist/plugin.es.mjs +1 -1
  85. package/dist/reactive/watch.d.ts.map +1 -1
  86. package/dist/reactive/websocket.d.ts +6 -3
  87. package/dist/reactive/websocket.d.ts.map +1 -1
  88. package/dist/{reactive-BjpLkclt.js → reactive-BAd2hfl8.js} +436 -449
  89. package/dist/reactive-BAd2hfl8.js.map +1 -0
  90. package/dist/reactive.es.mjs +42 -40
  91. package/dist/readonly-C0ZwS1Tf.js +35 -0
  92. package/dist/readonly-C0ZwS1Tf.js.map +1 -0
  93. package/dist/{registry-B08iilIh.js → registry-jpUQHf4E.js} +1 -1
  94. package/dist/{registry-B08iilIh.js.map → registry-jpUQHf4E.js.map} +1 -1
  95. package/dist/router-C4weu0QL.js +333 -0
  96. package/dist/router-C4weu0QL.js.map +1 -0
  97. package/dist/router.es.mjs +1 -1
  98. package/dist/{sanitize-B1V4JswB.js → sanitize-DOMkRO9G.js} +12 -7
  99. package/dist/{sanitize-B1V4JswB.js.map → sanitize-DOMkRO9G.js.map} +1 -1
  100. package/dist/security.es.mjs +1 -1
  101. package/dist/server/create-server.d.ts +25 -0
  102. package/dist/server/create-server.d.ts.map +1 -0
  103. package/dist/server/index.d.ts +11 -0
  104. package/dist/server/index.d.ts.map +1 -0
  105. package/dist/server/types.d.ts +396 -0
  106. package/dist/server/types.d.ts.map +1 -0
  107. package/dist/server-QdyKtCS1.js +349 -0
  108. package/dist/server-QdyKtCS1.js.map +1 -0
  109. package/dist/server.es.mjs +6 -0
  110. package/dist/ssr/adapters.d.ts +74 -0
  111. package/dist/ssr/adapters.d.ts.map +1 -0
  112. package/dist/ssr/async.d.ts +40 -0
  113. package/dist/ssr/async.d.ts.map +1 -0
  114. package/dist/ssr/config.d.ts +60 -0
  115. package/dist/ssr/config.d.ts.map +1 -0
  116. package/dist/ssr/context.d.ts +73 -0
  117. package/dist/ssr/context.d.ts.map +1 -0
  118. package/dist/ssr/defer-brand.d.ts +5 -0
  119. package/dist/ssr/defer-brand.d.ts.map +1 -0
  120. package/dist/ssr/escape.d.ts +17 -0
  121. package/dist/ssr/escape.d.ts.map +1 -0
  122. package/dist/ssr/expression.d.ts +44 -0
  123. package/dist/ssr/expression.d.ts.map +1 -0
  124. package/dist/ssr/hash.d.ts +39 -0
  125. package/dist/ssr/hash.d.ts.map +1 -0
  126. package/dist/ssr/head.d.ts +102 -0
  127. package/dist/ssr/head.d.ts.map +1 -0
  128. package/dist/ssr/html-parser.d.ts +58 -0
  129. package/dist/ssr/html-parser.d.ts.map +1 -0
  130. package/dist/ssr/index.d.ts +49 -43
  131. package/dist/ssr/index.d.ts.map +1 -1
  132. package/dist/ssr/mismatch.d.ts +60 -0
  133. package/dist/ssr/mismatch.d.ts.map +1 -0
  134. package/dist/ssr/render-async.d.ts +84 -0
  135. package/dist/ssr/render-async.d.ts.map +1 -0
  136. package/dist/ssr/render.d.ts.map +1 -1
  137. package/dist/ssr/renderer.d.ts +25 -0
  138. package/dist/ssr/renderer.d.ts.map +1 -0
  139. package/dist/ssr/resumability.d.ts +65 -0
  140. package/dist/ssr/resumability.d.ts.map +1 -0
  141. package/dist/ssr/router-bridge.d.ts +101 -0
  142. package/dist/ssr/router-bridge.d.ts.map +1 -0
  143. package/dist/ssr/runtime.d.ts +63 -0
  144. package/dist/ssr/runtime.d.ts.map +1 -0
  145. package/dist/ssr/serialize.d.ts.map +1 -1
  146. package/dist/ssr/store-snapshot.d.ts +87 -0
  147. package/dist/ssr/store-snapshot.d.ts.map +1 -0
  148. package/dist/ssr/strategies.d.ts +43 -0
  149. package/dist/ssr/strategies.d.ts.map +1 -0
  150. package/dist/ssr/suspense.d.ts +47 -0
  151. package/dist/ssr/suspense.d.ts.map +1 -0
  152. package/dist/ssr/types.d.ts +17 -0
  153. package/dist/ssr/types.d.ts.map +1 -1
  154. package/dist/ssr-Bt6BQA3J.js +2127 -0
  155. package/dist/ssr-Bt6BQA3J.js.map +1 -0
  156. package/dist/ssr.es.mjs +42 -7
  157. package/dist/{store-CY6sjTW3.js → store-DnXuu6Li.js} +6 -6
  158. package/dist/{store-CY6sjTW3.js.map → store-DnXuu6Li.js.map} +1 -1
  159. package/dist/store.es.mjs +2 -2
  160. package/dist/storybook.es.mjs +1 -1
  161. package/dist/{testing-UjAtu9aQ.js → testing-CeMUwrRD.js} +7 -7
  162. package/dist/{testing-UjAtu9aQ.js.map → testing-CeMUwrRD.js.map} +1 -1
  163. package/dist/testing.es.mjs +1 -1
  164. package/dist/{untrack-D0fnO5k2.js → untrack-bjWDNdyE.js} +11 -10
  165. package/dist/{untrack-D0fnO5k2.js.map → untrack-bjWDNdyE.js.map} +1 -1
  166. package/dist/view.es.mjs +12 -11
  167. package/package.json +24 -15
  168. package/src/concurrency/errors.ts +57 -0
  169. package/src/concurrency/high-level.ts +387 -0
  170. package/src/concurrency/index.ts +63 -0
  171. package/src/concurrency/internal.ts +100 -0
  172. package/src/concurrency/pipeline.ts +133 -0
  173. package/src/concurrency/pool.ts +450 -0
  174. package/src/concurrency/reactive.ts +339 -0
  175. package/src/concurrency/rpc.ts +380 -0
  176. package/src/concurrency/support.ts +44 -0
  177. package/src/concurrency/task.ts +318 -0
  178. package/src/concurrency/types.ts +431 -0
  179. package/src/full.ts +164 -0
  180. package/src/index.ts +6 -0
  181. package/src/media/observers.ts +5 -8
  182. package/src/reactive/watch.ts +10 -9
  183. package/src/reactive/websocket.ts +31 -8
  184. package/src/server/create-server.ts +754 -0
  185. package/src/server/index.ts +33 -0
  186. package/src/server/types.ts +490 -0
  187. package/src/ssr/adapters.ts +330 -0
  188. package/src/ssr/async.ts +125 -0
  189. package/src/ssr/config.ts +86 -0
  190. package/src/ssr/context.ts +245 -0
  191. package/src/ssr/defer-brand.ts +3 -0
  192. package/src/ssr/escape.ts +25 -0
  193. package/src/ssr/expression.ts +669 -0
  194. package/src/ssr/hash.ts +71 -0
  195. package/src/ssr/head.ts +240 -0
  196. package/src/ssr/html-parser.ts +387 -0
  197. package/src/ssr/index.ts +136 -43
  198. package/src/ssr/mismatch.ts +110 -0
  199. package/src/ssr/render-async.ts +286 -0
  200. package/src/ssr/render.ts +130 -59
  201. package/src/ssr/renderer.ts +453 -0
  202. package/src/ssr/resumability.ts +142 -0
  203. package/src/ssr/router-bridge.ts +177 -0
  204. package/src/ssr/runtime.ts +131 -0
  205. package/src/ssr/serialize.ts +1 -27
  206. package/src/ssr/store-snapshot.ts +209 -0
  207. package/src/ssr/strategies.ts +245 -0
  208. package/src/ssr/suspense.ts +504 -0
  209. package/src/ssr/types.ts +18 -0
  210. package/dist/core-DdtZHzsS.js +0 -168
  211. package/dist/core-DdtZHzsS.js.map +0 -1
  212. package/dist/reactive-BjpLkclt.js.map +0 -1
  213. package/dist/router-BieVwgci.js +0 -492
  214. package/dist/router-BieVwgci.js.map +0 -1
  215. package/dist/ssr-CrGSJySz.js +0 -248
  216. package/dist/ssr-CrGSJySz.js.map +0 -1
package/dist/full.umd.js CHANGED
@@ -1,10 +1,94 @@
1
- (function(y,de){typeof exports=="object"&&typeof module<"u"?de(exports):typeof define=="function"&&define.amd?define(["exports"],de):(y=typeof globalThis<"u"?globalThis:y||self,de(y.bQuery={}))})(this,function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Module"});var de="bquery-sanitizer",is=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"]),Wt=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),as=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"]),ls=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),cs=["on","formaction","xlink:","xmlns:"],Kt=["javascript:","data:","vbscript:","file:"],us=(e,t,r)=>{const n=e.toLowerCase();for(const s of cs)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},fs=e=>{const t=e.toLowerCase().trim();return!as.has(t)},ds=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(),Yt=e=>{const t=ds(e);for(const r of Kt)if(t.startsWith(r))return!1;return!0},hs=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!Yt(n))return!1}return!0},ms=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}},ps=e=>new DOMParser().parseFromString(e,"text/html"),Gt=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=ps(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},Ye=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:o=!1}=t,i=new Set([...is,...r.map(f=>f.toLowerCase())].filter(f=>!Wt.has(f))),a=new Set([...ls,...n.map(f=>f.toLowerCase())]),l=Gt(e);if(o)return l.textContent??"";const c=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT),u=[];for(;c.nextNode();){const f=c.currentNode,m=f.tagName.toLowerCase();if(Wt.has(m)){u.push(f);continue}if(!i.has(m)){u.push(f);continue}const g=[];for(const b of Array.from(f.attributes)){const v=b.name.toLowerCase();if(!us(v,a,s)){g.push(b.name);continue}if((v==="id"||v==="name")&&!fs(b.value)){g.push(b.name);continue}if((v==="href"||v==="src"||v==="action")&&!Yt(b.value)){g.push(b.name);continue}v==="srcset"&&!hs(b.value)&&g.push(b.name)}for(const b of g)f.removeAttribute(b);if(m==="a"){const b=f.getAttribute("href"),v=f.getAttribute("target")?.toLowerCase()==="_blank",w=b&&ms(b);if(v||w){const E=f.getAttribute("rel"),T=new Set(E?E.split(/\s+/).filter(Boolean):[]);T.add("noopener"),T.add("noreferrer"),f.setAttribute("rel",Array.from(T).join(" "))}}}for(const f of u)f.remove();const h=f=>{const m=document.createElement("div");return m.appendChild(f.cloneNode(!0)),m.innerHTML},d=h(l),p=h(Gt(d));return d!==p?l.textContent??"":p},Jt=Symbol("bquery.trusted-html.brand"),dt=Symbol("bquery.trusted-html"),Xt=e=>e,vs=e=>{const t=String(e);return Object.freeze({[Jt]:!0,[dt]:t,toString:()=>t})},ys=e=>typeof e=="object"&&e!==null&&Jt in e&&dt in e,gs=e=>e[dt],Zt=1024,er=8192,bs=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>Zt)throw new RangeError(`generateNonce length must not exceed ${Zt}`);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+=er){const s=t.subarray(n,Math.min(n+er,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},ws=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},Ge=null,tr=!1,Es=()=>typeof window<"u"&&typeof window.trustedTypes<"u",rr=()=>{if(Ge)return Ge;if(tr||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;tr=!0;try{return Ge=e.trustedTypes.createPolicy(de,{createHTML:t=>Ye(t)}),Ge}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${de}": ${r}`),null}},Ss=e=>{const t=rr();return t?t.createHTML(e):Ye(e)},J=(e,t={})=>Xt(Ye(e,t)),nr=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return e.replace(/[&<>"'`]/g,r=>t[r])},As=e=>Ye(e,{stripAllTags:!0}),sr=e=>Array.isArray(e)?e:[e],q=(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},Je=(e,t)=>he(e)?t==="width"?e.clientWidth:e.clientHeight:0,Xe=(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 o=s.getComputedStyle(e),i=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-left":"margin-top")),a=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-right":"margin-bottom")),l=Number.isNaN(i)?0:i,c=Number.isNaN(a)?0:a;return n+l+c},or=e=>J(e),Cs=(e,t)=>{e.innerHTML=J(t)},ir=e=>{const t=document.createElement("template");return t.innerHTML=J(e),t.content.firstElementChild??document.createElement("div")},ar=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,J(t));return}const n=sr(t);q(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 x(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function ks(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))x(n)||(me(s)&&me(t[n])?t[n]=pe(t[n],s):t[n]=s);return t}function Os(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function Ts(e,t){const r={...e};for(const n of t)delete r[n];return r}function Ls(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var $s=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},lr=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!$s(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},cr=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:lr(e)}catch{}return lr(e)},ve=class Vt{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 Cs(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"?ir(t):t;return this.element.replaceWith(r),new Vt(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}}innerWidth(){return Je(this.element,"width")}innerHeight(){return Je(this.element,"height")}outerWidth(t=!1){return Xe(this.element,"width",t)}outerHeight(t=!1){return Xe(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 Vt(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 cr(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 cr(t))r.append(n,s);return r.toString()}rect(){return this.element.getBoundingClientRect()}offset(){const t=this.element;return{width:t.offsetWidth,height:t.offsetHeight,top:t.offsetTop,left:t.offsetLeft}}insertContent(t,r){ar(this.element,t,r)}},Ze=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 ve(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 ve(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 ve(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=or(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"?ir(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 he(t)?t.offsetParent:null}position(){const t=this.first();return he(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}innerWidth(){return Je(this.first(),"width")}innerHeight(){return Je(this.first(),"height")}outerWidth(t=!1){return Xe(this.first(),"width",t)}outerHeight(t=!1){return Xe(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 c=l.target.closest(r);c&&o.contains(c)&&n(l,c)};this.delegatedHandlers.has(o)||this.delegatedHandlers.set(o,new Map);const a=this.delegatedHandlers.get(o);a.has(s)||a.set(s,new Map),a.get(s).set(n,i),o.addEventListener(t,i)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return 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=or(t);q(this.elements,o=>{o.insertAdjacentHTML(r,s)});return}const n=sr(t);this.elements.forEach((s,o)=>{ar(s,o===0?n:n.map(i=>i.cloneNode(!0)),r)})}},Rs=e=>{if(typeof e!="string")return new ve(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new ve(t)},Ms=e=>Array.isArray(e)?new Ze(e):e instanceof NodeList?new Ze(Array.from(e)):new Ze(Array.from(document.querySelectorAll(e)));function Ds(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ns(e){return Array.from(new Set(e))}function Ps(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 Is(e){return e.filter(Boolean)}function _s(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function ht(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 ur(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function qs(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function xs(){}function js(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function zs(e){return new Promise(t=>setTimeout(t,e))}function Fs(e,t){try{return JSON.parse(e)}catch{return t}}function Bs(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 Hs(e,t){return Math.floor(Math.random()*(t-e+1))+e}function Us(e,t,r){return Math.min(Math.max(e,t),r)}function Qs(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function Vs(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function Ws(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Ks(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 Js(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function Xs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zs(e){return typeof Element<"u"&&e instanceof Element}function eo(e){return!!(e&&typeof e=="object"&&"elements"in e)}function to(e){return typeof e=="function"}function ro(e){return typeof e=="string"}function no(e){return typeof e=="number"&&!Number.isNaN(e)}function so(e){return typeof e=="boolean"}function oo(e){return Array.isArray(e)}function io(e){return e instanceof Date}function Oe(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function ao(e){return typeof e=="object"&&e!==null}var lo={clone:ks,merge:pe,pick:Os,omit:Ts,hasOwn:Ls,debounce:ht,throttle:ur,once:qs,noop:xs,uid:js,isElement:Zs,isCollection:eo,isEmpty:Bs,isPlainObject:me,isFunction:to,isString:ro,isNumber:no,isBoolean:so,isArray:oo,isDate:io,isPromise:Oe,isObject:ao,parseJson:Fs,sleep:zs,randomInt:Hs,clamp:Us,inRange:Qs,toNumber:Vs,capitalize:Ws,toKebabCase:Ks,toCamelCase:Ys,truncate:Gs,slugify:Js,escapeRegExp:Xs,ensureArray:Ds,unique:Ns,chunk:Ps,compact:Is,flatten:_s},ye=[],Te=0,mt=new Set,et=new WeakMap,pt=(e,t)=>{ye.push(e);try{return t()}finally{ye.pop()}},fr=()=>ye[ye.length-1],vt=e=>{ye.push(void 0);try{return e()}finally{ye.pop()}},dr=e=>{if(Te>0){mt.add(e);return}e()},co=()=>{for(const e of Array.from(mt)){mt.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},uo=()=>{Te+=1},fo=()=>{Te<=0||(Te-=1,Te===0&&co())},hr=(e,t)=>{let r=et.get(e);r||(r=new Set,et.set(e,r)),r.add(t)},ho=(e,t)=>{const r=et.get(e);r&&r.delete(t)},Le=e=>{const t=et.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},$e=e=>{uo();try{e()}finally{fo()}},mr={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"}},Re=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>Re(t));if(me(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=Re(n);return t}return e},yt=Re(mr),mo=e=>(yt=Re(pe(mr,yt,e)),X()),X=()=>Re(yt),Me=[],tt=e=>typeof e=="object"&&e!==null&&"_addDisposer"in e,po=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",vo=e=>{const t=typeof e.constructor=="function"?e.constructor.name:void 0;return typeof e=="function"&&(Symbol.toStringTag in e&&e[Symbol.toStringTag]==="AsyncFunction"||t==="AsyncFunction")},De=()=>{for(let e=Me.length-1;e>=0;e--)if(Me[e].active)return Me[e]},yo=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(vo(e))throw new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");Me.push(this);try{const t=e();if(po(t))throw this.stop(),new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");return t}finally{Me.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}}},go=()=>{const e=new yo,t=De();return tt(t)&&t._addDisposer(()=>e.stop()),e},pr=()=>De(),vr=e=>{const t=De();if(!t||!t.active||!tt(t))throw new Error("bQuery reactive: onScopeDispose() must be called inside an active effectScope");t._addDisposer(e)},Ne=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)dr(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=vt(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=fr();return e&&(this.subscribers.add(e),hr(e,this)),this.dirty&&(this.dirty=!1,Le(this.markDirty),this.cachedValue=pt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=vt(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,Le(this.markDirty),this.cachedValue=pt(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 Ne(e),r=De();return tt(r)&&r._addDisposer(()=>t.dispose()),t},j=e=>{let t,r=!1;const n=De(),s=()=>{if(t){try{t()}catch(l){console.error("bQuery reactive: Error in effect cleanup",l)}t=void 0}},o=()=>{s(),Le(a)},i=()=>{r||(r=!0,o())};tt(n)&&n._addDisposer(i);const a=()=>{if(!r){s(),Le(a);try{t=pt(a,e)}catch(l){console.error("bQuery reactive: Error in effect",l)}r&&o()}};return a(),i},Pe=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=fr();return e&&(this.subscribers.add(e),hr(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)dr(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)ho(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},M=e=>new Pe(e),ae=e=>vt(e),bo=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))}},wo=e=>typeof e=="function"?e():e.value,yr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},Eo=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),So=(e,t)=>e==null||Eo(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),Ao=e=>typeof e=="function"?e():e,Co=(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))}},ko=(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)},Oo=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)}`)}},gt=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},To=(e,t,r)=>{const n=t instanceof Request?gt(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=gt(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}},gr=(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,c=()=>{};const u=()=>{a+=1,n.value=t.defaultValue,s.value=null,o.value="idle"},h=()=>{l||(l=!0,a+=1,c())},d=async()=>{if(l)return n.peek();const p=++a;o.value="pending",s.value=null;try{const f=await e(),m=t.transform?t.transform(f):f;return l||p!==a?n.peek():(n.value=m,o.value="success",t.onSuccess?.(m),m)}catch(f){const m=bo(f);return l||p!==a||(s.value=m,o.value="error",t.onError?.(m)),n.peek()}};if(t.watch?.length){let p=!1;c=j(()=>{for(const f of t.watch??[])wo(f);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}},Ro=e=>e>=200&&e<300,br=(e,t)=>e instanceof DOMException&&e.name===t,rt=e=>br(e,"TimeoutError"),wr=e=>br(e,"AbortError"),Mo=e=>{if(wr(e)||rt(e)||e.code==="ABORT"||e.code==="TIMEOUT")return!1;const t=e.status;return t===void 0||t>=500},Do=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},No=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),Po=(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??Ro;let i=null;const a=(c,u)=>{const h=u||rt(c)||rt(i?.signal.reason);return Object.assign(new Error(h?`Request timeout of ${t.timeout}ms exceeded`:"Request aborted"),{code:h?"TIMEOUT":"ABORT"})},l=gr(async()=>{const c=Ao(e),u=typeof c=="string"||c instanceof URL?ko(c,t.baseUrl??r?.baseUrl):c instanceof Request&&t.query?new URL(c.url):null;u&&t.query&&Co(u,t.query);const h=yr(r?.headers,c instanceof Request?c.headers:void 0,t.headers),d=t.body!=null,p=gt(t.method),f=To(p,c,d),m=f==="GET"||f==="HEAD"?f:null;if(d&&m)throw new Error(`Cannot send a request body with ${m} requests`);const g=Lo(p,c,f),b=Do(t.retry),v=(b?.count??0)+1,w=new AbortController;i=w;let E,T=!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(()=>{T=!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??c;c instanceof Request&&u&&u.toString()!==c.url&&(C=new Request(u.toString(),$o(c)));const R=()=>{const L=new Headers(h);return{...S,headers:L,body:So(t.body,L),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 O;try{for(let L=0;L<v;L++)try{const k=await s(C,R());if(!o(k.status))throw Object.assign(new Error(`Request failed with status ${k.status}`),{response:k,status:k.status,statusText:k.statusText});return await Oo(k,n)}catch(k){const $=k instanceof Error?k:new Error(String(k));if(w.signal.aborted||wr($)||rt($))throw a(w.signal.aborted?w.signal.reason:$,T);if(O=$,!(b&&(b.retryOn??Mo)($,L))||L>=v-1)throw $;await Po(No(b.delay,L),w.signal)}throw O}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 Io(e={}){return(t,r={})=>{const n=e,s=pe({},n.query??{},r.query??{});return W(t,{...n,...r,headers:yr(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 Er(){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 _o=e=>e>=200&&e<300,qo=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},xo=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},jo=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),zo=(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})}),Sr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},Fo=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),Bo=(e,t)=>e==null||Fo(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),Ho=(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))}},Uo=(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)},Qo=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})}},Vo=(e,t)=>{const r=e.body;if(!r)return e;const n=parseInt(e.headers.get("content-length")??"0",10)||0;let s=0;const o=r.getReader(),i=new ReadableStream({async pull(a){const{done:l,value:c}=await o.read();if(l){a.close();return}s+=c.byteLength,t({loaded:s,total:n,percent:n>0?Math.round(s/n*100):void 0}),a.enqueue(c)},cancel(a){o.cancel(a)}});return new Response(i,{status:e.status,statusText:e.statusText,headers:e.headers})},Wo=async e=>{const t=X().fetch,r=e.parseAs??t?.parseAs??"json",n=e.fetcher??fetch,s=e.validateStatus??_o,o=Uo(e.url??"/",e.baseUrl??t?.baseUrl);e.query&&Ho(o,e.query);const i=Sr(t?.headers,e.headers),a=Bo(e.body,i),l={};e.method&&(l.method=e.method.toUpperCase()),l.headers=i,a!=null&&(l.body=a),e.cache&&(l.cache=e.cache),e.credentials&&(l.credentials=e.credentials),e.integrity&&(l.integrity=e.integrity),e.keepalive!==void 0&&(l.keepalive=e.keepalive),e.mode&&(l.mode=e.mode),e.redirect&&(l.redirect=e.redirect),e.referrer&&(l.referrer=e.referrer),e.referrerPolicy&&(l.referrerPolicy=e.referrerPolicy);let c,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})),c=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=Vo(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 Qo(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{c!==void 0&&clearTimeout(c),e.signal&&h&&e.signal.removeEventListener("abort",h)}};function bt(e={}){const t=Er(),r=Er(),n=i=>{const a=pe({},e.query??{},i.query??{});return{...e,...i,headers:Sr(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(f){if(p){const m=await p(f);if(me(m))a=m;else throw f}else throw f}const c=xo(a.retry);let u;const h=(c?.count??0)+1;for(let d=0;d<h;d++)try{let p=await Wo(a);const f=[];r.forEach(m=>f.push(m));for(const{fulfilled:m,rejected:g}of f)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 f=p instanceof oe?p:new oe(p instanceof Error?p.message:String(p),a,"NETWORK");if(u=f,!(c&&(c.retryOn??qo)(f,d))||d>=h-1){const g=[];r.forEach(v=>g.push(v));let b=f;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=f),b}const m=c?jo(c.delay,d):0;c?.onRetry?.(f,d+1),await zo(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 Ko=bt();function Yo(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 Go=(e,t)=>{const r=P(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},Jo=(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 c=s.peek();return c>1&&(s.value=c-1),o.execute()},goTo:async c=>(s.value=Math.max(1,c),o.execute())}},Xo=(e,t)=>{const{getNextCursor:r,transform:n,initialCursor:s,immediate:o=!0,onSuccess:i,onError:a,...l}=t,c=M([]),u=M(t.defaultValue),h=M(null),d=M("idle"),p=P(()=>d.value==="pending"),f=M(s),m=P(()=>c.value.length===0||f.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(f.peek()),{...l,immediate:!1,watch:void 0}),R=await C.execute(),O=C.error.peek();if(C.dispose(),g||S!==b)return u.peek();if(O)return h.value=O,d.value="error",a?.(O),u.peek();if(R!==void 0){const L=R,k=[...c.peek(),L];c.value=k,f.value=r(L,k);const $=v(k);return u.value=$,d.value="success",i?.($),$}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()=>(c.value=[],f.value=s,u.value=t.defaultValue,h.value=null,d.value="idle",b+=1,w()),T=()=>{b+=1,c.value=[],f.value=s,u.value=t.defaultValue,h.value=null,d.value="idle"},A=()=>{g||(g=!0,b+=1)};return o&&w(),{data:u,pages:c,error:h,status:d,pending:p,hasMore:m,fetchNextPage:w,refresh:E,clear:T,dispose:A}},Zo=(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},ei=(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),c=M(!1),u=M(!1),h=typeof n=="function"?n:()=>n,d=P(()=>h()&&!l.value&&!(s&&c.value)&&!(o&&u.value)),p=W(e,{...a,immediate:i&&h()});let f,m=[];const g=()=>{b(),f=setInterval(()=>{p.execute()},r)},b=()=>{f!==void 0&&(clearInterval(f),f=void 0)},v=j(()=>{const T=d.value;ae(()=>{T?g():b()})});if(s&&typeof document<"u"){c.value=document.hidden;const T=()=>{c.value=document.hidden};document.addEventListener("visibilitychange",T),m.push(()=>document.removeEventListener("visibilitychange",T))}if(o&&typeof window<"u"){const T=()=>{u.value=!1},A=()=>{u.value=!0};window.addEventListener("online",T),window.addEventListener("offline",A),m.push(()=>{window.removeEventListener("online",T),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 T of m)T();m=[],w()}}},Ar=Symbol("bquery.readonlySignal"),Cr=e=>typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,Ar),H=e=>Object.defineProperties({},{value:{get(){return e.value},enumerable:!0},peek:{value(){return e.peek()},enumerable:!0},[Ar]:{value:!0,enumerable:!1,configurable:!1,writable:!1}}),ti=(e,t={})=>{const{optimistic:r=!1,onMutationSuccess:n,onMutationError:s,...o}=t,i=W(e,{...o}),a=M(!1),l=P(()=>a.value);let c=!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(c)return i.data.peek();const E=i.data.peek();r&&w!==void 0&&(i.data.value=w),a.value=!0,i.error.value=null;try{const T=W(u(),{...h(),method:b,body:v??void 0,immediate:!1,watch:void 0}),A=await T.execute(),S=T.error.peek();return T.dispose(),c?i.data.peek():S?(r&&w!==void 0&&(i.data.value=E),i.error.value=S,i.status.value="error",a.value=!1,s?.(S,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(T){if(c)return i.data.peek();r&&w!==void 0&&(i.data.value=E);const A=T instanceof Error?T:new Error(String(T));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"),!c&&i.error.peek()==null&&(i.data.value=void 0)}},f=i.dispose,m=()=>{c||(c=!0,f())};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}},ri=(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"}}},ni=(e,t={})=>{const r=bt({...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}},si=(e,t={})=>{const{getId:r=v=>v.id,optimistic:n=!1,onMutationSuccess:s,onMutationError:o,...i}=t,a=W(e,{...i}),l=M(!1),c=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:T,...A}=i;return A},f=async(v,w,E,T,A,S)=>{if(!u){n&&A&&A(),l.value=!0,a.error.value=null;try{const C=W(`${d()}${E}`,{...p(),method:w,body:T??void 0,immediate:!1,watch:void 0}),R=await C.execute(),O=C.error.peek();if(C.dispose(),u)return;if(O){n&&S&&S(),a.error.value=O,a.status.value="error",l.value=!1,o?.(O,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,T=w?.length??0,A=await f("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];T<C.length&&C[T]===E?C[T]=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(),T=await f("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(T!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===v?T:S)}return T},patch:async(v,w)=>{const E=a.data.peek(),T=await f("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(T!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===v?T:S)}return T},remove:async v=>{const w=a.data.peek();if(await f("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(T=>r(T)!==v)}}},g=a.dispose,b=()=>{u||(u=!0,g())};return{data:a.data,error:a.error,status:a.status,pending:a.pending,isMutating:c,actions:m,refresh:a.execute,clear:a.clear,dispose:b}},wt=new Map;function oi(e,t){const r=wt.get(e);if(r)return r;const n=t().finally(()=>{wt.delete(e)});return wt.set(e,n),n}var le=e=>e instanceof Pe,Ie=e=>e instanceof Ne,ii=e=>e instanceof Pe||e instanceof Ne||Cr(e)?e.value:e,Et=(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)})},ai=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=Number.isFinite(r)?Math.max(0,r):0;let a=!1,l,c;const u=()=>{h.cancel(),a=!1,c=void 0},h=ht(()=>{if(a){try{t(l,c)}catch(p){console.error("bQuery reactive: Error in watchDebounce callback",p)}a=!1,c=void 0}},i);s&&t(e.peek(),void 0);const d=Et(e,(p,f)=>{a||(c=f),l=p,a=!0,h()},{equals:o});return pr()&&vr(u),()=>{d(),u()}},li=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=ur((l,c)=>{t(l,c)},Number.isFinite(r)?Math.max(0,r):0);s&&i(e.peek(),void 0);const a=Et(e,(l,c)=>{i(l,c)},{equals:o});return()=>{a(),i.cancel()}};function kr(e){return e===!1?!1:e===!0||e===void 0?{}:e}var ci=e=>e?e===!0?{}:e:!1,Or=(e,t)=>{const r=t.delay??1e3,n=t.factor??2,s=t.maxDelay??3e4;return Math.min(r*n**e,s)},Tr=(e,t={})=>{const{protocols:r,immediate:n=!0,historySize:s=0,onOpen:o,onMessage:i,onClose:a,onError:l,onReconnect:c}=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),f=M(null),m=M([]),g=M(0),b=M(0),v=M(0),w=P(()=>d.value==="OPEN");let E=null,T=!1,A=!1,S,C,R,O=0,L=!1,k=0;const $=[],D=kr(t.autoReconnect),I=ci(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&&(k=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)},Q=()=>{R!==void 0&&(clearTimeout(R),R=void 0),k>0&&(b.value=Date.now()-k,k=0)},se=N=>{if(T||A||!D)return;const B=D.maxAttempts??1/0;if(O>=B||D.shouldReconnect&&!D.shouldReconnect(N,O))return;const V=Or(O,D);S=setTimeout(()=>{O++,g.value=O,L=!0,Qt()},V)},ke=()=>{S!==void 0&&(clearTimeout(S),S=void 0)},Ut=()=>{if(!E||E.readyState!==WebSocket.OPEN)return;let N=0;for(;N<$.length&&E.readyState===WebSocket.OPEN;N++)E.send($[N]);N>0&&$.splice(0,N)},Ke=()=>{const N=typeof e=="function"?e():e;return N instanceof URL?N.toString():N},Qt=()=>{if(!T){ke(),E&&(_(),k=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",f.value=null;try{E=new WebSocket(Ke(),r)}catch{d.value="CLOSED";return}E.onopen=N=>{d.value="OPEN";const B=L,V=O;O=0,g.value=0,L=!1,Ut(),z(),o?.(N),B&&c?.(V)},E.onmessage=N=>{if(I){const V=I.responseMessage;(V===void 0||N.data===V)&&Q()}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&&!T&&se(N)},E.onerror=N=>{f.value=N,l?.(N)}}},ss=(N,B)=>{A=!0,ke(),_(),E&&(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&(d.value="CLOSING",E.close(N,B))},$u=N=>{T||os(u(N))},os=N=>{T||(E?.readyState===WebSocket.OPEN?E.send(N):$.push(N))},Ru=()=>{T||(T=!0,ss(),$.length=0,E=null)};return n&&Qt(),{status:d,data:p,error:f,history:m,isConnected:w,reconnectAttempts:g,latency:b,lastDisconnectedAt:v,send:$u,sendRaw:os,open:Qt,close:ss,dispose:Ru}},ui=(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=Tr(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}},fi=(e,t={})=>{const{immediate:r=!0,events:n=[],eventSourceInit:s,onOpen:o,onMessage:i,onError:a}=t,l=t.deserialize??(L=>{try{return JSON.parse(L)}catch{return L}}),c=M("CLOSED"),u=M(void 0),h=M(void 0),d=M(null),p=P(()=>c.value==="OPEN"),f=kr(t.autoReconnect);let m=null,g=!1,b=!1,v,w=0;const E=()=>{const L=typeof e=="function"?e():e;return L instanceof URL?L.toString():L},T=L=>k=>{const $=l(k.data);u.value=$,h.value=L,i?.($,k)},A=()=>{v!==void 0&&(clearTimeout(v),v=void 0)},S=()=>{if(g||b||!f)return;const L=f.maxAttempts??1/0;if(w>=L)return;const k=Or(w,f);v=setTimeout(()=>{w++,C()},k)},C=()=>{if(!g){A(),m&&(m.close(),m=null),b=!1,c.value="CONNECTING",d.value=null;try{m=new EventSource(E(),s)}catch{c.value="CLOSED";return}m.onopen=L=>{c.value="OPEN",w=0,o?.(L)},m.onerror=L=>{d.value=L,a?.(L),m?.readyState===EventSource.CLOSED&&(c.value="CLOSED",!b&&!g&&S())},m.addEventListener("message",T("message"));for(const L of n)m.addEventListener(L,T(L))}},R=()=>{b=!0,A(),m&&(m.close(),m=null),c.value="CLOSED"},O=()=>{g||(g=!0,R())};return r&&C(),{status:c,data:u,eventName:h,error:d,isConnected:p,open:C,close:R,dispose:O}},di=(e,t)=>{const{type:r}=t;if(r===String)return e;if(r===Number)return Number(e);if(r===Boolean){const n=e.trim().toLowerCase();return n===""||n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:!!e}if(r===Object||r===Array)try{return JSON.parse(e)}catch{return e}if(typeof r=="function"){const n=r,s=r;if(t.construct===!0)return Reflect.construct(s,[e]);if(t.construct===!1)return n(e);const o=r.prototype!==void 0&&r.prototype!==null,i=(o?Object.getOwnPropertyNames(r.prototype):[]).length>1,a=o&&r.prototype.constructor!==r,l=/^class\s/.test(Function.prototype.toString.call(r));if(i||a||l)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const c=n(e);if(c===void 0&&o)try{return Reflect.construct(s,[e])}catch{return c}return c}catch(c){if(c instanceof TypeError&&/cannot be invoked without 'new'|is not a function/i.test(c.message))return Reflect.construct(s,[e]);throw c}}return e},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}},_e;function ie(e){const t=_e;return _e=e,t}function Lr(){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 hi(e){const t=_e;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 mi(e){const t=_e;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 pi(e){const t=_e;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 vi=["slot"],yi=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],$r=(e,t)=>{const r=[...vi,...t.sanitize?.allowTags??[]],n=[...yi,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),i=(c=>c===!1?!1:c==="closed"?"closed":"open")(t.shadow),a=Array.from(new Set([...Object.keys(t.props??{}),...t.observeAttributes??[]]));class l extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.missingRequiredProps=new Set,this.hasMounted=!1,i!==!1?this.renderRootNode=this.attachShadow({mode:i}):this.renderRootNode=this,this.syncProps()}static get observedAttributes(){return a}connectedCallback(){try{if(!this.hasMounted&&this.missingRequiredProps.size>0)return;if(this.hasMounted){this.scope=Lr();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 f=ie(this.ensureScope());try{t.onAttributeChanged.call(this,u,h,d)}finally{ie(f)}}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=Lr())}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 f;if(p==null?d.required&&d.default===void 0?(this.missingRequiredProps.add(h),f=void 0):f=d.default??void 0:(this.missingRequiredProps.has(h)&&this.missingRequiredProps.delete(h),f=di(p,d)),d.validator&&f!==void 0&&!d.validator(f))throw new Error(`bQuery component: validation failed for prop "${h}" with value ${JSON.stringify(f)}`);this.props[h]=f}}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 f=(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:f}),{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(f){this.handleError(f)}}}return l};function gi(e,t){return $r(e,t)}function ge(e,t){const r=$r(e,t);customElements.get(e)||customElements.define(e,r)}var Rr=Symbol("bquery.booleanAttribute"),bi=/^[^\0-\x20"'/>=]+$/,Mr=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[Rr]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},Dr=e=>Mr(e)?e.enabled?e.name:"":String(e??""),wi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Ei=e=>Mr(e)?e.enabled?e.name:"":Dr(e).replace(/[&<>"'`]/g,t=>wi[t]),Si=(e,t)=>{if(!bi.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[Rr]:!0,enabled:!!t,name:e})},be=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${Dr(t[s])}`,""),Ai=(e,...t)=>{const r=n=>ys(n)?gs(n):Ei(n);return Xt(e.reduce((n,s,o)=>`${n}${s}${o<t.length?r(t[o]):""}`,""))},nt=`
1
+ (function(y,$e){typeof exports=="object"&&typeof module<"u"?$e(exports):typeof define=="function"&&define.amd?define(["exports"],$e):(y=typeof globalThis<"u"?globalThis:y||self,$e(y.bQuery={}))})(this,function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Module"});var $e="bquery-sanitizer",ln=new Set(["a","abbr","address","article","aside","b","bdi","bdo","blockquote","br","button","caption","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","input","ins","kbd","label","legend","li","main","mark","nav","ol","optgroup","option","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","wbr"]),cr=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),un=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"]),fn=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),dn=["on","formaction","xlink:","xmlns:"],lr=["javascript:","data:","vbscript:","file:"],zi=(e,t,r)=>{const n=e.toLowerCase();for(const s of dn)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},ji=e=>{const t=e.toLowerCase().trim();return!un.has(t)},Ui=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(),hn=e=>{const t=Ui(e);for(const r of lr)if(t.startsWith(r))return!1;return!0},Hi=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!hn(n))return!1}return!0},Wi=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}},Fi=e=>new DOMParser().parseFromString(e,"text/html"),mn=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=Fi(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},At=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:o=!1}=t,i=new Set([...ln,...r.map(f=>f.toLowerCase())].filter(f=>!cr.has(f))),a=new Set([...fn,...n.map(f=>f.toLowerCase())]),c=mn(e);if(o)return c.textContent??"";const l=document.createTreeWalker(c,NodeFilter.SHOW_ELEMENT),u=[];for(;l.nextNode();){const f=l.currentNode,m=f.tagName.toLowerCase();if(cr.has(m)){u.push(f);continue}if(!i.has(m)){u.push(f);continue}const v=[];for(const b of Array.from(f.attributes)){const g=b.name.toLowerCase();if(!zi(g,a,s)){v.push(b.name);continue}if((g==="id"||g==="name")&&!ji(b.value)){v.push(b.name);continue}if((g==="href"||g==="src"||g==="action")&&!hn(b.value)){v.push(b.name);continue}g==="srcset"&&!Hi(b.value)&&v.push(b.name)}for(const b of v)f.removeAttribute(b);if(m==="a"){const b=f.getAttribute("href"),g=f.getAttribute("target")?.toLowerCase()==="_blank",w=b&&Wi(b);if(g||w){const S=f.getAttribute("rel"),k=new Set(S?S.split(/\s+/).filter(Boolean):[]);k.add("noopener"),k.add("noreferrer"),f.setAttribute("rel",Array.from(k).join(" "))}}}for(const f of u)f.remove();const h=f=>{const m=document.createElement("div");return m.appendChild(f.cloneNode(!0)),m.innerHTML},d=h(c),p=h(mn(d));return d!==p?c.textContent??"":p},pn=Symbol("bquery.trusted-html.brand"),ur=Symbol("bquery.trusted-html"),vn=e=>e,Bi=e=>{const t=String(e);return Object.freeze({[pn]:!0,[ur]:t,toString:()=>t})},Qi=e=>typeof e=="object"&&e!==null&&pn in e&&ur in e,Vi=e=>e[ur],yn=1024,gn=8192,bn=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>yn)throw new RangeError(`generateNonce length must not exceed ${yn}`);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+=gn){const s=t.subarray(n,Math.min(n+gn,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Ki=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},kt=null,wn=!1,Yi=()=>typeof window<"u"&&typeof window.trustedTypes<"u",Sn=()=>{if(kt)return kt;if(wn||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;wn=!0;try{return kt=e.trustedTypes.createPolicy($e,{createHTML:t=>At(t)}),kt}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${$e}": ${r}`),null}},Ji=e=>{const t=Sn();return t?t.createHTML(e):At(e)},ie=(e,t={})=>vn(At(e,t)),En=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return e.replace(/[&<>"'`]/g,r=>t[r])},Gi=e=>At(e,{stripAllTags:!0}),An=e=>Array.isArray(e)?e:[e],z=(e,t)=>{for(const r of e)t(r)},Oe=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},Tt=(e,t)=>Oe(e)?t==="width"?e.clientWidth:e.clientHeight:0,Rt=(e,t,r)=>{if(!Oe(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")),c=Number.isNaN(i)?0:i,l=Number.isNaN(a)?0:a;return n+c+l},kn=e=>ie(e),Xi=(e,t)=>{e.innerHTML=ie(t)},Tn=e=>{const t=document.createElement("template");return t.innerHTML=ie(e),t.content.firstElementChild??document.createElement("div")},Rn=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,ie(t));return}const n=An(t);z(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})};function Le(e){return Object.prototype.toString.call(e)==="[object Object]"}function N(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function Zi(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))N(n)||(Le(s)&&Le(t[n])?t[n]=Pe(t[n],s):t[n]=s);return t}function ea(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function ta(e,t){const r={...e};for(const n of t)delete r[n];return r}function ra(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var na=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},Cn=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!na(n))continue;const s=n.name;if(!(!s||n.disabled||N(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},$n=e=>{if(typeof FormData=="function")try{const t=[];for(const[r,n]of new FormData(e).entries())N(r)||typeof n!="string"||t.push([r,n]);return t.length>0?t:Cn(e)}catch{}return Cn(e)},Ne=class cn{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 Xi(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"?Tn(t):t;return this.element.replaceWith(r),new cn(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 Oe(this.element)?this.element.offsetParent:null}position(){if(!Oe(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}innerWidth(){return Tt(this.element,"width")}innerHeight(){return Tt(this.element,"height")}outerWidth(t=!1){return Rt(this.element,"width",t)}outerHeight(t=!1){return Rt(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 cn(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 $n(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 $n(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){Rn(this.element,t,r)}},Ct=class oe{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 Ne(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 Ne(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new oe(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new Ne(t))}addClass(...t){return z(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return z(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return z(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(z(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return z(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return z(this.elements,n=>{const s=n.hasAttribute(t);r??!s?n.setAttribute(t,""):n.removeAttribute(t)}),this}text(t){return t===void 0?this.first()?.textContent??"":(z(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=kn(t);return z(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return z(this.elements,r=>{r.innerHTML=t}),this}append(t){return this.insertAll(t,"beforeend"),this}prepend(t){return this.insertAll(t,"afterbegin"),this}before(t){return this.insertAll(t,"beforebegin"),this}after(t){return this.insertAll(t,"afterend"),this}css(t,r){if(typeof t=="string"){if(r!==void 0)return z(this.elements,o=>{o.style.setProperty(t,r)}),this;const n=this.first();if(!n)return"";const s=n.ownerDocument?.defaultView;return!s||typeof s.getComputedStyle!="function"?"":s.getComputedStyle(n).getPropertyValue(t)}return z(this.elements,n=>{for(const[s,o]of Object.entries(t))n.style.setProperty(s,o)}),this}wrap(t){return this.elements.forEach((r,n)=>{const s=typeof t=="string"?document.createElement(t):n===0?t:t.cloneNode(!0);r.parentNode?.insertBefore(s,r),s.appendChild(r)}),this}unwrap(){const t=new Set;for(const r of this.elements)r.parentElement&&t.add(r.parentElement);return t.forEach(r=>{const n=r.parentNode;if(n){for(;r.firstChild;)n.insertBefore(r.firstChild,r);r.remove()}}),this}replaceWith(t){const r=[];return this.elements.forEach((n,s)=>{const o=typeof t=="string"?Tn(t):s===0?t:t.cloneNode(!0);n.replaceWith(o),r.push(o)}),new oe(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 Oe(t)?t.offsetParent:null}position(){const t=this.first();return Oe(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}innerWidth(){return Tt(this.first(),"width")}innerHeight(){return Tt(this.first(),"height")}outerWidth(t=!1){return Rt(this.first(),"width",t)}outerHeight(t=!1){return Rt(this.first(),"height",t)}show(t=""){return z(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return z(this.elements,t=>{t.style.display="none"}),this}on(t,r){return z(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return z(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return z(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return z(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return z(this.elements,o=>{const i=c=>{const l=c.target.closest(r);l&&o.contains(l)&&n(c,l)};this.delegatedHandlers.has(o)||this.delegatedHandlers.set(o,new Map);const a=this.delegatedHandlers.get(o);a.has(s)||a.set(s,new Map),a.get(s).set(n,i),o.addEventListener(t,i)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return z(this.elements,o=>{const i=this.delegatedHandlers.get(o);if(!i)return;const a=i.get(s);if(!a)return;const c=a.get(n);c&&(o.removeEventListener(t,c),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 oe(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 oe(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 oe(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 oe(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 oe(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 oe(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 oe(r)}remove(){return z(this.elements,t=>t.remove()),this}empty(){return z(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=kn(t);z(this.elements,o=>{o.insertAdjacentHTML(r,s)});return}const n=An(t);this.elements.forEach((s,o)=>{Rn(s,o===0?n:n.map(i=>i.cloneNode(!0)),r)})}},sa=e=>{if(typeof e!="string")return new Ne(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new Ne(t)},oa=e=>Array.isArray(e)?new Ct(e):e instanceof NodeList?new Ct(Array.from(e)):new Ct(Array.from(document.querySelectorAll(e)));function ia(e){return e==null?[]:Array.isArray(e)?e:[e]}function aa(e){return Array.from(new Set(e))}function ca(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 la(e){return e.filter(Boolean)}function ua(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function fr(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 On(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function fa(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function da(){}function ha(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function ma(e){return new Promise(t=>setTimeout(t,e))}function pa(e,t){try{return JSON.parse(e)}catch{return t}}function va(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 ya(e,t){return Math.floor(Math.random()*(t-e+1))+e}function ga(e,t,r){return Math.min(Math.max(e,t),r)}function ba(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function wa(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function Sa(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Ea(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function Aa(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function ka(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 Ta(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function Ra(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ca(e){return typeof Element<"u"&&e instanceof Element}function $a(e){return!!(e&&typeof e=="object"&&"elements"in e)}function Oa(e){return typeof e=="function"}function La(e){return typeof e=="string"}function Pa(e){return typeof e=="number"&&!Number.isNaN(e)}function Na(e){return typeof e=="boolean"}function Ia(e){return Array.isArray(e)}function Ma(e){return e instanceof Date}function Fe(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function Da(e){return typeof e=="object"&&e!==null}var _a={clone:Zi,merge:Pe,pick:ea,omit:ta,hasOwn:ra,debounce:fr,throttle:On,once:fa,noop:da,uid:ha,isElement:Ca,isCollection:$a,isEmpty:va,isPlainObject:Le,isFunction:Oa,isString:La,isNumber:Pa,isBoolean:Na,isArray:Ia,isDate:Ma,isPromise:Fe,isObject:Da,parseJson:pa,sleep:ma,randomInt:ya,clamp:ga,inRange:ba,toNumber:wa,capitalize:Sa,toKebabCase:Ea,toCamelCase:Aa,truncate:ka,slugify:Ta,escapeRegExp:Ra,ensureArray:ia,unique:aa,chunk:ca,compact:la,flatten:ua},Ie=[],Be=0,dr=new Set,$t=new WeakMap,hr=(e,t)=>{Ie.push(e);try{return t()}finally{Ie.pop()}},Ln=()=>Ie[Ie.length-1],mr=e=>{Ie.push(void 0);try{return e()}finally{Ie.pop()}},Pn=e=>{if(Be>0){dr.add(e);return}e()},xa=()=>{for(const e of Array.from(dr)){dr.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},qa=()=>{Be+=1},za=()=>{Be<=0||(Be-=1,Be===0&&xa())},Nn=(e,t)=>{let r=$t.get(e);r||(r=new Set,$t.set(e,r)),r.add(t)},ja=(e,t)=>{const r=$t.get(e);r&&r.delete(t)},Qe=e=>{const t=$t.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},Se=e=>{qa();try{e()}finally{za()}},In={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"}},Ve=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>Ve(t));if(Le(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=Ve(n);return t}return e},pr=Ve(In),Ua=e=>(pr=Ve(Pe(In,pr,e)),ae()),ae=()=>Ve(pr),Ke=[],Ot=e=>typeof e=="object"&&e!==null&&"_addDisposer"in e,Ha=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",Wa=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")},Ye=()=>{for(let e=Ke.length-1;e>=0;e--)if(Ke[e].active)return Ke[e]},Fa=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(Wa(e))throw new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");Ke.push(this);try{const t=e();if(Ha(t))throw this.stop(),new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");return t}finally{Ke.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}}},Ba=()=>{const e=new Fa,t=Ye();return Ot(t)&&t._addDisposer(()=>e.stop()),e},Mn=()=>Ye(),Dn=e=>{const t=Ye();if(!t||!t.active||!Ot(t))throw new Error("bQuery reactive: onScopeDispose() must be called inside an active effectScope");t._addDisposer(e)},Je=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)Pn(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=mr(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=Ln();return e&&(this.subscribers.add(e),Nn(e,this)),this.dirty&&(this.dirty=!1,Qe(this.markDirty),this.cachedValue=hr(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=mr(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,Qe(this.markDirty),this.cachedValue=hr(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,Qe(this.markDirty),this.subscribers.clear()}},D=e=>{const t=new Je(e),r=Ye();return Ot(r)&&r._addDisposer(()=>t.dispose()),t},j=e=>{let t,r=!1;const n=Ye(),s=()=>{if(t){try{t()}catch(c){console.error("bQuery reactive: Error in effect cleanup",c)}t=void 0}},o=()=>{s(),Qe(a)},i=()=>{r||(r=!0,o())};Ot(n)&&n._addDisposer(i);const a=()=>{if(!r){s(),Qe(a);try{t=hr(a,e)}catch(c){console.error("bQuery reactive: Error in effect",c)}r&&o()}};return a(),i},Ge=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=Ln();return e&&(this.subscribers.add(e),Nn(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)Pn(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)ja(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},L=e=>new Ge(e),Ee=e=>mr(e),Qa=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))}},Va=e=>typeof e=="function"?e():e.value,_n=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},Ka=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),Ya=(e,t)=>e==null||Ka(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),Ja=e=>typeof e=="function"?e():e,Ga=(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))}},Xa=(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)},Za=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)}`)}},vr=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},ec=(e,t,r)=>{const n=t instanceof Request?vr(t.method):void 0;return e??n??(r?"POST":void 0)},tc=(e,t,r)=>e||(t instanceof Request?void 0:r),rc=e=>{const t=vr(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}},xn=(e,t={})=>{const r=t.immediate??!0,n=L(t.defaultValue),s=L(null),o=L("idle"),i=D(()=>o.value==="pending");let a=0,c=!1,l=()=>{};const u=()=>{a+=1,n.value=t.defaultValue,s.value=null,o.value="idle"},h=()=>{c||(c=!0,a+=1,l())},d=async()=>{if(c)return n.peek();const p=++a;o.value="pending",s.value=null;try{const f=await e(),m=t.transform?t.transform(f):f;return c||p!==a?n.peek():(n.value=m,o.value="success",t.onSuccess?.(m),m)}catch(f){const m=Qa(f);return c||p!==a||(s.value=m,o.value="error",t.onError?.(m)),n.peek()}};if(t.watch?.length){let p=!1;l=j(()=>{for(const f of t.watch??[])Va(f);if(!p){p=!0,r&&Ee(()=>d());return}Ee(()=>d())})}else r&&d();return{data:n,error:s,status:o,pending:i,execute:d,refresh:d,abort:()=>{},clear:u,dispose:h}},nc=e=>e>=200&&e<300,qn=(e,t)=>e instanceof DOMException&&e.name===t,Lt=e=>qn(e,"TimeoutError"),zn=e=>qn(e,"AbortError"),sc=e=>{if(zn(e)||Lt(e)||e.code==="ABORT"||e.code==="TIMEOUT")return!1;const t=e.status;return t===void 0||t>=500},oc=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},ic=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),ac=(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})}),re=(e,t={})=>{const r=ae().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch,o=t.validateStatus??nc;let i=null;const a=(l,u)=>{const h=u||Lt(l)||Lt(i?.signal.reason);return Object.assign(new Error(h?`Request timeout of ${t.timeout}ms exceeded`:"Request aborted"),{code:h?"TIMEOUT":"ABORT"})},c=xn(async()=>{const l=Ja(e),u=typeof l=="string"||l instanceof URL?Xa(l,t.baseUrl??r?.baseUrl):l instanceof Request&&t.query?new URL(l.url):null;u&&t.query&&Ga(u,t.query);const h=_n(r?.headers,l instanceof Request?l.headers:void 0,t.headers),d=t.body!=null,p=vr(t.method),f=ec(p,l,d),m=f==="GET"||f==="HEAD"?f:null;if(d&&m)throw new Error(`Cannot send a request body with ${m} requests`);const v=tc(p,l,f),b=oc(t.retry),g=(b?.count??0)+1,w=new AbortController;i=w;let S,k=!1,A;t.signal&&(t.signal.aborted?w.abort(t.signal.reason):(A=()=>w.abort(t.signal?.reason),t.signal.addEventListener("abort",A,{once:!0}))),t.timeout&&t.timeout>0&&(S=setTimeout(()=>{k=!0,w.abort(new DOMException("Request timeout","TimeoutError"))},t.timeout));const E={...t,method:v,headers:h};delete E.baseUrl,delete E.query,delete E.parseAs,delete E.fetcher,delete E.defaultValue,delete E.immediate,delete E.watch,delete E.transform,delete E.onSuccess,delete E.onError,delete E.timeout,delete E.retry,delete E.validateStatus;let T=u??l;l instanceof Request&&u&&u.toString()!==l.url&&(T=new Request(u.toString(),rc(l)));const P=()=>{const $=new Headers(h);return{...E,headers:$,body:Ya(t.body,$),signal:w.signal}};if(g>1&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream)throw new Error("Cannot retry requests with ReadableStream bodies");if(g>1&&typeof Request<"u"&&T instanceof Request&&T.body!==null)throw new Error("Cannot retry requests with non-replayable Request bodies");let C;try{for(let $=0;$<g;$++)try{const R=await s(T,P());if(!o(R.status))throw Object.assign(new Error(`Request failed with status ${R.status}`),{response:R,status:R.status,statusText:R.statusText});return await Za(R,n)}catch(R){const O=R instanceof Error?R:new Error(String(R));if(w.signal.aborted||zn(O)||Lt(O))throw a(w.signal.aborted?w.signal.reason:O,k);if(C=O,!(b&&(b.retryOn??sc)(O,$))||$>=g-1)throw O;await ac(ic(b.delay,$),w.signal)}throw C}finally{S!==void 0&&clearTimeout(S),t.signal&&A&&t.signal.removeEventListener("abort",A),i===w&&(i=null)}},t);return c.abort=()=>{i&&i.abort(new DOMException("Request aborted","AbortError"))},c};function cc(e={}){return(t,r={})=>{const n=e,s=Pe({},n.query??{},r.query??{});return re(t,{...n,...r,headers:_n(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var ye=class extends Error{constructor(e,t,r,n){super(e),this.name="HttpError",this.config=t,this.code=r,this.response=n}};function jn(){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 lc=e=>e>=200&&e<300,uc=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},fc=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},dc=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),hc=(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})}),Un=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},mc=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),pc=(e,t)=>e==null||mc(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),vc=(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))}},yc=(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)},gc=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 ye(`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})}},bc=(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:c,value:l}=await o.read();if(c){a.close();return}s+=l.byteLength,t({loaded:s,total:n,percent:n>0?Math.round(s/n*100):void 0}),a.enqueue(l)},cancel(a){o.cancel(a)}});return new Response(i,{status:e.status,statusText:e.statusText,headers:e.headers})},wc=async e=>{const t=ae().fetch,r=e.parseAs??t?.parseAs??"json",n=e.fetcher??fetch,s=e.validateStatus??lc,o=yc(e.url??"/",e.baseUrl??t?.baseUrl);e.query&&vc(o,e.query);const i=Un(t?.headers,e.headers),a=pc(e.body,i),c={};e.method&&(c.method=e.method.toUpperCase()),c.headers=i,a!=null&&(c.body=a),e.cache&&(c.cache=e.cache),e.credentials&&(c.credentials=e.credentials),e.integrity&&(c.integrity=e.integrity),e.keepalive!==void 0&&(c.keepalive=e.keepalive),e.mode&&(c.mode=e.mode),e.redirect&&(c.redirect=e.redirect),e.referrer&&(c.referrer=e.referrer),e.referrerPolicy&&(c.referrerPolicy=e.referrerPolicy);let l,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})),l=setTimeout(()=>{d.abort(new DOMException("Request timeout","TimeoutError"))},e.timeout),u=d.signal}u&&(c.signal=u);try{let d=await n(o.toString(),c);if(e.onDownloadProgress&&(d=bc(d,e.onDownloadProgress)),!s(d.status))throw new ye(`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 gc(d,r,e),status:d.status,statusText:d.statusText,headers:d.headers,config:e}}catch(d){if(d instanceof ye)throw d;if(d instanceof DOMException&&(d.name==="AbortError"||d.name==="TimeoutError")){const p=d.name==="TimeoutError"||d.message==="Request timeout";throw new ye(p?`Request timeout of ${e.timeout}ms exceeded`:"Request aborted",e,p?"TIMEOUT":"ABORT")}throw new ye(d instanceof Error?d.message:String(d),e,"NETWORK")}finally{l!==void 0&&clearTimeout(l),e.signal&&h&&e.signal.removeEventListener("abort",h)}};function yr(e={}){const t=jn(),r=jn(),n=i=>{const a=Pe({},e.query??{},i.query??{});return{...e,...i,headers:Un(e.headers,i.headers),query:Object.keys(a).length>0?a:void 0}},s=async i=>{let a=i;const c=[];t.forEach(d=>c.push(d));for(const{fulfilled:d,rejected:p}of c)try{d&&(a=await d(a))}catch(f){if(p){const m=await p(f);if(Le(m))a=m;else throw f}else throw f}const l=fc(a.retry);let u;const h=(l?.count??0)+1;for(let d=0;d<h;d++)try{let p=await wc(a);const f=[];r.forEach(m=>f.push(m));for(const{fulfilled:m,rejected:v}of f)try{m&&(p=await m(p))}catch(b){if(v){const g=await v(b);if(g&&typeof g=="object"&&"data"in g)p=g;else throw b}else throw b}return p}catch(p){const f=p instanceof ye?p:new ye(p instanceof Error?p.message:String(p),a,"NETWORK");if(u=f,!(l&&(l.retryOn??uc)(f,d))||d>=h-1){const v=[];r.forEach(g=>v.push(g));let b=f;for(const{rejected:g}of v)if(g)try{const w=await g(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=f),b}const m=l?dc(l.delay,d):0;l?.onRetry?.(f,d+1),await hc(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,c={})=>o({...c,url:i,method:"POST",body:a}),put:(i,a,c={})=>o({...c,url:i,method:"PUT",body:a}),patch:(i,a,c={})=>o({...c,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 Sc=yr();function Ec(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 Ac=(e,t)=>{const r=D(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},kc=(e,t={})=>{const{initialPage:r=1,...n}=t,s=L(r),o=re(()=>e(s.value),{...n,watch:n.watch});return{...o,page:s,next:async()=>(s.value=s.peek()+1,o.execute()),prev:async()=>{const l=s.peek();return l>1&&(s.value=l-1),o.execute()},goTo:async l=>(s.value=Math.max(1,l),o.execute())}},Tc=(e,t)=>{const{getNextCursor:r,transform:n,initialCursor:s,immediate:o=!0,onSuccess:i,onError:a,...c}=t,l=L([]),u=L(t.defaultValue),h=L(null),d=L("idle"),p=D(()=>d.value==="pending"),f=L(s),m=D(()=>l.value.length===0||f.value!==void 0);let v=!1,b=0;const g=E=>n?n(E):E,w=async()=>{if(v)return u.peek();const E=++b;d.value="pending",h.value=null;try{const T=re(e(f.peek()),{...c,immediate:!1,watch:void 0}),P=await T.execute(),C=T.error.peek();if(T.dispose(),v||E!==b)return u.peek();if(C)return h.value=C,d.value="error",a?.(C),u.peek();if(P!==void 0){const $=P,R=[...l.peek(),$];l.value=R,f.value=r($,R);const O=g(R);return u.value=O,d.value="success",i?.(O),O}return d.value="success",u.peek()}catch(T){if(v||E!==b)return u.peek();const P=T instanceof Error?T:new Error(String(T));return h.value=P,d.value="error",a?.(P),u.peek()}},S=async()=>(l.value=[],f.value=s,u.value=t.defaultValue,h.value=null,d.value="idle",b+=1,w()),k=()=>{b+=1,l.value=[],f.value=s,u.value=t.defaultValue,h.value=null,d.value="idle"},A=()=>{v||(v=!0,b+=1)};return o&&w(),{data:u,pages:l,error:h,status:d,pending:p,hasMore:m,fetchNextPage:w,refresh:S,clear:k,dispose:A}},Rc=(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=L(s);return r&&n&&j(()=>{try{n.setItem(e,JSON.stringify(o.value))}catch{}}),o},Cc=(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 c=L(!1),l=L(!1),u=L(!1),h=typeof n=="function"?n:()=>n,d=D(()=>h()&&!c.value&&!(s&&l.value)&&!(o&&u.value)),p=re(e,{...a,immediate:i&&h()});let f,m=[];const v=()=>{b(),f=setInterval(()=>{p.execute()},r)},b=()=>{f!==void 0&&(clearInterval(f),f=void 0)},g=j(()=>{const k=d.value;Ee(()=>{k?v():b()})});if(s&&typeof document<"u"){l.value=document.hidden;const k=()=>{l.value=document.hidden};document.addEventListener("visibilitychange",k),m.push(()=>document.removeEventListener("visibilitychange",k))}if(o&&typeof window<"u"){const k=()=>{u.value=!1},A=()=>{u.value=!0};window.addEventListener("online",k),window.addEventListener("offline",A),m.push(()=>{window.removeEventListener("online",k),window.removeEventListener("offline",A)}),u.value=typeof navigator<"u"&&navigator.onLine!==void 0?!navigator.onLine:!1}const w=p.dispose;return{...p,pause:()=>{c.value=!0},resume:()=>{c.value=!1},isActive:d,dispose:()=>{b(),g();for(const k of m)k();m=[],w()}}},Hn=Symbol("bquery.readonlySignal"),Wn=e=>typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,Hn),_=e=>Object.defineProperties({},{value:{get(){return e.value},enumerable:!0},peek:{value(){return e.peek()},enumerable:!0},[Hn]:{value:!0,enumerable:!1,configurable:!1,writable:!1}}),$c=(e,t={})=>{const{optimistic:r=!1,onMutationSuccess:n,onMutationError:s,...o}=t,i=re(e,{...o}),a=L(!1),c=D(()=>a.value);let l=!1;const u=()=>{const v=typeof e=="function"?e():e;return v instanceof URL?v.toString():v},h=()=>{const{defaultValue:v,transform:b,onSuccess:g,onError:w,...S}=o;return S},d=async(v,b,g,w)=>{if(l)return i.data.peek();const S=i.data.peek();r&&w!==void 0&&(i.data.value=w),a.value=!0,i.error.value=null;try{const k=re(u(),{...h(),method:b,body:g??void 0,immediate:!1,watch:void 0}),A=await k.execute(),E=k.error.peek();return k.dispose(),l?i.data.peek():E?(r&&w!==void 0&&(i.data.value=S),i.error.value=E,i.status.value="error",a.value=!1,s?.(E,v),i.data.peek()):(b!=="DELETE"&&A!==void 0&&(i.data.value=A),a.value=!1,i.status.value="success",n?.(A,v),A)}catch(k){if(l)return i.data.peek();r&&w!==void 0&&(i.data.value=S);const A=k instanceof Error?k:new Error(String(k));return i.error.value=A,i.status.value="error",a.value=!1,s?.(A,v),i.data.peek()}},p={fetch:()=>i.execute(),create:v=>d("create","POST",v),update:v=>{const b=i.data.peek();return d("update","PUT",v,r&&b!==void 0?{...b,...v}:void 0)},patch:v=>{const b=i.data.peek();return d("patch","PATCH",v,r&&b!==void 0?{...b,...v}:void 0)},remove:async()=>{await d("remove","DELETE"),!l&&i.error.peek()==null&&(i.data.value=void 0)}},f=i.dispose,m=()=>{l||(l=!0,f())};return{data:i.data,error:i.error,status:i.status,pending:i.pending,isMutating:c,actions:p,refresh:i.execute,clear:i.clear,dispose:m}},Oc=(e,t={})=>{const{method:r="POST",...n}=t,s=L(void 0),o=L(null),i=L("idle"),a=D(()=>i.value==="pending");return{data:s,error:o,status:i,pending:a,submit:async u=>{i.value="pending",o.value=null;try{const h=re(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"}}},Lc=(e,t={})=>{const r=yr({...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}},Pc=(e,t={})=>{const{getId:r=g=>g.id,optimistic:n=!1,onMutationSuccess:s,onMutationError:o,...i}=t,a=re(e,{...i}),c=L(!1),l=D(()=>c.value);let u=!1;const h=()=>{const g=typeof e=="function"?e():e;return g instanceof URL?g.toString():g},d=()=>{let g=h();for(;g.endsWith("/");)g=g.slice(0,-1);return g},p=()=>{const{defaultValue:g,transform:w,onSuccess:S,onError:k,...A}=i;return A},f=async(g,w,S,k,A,E)=>{if(!u){n&&A&&A(),c.value=!0,a.error.value=null;try{const T=re(`${d()}${S}`,{...p(),method:w,body:k??void 0,immediate:!1,watch:void 0}),P=await T.execute(),C=T.error.peek();if(T.dispose(),u)return;if(C){n&&E&&E(),a.error.value=C,a.status.value="error",c.value=!1,o?.(C,g);return}return c.value=!1,a.status.value="success",s?.(g),P}catch(T){if(u)return;n&&E&&E();const P=T instanceof Error?T:new Error(String(T));a.error.value=P,a.status.value="error",c.value=!1,o?.(P,g);return}}},m={fetch:()=>a.execute(),add:async g=>{const w=a.data.peek(),S=g,k=w?.length??0,A=await f("add","POST","",g,n?()=>{a.data.value=[...w??[],S]}:void 0,n?()=>{a.data.value=w}:void 0);if(A!==void 0&&!u){const E=a.data.peek()??[];if(n){const T=[...E];k<T.length&&T[k]===S?T[k]=A:T.push(A),a.data.value=T}else a.data.value=[...E,A]}return A},update:async(g,w)=>{const S=a.data.peek(),k=await f("update","PUT",`/${encodeURIComponent(String(g))}`,w,n&&S?()=>{a.data.value=S.map(A=>r(A)===g?{...A,...w}:A)}:void 0,n?()=>{a.data.value=S}:void 0);if(k!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(E=>r(E)===g?k:E)}return k},patch:async(g,w)=>{const S=a.data.peek(),k=await f("patch","PATCH",`/${encodeURIComponent(String(g))}`,w,n&&S?()=>{a.data.value=S.map(A=>r(A)===g?{...A,...w}:A)}:void 0,n?()=>{a.data.value=S}:void 0);if(k!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(E=>r(E)===g?k:E)}return k},remove:async g=>{const w=a.data.peek();if(await f("remove","DELETE",`/${encodeURIComponent(String(g))}`,void 0,n&&w?()=>{a.data.value=w.filter(S=>r(S)!==g)}:void 0,n?()=>{a.data.value=w}:void 0),!n&&!u&&a.error.peek()==null){const S=a.data.peek()??[];a.data.value=S.filter(k=>r(k)!==g)}}},v=a.dispose,b=()=>{u||(u=!0,v())};return{data:a.data,error:a.error,status:a.status,pending:a.pending,isMutating:l,actions:m,refresh:a.execute,clear:a.clear,dispose:b}},gr=new Map;function Nc(e,t){const r=gr.get(e);if(r)return r;const n=t().finally(()=>{gr.delete(e)});return gr.set(e,n),n}var G=e=>e instanceof Ge,ce=e=>e instanceof Je,Ic=e=>e instanceof Ge||e instanceof Je||Wn(e)?e.value:e,br=(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)})},Mc=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=Number.isFinite(r)?Math.max(0,r):0;let a=!1,c,l;const u=()=>{h.cancel(),a=!1,l=void 0},h=fr(()=>{if(a){try{t(c,l)}catch(p){console.error("bQuery reactive: Error in watchDebounce callback",p)}a=!1,l=void 0}},i);s&&t(e.peek(),void 0);const d=br(e,(p,f)=>{a||(l=f),c=p,a=!0,h()},{equals:o});return Mn()&&Dn(u),()=>{d(),u()}},Dc=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=On((c,l)=>{t(c,l)},Number.isFinite(r)?Math.max(0,r):0);s&&i(e.peek(),void 0);const a=br(e,(c,l)=>{i(c,l)},{equals:o});return()=>{a(),i.cancel()}};function Fn(e){return e===!1?!1:e===!0||e===void 0?{}:e}var _c=e=>e?e===!0?{}:e:!1,Bn=(e,t)=>{const r=t.delay??1e3,n=t.factor??2,s=t.maxDelay??3e4;return Math.min(r*n**e,s)},wr=(e,t)=>{if(typeof t=="string"||t instanceof Blob||t instanceof ArrayBuffer){e.send(t);return}if(ArrayBuffer.isView(t)){e.send(t);return}if(typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer){e.send(t);return}throw new TypeError("Unsupported WebSocket payload type.")},Qn=(e,t={})=>{const{protocols:r,immediate:n=!0,historySize:s=0,onOpen:o,onMessage:i,onClose:a,onError:c,onReconnect:l}=t,u=t.serialize??(M=>JSON.stringify(M)),h=t.deserialize??(M=>{const B=M.data;if(typeof B=="string")try{return JSON.parse(B)}catch{return B}return B}),d=L("CLOSED"),p=L(void 0),f=L(null),m=L([]),v=L(0),b=L(0),g=L(0),w=D(()=>d.value==="OPEN");let S=null,k=!1,A=!1,E,T,P,C=0,$=!1,R=0;const O=[],I=Fn(t.autoReconnect),x=_c(t.heartbeat),W=()=>{if(!x)return;q();const M=x.interval??3e4,B=x.pongTimeout??1e4,J=x.message??"ping";T=setInterval(()=>{S?.readyState===WebSocket.OPEN&&(R=Date.now(),wr(S,J),P!==void 0&&clearTimeout(P),P=setTimeout(()=>{S?.close(4e3,"Heartbeat timeout")},B))},M)},q=()=>{T!==void 0&&(clearInterval(T),T=void 0),P!==void 0&&(clearTimeout(P),P=void 0)},V=()=>{P!==void 0&&(clearTimeout(P),P=void 0),R>0&&(b.value=Date.now()-R,R=0)},ve=M=>{if(k||A||!I)return;const B=I.maxAttempts??1/0;if(C>=B||I.shouldReconnect&&!I.shouldReconnect(M,C))return;const J=Bn(C,I);E=setTimeout(()=>{C++,v.value=C,$=!0,an()},J)},We=()=>{E!==void 0&&(clearTimeout(E),E=void 0)},on=()=>{if(!S||S.readyState!==WebSocket.OPEN)return;let M=0;for(;M<O.length&&S.readyState===WebSocket.OPEN;M++)wr(S,O[M]);M>0&&O.splice(0,M)},Et=()=>{const M=typeof e=="function"?e():e;return M instanceof URL?M.toString():M},an=()=>{if(!k){We(),S&&(q(),R=0,S.onopen=null,S.onmessage=null,S.onclose=null,S.onerror=null,(S.readyState===WebSocket.OPEN||S.readyState===WebSocket.CONNECTING)&&S.close(),S=null),A=!1,d.value="CONNECTING",f.value=null;try{S=new WebSocket(Et(),r)}catch{d.value="CLOSED";return}S.onopen=M=>{d.value="OPEN";const B=$,J=C;C=0,v.value=0,$=!1,on(),W(),o?.(M),B&&l?.(J)},S.onmessage=M=>{if(x){const J=x.responseMessage;(J===void 0||M.data===J)&&V()}const B=h(M);if(p.value=B,s>0){const J=[...m.peek(),B];m.value=J.length>s?J.slice(-s):J}i?.(B,M)},S.onclose=M=>{d.value="CLOSED",q(),A||(g.value=Date.now()),a?.(M),!A&&!k&&ve(M)},S.onerror=M=>{f.value=M,c?.(M)}}},_i=(M,B)=>{A=!0,We(),q(),S&&(S.readyState===WebSocket.OPEN||S.readyState===WebSocket.CONNECTING)&&(d.value="CLOSING",S.close(M,B))},Np=M=>{k||xi(u(M))},xi=M=>{k||(S?.readyState===WebSocket.OPEN?wr(S,M):O.push(M))},Ip=()=>{k||(k=!0,_i(),O.length=0,S=null)};return n&&an(),{status:d,data:p,error:f,history:m,isConnected:w,reconnectAttempts:v,latency:b,lastDisconnectedAt:g,send:Np,sendRaw:xi,open:an,close:_i,dispose:Ip}},xc=(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=Qn(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=L(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}},qc=(e,t={})=>{const{immediate:r=!0,events:n=[],eventSourceInit:s,onOpen:o,onMessage:i,onError:a}=t,c=t.deserialize??($=>{try{return JSON.parse($)}catch{return $}}),l=L("CLOSED"),u=L(void 0),h=L(void 0),d=L(null),p=D(()=>l.value==="OPEN"),f=Fn(t.autoReconnect);let m=null,v=!1,b=!1,g,w=0;const S=()=>{const $=typeof e=="function"?e():e;return $ instanceof URL?$.toString():$},k=$=>R=>{const O=c(R.data);u.value=O,h.value=$,i?.(O,R)},A=()=>{g!==void 0&&(clearTimeout(g),g=void 0)},E=()=>{if(v||b||!f)return;const $=f.maxAttempts??1/0;if(w>=$)return;const R=Bn(w,f);g=setTimeout(()=>{w++,T()},R)},T=()=>{if(!v){A(),m&&(m.close(),m=null),b=!1,l.value="CONNECTING",d.value=null;try{m=new EventSource(S(),s)}catch{l.value="CLOSED";return}m.onopen=$=>{l.value="OPEN",w=0,o?.($)},m.onerror=$=>{d.value=$,a?.($),m?.readyState===EventSource.CLOSED&&(l.value="CLOSED",!b&&!v&&E())},m.addEventListener("message",k("message"));for(const $ of n)m.addEventListener($,k($))}},P=()=>{b=!0,A(),m&&(m.close(),m=null),l.value="CLOSED"},C=()=>{v||(v=!0,P())};return r&&T(),{status:l,data:u,eventName:h,error:d,isConnected:p,open:T,close:P,dispose:C}},H=class extends Error{constructor(e,t,r){super(e),this.name="TaskWorkerError",this.code=t,r!==void 0&&(this.cause=r)}},Sr=class extends H{constructor(e="Concurrency tasks are not supported in this environment.",t){super(e,"UNSUPPORTED",t),this.name="TaskWorkerUnsupportedError"}},Ae=class extends H{constructor(e,t){super(e,"SERIALIZATION",t),this.name="TaskWorkerSerializationError"}},Pt=class extends H{constructor(e,t){super(e,"TIMEOUT",t),this.name="TaskWorkerTimeoutError"}},ge=class extends H{constructor(e="The worker task was aborted.",t){super(e,"ABORT",t),this.name="TaskWorkerAbortError"}},zc=new Set(["ABORT","BUSY","METHOD_NOT_FOUND","QUEUE_CLEARED","QUEUE_FULL","SERIALIZATION","TERMINATED","TIMEOUT","UNSUPPORTED","WORKER"]),jc=/\{\s*\[native code\]\s*\}$/u,Uc=e=>typeof e=="string"&&zc.has(e),Nt=e=>{if(!(typeof e!="number"||!Number.isFinite(e)||e<=0))return e},Xe=e=>{const t=Function.prototype.toString.call(e).trim();if(!t||jc.test(t))throw new Ae("Task handlers must be standalone user-defined functions or arrow functions.");try{if(typeof new Function(`return (${t});`)()!="function")throw new TypeError("Task handler did not revive as a function.")}catch(r){throw new Ae("Task handlers must be standalone functions that can be reconstructed in a worker context.",r)}return t},Vn=(e,t)=>{const r=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(r);try{return new Worker(n,t?{name:t}:void 0)}finally{URL.revokeObjectURL(n)}},Kn=e=>{const t=e?.message||"Worker task failed.",r=Uc(e?.code)?e.code:"WORKER",n=r==="TIMEOUT"?new Pt(t):new H(t,r);return n.name=e?.name||n.name,e?.stack&&(n.stack=e.stack),n};function Yn(){const e=typeof globalThis.Worker=="function",t=typeof globalThis.Blob=="function",r=typeof globalThis.URL<"u"&&globalThis.URL!==null&&typeof globalThis.URL.createObjectURL=="function"&&typeof globalThis.URL.revokeObjectURL=="function";return{worker:e,blob:t,objectUrl:r,abortController:typeof globalThis.AbortController=="function",supported:e&&t&&r}}function Er(){return Yn().supported}var Jn="bq:rpc",Hc=e=>{const t=Object.keys(e);if(t.length===0)throw new Ae("RPC workers require at least one standalone method handler.");return t.map(r=>{const n=e[r];if(typeof n!="function")throw new Ae(`RPC handler "${r}" must be a standalone function.`);return[r,Xe(n)]})},Wc=e=>`'use strict';
2
+ const serializeError = (error) => {
3
+ if (error && typeof error === 'object') {
4
+ return {
5
+ code: typeof error.code === 'string' ? error.code : undefined,
6
+ message: typeof error.message === 'string' ? error.message : 'Worker RPC call failed.',
7
+ name: typeof error.name === 'string' ? error.name : 'Error',
8
+ stack: typeof error.stack === 'string' ? error.stack : undefined,
9
+ };
10
+ }
11
+
12
+ return {
13
+ message: typeof error === 'string' ? error : 'Worker RPC call failed.',
14
+ name: 'Error',
15
+ };
16
+ };
17
+
18
+ const handlers = Object.create(null);
19
+ ${e.map(([t,r])=>`handlers[${JSON.stringify(t)}] = (${r});`).join(`
20
+ `)}
21
+
22
+ const hasOwn = Object.prototype.hasOwnProperty;
23
+
24
+ self.onmessage = async (event) => {
25
+ const message = event.data;
26
+ if (!message || message.type !== '${Jn}') {
27
+ return;
28
+ }
29
+
30
+ const method = typeof message.method === 'string' ? message.method : '';
31
+ if (!hasOwn.call(handlers, method)) {
32
+ self.postMessage({
33
+ error: {
34
+ code: 'METHOD_NOT_FOUND',
35
+ message: 'Unknown RPC method "' + String(method) + '".',
36
+ name: 'TaskWorkerError',
37
+ },
38
+ id: message.id,
39
+ type: 'bq:error',
40
+ });
41
+ return;
42
+ }
43
+
44
+ try {
45
+ const result = await handlers[method](message.payload);
46
+ self.postMessage({ id: message.id, result, type: 'bq:result' });
47
+ } catch (error) {
48
+ self.postMessage({ error: serializeError(error), id: message.id, type: 'bq:error' });
49
+ }
50
+ };`;function It(e,t={}){if(!Er())throw new Sr;const r=Wc(Hc(e)),n=Nt(t.timeout);let s=!1,o=null,i=null,a=0,c;const l=()=>{i&&(i.timeoutId!==void 0&&clearTimeout(i.timeoutId),i.abortHandler&&c?.removeEventListener("abort",i.abortHandler),i=null,c=void 0)},u=()=>{o&&(o.onmessage=null,o.onerror=null,o.terminate(),o=null)},h=f=>{if(!i)return;const m=i;l(),m.reject(f)},d=()=>{if(s)throw new H("The RPC worker has already been terminated.","TERMINATED");if(o)return o;const f=Vn(r,t.name);return f.onmessage=m=>{const v=i;if(!v)return;const b=m.data;if(!(!b||b.id!==v.id)){if(l(),b.type==="bq:error"){v.reject(Kn(b.error));return}v.resolve(b.result)}},f.onerror=m=>{const v=new H(m.message||"Worker RPC execution failed.","WORKER");u(),h(v)},o=f,f},p=f=>{u(),h(f)};return{get busy(){return i!==null},get state(){return s?"terminated":i?"running":"idle"},call(f,m,v={}){if(s)return Promise.reject(new H("The RPC worker has already been terminated.","TERMINATED"));if(i)return Promise.reject(new H("This RPC worker is already processing a request. Wait for the current call to finish or create another worker.","BUSY"));if(v.signal?.aborted)return Promise.reject(new ge);const b=d(),g=Nt(v.timeout)??n,w=a++;return new Promise((S,k)=>{const A={id:w,reject:k,resolve:S};v.signal&&(A.abortHandler=()=>{p(new ge)},c=v.signal,v.signal.addEventListener("abort",A.abortHandler,{once:!0})),g!==void 0&&(A.timeoutId=setTimeout(()=>{p(new Pt(`Worker RPC call exceeded the timeout of ${g}ms.`))},g)),i=A;try{b.postMessage({id:w,method:f,payload:m,type:Jn},v.transfer??[])}catch(E){u(),h(new Ae("Failed to serialize the RPC payload or transfer list for worker execution.",E))}})},terminate(){s||(s=!0,u(),h(new H("The RPC worker was terminated.","TERMINATED")))}}}async function Fc(e,t,r,n={}){const s=It(e,n);try{return await s.call(t,r,n)}finally{s.terminate()}}var Gn="bq:run",Bc=e=>`'use strict';
51
+ const serializeError = (error) => {
52
+ if (error && typeof error === 'object') {
53
+ return {
54
+ code: typeof error.code === 'string' ? error.code : undefined,
55
+ message: typeof error.message === 'string' ? error.message : 'Worker task failed.',
56
+ name: typeof error.name === 'string' ? error.name : 'Error',
57
+ stack: typeof error.stack === 'string' ? error.stack : undefined,
58
+ };
59
+ }
60
+
61
+ return {
62
+ message: typeof error === 'string' ? error : 'Worker task failed.',
63
+ name: 'Error',
64
+ };
65
+ };
66
+
67
+ const handler = (${e});
68
+
69
+ if (typeof handler !== 'function') {
70
+ throw new TypeError('The worker task handler must evaluate to a function.');
71
+ }
72
+
73
+ self.onmessage = async (event) => {
74
+ const message = event.data;
75
+ if (!message || message.type !== '${Gn}') {
76
+ return;
77
+ }
78
+
79
+ try {
80
+ const result = await handler(message.payload);
81
+ self.postMessage({ id: message.id, result, type: 'bq:result' });
82
+ } catch (error) {
83
+ self.postMessage({ error: serializeError(error), id: message.id, type: 'bq:error' });
84
+ }
85
+ };`;function Mt(e,t={}){if(!Er())throw new Sr;const r=Bc(Xe(e)),n=Nt(t.timeout);let s=!1,o=null,i=null,a=0;const c=()=>{i&&(i.timeoutId!==void 0&&clearTimeout(i.timeoutId),i.abortHandler&&l?.removeEventListener("abort",i.abortHandler),i=null,l=void 0)};let l;const u=()=>{o&&(o.onmessage=null,o.onerror=null,o.terminate(),o=null)},h=f=>{if(!i)return;const m=i;c(),m.reject(f)},d=()=>{if(s)throw new H("The task worker has already been terminated.","TERMINATED");if(o)return o;const f=Vn(r,t.name);return f.onmessage=m=>{const v=i;if(!v)return;const b=m.data;if(!(!b||b.id!==v.id)){if(c(),b.type==="bq:error"){v.reject(Kn(b.error));return}v.resolve(b.result)}},f.onerror=m=>{const v=new H(m.message||"Worker execution failed.","WORKER");u(),h(v)},o=f,f},p=f=>{u(),h(f)};return{get busy(){return i!==null},get state(){return s?"terminated":i?"running":"idle"},run(f,m={}){if(s)return Promise.reject(new H("The task worker has already been terminated.","TERMINATED"));if(i)return Promise.reject(new H("This task worker is already running a task. Create another worker or wait for the current task to finish.","BUSY"));if(m.signal?.aborted)return Promise.reject(new ge);const v=d(),b=Nt(m.timeout)??n,g=a++;return new Promise((w,S)=>{const k={id:g,reject:S,resolve:w};m.signal&&(k.abortHandler=()=>{p(new ge)},l=m.signal,m.signal.addEventListener("abort",k.abortHandler,{once:!0})),b!==void 0&&(k.timeoutId=setTimeout(()=>{p(new Pt(`Worker task exceeded the timeout of ${b}ms.`))},b)),i=k;try{v.postMessage({id:g,payload:f,type:Gn},m.transfer??[])}catch(A){u(),h(new Ae("Failed to serialize the task input or transfer list for worker execution.",A))}})},terminate(){s||(s=!0,u(),h(new H("The task worker was terminated.","TERMINATED")))}}}async function Xn(e,t,r={}){const n=Mt(e,r);try{return await n.run(t,r)}finally{n.terminate()}}var Qc=4,Zn=(e,t)=>{if(e===void 0)return Qc;if(!Number.isInteger(e)||e<1)throw new RangeError(`${t} concurrency must be a positive integer.`);return e},es=(e,t)=>{if(e===void 0)return Number.POSITIVE_INFINITY;if(e===Number.POSITIVE_INFINITY)return e;if(!Number.isInteger(e)||e<0)throw new RangeError(`${t} maxQueue must be a non-negative integer or Infinity.`);return e},Dt=e=>{e.abortHandler&&e.signal&&e.signal.removeEventListener("abort",e.abortHandler),e.abortHandler=void 0,e.signal=void 0},ts=({abortedWhileQueuedMessage:e,clearMessage:t,concurrency:r,createWorkers:n,queueFullMessage:s,terminatedMessage:o,workerTerminatedMessage:i,runWorker:a,maxQueue:c})=>{const l=[],u=n(r);let h=!1,d=0;const p=()=>{if(!(h||l.length===0))for(const m of u){if(l.length===0)return;if(m.busy)continue;const v=l.shift();if(v.signal?.aborted){Dt(v),v.reject(new ge(e));continue}Dt(v),d++,a(m,v.job,v.options).then(v.resolve,v.reject).finally(()=>{d--,p()})}},f=m=>{const v=l.splice(0);for(const b of v)Dt(b),b.reject(m)};return{get state(){return h?"terminated":d>0||l.length>0?"running":"idle"},get busy(){return d>0||l.length>0},concurrency:r,get pending(){return d},get size(){return l.length},enqueue(m,v={}){return h?Promise.reject(new H(i,"TERMINATED")):v.signal?.aborted?Promise.reject(new ge):new Promise((b,g)=>{const w={job:m,options:v,reject:g,resolve:b},S=u.find(k=>!k.busy);if(S){d++,a(S,m,v).then(b,g).finally(()=>{d--,p()});return}if(l.length>=c){g(new H(s,"QUEUE_FULL"));return}v.signal&&(w.signal=v.signal,w.abortHandler=()=>{const k=l.indexOf(w);k!==-1&&(l.splice(k,1),Dt(w),g(new ge(e)))},v.signal.addEventListener("abort",w.abortHandler,{once:!0})),l.push(w)})},clear(){h||l.length===0||f(new H(t,"QUEUE_CLEARED"))},terminate(){if(!h){h=!0,f(new H(o,"TERMINATED"));for(const m of u)"terminate"in m&&typeof m.terminate=="function"&&m.terminate()}}}},rs=(e,t)=>e?t===1?[e]:Array.from({length:t},(r,n)=>`${e}-${n+1}`):Array.from({length:t},()=>{});function _t(e,t={}){const{concurrency:r,maxQueue:n,...s}=t,o=ts({abortedWhileQueuedMessage:"The queued task was aborted before execution started.",clearMessage:"The task pool queue was cleared.",concurrency:Zn(r,"Task pool"),createWorkers(i){const a=[],c=rs(s.name,i);try{for(let l=0;l<i;l++)a.push(Mt(e,{...s,name:c[l]}))}catch(l){for(const u of a)u.terminate();throw l}return a},queueFullMessage:"The task pool queue is full. Increase maxQueue, wait for pending tasks, or raise pool concurrency.",terminatedMessage:"The task pool was terminated.",workerTerminatedMessage:"The task pool has already been terminated.",runWorker(i,a,c){return i.run(a,c)},maxQueue:es(n,"Task pool")});return{get state(){return o.state},get busy(){return o.busy},get concurrency(){return o.concurrency},get pending(){return o.pending},get size(){return o.size},run(i,a){return o.enqueue(i,a)},clear(){o.clear()},terminate(){o.terminate()}}}function ns(e,t={}){const{concurrency:r,maxQueue:n,...s}=t,o=ts({abortedWhileQueuedMessage:"The queued RPC call was aborted before execution started.",clearMessage:"The RPC pool queue was cleared.",concurrency:Zn(r,"RPC pool"),createWorkers(i){const a=[],c=rs(s.name,i);try{for(let l=0;l<i;l++)a.push(It(e,{...s,name:c[l]}))}catch(l){for(const u of a)u.terminate();throw l}return a},queueFullMessage:"The RPC pool queue is full. Increase maxQueue, wait for pending calls, or raise pool concurrency.",terminatedMessage:"The RPC pool was terminated.",workerTerminatedMessage:"The RPC pool has already been terminated.",runWorker(i,a,c){return i.call(a.method,a.input,c)},maxQueue:es(n,"RPC pool")});return{get state(){return o.state},get busy(){return o.busy},get concurrency(){return o.concurrency},get pending(){return o.pending},get size(){return o.size},call(i,a,c){return o.enqueue({input:a,method:i},c)},clear(){o.clear()},terminate(){o.terminate()}}}var Vc=async e=>{const t=new Function(`return (${e.handlerSource});`)();if(typeof t!="function")throw new TypeError("The serialized task handler did not revive as a function.");return await t(e.input)},Kc=async e=>{const t=new Function(`return (${e.handlerSource});`)();if(typeof t!="function")throw new TypeError("The serialized collection handler did not revive as a function.");const r=[];for(const n of e.items)r.push({index:n.index,value:await t(n.value,n.index)});return r},Yc=async e=>{const t=new Function(`return (${e.reducerSource});`)();if(typeof t!="function")throw new TypeError("The serialized reducer did not revive as a function.");let r=e.initialValue;for(let n=0;n<e.values.length;n++)r=await t(r,e.values[n],n);return r},ss=(e,t)=>{if(e===void 0)return 1;if(!Number.isInteger(e)||e<1)throw new RangeError(`${t} batchSize must be a positive integer.`);return e},os=e=>_t(Vc,e),is=e=>({handlerSource:Xe(e.handler),input:e.input}),Ze=async(e,t,r={},n)=>{if(e.length===0)return[];const s=Xe(t),{batchSize:o,signal:i,...a}=r,c=ss(o,n),l=_t(Kc,a),u=[];for(let h=0;h<e.length;h+=c){const d=Math.min(h+c,e.length),p=[];for(let f=h;f<d;f+=1)p.push({index:f,value:e[f]});u.push({items:p,handlerSource:s})}try{const h=await Promise.all(u.map(p=>l.run(p,i?{signal:i}:void 0))),d=new Array(e.length);for(const p of h)for(const f of p)d[f.index]=f.value;return d}finally{l.terminate()}};async function Jc(e,t={}){if(e.length===0)return[];const r=os(t);try{return await Promise.all(e.map(n=>r.run(is(n),n.options)))}finally{r.terminate()}}async function Gc(e,t,r={}){if(e.length===0)return[];const n=ss(t,"batchTasks"),s=os(r),o=[];try{for(let i=0;i<e.length;i+=n){const a=e.slice(i,i+n),c=await Promise.all(a.map(l=>s.run(is(l),l.options)));o.push(...c)}return o}finally{s.terminate()}}async function as(e,t,r={}){return Ze(e,t,r,"map")}async function cs(e,t,r={}){const n=await Ze(e,t,r,"filter"),s=[];for(let o=0;o<e.length;o+=1)n[o]&&(o in e?s.push(e[o]):s.length+=1);return s}async function ls(e,t,r={}){return e.length===0?!1:(await Ze(e,t,r,"some")).some(Boolean)}async function us(e,t,r={}){return e.length===0?!0:(await Ze(e,t,r,"every")).every(Boolean)}async function fs(e,t,r={}){if(e.length===0)return;const n=(await Ze(e,t,r,"find")).findIndex(Boolean);return n===-1?void 0:e[n]}async function ds(e,t,r,n={}){return e.length===0?r:Xn(Yc,{initialValue:r,reducerSource:Xe(t),values:e},n)}var et=(e,t={})=>({...e,...t}),Xc=(e,t={})=>({signal:"signal"in t?t.signal:e.signal,timeout:"timeout"in t?t.timeout:e.timeout,transfer:t.transfer}),Zc=class qi{constructor(t,r){this.valuesPromise=t,this.defaults=r}createNext(t){return new qi(this.valuesPromise.then(r=>t(r)),this.defaults)}map(t,r){const n=et(this.defaults,r);return this.createNext(s=>as(s,t,n))}filter(t,r){const n=et(this.defaults,r);return this.createNext(s=>cs(s,t,n))}toArray(){return this.valuesPromise.then(t=>t.slice())}some(t,r){const n=et(this.defaults,r);return this.valuesPromise.then(s=>ls(s,t,n))}every(t,r){const n=et(this.defaults,r);return this.valuesPromise.then(s=>us(s,t,n))}find(t,r){const n=et(this.defaults,r);return this.valuesPromise.then(s=>fs(s,t,n))}reduce(t,r,n){const s=Xc(this.defaults,n);return this.valuesPromise.then(o=>ds(o,t,r,s))}};function el(e,t={}){return new Zc(Promise.resolve(e.slice()),t)}var hs=(e,t)=>{Se(()=>{t.state.value=e.state,t.busy.value=e.busy})},ms=(e,t)=>{Se(()=>{t.state.value=e.state,t.busy.value=e.busy,t.concurrency.value=e.concurrency,t.pending.value=e.pending,t.size.value=e.size})},ps=e=>({busy:L(e.busy),state:L(e.state)}),vs=e=>({busy:L(e.busy),concurrency:L(e.concurrency),pending:L(e.pending),size:L(e.size),state:L(e.state)}),xt=(e,t)=>(t(),e.finally(()=>{t(),queueMicrotask(t)}));function tl(e,t={}){const r=Mt(e,t),n=ps(r),s=()=>{hs(r,n)};return{get busy(){return r.busy},get state(){return r.state},busy$:_(n.busy),state$:_(n.state),run(o,i={}){return xt(r.run(o,i),s)},terminate(){r.terminate(),s()}}}function rl(e,t={}){const r=It(e,t),n=ps(r),s=()=>{hs(r,n)};return{get busy(){return r.busy},get state(){return r.state},busy$:_(n.busy),state$:_(n.state),call(o,i,a={}){return xt(r.call(o,i,a),s)},terminate(){r.terminate(),s()}}}function nl(e,t={}){const r=_t(e,t),n=vs(r),s=()=>{ms(r,n)};return{get busy(){return r.busy},get concurrency(){return r.concurrency},get pending(){return r.pending},get size(){return r.size},get state(){return r.state},busy$:_(n.busy),concurrency$:_(n.concurrency),pending$:_(n.pending),size$:_(n.size),state$:_(n.state),run(o,i={}){return xt(r.run(o,i),s)},clear(){r.clear(),s()},terminate(){r.terminate(),s()}}}function sl(e,t={}){const r=ns(e,t),n=vs(r),s=()=>{ms(r,n)};return{get busy(){return r.busy},get concurrency(){return r.concurrency},get pending(){return r.pending},get size(){return r.size},get state(){return r.state},busy$:_(n.busy),concurrency$:_(n.concurrency),pending$:_(n.pending),size$:_(n.size),state$:_(n.state),call(o,i,a={}){return xt(r.call(o,i,a),s)},clear(){r.clear(),s()},terminate(){r.terminate(),s()}}}var ol=(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,c=/^class\s/.test(Function.prototype.toString.call(r));if(i||a||c)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const l=n(e);if(l===void 0&&o)try{return Reflect.construct(s,[e])}catch{return l}return l}catch(l){if(l instanceof TypeError&&/cannot be invoked without 'new'|is not a function/i.test(l.message))return Reflect.construct(s,[e]);throw l}}return e},qt=()=>{try{const e=globalThis;if(typeof e.__BQUERY_DEV__=="boolean")return e.__BQUERY_DEV__;const t=e.process?.env?.NODE_ENV;if(typeof t=="string")return t!=="production";const r=e.process?.versions?.node;if(typeof r=="string"&&r.length>0)return!0;const n=e.process?.release?.name;return n==="node"||n==="io.js"}catch{return!1}},tt;function be(e){const t=tt;return tt=e,t}function ys(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){qt()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function il(e){const t=tt;if(!t)throw new Error("bQuery component: useSignal() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=L(e);return t.addDisposer(()=>r.dispose()),r}function al(e){const t=tt;if(!t)throw new Error("bQuery component: useComputed() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=D(e);return t.addDisposer(()=>r.dispose()),r}function cl(e){const t=tt;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 ll=["slot"],ul=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],gs=(e,t)=>{const r=[...ll,...t.sanitize?.allowTags??[]],n=[...ul,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),i=(l=>l===!1?!1:l==="closed"?"closed":"open")(t.shadow),a=Array.from(new Set([...Object.keys(t.props??{}),...t.observeAttributes??[]]));class c 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=ys();const u=be(this.scope);try{t.connected?.call(this)}catch(h){this.handleError(h)}finally{be(u)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(u){this.handleError(u)}}mount(){if(this.hasMounted)return;const u=be(this.ensureScope());let h=!1;try{t.beforeMount?.call(this),t.connected?.call(this)}catch(d){h=!0,this.handleError(d)}finally{be(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 f=be(this.ensureScope());try{t.onAttributeChanged.call(this,u,h,d)}finally{be(f)}}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=be(this.ensureScope());try{t.onAdopted.call(this)}catch(h){this.handleError(h)}finally{be(u)}}handleError(u){t.onError?t.onError.call(this,u):console.error(`bQuery component error in <${e}>:`,u)}ensureScope(){return this.scope??(this.scope=ys())}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();Ee(()=>{this.render(!0,p,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const d=this.cloneProps();Ee(()=>{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 f;if(p==null?d.required&&d.default===void 0?(this.missingRequiredProps.add(h),f=void 0):f=d.default??void 0:(this.missingRequiredProps.has(h)&&this.missingRequiredProps.delete(h),f=ol(p,d)),d.validator&&f!==void 0&&!d.validator(f))throw new Error(`bQuery component: validation failed for prop "${h}" with value ${JSON.stringify(f)}`);this.props[h]=f}}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 f=(g,w)=>{this.dispatchEvent(new CustomEvent(g,{detail:w,bubbles:!0,composed:!0}))},m=this.renderRootNode,v=ie(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:f}),{allowTags:r,allowAttributes:n});let b=null;if(t.styles&&(b=m.querySelector("style[data-bquery-component-style]")),m.innerHTML=v,t.styles){const g=b??document.createElement("style");b||g.setAttribute("data-bquery-component-style",""),g.textContent=t.styles,m.prepend(g)}u&&t.updated?.call(this,d)}catch(f){this.handleError(f)}}}return c};function fl(e,t){return gs(e,t)}function Me(e,t){const r=gs(e,t);customElements.get(e)||customElements.define(e,r)}var bs=Symbol("bquery.booleanAttribute"),dl=/^[^\0-\x20"'/>=]+$/,ws=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[bs]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},Ss=e=>ws(e)?e.enabled?e.name:"":String(e??""),hl={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},ml=e=>ws(e)?e.enabled?e.name:"":Ss(e).replace(/[&<>"'`]/g,t=>hl[t]),pl=(e,t)=>{if(!dl.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[bs]:!0,enabled:!!t,name:e})},De=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${Ss(t[s])}`,""),vl=(e,...t)=>{const r=n=>Qi(n)?Vi(n):ml(n);return vn(e.reduce((n,s,o)=>`${n}${s}${o<t.length?r(t[o]):""}`,""))},zt=`
2
86
  :host {
3
87
  color: inherit;
4
88
  font: inherit;
5
89
  }
6
- `,Nr=`
7
- ${nt}
90
+ `,Es=`
91
+ ${zt}
8
92
  .field {
9
93
  display: inline-flex;
10
94
  flex-direction: column;
@@ -38,8 +122,8 @@
38
122
  color: #94a3b8;
39
123
  cursor: not-allowed;
40
124
  }
41
- `,F=e=>nr(e),At=new WeakMap,Ct=(e,t)=>At.get(e)?.[t],kt=(e,t,r)=>{const n=At.get(e)??{};n[t]=r,At.set(e,n)},Ci=(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)},ki=(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)},Oi=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 ge(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
- ${nt}
125
+ `,F=e=>En(e),Ar=new WeakMap,kr=(e,t)=>Ar.get(e)?.[t],Tr=(e,t,r)=>{const n=Ar.get(e)??{};n[t]=r,Ar.set(e,n)},yl=(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)},gl=(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)},bl=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(""),wl=(e={})=>{const t=e.prefix??ae().components?.prefix??"bq",r={button:`${t}-button`,card:`${t}-card`,input:`${t}-input`,textarea:`${t}-textarea`,checkbox:`${t}-checkbox`};return Me(r.button,{props:{label:{type:String,default:""},variant:{type:String,default:"primary"},size:{type:String,default:"md"},type:{type:String,default:"button"},disabled:{type:Boolean,default:!1}},styles:`
126
+ ${zt}
43
127
  button {
44
128
  appearance: none;
45
129
  border: 0;
@@ -76,7 +160,7 @@
76
160
  cursor: not-allowed;
77
161
  opacity: 0.6;
78
162
  }
79
- `,render:({props:n})=>be`
163
+ `,render:({props:n})=>De`
80
164
  <button
81
165
  part="button"
82
166
  type="${F(n.type)}"
@@ -86,8 +170,8 @@
86
170
  >
87
171
  <slot>${F(n.label)}</slot>
88
172
  </button>
89
- `}),ge(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
90
- ${nt}
173
+ `}),Me(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
174
+ ${zt}
91
175
  article {
92
176
  background: #fff;
93
177
  border: 1px solid #e2e8f0;
@@ -111,13 +195,13 @@
111
195
  footer {
112
196
  margin-top: 0.75rem;
113
197
  }
114
- `,render:({props:n})=>be`
198
+ `,render:({props:n})=>De`
115
199
  <article part="card" data-elevated="${String(n.elevated)}">
116
200
  ${n.title?`<header part="header">${F(n.title)}</header>`:""}
117
201
  <section part="body"><slot></slot></section>
118
202
  ${n.footer?`<footer part="footer">${F(n.footer)}</footer>`:""}
119
203
  </article>
120
- `}),ge(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:Nr,beforeUpdate(n,s){return!Ci(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})))};kt(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=Ct(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>be`
204
+ `}),Me(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:Es,beforeUpdate(n,s){return!yl(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})))};Tr(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=kr(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>De`
121
205
  <label part="field" class="field">
122
206
  ${n.label?`<span part="label" class="label">${F(n.label)}</span>`:""}
123
207
  <input
@@ -130,18 +214,18 @@
130
214
  ${n.disabled?"disabled":""}
131
215
  />
132
216
  </label>
133
- `}),ge(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:`${Nr}
217
+ `}),Me(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:`${Es}
134
218
  textarea.control {
135
219
  min-height: 6rem;
136
220
  resize: vertical;
137
221
  }
138
- `,beforeUpdate(n,s){return!ki(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})))};kt(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=Ct(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>be`
222
+ `,beforeUpdate(n,s){return!gl(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})))};Tr(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=kr(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>De`
139
223
  <label part="field" class="field">
140
224
  ${n.label?`<span part="label" class="label">${F(n.label)}</span>`:""}
141
- ${Oi(n)}
225
+ ${bl(n)}
142
226
  </label>
143
- `}),ge(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
144
- ${nt}
227
+ `}),Me(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
228
+ ${zt}
145
229
  label {
146
230
  align-items: center;
147
231
  color: #0f172a;
@@ -157,7 +241,7 @@
157
241
  input:disabled {
158
242
  cursor: not-allowed;
159
243
  }
160
- `,connected(){const n=s=>{const o=s.target;o?.matches('input[type="checkbox"]')&&(s.stopPropagation(),o.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:o.checked},bubbles:!0,composed:!0})))};kt(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=Ct(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>be`
244
+ `,connected(){const n=s=>{const o=s.target;o?.matches('input[type="checkbox"]')&&(s.stopPropagation(),o.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:o.checked},bubbles:!0,composed:!0})))};Tr(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=kr(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>De`
161
245
  <label part="label">
162
246
  <input
163
247
  part="control"
@@ -167,12 +251,12 @@
167
251
  />
168
252
  <span part="text"><slot>${F(n.label)}</slot></span>
169
253
  </label>
170
- `}),r},Ot=null,Z=()=>Ot!==null?Ot:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,Li=e=>{Ot=e},Pr=e=>typeof e=="string"||typeof e=="number",Ir=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),we=(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")&&Pr(o)){const i=s.startsWith("--")?s:Ir(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(Pr(o)){const i=n.startsWith("--")?n:Ir(n);r.setProperty(i,String(o))}}},st=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:o=!0,onFinish:i}=t;if(o&&Z())return s&&we(e,r),i?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&we(e,r),i?.(),Promise.resolve()):new Promise(l=>{const c=a.animate(r,n);let u=!1;const h=()=>{u||(u=!0,s&&(typeof c.commitStyles=="function"?c.commitStyles():we(e,r)),c.cancel(),i?.(),l())};c.onfinish=h,c.finished&&c.finished.then(h).catch(h)})},ee=e=>Math.min(1,Math.max(0,e)),_r=e=>ee(e),qr=e=>ee(e*e),xr=e=>ee(1-(1-e)*(1-e)),jr=e=>ee(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),zr=e=>ee(e*e*e),Fr=e=>ee(1-Math.pow(1-e,3)),Br=e=>ee(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),Hr=e=>ee(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),Ur=e=>ee(e===1?1:1-Math.pow(2,-10*e)),$i={linear:_r,easeInQuad:qr,easeOutQuad:xr,easeInOutQuad:jr,easeInCubic:zr,easeOutCubic:Fr,easeInOutCubic:Br,easeOutBack:Hr,easeOutExpo:Ur},Tt=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},Lt=(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,c=t.width/i.width,u=t.height/i.height;if(a===0&&l===0&&c===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(${c}, ${u})`,h.style.transformOrigin="top left",h.offsetHeight,new Promise(d=>{const p=h.animate([{transform:`translate(${a}px, ${l}px) scale(${c}, ${u})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let f=!1;const m=()=>{f||(f=!0,h.style.transform="",h.style.transformOrigin="",o?.(),d())};p.onfinish=m,p.finished&&p.finished.then(m).catch(m)}))},Ri=async(e,t,r={})=>{await Qr(e,t,r)},Qr=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,c)=>{const u=o.get(l);if(!u)return Promise.resolve();const h=n?n(c,i):0;return h>0?new Promise(d=>setTimeout(d,h)).then(()=>Lt(l,u,s)):Lt(l,u,s)});await Promise.all(a)},Mi={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)"}]},Di=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:o=!0,onComplete:i}=r,a=e,l=t;if(typeof window>"u"||typeof document>"u"||typeof a.getBoundingClientRect!="function"||typeof l.getBoundingClientRect!="function"||typeof a.style>"u"||typeof l.style>"u")return i?.(),Promise.resolve();const c=e.getBoundingClientRect(),u=l.style.display,h=l.style.visibility,d=l.style.transform,p=l.style.opacity,f=typeof getComputedStyle=="function"?getComputedStyle(l).display:u||"block",m=f==="none"?"block":u||f||"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",f==="none"?l.style.display=m:u==="none"?l.style.display="":l.style.display=u,o&&Z())return g(),i?.(),Promise.resolve();const v=c.left-b.left,w=c.top-b.top,E=c.width/(b.width||1),T=c.height/(b.height||1);if(v===0&&w===0&&E===1&&T===1)return g(),i?.(),Promise.resolve();const A=[{transform:`translate(${v}px, ${w}px) scale(${E}, ${T})`,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 O=()=>{R||(R=!0,g(),C.cancel(),i?.(),S())};C.onfinish=O,C.finished&&C.finished.then(O).catch(O)})},Ni=(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,c=null;const u=()=>{l||(l=!0,window.removeEventListener("scroll",d),c!==null&&(cancelAnimationFrame(c),c=null),a=!1,o.style.transform=i)},h=()=>{if(l)return;if(s&&Z()){u();return}const p=window.scrollY,f=window.scrollX;let m=0,g=0;(n==="vertical"||n==="both")&&(g=p*r),(n==="horizontal"||n==="both")&&(m=f*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,c=requestAnimationFrame(()=>{c=null,h(),a=!1}))}};return h(),window.addEventListener("scroll",d,{passive:!0}),u},Pi=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),Ii=(e,t)=>{const r=Pi(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),st(u,l)}),()=>{};const c=new IntersectionObserver(u=>{u.forEach(h=>{if(!h.isIntersecting)return;const d=h.target;a?.(d),st(d,l),i&&c.unobserve(d)})},{root:n,rootMargin:s,threshold:o});return r.forEach(u=>c.observe(u)),()=>c.disconnect()},_i={stiffness:100,damping:10,mass:1,precision:.01},qi=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:o}={..._i,...t};let i=e,a=0,l=e,c=null,u=null,h=null;const d=new Set,p=()=>{for(const m of d)m(i)},f=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,c=null,p(),u?.(),u=null;return}c=requestAnimationFrame(f)};return{to(m){return l=m,c!==null&&cancelAnimationFrame(c),u?.(),h=null,new Promise(g=>{u=g,c=requestAnimationFrame(f)})},current(){return i},stop(){c!==null&&(cancelAnimationFrame(c),c=null),a=0,h=null,u?.(),u=null},onChange(m){return d.add(m),()=>d.delete(m)}}},xi={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},ji=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(o,i=0)=>{const a=typeof n=="number"?n:n==="center"?(i-1)/2:n==="end"?i-1:0,l=Math.abs(o-a),c=i>1?Math.max(a,i-1-a):1,u=c===0?0:l/c;return r+(s?s(u)*c:l)*e}},$t=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},zi=(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},Fi=e=>{const t=$t(e?.duration),r=$t(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},Vr=e=>{let t=0;return e.map(r=>{const n=zi(r.at,t),s=$t(r.options?.delay),o=Math.max(0,n+s),i=Fi(r.options),a=o+i;return t=Math.max(t,a),{step:r,start:o,end:a,duration:i}})},Bi=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 st(i.target,i)}n?.()},Hi=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],o=0,i=!1,a=!1;const{commitStyles:l=!0,respectReducedMotion:c=!0,onFinish:u}=t,h=()=>{if(!a){if(a=!0,l)for(const p of s){const{animation:f,step:m}=p;typeof f.commitStyles=="function"?f.commitStyles():we(m.target,m.keyframes),f.cancel()}n.forEach(p=>p()),u?.()}},d=()=>{s.forEach(({animation:f})=>f.cancel()),s=[],a=!1;const p=Vr(r);if(o=p.length?Math.max(...p.map(f=>f.end)):0,c&&Z()){l&&p.forEach(({step:f})=>we(f.target,f.keyframes)),i=!0;return}if(p.some(({step:f})=>typeof f.target.animate!="function")){l&&p.forEach(({step:f})=>we(f.target,f.keyframes)),i=!0;return}i=!1,s=p.map(({step:f,start:m})=>{const{delay:g,...b}=f.options??{};return{animation:f.target.animate(f.keyframes,{...b,delay:m,fill:b.fill??"both"}),step:f,start:m}})};return{add(p){r.push(p)},duration(){if(!r.length)return 0;if(!s.length){const p=Vr(r);return Math.max(...p.map(f=>f.end))}return o},async play(){if(d(),i||s.length===0){h();return}const p=s.map(f=>f.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:f})=>{f.currentTime=p})},onFinish(p){return n.add(p),()=>n.delete(p)}}},Wr=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Ui=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=Wr(r.classes),a=Wr(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()),c=l.types;if(c)for(const u of a)c.add(u);await l.ready,r.onReady?.(),await l.finished,r.onFinish?.()}finally{i.forEach(l=>o.classList.remove(l))}},Qi=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:o=!1,cursorChar:i="|",loop:a=!1,loopDelay:l=1e3,respectReducedMotion:c=!0,onComplete:u}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const h=e;let d=!1,p=null,f=null,m=null,g=null;const b=()=>{if(!o)return;f=document.createElement("span"),f.setAttribute("aria-hidden","true"),f.textContent=i,h.appendChild(f);let E=!0;m=setInterval(()=>{f&&(E=!E,f.style.opacity=E?"1":"0")},530)},v=()=>{m!==null&&(clearInterval(m),m=null),f&&f.parentNode&&(f.parentNode.removeChild(f),f=null)},w=()=>{d||(d=!0,p!==null&&(clearTimeout(p),p=null),v(),g?.(),g=null)};return c&&Z()?(h.textContent=t,u?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(E=>{g=E;const T=()=>{let A=0;h.textContent="",b();const S=document.createTextNode("");f?h.insertBefore(S,f):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(),T())},l):(v(),E(),g=null)))};p=setTimeout(C,s)};T()})}},Vi=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))}},Wi={async open(e){return new Vi(e)}},Ki=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)}},Yi={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new Ki(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},Gi=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},Ji=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},Xi=(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("; ")},Zi=(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("; ")},ea=(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=Gi(e);let o=n.defaultValue??null;if(s!==null)try{o=n.deserialize?n.deserialize(s):Ji(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){Xi(e,n);return}Zi(e,l,n)}),i},ta={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)}},ra=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),na=(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",ra),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,c,u=!1;const h=()=>{l&&(clearTimeout(l),l=void 0),c&&(clearTimeout(c),c=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&&(c=setTimeout(()=>{u||(n.value="")},w)))},v)},clear:()=>{u||(h(),n.value="")},destroy:()=>{u||(u=!0,h(),n.value="",a(),i&&o.remove())}}},Kr=(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)}},Yr=(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},sa=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=Yr("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=Yr("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(Kr(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(Kr(document.body,e.bodyAttributes)),()=>{document.title=o;for(const a of s.reverse())a();for(const a of n)a.remove()}},Gr=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}},oa=class extends Gr{constructor(){super(localStorage)}},ia=class extends Gr{constructor(){super(sessionStorage)}},aa=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))}},la={local(){return new oa},session(){return new ia},indexedDB(e){return new aa(e)}},Jr=null,te=M({path:"",params:{},query:{},matched:null,hash:""}),Xr=P(()=>te.value),qe=M(0),ot=M(!1),ca=H(ot),Zr=()=>{qe.value===0&&(ot.value=!0),qe.value+=1},en=()=>{const e=Math.max(0,qe.value-1);qe.value=e,e===0&&(ot.value=!1)},ua=()=>{qe.value=0,ot.value=!1},ce=()=>Jr,tn=e=>{Jr=e},xe=async(e,t={})=>{const r=ce();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},fa=()=>{const e=ce();e?e.back():history.back()},da=()=>{const e=ce();e?e.forward():history.forward()},ha="active",ma=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),pa=typeof HTMLElement<"u"?HTMLElement:class{},rn=class extends pa{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")??ha}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=ma(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&&ce()&&xe(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},va=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",rn)},ya=(e,t={})=>r=>{r.preventDefault(),xe(e,t).catch(n=>{console.error("Navigation failed:",n)})},ga=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=ce();if(!o){n.preventDefault(),xe(s.pathname+s.search+s.hash).catch(c=>{console.error("Navigation failed:",c)});return}const i=o.base,a=o.hash;let l;if(a&&s.hash&&s.hash.startsWith("#/"))l=s.hash.slice(1);else{let c=s.pathname;i&&i!=="/"&&c.startsWith(i)&&(c=c.slice(i.length)||"/"),l=c+s.search+s.hash}n.preventDefault(),xe(l).catch(c=>{console.error("Navigation failed:",c)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},ba=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},wa=128,nn=new Map,sn=new Map,on=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=wa)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},Ea=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},Sa=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},Rt=e=>{const t=nn.get(e);if(t!==void 0)return t;const r=Sa(e);return on(nn,e,r),r},an=e=>{const t=Rt(e),r=sn.get(t);if(r)return r;if(Ea(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 on(sn,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},je=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),ln=e=>je(e)||e!==void 0&&e>="0"&&e<="9",cn=(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},Aa=(e,t)=>{const r=cn(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},un=new Set,fn=(e,t)=>{if(e[t]!==":"||!je(e[t+1]))return null;let r=t+2;for(;r<e.length&&ln(e[r]);)r++;let n=r,s;if(e[r]==="("){const o=Aa(e,r);s=o.constraint,n=o.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},Ca=e=>{if(!un.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&je(e[t+1])){const r=fn(e,t);r?.constraint&&Rt(r.constraint),t=r?.nextIndex??t+1;continue}t++}un.add(e)}},ka=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},dn=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&je(e[r+1]));)r++;return e.slice(t,r)},hn=(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()},Oa=(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=dn(e,s+1),h=u.length>0?hn(t,o,t.length,u):null,d=(h?p=>{for(const f of h){const m=p(f);if(m)return m}return null}:p=>{for(let f=t.length;f>=o;f--){const m=p(f);if(m)return m}return null})(p=>{const f=n(s+1,p);return f?(r.set(i,f),f):null});return d||(r.set(i,null),null)}const l=fn(e,s);if(l){const u=l.constraint?an(l.constraint):void 0,h=l.constraint?t.length:ka(t,o),d=dn(e,l.nextIndex),p=d.length>0?hn(t,o,h,d):null,f=(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 f||(r.set(i,null),null)}if(o>=t.length||a!==t[o])return r.set(i,null),null;const c=n(s+1,o+1);return r.set(i,c),c};return n(0,0)},Ta=(e,t)=>{for(const r of t){Ca(r.path);const n=Oa(r.path,e);if(n)return{matched:r,params:n}}return null},it=(e,t,r,n)=>{const s=Ta(e,n);return{path:e,params:s?.params??{},query:ba(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},mn=(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(...mn(n.children,s))}return r},La=(e,t={})=>{const r=ce();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]===":"&&je(n.path[o+1])){let i=o+2;for(;i<n.path.length&&ln(n.path[i]);)i++;let a=i,l=null;if(n.path[i]==="("){const h=cn(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 c=n.path.slice(o+1,i),u=t[c];if(u===void 0)throw new Error(`bQuery router: Missing required param "${c}" for route "${e}".`);if(l&&!an(l).test(u))throw new Error(`bQuery router: Param "${c}" 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},$a=(e,t=!1)=>{const r=te.value.path;return t?r===e:r.startsWith(e)},Ra=(e,t=!1)=>P(()=>{const r=te.value.path;return t?r===e:r.startsWith(e)}),Ma=100,Da=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},Na=e=>{const t=ce();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:o=!1}=e,i=[],a=[],l=mn(r),c=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,f=()=>`${Date.now()}-${h++}`,m=(S=p())=>{if(o)for(c.has(S)&&c.delete(S),c.set(S,{x:window.scrollX,y:window.scrollY});c.size>Ma;){const C=c.keys().next().value;if(C===void 0)break;c.delete(C)}},g=(S=p())=>{if(!o)return;const C=c.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("#"),[O,L=""]=C.split("?");return{pathname:O,search:L?`?${L}`:"",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=it(S,C,R,l)},E=async(S,C,R=new Set)=>{Zr();try{const{pathname:O,search:L,hash:k}=v(),$=it(O,L,k,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=it(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,$)===!1)return;for(const Ke of i)if(await Ke(z,$)===!1)return;m();const _=o?p():void 0,Q=C==="replaceState"&&_?_:f(),se=s?`#${S}`:`${n}${S}`,ke=o&&history.state&&typeof history.state=="object"?Da(history.state):{},Ut=o?{...ke,__bqScrollKey:Q}:{};history[C](Ut,"",se),u=Q,w(),o&&C==="pushState"&&window.scrollTo(0,0);for(const Ke of a)Ke(te.value,$)}finally{en()}},T=async S=>{Zr();try{const{pathname:C,search:R,hash:O}=v(),L=te.value,k=it(C,R,O,l);if(k.matched?.redirectTo){await E(k.matched.redirectTo,"replaceState");return}if(k.matched?.beforeEnter&&await k.matched.beforeEnter(k,L)===!1){const $=new URLSearchParams(Object.entries(L.query).flatMap(([_,Q])=>Array.isArray(Q)?Q.map(se=>[_,se]):[[_,Q]])).toString(),D=$?`?${$}`:"",I=L.hash?`#${L.hash}`:"",z=s?`#${L.path}${D}${I}`:`${n}${L.path}${D}${I}`;history.replaceState(b(),"",z);return}for(const $ of i)if(await $(k,L)===!1){const D=new URLSearchParams(Object.entries(L.query).flatMap(([Q,se])=>Array.isArray(se)?se.map(ke=>[Q,ke]):[[Q,se]])).toString(),I=D?`?${D}`:"",z=L.hash?`#${L.hash}`:"",_=s?`#${L.path}${I}${z}`:`${n}${L.path}${I}${z}`;history.replaceState(b(),"",_);return}m(u),u=S.state?.__bqScrollKey??p(),w(),g(u);for(const $ of a)$(te.value,L)}finally{en()}};window.addEventListener("popstate",T),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:Xr,routes:l,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",T),i.length=0,a.length=0,c.clear(),d!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=d),ua(),tn(null)}};return tn(A),A},Ee=P(()=>te.value),Pa={route:Ee,path:P(()=>Ee.value.path),params:P(()=>Ee.value.params),query:P(()=>Ee.value.query),hash:P(()=>Ee.value.hash),matched:P(()=>Ee.value.matched)},Ia=()=>Pa,_a=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},qa=(e,t)=>{const r=_a();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},xa=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},ja=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},pn=[],za=e=>{pn.push(e)},Fa=(e,t)=>{for(const r of pn){const n=r({store:e,options:t});n&&Object.assign(e,n)}},ze=new Map,vn=e=>ze.has(e),Ba=(e,t)=>{ze.set(e,t)},Se=e=>ze.get(e),Mt=()=>Array.from(ze.keys()),Ha=e=>{ze.delete(e),xa(e)},yn=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,ue=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ue);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,ue(n)]));if(e instanceof Set)return new Set(Array.from(e).map(ue));const t={};for(const r of Object.keys(e))t[r]=ue(e[r]);return t},Ae=(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)||!Ae(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(Ae(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)=>Ae(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=>Ae(e[s],t[s]))},Ua=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const o=e[s],i=t[s];r.get(s)===i&&yn(o)&&yn(i)&&!Ae(o,i)&&n.push(s)}return n},Fe=()=>St(),Dt=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if(vn(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),Se(t);const o=r(),i=new Map;for(const v of Object.keys(o))i.set(v,M(o[v]));const a=[],l=[],c=(v,w,E)=>{!Fe()||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)=>{!Fe()||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,T)=>{try{const A=E();Oe(A)&&(v==="listener"&&T&&h(T,w),A.catch(S=>{c(v,w,S)}))}catch(A){c(v,w,A)}},p=()=>ae(()=>({...m})),f=()=>{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);ja(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,f()},enumerable:!0,configurable:!1});for(const v of Object.keys(n)){const w=n[v],E=P(()=>w(m,new Proxy({},{get:(T,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(...T){const A=new Proxy(b,{get:(k,$)=>typeof $=="string"&&i.has($)?i.get($).value:k[$],set:(k,$,D)=>typeof $=="string"&&i.has($)?(i.get($).value=D,f(),!0):Reflect.set(k,$,D)});if(l.length===0)return w.apply(A,T);const S=[],C=[],R=[...l],O={name:E,store:b,args:T,after:k=>{S.push($=>k($))},onError:k=>{C.push(k)}};for(const k of R)d("listener",E,()=>k(O),k);let L;try{L=w.apply(A,T)}catch(k){for(const $ of C)d("onError",E,()=>$(k));throw k}if(Oe(L))return L.then(k=>{for(const $ of S)d("after",E,()=>$(k));return k},k=>{for(const $ of C)d("onError",E,()=>$(k));throw k});for(const k of S)d("after",E,()=>k(L));return L}}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]}),f()},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=Fe(),E=w?ue(p()):null,T=w?new Map(Array.from(i.entries()).map(([S,C])=>[S,C.value])):null,A=p();if(v(A),w&&E&&T){const S=Ua(E,A,T);S.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${S.map(String).join(", ")}.
254
+ `}),r},Rr=null,le=()=>Rr!==null?Rr:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,Sl=e=>{Rr=e},As=e=>typeof e=="string"||typeof e=="number",ks=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),_e=(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")&&As(o)){const i=s.startsWith("--")?s:ks(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(As(o)){const i=n.startsWith("--")?n:ks(n);r.setProperty(i,String(o))}}},jt=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:o=!0,onFinish:i}=t;if(o&&le())return s&&_e(e,r),i?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&_e(e,r),i?.(),Promise.resolve()):new Promise(c=>{const l=a.animate(r,n);let u=!1;const h=()=>{u||(u=!0,s&&(typeof l.commitStyles=="function"?l.commitStyles():_e(e,r)),l.cancel(),i?.(),c())};l.onfinish=h,l.finished&&l.finished.then(h).catch(h)})},ue=e=>Math.min(1,Math.max(0,e)),Ts=e=>ue(e),Rs=e=>ue(e*e),Cs=e=>ue(1-(1-e)*(1-e)),$s=e=>ue(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),Os=e=>ue(e*e*e),Ls=e=>ue(1-Math.pow(1-e,3)),Ps=e=>ue(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),Ns=e=>ue(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),Is=e=>ue(e===1?1:1-Math.pow(2,-10*e)),El={linear:Ts,easeInQuad:Rs,easeOutQuad:Cs,easeInOutQuad:$s,easeInCubic:Os,easeOutCubic:Ls,easeInOutCubic:Ps,easeOutBack:Ns,easeOutExpo:Is},Cr=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},$r=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:o}=r,i=Cr(e);if(i.width===0||i.height===0)return o?.(),Promise.resolve();const a=t.left-i.left,c=t.top-i.top,l=t.width/i.width,u=t.height/i.height;if(a===0&&c===0&&l===1&&u===1)return o?.(),Promise.resolve();const h=e;return typeof h.animate!="function"?(o?.(),Promise.resolve()):(h.style.transform=`translate(${a}px, ${c}px) scale(${l}, ${u})`,h.style.transformOrigin="top left",h.offsetHeight,new Promise(d=>{const p=h.animate([{transform:`translate(${a}px, ${c}px) scale(${l}, ${u})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let f=!1;const m=()=>{f||(f=!0,h.style.transform="",h.style.transformOrigin="",o?.(),d())};p.onfinish=m,p.finished&&p.finished.then(m).catch(m)}))},Al=async(e,t,r={})=>{await Ms(e,t,r)},Ms=async(e,t,r={})=>{const{stagger:n,...s}=r,o=new Map;for(const c of e)o.set(c,Cr(c));t();const i=e.length,a=e.map((c,l)=>{const u=o.get(c);if(!u)return Promise.resolve();const h=n?n(l,i):0;return h>0?new Promise(d=>setTimeout(d,h)).then(()=>$r(c,u,s)):$r(c,u,s)});await Promise.all(a)},kl={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)"}]},Tl=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:o=!0,onComplete:i}=r,a=e,c=t;if(typeof window>"u"||typeof document>"u"||typeof a.getBoundingClientRect!="function"||typeof c.getBoundingClientRect!="function"||typeof a.style>"u"||typeof c.style>"u")return i?.(),Promise.resolve();const l=e.getBoundingClientRect(),u=c.style.display,h=c.style.visibility,d=c.style.transform,p=c.style.opacity,f=typeof getComputedStyle=="function"?getComputedStyle(c).display:u||"block",m=f==="none"?"block":u||f||"block",v=()=>{c.style.transform=d,c.style.opacity=p};c.style.visibility="hidden",c.style.display=m;const b=t.getBoundingClientRect();if(c.style.visibility=h,a.style.display="none",f==="none"?c.style.display=m:u==="none"?c.style.display="":c.style.display=u,o&&le())return v(),i?.(),Promise.resolve();const g=l.left-b.left,w=l.top-b.top,S=l.width/(b.width||1),k=l.height/(b.height||1);if(g===0&&w===0&&S===1&&k===1)return v(),i?.(),Promise.resolve();const A=[{transform:`translate(${g}px, ${w}px) scale(${S}, ${k})`,opacity:"0.5"},{transform:"translate(0, 0) scale(1, 1)",opacity:"1"}];return typeof c.animate!="function"?(v(),i?.(),Promise.resolve()):new Promise(E=>{const T=c.animate(A,{duration:n,easing:s,fill:"forwards"});let P=!1;const C=()=>{P||(P=!0,v(),T.cancel(),i?.(),E())};T.onfinish=C,T.finished&&T.finished.then(C).catch(C)})},Rl=(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&&le())return()=>{};let a=!1,c=!1,l=null;const u=()=>{c||(c=!0,window.removeEventListener("scroll",d),l!==null&&(cancelAnimationFrame(l),l=null),a=!1,o.style.transform=i)},h=()=>{if(c)return;if(s&&le()){u();return}const p=window.scrollY,f=window.scrollX;let m=0,v=0;(n==="vertical"||n==="both")&&(v=p*r),(n==="horizontal"||n==="both")&&(m=f*r);const b=`translate3d(${m}px, ${v}px, 0)`;o.style.transform=i?`${i} ${b}`:b},d=()=>{if(!c){if(s&&le()){u();return}a||(a=!0,l=requestAnimationFrame(()=>{l=null,h(),a=!1}))}};return h(),window.addEventListener("scroll",d,{passive:!0}),u},Cl=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),$l=(e,t)=>{const r=Cl(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:o,once:i=!0,onEnter:a,...c}=t;if(typeof IntersectionObserver>"u")return r.forEach(u=>{a?.(u),jt(u,c)}),()=>{};const l=new IntersectionObserver(u=>{u.forEach(h=>{if(!h.isIntersecting)return;const d=h.target;a?.(d),jt(d,c),i&&l.unobserve(d)})},{root:n,rootMargin:s,threshold:o});return r.forEach(u=>l.observe(u)),()=>l.disconnect()},Ol={stiffness:100,damping:10,mass:1,precision:.01},Ll=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:o}={...Ol,...t};let i=e,a=0,c=e,l=null,u=null,h=null;const d=new Set,p=()=>{for(const m of d)m(i)},f=m=>{const v=h!==null?(m-h)/1e3:.016666666666666666,b=Math.min(v,1/30);h=m;const g=i-c,w=(-r*g+-n*a)/s;if(a+=w*b,i+=a*b,p(),Math.abs(a)<o&&Math.abs(g)<o){i=c,a=0,l=null,p(),u?.(),u=null;return}l=requestAnimationFrame(f)};return{to(m){return c=m,l!==null&&cancelAnimationFrame(l),u?.(),h=null,new Promise(v=>{u=v,l=requestAnimationFrame(f)})},current(){return i},stop(){l!==null&&(cancelAnimationFrame(l),l=null),a=0,h=null,u?.(),u=null},onChange(m){return d.add(m),()=>d.delete(m)}}},Pl={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},Nl=(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,c=Math.abs(o-a),l=i>1?Math.max(a,i-1-a):1,u=l===0?0:c/l;return r+(s?s(u)*l:c)*e}},Or=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},Il=(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},Ml=e=>{const t=Or(e?.duration),r=Or(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},Ds=e=>{let t=0;return e.map(r=>{const n=Il(r.at,t),s=Or(r.options?.delay),o=Math.max(0,n+s),i=Ml(r.options),a=o+i;return t=Math.max(t,a),{step:r,start:o,end:a,duration:i}})},Dl=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(c=>setTimeout(c,a)),await jt(i.target,i)}n?.()},_l=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],o=0,i=!1,a=!1;const{commitStyles:c=!0,respectReducedMotion:l=!0,onFinish:u}=t,h=()=>{if(!a){if(a=!0,c)for(const p of s){const{animation:f,step:m}=p;typeof f.commitStyles=="function"?f.commitStyles():_e(m.target,m.keyframes),f.cancel()}n.forEach(p=>p()),u?.()}},d=()=>{s.forEach(({animation:f})=>f.cancel()),s=[],a=!1;const p=Ds(r);if(o=p.length?Math.max(...p.map(f=>f.end)):0,l&&le()){c&&p.forEach(({step:f})=>_e(f.target,f.keyframes)),i=!0;return}if(p.some(({step:f})=>typeof f.target.animate!="function")){c&&p.forEach(({step:f})=>_e(f.target,f.keyframes)),i=!0;return}i=!1,s=p.map(({step:f,start:m})=>{const{delay:v,...b}=f.options??{};return{animation:f.target.animate(f.keyframes,{...b,delay:m,fill:b.fill??"both"}),step:f,start:m}})};return{add(p){r.push(p)},duration(){if(!r.length)return 0;if(!s.length){const p=Ds(r);return Math.max(...p.map(f=>f.end))}return o},async play(){if(d(),i||s.length===0){h();return}const p=s.map(f=>f.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:f})=>{f.currentTime=p})},onFinish(p){return n.add(p),()=>n.delete(p)}}},_s=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),xl=async e=>{const t=ae().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=_s(r.classes),a=_s(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&le()){await n(),r.onFinish?.();return}i.forEach(c=>o.classList.add(c));try{const c=s.startViewTransition(()=>n()),l=c.types;if(l)for(const u of a)l.add(u);await c.ready,r.onReady?.(),await c.finished,r.onFinish?.()}finally{i.forEach(c=>o.classList.remove(c))}},ql=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:o=!1,cursorChar:i="|",loop:a=!1,loopDelay:c=1e3,respectReducedMotion:l=!0,onComplete:u}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const h=e;let d=!1,p=null,f=null,m=null,v=null;const b=()=>{if(!o)return;f=document.createElement("span"),f.setAttribute("aria-hidden","true"),f.textContent=i,h.appendChild(f);let S=!0;m=setInterval(()=>{f&&(S=!S,f.style.opacity=S?"1":"0")},530)},g=()=>{m!==null&&(clearInterval(m),m=null),f&&f.parentNode&&(f.parentNode.removeChild(f),f=null)},w=()=>{d||(d=!0,p!==null&&(clearTimeout(p),p=null),g(),v?.(),v=null)};return l&&le()?(h.textContent=t,u?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(S=>{v=S;const k=()=>{let A=0;h.textContent="",b();const E=document.createTextNode("");f?h.insertBefore(E,f):h.appendChild(E);const T=()=>{d||(A<t.length?(E.data=t.slice(0,A+1),A++,p=setTimeout(T,n)):(u?.(),a&&!d?p=setTimeout(()=>{d||(g(),k())},c):(g(),S(),v=null)))};p=setTimeout(T,s)};k()})}},zl=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))}},jl={async open(e){return new zl(e)}},Ul=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)}},Hl={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new Ul(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},Wl=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},Fl=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},Bl=(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("; ")},Ql=(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("; ")},Vl=(e,t={})=>{const r=ae().cookies,n={path:r?.path??"/",sameSite:r?.sameSite??"Lax",secure:r?.secure??!1,watch:!0,...t};n.sameSite==="None"&&(n.secure=!0);const s=Wl(e);let o=n.defaultValue??null;if(s!==null)try{o=n.deserialize?n.deserialize(s):Fl(s)?JSON.parse(s):s??o}catch(c){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,c),o=s??o}const i=L(o);if(typeof document>"u"||n.watch===!1)return i;let a=!1;return j(()=>{const c=i.value;if(!a){a=!0;return}if(c==null){Bl(e,n);return}Ql(e,c,n)}),i},Kl={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)}},Yl=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),Jl=(e={})=>{const t=ae().announcer,r={politeness:t?.politeness??"polite",atomic:t?.atomic??!0,delay:t?.delay??16,clearDelay:t?.clearDelay??1e3,...e},n=L("");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",Yl),i){const m=r.container??document.body??document.documentElement;if(!m)return{element:null,message:n,announce(v){n.value=v},clear(){n.value=""},destroy(){n.value=""}};m.appendChild(o)}const a=j(()=>{o.textContent=n.value});let c,l,u=!1;const h=()=>{c&&(clearTimeout(c),c=void 0),l&&(clearTimeout(l),l=void 0)};return{element:o,message:n,announce:(m,v={})=>{if(u)return;const b=v.politeness??r.politeness,g=v.delay??r.delay,w=v.clearDelay??r.clearDelay;h(),o.setAttribute("aria-live",b),o.setAttribute("role",b==="assertive"?"alert":"status"),n.value="",c=setTimeout(()=>{u||(n.value=m,w>0&&(l=setTimeout(()=>{u||(n.value="")},w)))},g)},clear:()=>{u||(h(),n.value="")},destroy:()=>{u||(u=!0,h(),n.value="",a(),i&&o.remove())}}},xs=(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)}},qs=(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},Gl=e=>{if(typeof document>"u")return()=>{};const t=ae().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 c=qs("meta",{name:a.name,property:a.property,"http-equiv":a.httpEquiv,content:a.content});document.head.appendChild(c),n.push(c)}for(const a of e.link??[]){const c=qs("link",{rel:a.rel,href:a.href,type:a.type,media:a.media,crossorigin:a.crossOrigin});document.head.appendChild(c),n.push(c)}return e.htmlAttributes&&s.push(xs(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(xs(document.body,e.bodyAttributes)),()=>{document.title=o;for(const a of s.reverse())a();for(const a of n)a.remove()}},zs=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}},Xl=class extends zs{constructor(){super(localStorage)}},Zl=class extends zs{constructor(){super(sessionStorage)}},eu=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))}},tu={local(){return new Xl},session(){return new Zl},indexedDB(e){return new eu(e)}},js=null,fe=L({path:"",params:{},query:{},matched:null,hash:""}),Us=D(()=>fe.value),rt=L(0),Ut=L(!1),ru=_(Ut),Hs=()=>{rt.value===0&&(Ut.value=!0),rt.value+=1},Ws=()=>{const e=Math.max(0,rt.value-1);rt.value=e,e===0&&(Ut.value=!1)},nu=()=>{rt.value=0,Ut.value=!1},ke=()=>js,Fs=e=>{js=e},nt=async(e,t={})=>{const r=ke();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},su=()=>{const e=ke();e?e.back():history.back()},ou=()=>{const e=ke();e?e.forward():history.forward()},iu="active",au=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),cu=typeof HTMLElement<"u"?HTMLElement:class{},Bs=class extends cu{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")??iu}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=au(this.activeClass);this._trackedActiveClasses=new Map(r.map(n=>[n,this.classList.contains(n)])),this._cleanup=j(()=>{const n=fe.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&&ke()&&nt(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},lu=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",Bs)},uu=(e,t={})=>r=>{r.preventDefault(),nt(e,t).catch(n=>{console.error("Navigation failed:",n)})},fu=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=ke();if(!o){n.preventDefault(),nt(s.pathname+s.search+s.hash).catch(l=>{console.error("Navigation failed:",l)});return}const i=o.base,a=o.hash;let c;if(a&&s.hash&&s.hash.startsWith("#/"))c=s.hash.slice(1);else{let l=s.pathname;i&&i!=="/"&&l.startsWith(i)&&(l=l.slice(i.length)||"/"),c=l+s.search+s.hash}n.preventDefault(),nt(c).catch(l=>{console.error("Navigation failed:",l)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},Qs=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{if(N(n))return;const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},du=128,Vs=new Map,Ks=new Map,Ys=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=du)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},hu=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},mu=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},Lr=e=>{const t=Vs.get(e);if(t!==void 0)return t;const r=mu(e);return Ys(Vs,e,r),r},Js=e=>{const t=Lr(e),r=Ks.get(t);if(r)return r;if(hu(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 Ys(Ks,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},st=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),Gs=e=>st(e)||e!==void 0&&e>="0"&&e<="9",Xs=(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},pu=(e,t)=>{const r=Xs(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},Zs=new Set,eo=(e,t)=>{if(e[t]!==":"||!st(e[t+1]))return null;let r=t+2;for(;r<e.length&&Gs(e[r]);)r++;let n=r,s;if(e[r]==="("){const o=pu(e,r);s=o.constraint,n=o.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},vu=e=>{if(!Zs.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&st(e[t+1])){const r=eo(e,t);r?.constraint&&Lr(r.constraint),t=r?.nextIndex??t+1;continue}t++}Zs.add(e)}},yu=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},to=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&st(e[r+1]));)r++;return e.slice(t,r)},ro=(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()},gu=(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=to(e,s+1),h=u.length>0?ro(t,o,t.length,u):null,d=(h?p=>{for(const f of h){const m=p(f);if(m)return m}return null}:p=>{for(let f=t.length;f>=o;f--){const m=p(f);if(m)return m}return null})(p=>{const f=n(s+1,p);return f?(r.set(i,f),f):null});return d||(r.set(i,null),null)}const c=eo(e,s);if(c){const u=c.constraint?Js(c.constraint):void 0,h=c.constraint?t.length:yu(t,o),d=to(e,c.nextIndex),p=d.length>0?ro(t,o,h,d):null,f=(p?m=>{for(const v of p){if(v<=o)continue;const b=m(v);if(b)return b}return null}:m=>{for(let v=h;v>o;v--){const b=m(v);if(b)return b}return null})(m=>{const v=t.slice(o,m);if(u&&!u.test(v))return null;const b=n(c.nextIndex,m);if(b){const g={[c.name]:v,...b};return r.set(i,g),g}return null});return f||(r.set(i,null),null)}if(o>=t.length||a!==t[o])return r.set(i,null),null;const l=n(s+1,o+1);return r.set(i,l),l};return n(0,0)},no=(e,t)=>{for(const r of t){vu(r.path);const n=gu(r.path,e);if(n)return{matched:r,params:n}}return null},Ht=(e,t,r,n)=>{const s=no(e,n);return{path:e,params:s?.params??{},query:Qs(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},so=(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(...so(n.children,s))}return r},bu=(e,t={})=>{const r=ke();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]===":"&&st(n.path[o+1])){let i=o+2;for(;i<n.path.length&&Gs(n.path[i]);)i++;let a=i,c=null;if(n.path[i]==="("){const h=Xs(n.path,i);if(!h)throw new Error(`bQuery router: Invalid constraint syntax in path "${n.path}" for route "${e}".`);c=h.constraint,a=h.endIndex}const l=n.path.slice(o+1,i),u=t[l];if(u===void 0)throw new Error(`bQuery router: Missing required param "${l}" for route "${e}".`);if(c&&!Js(c).test(u))throw new Error(`bQuery router: Param "${l}" with value "${u}" does not satisfy the route constraint "${c}" for route "${e}".`);s+=encodeURIComponent(u),o=a;continue}s+=n.path[o],o++}return s},wu=(e,t=!1)=>{const r=fe.value.path;return t?r===e:r.startsWith(e)},Su=(e,t=!1)=>D(()=>{const r=fe.value.path;return t?r===e:r.startsWith(e)}),Eu=100,Au=e=>{const t={};for(const[r,n]of Object.entries(e))N(r)||(t[r]=n);return t},ku=e=>{const t=ke();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:o=!1}=e,i=[],a=[],c=so(r),l=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 E=history.state&&typeof history.state=="object"?history.state:{};if(typeof E.__bqScrollKey!="string"){const T=s?window.location.hash||"#/":`${window.location.pathname}${window.location.search}${window.location.hash}`;history.replaceState({...E,__bqScrollKey:u},"",T)}}const p=()=>history.state&&history.state.__bqScrollKey||u,f=()=>`${Date.now()}-${h++}`,m=(E=p())=>{if(o)for(l.has(E)&&l.delete(E),l.set(E,{x:window.scrollX,y:window.scrollY});l.size>Eu;){const T=l.keys().next().value;if(T===void 0)break;l.delete(T)}},v=(E=p())=>{if(!o)return;const T=l.get(E);T?window.scrollTo(T.x,T.y):window.scrollTo(0,0)},b=()=>{const E=history.state&&typeof history.state=="object"?{...history.state}:{};return o&&(E.__bqScrollKey=u),E},g=()=>{if(s){const[T,P=""]=(window.location.hash.slice(1)||"/").split("#"),[C,$=""]=T.split("?");return{pathname:C,search:$?`?${$}`:"",hash:P?`#${P}`:""}}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:T,hash:P}=g();fe.value=Ht(E,T,P,c)},S=async(E,T,P=new Set)=>{Hs();try{const{pathname:C,search:$,hash:R}=g(),O=Ht(C,$,R,c),I=new URL(E,window.location.origin),x=`${I.pathname}${I.search}${I.hash}`;if(P.has(x))throw new Error(`bQuery router: redirect loop detected for path "${x}"`);P.add(x);const W=Ht(I.pathname,I.search,I.hash,c);if(W.matched?.redirectTo){await S(W.matched.redirectTo,T,P);return}if(W.matched?.beforeEnter&&await W.matched.beforeEnter(W,O)===!1)return;for(const Et of i)if(await Et(W,O)===!1)return;m();const q=o?p():void 0,V=T==="replaceState"&&q?q:f(),ve=s?`#${E}`:`${n}${E}`,We=o&&history.state&&typeof history.state=="object"?Au(history.state):{},on=o?{...We,__bqScrollKey:V}:{};history[T](on,"",ve),u=V,w(),o&&T==="pushState"&&window.scrollTo(0,0);for(const Et of a)Et(fe.value,O)}finally{Ws()}},k=async E=>{Hs();try{const{pathname:T,search:P,hash:C}=g(),$=fe.value,R=Ht(T,P,C,c);if(R.matched?.redirectTo){await S(R.matched.redirectTo,"replaceState");return}if(R.matched?.beforeEnter&&await R.matched.beforeEnter(R,$)===!1){const O=new URLSearchParams(Object.entries($.query).flatMap(([q,V])=>Array.isArray(V)?V.map(ve=>[q,ve]):[[q,V]])).toString(),I=O?`?${O}`:"",x=$.hash?`#${$.hash}`:"",W=s?`#${$.path}${I}${x}`:`${n}${$.path}${I}${x}`;history.replaceState(b(),"",W);return}for(const O of i)if(await O(R,$)===!1){const I=new URLSearchParams(Object.entries($.query).flatMap(([V,ve])=>Array.isArray(ve)?ve.map(We=>[V,We]):[[V,ve]])).toString(),x=I?`?${I}`:"",W=$.hash?`#${$.hash}`:"",q=s?`#${$.path}${x}${W}`:`${n}${$.path}${x}${W}`;history.replaceState(b(),"",q);return}m(u),u=E.state?.__bqScrollKey??p(),w(),v(u);for(const O of a)O(fe.value,$)}finally{Ws()}};window.addEventListener("popstate",k),w();const A={push:E=>S(E,"pushState"),replace:E=>S(E,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:E=>history.go(E),beforeEach:E=>(i.push(E),()=>{const T=i.indexOf(E);T>-1&&i.splice(T,1)}),afterEach:E=>(a.push(E),()=>{const T=a.indexOf(E);T>-1&&a.splice(T,1)}),currentRoute:Us,routes:c,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",k),i.length=0,a.length=0,l.clear(),d!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=d),nu(),Fs(null)}};return Fs(A),A},xe=D(()=>fe.value),Tu={route:xe,path:D(()=>xe.value.path),params:D(()=>xe.value.params),query:D(()=>xe.value.query),hash:D(()=>xe.value.hash),matched:D(()=>xe.value.matched)},Ru=()=>Tu,Cu=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},$u=(e,t)=>{const r=Cu();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},Ou=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},Lu=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},oo=[],Pu=e=>{oo.push(e)},Nu=(e,t)=>{for(const r of oo){const n=r({store:e,options:t});n&&Object.assign(e,n)}},ot=new Map,io=e=>ot.has(e),Iu=(e,t)=>{ot.set(e,t)},we=e=>ot.get(e),Wt=()=>Array.from(ot.keys()),Mu=e=>{ot.delete(e),Ou(e)},ao=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},qe=(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)||!qe(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(qe(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)=>qe(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=>qe(e[s],t[s]))},Du=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const o=e[s],i=t[s];r.get(s)===i&&ao(o)&&ao(i)&&!qe(o,i)&&n.push(s)}return n},it=()=>qt(),Pr=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if(io(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),we(t);const o=r(),i=new Map;for(const g of Object.keys(o))i.set(g,L(o[g]));const a=[],c=[],l=(g,w,S)=>{!it()||typeof console>"u"||typeof console.error!="function"||console.error(`[bQuery store "${t}"] Error in $onAction ${g} for action "${w}"`,S)},u=new WeakSet,h=(g,w)=>{!it()||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.`))},d=(g,w,S,k)=>{try{const A=S();Fe(A)&&(g==="listener"&&k&&h(k,w),A.catch(E=>{l(g,w,E)}))}catch(A){l(g,w,A)}},p=()=>Ee(()=>({...m})),f=()=>{const g=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(a.length===0&&!g)return;const w=p();for(const S of a)S(w);Lu(t,w)},m=new Proxy({},{get:(g,w)=>{const S=w;if(i.has(S))return i.get(S).value},ownKeys:()=>Array.from(i.keys()),getOwnPropertyDescriptor:(g,w)=>{if(i.has(w))return{enumerable:!0,configurable:!0}},has:(g,w)=>i.has(w)}),v=new Map,b={};for(const g of Object.keys(o))Object.defineProperty(b,g,{get:()=>i.get(g).value,set:w=>{i.get(g).value=w,f()},enumerable:!0,configurable:!1});for(const g of Object.keys(n)){const w=n[g],S=D(()=>w(m,new Proxy({},{get:(k,A)=>{const E=A;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(...k){const A=new Proxy(b,{get:(R,O)=>typeof O=="string"&&i.has(O)?i.get(O).value:R[O],set:(R,O,I)=>typeof O=="string"&&i.has(O)?(i.get(O).value=I,f(),!0):Reflect.set(R,O,I)});if(c.length===0)return w.apply(A,k);const E=[],T=[],P=[...c],C={name:S,store:b,args:k,after:R=>{E.push(O=>R(O))},onError:R=>{T.push(R)}};for(const R of P)d("listener",S,()=>R(C),R);let $;try{$=w.apply(A,k)}catch(R){for(const O of T)d("onError",S,()=>O(R));throw R}if(Fe($))return $.then(R=>{for(const O of E)d("after",S,()=>O(R));return R},R=>{for(const O of T)d("onError",S,()=>O(R));throw R});for(const R of E)d("after",S,()=>R($));return $}}return Object.defineProperties(b,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const g=r();Se(()=>{for(const[w,S]of i)S.value=g[w]}),f()},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=>(c.push(g),()=>{const w=c.indexOf(g);w>-1&&c.splice(w,1)}),writable:!1,enumerable:!1},$patch:{value:g=>{Se(()=>{if(typeof g=="function"){const w=it(),S=w?Te(p()):null,k=w?new Map(Array.from(i.entries()).map(([E,T])=>[E,T.value])):null,A=p();if(g(A),w&&S&&k){const E=Du(S,A,k);E.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${E.map(String).join(", ")}.
171
255
  Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.
172
256
  To fix this, either:
173
257
  1. Replace the entire object: state.user = { ...state.user, name: "New" }
174
258
  2. Use $patchDeep() for automatic deep cloning
175
- See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,C]of Object.entries(A))i.has(S)&&(i.get(S).value=C)}else for(const[w,E]of Object.entries(v))i.has(w)&&(i.get(w).value=E)}),f()},writable:!1,enumerable:!1},$patchDeep:{value:v=>{$e(()=>{if(typeof v=="function"){const w=ue(p());v(w);for(const[E,T]of Object.entries(w))i.has(E)&&(i.get(E).value=T)}else for(const[w,E]of Object.entries(v))i.has(w)&&(i.get(w).value=ue(E))}),f()},writable:!1,enumerable:!1},$state:{get:()=>p(),enumerable:!1}}),Ba(t,b),Fa(b,e),qa(t,b),b},Qa=(e,t)=>()=>vn(e)?Se(e):Dt({id:e,...t}),Va=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Wa=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Ka=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},Ya="__version",Ga={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},gn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},Ja=(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},Xa=()=>{try{return globalThis.localStorage}catch{return}},Za=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??Xa(),o=r.serializer??Ga,i=r.version,a=r.migrate,l=n+Ya;let c=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&&Fe()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(m,g),!1}},p=e.state,f=Dt({...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(!gn(b))return m;let v=b;if(i!==void 0&&a){const w=s.getItem(l),E=w!==null?Number(w):0,T=Number.isFinite(E)?E:0;if(T!==i){c=!1,u=!0;const A=a(v,T);if(!gn(A))return m;v=A;let S=!1;try{s.setItem(n,o.serialize(v)),S=!0,h=!0}catch(C){Fe()&&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 c=!1}return Ja(m,v)}catch{return m}}});return c&&s?d():u&&h&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(u=!1),f.$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{}}),f},el=(e,t,r,n={})=>{const s=n.equals??(n.deep?Ae: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)}})},bn=500,wn=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}},En=new wn(bn),Sn=new wn(bn),tl=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return le(n)||Ie(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),U=(e,t)=>{try{const r=tl(t);let n=En.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),En.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},at=(e,t)=>{try{let r=Sn.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),Sn.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Nt=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",o=0,i=null;for(let a=0;a<r.length;a++){const l=r[a];if(l==='"'||l==="'"||l==="`"){let c=0,u=a-1;for(;u>=0&&r[u]==="\\";)c++,u--;c%2===0&&(i===null?i=l:i===l&&(i=null)),s+=l;continue}if(i!==null){s+=l;continue}l==="("||l==="["||l==="{"?(o++,s+=l):l===")"||l==="]"||l==="}"?(o--,s+=l):l===","&&o===0?(n.push(s.trim()),s=""):s+=l}s.trim()&&n.push(s.trim());for(const a of n){let l=-1,c=0,u=null;for(let h=0;h<a.length;h++){const d=a[h];if(d==='"'||d==="'"||d==="`"){let p=0,f=h-1;for(;f>=0&&a[f]==="\\";)p++,f--;p%2===0&&(u===null?u=d:u===d&&(u=null));continue}if(u===null){if(d==="("||d==="["||d==="{")c++;else if(d===")"||d==="]"||d==="}")c--;else if(d===":"&&c===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},rl=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),nl=e=>{const t=e.trim(),r=t.toLowerCase();return r.startsWith("aria-")?r:`aria-${rl(/^aria[A-Z]/.test(t)?t.slice(4):t).replace(/^-/,"")}`},sl=e=>e==null||e==="",ol=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set,a=Object.create(null);if(t.trimStart().startsWith("{")){const l=Nt(t);for(const[c,u]of Object.entries(l))a[c]=U(u,r)}else{const l=U(t,r);if(l&&typeof l=="object"&&!Array.isArray(l))for(const[c,u]of Object.entries(l))x(c)||(a[c]=u)}for(const[l,c]of Object.entries(a)){const u=nl(l);if(sl(c)){e.removeAttribute(u);continue}e.setAttribute(u,c===!0?"true":String(c)),i.add(u)}for(const l of s)i.has(l)||e.removeAttribute(l);s=i});n.push(o)},il=e=>(t,r,n,s)=>{const o=j(()=>{const i=U(r,n);i==null||i===!1?t.removeAttribute(e):i===!0?t.setAttribute(e,""):t.setAttribute(e,String(i))});s.push(o)},al=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set;if(t.trimStart().startsWith("{")){const a=Nt(t);for(const[l,c]of Object.entries(a)){const u=U(c,r);e.classList.toggle(l,!!u),i.add(l)}}else if(/^\s*\[/.test(t)){const a=U(t,r);if(Array.isArray(a))for(const l of a)l&&(e.classList.add(l),i.add(l))}else{const a=U(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)},ll=e=>{if(le(e)||Ie(e))return String(e.value??"");if(e&&typeof e=="object"&&"error"in e){const t=e.error;return le(t)||Ie(t)?String(t.value??""):String(t??"")}return String(e??"")},cl=(e,t,r,n)=>{const s=e,o=!s.hasAttribute("aria-hidden");s.hasAttribute("role")||s.setAttribute("role","alert"),s.hasAttribute("aria-live")||s.setAttribute("aria-live","assertive");const i=j(()=>{const a=ll(U(t,r)).trim(),l=a.length>0;s.textContent=a,s.hidden=!l,o&&(l?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden","true"))});n.push(i)},ul=(e,t,r,n,s,o)=>{if(!r)return t;const i={...o,[n]:e};return s&&(i[s]=t),U(r,i)},fl=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,o,i,a)=>{const l=s.parentNode;if(!l)return;const c=o.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!c){console.error(`bQuery view: Invalid bq-for expression "${o}"`);return}const[,u,h,d]=c,p=s.getAttribute(":key")||s.getAttribute(`${t}-key`),f=s.cloneNode(!0);f.removeAttribute(`${t}-for`),f.removeAttribute(":key"),f.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=f.cloneNode(!0),O=[],L=M(A),k=h?M(S):null,$={...i,[u]:L};return h&&k&&($[h]=k),r(R,$,t,O),n(R,$,t,O),{key:C,element:R,cleanups:O,item:A,index:S,itemSignal:L,indexSignal:k}},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))},T=j(()=>{const A=U(d,i);if(!Array.isArray(A)){for(const $ of g.values())w($);g.clear(),b=[];return}const S=[],C=new Map,R=new Set;A.forEach(($,D)=>{let I=ul($,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:$,index:D})});const O=[];for(const $ of b)C.has($)||O.push($);for(const $ of O){const D=g.get($);D&&(w(D),g.delete($))}const L=new Map;let k=m;for(let $=0;$<S.length;$++){const D=S[$],{item:I,index:z}=C.get(D);let _=g.get(D);_?(E(_,I,z),L.set(D,_),k.nextSibling!==_.element&&k.after(_.element),k=_.element):(_=v(I,z,D),L.set(D,_),k.after(_.element),k=_.element)}g=L,b=S});a.push(()=>{T();for(const A of g.values())for(const S of A.cleanups)S();g.clear()})}},dl=e=>(t,r,n,s)=>{const o=j(()=>{const i=U(r,n),a=String(i??"");t.innerHTML=e?J(a):a});s.push(o)},hl=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let o=!0;const i=j(()=>{const a=U(t,r);a&&!o?(s.replaceWith(e),o=!0):!a&&o&&(e.replaceWith(s),o=!1)});n.push(i)},ml=(e,t,r,n)=>{const s=e,o=at(t,r);if(!le(o)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const i=o,a=s.type==="checkbox",l=s.type==="radio",c=()=>{a?s.checked=!!i.value:l?s.checked=i.value===s.value:s.value=String(i.value??"")},u=j(()=>{c()});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))},pl=e=>(t,r,n,s)=>{const o=i=>{const a={...n,$event:i,$el:t};if(!r.includes("(")){const l=at(r,a);if(typeof l=="function"){l(i);return}return}at(r,a)};t.addEventListener(e,o),s.push(()=>t.removeEventListener(e,o))};function vl(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var yl=(e,t,r,n)=>{const s=at(t,r);le(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&vl(s)&&(s.value=e,n.push(()=>{s.value=null}))},gl=(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=U(t,r);s.style.display=a?o:"none"});n.push(i)},bl=(e,t,r,n)=>{const s=e;let o=new Set;const i=j(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const l=Nt(t);for(const[c,u]of Object.entries(l)){const h=U(u,r),d=c.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(d,String(h??"")),a.add(d)}}else{const l=U(t,r);if(l&&typeof l=="object")for(const[c,u]of Object.entries(l)){const h=c.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)},wl=(e,t,r,n)=>{const s=j(()=>{const o=U(t,r);e.textContent=String(o??"")});n.push(s)},Pt=null,El=e=>{Pt=e},Sl=e=>Pt?Pt(e):void 0,lt=(e,t,r,n,s)=>{const o=Array.from(e.attributes);for(const i of o){const{name:a,value:l}=i;if(!a.startsWith(`${r}-`))continue;const c=a.slice(r.length+1);if(c==="for"){s.for(e,l,t,n);return}if(c==="text")s.text(e,l,t,n);else if(c==="error")s.error(e,l,t,n);else if(c==="aria")s.aria(e,l,t,n);else if(c==="html")s.html(e,l,t,n);else if(c==="if")s.if(e,l,t,n);else if(c==="show")s.show(e,l,t,n);else if(c==="class")s.class(e,l,t,n);else if(c==="style")s.style(e,l,t,n);else if(c==="model")s.model(e,l,t,n);else if(c==="ref")s.ref(e,l,t,n);else if(c.startsWith("bind:")){const u=c.slice(5);s.bind(u)(e,l,t,n)}else if(c.startsWith("on:")){const u=c.slice(3);s.on(u)(e,l,t,n)}else{const u=Sl(c);u?u(e,l,t,n):St()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery][view] Unknown directive "${a}" (parsed as "${c}") on <${e.tagName.toLowerCase()}>. This may be a typo or a missing custom directive registration.`)}}},It=(e,t,r,n,s)=>{const o=Array.from(e.children);for(const i of o)i.hasAttribute(`${r}-for`)?lt(i,t,r,n,s):(lt(i,t,r,n,s),It(i,t,r,n,s))},_t=(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:wl,error:cl,aria:ol,html:dl(s),if:hl,show:gl,class:al,style:bl,model:ml,ref:yl,for:fl({prefix:n,processElement:(c,u,h,d)=>lt(c,u,h,d,a),processChildren:(c,u,h,d)=>It(c,u,h,d,a)}),bind:il,on:pl};return((c,u,h)=>{const d=c.hasAttribute(`${n}-for`);lt(c,u,n,h,a),d||It(c,u,n,h,a)})(o,t,i),{el:o,context:t,update:c=>{Object.assign(t,c)},destroy:()=>{for(const c of i)c();i.length=0}}},Al=(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 _t(s,r,t)},Cl=e=>e===!0||e===void 0,kl=async(e,t)=>{const r=e(t),n=Oe(r)?await r:r;return Cl(n)?void 0:n},Ol=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}}},An=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await kl(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},Tl=e=>{const t=Object.entries(e.fields),r={},n={};for(const[f,m]of t){const g=Ol(m);r[f]=g,n[f]=g.error}const s=M(!1),o=P(()=>{for(const f of Object.keys(r))if(r[f].error.value!=="")return!1;return!0}),i=P(()=>{for(const f of Object.keys(r))if(r[f].isDirty.value)return!0;return!1}),a=async f=>{const m=r[f],g=e.fields[f];!m||!g||await An(m,g.validators)},l=async()=>{let f=!1;for(const[m,g]of t){const b=r[m];await An(b,g.validators)&&(f=!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),f=!0)}}}}return!f},c=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 f of Object.keys(r))r[f].reset()},h=()=>{const f={};for(const m of Object.keys(r))f[m]=r[m].value.value;return f};return{fields:r,errors:n,isValid:o,isDirty:i,isSubmitting:s,handleSubmit:c,validateField:a,validate:l,reset:u,getValues:h,setValues:f=>{for(const[m,g]of Object.entries(f)){if(x(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.value.value=g)}},setErrors:f=>{for(const[m,g]of Object.entries(f)){if(x(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.error.value=g??"")}}}},Ll=e=>e===!0||e===void 0,$l=async(e,t)=>{const r=e(t),n=Oe(r)?await r:r;return Ll(n)?void 0:n},Rl=(e,t={})=>{let r;Ml(e)?r=e:r=M(Cr(e)||Dl(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),c=P(()=>s.value===""),u=t.validateOn??"manual",h=Math.max(0,t.debounceMs??0);let d=0,p=!1,f=!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 O=await $l(R,C);if(A!==d)return s.peek()==="";if(O)return s.value=O,!1}return A===d&&(s.value=""),!0}finally{A===d&&(i.value=!1)}},w=ht(()=>{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(f){f=!1;return}E()})),{value:r,error:s,isDirty:a,isTouched:o,isPristine:l,isValid:c,isValidating:i,touch:()=>{o.value=!0,(u==="blur"||u==="both")&&E()},reset:()=>{d+=1,w.cancel(),Object.is(r.peek(),n)||(f=!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(),c.dispose(),i.value=!1)}}},Ml=e=>e instanceof Pe,Dl=e=>e instanceof Ne,Nl=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,Pl=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},Il=(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}},ql=(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}},xl=(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}},jl=(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},zl=(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},Fl=(e,t)=>r=>e(r)?!0:t,Bl=(e,t)=>async r=>await e(r)?!0:t,Hl=(e,t="Fields do not match")=>r=>Object.is(r,e.value)?!0:t,Cn=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},kn=(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()}},On=(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},Ul=(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]},Tn=(e,t,r,n)=>{let s;return e&&(s=On(e,t)),s===void 0&&n&&(s=On(n,t)),s===void 0?t:Ul(Ql(s,r),r)},Ln=(e,t)=>{const r=pe(e,t),n=s=>{if(Array.isArray(s))return s.map(i=>n(i));if(!me(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)},Vl=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=v=>Ln(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 Tn(E,v,w,n?o[n]:void 0)},tc:(v,w={})=>P(()=>{const E=o[i.value];return Tn(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)=>Cn(v,w?.locale??i.value,w),d:(v,w)=>kn(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]=Ln(o[v],s(w)))},availableLocales:()=>{const v=new Set([...l,...a.keys()]);return Array.from(v).sort()}}},ct=new Map,Be=new Map,Wl=50,Kl=e=>{const t=ct.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),ct.set(e,r),r},Yl=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=Kl(t),n=Be.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{Be.delete(t),r.isConnected&&(r.textContent=e)},Wl);Be.set(t,s)},Gl=()=>{for(const e of Be.values())clearTimeout(e);Be.clear();for(const[,e]of ct)e.remove();ct.clear()},K=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),Jl=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},Xl=e=>{const t=[],r=e.querySelectorAll("input, select, textarea");for(const n of r){const s=n.getAttribute("type");if(s==="hidden"||s==="submit"||s==="button"||s==="reset")continue;const o=n.getAttribute("id"),i=o?!!e.querySelector(`label[for="${o}"]`):!1,a=n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby"),l=n.hasAttribute("title"),c=n.closest("label")!==null;!i&&!a&&!l&&!c&&t.push(K("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},Zl=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},ec=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},tc=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},rc=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},nc=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...Jl(t),...Xl(t),...Zl(t),...ec(t),...tc(t),...rc(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}},$n=(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)}},Rn=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},sc=()=>{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=$n(r,o=>{e.value=o.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return Rn(H(e),t)},oc=()=>{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=>$n(a,()=>{o()})).filter(a=>a!==void 0);i.length>0&&(t=()=>{for(const a of i)a();e.dispose()})}catch{}}return Rn(H(e),t)},ic=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:o}=r;let i=0;const a=new Map,l=()=>Array.from(e.querySelectorAll(t)),c=f=>{for(const m of f)a.has(m)||a.set(m,m.getAttribute("tabindex"))},u=f=>{const m=l();if(m.length===0)return;c(m);const g=Math.max(0,Math.min(f,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=f=>{if(f==="Home"||f==="End")return!0;switch(s){case"horizontal":return f==="ArrowLeft"||f==="ArrowRight";case"vertical":return f==="ArrowUp"||f==="ArrowDown";case"both":return f==="ArrowLeft"||f==="ArrowRight"||f==="ArrowUp"||f==="ArrowDown";default:return!1}},d=f=>{if(!h(f.key))return;const m=l();if(m.length===0)return;f.preventDefault();let g=i;switch(f.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();c(p);for(let f=0;f<p.length;f++)p[f].setAttribute("tabindex",f===0?"0":"-1");return e.addEventListener("keydown",d),{destroy:()=>{e.removeEventListener("keydown",d);for(const[f,m]of a)m===null?f.removeAttribute("tabindex"):f.setAttribute("tabindex",m);a.clear()},focusItem:f=>{u(f)},activeIndex:()=>i}},qt=`
259
+ See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[E,T]of Object.entries(A))i.has(E)&&(i.get(E).value=T)}else for(const[w,S]of Object.entries(g))i.has(w)&&(i.get(w).value=S)}),f()},writable:!1,enumerable:!1},$patchDeep:{value:g=>{Se(()=>{if(typeof g=="function"){const w=Te(p());g(w);for(const[S,k]of Object.entries(w))i.has(S)&&(i.get(S).value=k)}else for(const[w,S]of Object.entries(g))i.has(w)&&(i.get(w).value=Te(S))}),f()},writable:!1,enumerable:!1},$state:{get:()=>p(),enumerable:!1}}),Iu(t,b),Nu(b,e),$u(t,b),b},_u=(e,t)=>()=>io(e)?we(e):Pr({id:e,...t}),xu=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},qu=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},zu=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},ju="__version",Uu={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},co=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},Hu=(e,t)=>{const r={...e};for(const[n,s]of Object.entries(t))N(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s);return r},Wu=()=>{try{return globalThis.localStorage}catch{return}},Fu=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??Wu(),o=r.serializer??Uu,i=r.version,a=r.migrate,c=n+ju;let l=s!==void 0&&i!==void 0,u=!1,h=!1;const d=m=>{if(!s||i===void 0)return!1;try{return s.setItem(c,String(i)),!0}catch(v){return m&&it()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(m,v),!1}},p=e.state,f=Pr({...e,state:()=>{const m=p();if(!s)return m;try{const v=s.getItem(n);if(!v)return m;const b=o.deserialize(v);if(!co(b))return m;let g=b;if(i!==void 0&&a){const w=s.getItem(c),S=w!==null?Number(w):0,k=Number.isFinite(S)?S:0;if(k!==i){l=!1,u=!0;const A=a(g,k);if(!co(A))return m;g=A;let E=!1;try{s.setItem(n,o.serialize(g)),E=!0,h=!0}catch(T){it()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`,T)}E&&d(`[bQuery store "${e.id}"] Failed to persist migrated version:`)&&(u=!1)}else l=!1}return Hu(m,g)}catch{return m}}});return l&&s?d():u&&h&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(u=!1),f.$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{}}),f},Bu=(e,t,r,n={})=>{const s=n.equals??(n.deep?qe: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 c=o;o=a,r(a,c)}})},lo=500,uo=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}},fo=new uo(lo),ho=new uo(lo),Qu=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return G(n)||ce(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),Q=(e,t)=>{try{const r=Qu(t);let n=fo.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),fo.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Ft=(e,t)=>{try{let r=ho.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),ho.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Nr=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 c=r[a];if(c==='"'||c==="'"||c==="`"){let l=0,u=a-1;for(;u>=0&&r[u]==="\\";)l++,u--;l%2===0&&(i===null?i=c:i===c&&(i=null)),s+=c;continue}if(i!==null){s+=c;continue}c==="("||c==="["||c==="{"?(o++,s+=c):c===")"||c==="]"||c==="}"?(o--,s+=c):c===","&&o===0?(n.push(s.trim()),s=""):s+=c}s.trim()&&n.push(s.trim());for(const a of n){let c=-1,l=0,u=null;for(let h=0;h<a.length;h++){const d=a[h];if(d==='"'||d==="'"||d==="`"){let p=0,f=h-1;for(;f>=0&&a[f]==="\\";)p++,f--;p%2===0&&(u===null?u=d:u===d&&(u=null));continue}if(u===null){if(d==="("||d==="["||d==="{")l++;else if(d===")"||d==="]"||d==="}")l--;else if(d===":"&&l===0){c=h;break}}}if(c>-1){const h=a.slice(0,c).trim().replace(/^['"]|['"]$/g,"");if(N(h))continue;t[h]=a.slice(c+1).trim()}}return t},Vu=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),Ku=e=>{const t=e.trim(),r=t.toLowerCase();return r.startsWith("aria-")?r:`aria-${Vu(/^aria[A-Z]/.test(t)?t.slice(4):t).replace(/^-/,"")}`},Yu=e=>e==null||e==="",Ju=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set,a=Object.create(null);if(t.trimStart().startsWith("{")){const c=Nr(t);for(const[l,u]of Object.entries(c))a[l]=Q(u,r)}else{const c=Q(t,r);if(c&&typeof c=="object"&&!Array.isArray(c))for(const[l,u]of Object.entries(c))N(l)||(a[l]=u)}for(const[c,l]of Object.entries(a)){const u=Ku(c);if(Yu(l)){e.removeAttribute(u);continue}e.setAttribute(u,l===!0?"true":String(l)),i.add(u)}for(const c of s)i.has(c)||e.removeAttribute(c);s=i});n.push(o)},Gu=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)},Xu=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set;if(t.trimStart().startsWith("{")){const a=Nr(t);for(const[c,l]of Object.entries(a)){const u=Q(l,r);e.classList.toggle(c,!!u),i.add(c)}}else if(/^\s*\[/.test(t)){const a=Q(t,r);if(Array.isArray(a))for(const c of a)c&&(e.classList.add(c),i.add(c))}else{const a=Q(t,r);typeof a=="string"?a.split(/\s+/).forEach(c=>{c&&(e.classList.add(c),i.add(c))}):Array.isArray(a)&&a.forEach(c=>{c&&(e.classList.add(c),i.add(c))})}for(const a of s)i.has(a)||e.classList.remove(a);s=i});n.push(o)},Zu=e=>{if(G(e)||ce(e))return String(e.value??"");if(e&&typeof e=="object"&&"error"in e){const t=e.error;return G(t)||ce(t)?String(t.value??""):String(t??"")}return String(e??"")},ef=(e,t,r,n)=>{const s=e,o=!s.hasAttribute("aria-hidden");s.hasAttribute("role")||s.setAttribute("role","alert"),s.hasAttribute("aria-live")||s.setAttribute("aria-live","assertive");const i=j(()=>{const a=Zu(Q(t,r)).trim(),c=a.length>0;s.textContent=a,s.hidden=!c,o&&(c?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden","true"))});n.push(i)},tf=(e,t,r,n,s,o)=>{if(!r)return t;const i={...o,[n]:e};return s&&(i[s]=t),Q(r,i)},rf=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,o,i,a)=>{const c=s.parentNode;if(!c)return;const l=o.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!l){console.error(`bQuery view: Invalid bq-for expression "${o}"`);return}const[,u,h,d]=l,p=s.getAttribute(":key")||s.getAttribute(`${t}-key`),f=s.cloneNode(!0);f.removeAttribute(`${t}-for`),f.removeAttribute(":key"),f.removeAttribute(`${t}-key`);const m=document.createComment(`bq-for: ${o}`);c.replaceChild(m,s);let v=new Map,b=[];const g=(A,E,T)=>{const P=f.cloneNode(!0),C=[],$=L(A),R=h?L(E):null,O={...i,[u]:$};return h&&R&&(O[h]=R),r(P,O,t,C),n(P,O,t,C),{key:T,element:P,cleanups:C,item:A,index:E,itemSignal:$,indexSignal:R}},w=A=>{for(const E of A.cleanups)E();A.element.remove()},S=(A,E,T)=>{Object.is(A.item,E)||(A.item=E,A.itemSignal.value=E),A.index!==T&&(A.index=T,A.indexSignal&&(A.indexSignal.value=T))},k=j(()=>{const A=Q(d,i);if(!Array.isArray(A)){for(const O of v.values())w(O);v.clear(),b=[];return}const E=[],T=new Map,P=new Set;A.forEach((O,I)=>{let x=tf(O,I,p,u,h,i);P.has(x)&&(console.warn(`bq-for: Duplicate key "${String(x)}" detected at index ${I}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),x={__bqDuplicateKey:x,__bqIndex:I}),P.add(x),E.push(x),T.set(x,{item:O,index:I})});const C=[];for(const O of b)T.has(O)||C.push(O);for(const O of C){const I=v.get(O);I&&(w(I),v.delete(O))}const $=new Map;let R=m;for(let O=0;O<E.length;O++){const I=E[O],{item:x,index:W}=T.get(I);let q=v.get(I);q?(S(q,x,W),$.set(I,q),R.nextSibling!==q.element&&R.after(q.element),R=q.element):(q=g(x,W,I),$.set(I,q),R.after(q.element),R=q.element)}v=$,b=E});a.push(()=>{k();for(const A of v.values())for(const E of A.cleanups)E();v.clear()})}},nf=e=>(t,r,n,s)=>{const o=j(()=>{const i=Q(r,n),a=String(i??"");t.innerHTML=e?ie(a):a});s.push(o)},sf=(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)},of=(e,t,r,n)=>{const s=e,o=Ft(t,r);if(!G(o)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const i=o,a=s.type==="checkbox",c=s.type==="radio",l=()=>{a?s.checked=!!i.value:c?s.checked=i.value===s.value:s.value=String(i.value??"")},u=j(()=>{l()});n.push(u);const h=s.tagName==="SELECT"?"change":"input",d=()=>{a?i.value=s.checked:c?s.checked&&(i.value=s.value):i.value=s.value};s.addEventListener(h,d),n.push(()=>s.removeEventListener(h,d))},af=e=>(t,r,n,s)=>{const o=i=>{const a={...n,$event:i,$el:t};if(!r.includes("(")){const c=Ft(r,a);if(typeof c=="function"){c(i);return}return}Ft(r,a)};t.addEventListener(e,o),s.push(()=>t.removeEventListener(e,o))};function cf(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var lf=(e,t,r,n)=>{const s=Ft(t,r);G(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&cf(s)&&(s.value=e,n.push(()=>{s.value=null}))},uf=(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)},ff=(e,t,r,n)=>{const s=e;let o=new Set;const i=j(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const c=Nr(t);for(const[l,u]of Object.entries(c)){const h=Q(u,r),d=l.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(d,String(h??"")),a.add(d)}}else{const c=Q(t,r);if(c&&typeof c=="object")for(const[l,u]of Object.entries(c)){const h=l.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(h,String(u??"")),a.add(h)}}for(const c of o)a.has(c)||s.style.removeProperty(c);o=a});n.push(i)},df=(e,t,r,n)=>{const s=j(()=>{const o=Q(t,r);e.textContent=String(o??"")});n.push(s)},Ir=null,hf=e=>{Ir=e},mf=e=>Ir?Ir(e):void 0,Bt=(e,t,r,n,s)=>{const o=Array.from(e.attributes);for(const i of o){const{name:a,value:c}=i;if(!a.startsWith(`${r}-`))continue;const l=a.slice(r.length+1);if(l==="for"){s.for(e,c,t,n);return}if(l==="text")s.text(e,c,t,n);else if(l==="error")s.error(e,c,t,n);else if(l==="aria")s.aria(e,c,t,n);else if(l==="html")s.html(e,c,t,n);else if(l==="if")s.if(e,c,t,n);else if(l==="show")s.show(e,c,t,n);else if(l==="class")s.class(e,c,t,n);else if(l==="style")s.style(e,c,t,n);else if(l==="model")s.model(e,c,t,n);else if(l==="ref")s.ref(e,c,t,n);else if(l.startsWith("bind:")){const u=l.slice(5);s.bind(u)(e,c,t,n)}else if(l.startsWith("on:")){const u=l.slice(3);s.on(u)(e,c,t,n)}else{const u=mf(l);u?u(e,c,t,n):qt()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery][view] Unknown directive "${a}" (parsed as "${l}") on <${e.tagName.toLowerCase()}>. This may be a typo or a missing custom directive registration.`)}}},Mr=(e,t,r,n,s)=>{const o=Array.from(e.children);for(const i of o)i.hasAttribute(`${r}-for`)?Bt(i,t,r,n,s):(Bt(i,t,r,n,s),Mr(i,t,r,n,s))},Dr=(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:df,error:ef,aria:Ju,html:nf(s),if:sf,show:uf,class:Xu,style:ff,model:of,ref:lf,for:rf({prefix:n,processElement:(l,u,h,d)=>Bt(l,u,h,d,a),processChildren:(l,u,h,d)=>Mr(l,u,h,d,a)}),bind:Gu,on:af};return((l,u,h)=>{const d=l.hasAttribute(`${n}-for`);Bt(l,u,n,h,a),d||Mr(l,u,n,h,a)})(o,t,i),{el:o,context:t,update:l=>{Object.assign(t,l)},destroy:()=>{for(const l of i)l();i.length=0}}},pf=(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 Dr(s,r,t)},vf=e=>e===!0||e===void 0,yf=async(e,t)=>{const r=e(t),n=Fe(r)?await r:r;return vf(n)?void 0:n},gf=e=>{const t=e.initialValue,r=L(t),n=L(""),s=L(!1),o=D(()=>!Object.is(r.value,t));return{value:r,error:n,isDirty:o,isTouched:s,isPristine:D(()=>!o.value),touch:()=>{s.value=!0},reset:()=>{r.value=t,n.value="",s.value=!1}}},mo=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await yf(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},bf=e=>{const t=Object.entries(e.fields),r={},n={};for(const[f,m]of t){const v=gf(m);r[f]=v,n[f]=v.error}const s=L(!1),o=D(()=>{for(const f of Object.keys(r))if(r[f].error.value!=="")return!1;return!0}),i=D(()=>{for(const f of Object.keys(r))if(r[f].isDirty.value)return!0;return!1}),a=async f=>{const m=r[f],v=e.fields[f];!m||!v||await mo(m,v.validators)},c=async()=>{let f=!1;for(const[m,v]of t){const b=r[m];await mo(b,v.validators)&&(f=!0)}if(e.crossValidators&&e.crossValidators.length>0){const m=h();for(const v of e.crossValidators){const b=await v(m);if(b){for(const[g,w]of Object.entries(b))if(w){const S=r[g];S&&(S.error.value===""&&(S.error.value=w),f=!0)}}}}return!f},l=async()=>{if(!s.value){s.value=!0;try{if(!await c())return;e.onSubmit&&await e.onSubmit(h())}finally{s.value=!1}}},u=()=>{for(const f of Object.keys(r))r[f].reset()},h=()=>{const f={};for(const m of Object.keys(r))f[m]=r[m].value.value;return f};return{fields:r,errors:n,isValid:o,isDirty:i,isSubmitting:s,handleSubmit:l,validateField:a,validate:c,reset:u,getValues:h,setValues:f=>{for(const[m,v]of Object.entries(f)){if(N(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.value.value=v)}},setErrors:f=>{for(const[m,v]of Object.entries(f)){if(N(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.error.value=v??"")}}}},wf=e=>e===!0||e===void 0,Sf=async(e,t)=>{const r=e(t),n=Fe(r)?await r:r;return wf(n)?void 0:n},Ef=(e,t={})=>{let r;Af(e)?r=e:r=L(Wn(e)||kf(e)?e.peek():e);const n=r.peek(),s=L(t.initialError??""),o=L(!1),i=L(!1),a=D(()=>!Object.is(r.value,n)),c=D(()=>!a.value),l=D(()=>s.value===""),u=t.validateOn??"manual",h=Math.max(0,t.debounceMs??0);let d=0,p=!1,f=!1,m=!1,v;const b=A=>{console.error("bQuery forms: Error in scheduled field validation",A)},g=async()=>{const A=++d,E=t.validators;if(!E||E.length===0)return s.value="",i.value=!1,!0;i.value=!0;try{const T=r.peek();for(const P of E){const C=await Sf(P,T);if(A!==d)return s.peek()==="";if(C)return s.value=C,!1}return A===d&&(s.value=""),!0}finally{A===d&&(i.value=!1)}},w=fr(()=>{g().catch(b)},h),S=()=>{if(!m){if(h>0){w();return}g().catch(b)}};return(u==="change"||u==="both")&&(v=j(()=>{if(r.value,!p){p=!0;return}if(f){f=!1;return}S()})),{value:r,error:s,isDirty:a,isTouched:o,isPristine:c,isValid:l,isValidating:i,touch:()=>{o.value=!0,(u==="blur"||u==="both")&&S()},reset:()=>{d+=1,w.cancel(),Object.is(r.peek(),n)||(f=!0),r.value=n,s.value=t.initialError??"",o.value=!1,i.value=!1},validate:async()=>(w.cancel(),g()),destroy:()=>{m||(m=!0,d+=1,w.cancel(),v?.(),v=void 0,a.dispose(),c.dispose(),l.dispose(),i.value=!1)}}},Af=e=>e instanceof Ge,kf=e=>e instanceof Je,Tf=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,Rf=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},Cf=(e,t)=>{const r=t??`Must be at most ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length<=e?!0:r},$f=(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}},Of=(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}},Lf=(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}},Pf=(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},Nf=(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},If=(e,t)=>r=>e(r)?!0:t,Mf=(e,t)=>async r=>await e(r)?!0:t,Df=(e,t="Fields do not match")=>r=>Object.is(r,e.value)?!0:t,po=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},vo=(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()}},yo=(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},_f=(e,t)=>e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r),xf=(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]},go=(e,t,r,n)=>{let s;return e&&(s=yo(e,t)),s===void 0&&n&&(s=yo(n,t)),s===void 0?t:_f(xf(s,r),r)},bo=(e,t)=>{const r=Pe(e,t),n=s=>{if(Array.isArray(s))return s.map(i=>n(i));if(!Le(s))return s;const o=Object.create(null);for(const[i,a]of Object.entries(s))N(i)||(o[i]=n(a));return o};return n(r)},qf=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=g=>bo(Object.create(null),g),o=Object.create(null);for(const[g,w]of Object.entries(r))N(g)||(o[g]=s(w));const i=L(t),a=new Map,c=new Set(Object.keys(o));return{$locale:i,t:(g,w={})=>{const S=o[i.value];return go(S,g,w,n?o[n]:void 0)},tc:(g,w={})=>D(()=>{const S=o[i.value];return go(S,g,w,n?o[n]:void 0)}),loadLocale:(g,w)=>{N(g)||a.set(g,w)},ensureLocale:async g=>{if(N(g)||c.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();o[g]=s(S.default??S),c.add(g)},n:(g,w)=>po(g,w?.locale??i.value,w),d:(g,w)=>vo(g,w?.locale??i.value,w),getMessages:g=>{if(!N(g))return o[g]},mergeMessages:(g,w)=>{N(g)||(o[g]||(o[g]=Object.create(null),c.add(g)),o[g]=bo(o[g],s(w)))},availableLocales:()=>{const g=new Set([...c,...a.keys()]);return Array.from(g).sort()}}},Qt=new Map,at=new Map,zf=50,jf=e=>{const t=Qt.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),Qt.set(e,r),r},Uf=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=jf(t),n=at.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{at.delete(t),r.isConnected&&(r.textContent=e)},zf);at.set(t,s)},Hf=()=>{for(const e of at.values())clearTimeout(e);at.clear();for(const[,e]of Qt)e.remove();Qt.clear()},ne=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),Wf=e=>{const t=[],r=e.querySelectorAll("img");for(const n of r)n.hasAttribute("alt")?n.getAttribute("alt")===""&&!n.hasAttribute("role")&&t.push(ne("info",'Image has empty alt text. Consider adding role="presentation" if decorative.',n,"img-decorative")):t.push(ne("error",'Image is missing an alt attribute. Add alt="" for decorative images or a descriptive alt text.',n,"img-alt"));return t},Ff=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"),c=n.hasAttribute("title"),l=n.closest("label")!==null;!i&&!a&&!c&&!l&&t.push(ne("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},Bf=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(ne("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"),c=s.querySelector("img[alt]")!==null;!o&&!i&&!a&&!c&&t.push(ne("error","Link has no accessible name. Add text content, aria-label, or title.",s,"link-name"))}return t},Qf=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(ne("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(ne("warning","Heading element is empty.",s,"heading-empty")),n=o}return t},Vf=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(ne("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(ne("error",`aria-describedby references "${i}" which does not exist in the document.`,s,"aria-describedby-ref"))}return t},Kf=e=>{const t=[];return(e===document.body||e===document.documentElement)&&(e.querySelector("main")||e.querySelector('[role="main"]')||t.push(ne("warning",'Page is missing a <main> landmark. Add <main> or role="main" to the primary content area.',e,"landmark-main"))),t},Yf=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...Wf(t),...Ff(t),...Bf(t),...Qf(t),...Vf(t),...Kf(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}},wo=(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)}},So=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},Jf=()=>{const e=L("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=wo(r,o=>{e.value=o.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return So(_(e),t)},Gf=()=>{const e=L("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=>wo(a,()=>{o()})).filter(a=>a!==void 0);i.length>0&&(t=()=>{for(const a of i)a();e.dispose()})}catch{}}return So(_(e),t)},Xf=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:o}=r;let i=0;const a=new Map,c=()=>Array.from(e.querySelectorAll(t)),l=f=>{for(const m of f)a.has(m)||a.set(m,m.getAttribute("tabindex"))},u=f=>{const m=c();if(m.length===0)return;l(m);const v=Math.max(0,Math.min(f,m.length-1));for(let b=0;b<m.length;b++)m[b].setAttribute("tabindex",b===v?"0":"-1");i=v,m[v].focus(),o?.(m[v],v)},h=f=>{if(f==="Home"||f==="End")return!0;switch(s){case"horizontal":return f==="ArrowLeft"||f==="ArrowRight";case"vertical":return f==="ArrowUp"||f==="ArrowDown";case"both":return f==="ArrowLeft"||f==="ArrowRight"||f==="ArrowUp"||f==="ArrowDown";default:return!1}},d=f=>{if(!h(f.key))return;const m=c();if(m.length===0)return;f.preventDefault();let v=i;switch(f.key){case"ArrowDown":case"ArrowRight":v=i+1,v>=m.length&&(v=n?0:m.length-1);break;case"ArrowUp":case"ArrowLeft":v=i-1,v<0&&(v=n?m.length-1:0);break;case"Home":v=0;break;case"End":v=m.length-1;break}u(v)},p=c();l(p);for(let f=0;f<p.length;f++)p[f].setAttribute("tabindex",f===0?"0":"-1");return e.addEventListener("keydown",d),{destroy:()=>{e.removeEventListener("keydown",d);for(const[f,m]of a)m===null?f.removeAttribute("tabindex"):f.setAttribute("tabindex",m);a.clear()},focusItem:f=>{u(f)},activeIndex:()=>i}},_r=`
176
260
  position: absolute;
177
261
  top: -9999px;
178
262
  left: -9999px;
@@ -185,9 +269,13 @@ See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,C]of Object.en
185
269
  border-radius: 0 0 4px 0;
186
270
  outline: 2px solid #4A90D9;
187
271
  outline-offset: 2px;
188
- `,ac=`
272
+ `,Zf=`
189
273
  top: 0;
190
274
  left: 0;
191
- `,Mn=0,Ce=new Map,lc=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,cc=()=>({destroy:()=>{},element:null}),uc=(e,t={})=>{if(!lc())return cc();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=Ce.get(s),g=(m?.count??0)-1;g<=0?(Ce.delete(s),m?.target.isConnected&&m.target.id===s&&m.target.removeAttribute("id")):Ce.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},c=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=Ce.get(g);Ce.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 Ce.get(m.id)?.target===m&&u(m,m.id),m.id;let g;do Mn+=1,g=`bq-skip-target-${Mn}`;while(document.getElementById(g)!==null);return m.id=g,u(m,g),g},p=document.createElement("a"),f=h();return p.href=e.startsWith("#")?e:f?`#${d(f)}`:`#${e}`,p.textContent=r,p.className=n,p.setAttribute("style",qt),p.addEventListener("focus",()=>{p.setAttribute("style",qt+ac)}),p.addEventListener("blur",()=>{p.setAttribute("style",qt)}),p.addEventListener("click",m=>{m.preventDefault();const g=h();g&&(p.href=`#${d(g)}`,c(g),g.focus())}),document.body.firstChild?document.body.insertBefore(p,document.body.firstChild):document.body.appendChild(p),{destroy:()=>{l(),a(),p.remove()},element:p}},fc=["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(", "),xt=e=>Array.from(e.querySelectorAll(fc)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),Dn=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,dc=(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=xt(e);if(d.length===0){h.preventDefault();return}const p=d[0],f=d[d.length-1];h.shiftKey?(document.activeElement===p||!e.contains(document.activeElement))&&(h.preventDefault(),f.focus()):(document.activeElement===f||!e.contains(document.activeElement))&&(h.preventDefault(),p.focus())};document.addEventListener("keydown",l,!0);const c=Dn(s,e);if(c)c.focus();else{const h=xt(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=Dn(o,document.body);h?h.focus():i&&i.focus&&i.focus()}};return u},hc=e=>{e.release()},He=new Map,Nn=()=>{const e=Array.from(He.values());return e[e.length-1]},mc=(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)}},pc=(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,vc=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:o=!1,ghostClass:i="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:l,onDrag:c,onDragEnd:u}=t;let h=!t.disabled,d=!1,p={x:0,y:0},f={x:0,y:0},m={x:0,y:0},g=null,b=null;const v=e.style.touchAction,w=e.style.userSelect,E=O=>({element:e,position:{...f},delta:{x:f.x-m.x,y:f.y-m.y},event:O}),T=()=>{const O=e.cloneNode(!0),L=e.getBoundingClientRect();return O.classList.add(i),O.style.position="fixed",O.style.left=`${L.left}px`,O.style.top=`${L.top}px`,O.style.width=`${L.width}px`,O.style.height=`${L.height}px`,O.style.pointerEvents="none",O.style.zIndex="999999",O.style.opacity="0.7",O.style.margin="0",document.body.appendChild(O),O},A=()=>{g&&(g.remove(),g=null),b=null},S=O=>{if(h&&!(s&&!O.target.closest(s))){if(O.preventDefault(),d=!0,p={x:O.clientX,y:O.clientY},m={...f},e.classList.add(a),e.setPointerCapture(O.pointerId),o){const L=e.getBoundingClientRect();b={x:L.left,y:L.top},g=T()}He.set(e,{element:e,position:f}),l?.(E(O))}},C=O=>{if(!d)return;O.preventDefault(),m={...f};let L=f.x+(O.clientX-p.x),k=f.y+(O.clientY-p.y);p={x:O.clientX,y:O.clientY},r==="x"&&(k=f.y),r==="y"&&(L=f.x);let $={x:L,y:k};if(n){const D=mc(e,n);$=pc($,D)}if(f=$,He.set(e,{element:e,position:f}),o&&g){const D=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};g.style.left=`${D.x+f.x}px`,g.style.top=`${D.y+f.y}px`}else e.style.transform=`translate(${f.x}px, ${f.y}px)`;c?.(E(O))},R=O=>{if(d){d=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(O.pointerId))&&e.releasePointerCapture(O.pointerId)}catch{}finally{A(),He.delete(e),u?.(E(O))}}};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(),He.delete(e),e.style.touchAction=v,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{h=!1},enable:()=>{h=!0},get enabled(){return h}}},yc={passive:!0},Ue=new Set,Qe=null,re=null,Pn=()=>Array.from(Ue),gc=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",bc=e=>{for(const t of Pn())t.handlePointerMove(e)},wc=()=>{re=null;const e=Qe;Qe=null,e&&bc(e)},In=e=>{Qe=e,re===null&&(re=requestAnimationFrame(wc))},_n=e=>{re!==null&&(cancelAnimationFrame(re),re=null,Qe=null);for(const t of Pn())t.handlePointerUp(e)},Ec=e=>{Ue.size===0&&(document.addEventListener("pointermove",In,yc),document.addEventListener("pointerup",_n)),Ue.add(e)},Sc=e=>{Ue.delete(e),Ue.size===0&&(document.removeEventListener("pointermove",In),document.removeEventListener("pointerup",_n),re!==null&&(cancelAnimationFrame(re),re=null),Qe=null)},qn=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,Ac=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:o,onDragLeave:i,onDrop:a}=t;if(!gc())return{destroy:()=>{}};let l=!1,c=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=()=>Nn()?.element??c,p=(b,v=c)=>{l&&(l=!1,e.classList.remove(r),v&&i?.(u(v,b)),c=null)},g={handlePointerMove:b=>{const v=Nn()?.element??null,w=h(b);if(!(v!==null&&v!==e&&qn(v,n))||!w){p(b,v??c);return}l?o?.(u(v,b)):(l=!0,c=v,e.classList.add(r),s?.(u(v,b)))},handlePointerUp:b=>{const v=d(),w=h(b),E=v!==null&&v!==e&&qn(v,n);w&&E&&v&&a?.(u(v,b)),l&&(l=!1,e.classList.remove(r)),c=null}};return Ec(g),{destroy:()=>{Sc(g),e.classList.remove(r),c=null}}},xn=(e,t)=>Array.from(e.querySelectorAll(t)),Cc=(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},kc=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:o="bq-sort-placeholder",sortingClass:i="bq-sorting",animationDuration:a=200,onSortStart:l,onSortMove:c,onSortEnd:u}=t;let h=!t.disabled,d=!1,p=null,f=null,m=-1,g=0,b=0,v=0,w=0;const E=(R,O,L)=>({container:e,item:R,oldIndex:O,newIndex:L}),T=R=>{if(!h)return;const O=R.target,L=xn(e,r);let k=null;for(const D of L)if(D.contains(O)){k=D;break}if(!k||s&&!O.closest(s))return;R.preventDefault(),d=!0,p=k,m=L.indexOf(k),g=R.clientY,b=R.clientX;const $=k.getBoundingClientRect();v=$.top,w=$.left,f=document.createElement("div"),f.classList.add(o),f.style.width=`${$.width}px`,f.style.height=`${$.height}px`,f.style.boxSizing="border-box",k.classList.add(i),k.style.position="fixed",k.style.width=`${$.width}px`,k.style.height=`${$.height}px`,k.style.left=`${$.left}px`,k.style.top=`${$.top}px`,k.style.zIndex="999999",k.style.pointerEvents="none",k.style.margin="0",k.parentNode?.insertBefore(f,k),e.setPointerCapture(R.pointerId),l?.(E(k,m,m))},A=R=>{if(!d||!p||!f)return;R.preventDefault();const O=R.clientX-b,L=R.clientY-g;n==="y"?p.style.top=`${v+L}px`:p.style.left=`${w+O}px`;const k=Cc(xn(e,r),n==="y"?R.clientY:R.clientX,n,p);k?e.insertBefore(f,k.element):e.appendChild(f);const $=Array.from(e.children).indexOf(f);c?.(E(p,m,$))},S=R=>{if(!d||!p||!f)return;d=!1;const O=p,L=Array.from(e.children).indexOf(f),k=f.getBoundingClientRect(),$=O.getBoundingClientRect();if(a>0){const D=k.left-$.left,I=k.top-$.top;O.style.transition=`transform ${a}ms ease`,O.style.transform=`translate(${D}px, ${I}px)`;let z=!1,_=null;const Q=()=>{z||(z=!0,_!==null&&(window.clearTimeout(_),_=null),C(),u?.(E(O,m,L)))};_=window.setTimeout(()=>{Q()},a+50),O.addEventListener("transitionend",Q,{once:!0})}else C(),u?.(E(O,m,L));e.releasePointerCapture(R.pointerId)},C=()=>{!p||!f||(f.parentNode?.insertBefore(p,f),f.remove(),f=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",T),e.addEventListener("pointermove",A),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",T),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}}},Oc=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=H(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},Tc=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 c=H(a);let u=!1;Object.defineProperty(c,"destroy",{enumerable:!1,configurable:!0,value(){u||(u=!0,l?.(),a.dispose())}}),r.push(c.destroy),t[o]=c}let n=!1;const s=Object.defineProperty(t,"destroyAll",{enumerable:!1,configurable:!0,value(){n||(n=!0,r.forEach(o=>{o()}))}});return Object.prototype.hasOwnProperty.call(t,"destroy")||Object.defineProperty(s,"destroy",{enumerable:!1,configurable:!0,value:s.destroyAll}),s},jn=(e,t)=>t>=e?"portrait":"landscape",Lc=()=>{const e=M({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?jn(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:jn(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},zn=()=>{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}},$c=()=>{const e=M(zn());let t;if(typeof window<"u"){const s=()=>{e.value=zn()};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=H(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},Rc={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},Mc=()=>{const e=M({...Rc});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=H(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},Fn={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},Dc=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,o=M({...Fn});let i;if(typeof navigator<"u"&&"geolocation"in navigator){o.value={...Fn,supported:!0,loading:!0};const c={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,c);i=()=>{navigator.geolocation.clearWatch(d)}}else navigator.geolocation.getCurrentPosition(u,h,c)}const a=H(o);let l=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){l||(l=!0,i?.(),o.dispose())}}),a},Nc={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},Pc={alpha:null,beta:null,gamma:null,absolute:!1},Ic=()=>{const e=M({...Nc});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=H(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({...Pc});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=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},Bn="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",qc={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(Bn);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(Bn);return navigator.clipboard.writeText(e)}},xc=(e,t)=>{let r;t==="border-box"?r=e.borderBoxSize:t==="device-pixel-content-box"?r=e.devicePixelContentBoxSize:r=e.contentBoxSize;const n=Array.isArray(r)?r[0]:r;return n&&typeof n.inlineSize=="number"&&typeof n.blockSize=="number"?{width:n.inlineSize,height:n.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}},jc=(e,t)=>{const r=M({isIntersecting:!1,intersectionRatio:0,entry:null});let n,s=!1;if(typeof window<"u"&&typeof IntersectionObserver<"u")try{if(n=new IntersectionObserver(i=>{if(s)return;const a=i[i.length-1];a&&(r.value={isIntersecting:a.isIntersecting,intersectionRatio:a.intersectionRatio,entry:a})},{root:t?.root??null,rootMargin:t?.rootMargin??"0px",threshold:t?.threshold??0}),e){const i=Array.isArray(e)?e:[e];for(const a of i)n.observe(a)}}catch{n&&n.disconnect(),n=void 0}const o=H(r);return Object.defineProperties(o,{observe:{enumerable:!1,configurable:!0,value(i){if(!s)try{n?.observe(i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(i){s||n?.unobserve(i)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),o},zc=(e,t)=>{const r=M({width:0,height:0,entry:null});let n,s=!1;const o=t?.box??"content-box",i=t?.box?{box:t.box}:void 0;if(typeof window<"u"&&typeof ResizeObserver<"u")try{if(n=new ResizeObserver(l=>{if(s)return;const c=l[l.length-1];if(c){const{width:u,height:h}=xc(c,o);r.value={width:u,height:h,entry:c}}}),e){const l=Array.isArray(e)?e:[e];for(const c of l)n.observe(c,i)}}catch{n&&n.disconnect(),n=void 0}const a=H(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(l){s||n?.unobserve(l)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Fc=(e,t)=>{const r=M({mutations:[],count:0});let n,s=!1,o=0;const i={attributes:t?.attributes??!0,childList:t?.childList??!1,characterData:t?.characterData??!1,subtree:t?.subtree??!1,attributeOldValue:t?.attributeOldValue??!1,characterDataOldValue:t?.characterDataOldValue??!1,...t&&t.attributeFilter!==void 0?{attributeFilter:t.attributeFilter}:{}};if(!i.attributes&&!i.childList&&!i.characterData&&(i.attributes=!0),i.attributes||(i.attributeOldValue=!1,delete i.attributeFilter),i.characterData||(i.characterDataOldValue=!1),typeof window<"u"&&typeof MutationObserver<"u")try{n=new MutationObserver(l=>{s||(o+=1,r.value={mutations:l,count:o})}),e&&n.observe(e,i)}catch{n&&n.disconnect(),n=void 0}const a=H(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},takeRecords:{enumerable:!1,configurable:!0,value(){return n?.takeRecords()??[]}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Ve=new Set,ne=new Map,jt=()=>{El(e=>ne.get(e))};jt();var Hn=e=>{ne.clear();for(const[t,r]of e)ne.set(t,r)},Bc=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})}}),Hc=(e,t)=>{if(jt(),!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(Ve.has(e.name))return;const r=[],n=Bc(r),s=new Map(ne);try{e.install(n,t)}catch(o){throw Hn(s),o}try{for(const o of r)customElements.get(o.tagName)||customElements.define(o.tagName,o.constructor,o.options)}catch(o){throw Hn(s),o}Ve.add(e.name)},Uc=e=>Ve.has(e),Qc=()=>[...Ve],Vc=e=>ne.get(e),Wc=()=>[...ne.entries()].map(([e,t])=>({name:e,handler:t})),Kc=()=>{Ve.clear(),ne.clear(),jt()},We=!1,zt={},fe=[],ut=new Map,Un=0,Yc=(e,t)=>{We=e,zt=t??{},e||(fe.length=0,ut.clear(),Un=0)},Gc=()=>We,Jc=(e,t,r)=>{if(We){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");ut.set(e,{peek:t,subscriberCount:r})}},Xc=e=>{ut.delete(e)},Zc=()=>`signal_${Un++}`,Qn=()=>{const e=[];for(const[t,r]of ut)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},Vn=()=>{try{return Mt().map(e=>{const t=Se(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[]}},Wn=()=>{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},eu=(e,t)=>{if(!We)return;const r={timestamp:Date.now(),type:e,detail:t};fe.push(r),zt.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},tu=()=>fe,ru=()=>{fe.length=0},nu=()=>({enabled:We,options:{...zt},timeline:[...fe]}),su=()=>{const e=Qn();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},ou=()=>{const e=Vn();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)})))},iu=()=>{const e=Wn();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},au=e=>{const t=typeof e=="number"&&e>0?fe.slice(-e):fe;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})))},Kn=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),lu=(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},Yn=new Map,cu=e=>{const t=Rt(e),r=Yn.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return Yn.set(t,n),n};function uu(e,t={}){if(!e||!e.includes("-"))throw new Error(`bQuery testing: "${e}" is not a valid custom element tag name (must contain a hyphen)`);const{props:r,slots:n,container:s=document.body}=t,o=document.createElement(e);if(r)for(const[a,l]of Object.entries(r))l!=null&&o.setAttribute(a,String(l));if(n)if(typeof n=="string")o.innerHTML=n;else{const a=[];for(const[l,c]of Object.entries(n))if(l==="default")a.push(c);else{const u=l.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");a.push(`<div slot="${u}">${c}</div>`)}o.innerHTML=a.join("")}return s.appendChild(o),{el:o,unmount:()=>{o.parentNode&&o.parentNode.removeChild(o)}}}function Gn(){$e(()=>{})}function fu(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 du(e,t){let r=e;t&&r.startsWith(t)&&(r=r.slice(t.length)||"/");let n="";const s=r.indexOf("#");s>=0&&(n=r.slice(s+1),r=r.slice(0,s));const o={},i=r.indexOf("?");if(i>=0){const a=r.slice(i+1);r=r.slice(0,i);for(const l of a.split("&")){const c=l.indexOf("="),u=c>=0?decodeURIComponent(l.slice(0,c)):decodeURIComponent(l),h=c>=0?decodeURIComponent(l.slice(c+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 hu(e,t){for(const r of t){const n=mu(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function mu(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===":"&&Kn(e[o+1])){let u=o+2;for(;u<e.length&&Kn(e[u]);)u++;const h=e.slice(o+1,u);let d=u,p,f=!1;if(e[u]==="("){const g=lu(e,u);g&&(p=g.constraint,d=g.endIndex)}e[d]==="*"&&(f=!0,d++);const m=f||p?t.length:n(t,i);for(let g=m;g>i;g--){const b=t.slice(i,g);if(p&&!cu(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 c=s(o+1,i+1);return r.set(a,c),c};return s(0,0)}function pu(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=i=>{const{path:a,query:l,hash:c}=du(i,r),{matched:u,params:h}=hu(a,t);return{path:a,params:h,query:l,matched:u,hash:c}},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 vu(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 Gn(),l}async function yu(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 gu=(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 _t(e,t,s)},ft=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ft=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},Jn=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),bu=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Xn=(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??Mt(),i=Object.create(null);for(const u of o){if(x(u))continue;const h=Se(u);h&&(i[u]=Ft(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(!ft(u))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const l=Jn(a),c=Jn(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${bu(t)}">window[${c}]=${l}<\/script>`}},wu=(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(!ft(r))return{};for(const s of Object.values(r))if(!ft(s))return{};const n=Object.create(null);for(const[s,o]of Object.entries(r))x(s)||!ft(o)||(n[s]=Ft(o));return n},Zn=(e,t)=>{const r=Se(e);r&&typeof r.$patch=="function"&&r.$patch(Ft(t))},Eu=e=>{for(const[t,r]of Object.entries(e))Zn(t,r)},Su=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),es=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Au=e=>es(e).replace(/"/g,"&quot;"),Cu=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"},ku=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(),Ou=e=>{const t=ku(e);return Kt.some(r=>t.startsWith(r))},ts=e=>{if(e.nodeType===Node.TEXT_NODE)return es(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")||Cu(i)&&Ou(o.value)||(n+=` ${o.name}="${Au(o.value)}"`)}if(Su.has(r))return`<${r}${n}>`;let s="";for(const o of t.childNodes)s+=ts(o);return`<${r}${n}>${s}</${r}>`},rs=e=>le(e)||Ie(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=rs(s[o]):s=s[o]}return s}try{const n=Object.keys(t),s=n.map(o=>rs(t[o]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},Tu=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},Bt=(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 f of p){const m=f.indexOf(":");if(m>-1){const g=f.slice(0,m).trim().replace(/^['"]|['"]$/g,"");Y(f.slice(m+1).trim(),t)&&e.classList.add(g)}}}else{const p=Y(l,t);typeof p=="string"?p.split(/\s+/).filter(Boolean).forEach(f=>e.classList.add(f)):Array.isArray(p)&&p.filter(Boolean).forEach(f=>e.classList.add(f))}}const c=e.getAttribute(`${r}-style`);if(c!==null){const d=Y(c,t);if(d&&typeof d=="object"){const p=e;for(const[f,m]of Object.entries(d)){const g=f.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),f=Y(d.value,t);f===!1||f===null||f===void 0?e.removeAttribute(p):f===!0?e.setAttribute(p,""):e.setAttribute(p,String(f))}const h=e.getAttribute(`${r}-for`);if(h!==null){const d=Tu(h);if(d){const p=Y(d.listExpr,t);if(Array.isArray(p)&&e.parentNode){const f=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),Bt(b,v,r,n),Ht(b,v,r,n),f.insertBefore(b,e)}return f.removeChild(e),!0}}}return!0},Ht=(e,t,r,n)=>{const s=Array.from(e.children);for(const o of s){if(o.hasAttribute(`${r}-for`)){Bt(o,t,r,n)||o.remove();continue}if(!Bt(o,t,r,n)){o.remove();continue}Ht(o,t,r,n)}},ns=(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))ns(n,t)},Lu=(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(Ht(a,t,n,i),s)for(const u of Array.from(a.children))ns(u,n);let l="";for(const u of a.childNodes)l+=ts(u);let c;return o&&(c=Xn({storeIds:Array.isArray(o)?o:void 0}).stateJson),{html:l,storeState:c}};y.$=Rs,y.$$=Ms,y.BQueryCollection=Ze,y.BQueryElement=ve,y.BqLinkElement=rn,y.Computed=Ne,y.HttpError=oe,y.Signal=Pe,y.animate=st,y.announceToScreenReader=Yl,y.auditA11y=nc,y.back=fa,y.batch=$e,y.bool=Si,y.breakpoints=Tc,y.buckets=Wi,y.cache=Yi,y.capturePosition=Tt,y.clearAnnouncements=Gl,y.clearTimeline=ru,y.clipboard=qc,y.component=ge,y.computed=P,y.createForm=Tl,y.createHttp=bt,y.createI18n=Vl,y.createPersistedStore=Za,y.createRequestQueue=Yo,y.createRestClient=ni,y.createRouter=Na,y.createStore=Dt,y.createTemplate=Al,y.createTrustedHtml=Ss,y.createUseFetch=Io,y.currentRoute=Xr,y.custom=Fl,y.customAsync=Bl,y.deduplicateRequest=oi,y.defineBqueryConfig=mo,y.defineComponent=gi,y.definePageMeta=sa,y.defineStore=Qa,y.deserializeStoreState=wu,y.destroyStore=Ha,y.draggable=vc,y.droppable=Ac,y.easeInCubic=zr,y.easeInOutCubic=Br,y.easeInOutQuad=jr,y.easeInQuad=qr,y.easeOutBack=Hr,y.easeOutCubic=Fr,y.easeOutExpo=Ur,y.easeOutQuad=xr,y.easingPresets=$i,y.effect=j,y.effectScope=go,y.email=ql,y.enableDevtools=Yc,y.escapeHtml=nr,y.fireEvent=vu,y.flip=Lt,y.flipElements=Qr,y.flipList=Ri,y.flushEffects=Gn,y.formatDate=kn,y.formatNumber=Cn,y.forward=da,y.generateNonce=bs,y.generateSignalLabel=Zc,y.getBqueryConfig=X,y.getCurrentScope=pr,y.getCustomDirective=Vc,y.getCustomDirectives=Wc,y.getDevtoolsState=nu,y.getFocusableElements=xt,y.getInstalledPlugins=Qc,y.getStore=Se,y.getTimeline=tu,y.getTrustedTypesPolicy=rr,y.hasCSPDirective=ws,y.html=be,y.http=Ko,y.hydrateMount=gu,y.hydrateStore=Zn,y.hydrateStores=Eu,y.inspectComponents=Wn,y.inspectSignals=Qn,y.inspectStores=Vn,y.interceptLinks=ga,y.isActive=$a,y.isActiveSignal=Ra,y.isComputed=Ie,y.isDevtoolsEnabled=Gc,y.isInstalled=Uc,y.isNavigating=ca,y.isSignal=le,y.isTrustedTypesSupported=Es,y.keyframePresets=Mi,y.linear=_r,y.link=ya,y.linkedSignal=Go,y.listStores=Mt,y.logComponents=iu,y.logSignals=su,y.logStores=ou,y.logTimeline=au,y.mapActions=Ka,y.mapGetters=Wa,y.mapState=Va,y.matchField=Hl,y.max=zl,y.maxLength=Il,y.mediaQuery=Oc,y.min=jl,y.minLength=Pl,y.mockRouter=pu,y.mockSignal=fu,y.morphElement=Di,y.mount=_t,y.navigate=xe,y.notifications=ta,y.onScopeDispose=vr,y.parallax=Ni,y.pattern=_l,y.persistedSignal=Zo,y.prefersColorScheme=sc,y.prefersContrast=oc,y.prefersReducedMotion=Z,y.readonly=H,y.recordEvent=eu,y.registerBqLink=va,y.registerDefaultComponents=Ti,y.registerPlugin=za,y.releaseFocus=hc,y.renderComponent=uu,y.renderToString=Lu,y.required=Nl,y.resetPlugins=Kc,y.resolve=La,y.rovingTabIndex=ic,y.safeHtml=Ai,y.sanitize=J,y.sanitizeHtml=J,y.scrollAnimate=Ii,y.sequence=Bi,y.serializeStoreState=Xn,y.setReducedMotion=Li,y.signal=M,y.skipLink=uc,y.sortable=kc,y.spring=qi,y.springPresets=xi,y.stagger=ji,y.storage=la,y.stripTags=As,y.timeline=Hi,y.toValue=ii,y.trackSignal=Jc,y.transition=Ui,y.trapFocus=dc,y.trusted=vs,y.typewriter=Qi,y.untrack=ae,y.untrackSignal=Xc,y.url=xl,y.use=Hc,y.useAnnouncer=na,y.useAsyncData=gr,y.useBattery=Mc,y.useComputed=mi,y.useCookie=ea,y.useDeviceMotion=Ic,y.useDeviceOrientation=_c,y.useEffect=pi,y.useEventSource=fi,y.useFetch=W,y.useFormField=Rl,y.useGeolocation=Dc,y.useInfiniteFetch=Xo,y.useIntersectionObserver=jc,y.useMutationObserver=Fc,y.useNetworkStatus=$c,y.usePaginatedFetch=Jo,y.usePolling=ei,y.useResizeObserver=zc,y.useResource=ti,y.useResourceList=si,y.useRoute=Ia,y.useSignal=hi,y.useSubmit=ri,y.useViewport=Lc,y.useWebSocket=Tr,y.useWebSocketChannel=ui,y.utils=lo,y.waitFor=yu,y.watch=Et,y.watchDebounce=ai,y.watchStore=el,y.watchThrottle=li});
275
+ `,Eo=0,ze=new Map,ed=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,td=()=>({destroy:()=>{},element:null}),rd=(e,t={})=>{if(!ed())return td();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=ze.get(s),v=(m?.count??0)-1;v<=0?(ze.delete(s),m?.target.isConnected&&m.target.id===s&&m.target.removeAttribute("id")):ze.set(s,{count:v,target:m.target}),s=void 0},c=()=>{if(!o)return;const{target:m,hadTabIndex:v,previousTabIndex:b}=o;m.isConnected&&(v?m.setAttribute("tabindex",b??""):m.removeAttribute("tabindex")),o=void 0},l=m=>{if(o?.target!==m){if(c(),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,v)=>{if(s===v)return;a();const b=ze.get(v);ze.set(v,{count:(b?.count??0)+1,target:m}),s=v},h=()=>{if(e.startsWith("#")){const v=e.slice(1),b=v?document.getElementById(v):null;return b||i(e)}const m=document.getElementById(e);return m||i(e)},d=m=>{if(m.id)return ze.get(m.id)?.target===m&&u(m,m.id),m.id;let v;do Eo+=1,v=`bq-skip-target-${Eo}`;while(document.getElementById(v)!==null);return m.id=v,u(m,v),v},p=document.createElement("a"),f=h();return p.href=e.startsWith("#")?e:f?`#${d(f)}`:`#${e}`,p.textContent=r,p.className=n,p.setAttribute("style",_r),p.addEventListener("focus",()=>{p.setAttribute("style",_r+Zf)}),p.addEventListener("blur",()=>{p.setAttribute("style",_r)}),p.addEventListener("click",m=>{m.preventDefault();const v=h();v&&(p.href=`#${d(v)}`,l(v),v.focus())}),document.body.firstChild?document.body.insertBefore(p,document.body.firstChild):document.body.appendChild(p),{destroy:()=>{c(),a(),p.remove()},element:p}},nd=["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(", "),xr=e=>Array.from(e.querySelectorAll(nd)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),Ao=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,sd=(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 c=h=>{if(!a)return;if(h.key==="Escape"&&r){h.preventDefault(),u.release(),n?.();return}if(h.key!=="Tab")return;const d=xr(e);if(d.length===0){h.preventDefault();return}const p=d[0],f=d[d.length-1];h.shiftKey?(document.activeElement===p||!e.contains(document.activeElement))&&(h.preventDefault(),f.focus()):(document.activeElement===f||!e.contains(document.activeElement))&&(h.preventDefault(),p.focus())};document.addEventListener("keydown",c,!0);const l=Ao(s,e);if(l)l.focus();else{const h=xr(e);h.length>0&&h[0].focus()}const u={get active(){return a},release:()=>{if(!a)return;a=!1,document.removeEventListener("keydown",c,!0);const h=Ao(o,document.body);h?h.focus():i&&i.focus&&i.focus()}};return u},od=e=>{e.release()},ct=new Map,ko=()=>{const e=Array.from(ct.values());return e[e.length-1]},id=(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,c=Number.isNaN(i)?0:i;return{left:n.left-s.left+a,top:n.top-s.top+c,right:n.right-s.right+a+(n.width-s.width),bottom:n.bottom-s.bottom+c+(n.height-s.height)}},ad=(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,cd=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:o=!1,ghostClass:i="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:c,onDrag:l,onDragEnd:u}=t;let h=!t.disabled,d=!1,p={x:0,y:0},f={x:0,y:0},m={x:0,y:0},v=null,b=null;const g=e.style.touchAction,w=e.style.userSelect,S=C=>({element:e,position:{...f},delta:{x:f.x-m.x,y:f.y-m.y},event:C}),k=()=>{const C=e.cloneNode(!0),$=e.getBoundingClientRect();return C.classList.add(i),C.style.position="fixed",C.style.left=`${$.left}px`,C.style.top=`${$.top}px`,C.style.width=`${$.width}px`,C.style.height=`${$.height}px`,C.style.pointerEvents="none",C.style.zIndex="999999",C.style.opacity="0.7",C.style.margin="0",document.body.appendChild(C),C},A=()=>{v&&(v.remove(),v=null),b=null},E=C=>{if(h&&!(s&&!C.target.closest(s))){if(C.preventDefault(),d=!0,p={x:C.clientX,y:C.clientY},m={...f},e.classList.add(a),e.setPointerCapture(C.pointerId),o){const $=e.getBoundingClientRect();b={x:$.left,y:$.top},v=k()}ct.set(e,{element:e,position:f}),c?.(S(C))}},T=C=>{if(!d)return;C.preventDefault(),m={...f};let $=f.x+(C.clientX-p.x),R=f.y+(C.clientY-p.y);p={x:C.clientX,y:C.clientY},r==="x"&&(R=f.y),r==="y"&&($=f.x);let O={x:$,y:R};if(n){const I=id(e,n);O=ad(O,I)}if(f=O,ct.set(e,{element:e,position:f}),o&&v){const I=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};v.style.left=`${I.x+f.x}px`,v.style.top=`${I.y+f.y}px`}else e.style.transform=`translate(${f.x}px, ${f.y}px)`;l?.(S(C))},P=C=>{if(d){d=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(C.pointerId))&&e.releasePointerCapture(C.pointerId)}catch{}finally{A(),ct.delete(e),u?.(S(C))}}};return e.addEventListener("pointerdown",E),e.addEventListener("pointermove",T),e.addEventListener("pointerup",P),e.addEventListener("pointercancel",P),e.style.touchAction="none",e.style.userSelect="none",{destroy:()=>{e.removeEventListener("pointerdown",E),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",P),e.removeEventListener("pointercancel",P),A(),ct.delete(e),e.style.touchAction=g,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{h=!1},enable:()=>{h=!0},get enabled(){return h}}},ld={passive:!0},lt=new Set,ut=null,de=null,To=()=>Array.from(lt),ud=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",fd=e=>{for(const t of To())t.handlePointerMove(e)},dd=()=>{de=null;const e=ut;ut=null,e&&fd(e)},Ro=e=>{ut=e,de===null&&(de=requestAnimationFrame(dd))},Co=e=>{de!==null&&(cancelAnimationFrame(de),de=null,ut=null);for(const t of To())t.handlePointerUp(e)},hd=e=>{lt.size===0&&(document.addEventListener("pointermove",Ro,ld),document.addEventListener("pointerup",Co)),lt.add(e)},md=e=>{lt.delete(e),lt.size===0&&(document.removeEventListener("pointermove",Ro),document.removeEventListener("pointerup",Co),de!==null&&(cancelAnimationFrame(de),de=null),ut=null)},$o=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,pd=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:o,onDragLeave:i,onDrop:a}=t;if(!ud())return{destroy:()=>{}};let c=!1,l=null;const u=(b,g)=>({zone:e,dragged:b,event:g}),h=b=>{const g=e.getBoundingClientRect();return b.clientX>=g.left&&b.clientX<=g.right&&b.clientY>=g.top&&b.clientY<=g.bottom},d=()=>ko()?.element??l,p=(b,g=l)=>{c&&(c=!1,e.classList.remove(r),g&&i?.(u(g,b)),l=null)},v={handlePointerMove:b=>{const g=ko()?.element??null,w=h(b);if(!(g!==null&&g!==e&&$o(g,n))||!w){p(b,g??l);return}c?o?.(u(g,b)):(c=!0,l=g,e.classList.add(r),s?.(u(g,b)))},handlePointerUp:b=>{const g=d(),w=h(b),S=g!==null&&g!==e&&$o(g,n);w&&S&&g&&a?.(u(g,b)),c&&(c=!1,e.classList.remove(r)),l=null}};return hd(v),{destroy:()=>{md(v),e.classList.remove(r),l=null}}},Oo=(e,t)=>Array.from(e.querySelectorAll(t)),vd=(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(),c=t-(r==="y"?a.top+a.height/2:a.left+a.width/2);(s===null||c<0&&c>s.distance||s.distance>=0&&c<0&&Math.abs(c)<Math.abs(s.distance))&&c<0&&(s={element:i,index:o,distance:c})}return s?{element:s.element,index:s.index}:null},yd=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:o="bq-sort-placeholder",sortingClass:i="bq-sorting",animationDuration:a=200,onSortStart:c,onSortMove:l,onSortEnd:u}=t;let h=!t.disabled,d=!1,p=null,f=null,m=-1,v=0,b=0,g=0,w=0;const S=(P,C,$)=>({container:e,item:P,oldIndex:C,newIndex:$}),k=P=>{if(!h)return;const C=P.target,$=Oo(e,r);let R=null;for(const I of $)if(I.contains(C)){R=I;break}if(!R||s&&!C.closest(s))return;P.preventDefault(),d=!0,p=R,m=$.indexOf(R),v=P.clientY,b=P.clientX;const O=R.getBoundingClientRect();g=O.top,w=O.left,f=document.createElement("div"),f.classList.add(o),f.style.width=`${O.width}px`,f.style.height=`${O.height}px`,f.style.boxSizing="border-box",R.classList.add(i),R.style.position="fixed",R.style.width=`${O.width}px`,R.style.height=`${O.height}px`,R.style.left=`${O.left}px`,R.style.top=`${O.top}px`,R.style.zIndex="999999",R.style.pointerEvents="none",R.style.margin="0",R.parentNode?.insertBefore(f,R),e.setPointerCapture(P.pointerId),c?.(S(R,m,m))},A=P=>{if(!d||!p||!f)return;P.preventDefault();const C=P.clientX-b,$=P.clientY-v;n==="y"?p.style.top=`${g+$}px`:p.style.left=`${w+C}px`;const R=vd(Oo(e,r),n==="y"?P.clientY:P.clientX,n,p);R?e.insertBefore(f,R.element):e.appendChild(f);const O=Array.from(e.children).indexOf(f);l?.(S(p,m,O))},E=P=>{if(!d||!p||!f)return;d=!1;const C=p,$=Array.from(e.children).indexOf(f),R=f.getBoundingClientRect(),O=C.getBoundingClientRect();if(a>0){const I=R.left-O.left,x=R.top-O.top;C.style.transition=`transform ${a}ms ease`,C.style.transform=`translate(${I}px, ${x}px)`;let W=!1,q=null;const V=()=>{W||(W=!0,q!==null&&(window.clearTimeout(q),q=null),T(),u?.(S(C,m,$)))};q=window.setTimeout(()=>{V()},a+50),C.addEventListener("transitionend",V,{once:!0})}else T(),u?.(S(C,m,$));e.releasePointerCapture(P.pointerId)},T=()=>{!p||!f||(f.parentNode?.insertBefore(p,f),f.remove(),f=null,p.classList.remove(i),p.style.position="",p.style.width="",p.style.height="",p.style.left="",p.style.top="",p.style.zIndex="",p.style.pointerEvents="",p.style.margin="",p.style.transition="",p.style.transform="",p=null)};return e.addEventListener("pointerdown",k),e.addEventListener("pointermove",A),e.addEventListener("pointerup",E),e.addEventListener("pointercancel",E),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",k),e.removeEventListener("pointermove",A),e.removeEventListener("pointerup",E),e.removeEventListener("pointercancel",E),e.style.touchAction="",d&&T()},disable:()=>{h=!1},enable:()=>{h=!0},get enabled(){return h}}},gd=e=>{const t=L(!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=_(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},bd=e=>{const t={},r=[];for(const o of Object.keys(e)){const i=e[o],a=L(!1);let c;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),c=()=>{h.removeEventListener("change",d)};else{const p=h;typeof p.addListener=="function"&&(p.addListener(d),c=()=>{p.removeListener?.(d)})}}catch{}const l=_(a);let u=!1;Object.defineProperty(l,"destroy",{enumerable:!1,configurable:!0,value(){u||(u=!0,c?.(),a.dispose())}}),r.push(l.destroy),t[o]=l}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},Lo=(e,t)=>t>=e?"portrait":"landscape",wd=()=>{const e=L({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?Lo(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:Lo(window.innerWidth,window.innerHeight)}};window.addEventListener("resize",s),t=()=>{window.removeEventListener("resize",s)}}const r=_(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value:()=>{n||(n=!0,t?.(),e.dispose())}}),r},Po=()=>{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}},Sd=()=>{const e=L(Po());let t;if(typeof window<"u"){const s=()=>{e.value=Po()};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=_(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},Ed={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},Ad=()=>{const e=L({...Ed});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=_(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},No={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},kd=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,o=L({...No});let i;if(typeof navigator<"u"&&"geolocation"in navigator){o.value={...No,supported:!0,loading:!0};const l={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,l);i=()=>{navigator.geolocation.clearWatch(d)}}else navigator.geolocation.getCurrentPosition(u,h,l)}const a=_(o);let c=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){c||(c=!0,i?.(),o.dispose())}}),a},Td={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},Rd={alpha:null,beta:null,gamma:null,absolute:!1},Cd=()=>{const e=L({...Td});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=_(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},$d=()=>{const e=L({...Rd});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=_(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},Io="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",Od={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(Io);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(Io);return navigator.clipboard.writeText(e)}},Ld=(e,t)=>{let r;t==="border-box"?r=e.borderBoxSize:t==="device-pixel-content-box"?r=e.devicePixelContentBoxSize:r=e.contentBoxSize;const n=Array.isArray(r)?r[0]:r;return n&&typeof n.inlineSize=="number"&&typeof n.blockSize=="number"?{width:n.inlineSize,height:n.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}},Pd=(e,t)=>{const r=L({isIntersecting:!1,intersectionRatio:0,entry:null});let n,s=!1;if(typeof window<"u"&&typeof IntersectionObserver<"u")try{if(n=new IntersectionObserver(i=>{if(s)return;const a=i[i.length-1];a&&(r.value={isIntersecting:a.isIntersecting,intersectionRatio:a.intersectionRatio,entry:a})},{root:t?.root??null,rootMargin:t?.rootMargin??"0px",threshold:t?.threshold??0}),e){const i=Array.isArray(e)?e:[e];for(const a of i)n.observe(a)}}catch{n&&n.disconnect(),n=void 0}const o=_(r);return Object.defineProperties(o,{observe:{enumerable:!1,configurable:!0,value(i){if(!s)try{n?.observe(i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(i){s||n?.unobserve(i)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),o},Nd=(e,t)=>{const r=L({width:0,height:0,entry:null});let n,s=!1;const o=t?.box??"content-box",i=t?.box?{box:t.box}:void 0;if(typeof window<"u"&&typeof ResizeObserver<"u")try{if(n=new ResizeObserver(c=>{if(s)return;const l=c[c.length-1];if(l){const{width:u,height:h}=Ld(l,o);r.value={width:u,height:h,entry:l}}}),e){const c=Array.isArray(e)?e:[e];for(const l of c)n.observe(l,i)}}catch{n&&n.disconnect(),n=void 0}const a=_(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(c){if(!s)try{n?.observe(c,i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(c){s||n?.unobserve(c)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Id=(e,t)=>{const r=L({mutations:[],count:0});let n,s=!1,o=0;const i={attributes:t?.attributes??!0,childList:t?.childList??!1,characterData:t?.characterData??!1,subtree:t?.subtree??!1,attributeOldValue:t?.attributeOldValue??!1,characterDataOldValue:t?.characterDataOldValue??!1,...t&&t.attributeFilter!==void 0?{attributeFilter:t.attributeFilter}:{}};if(!i.attributes&&!i.childList&&!i.characterData&&(i.attributes=!0),i.attributes||(i.attributeOldValue=!1,delete i.attributeFilter),i.characterData||(i.characterDataOldValue=!1),typeof window<"u"&&typeof MutationObserver<"u")try{n=new MutationObserver(c=>{s||(o+=1,r.value={mutations:c,count:o})}),e&&n.observe(e,i)}catch{n&&n.disconnect(),n=void 0}const a=_(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(c){if(!s)try{n?.observe(c,i)}catch{}}},takeRecords:{enumerable:!1,configurable:!0,value(){return n?.takeRecords()??[]}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},ft=new Set,he=new Map,qr=()=>{hf(e=>he.get(e))};qr();var Mo=e=>{he.clear();for(const[t,r]of e)he.set(t,r)},Md=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(he.has(t))throw new Error(`bQuery plugin directive: a directive named "${t}" is already registered`);he.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})}}),Dd=(e,t)=>{if(qr(),!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(ft.has(e.name))return;const r=[],n=Md(r),s=new Map(he);try{e.install(n,t)}catch(o){throw Mo(s),o}try{for(const o of r)customElements.get(o.tagName)||customElements.define(o.tagName,o.constructor,o.options)}catch(o){throw Mo(s),o}ft.add(e.name)},_d=e=>ft.has(e),xd=()=>[...ft],qd=e=>he.get(e),zd=()=>[...he.entries()].map(([e,t])=>({name:e,handler:t})),jd=()=>{ft.clear(),he.clear(),qr()},dt=!1,zr={},Re=[],Vt=new Map,Do=0,Ud=(e,t)=>{dt=e,zr=t??{},e||(Re.length=0,Vt.clear(),Do=0)},Hd=()=>dt,Wd=(e,t,r)=>{if(dt){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");Vt.set(e,{peek:t,subscriberCount:r})}},Fd=e=>{Vt.delete(e)},Bd=()=>`signal_${Do++}`,_o=()=>{const e=[];for(const[t,r]of Vt)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},xo=()=>{try{return Wt().map(e=>{const t=we(e),r={};if(t&&typeof t=="object"&&"$state"in t){const n=t.$state;n&&typeof n=="object"&&Object.assign(r,n)}return{id:e,state:r}})}catch{return[]}},qo=()=>{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},Qd=(e,t)=>{if(!dt)return;const r={timestamp:Date.now(),type:e,detail:t};Re.push(r),zr.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},Vd=()=>Re,Kd=()=>{Re.length=0},Yd=()=>({enabled:dt,options:{...zr},timeline:[...Re]}),Jd=()=>{const e=_o();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},Gd=()=>{const e=xo();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)})))},Xd=()=>{const e=qo();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},Zd=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})))},zo=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),eh=(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},jo=new Map,th=e=>{const t=Lr(e),r=jo.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return jo.set(t,n),n};function rh(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,c]of Object.entries(r))c!=null&&o.setAttribute(a,String(c));if(n)if(typeof n=="string")o.innerHTML=n;else{const a=[];for(const[c,l]of Object.entries(n))if(c==="default")a.push(l);else{const u=c.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");a.push(`<div slot="${u}">${l}</div>`)}o.innerHTML=a.join("")}return s.appendChild(o),{el:o,unmount:()=>{o.parentNode&&o.parentNode.removeChild(o)}}}function Uo(){Se(()=>{})}function nh(e){const t=L(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 sh(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 c of a.split("&")){const l=c.indexOf("="),u=l>=0?decodeURIComponent(c.slice(0,l)):decodeURIComponent(c),h=l>=0?decodeURIComponent(c.slice(l+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 oh(e,t){for(const r of t){const n=ih(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function ih(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 c=e[o];if(c==="*"){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(c===":"&&zo(e[o+1])){let u=o+2;for(;u<e.length&&zo(e[u]);)u++;const h=e.slice(o+1,u);let d=u,p,f=!1;if(e[u]==="("){const v=eh(e,u);v&&(p=v.constraint,d=v.endIndex)}e[d]==="*"&&(f=!0,d++);const m=f||p?t.length:n(t,i);for(let v=m;v>i;v--){const b=t.slice(i,v);if(p&&!th(p).test(b))continue;const g=s(d,v);if(g){const w={[h]:b,...g};return r.set(a,w),w}}return r.set(a,null),null}if(i>=t.length||c!==t[i])return r.set(a,null),null;const l=s(o+1,i+1);return r.set(a,l),l};return s(0,0)}function ah(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=i=>{const{path:a,query:c,hash:l}=sh(i,r),{matched:u,params:h}=oh(a,t);return{path:a,params:h,query:c,matched:u,hash:l}},o=L(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 ch(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 c=e.dispatchEvent(a);return Uo(),c}async function lh(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 Ho=(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 Dr(e,t,s)},me={backend:"auto",documentImpl:null},uh=e=>{e.backend!==void 0&&(me.backend=e.backend),e.documentImpl!==void 0&&(me.documentImpl=e.documentImpl)},fh=()=>({backend:me.backend,documentImpl:me.documentImpl}),dh=()=>me.backend==="pure"?"pure":me.backend==="dom"||me.documentImpl||typeof globalThis.DOMParser=="function"?"dom":"pure",hh=()=>me.documentImpl?me.documentImpl.DOMParser:typeof globalThis.DOMParser=="function"?globalThis.DOMParser:null,jr=e=>{let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)|0;return(t>>>0).toString(36)},Kt="data-bq-h",mh=(e,t,r)=>{const n=[];for(const s of e)s!=="data-bq-h"&&(s.startsWith(`${r}-`)||s.startsWith(":"))&&n.push(`${s}=${t[s]??""}`);return n.join("|")},Wo=(e,t)=>{const r=[];for(const n of Array.from(e.attributes))n.name!=="data-bq-h"&&(n.name.startsWith(`${t}-`)||n.name.startsWith(":"))&&r.push(`${n.name}=${n.value}`);return r.join("|")},ph=e=>G(e)||ce(e)?e.value:e,vh=["===","!==","==","!=","<=",">=","&&","||","??","?."],yh="+-*/%<>!?:,.()[]",Fo=e=>e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$",gh=e=>Fo(e)||e>="0"&&e<="9",Ur=e=>e>="0"&&e<="9",bh=e=>{const t=[],r=e.length;let n=0;for(;n<r;){const s=e[n];if(s===" "||s===" "||s===`
276
+ `||s==="\r"){n++;continue}if(s==='"'||s==="'"){const i=s,a=n;n++;let c="";for(;n<r&&e[n]!==i;){if(e[n]==="\\"&&n+1<r){const l=e[n+1];l==="n"?c+=`
277
+ `:l==="t"?c+=" ":l==="r"?c+="\r":l==="\\"?c+="\\":l===i?c+=i:c+=l,n+=2;continue}c+=e[n],n++}if(n>=r)throw new Error("Unterminated string literal in SSR expression");n++,t.push({kind:"string",value:c,start:a});continue}if(Ur(s)||s==="."&&n+1<r&&Ur(e[n+1])){const i=n;for(;n<r&&(Ur(e[n])||e[n]===".");)n++;t.push({kind:"number",value:e.slice(i,n),start:i});continue}if(Fo(s)){const i=n;for(;n<r&&gh(e[n]);)n++;t.push({kind:"ident",value:e.slice(i,n),start:i});continue}let o=!1;for(const i of vh)if(e.startsWith(i,n)){t.push({kind:"punct",value:i,start:n}),n+=i.length,o=!0;break}if(!o){if(yh.includes(s)){t.push({kind:"punct",value:s,start:n}),n++;continue}throw new Error(`Unexpected character "${s}" in SSR expression`)}}return t.push({kind:"eof",value:"",start:r}),t},Y=e=>e.tokens[e.pos],je=e=>e.tokens[e.pos++],K=(e,t)=>{const r=Y(e);if(r.kind!=="punct"||r.value!==t)throw new Error(`Expected "${t}" in SSR expression, got "${r.value}"`);e.pos++},Yt=(e,t)=>{const r=Y(e);return r.kind==="punct"&&r.value===t?(e.pos++,!0):!1},Jt=(e,t,r)=>{K(e,t);const n=[t];for(;n.length>0;){const s=je(e);if(!s||s.kind==="eof")throw new Error(`Unterminated "${t}${r}" group in SSR expression`);if(s.kind==="punct"){if(s.value==="("||s.value==="["){n.push(s.value);continue}if(s.value===")"||s.value==="]"){const o=n[n.length-1],i=o==="("?")":"]";if(s.value!==i)throw new Error(`Mismatched "${o}${i}" group in SSR expression`);n.pop()}}}},Hr=e=>{const t=Y(e);if(t.kind==="punct"&&t.value==="["){Jt(e,"[","]");return}if(t.kind==="punct"&&t.value==="("){Jt(e,"(",")");return}if(t.kind==="ident"){e.pos++;return}throw new Error("Invalid optional chain in SSR expression")},wh=e=>{for(;;){const t=Y(e);if(t.kind!=="punct")break;if(t.value==="."){if(e.pos++,je(e).kind!=="ident")throw new Error('Expected identifier after "."');continue}if(t.value==="["){Jt(e,"[","]");continue}if(t.value==="("){Jt(e,"(",")");continue}if(t.value==="?."){e.pos++,Hr(e);continue}break}},Sh=e=>{const t=je(e);if(!t||t.kind==="eof")throw new Error("Unexpected end of SSR expression");if(!(t.kind==="number"||t.kind==="string"||t.kind==="ident")){if(t.kind==="punct"&&t.value==="("){X(e,0),K(e,")");return}throw new Error(`Unexpected token "${t.value}" in SSR expression`)}},Eh=e=>{if(K(e,"("),!Yt(e,")")){for(;;)if(X(e,0),!Yt(e,",")){K(e,")");break}}},Ah=e=>{for(Sh(e);;){const t=Y(e);if(t.kind!=="punct")break;if(t.value==="."){if(e.pos++,je(e).kind!=="ident")throw new Error('Expected identifier after "."');continue}if(t.value==="?."){e.pos++,Hr(e);continue}if(t.value==="["){e.pos++,X(e,0),K(e,"]");continue}if(t.value==="("){Eh(e);continue}break}},Wr=e=>{const t=Y(e);if(t.kind==="punct"&&(t.value==="!"||t.value==="-"||t.value==="+")){e.pos++,Wr(e);return}if(t.kind==="ident"&&t.value==="typeof"){e.pos++,Wr(e);return}Ah(e)},X=(e,t=0)=>{for(Wr(e);;){const r=Y(e);if(r.kind!=="punct")break;if(r.value==="?"&&t<=0){e.pos++,X(e,0),K(e,":"),X(e,0);continue}const n=Bo[r.value];if(n===void 0||n<t)break;e.pos++,X(e,n+1)}},kh=(e,t)=>{if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;if(t!=="undefined"&&!N(t))return ph(e.context[t])},Gt=(e,t)=>{if(e!=null&&!(typeof t=="string"&&N(t)))return e[t]},Bo={"||":1,"??":1,"&&":2,"==":3,"!=":3,"===":3,"!==":3,"<":4,"<=":4,">":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6},Z=(e,t=0)=>{let r=ht(e);for(;;){const n=Y(e);if(n.kind!=="punct")break;if(n.value==="?"&&t<=0){if(e.pos++,r){const i=Z(e,0);K(e,":"),X(e,0),r=i}else X(e,0),K(e,":"),r=Z(e,0);continue}const s=Bo[n.value];if(s===void 0||s<t)break;if(e.pos++,n.value==="&&"){r?r=Z(e,s+1):X(e,s+1);continue}if(n.value==="||"){r?X(e,s+1):r=Z(e,s+1);continue}if(n.value==="??"){r!=null?X(e,s+1):r=Z(e,s+1);continue}const o=Z(e,s+1);r=Th(n.value,r,o)}return r},Th=(e,t,r)=>{switch(e){case"||":return t||r;case"&&":return t&&r;case"??":return t??r;case"==":return t==r;case"!=":return t!=r;case"===":return t===r;case"!==":return t!==r;case"<":return t<r;case"<=":return t<=r;case">":return t>r;case">=":return t>=r;case"+":return typeof t=="string"||typeof r=="string"?String(t??"")+String(r??""):t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;default:throw new Error(`Unsupported binary operator "${e}"`)}},ht=e=>{const t=Y(e);if(t.kind==="punct"){if(t.value==="!")return e.pos++,!ht(e);if(t.value==="-")return e.pos++,-ht(e);if(t.value==="+")return e.pos++,+ht(e)}return t.kind==="ident"&&t.value==="typeof"?(e.pos++,typeof ht(e)):Rh(e)},Rh=e=>{let t=Ch(e),r;for(;;){const n=Y(e);if(n.kind!=="punct")break;if(n.value==="."){e.pos++;const s=je(e);if(s.kind!=="ident")throw new Error('Expected identifier after "."');r=t,t=Gt(t,s.value);continue}if(n.value==="?."){if(e.pos++,t==null){Hr(e),wh(e),t=void 0,r=void 0;continue}const s=Y(e);if(s.kind==="punct"&&s.value==="["){e.pos++;const o=t,i=Z(e,0);K(e,"]"),r=o,t=Gt(t,i)}else if(s.kind==="punct"&&s.value==="(")t=Qo(e,t,r),r=void 0;else if(s.kind==="ident")e.pos++,r=t,t=Gt(t,s.value);else throw new Error("Invalid optional chain in SSR expression");continue}if(n.value==="["){e.pos++;const s=t,o=Z(e,0);K(e,"]"),r=s,t=Gt(t,o);continue}if(n.value==="("){t=Qo(e,t,r),r=void 0;continue}break}return t},Qo=(e,t,r)=>{K(e,"(");const n=[];if(!Yt(e,")")){for(;;)if(n.push(Z(e,0)),!Yt(e,",")){K(e,")");break}}if(typeof t=="function")return t.apply(r,n)},Ch=e=>{const t=je(e);if(t.kind==="number")return Number(t.value);if(t.kind==="string")return t.value;if(t.kind==="ident")return kh(e,t.value);if(t.kind==="punct"&&t.value==="("){const r=Z(e,0);return K(e,")"),r}throw new Error(`Unexpected token "${t.value}" in SSR expression`)},pe=(e,t)=>{const r=e.trim();if(r!=="")try{const n={tokens:bh(r),pos:0,context:t},s=Z(n,0);return Y(n).kind!=="eof"?void 0:s}catch{return}},$h=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Oh=new Set(["script","style","textarea","title"]),Lh={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},Fr=e=>e.indexOf("&")===-1?e:e.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,(t,r)=>{if(r[0]==="#"){const n=r[1]==="x"||r[1]==="X",s=parseInt(r.slice(n?2:1),n?16:10);if(Number.isFinite(s))try{return String.fromCodePoint(s)}catch{return t}return t}return Lh[r.toLowerCase()]??t}),mt=e=>e===" "||e===" "||e===`
278
+ `||e==="\r"||e==="\f",Xt=e=>{for(;e.pos<e.src.length&&mt(e.src[e.pos]);)e.pos++},Ph=(e,t)=>{const r=e.pos,n=e.src.indexOf(t,r);return n===-1?(e.pos=e.src.length,e.src.slice(r)):(e.pos=n,e.src.slice(r,n))},Vo=e=>{const t=e.pos;for(;e.pos<e.src.length;){const r=e.src[e.pos];if(mt(r)||r===">"||r==="/")break;e.pos++}return e.src.slice(t,e.pos).toLowerCase()},Nh=e=>{const t=e.pos;for(;e.pos<e.src.length;){const r=e.src[e.pos];if(mt(r)||r==="="||r===">"||r==="/")break;e.pos++}return e.src.slice(t,e.pos)},Ih=e=>{const t=e.src[e.pos];if(t==='"'||t==="'"){const n=t;e.pos++;const s=e.pos;for(;e.pos<e.src.length&&e.src[e.pos]!==n;)e.pos++;const o=e.src.slice(s,e.pos);return e.pos<e.src.length&&e.pos++,Fr(o)}const r=e.pos;for(;e.pos<e.src.length;){const n=e.src[e.pos];if(mt(n)||n===">"||n==="/"&&e.src[e.pos+1]===">")break;e.pos++}return Fr(e.src.slice(r,e.pos))},Mh=e=>{const t=Object.create(null),r=[];let n=!1;for(;e.pos<e.src.length;){Xt(e);const s=e.src[e.pos];if(s===">"){e.pos++;break}if(s==="/"){if(e.pos++,Xt(e),e.src[e.pos]===">"){n=!0,e.pos++;break}continue}if(e.pos>=e.src.length)break;const o=Nh(e);if(!o){for(;e.pos<e.src.length;){const c=e.src[e.pos];if(mt(c)||c===">"||c==="/")break;e.pos++}continue}const i=o.toLowerCase();Xt(e);let a="";e.src[e.pos]==="="&&(e.pos++,Xt(e),a=Ih(e)),i in t||r.push(i),t[i]=a}return{attributes:t,order:r,selfClose:n}},Zt=e=>{const t={src:e,pos:0},r={type:"fragment",children:[]},n=[r],s=()=>n[n.length-1];for(;t.pos<t.src.length;){if(t.src[t.pos]==="<"){if(t.src.startsWith("<!--",t.pos)){t.pos+=4;const i=t.src.indexOf("-->",t.pos),a=i===-1?t.src.slice(t.pos):t.src.slice(t.pos,i);t.pos=i===-1?t.src.length:i+3,s().children.push({type:"comment",value:a});continue}if(t.src.startsWith("<!",t.pos)||t.src.startsWith("<?",t.pos)){const i=t.src.indexOf(">",t.pos);t.pos=i===-1?t.src.length:i+1;continue}if(t.src[t.pos+1]==="/"){t.pos+=2;const i=Vo(t),a=t.src.indexOf(">",t.pos);t.pos=a===-1?t.src.length:a+1;for(let c=n.length-1;c>0;c--){const l=n[c];if(l.type==="element"&&l.tag===i){n.length=c;break}}continue}if(t.pos+1<t.src.length&&/[a-zA-Z]/.test(t.src[t.pos+1])){t.pos++;const i=Vo(t),{attributes:a,order:c,selfClose:l}=Mh(t),u=$h.has(i),h={type:"element",tag:i,attributes:a,attributeOrder:c,children:[],void:u,raw:Oh.has(i)};if(s().children.push(h),u||l)continue;if(h.raw){const d=`</${i}`,p=t.pos,f=t.src.toLowerCase().indexOf(d,p),m=f===-1?t.src.slice(p):t.src.slice(p,f);if(m&&h.children.push({type:"text",value:m}),f===-1)t.pos=t.src.length;else{t.pos=f;const v=t.src.indexOf(">",t.pos);t.pos=v===-1?t.src.length:v+1}continue}n.push(h);continue}s().children.push({type:"text",value:"<"}),t.pos++;continue}const o=Ph(t,"<");o&&s().children.push({type:"text",value:Fr(o)})}return r},Dh=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),_h=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),pt=e=>{if(e.type==="text")return Dh(e.value);if(e.type==="comment")return`<!--${e.value}-->`;if(e.type==="fragment"){let s="";for(const o of e.children)s+=pt(o);return s}const t=e;let r="";for(const s of t.attributeOrder){const o=t.attributes[s];r+=` ${s}="${_h(o)}"`}if(t.void)return`<${t.tag}${r}>`;let n="";if(t.raw)for(const s of t.children)s.type==="text"&&(n+=s.value);else for(const s of t.children)n+=pt(s);return`<${t.tag}${r}>${n}</${t.tag}>`},Br=e=>e.type==="element"?{type:"element",tag:e.tag,attributes:{...e.attributes},attributeOrder:[...e.attributeOrder],children:e.children.map(Br),void:e.void,raw:e.raw}:e.type==="fragment"?{type:"fragment",children:e.children.map(Br)}:e.type==="text"?{type:"text",value:e.value}:{type:"comment",value:e.value},xh=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"},qh=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(),Ko=e=>{const t=qh(e);return lr.some(r=>t.startsWith(r))},zh=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,jh=/\s+/,Uh=e=>{const t=e.toLowerCase();for(const r of dn)if(t.startsWith(r))return!1;return t.startsWith("data-")||t.startsWith("aria-")?!0:fn.has(t)},Hh=e=>!un.has(e.toLowerCase().trim()),Wh=e=>{try{const t=e.trim();if(t.startsWith("//"))return!0;const r=t.toLowerCase();return!r.startsWith("http://")&&!r.startsWith("https://")?!!zh.test(t):typeof window>"u"||!window.location?!0:new URL(t,window.location.href).origin!==window.location.origin}catch{return!0}},er=(e,t)=>{if(!t)return;const r=e.attributes.class,n=r?`${r} ${t}`:t;"class"in e.attributes||e.attributeOrder.push("class"),e.attributes.class=n},Yo=(e,t)=>{let r=e.attributes.style??"";for(const[n,s]of Object.entries(t)){if(s==null||s===!1)continue;const o=n.replace(/([A-Z])/g,"-$1").toLowerCase();r&&!r.endsWith(";")&&(r+="; "),r+=`${o}: ${String(s)};`}"style"in e.attributes||e.attributeOrder.push("style"),e.attributes.style=r},ee=(e,t)=>{if(t in e.attributes){delete e.attributes[t];const r=e.attributeOrder.indexOf(t);r!==-1&&e.attributeOrder.splice(r,1)}},tr=(e,t,r)=>{t in e.attributes||e.attributeOrder.push(t),e.attributes[t]=r},Fh=(e,t)=>mh(e.attributeOrder,e.attributes,t),Bh=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},Qr=(e,t)=>{if(e.type!=="element"){if(e.type==="fragment")for(const r of e.children)Qr(r,t);return}for(const r of[...e.attributeOrder])(r.startsWith(`${t}-`)||r.startsWith(":"))&&ee(e,r);for(const r of e.children)Qr(r,t)},Qh=(e,t)=>{e.children=[{type:"text",value:t}]},Vh=(e,t)=>{e.children=Zt(t).children},Jo=e=>{const t=r=>{if(r.type==="fragment")return r.children=r.children.flatMap(n=>{const s=t(n);return s?[s]:[]}),r;if(r.type!=="element")return r;if(cr.has(r.tag)||!ln.has(r.tag))return null;for(const n of[...r.attributeOrder]){const s=r.attributes[n],o=n.toLowerCase();if(!Uh(o)){ee(r,n);continue}if((o==="id"||o==="name")&&!Hh(s)){ee(r,n);continue}if((o==="href"||o==="src")&&Ko(s)){ee(r,n);continue}}if(r.tag==="a"){const n=r.attributes.href,s=r.attributes.target?.toLowerCase()==="_blank",o=n?Wh(n):!1;if(s||o){const i=new Set((r.attributes.rel??"").trim().split(jh).filter(Boolean));i.add("noopener"),i.add("noreferrer"),tr(r,"rel",Array.from(i).join(" "))}}return r.children=r.children.flatMap(n=>{const s=t(n);return s?[s]:[]}),r};return pt(t(Zt(e))??{type:"fragment",children:[]})},Go=(e,t,r)=>{const n=[];for(const s of e.children){if(s.type!=="element"){n.push(s);continue}const o=Xo(s,t,r);if(o!==null)if(Array.isArray(o))for(const i of o)n.push(i);else n.push(o)}e.children=n},Xo=(e,t,r)=>{const{prefix:n}=r,s=e.attributes[`${n}-for`];if(s!==void 0){const d=Bh(s);if(d||ee(e,`${n}-for`),d){const p=pe(d.listExpr,t);if(!Array.isArray(p))return null;const f=[];for(let m=0;m<p.length;m++){const v=Br(e);ee(v,`${n}-for`),ee(v,`${n}-key`),ee(v,":key");const b={...t,[d.itemName]:p[m]};d.indexName&&(b[d.indexName]=m);const g=Xo(v,b,r);g!==null&&(Array.isArray(g)?f.push(...g):f.push(g))}return f}}const o=r.annotateHydration?Fh(e,n):"",i=e.attributes[`${n}-if`];if(i!==void 0&&!pe(i,t))return null;const a=e.attributes[`${n}-show`];a!==void 0&&(pe(a,t)||Yo(e,{display:"none"}));const c=e.attributes[`${n}-text`];if(c!==void 0){const d=pe(c,t);Qh(e,String(d??""))}const l=e.attributes[`${n}-html`];if(l!==void 0){const d=pe(l,t);Vh(e,Jo(String(d??"")))}const u=e.attributes[`${n}-class`];if(u!==void 0){const d=u.trim();if(d.startsWith("{")){const p=d.slice(1,-1).split(",");for(const f of p){const m=f.indexOf(":");if(m<0)continue;const v=f.slice(0,m).trim().replace(/^['"]|['"]$/g,"");pe(f.slice(m+1),t)&&er(e,v)}}else{const p=pe(u,t);if(typeof p=="string")for(const f of p.split(/\s+/).filter(Boolean))er(e,f);else if(Array.isArray(p))for(const f of p)typeof f=="string"&&f&&er(e,f);else if(p&&typeof p=="object")for(const[f,m]of Object.entries(p))m&&er(e,f)}}const h=e.attributes[`${n}-style`];if(h!==void 0){const d=pe(h,t);d&&typeof d=="object"&&Yo(e,d)}for(const d of[...e.attributeOrder]){if(!d.startsWith(`${n}-bind:`))continue;const p=d.slice(`${n}-bind:`.length),f=pe(e.attributes[d],t);f===!1||f==null?ee(e,p):f===!0?tr(e,p,""):tr(e,p,String(f))}for(const d of[...e.attributeOrder]){const p=d.toLowerCase();if(p.startsWith("on")){ee(e,d);continue}xh(p)&&Ko(e.attributes[d]??"")&&ee(e,d)}return e.tag==="script"?null:(Go(e,t,r),o&&tr(e,Kt,jr(o)),e)},Kh=(e,t,r={})=>{const n={prefix:r.prefix??"bq",stripDirectives:r.stripDirectives??!1,annotateHydration:r.annotateHydration??!1},s=Zt(e);return Go(s,t,n),n.stripDirectives&&Qr(s,n.prefix),pt(s)},Ue=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),vt=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),rr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Vr=e=>{const t={};for(const[r,n]of Object.entries(e))N(r)||(t[r]=n);return t},yt=(e={})=>{const{scriptId:t="__BQUERY_STORE_STATE__",globalKey:r="__BQUERY_INITIAL_STATE__",storeIds:n,serialize:s=JSON.stringify}=e;if(N(r))throw new Error(`serializeStoreState: invalid globalKey "${r}" - prototype-pollution keys are not allowed.`);if(N(t))throw new Error(`serializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);const o=n??Wt(),i=Object.create(null);for(const u of o){if(N(u))continue;const h=we(u);h&&(i[u]=Vr(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(!rr(u))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const c=Ue(a),l=Ue(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${vt(t)}">window[${l}]=${c}<\/script>`}},Yh=(e="__BQUERY_INITIAL_STATE__",t="__BQUERY_STORE_STATE__")=>{if(N(e))throw new Error(`deserializeStoreState: invalid globalKey "${e}" - prototype-pollution keys are not allowed.`);if(N(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(!rr(r))return{};for(const s of Object.values(r))if(!rr(s))return{};const n=Object.create(null);for(const[s,o]of Object.entries(r))N(s)||!rr(o)||(n[s]=Vr(o));return n},Zo=(e,t)=>{const r=we(e);r&&typeof r.$patch=="function"&&r.$patch(Vr(t))},Jh=e=>{for(const[t,r]of Object.entries(e))Zo(t,r)},Gh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Xh=3,Zh=1,ei=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),em=e=>ei(e).replace(/"/g,"&quot;"),tm=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"},rm=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(),nm=e=>{const t=rm(e);return lr.some(r=>t.startsWith(r))},ti=e=>{if(e.nodeType===Xh)return ei(e.textContent??"");if(e.nodeType!==Zh)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")||tm(i)&&nm(o.value)||(n+=` ${o.name}="${em(o.value)}"`)}if(Gh.has(r))return`<${r}${n}>`;let s="";for(const o of t.childNodes)s+=ti(o);return`<${r}${n}>${s}</${r}>`},ri=e=>G(e)||ce(e)?e.value:e,se=(e,t)=>{const r=e.trim();if(r.startsWith("!"))return!se(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=ri(s[o]):s=s[o]}return s}try{const n=Object.keys(t),s=n.map(o=>ri(t[o]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},sm=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},Kr=(e,t,r,n=!1)=>{const s=e.getAttribute(`${r}-for`),o=s!==null?sm(s):null;s!==null&&!o&&e.removeAttribute(`${r}-for`);const i=n?Wo(e,r):"";if(s!==null&&o){const f=se(o.listExpr,t);if(e.parentNode){const m=e.parentNode;if(!Array.isArray(f))return m.removeChild(e),!0;for(let v=0;v<f.length;v++){const b=f[v],g=e.cloneNode(!0);g.removeAttribute(`${r}-for`),g.removeAttribute(":key"),g.removeAttribute(`${r}-key`);const w={...t,[o.itemName]:b};o.indexName&&(w[o.indexName]=v),Kr(g,w,r,n)&&(Yr(g,w,r,n),m.insertBefore(g,e))}return m.removeChild(e),!0}}const a=e.getAttribute(`${r}-if`);if(a!==null&&!se(a,t))return!1;const c=e.getAttribute(`${r}-show`);if(c!==null&&!se(c,t)){const f=e;f.style?f.style.display="none":e.setAttribute("style","display: none;")}const l=e.getAttribute(`${r}-text`);if(l!==null){const f=se(l,t);e.textContent=String(f??"")}const u=e.getAttribute(`${r}-html`);if(u!==null){const f=se(u,t);e.innerHTML=Jo(String(f??""))}const h=e.getAttribute(`${r}-class`);if(h!==null){const f=h.trim();if(f.startsWith("{")){const m=f.slice(1,-1).trim().split(",");for(const v of m){const b=v.indexOf(":");if(b>-1){const g=v.slice(0,b).trim().replace(/^['"]|['"]$/g,"");se(v.slice(b+1).trim(),t)&&e.classList.add(g)}}}else{const m=se(h,t);typeof m=="string"?m.split(/\s+/).filter(Boolean).forEach(v=>e.classList.add(v)):Array.isArray(m)&&m.filter(Boolean).forEach(v=>e.classList.add(v))}}const d=e.getAttribute(`${r}-style`);if(d!==null){const f=se(d,t);if(f&&typeof f=="object"){const m=e;for(const[v,b]of Object.entries(f)){const g=v.replace(/([A-Z])/g,"-$1").toLowerCase();m.style.setProperty(g,String(b))}}}const p=Array.from(e.attributes);for(const f of p)if(f.name.startsWith(`${r}-bind:`)){const m=f.name.slice(`${r}-bind:`.length),v=se(f.value,t);v===!1||v===null||v===void 0?e.removeAttribute(m):v===!0?e.setAttribute(m,""):e.setAttribute(m,String(v))}return i&&e.setAttribute(Kt,jr(i)),!0},Yr=(e,t,r,n=!1)=>{const s=Array.from(e.children);for(const o of s){let i=!1;if(o.hasAttribute(`${r}-for`)){const a=Kr(o,t,r,n);if(i=!0,!a){o.remove();continue}if(o.parentNode!==e)continue}if(!i&&!Kr(o,t,r,n)){o.remove();continue}Yr(o,t,r,n)}},ni=(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))ni(n,t)},gt=(e,t,r={})=>{const{prefix:n="bq",stripDirectives:s=!1,includeStoreState:o=!1,annotateHydration:i=!1}=r;if(!e||typeof e!="string")throw new Error("bQuery SSR: template must be a non-empty string.");const a=e.trim();if(dh()==="pure"){const p=Kh(a,t,{prefix:n,stripDirectives:s,annotateHydration:i});let f;return o&&(f=yt({storeIds:Array.isArray(o)?o:void 0}).stateJson),{html:p,storeState:f}}const c=hh();if(!c)throw new Error("bQuery SSR: DOMParser is not available in this environment. Provide a DOMParser-compatible implementation before calling renderToString().");const l=new c().parseFromString(a,"text/html"),u=l.body||l.documentElement;if(!u)throw new Error("bQuery SSR: Failed to parse template.");if(Yr(u,t,n,i),s)for(const p of Array.from(u.children))ni(p,n);let h="";for(const p of u.childNodes)h+=ti(p);let d;return o&&(d=yt({storeIds:Array.isArray(o)?o:void 0}).stateJson),{html:h,storeState:d}},si=()=>typeof globalThis<"u"?globalThis:{},nr=()=>{const e=si();if(typeof e.Bun?.version=="string")return"bun";if(typeof e.Deno?.version?.deno=="string")return"deno";const t=e.navigator;return typeof t?.userAgent=="string"&&t.userAgent.toLowerCase().includes("cloudflare-workers")?"workerd":typeof e.process?.versions?.node=="string"?"node":typeof e.window<"u"&&typeof e.document<"u"?"browser":"unknown"},om=()=>{const e=nr();return e==="bun"||e==="deno"||e==="node"||e==="workerd"},im=()=>nr()==="browser",am=()=>{const e=si(),t=e.crypto;return{fetchApi:typeof e.Request=="function"&&typeof e.Response=="function"&&typeof e.fetch=="function",webStreams:typeof e.ReadableStream=="function",textEncoder:typeof e.TextEncoder=="function",subtleCrypto:typeof t?.subtle=="object"&&t?.subtle!==null,randomUuid:typeof t?.randomUUID=="function",domParser:typeof e.DOMParser=="function"}},bt=Symbol.for("bquery.ssr.defer"),cm=e=>(Object.defineProperty(e,bt,{value:!0,enumerable:!1,configurable:!0}),e),lm=(e,t)=>{const r=e instanceof Promise?e:Promise.resolve(e);return{[bt]:!0,promise:r,fallback:t}},um=e=>typeof e=="object"&&e!==null&&e[bt]===!0,fm=async(e,t)=>{const r=Object.create(null),n=Object.entries(e);await Promise.all(n.map(async([s,o])=>{if(!N(s)){if(G(o)||ce(o)){r[s]=o;return}if(um(o)){try{r[s]=await o.promise}catch(i){t.reportError(i),r[s]=o.fallback}return}if(o&&typeof o.then=="function"){try{r[s]=await o}catch(i){t.reportError(i),r[s]=void 0}return}if(typeof o=="function"&&o[bt]){try{r[s]=await Promise.resolve(o(t))}catch(i){t.reportError(i),r[s]=void 0}return}r[s]=o}}));for(const[s,o]of Object.entries(e))!N(s)&&!Object.prototype.hasOwnProperty.call(r,s)&&(G(o)||ce(o))&&(r[s]=o);return r},U=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),dm=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),hm=e=>e.replace(/<\/(script)/gi,"<\\/$1").replace(/<!--/g,"<\\!--").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),oi=()=>{const e={title:null,titleTemplate:null,meta:[],link:[],script:[]};return{add:s=>{typeof s.title=="string"&&(e.title=s.title),typeof s.titleTemplate=="string"&&(e.titleTemplate=s.titleTemplate),Array.isArray(s.meta)&&e.meta.push(...s.meta),Array.isArray(s.link)&&e.link.push(...s.link),Array.isArray(s.script)&&e.script.push(...s.script)},state:()=>({...e,meta:[...e.meta],link:[...e.link],script:[...e.script]}),render:(s={})=>{let o="";if(e.title!==null){const i=e.titleTemplate?e.titleTemplate.replace(/%s/g,e.title):e.title;o+=`<title>${dm(i)}</title>`}for(const i of e.meta){let a="";for(const[c,l]of Object.entries(i))l!=null&&(N(c)||(a+=` ${c==="httpEquiv"?"http-equiv":c}="${U(String(l))}"`));o+=`<meta${a}>`}for(const i of e.link){let a=` rel="${U(i.rel)}" href="${U(i.href)}"`;i.as&&(a+=` as="${U(i.as)}"`),i.type&&(a+=` type="${U(i.type)}"`),i.crossorigin&&(a+=` crossorigin="${U(i.crossorigin)}"`),i.media&&(a+=` media="${U(i.media)}"`),i.integrity&&(a+=` integrity="${U(i.integrity)}"`),(i.nonce??s.nonce)&&(a+=` nonce="${U(i.nonce??s.nonce)}"`),o+=`<link${a}>`}for(const i of e.script){let a="";i.src&&(a+=` src="${U(i.src)}"`),i.type?a+=` type="${U(i.type)}"`:i.module&&(a+=' type="module"'),i.defer&&(a+=" defer"),i.async&&(a+=" async"),i.crossorigin&&(a+=` crossorigin="${U(i.crossorigin)}"`),i.integrity&&(a+=` integrity="${U(i.integrity)}"`);const c=i.nonce??s.nonce;c&&(a+=` nonce="${U(c)}"`),o+=`<script${a}>${i.body?hm(i.body):""}<\/script>`}return o},reset:()=>{e.title=null,e.titleTemplate=null,e.meta=[],e.link=[],e.script=[]}}},ii=()=>{const e=[];return{preload(t,r={}){e.push({href:t,rel:"preload",...r})},module(t,r={}){e.push({href:t,rel:"modulepreload",...r})},style(t,r={}){e.push({href:t,rel:"stylesheet",...r})},list:()=>[...e],render(t={}){let r="";for(const n of e){let s=` rel="${U(n.rel)}" href="${U(n.href)}"`;n.as&&(s+=` as="${U(n.as)}"`),n.type&&(s+=` type="${U(n.type)}"`),n.crossorigin&&(s+=` crossorigin="${U(n.crossorigin)}"`),n.integrity&&(s+=` integrity="${U(n.integrity)}"`),t.nonce&&(s+=` nonce="${U(t.nonce)}"`),r+=`<link${s}>`}return r},reset(){e.length=0}}},mm=e=>{const t=Object.create(null);if(!e)return t;for(const r of e.split(/;\s*/)){const n=r.indexOf("=");if(n===-1)continue;const s=r.slice(0,n).trim(),o=r.slice(n+1).trim();if(!(!s||N(s)))try{t[s]=decodeURIComponent(o)}catch{t[s]=o}}return t},pm=e=>{if(!e)return"en";const t=e.split(",").map(r=>{const[n,...s]=r.trim().split(";"),o=s.find(a=>a.trim().startsWith("q=")),i=o?Number.parseFloat(o.split("=")[1]):1;return{tag:n.trim(),q:Number.isFinite(i)?i:0}}).filter(r=>r.tag);return t.length?(t.sort((r,n)=>n.q-r.q),t[0].tag):"en"},vm=()=>{try{return bn()}catch{return""}},ai=()=>{const e=new Map,t={append(r,n){const s=String(r).toLowerCase(),o=e.get(s);o?o.push(String(n)):e.set(s,[String(n)])},delete(r){e.delete(String(r).toLowerCase())},get(r){const n=e.get(String(r).toLowerCase());return n?n.join(", "):null},has(r){return e.has(String(r).toLowerCase())},set(r,n){e.set(String(r).toLowerCase(),[String(n)])},forEach(r,n){for(const[s,o]of e)r.call(n,o.join(", "),s,t)},*entries(){for(const[r,n]of e)yield[r,n.join(", ")]},[Symbol.iterator](){return t.entries()}};return t},ci=()=>({aborted:!1,onabort:null,reason:void 0,addEventListener(){},removeEventListener(){},dispatchEvent(){return!1},throwIfAborted(){}}),ym=e=>typeof e=="object"&&e!==null&&typeof e.get=="function",gm=e=>typeof e=="object"&&e!==null&&typeof e.aborted=="boolean",li=()=>typeof Headers=="function"?new Headers:ai(),wt=(e={})=>{const t=e.url instanceof URL?e.url.toString():typeof e.url=="string"?new URL(e.url,"http://localhost/").toString():"http://localhost/",r=e.request??(typeof Request=="function"?new Request(t):{url:t,headers:ai(),signal:ci()}),n=e.url??r.url,s=n instanceof URL?n:new URL(String(n),"http://localhost/"),o=ym(r.headers)?r.headers:li();return{request:r,url:s,headers:o,cookies:mm(o.get("cookie")??""),userAgent:e.userAgent??o.get("user-agent")??"",locale:e.locale??pm(o.get("accept-language")),signal:e.signal??(gm(r.signal)?r.signal:ci()),nonce:e.nonce??vm(),mode:e.mode??"string",head:oi(),assets:ii(),status:200,responseHeaders:li(),reportError(i){e.onError?.(i)}}},bm=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),wm=e=>e===" "||e===`
279
+ `||e===" "||e==="\r"||e==="\f",Sm=(e,t)=>{if(e.slice(0,7).toLowerCase()!=="<script")return e;const r=e[7];return r!==">"&&!wm(r)?e:`<script nonce="${bm(t)}"${e.slice(7)}`},Em=(e,t)=>{if(!t)return e;const r=e.toLowerCase().indexOf("</head>");return r===-1?e:e.slice(0,r)+t+e.slice(r)},Am=(e,t)=>{if(!t)return e;const r=e.toLowerCase().lastIndexOf("</body>");return r===-1?e:e.slice(0,r)+t+e.slice(r)},Jr=async(e,t,r={})=>{const n=r.context??wt({mode:"string"});if(n.signal.aborted)throw new DOMException("SSR render aborted","AbortError");const s=await fm(t,n);if(n.signal.aborted)throw new DOMException("SSR render aborted","AbortError");let{html:o,storeState:i}=gt(e,s,{prefix:r.prefix,stripDirectives:r.stripDirectives,includeStoreState:!1,annotateHydration:r.annotateHydration});const a=n.head.render({nonce:n.nonce}),c=n.assets.render({nonce:n.nonce});let l="";if(r.includeStoreState){const u=yt({storeIds:Array.isArray(r.includeStoreState)?r.includeStoreState:void 0,scriptId:r.storeScriptId,globalKey:r.storeGlobalKey});i=u.stateJson,l=u.scriptTag,n.nonce&&(l=Sm(l,n.nonce))}return r.injectHead!==!1&&(o=Em(o,a+c),o=Am(o,l)),{html:o,storeState:i,context:n,headHtml:a,assetsHtml:c,storeScriptTag:l}},ui=()=>{if(typeof TextEncoder>"u")throw new Error("bQuery SSR: TextEncoder is not available in this runtime.");return new TextEncoder},km=(e,t,r={})=>{if(typeof ReadableStream>"u")throw new Error("bQuery SSR: ReadableStream is not available in this runtime.");const n=ui(),s=r.context??wt({...r,mode:"stream"}),o={...r,context:s};return new ReadableStream({async start(i){const a=()=>{try{i.error(new DOMException("SSR stream aborted","AbortError"))}catch{}};if(s.signal.aborted){a();return}s.signal.addEventListener("abort",a,{once:!0});try{const c=await Jr(e,t,o);i.enqueue(n.encode(c.html)),i.close()}catch(c){s.signal.removeEventListener("abort",a);try{i.error(c)}catch{}}finally{s.signal.removeEventListener("abort",a)}}})},Tm=async e=>{const t=globalThis.crypto?.subtle;if(!t)return null;try{const r=await t.digest("SHA-1",ui().encode(e)),n=new Uint8Array(r);let s="";for(const o of n)s+=o.toString(16).padStart(2,"0");return`W/"${s.slice(0,27)}"`}catch{return null}},Rm=async(e,t,r={})=>{const n=r.context??wt({...r,mode:"string"}),s=await Jr(e,t,{...r,context:n}),o=r.status??n.status??200,i=new Headers(r.headers);for(const[a,c]of n.responseHeaders)i.append(a,c);if(i.has("content-type")||i.set("content-type",r.contentType??"text/html; charset=utf-8"),r.cacheControl&&i.set("cache-control",r.cacheControl),r.etag){const a=await Tm(s.html);if(a){i.set("etag",a);const c=n.headers.get("if-none-match");if(c&&c===a)return new Response(null,{status:304,headers:i})}}return new Response(s.html,{status:o,headers:i})},Gr=e=>{if(typeof e!="string")return e;if(typeof document>"u")return null;try{return document.querySelector(e)}catch{return null}},St=(e,t,r)=>{const n=Gr(e);return n?Ho(n,t,r):null},te=()=>{},Cm=e=>{if(typeof window>"u")return e(),te;const t=window.requestIdleCallback;if(typeof t=="function"){const n=t(e);return()=>{const s=window.cancelIdleCallback;typeof s=="function"&&s(n)}}const r=setTimeout(e,1);return()=>clearTimeout(r)},sr=e=>{let t=!1,r=te,n=te;const s=new Promise((a,c)=>{r=a,n=c});let o=te;return{handle:{ready:s,cancel(){t||(t=!0,o(),r(null))}},arm:a=>{o=e(()=>{if(!t)try{const c=a();r(c)}catch(c){n(c)}})}}},$m=(e,t,r={})=>{const{rootMargin:n,threshold:s,...o}=r,{handle:i,arm:a}=sr(c=>{const l=Gr(e);if(!l||typeof IntersectionObserver>"u")return c(),te;const u=new IntersectionObserver(h=>{for(const d of h)if(d.isIntersecting){u.disconnect(),c();return}},{rootMargin:n??"0px",threshold:s??0});return u.observe(l),()=>u.disconnect()});return a(()=>St(e,t,o)),i},Om=(e,t,r={})=>{const{handle:n,arm:s}=sr(o=>Cm(o));return s(()=>St(e,t,r)),n},Lm=(e,t,r={})=>{const n=r.events??["pointerdown","click","keydown","touchstart","focusin"],{events:s,...o}=r,{handle:i,arm:a}=sr(c=>{const l=Gr(e);if(!l)return c(),te;const u=()=>{h(),c()},h=()=>{for(const d of n)l.removeEventListener(d,u,!0)};for(const d of n)l.addEventListener(d,u,{once:!0,capture:!0});return h});return a(()=>St(e,t,o)),i},Pm=(e,t,r,n={})=>{const{handle:s,arm:o}=sr(i=>{if(typeof window>"u"||typeof window.matchMedia!="function")return i(),te;const a=window.matchMedia(r);if(a.matches)return i(),te;let c=te;const l=h=>{h.matches&&(c(),i())};if(typeof a.addEventListener=="function")return a.addEventListener("change",l),c=()=>a.removeEventListener("change",l),c;const u=a;return typeof u.addListener=="function"&&typeof u.removeListener=="function"?(u.addListener(l),c=()=>u.removeListener(l),c):(i(),te)});return o(()=>St(e,t,n)),s},Nm=(e,t,r={})=>St(e,t,r),Im=(e,t={})=>{const r=t.prefix??"bq",n=t.warn??qt(),s=t.onMismatch,o=[];if(!e||typeof e.querySelectorAll!="function")return o;const i=[];typeof e.getAttribute=="function"&&e.getAttribute("data-bq-h")!==null&&i.push(e);for(const a of Array.from(e.querySelectorAll(`[${Kt}]`)))i.push(a);for(const a of i){const c=a.getAttribute("data-bq-h")??"",l=Wo(a,r),u=jr(l);if(u!==c){const h={element:a,expected:c,actual:u,signature:l};o.push(h),s?.(h),n&&console.warn(`[bQuery SSR] Hydration mismatch on <${a.tagName.toLowerCase()}>: server="${c}" client="${u}" signature="${l}".`,a)}}return o},Mm=e=>typeof e=="object"&&e!==null&&e[bt]===!0,Dm=e=>G(e)||ce(e),_m=/^[A-Za-z][\w-]*$/,xm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/,fi=(e,t)=>typeof e!="string"||!_m.test(e)?t:e,qm=(e,t)=>typeof e!="string"||!xm.test(e)?t:e,zm=e=>{const t=e.replace(/-s$/,"-r");return t===e&&e.endsWith("-r")?`${e}-template`:t===e?`${e}-r`:t},jm=(e,t)=>{const r={},n=[];let s=0;for(const[o,i]of Object.entries(e)){if(Dm(i)){r[o]=i;continue}if(Mm(i)){const a=`${t}-${s++}`;n.push({id:a,key:o,promise:i.promise}),r[o]=i.fallback;continue}if(i&&typeof i.then=="function"){const a=`${t}-${s++}`;n.push({id:a,key:o,promise:i}),r[o]=void 0;continue}r[o]=i}return{syncContext:r,slots:n}},Xr=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),or=e=>Xr(e).replace(/"/g,"&quot;"),Um=e=>e.replace(/<\/(script)/gi,"<\\/$1").replace(/<!--/g,"<\\!--").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),Hm=Um('(()=>{var c=document.currentScript;if(!c)return;var slotId=c.getAttribute("data-bq-slot");var templateId=c.getAttribute("data-bq-template");if(!slotId||!templateId)return;var s=document.getElementById(slotId);var t=document.getElementById(templateId);if(!s||!t)return;var f=t.content?t.content.cloneNode(true):t;while(s.firstChild)s.removeChild(s.firstChild);s.appendChild(f);t.parentNode&&t.parentNode.removeChild(t);s.parentNode&&s.replaceWith(...s.childNodes);})();'),Wm=(e,t,r)=>`<script${r?` nonce="${or(r)}"`:""} data-bq-slot="${or(e)}" data-bq-template="${or(t)}">${Hm}<\/script>`,Fm=(e,t,r,n,s,o)=>{const i=t[`__suspense_${n}`];return typeof i=="string"?gt(i,{...r,[n]:s},{prefix:o.prefix,stripDirectives:o.stripDirectives,annotateHydration:o.annotateHydration}).html:s==null?"":Xr(typeof s=="string"?s:String(s))},Bm=(e,t)=>{if(!(t in e.attributes))return;delete e.attributes[t];const r=e.attributeOrder.indexOf(t);r!==-1&&e.attributeOrder.splice(r,1)},di=(e,t,r=[])=>({type:"element",tag:e,attributes:{id:t},attributeOrder:["id"],children:r,void:!1,raw:!1}),hi=(e,t)=>{for(const r of e)r.type==="element"&&(t(r),hi(r.children,t))},mi=(e,t)=>{for(const r of e){if(r.type!=="element")continue;if(r.tag===t)return r;const n=mi(r.children,t);if(n)return n}return null},Qm=(e,t,r,n)=>{const s=qm(n.slotTag,"bq-slot"),o=Zt(e),i=new Map(r.map(l=>[l.key,l])),a=new Set;hi(o.children,l=>{const u=l.attributes["data-bq-defer"];if(!u)return;Bm(l,"data-bq-defer");const h=i.get(u);if(!h||a.has(h.id))return;const d=l.children;l.children=[di(s,h.id,d)],a.add(h.id)});const c=mi(o.children,"body")?.children??o.children;for(const l of r)a.has(l.id)||c.push(di(s,l.id));return pt(o)},Vm=e=>e!==void 0&&/\s/.test(e),Km=e=>e===void 0||e==="="||e===">"||e==="/"||/\s/.test(e),Ym=e=>{let t="",r=0,n=!1,s="",o=!1,i=!1,a=!0;const c="bq-defer";for(;r<e.length;){const l=e[r];if(!n){l==="<"&&(n=!0,o=!1,i=!1,a=!0),t+=l,r++;continue}if(s){t+=l,l===s&&(s=""),r++;continue}if(l==='"'||l==="'"){s=l,t+=l,r++;continue}if(l===">"){n=!1,t+=l,r++;continue}if(!o){if(t+=l,r++,!i){if(/\s/.test(l))continue;i=!0,(l==="/"||l==="!"||l==="?")&&(a=!1);continue}a&&/\s/.test(l)&&(o=!0);continue}if(a&&e.startsWith(c,r)&&Vm(e[r-1])&&Km(e[r+8])){t+="data-bq-defer",r+=8;continue}t+=l,r++}return t},Jm=()=>{if(typeof TextEncoder>"u")throw new Error("bQuery SSR: TextEncoder is not available in this runtime.");return new TextEncoder},Gm=(e,t,r={})=>{if(typeof ReadableStream>"u")throw new Error("bQuery SSR: ReadableStream is not available in this runtime.");const n=Jm(),s=r.context??wt({...r,mode:"stream"}),o=fi(r.slotIdPrefix??"bq-s","bq-s"),i=fi(zm(o),"bq-r");return new ReadableStream({async start(a){const c=()=>{try{a.error(new DOMException("SSR stream aborted","AbortError"))}catch{}};if(s.signal.aborted){c();return}s.signal.addEventListener("abort",c,{once:!0});try{const{syncContext:l,slots:u}=jm(t,o),h=gt(Ym(e),l,{prefix:r.prefix,stripDirectives:r.stripDirectives,annotateHydration:r.annotateHydration}).html,d=Qm(h,l,u,r);a.enqueue(n.encode(d));const p=[],f=[];let m=u.length;const v=g=>{const w=f.shift();if(w){w(g);return}p.push(g)};for(const[g,w]of u.entries())w.promise.then(S=>({index:g,slot:w,ok:!0,value:S}),S=>({index:g,slot:w,ok:!1,error:S})).then(v);const b=async()=>{const g=p.shift();return g||new Promise(w=>{f.push(w)})};for(;m>0;){if(s.signal.aborted)return;const g=await b();m--;const{slot:w}=g,S=`${i}-${w.id.split("-").pop()}`;let k;g.ok?k=Fm(e,t,l,w.key,g.value,r):(s.reportError(g.error),k="");const A=`<template id="${or(S)}">${k}</template>`,E=Wm(w.id,S,s.nonce);a.enqueue(n.encode(A+E))}a.close()}catch(l){try{a.error(l)}catch{}}finally{s.signal.removeEventListener("abort",c)}}})},Xm=e=>{if(!e||!e.meta)return;const t=e.meta.loader;return typeof t=="function"?t:void 0},pi=e=>{const t=typeof e.url=="string"?new URL(e.url,"http://localhost/"):e.url,r=e.base??"";let n=t.pathname;r&&(n===r?n="/":n.startsWith(`${r}/`)&&(n=n.slice(r.length)||"/"));const s=no(n,e.routes),o={path:n,params:s?.params??{},query:Qs(t.search),matched:s?.matched??null,hash:t.hash.replace(/^#/,"")},i=s!==null,a=s?.matched??null,c=!!a&&"redirectTo"in a&&typeof a.redirectTo=="string";return{route:o,matched:i,isRedirect:c,redirectTo:c?a.redirectTo:void 0}},vi=async(e,t)=>{const r=Xm(e.matched);if(r)try{return await r({route:e,ctx:t})}catch(n){t.reportError(n);return}},Zm=async e=>{const t=pi({url:e.url,routes:e.routes,base:e.base}),r=t.matched?await vi(t.route,e.ctx):void 0;return{route:t.route,matched:t.matched,isRedirect:t.isRedirect,redirectTo:t.redirectTo,data:r,bindings:{route:t.route,params:t.route.params,query:t.route.query,data:r}}},Zr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yi=e=>{const t={};for(const[r,n]of Object.entries(e))N(r)||(t[r]=n);return t},ep=e=>{const{version:t,storeIds:r,scriptId:n="__BQUERY_STORE_SNAPSHOT__",globalKey:s="__BQUERY_STORE_SNAPSHOT__",nonce:o}=e;if(typeof t!="string"||t.length===0)throw new Error("serializeStoreSnapshot: `version` is required and must be a non-empty string.");if(N(n)||N(s))throw new Error("serializeStoreSnapshot: invalid scriptId/globalKey.");const i=r??Wt(),a=Object.create(null);for(const d of i){if(N(d))continue;const p=we(d);p&&(a[d]=yi(p.$state))}const c={version:t,state:a},l=JSON.stringify(c),u=Ue(l),h=Ue(JSON.stringify(s));return{snapshot:c,json:l,scriptTag:`<script id="${vt(n)}"${o?` nonce="${vt(o)}"`:""}>window[${h}]=${u}<\/script>`}},gi=e=>{if(!Zr(e))return!1;const t=e.version,r=e.state;return typeof t=="string"&&Zr(r)},tp=(e,t={})=>{if(!gi(e))return t.strict&&console.warn("[bQuery SSR] hydrateStoreSnapshot: snapshot has invalid shape."),{applied:!1,reason:"invalid-shape",appliedIds:[],unknownIds:[]};if(typeof t.expectedVersion=="string"&&t.expectedVersion!==e.version)return t.strict&&console.warn(`[bQuery SSR] hydrateStoreSnapshot: version mismatch — server="${e.version}" client="${t.expectedVersion}". Skipping.`),{applied:!1,reason:"version-mismatch",appliedIds:[],unknownIds:[]};const r=[],n=[];for(const[s,o]of Object.entries(e.state)){if(N(s)||!Zr(o))continue;const i=we(s);if(!i||typeof i.$patch!="function"){n.push(s),t.strict&&console.warn(`[bQuery SSR] hydrateStoreSnapshot: store "${s}" is not registered; skipping.`);continue}i.$patch(yi(o)),r.push(s)}return{applied:r.length>0,appliedIds:r,unknownIds:n}},rp=(e="__BQUERY_STORE_SNAPSHOT__",t="__BQUERY_STORE_SNAPSHOT__")=>{if(N(e)||N(t)||typeof window>"u")return null;const r=window[e];try{delete window[e]}catch{window[e]=void 0}if(typeof document<"u"&&typeof document.getElementById=="function"){const n=document.getElementById(t);n&&n.remove()}return gi(r)?r:null},bi=e=>{const t=Object.create(null);for(const[r,n]of Object.entries(e))N(r)||(t[r]=n);return t},np=(e={})=>{const t=Object.create(null);if(e.initial)for(const[r,n]of Object.entries(e.initial))N(r)||(t[r]=n);return{set(r,n){N(r)||(t[r]=n)},get(r){return t[r]},entries(){return bi(t)},render(r={}){const n=r.scriptId??"__BQUERY_RESUME__",s=r.globalKey??"__BQUERY_RESUME__";if(N(n)||N(s))return"";const o=Ue(JSON.stringify(t)),i=Ue(JSON.stringify(s));return`<script id="${vt(n)}"${r.nonce?` nonce="${vt(r.nonce)}"`:""}>window[${i}]=${o}<\/script>`}}},sp=(e="__BQUERY_RESUME__",t="__BQUERY_RESUME__")=>{const r={get:()=>{},hasSnapshot:!1,entries:()=>({})};if(N(e)||N(t)||typeof window>"u")return r;const n=window[e];try{delete window[e]}catch{window[e]=void 0}if(typeof document<"u"&&typeof document.getElementById=="function"){const o=document.getElementById(t);o&&o.remove()}if(!n||typeof n!="object")return r;const s=n;return{hasSnapshot:!0,get(o){if(!N(o))return s[o]},entries(){return bi(s)}}},wi=e=>e,Si=e=>async t=>Promise.resolve(e(t)),Ei=e=>async t=>Promise.resolve(e(t)),op=e=>e!=="GET"&&e!=="HEAD",en=class extends Error{constructor(e){super(e),this.name="NodeRequestLimitError"}},ir=(e,t)=>{const r=e[t];return Array.isArray(r)?r[0]:r},ip=e=>{const t=ir(e.headers,"content-length");if(!t)return null;const r=Number.parseInt(t,10);return Number.isSafeInteger(r)&&r>=0?r:null},ap=(e,t)=>new Promise((r,n)=>{const s=[];let o=0,i=!1;const a=l=>{i||(i=!0,s.length=0,o=0,e.destroy?.(l instanceof Error?l:void 0),n(l))},c=ip(e);if(t!==void 0&&c!==null&&c>t){a(new en(`Request body exceeds ${t} bytes.`));return}e.on("data",l=>{if(i)return;const u=typeof l=="string"?new TextEncoder().encode(l):l;if(o+=u.byteLength,t!==void 0&&o>t){a(new en(`Request body exceeds ${t} bytes.`));return}s.push(u)}),e.on("end",()=>{if(i)return;i=!0;const l=new ArrayBuffer(o),u=new Uint8Array(l);let h=0;for(const d of s)u.set(d,h),h+=d.byteLength;r(l)}),e.on("error",a)}),cp=(e,t)=>{const r=`${t}://localhost`,n=ir(e.headers,"host")||"localhost";try{return new URL(e.url??"/",`${t}://${n}`)}catch{try{return new URL(e.url??"/",r)}catch{return new URL("/",r)}}},lp=async(e,t={})=>{const r=typeof ir(e.headers,"x-forwarded-proto")=="string"?ir(e.headers,"x-forwarded-proto").split(",")[0].trim().toLowerCase():"",n=cp(e,r==="http"||r==="https"?r:"http"),s=new Headers;for(const[a,c]of Object.entries(e.headers))if(c!==void 0)if(Array.isArray(c))for(const l of c)s.append(a,l);else s.append(a,c);const o=(e.method??"GET").toUpperCase(),i={method:o,headers:s};return op(o)&&(i.body=await ap(e,t.maxBodyBytes)),new Request(n.toString(),i)},up=e=>{const t=e.getSetCookie?.();if(Array.isArray(t)&&t.length>0)return t;const r=e.get("set-cookie");return r?[r]:[]},fp=e=>new Promise((t,r)=>{const n=typeof e.once=="function"?e.once.bind(e):void 0,s=typeof e.on=="function"?e.on.bind(e):void 0,o=n??s;if(!o){t();return}o("drain",()=>t()),o("error",i=>{r(i instanceof Error?i:new Error("Node response stream errored while draining."))})}),Ai=async(e,t)=>{t.statusCode=e.status;const r=up(e.headers);if(r.length>0&&t.setHeader("set-cookie",r.length===1?r[0]:r),e.headers.forEach((s,o)=>{o.toLowerCase()!=="set-cookie"&&t.setHeader(o,s)}),!e.body){t.end();return}const n=e.body.getReader();for(;;){const{value:s,done:o}=await n.read();if(o)break;s&&!t.write(s)&&await fp(t)}t.end()},ki=(e,t={})=>async(r,n)=>{let s;try{s=await lp(r,t)}catch(o){if(o instanceof en){await Ai(new Response(o.message,{status:413}),n);return}throw o}await Ai(await Promise.resolve(e(s)),n)},dp=e=>{switch(nr()){case"node":return ki(e);case"bun":return Si(e);case"deno":return Ei(e);default:return wi(e)}},hp="http://localhost",mp={"<":"\\u003C",">":"\\u003E","&":"\\u0026","\u2028":"\\u2028","\u2029":"\\u2029"},pp=/[<>&\u2028\u2029]/g,vp=null,Ti="x-bquery-websocket-passthrough",yp=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ar=()=>Object.create(null),tn=e=>{if(!e)throw new Error(`route path must be a non-empty string; received ${String(e)}`);if(e==="*"||e==="/*")return"/*";const t=e.startsWith("/")?e:`/${e}`;return t.length>1&&t.endsWith("/")?t.slice(0,-1):t},Ri=e=>{const t=tn(e);if(t==="/*")return{path:t,paramNames:[],pattern:/^\/.*$/};const r=t.split("/").filter(Boolean);if(r.length===0)return{path:t,paramNames:[],pattern:/^\/$/};const n=[];let s="^";for(const[o,i]of r.entries()){if(s+="/",i==="*"){if(o!==r.length-1)throw new Error(`invalid route path: "*" must be the final segment in "${t}"`);s+=".*";break}if(i.startsWith(":")){const a=i.slice(1);if(!/^[A-Za-z_$][\w$]*$/.test(a))throw new Error(`invalid route param name: ${a} - must start with a letter, $, or _ and contain only word characters`);if(N(a))throw new Error(`invalid route param name: ${a} - reserved for object safety`);n.push(a),s+="([^/]+)";continue}s+=yp(i)}return s+="/?$",{path:t,paramNames:n,pattern:new RegExp(s)}},gp=e=>{if(typeof e>"u")return vp;const t=Array.isArray(e)?e:[e];if(t.length===0)throw new Error("route method must be specified - received empty array");const r=new Set(t.map(n=>n.trim().toUpperCase()).filter(Boolean));if(r.size===0)throw new Error(`route method must include at least one non-empty method string; received ${JSON.stringify(e)}`);return r},Ci=e=>{const t=ar();for(const[r,n]of e.searchParams.entries()){if(N(r))continue;const s=t[r];typeof s>"u"?t[r]=n:Array.isArray(s)?s.push(n):t[r]=[s,n]}return t},$i=(e,t)=>e instanceof URL?new URL(e.toString()):new URL(e,t),Oi=(e,t)=>{if(e instanceof Request)return e;if(typeof e=="string"||e instanceof URL)return new Request($i(e,t).toString());const{url:r,method:n="GET",headers:s,body:o=null}=e;return new Request($i(r,t).toString(),{method:n,headers:s,body:o})},bp=e=>typeof e>"u"?[]:[...new Set((Array.isArray(e)?e:[e]).map(t=>t.trim()).filter(Boolean))],wp=e=>{const t=e.data;if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Sp=e=>e.replace(pp,t=>mp[t]),He=e=>new Headers(e),rn=(e,t)=>(e.has("content-type")||e.set("content-type",t),e),Ce=(e,t={})=>{const{headers:r,...n}=t;return new Response(e,{...n,headers:He(r)})},Li=(e,t={})=>{const r=rn(He(t.headers),"text/plain; charset=utf-8");return Ce(e,{...t,headers:r})},nn=(e,t={})=>{const{trusted:r=!1,...n}=t,s=rn(He(n.headers),"text/html; charset=utf-8");return Ce(r?e:ie(e),{...n,headers:s})},Pi=(e,t={})=>{const r=rn(He(t.headers),"application/json; charset=utf-8");let n;try{n=JSON.stringify(e)??"null"}catch{n="null"}return Ce(Sp(n),{...t,headers:r})},Ni=(e,t=302)=>Ce(null,{headers:He({location:e.toString()}),status:t}),Ii=(e,t,r={})=>{const{includeStoreState:n=!1,status:s=200,headers:o,...i}=r,a=gt(e,t,{...i,includeStoreState:!1}),c=n?yt({storeIds:Array.isArray(n)?n:void 0}).scriptTag:"";return nn(`${a.html}${c}`,{headers:o,status:s,trusted:!0})},sn=e=>{if(e.method.toUpperCase()!=="GET")return!1;const t=e.headers.get("upgrade");if(typeof t!="string"||t.trim().toLowerCase()!=="websocket")return!1;const r=e.headers.get("connection");if(typeof r!="string"||!r.split(",").some(s=>s.trim().toLowerCase()==="upgrade")||e.headers.get("sec-websocket-version")?.trim()!=="13")return!1;const n=e.headers.get("sec-websocket-key")?.trim();return typeof n=="string"&&/^[A-Za-z0-9+/]{22}==$/.test(n)},Ep=e=>{if(typeof e!="object"||e===null||e instanceof Response)return!1;const t=e;return typeof t.open=="function"&&typeof t.message=="function"&&typeof t.close=="function"&&typeof t.error=="function"},Ap=()=>{const e=new WeakMap;return t=>{const r=e.get(t);if(r)return r;const n={get protocol(){return t.protocol},get readyState(){return t.readyState},get url(){return t.url},send(s){t.send(s)},sendJson(s){const o=JSON.stringify(s);if(typeof o!="string")throw new TypeError("socket.sendJson() does not support undefined values");t.send(o)},close(s,o){t.close(s,o)}};return e.set(t,n),n}},kp=(e,t)=>{const r=Ap(),n=t.deserialize??wp;return{context:e,protocols:bp(t.protocols),headers:t.headers,async open(s){t.onOpen&&await t.onOpen(r(s),e)},async message(s,o){t.onMessage&&await t.onMessage(n(o),r(s),e,o)},async close(s,o){t.onClose&&await t.onClose(o,r(s),e)},async error(s,o){t.onError&&await t.onError(o,r(s),e)}}},Tp=()=>Ce(null,{headers:He({[Ti]:"1"}),status:204}),Rp=e=>e.headers.get(Ti)==="1",Cp=(e,t,r)=>{if(e.methods&&!e.methods.has(t))return null;const n=e.pattern.exec(r);if(!n)return null;const s=ar();for(const[o,i]of e.paramNames.entries())try{s[i]=decodeURIComponent(n[o+1]??"")}catch(a){if(a instanceof URIError)return null;throw a}return s},Mi=(e,t,r,n)=>{for(const s of e){const o=Cp(s,t,r);if(o)return n.params=o,s}return null},$p=async(e,t,r)=>{const n=async s=>{const o=t[s];if(!o)return r();let i=!1;return await o(e,async()=>{if(i)throw new Error("middleware next() called multiple times - if a middleware calls next(), it may only do so once");return i=!0,await n(s+1)})};return await n(0)},Op=async(e,t,r)=>{const n=async s=>{const o=t[s];if(!o)return r();let i=!1;return await o(e,async()=>{if(i)throw new Error("middleware next() called multiple times - if a middleware calls next(), it may only do so once");return i=!0,await n(s+1)})};return await n(0)},Lp=e=>async(t,r)=>{let n=null,s=null;const o=await e(t,async()=>(n=await r(),n instanceof Response?(s=n,n):Tp()));return s?o:o instanceof Response&&Rp(o)?n:o},Di=e=>{const t=Ri(e.path);return{handler:e.handler,methods:gp(e.method),middlewares:e.middlewares??[],paramNames:t.paramNames,path:t.path,pattern:t.pattern}},Pp=(e={})=>{const t=e.baseUrl??hp,r=[...e.middlewares??[]],n=[],s=[],o=e.notFound??(u=>u.text("Not Found",{status:404})),i=e.onError??((u,h)=>u instanceof Response?u:h.text("Internal Server Error",{status:500})),a=(u,h,d,p)=>(n.push(Di({handler:d,method:u,middlewares:p,path:h})),l),c=(u,h,d)=>{const p=Ri(u);return s.push({handler:h,methods:new Set(["GET"]),middlewares:d??[],paramNames:p.paramNames,path:p.path,pattern:p.pattern}),l},l={use(u){return r.push(u),l},add(u){return n.push(Di(u)),l},get(u,h,d){return a("GET",u,h,d)},post(u,h,d){return a("POST",u,h,d)},put(u,h,d){return a("PUT",u,h,d)},patch(u,h,d){return a("PATCH",u,h,d)},delete(u,h,d){return a("DELETE",u,h,d)},all(u,h,d){return a(void 0,u,h,d)},ws(u,h,d){return c(u,h,d)},async handle(u){const h=Oi(u,t),d=new URL(h.url),p=h.method.toUpperCase(),f=tn(d.pathname||"/"),m=Ci(d),v={request:h,url:d,method:p,path:f,params:ar(),query:m,state:{},response:Ce,text:Li,html:nn,json:Pi,redirect:Ni,render:Ii,isWebSocketRequest:sn(h)};try{const b=Mi(n,p,f,v);return b?await $p(v,[...r,...b.middlewares,async g=>await b.handler(g)],async()=>await o(v)):await o(v)}catch(b){return await i(b,v)}},async handleWebSocket(u){const h=Oi(u,t),d=new URL(h.url),p=h.method.toUpperCase(),f=tn(d.pathname||"/"),m=Ci(d),v={request:h,url:d,method:p,path:f,params:ar(),query:m,state:{},response:Ce,text:Li,html:nn,json:Pi,redirect:Ni,render:Ii,isWebSocketRequest:sn(h)};if(!v.isWebSocketRequest)return null;try{const b=Mi(s,p,f,v);return b?await Op(v,[...r.map(Lp),...b.middlewares],async()=>kp(v,typeof b.handler=="function"?await b.handler(v):b.handler)):null}catch(b){return await i(b,v)}}};return l};y.$=sa,y.$$=oa,y.BQueryCollection=Ct,y.BQueryElement=Ne,y.BqLinkElement=Bs,y.Computed=Je,y.HYDRATION_HASH_ATTR=Kt,y.HttpError=ye,y.Signal=Ge,y.TaskWorkerAbortError=ge,y.TaskWorkerError=H,y.TaskWorkerSerializationError=Ae,y.TaskWorkerTimeoutError=Pt,y.TaskWorkerUnsupportedError=Sr,y.animate=jt,y.announceToScreenReader=Uf,y.auditA11y=Yf,y.back=su,y.batch=Se,y.batchTasks=Gc,y.bool=pl,y.breakpoints=bd,y.buckets=jl,y.cache=Hl,y.callWorkerMethod=Fc,y.capturePosition=Cr,y.clearAnnouncements=Hf,y.clearTimeline=Kd,y.clipboard=Od,y.component=Me,y.computed=D,y.configureSSR=uh,y.createAssetManager=ii,y.createBunHandler=Si,y.createDenoHandler=Ei,y.createForm=bf,y.createHeadManager=oi,y.createHttp=yr,y.createI18n=qf,y.createNodeHandler=ki,y.createPersistedStore=Fu,y.createReactiveRpcPool=sl,y.createReactiveRpcWorker=rl,y.createReactiveTaskPool=nl,y.createReactiveTaskWorker=tl,y.createRequestQueue=Ec,y.createRestClient=Lc,y.createResumableState=np,y.createRouter=ku,y.createRpcPool=ns,y.createRpcWorker=It,y.createSSRContext=wt,y.createSSRHandler=dp,y.createSSRRouterContext=Zm,y.createServer=Pp,y.createStore=Pr,y.createTaskPool=_t,y.createTaskWorker=Mt,y.createTemplate=pf,y.createTrustedHtml=Ji,y.createUseFetch=cc,y.createWebHandler=wi,y.currentRoute=Us,y.custom=If,y.customAsync=Mf,y.deduplicateRequest=Nc,y.defer=lm,y.defineBqueryConfig=Ua,y.defineComponent=fl,y.defineLoader=cm,y.definePageMeta=Gl,y.defineStore=_u,y.deserializeStoreState=Yh,y.destroyStore=Mu,y.detectRuntime=nr,y.draggable=cd,y.droppable=pd,y.easeInCubic=Os,y.easeInOutCubic=Ps,y.easeInOutQuad=$s,y.easeInQuad=Rs,y.easeOutBack=Ns,y.easeOutCubic=Ls,y.easeOutExpo=Is,y.easeOutQuad=Cs,y.easingPresets=El,y.effect=j,y.effectScope=Ba,y.email=Of,y.enableDevtools=Ud,y.escapeHtml=En,y.every=us,y.filter=cs,y.find=fs,y.fireEvent=ch,y.flip=$r,y.flipElements=Ms,y.flipList=Al,y.flushEffects=Uo,y.formatDate=vo,y.formatNumber=po,y.forward=ou,y.generateNonce=bn,y.generateSignalLabel=Bd,y.getBqueryConfig=ae,y.getConcurrencySupport=Yn,y.getCurrentScope=Mn,y.getCustomDirective=qd,y.getCustomDirectives=zd,y.getDevtoolsState=Yd,y.getFocusableElements=xr,y.getInstalledPlugins=xd,y.getSSRConfig=fh,y.getSSRRuntimeFeatures=am,y.getStore=we,y.getTimeline=Vd,y.getTrustedTypesPolicy=Sn,y.hasCSPDirective=Ki,y.html=De,y.http=Sc,y.hydrateIsland=Nm,y.hydrateMount=Ho,y.hydrateOnIdle=Om,y.hydrateOnInteraction=Lm,y.hydrateOnMedia=Pm,y.hydrateOnVisible=$m,y.hydrateStore=Zo,y.hydrateStoreSnapshot=tp,y.hydrateStores=Jh,y.inspectComponents=qo,y.inspectSignals=_o,y.inspectStores=xo,y.interceptLinks=fu,y.isActive=wu,y.isActiveSignal=Su,y.isBrowserRuntime=im,y.isComputed=ce,y.isConcurrencySupported=Er,y.isDevtoolsEnabled=Hd,y.isInstalled=_d,y.isNavigating=ru,y.isServerRuntime=om,y.isServerWebSocketSession=Ep,y.isSignal=G,y.isTrustedTypesSupported=Yi,y.isWebSocketRequest=sn,y.keyframePresets=kl,y.linear=Ts,y.link=uu,y.linkedSignal=Ac,y.listStores=Wt,y.logComponents=Xd,y.logSignals=Jd,y.logStores=Gd,y.logTimeline=Zd,y.map=as,y.mapActions=zu,y.mapGetters=qu,y.mapState=xu,y.matchField=Df,y.max=Nf,y.maxLength=Cf,y.mediaQuery=gd,y.min=Pf,y.minLength=Rf,y.mockRouter=ah,y.mockSignal=nh,y.morphElement=Tl,y.mount=Dr,y.navigate=nt,y.notifications=Kl,y.onScopeDispose=Dn,y.parallax=Rl,y.parallel=Jc,y.pattern=$f,y.persistedSignal=Rc,y.pipeline=el,y.prefersColorScheme=Jf,y.prefersContrast=Gf,y.prefersReducedMotion=le,y.readStoreSnapshot=rp,y.readonly=_,y.recordEvent=Qd,y.reduce=ds,y.registerBqLink=lu,y.registerDefaultComponents=wl,y.registerPlugin=Pu,y.releaseFocus=od,y.renderComponent=rh,y.renderToResponse=Rm,y.renderToStream=km,y.renderToStreamSuspense=Gm,y.renderToString=gt,y.renderToStringAsync=Jr,y.required=Tf,y.resetPlugins=jd,y.resolve=bu,y.resolveSSRRoute=pi,y.resumeState=sp,y.rovingTabIndex=Xf,y.runRouteLoaders=vi,y.runTask=Xn,y.safeHtml=vl,y.sanitize=ie,y.sanitizeHtml=ie,y.scrollAnimate=$l,y.sequence=Dl,y.serializeStoreSnapshot=ep,y.serializeStoreState=yt,y.setReducedMotion=Sl,y.signal=L,y.skipLink=rd,y.some=ls,y.sortable=yd,y.spring=Ll,y.springPresets=Pl,y.stagger=Nl,y.storage=tu,y.stripTags=Gi,y.timeline=_l,y.toValue=Ic,y.trackSignal=Wd,y.transition=xl,y.trapFocus=sd,y.trusted=Bi,y.typewriter=ql,y.untrack=Ee,y.untrackSignal=Fd,y.url=Lf,y.use=Dd,y.useAnnouncer=Jl,y.useAsyncData=xn,y.useBattery=Ad,y.useComputed=al,y.useCookie=Vl,y.useDeviceMotion=Cd,y.useDeviceOrientation=$d,y.useEffect=cl,y.useEventSource=qc,y.useFetch=re,y.useFormField=Ef,y.useGeolocation=kd,y.useInfiniteFetch=Tc,y.useIntersectionObserver=Pd,y.useMutationObserver=Id,y.useNetworkStatus=Sd,y.usePaginatedFetch=kc,y.usePolling=Cc,y.useResizeObserver=Nd,y.useResource=$c,y.useResourceList=Pc,y.useRoute=Ru,y.useSignal=il,y.useSubmit=Oc,y.useViewport=wd,y.useWebSocket=Qn,y.useWebSocketChannel=xc,y.utils=_a,y.verifyHydration=Im,y.waitFor=lh,y.watch=br,y.watchDebounce=Mc,y.watchStore=Bu,y.watchThrottle=Dc});
192
280
 
193
281
  //# sourceMappingURL=full.umd.js.map