@bquery/bquery 1.6.0 → 1.7.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.
- package/README.md +716 -586
- package/dist/a11y/announce.d.ts +43 -0
- package/dist/a11y/announce.d.ts.map +1 -0
- package/dist/a11y/audit.d.ts +42 -0
- package/dist/a11y/audit.d.ts.map +1 -0
- package/dist/a11y/index.d.ts +53 -0
- package/dist/a11y/index.d.ts.map +1 -0
- package/dist/a11y/media-preferences.d.ts +77 -0
- package/dist/a11y/media-preferences.d.ts.map +1 -0
- package/dist/a11y/roving-tab-index.d.ts +38 -0
- package/dist/a11y/roving-tab-index.d.ts.map +1 -0
- package/dist/a11y/skip-link.d.ts +37 -0
- package/dist/a11y/skip-link.d.ts.map +1 -0
- package/dist/a11y/trap-focus.d.ts +49 -0
- package/dist/a11y/trap-focus.d.ts.map +1 -0
- package/dist/a11y/types.d.ts +152 -0
- package/dist/a11y/types.d.ts.map +1 -0
- package/dist/a11y-C5QOVvRn.js +421 -0
- package/dist/a11y-C5QOVvRn.js.map +1 -0
- package/dist/a11y.es.mjs +14 -0
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/html.d.ts.map +1 -1
- package/dist/component/index.d.ts +2 -1
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/library.d.ts.map +1 -1
- package/dist/component/scope.d.ts +138 -0
- package/dist/component/scope.d.ts.map +1 -0
- package/dist/component/types.d.ts +53 -1
- package/dist/component/types.d.ts.map +1 -1
- package/dist/component-CuuTijA6.js +684 -0
- package/dist/component-CuuTijA6.js.map +1 -0
- package/dist/component.es.mjs +9 -6
- package/dist/{config-DRmZZno3.js → config-BW35FKuA.js} +4 -4
- package/dist/{config-DRmZZno3.js.map → config-BW35FKuA.js.map} +1 -1
- package/dist/constraints-3lV9yyBw.js +100 -0
- package/dist/constraints-3lV9yyBw.js.map +1 -0
- package/dist/core/collection.d.ts +48 -0
- package/dist/core/collection.d.ts.map +1 -1
- package/dist/core/element.d.ts +92 -0
- package/dist/core/element.d.ts.map +1 -1
- package/dist/core/env.d.ts +18 -0
- package/dist/core/env.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/shared.d.ts +8 -0
- package/dist/core/shared.d.ts.map +1 -1
- package/dist/core/utils/index.d.ts +52 -41
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core-Cjl7GUu8.js +717 -0
- package/dist/core-Cjl7GUu8.js.map +1 -0
- package/dist/core-DnlyjbF2.js +112 -0
- package/dist/core-DnlyjbF2.js.map +1 -0
- package/dist/core.es.mjs +45 -44
- package/dist/custom-directives-7wAShnnd.js +9 -0
- package/dist/custom-directives-7wAShnnd.js.map +1 -0
- package/dist/devtools/devtools.d.ts +212 -0
- package/dist/devtools/devtools.d.ts.map +1 -0
- package/dist/devtools/index.d.ts +20 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/types.d.ts +69 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools-D2fQLhDN.js +122 -0
- package/dist/devtools-D2fQLhDN.js.map +1 -0
- package/dist/devtools.es.mjs +19 -0
- package/dist/dnd/draggable.d.ts +51 -0
- package/dist/dnd/draggable.d.ts.map +1 -0
- package/dist/dnd/droppable.d.ts +38 -0
- package/dist/dnd/droppable.d.ts.map +1 -0
- package/dist/dnd/index.d.ts +47 -0
- package/dist/dnd/index.d.ts.map +1 -0
- package/dist/dnd/sortable.d.ts +43 -0
- package/dist/dnd/sortable.d.ts.map +1 -0
- package/dist/dnd/types.d.ts +250 -0
- package/dist/dnd/types.d.ts.map +1 -0
- package/dist/dnd-B8EgyzaI.js +244 -0
- package/dist/dnd-B8EgyzaI.js.map +1 -0
- package/dist/dnd.es.mjs +6 -0
- package/dist/env-NeVmr4Gf.js +19 -0
- package/dist/env-NeVmr4Gf.js.map +1 -0
- package/dist/forms/create-form.d.ts +49 -0
- package/dist/forms/create-form.d.ts.map +1 -0
- package/dist/forms/index.d.ts +39 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/types.d.ts +139 -0
- package/dist/forms/types.d.ts.map +1 -0
- package/dist/forms/validators.d.ts +179 -0
- package/dist/forms/validators.d.ts.map +1 -0
- package/dist/forms-C3yovgH9.js +141 -0
- package/dist/forms-C3yovgH9.js.map +1 -0
- package/dist/forms.es.mjs +14 -0
- package/dist/full.d.ts +35 -7
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +182 -91
- package/dist/full.iife.js +47 -31
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +47 -31
- package/dist/full.umd.js.map +1 -1
- package/dist/i18n/formatting.d.ts +40 -0
- package/dist/i18n/formatting.d.ts.map +1 -0
- package/dist/i18n/i18n.d.ts +48 -0
- package/dist/i18n/i18n.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +57 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/translate.d.ts +83 -0
- package/dist/i18n/translate.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +156 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n-BnnhTFOS.js +89 -0
- package/dist/i18n-BnnhTFOS.js.map +1 -0
- package/dist/i18n.es.mjs +6 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.mjs +227 -136
- package/dist/media/battery.d.ts +35 -0
- package/dist/media/battery.d.ts.map +1 -0
- package/dist/media/breakpoints.d.ts +51 -0
- package/dist/media/breakpoints.d.ts.map +1 -0
- package/dist/media/clipboard.d.ts +30 -0
- package/dist/media/clipboard.d.ts.map +1 -0
- package/dist/media/device-sensors.d.ts +54 -0
- package/dist/media/device-sensors.d.ts.map +1 -0
- package/dist/media/geolocation.d.ts +38 -0
- package/dist/media/geolocation.d.ts.map +1 -0
- package/dist/media/index.d.ts +42 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/media-query.d.ts +36 -0
- package/dist/media/media-query.d.ts.map +1 -0
- package/dist/media/network.d.ts +35 -0
- package/dist/media/network.d.ts.map +1 -0
- package/dist/media/types.d.ts +173 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/viewport.d.ts +32 -0
- package/dist/media/viewport.d.ts.map +1 -0
- package/dist/media-Di2Ta22s.js +340 -0
- package/dist/media-Di2Ta22s.js.map +1 -0
- package/dist/media.es.mjs +12 -0
- package/dist/motion/index.d.ts +7 -3
- package/dist/motion/index.d.ts.map +1 -1
- package/dist/motion/morph.d.ts +27 -0
- package/dist/motion/morph.d.ts.map +1 -0
- package/dist/motion/parallax.d.ts +30 -0
- package/dist/motion/parallax.d.ts.map +1 -0
- package/dist/motion/reduced-motion.d.ts +36 -3
- package/dist/motion/reduced-motion.d.ts.map +1 -1
- package/dist/motion/types.d.ts +58 -0
- package/dist/motion/types.d.ts.map +1 -1
- package/dist/motion/typewriter.d.ts +31 -0
- package/dist/motion/typewriter.d.ts.map +1 -0
- package/dist/motion-qPj_TYGv.js +530 -0
- package/dist/motion-qPj_TYGv.js.map +1 -0
- package/dist/motion.es.mjs +27 -23
- package/dist/{view-C70lA3vf.js → mount-SM07RUa6.js} +166 -160
- package/dist/mount-SM07RUa6.js.map +1 -0
- package/dist/{object-qGpWr6-J.js → object-BCk-1c8T.js} +5 -4
- package/dist/{object-qGpWr6-J.js.map → object-BCk-1c8T.js.map} +1 -1
- package/dist/{platform-Dr9b6fsq.js → platform-CPbCprb6.js} +21 -22
- package/dist/{platform-Dr9b6fsq.js.map → platform-CPbCprb6.js.map} +1 -1
- package/dist/platform.es.mjs +2 -2
- package/dist/plugin/index.d.ts +22 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/registry.d.ts +108 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +110 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin-cPoOHFLY.js +64 -0
- package/dist/plugin-cPoOHFLY.js.map +1 -0
- package/dist/plugin.es.mjs +9 -0
- package/dist/reactive/computed.d.ts +7 -0
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive-Cfv0RK6x.js +233 -0
- package/dist/reactive-Cfv0RK6x.js.map +1 -0
- package/dist/reactive.es.mjs +19 -20
- package/dist/registry-CWf368tT.js +26 -0
- package/dist/registry-CWf368tT.js.map +1 -0
- package/dist/router/bq-link.d.ts +112 -0
- package/dist/router/bq-link.d.ts.map +1 -0
- package/dist/router/constraints.d.ts +9 -0
- package/dist/router/constraints.d.ts.map +1 -0
- package/dist/router/index.d.ts +14 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/match.d.ts +0 -1
- package/dist/router/match.d.ts.map +1 -1
- package/dist/router/path-pattern.d.ts +14 -0
- package/dist/router/path-pattern.d.ts.map +1 -0
- package/dist/router/query.d.ts.map +1 -1
- package/dist/router/router.d.ts +3 -1
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/types.d.ts +48 -4
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/use-route.d.ts +50 -0
- package/dist/router/use-route.d.ts.map +1 -0
- package/dist/router/utils.d.ts +3 -0
- package/dist/router/utils.d.ts.map +1 -1
- package/dist/router-BrthaP_z.js +473 -0
- package/dist/router-BrthaP_z.js.map +1 -0
- package/dist/router.es.mjs +13 -10
- package/dist/{sanitize-Bs2dkMby.js → sanitize-B1V4JswB.js} +2 -1
- package/dist/{sanitize-Bs2dkMby.js.map → sanitize-B1V4JswB.js.map} +1 -1
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security.es.mjs +1 -1
- package/dist/ssr/hydrate.d.ts +65 -0
- package/dist/ssr/hydrate.d.ts.map +1 -0
- package/dist/ssr/index.d.ts +59 -0
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/render.d.ts +62 -0
- package/dist/ssr/render.d.ts.map +1 -0
- package/dist/ssr/serialize.d.ts +118 -0
- package/dist/ssr/serialize.d.ts.map +1 -0
- package/dist/ssr/types.d.ts +70 -0
- package/dist/ssr/types.d.ts.map +1 -0
- package/dist/ssr-B2qd_WBB.js +248 -0
- package/dist/ssr-B2qd_WBB.js.map +1 -0
- package/dist/ssr.es.mjs +9 -0
- package/dist/store/create-store.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/persisted.d.ts +38 -4
- package/dist/store/persisted.d.ts.map +1 -1
- package/dist/store/types.d.ts +138 -1
- package/dist/store/types.d.ts.map +1 -1
- package/dist/store/utils.d.ts +2 -2
- package/dist/store/utils.d.ts.map +1 -1
- package/dist/store-DWpyH6p5.js +338 -0
- package/dist/store-DWpyH6p5.js.map +1 -0
- package/dist/store.es.mjs +11 -10
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/storybook.es.mjs +1 -1
- package/dist/storybook.es.mjs.map +1 -1
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/testing.d.ts +156 -0
- package/dist/testing/testing.d.ts.map +1 -0
- package/dist/testing/types.d.ts +134 -0
- package/dist/testing/types.d.ts.map +1 -0
- package/dist/testing-CsqjNUyy.js +224 -0
- package/dist/testing-CsqjNUyy.js.map +1 -0
- package/dist/testing.es.mjs +9 -0
- package/dist/type-guards-Do9DWgNp.js +44 -0
- package/dist/type-guards-Do9DWgNp.js.map +1 -0
- package/dist/untrack-DJVQQ2WM.js +33 -0
- package/dist/untrack-DJVQQ2WM.js.map +1 -0
- package/dist/view/custom-directives.d.ts +20 -0
- package/dist/view/custom-directives.d.ts.map +1 -0
- package/dist/view/evaluate.d.ts.map +1 -1
- package/dist/view/process.d.ts.map +1 -1
- package/dist/view.es.mjs +9 -9
- package/package.json +177 -141
- package/src/a11y/announce.ts +131 -0
- package/src/a11y/audit.ts +314 -0
- package/src/a11y/index.ts +68 -0
- package/src/a11y/media-preferences.ts +255 -0
- package/src/a11y/roving-tab-index.ts +164 -0
- package/src/a11y/skip-link.ts +255 -0
- package/src/a11y/trap-focus.ts +184 -0
- package/src/a11y/types.ts +183 -0
- package/src/component/component.ts +104 -29
- package/src/component/html.ts +5 -5
- package/src/component/index.ts +2 -0
- package/src/component/library.ts +26 -2
- package/src/component/scope.ts +212 -0
- package/src/component/types.ts +94 -40
- package/src/core/collection.ts +707 -628
- package/src/core/element.ts +981 -774
- package/src/core/env.ts +60 -0
- package/src/core/index.ts +49 -48
- package/src/core/shared.ts +62 -13
- package/src/core/utils/index.ts +148 -83
- package/src/devtools/devtools.ts +410 -0
- package/src/devtools/index.ts +48 -0
- package/src/devtools/types.ts +104 -0
- package/src/dnd/draggable.ts +296 -0
- package/src/dnd/droppable.ts +228 -0
- package/src/dnd/index.ts +62 -0
- package/src/dnd/sortable.ts +307 -0
- package/src/dnd/types.ts +293 -0
- package/src/forms/create-form.ts +278 -0
- package/src/forms/index.ts +65 -0
- package/src/forms/types.ts +154 -0
- package/src/forms/validators.ts +265 -0
- package/src/full.ts +253 -2
- package/src/i18n/formatting.ts +67 -0
- package/src/i18n/i18n.ts +200 -0
- package/src/i18n/index.ts +67 -0
- package/src/i18n/translate.ts +182 -0
- package/src/i18n/types.ts +171 -0
- package/src/index.ts +108 -36
- package/src/media/battery.ts +116 -0
- package/src/media/breakpoints.ts +131 -0
- package/src/media/clipboard.ts +80 -0
- package/src/media/device-sensors.ts +158 -0
- package/src/media/geolocation.ts +119 -0
- package/src/media/index.ts +76 -0
- package/src/media/media-query.ts +92 -0
- package/src/media/network.ts +115 -0
- package/src/media/types.ts +177 -0
- package/src/media/viewport.ts +84 -0
- package/src/motion/index.ts +57 -48
- package/src/motion/morph.ts +151 -0
- package/src/motion/parallax.ts +120 -0
- package/src/motion/reduced-motion.ts +66 -17
- package/src/motion/types.ts +271 -208
- package/src/motion/typewriter.ts +164 -0
- package/src/plugin/index.ts +37 -0
- package/src/plugin/registry.ts +269 -0
- package/src/plugin/types.ts +137 -0
- package/src/reactive/computed.ts +130 -92
- package/src/router/bq-link.ts +279 -0
- package/src/router/constraints.ts +201 -0
- package/src/router/index.ts +49 -41
- package/src/router/match.ts +312 -106
- package/src/router/path-pattern.ts +52 -0
- package/src/router/query.ts +38 -35
- package/src/router/router.ts +402 -211
- package/src/router/types.ts +139 -93
- package/src/router/use-route.ts +68 -0
- package/src/router/utils.ts +157 -116
- package/src/security/index.ts +2 -7
- package/src/security/sanitize.ts +70 -70
- package/src/security/trusted-html.ts +71 -71
- package/src/ssr/hydrate.ts +82 -0
- package/src/ssr/index.ts +70 -0
- package/src/ssr/render.ts +508 -0
- package/src/ssr/serialize.ts +296 -0
- package/src/ssr/types.ts +81 -0
- package/src/store/create-store.ts +467 -329
- package/src/store/define-store.ts +49 -49
- package/src/store/index.ts +27 -22
- package/src/store/mapping.ts +74 -74
- package/src/store/persisted.ts +206 -19
- package/src/store/types.ts +157 -2
- package/src/store/utils.ts +135 -141
- package/src/store/watch.ts +53 -53
- package/src/storybook/index.ts +2 -1
- package/src/testing/index.ts +42 -0
- package/src/testing/testing.ts +593 -0
- package/src/testing/types.ts +170 -0
- package/src/view/custom-directives.ts +30 -0
- package/src/view/evaluate.ts +292 -290
- package/src/view/process.ts +108 -92
- package/dist/component-BEQgt5hl.js +0 -600
- package/dist/component-BEQgt5hl.js.map +0 -1
- package/dist/core-BGQJVw0-.js +0 -35
- package/dist/core-BGQJVw0-.js.map +0 -1
- package/dist/core-CCEabVHl.js +0 -648
- package/dist/core-CCEabVHl.js.map +0 -1
- package/dist/effect-AFRW_Plg.js +0 -84
- package/dist/effect-AFRW_Plg.js.map +0 -1
- package/dist/motion-D9TcHxOF.js +0 -415
- package/dist/motion-D9TcHxOF.js.map +0 -1
- package/dist/reactive-DSkct0dO.js +0 -254
- package/dist/reactive-DSkct0dO.js.map +0 -1
- package/dist/router-CbDhl8rS.js +0 -188
- package/dist/router-CbDhl8rS.js.map +0 -1
- package/dist/store-BwDvI45q.js +0 -263
- package/dist/store-BwDvI45q.js.map +0 -1
- package/dist/untrack-B0rVscTc.js +0 -7
- package/dist/untrack-B0rVscTc.js.map +0 -1
- package/dist/view-C70lA3vf.js.map +0 -1
package/dist/full.umd.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(h,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(h=typeof globalThis<"u"?globalThis:h||self,U(h.bQuery={}))})(this,function(h){Object.defineProperty(h,Symbol.toStringTag,{value:"Module"});var U="bquery-sanitizer",zt=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"]),qe=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),Bt=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"]),Ut=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),Ft=["on","formaction","xlink:","xmlns:"],Wt=["javascript:","data:","vbscript:","file:"],xt=(e,t,r)=>{const n=e.toLowerCase();for(const s of Ft)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},Qt=e=>{const t=e.toLowerCase().trim();return!Bt.has(t)},Vt=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(),je=e=>{const t=Vt(e);for(const r of Wt)if(t.startsWith(r))return!1;return!0},Kt=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!je(n))return!1}return!0},Jt=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}},Gt=e=>new DOMParser().parseFromString(e,"text/html"),Ie=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=Gt(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},ne=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:i=!1}=t,a=new Set([...zt,...r.map(u=>u.toLowerCase())].filter(u=>!qe.has(u))),o=new Set([...Ut,...n.map(u=>u.toLowerCase())]),c=Ie(e);if(i)return c.textContent??"";const l=document.createTreeWalker(c,NodeFilter.SHOW_ELEMENT),d=[];for(;l.nextNode();){const u=l.currentNode,p=u.tagName.toLowerCase();if(qe.has(p)){d.push(u);continue}if(!a.has(p)){d.push(u);continue}const v=[];for(const g of Array.from(u.attributes)){const b=g.name.toLowerCase();if(!xt(b,o,s)){v.push(g.name);continue}if((b==="id"||b==="name")&&!Qt(g.value)){v.push(g.name);continue}if((b==="href"||b==="src"||b==="action")&&!je(g.value)){v.push(g.name);continue}b==="srcset"&&!Kt(g.value)&&v.push(g.name)}for(const g of v)u.removeAttribute(g);if(p==="a"){const g=u.getAttribute("href"),b=u.getAttribute("target")?.toLowerCase()==="_blank",E=g&&Jt(g);if(b||E){const D=u.getAttribute("rel"),P=new Set(D?D.split(/\s+/).filter(Boolean):[]);P.add("noopener"),P.add("noreferrer"),u.setAttribute("rel",Array.from(P).join(" "))}}}for(const u of d)u.remove();const m=u=>{const p=document.createElement("div");return p.appendChild(u.cloneNode(!0)),p.innerHTML},y=m(c),f=m(Ie(y));return y!==f?c.textContent??"":f},He=Symbol("bquery.trusted-html.brand"),we=Symbol("bquery.trusted-html"),ze=e=>e,Yt=e=>{const t=String(e);return Object.freeze({[He]:!0,[we]:t,toString:()=>t})},Zt=e=>typeof e=="object"&&e!==null&&He in e&&we in e,Xt=e=>e[we],Be=1024,Ue=8192,er=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>Be)throw new RangeError(`generateNonce length must not exceed ${Be}`);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+=Ue){const s=t.subarray(n,Math.min(n+Ue,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},tr=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},se=null,Fe=!1,rr=()=>typeof window<"u"&&typeof window.trustedTypes<"u",We=()=>{if(se)return se;if(Fe||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;Fe=!0;try{return se=e.trustedTypes.createPolicy(U,{createHTML:t=>ne(t)}),se}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${U}": ${r}`),null}},nr=e=>{const t=We();return t?t.createHTML(e):ne(e)},j=(e,t={})=>ze(ne(e,t)),xe=e=>{const t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};return e.replace(/[&<>"'`]/g,r=>t[r])},sr=e=>ne(e,{stripAllTags:!0}),Qe=e=>Array.isArray(e)?e:[e],S=(e,t)=>{for(const r of e)t(r)},Ve=e=>j(e),ir=(e,t)=>{e.innerHTML=j(t)},Ke=e=>{const t=document.createElement("template");return t.innerHTML=j(e),t.content.firstElementChild??document.createElement("div")},Je=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,j(t));return}const n=Qe(t);S(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})},F=class De{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 ir(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"?Ke(t):t;return this.element.replaceWith(r),new De(r)}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 De(this.element.cloneNode(t))}find(t){return Array.from(this.element.querySelectorAll(t))}findOne(t){return this.element.querySelector(t)}closest(t){return this.element.closest(t)}parent(){return this.element.parentElement}children(){return Array.from(this.element.children)}siblings(){const t=this.element.parentElement;return t?Array.from(t.children).filter(r=>r!==this.element):[]}next(){return this.element.nextElementSibling}prev(){return this.element.previousElementSibling}on(t,r){return this.element.addEventListener(t,r),this}once(t,r){return this.element.addEventListener(t,r,{once:!0}),this}off(t,r){return this.element.removeEventListener(t,r),this}trigger(t,r){return this.element.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0})),this}delegate(t,r,n){const s=`${t}:${r}`,i=a=>{const o=a.target.closest(r);o&&this.element.contains(o)&&n(a,o)};return this.delegatedHandlers.has(s)||this.delegatedHandlers.set(s,new Map),this.delegatedHandlers.get(s).set(n,i),this.element.addEventListener(t,i),this}undelegate(t,r,n){const s=`${t}:${r}`,i=this.delegatedHandlers.get(s);if(i){const a=i.get(n);a&&(this.element.removeEventListener(t,a),i.delete(n),i.size===0&&this.delegatedHandlers.delete(s))}return this}matches(t){return this.element.matches(t)}is(t){return this.matches(t)}hasClass(t){return this.element.classList.contains(t)}show(t=""){return this.element.removeAttribute("hidden"),this.element.style.display=t,this}hide(){return this.element.style.display="none",this}toggle(t){const r=this.element.style.display==="none";return t??r?this.show():this.hide()}focus(){return this.element.focus(),this}blur(){return this.element.blur(),this}val(t){const r=this.element;return t===void 0?r.value??"":(r.value=t,this)}serialize(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return{};const r={},n=new FormData(t);for(const[s,i]of n.entries())if(typeof i=="string")if(s in r){const a=r[s];Array.isArray(a)?a.push(i):r[s]=[a,i]}else r[s]=i;return r}serializeString(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return"";const r=new FormData(t),n=new URLSearchParams;for(const[s,i]of r.entries())typeof i=="string"&&n.append(s,i);return n.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){Je(this.element,t,r)}},ie=class be{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 F(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 F(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new be(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new F(t))}addClass(...t){return S(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return S(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return S(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(S(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return S(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return S(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??"":(S(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=Ve(t);return S(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return S(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 S(this.elements,i=>{i.style.setProperty(t,r)}),this;const n=this.first();if(!n)return"";const s=n.ownerDocument?.defaultView;return!s||typeof s.getComputedStyle!="function"?"":s.getComputedStyle(n).getPropertyValue(t)}return S(this.elements,n=>{for(const[s,i]of Object.entries(t))n.style.setProperty(s,i)}),this}wrap(t){return this.elements.forEach((r,n)=>{const s=typeof t=="string"?document.createElement(t):n===0?t:t.cloneNode(!0);r.parentNode?.insertBefore(s,r),s.appendChild(r)}),this}unwrap(){const t=new Set;for(const r of this.elements)r.parentElement&&t.add(r.parentElement);return t.forEach(r=>{const n=r.parentNode;if(n){for(;r.firstChild;)n.insertBefore(r.firstChild,r);r.remove()}}),this}replaceWith(t){const r=[];return this.elements.forEach((n,s)=>{const i=typeof t=="string"?Ke(t):s===0?t:t.cloneNode(!0);n.replaceWith(i),r.push(i)}),new be(r)}show(t=""){return S(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return S(this.elements,t=>{t.style.display="none"}),this}on(t,r){return S(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return S(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return S(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return S(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return S(this.elements,i=>{const a=c=>{const l=c.target.closest(r);l&&i.contains(l)&&n(c,l)};this.delegatedHandlers.has(i)||this.delegatedHandlers.set(i,new Map);const o=this.delegatedHandlers.get(i);o.has(s)||o.set(s,new Map),o.get(s).set(n,a),i.addEventListener(t,a)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return S(this.elements,i=>{const a=this.delegatedHandlers.get(i);if(!a)return;const o=a.get(s);if(!o)return;const c=o.get(n);c&&(i.removeEventListener(t,c),o.delete(n),o.size===0&&a.delete(s),a.size===0&&this.delegatedHandlers.delete(i))}),this}find(t){const r=new Set,n=[];for(const s of this.elements){const i=s.querySelectorAll(t);for(let a=0;a<i.length;a++)r.has(i[a])||(r.add(i[a]),n.push(i[a]))}return new be(n)}remove(){return S(this.elements,t=>t.remove()),this}empty(){return S(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=Ve(t);S(this.elements,i=>{i.insertAdjacentHTML(r,s)});return}const n=Qe(t);this.elements.forEach((s,i)=>{Je(s,i===0?n:n.map(a=>a.cloneNode(!0)),r)})}},ar=e=>{if(typeof e!="string")return new F(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new F(t)},or=e=>Array.isArray(e)?new ie(e):e instanceof NodeList?new ie(Array.from(e)):new ie(Array.from(document.querySelectorAll(e)));function cr(e){return e==null?[]:Array.isArray(e)?e:[e]}function lr(e){return Array.from(new Set(e))}function ur(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 fr(e){return e.filter(Boolean)}function dr(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function hr(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 mr(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function pr(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function yr(){}function gr(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function vr(e){return new Promise(t=>setTimeout(t,e))}function br(e,t){try{return JSON.parse(e)}catch{return t}}function wr(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 Sr(e,t){return Math.floor(Math.random()*(t-e+1))+e}function Er(e,t,r){return Math.min(Math.max(e,t),r)}function Ar(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function Cr(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function ae(e){return Object.prototype.toString.call(e)==="[object Object]"}function $r(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function kr(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function oe(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))$r(n)||(ae(s)&&ae(t[n])?t[n]=oe(t[n],s):t[n]=s);return t}function Tr(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function Or(e,t){const r={...e};for(const n of t)delete r[n];return r}function Rr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Mr(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Pr(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function Lr(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function Nr(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 _r(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function Dr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qr(e){return typeof Element<"u"&&e instanceof Element}function jr(e){return!!(e&&typeof e=="object"&&"elements"in e)}function Ir(e){return typeof e=="function"}function Hr(e){return typeof e=="string"}function zr(e){return typeof e=="number"&&!Number.isNaN(e)}function Br(e){return typeof e=="boolean"}function Ur(e){return Array.isArray(e)}function Fr(e){return e instanceof Date}function Wr(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function xr(e){return typeof e=="object"&&e!==null}var Qr={clone:kr,merge:oe,pick:Tr,omit:Or,hasOwn:Rr,debounce:hr,throttle:mr,once:pr,noop:yr,uid:gr,isElement:qr,isCollection:jr,isEmpty:wr,isPlainObject:ae,isFunction:Ir,isString:Hr,isNumber:zr,isBoolean:Br,isArray:Ur,isDate:Fr,isPromise:Wr,isObject:xr,parseJson:br,sleep:vr,randomInt:Sr,clamp:Er,inRange:Ar,toNumber:Cr,capitalize:Mr,toKebabCase:Pr,toCamelCase:Lr,truncate:Nr,slugify:_r,escapeRegExp:Dr,ensureArray:cr,unique:lr,chunk:ur,compact:fr,flatten:dr},W=[],X=0,Se=new Set,ce=new WeakMap,Ee=(e,t)=>{W.push(e);try{return t()}finally{W.pop()}},Ge=()=>W[W.length-1],Vr=e=>{W.push(void 0);try{return e()}finally{W.pop()}},Ye=e=>{if(X>0){Se.add(e);return}e()},Kr=()=>{for(const e of Array.from(Se)){Se.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},Jr=()=>{X+=1},Gr=()=>{X<=0||(X-=1,X===0&&Kr())},Ze=(e,t)=>{let r=ce.get(e);r||(r=new Set,ce.set(e,r)),r.add(t)},Yr=(e,t)=>{const r=ce.get(e);r&&r.delete(t)},le=e=>{const t=ce.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},ue=e=>{Jr();try{e()}finally{Gr()}},Xe={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"}},ee=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>ee(t));if(ae(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=ee(n);return t}return e},Ae=ee(Xe),Zr=e=>(Ae=ee(oe(Xe,Ae,e)),I()),I=()=>ee(Ae),Ce=class{constructor(e){this.compute=e,this.dirty=!0,this.subscribers=new Set,this.markDirty=()=>{this.dirty=!0;const t=Array.from(this.subscribers);for(const r of t)Ye(r)}}get value(){const e=Ge();return e&&(this.subscribers.add(e),Ze(e,this)),this.dirty&&(this.dirty=!1,le(this.markDirty),this.cachedValue=Ee(this.markDirty,this.compute)),this.cachedValue}peek(){return this.dirty&&(this.dirty=!1,le(this.markDirty),this.cachedValue=Ee(this.markDirty,this.compute)),this.cachedValue}unsubscribe(e){this.subscribers.delete(e)}},x=e=>new Ce(e),$=e=>{let t,r=!1;const n=()=>{if(t){try{t()}catch(i){console.error("bQuery reactive: Error in effect cleanup",i)}t=void 0}},s=()=>{if(!r){n(),le(s);try{t=Ee(s,e)}catch(i){console.error("bQuery reactive: Error in effect",i)}}};return s(),()=>{r=!0,n(),le(s)}},$e=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=Ge();return e&&(this.subscribers.add(e),Ze(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)Ye(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)Yr(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},M=e=>new $e(e),Q=e=>Vr(e),Xr=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))}},en=e=>typeof e=="function"?e():e.value,et=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},tn=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),rn=(e,t)=>e==null||tn(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),nn=e=>typeof e=="function"?e():e,sn=(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))}},an=(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)},on=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)}`)}},ke=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},cn=(e,t,r)=>{const n=t instanceof Request?ke(t.method):void 0;return e??n??(r?"POST":void 0)},ln=(e,t,r)=>e||(t instanceof Request?void 0:r),un=e=>{const t=ke(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}},tt=(e,t={})=>{const r=t.immediate??!0,n=M(t.defaultValue),s=M(null),i=M("idle"),a=x(()=>i.value==="pending");let o=0,c=!1,l=()=>{};const d=()=>{o+=1,n.value=t.defaultValue,s.value=null,i.value="idle"},m=()=>{c||(c=!0,o+=1,l())},y=async()=>{if(c)return n.peek();const f=++o;i.value="pending",s.value=null;try{const u=await e(),p=t.transform?t.transform(u):u;return c||f!==o?n.peek():(n.value=p,i.value="success",t.onSuccess?.(p),p)}catch(u){const p=Xr(u);return c||f!==o||(s.value=p,i.value="error",t.onError?.(p)),n.peek()}};if(t.watch?.length){let f=!1;l=$(()=>{for(const u of t.watch??[])en(u);if(!f){f=!0,r&&Q(()=>y());return}Q(()=>y())})}else r&&y();return{data:n,error:s,status:i,pending:a,execute:y,refresh:y,clear:d,dispose:m}},rt=(e,t={})=>{const r=I().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch;return tt(async()=>{const i=nn(e),a=typeof i=="string"||i instanceof URL?an(i,t.baseUrl??r?.baseUrl):i instanceof Request&&t.query?new URL(i.url):null;a&&t.query&&sn(a,t.query);const o=et(r?.headers,i instanceof Request?i.headers:void 0,t.headers),c=t.body!=null,l=ke(t.method),d=cn(l,i,c),m=d==="GET"||d==="HEAD"?d:null;if(c&&m)throw new Error(`Cannot send a request body with ${m} requests`);const y=ln(l,i,d),f={...t,method:y,headers:o,body:rn(t.body,o)};delete f.baseUrl,delete f.query,delete f.parseAs,delete f.fetcher,delete f.defaultValue,delete f.immediate,delete f.watch,delete f.transform,delete f.onSuccess,delete f.onError;let u=a??i;i instanceof Request&&a&&a.toString()!==i.url&&(u=new Request(a.toString(),un(i)));const p=await s(u,f);if(!p.ok)throw Object.assign(new Error(`Request failed with status ${p.status}`),{response:p,status:p.status,statusText:p.statusText});return on(p,n)},t)};function fn(e={}){return(t,r={})=>{const n=e,s=oe({},n.query??{},r.query??{});return rt(t,{...n,...r,headers:et(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var dn=(e,t)=>{const r=x(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},hn=(e,t)=>{let r=!1,n=null;try{if(n=globalThis.localStorage,n){const a=`__bquery_test_${Math.random().toString(36).slice(2,9)}__`,o="__test__";try{n.setItem(a,o),n.getItem(a),r=!0}finally{try{n.removeItem(a)}catch{}}}}catch{r=!1}let s=t;if(r&&n)try{const a=n.getItem(e);a!==null&&(s=JSON.parse(a))}catch{}const i=M(s);return r&&n&&$(()=>{try{n.setItem(e,JSON.stringify(i.value))}catch{}}),i},mn=e=>({get value(){return e.value},peek(){return e.peek()}}),fe=e=>e instanceof $e,nt=e=>e instanceof Ce,pn=(e,t,r={})=>{const{immediate:n=!1,equals:s=Object.is}=r;let i,a=!0;return $(()=>{const o=e.value;if(a){a=!1,i=o,n&&t(o,void 0);return}s(o,i)||(t(o,i),i=o)})},yn=(e,t)=>{const{type:r}=t;if(r===String)return e;if(r===Number)return Number(e);if(r===Boolean){const n=e.trim().toLowerCase();return n===""||n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:!!e}if(r===Object||r===Array)try{return JSON.parse(e)}catch{return e}if(typeof r=="function"){const n=r,s=r;if(t.construct===!0)return Reflect.construct(s,[e]);if(t.construct===!1)return n(e);const i=r.prototype!==void 0&&r.prototype!==null,a=(i?Object.getOwnPropertyNames(r.prototype):[]).length>1,o=i&&r.prototype.constructor!==r,c=/^class\s/.test(Function.prototype.toString.call(r));if(a||o||c)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const l=n(e);if(l===void 0&&i)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},gn=["slot"],vn=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],bn=(e,t)=>{const r=[...gn,...t.sanitize?.allowTags??[]],n=[...vn,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{});class i extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.missingRequiredProps=new Set,this.hasMounted=!1,this.attachShadow({mode:"open"}),this.syncProps()}static get observedAttributes(){return Object.keys(t.props??{})}connectedCallback(){try{if(!this.hasMounted&&this.missingRequiredProps.size>0)return;if(this.hasMounted){try{t.connected?.call(this)}catch(o){this.handleError(o)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(o){this.handleError(o)}}mount(){this.hasMounted||(t.beforeMount?.call(this),t.connected?.call(this),this.render(),this.setupSignalSubscriptions(),this.hasMounted=!0)}disconnectedCallback(){try{this.signalEffectCleanup?.(),this.signalEffectCleanup=void 0,t.disconnected?.call(this)}catch(o){this.handleError(o)}}attributeChangedCallback(o,c,l){try{const d=this.cloneProps();this.syncProps(),this.hasMounted?this.render(!0,d,{name:o,oldValue:c,newValue:l}):this.isConnected&&this.missingRequiredProps.size===0&&this.mount()}catch(d){this.handleError(d)}}handleError(o){t.onError?t.onError.call(this,o):console.error(`bQuery component error in <${e}>:`,o)}setState(o,c){this.state[o]=c,this.render(!0,this.cloneProps(),void 0,!1)}getState(o){return this.state[o]}setupSignalSubscriptions(o=!1){if(this.signalEffectCleanup||s.length===0)return;let c=!0;this.signalEffectCleanup=$(()=>{try{for(const d of s)d.value;if(c){if(c=!1,o&&this.hasMounted&&this.isConnected){const d=this.cloneProps();Q(()=>{this.render(!0,d,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const l=this.cloneProps();Q(()=>{this.render(!0,l,void 0,!1)})}catch(l){this.handleError(l)}})}syncProps(){const o=t.props??{};for(const[c,l]of Object.entries(o)){const d=this.getAttribute(c);let m;if(d==null?l.required&&l.default===void 0?(this.missingRequiredProps.add(c),m=void 0):m=l.default??void 0:(this.missingRequiredProps.has(c)&&this.missingRequiredProps.delete(c),m=yn(d,l)),l.validator&&m!==void 0&&!l.validator(m))throw new Error(`bQuery component: validation failed for prop "${c}" with value ${JSON.stringify(m)}`);this.props[c]=m}}cloneProps(){return{...this.props}}render(o=!1,c,l,d=!0){try{if(o&&d&&t.beforeUpdate){if(!c)throw new Error("bQuery component: previous props are required for update renders");if(t.beforeUpdate.call(this,this.props,c)===!1)return}const m=(u,p)=>{this.dispatchEvent(new CustomEvent(u,{detail:p,bubbles:!0,composed:!0}))};if(!this.shadowRoot)return;const y=j(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:m}),{allowTags:r,allowAttributes:n});let f=null;if(t.styles&&(f=this.shadowRoot.querySelector("style[data-bquery-component-style]")),this.shadowRoot.innerHTML=y,t.styles){const u=f??document.createElement("style");f||u.setAttribute("data-bquery-component-style",""),u.textContent=t.styles,this.shadowRoot.prepend(u)}o&&t.updated?.call(this,l)}catch(m){this.handleError(m)}}}return i};function V(e,t){const r=bn(e,t);customElements.get(e)||customElements.define(e,r)}var st=Symbol("bquery.booleanAttribute"),wn=/^[^\0-\x20"'/>=]+$/,it=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[st]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},at=e=>it(e)?e.enabled?e.name:"":String(e??""),Sn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},En=e=>it(e)?e.enabled?e.name:"":at(e).replace(/[&<>"'`]/g,t=>Sn[t]),An=(e,t)=>{if(!wn.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);const r={[st]:!0,enabled:!!t,name:e};return Object.freeze(r)},K=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${at(t[s])}`,""),Cn=(e,...t)=>{const r=n=>Zt(n)?Xt(n):En(n);return ze(e.reduce((n,s,i)=>`${n}${s}${i<t.length?r(t[i]):""}`,""))},de=`
|
|
1
|
+
(function(y,se){typeof exports=="object"&&typeof module<"u"?se(exports):typeof define=="function"&&define.amd?define(["exports"],se):(y=typeof globalThis<"u"?globalThis:y||self,se(y.bQuery={}))})(this,function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Module"});var se="bquery-sanitizer",$n=new Set(["a","abbr","address","article","aside","b","bdi","bdo","blockquote","br","button","caption","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","input","ins","kbd","label","legend","li","main","mark","nav","ol","optgroup","option","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","wbr"]),kt=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),kn=new Set(["document","window","location","top","self","parent","frames","history","navigator","screen","alert","confirm","prompt","eval","function","cookie","domain","referrer","body","head","forms","images","links","scripts","children","parentnode","firstchild","lastchild","innerhtml","outerhtml","textcontent"]),Ln=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),Tn=["on","formaction","xlink:","xmlns:"],Lt=["javascript:","data:","vbscript:","file:"],On=(e,t,r)=>{const n=e.toLowerCase();for(const s of Tn)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},Rn=e=>{const t=e.toLowerCase().trim();return!kn.has(t)},Mn=e=>e.replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),Tt=e=>{const t=Mn(e);for(const r of Lt)if(t.startsWith(r))return!1;return!0},Nn=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!Tt(n))return!1}return!0},_n=e=>{try{const t=e.trim();if(t.startsWith("//"))return!0;const r=t.toLowerCase();return/^[a-z][a-z0-9+.-]*:/i.test(t)&&!r.startsWith("http://")&&!r.startsWith("https://")?!0:!r.startsWith("http://")&&!r.startsWith("https://")?!1:typeof window>"u"||!window.location?!0:new URL(t,window.location.href).origin!==window.location.origin}catch{return!0}},Dn=e=>new DOMParser().parseFromString(e,"text/html"),Ot=e=>{const t=(typeof e=="string"?e:String(e??"")).trim(),r=document.createDocumentFragment();if(t.length===0)return r;if(!(t.includes("<")||t.includes(">")))return r.appendChild(document.createTextNode(t)),r;const n=Dn(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},De=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:i=!1}=t,o=new Set([...$n,...r.map(c=>c.toLowerCase())].filter(c=>!kt.has(c))),a=new Set([...Ln,...n.map(c=>c.toLowerCase())]),l=Ot(e);if(i)return l.textContent??"";const f=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT),u=[];for(;f.nextNode();){const c=f.currentNode,p=c.tagName.toLowerCase();if(kt.has(p)){u.push(c);continue}if(!o.has(p)){u.push(c);continue}const v=[];for(const b of Array.from(c.attributes)){const g=b.name.toLowerCase();if(!On(g,a,s)){v.push(b.name);continue}if((g==="id"||g==="name")&&!Rn(b.value)){v.push(b.name);continue}if((g==="href"||g==="src"||g==="action")&&!Tt(b.value)){v.push(b.name);continue}g==="srcset"&&!Nn(b.value)&&v.push(b.name)}for(const b of v)c.removeAttribute(b);if(p==="a"){const b=c.getAttribute("href"),g=c.getAttribute("target")?.toLowerCase()==="_blank",w=b&&_n(b);if(g||w){const S=c.getAttribute("rel"),M=new Set(S?S.split(/\s+/).filter(Boolean):[]);M.add("noopener"),M.add("noreferrer"),c.setAttribute("rel",Array.from(M).join(" "))}}}for(const c of u)c.remove();const m=c=>{const p=document.createElement("div");return p.appendChild(c.cloneNode(!0)),p.innerHTML},h=m(l),d=m(Ot(h));return h!==d?l.textContent??"":d},Rt=Symbol("bquery.trusted-html.brand"),Ye=Symbol("bquery.trusted-html"),Mt=e=>e,Pn=e=>{const t=String(e);return Object.freeze({[Rt]:!0,[Ye]:t,toString:()=>t})},In=e=>typeof e=="object"&&e!==null&&Rt in e&&Ye in e,qn=e=>e[Ye],Nt=1024,_t=8192,xn=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>Nt)throw new RangeError(`generateNonce length must not exceed ${Nt}`);if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function")throw new Error("generateNonce requires crypto.getRandomValues (not available in this environment)");if(typeof globalThis.btoa!="function")throw new Error("generateNonce requires btoa (not available in this environment)");const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);let r="";for(let n=0;n<t.length;n+=_t){const s=t.subarray(n,Math.min(n+_t,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},jn=e=>{if(typeof document>"u")return!1;const t=document.querySelector('meta[http-equiv="Content-Security-Policy"]');return t?(t.getAttribute("content")??"").includes(e):!1},Pe=null,Dt=!1,zn=()=>typeof window<"u"&&typeof window.trustedTypes<"u",Pt=()=>{if(Pe)return Pe;if(Dt||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;Dt=!0;try{return Pe=e.trustedTypes.createPolicy(se,{createHTML:t=>De(t)}),Pe}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${se}": ${r}`),null}},Fn=e=>{const t=Pt();return t?t.createHTML(e):De(e)},V=(e,t={})=>Mt(De(e,t)),It=e=>{const t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};return e.replace(/[&<>"'`]/g,r=>t[r])},Bn=e=>De(e,{stripAllTags:!0}),qt=e=>Array.isArray(e)?e:[e],_=(e,t)=>{for(const r of e)t(r)},he=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},Ie=(e,t,r)=>{if(!he(e))return 0;const n=t==="width"?e.offsetWidth:e.offsetHeight;if(!r)return n;const s=e.ownerDocument?.defaultView;if(!s||typeof s.getComputedStyle!="function")return n;const i=s.getComputedStyle(e),o=Number.parseFloat(i.getPropertyValue(t==="width"?"margin-left":"margin-top")),a=Number.parseFloat(i.getPropertyValue(t==="width"?"margin-right":"margin-bottom")),l=Number.isNaN(o)?0:o,f=Number.isNaN(a)?0:a;return n+l+f},xt=e=>V(e),Hn=(e,t)=>{e.innerHTML=V(t)},jt=e=>{const t=document.createElement("template");return t.innerHTML=V(e),t.content.firstElementChild??document.createElement("div")},zt=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,V(t));return}const n=qt(t);_(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})};function me(e){return Object.prototype.toString.call(e)==="[object Object]"}function I(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function Qn(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function pe(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))I(n)||(me(s)&&me(t[n])?t[n]=pe(t[n],s):t[n]=s);return t}function Un(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function Vn(e,t){const r={...e};for(const n of t)delete r[n];return r}function Wn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Kn=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},Ft=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!Kn(n))continue;const s=n.name;if(!(!s||n.disabled||I(s))){if(n.tagName.toLowerCase()==="input"){const i=n,o=i.type.toLowerCase();if(o==="checkbox"||o==="radio"){i.checked&&t.push([s,i.value]);continue}if(o==="file"||o==="submit"||o==="button"||o==="reset"||o==="image")continue;t.push([s,i.value]);continue}if(n.tagName.toLowerCase()==="select"){const i=n;if(i.multiple)for(const o of Array.from(i.selectedOptions))t.push([s,o.value]);else t.push([s,i.value]);continue}t.push([s,n.value])}}return t},Bt=e=>{if(typeof FormData=="function")try{const t=[];for(const[r,n]of new FormData(e).entries())I(r)||typeof n!="string"||t.push([r,n]);return t.length>0?t:Ft(e)}catch{}return Ft(e)},ie=class $t{constructor(t){this.element=t,this.delegatedHandlers=new Map}get raw(){return this.element}get node(){return this.element}addClass(...t){return this.element.classList.add(...t),this}removeClass(...t){return this.element.classList.remove(...t),this}toggleClass(t,r){return this.element.classList.toggle(t,r),this}attr(t,r){return r===void 0?this.element.getAttribute(t)??"":(this.element.setAttribute(t,r),this)}removeAttr(t){return this.element.removeAttribute(t),this}toggleAttr(t,r){const n=this.element.hasAttribute(t);return r??!n?this.element.setAttribute(t,""):this.element.removeAttribute(t),this}prop(t,r){return r===void 0?this.element[t]:(this.element[t]=r,this)}data(t,r){const n=t.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`);return r===void 0?this.element.getAttribute(`data-${n}`)??"":(this.element.setAttribute(`data-${n}`,r),this)}text(t){return t===void 0?this.element.textContent??"":(this.element.textContent=t,this)}html(t){return Hn(this.element,t),this}htmlUnsafe(t){return this.element.innerHTML=t,this}css(t,r){if(typeof t=="string"){if(r!==void 0)return this.element.style.setProperty(t,r),this;const n=this.element.ownerDocument?.defaultView;return!n||typeof n.getComputedStyle!="function"?"":n.getComputedStyle(this.element).getPropertyValue(t)}for(const[n,s]of Object.entries(t))this.element.style.setProperty(n,s);return this}append(t){return this.insertContent(t,"beforeend"),this}prepend(t){return this.insertContent(t,"afterbegin"),this}before(t){return this.insertContent(t,"beforebegin"),this}after(t){return this.insertContent(t,"afterend"),this}wrap(t){const r=typeof t=="string"?document.createElement(t):t;return this.element.parentNode?.insertBefore(r,this.element),r.appendChild(this.element),this}unwrap(){const t=this.element.parentElement;return t&&t.parentNode&&(t.parentNode.insertBefore(this.element,t),t.remove()),this}replaceWith(t){const r=typeof t=="string"?jt(t):t;return this.element.replaceWith(r),new $t(r)}detach(){return this.remove()}index(){const t=this.element.parentElement;return t?Array.from(t.children).indexOf(this.element):-1}contents(){return Array.from(this.element.childNodes)}offsetParent(){return he(this.element)?this.element.offsetParent:null}position(){if(!he(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}outerWidth(t=!1){return Ie(this.element,"width",t)}outerHeight(t=!1){return Ie(this.element,"height",t)}scrollTo(t={behavior:"smooth"}){return this.element.scrollIntoView(t),this}remove(){return this.element.remove(),this}empty(){return this.element.innerHTML="",this}clone(t=!0){return new $t(this.element.cloneNode(t))}find(t){return Array.from(this.element.querySelectorAll(t))}findOne(t){return this.element.querySelector(t)}closest(t){return this.element.closest(t)}parent(){return this.element.parentElement}children(){return Array.from(this.element.children)}siblings(){const t=this.element.parentElement;return t?Array.from(t.children).filter(r=>r!==this.element):[]}next(){return this.element.nextElementSibling}prev(){return this.element.previousElementSibling}on(t,r){return this.element.addEventListener(t,r),this}once(t,r){return this.element.addEventListener(t,r,{once:!0}),this}off(t,r){return this.element.removeEventListener(t,r),this}trigger(t,r){return this.element.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0})),this}delegate(t,r,n){const s=`${t}:${r}`,i=o=>{const a=o.target.closest(r);a&&this.element.contains(a)&&n(o,a)};return this.delegatedHandlers.has(s)||this.delegatedHandlers.set(s,new Map),this.delegatedHandlers.get(s).set(n,i),this.element.addEventListener(t,i),this}undelegate(t,r,n){const s=`${t}:${r}`,i=this.delegatedHandlers.get(s);if(i){const o=i.get(n);o&&(this.element.removeEventListener(t,o),i.delete(n),i.size===0&&this.delegatedHandlers.delete(s))}return this}matches(t){return this.element.matches(t)}is(t){return this.matches(t)}hasClass(t){return this.element.classList.contains(t)}show(t=""){return this.element.removeAttribute("hidden"),this.element.style.display=t,this}hide(){return this.element.style.display="none",this}toggle(t){const r=this.element.style.display==="none";return t??r?this.show():this.hide()}focus(){return this.element.focus(),this}blur(){return this.element.blur(),this}val(t){const r=this.element;return t===void 0?r.value??"":(r.value=t,this)}serialize(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return{};const r=Object.create(null);for(const[n,s]of Bt(t))if(Object.prototype.hasOwnProperty.call(r,n)){const i=r[n];Array.isArray(i)?i.push(s):r[n]=[i,s]}else r[n]=s;return r}serializeString(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return"";const r=new URLSearchParams;for(const[n,s]of Bt(t))r.append(n,s);return r.toString()}rect(){return this.element.getBoundingClientRect()}offset(){const t=this.element;return{width:t.offsetWidth,height:t.offsetHeight,top:t.offsetTop,left:t.offsetLeft}}insertContent(t,r){zt(this.element,t,r)}},qe=class Ke{constructor(t){this.elements=t,this.delegatedHandlers=new WeakMap}get length(){return this.elements.length}first(){return this.elements[0]}eq(t){const r=this.elements[t];return r?new ie(r):void 0}firstEl(){return this.eq(0)}lastEl(){return this.eq(this.elements.length-1)}each(t){return this.elements.forEach((r,n)=>{t(new ie(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new Ke(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new ie(t))}addClass(...t){return _(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return _(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return _(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(_(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return _(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return _(this.elements,n=>{const s=n.hasAttribute(t);r??!s?n.setAttribute(t,""):n.removeAttribute(t)}),this}text(t){return t===void 0?this.first()?.textContent??"":(_(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=xt(t);return _(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return _(this.elements,r=>{r.innerHTML=t}),this}append(t){return this.insertAll(t,"beforeend"),this}prepend(t){return this.insertAll(t,"afterbegin"),this}before(t){return this.insertAll(t,"beforebegin"),this}after(t){return this.insertAll(t,"afterend"),this}css(t,r){if(typeof t=="string"){if(r!==void 0)return _(this.elements,i=>{i.style.setProperty(t,r)}),this;const n=this.first();if(!n)return"";const s=n.ownerDocument?.defaultView;return!s||typeof s.getComputedStyle!="function"?"":s.getComputedStyle(n).getPropertyValue(t)}return _(this.elements,n=>{for(const[s,i]of Object.entries(t))n.style.setProperty(s,i)}),this}wrap(t){return this.elements.forEach((r,n)=>{const s=typeof t=="string"?document.createElement(t):n===0?t:t.cloneNode(!0);r.parentNode?.insertBefore(s,r),s.appendChild(r)}),this}unwrap(){const t=new Set;for(const r of this.elements)r.parentElement&&t.add(r.parentElement);return t.forEach(r=>{const n=r.parentNode;if(n){for(;r.firstChild;)n.insertBefore(r.firstChild,r);r.remove()}}),this}replaceWith(t){const r=[];return this.elements.forEach((n,s)=>{const i=typeof t=="string"?jt(t):s===0?t:t.cloneNode(!0);n.replaceWith(i),r.push(i)}),new Ke(r)}detach(){return this.remove()}index(){const t=this.first();return t?.parentElement?Array.from(t.parentElement.children).indexOf(t):-1}contents(){return Array.from(this.first()?.childNodes??[])}offsetParent(){const t=this.first();return he(t)?t.offsetParent:null}position(){const t=this.first();return he(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}outerWidth(t=!1){return Ie(this.first(),"width",t)}outerHeight(t=!1){return Ie(this.first(),"height",t)}show(t=""){return _(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return _(this.elements,t=>{t.style.display="none"}),this}on(t,r){return _(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return _(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return _(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return _(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return _(this.elements,i=>{const o=l=>{const f=l.target.closest(r);f&&i.contains(f)&&n(l,f)};this.delegatedHandlers.has(i)||this.delegatedHandlers.set(i,new Map);const a=this.delegatedHandlers.get(i);a.has(s)||a.set(s,new Map),a.get(s).set(n,o),i.addEventListener(t,o)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return _(this.elements,i=>{const o=this.delegatedHandlers.get(i);if(!o)return;const a=o.get(s);if(!a)return;const l=a.get(n);l&&(i.removeEventListener(t,l),a.delete(n),a.size===0&&o.delete(s),o.size===0&&this.delegatedHandlers.delete(i))}),this}find(t){const r=new Set,n=[];for(const s of this.elements){const i=s.querySelectorAll(t);for(let o=0;o<i.length;o++)r.has(i[o])||(r.add(i[o]),n.push(i[o]))}return new Ke(n)}remove(){return _(this.elements,t=>t.remove()),this}empty(){return _(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=xt(t);_(this.elements,i=>{i.insertAdjacentHTML(r,s)});return}const n=qt(t);this.elements.forEach((s,i)=>{zt(s,i===0?n:n.map(o=>o.cloneNode(!0)),r)})}},Yn=e=>{if(typeof e!="string")return new ie(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new ie(t)},Jn=e=>Array.isArray(e)?new qe(e):e instanceof NodeList?new qe(Array.from(e)):new qe(Array.from(document.querySelectorAll(e)));function Gn(e){return e==null?[]:Array.isArray(e)?e:[e]}function Xn(e){return Array.from(new Set(e))}function Zn(e,t){if(t<=0)return[];const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function es(e){return e.filter(Boolean)}function ts(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function rs(e,t){let r;return Object.assign((...n)=>{r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,e(...n)},t)},{cancel:()=>{r!==void 0&&(clearTimeout(r),r=void 0)}})}function ns(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function ss(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function is(){}function os(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function as(e){return new Promise(t=>setTimeout(t,e))}function ls(e,t){try{return JSON.parse(e)}catch{return t}}function cs(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function us(e,t){return Math.floor(Math.random()*(t-e+1))+e}function fs(e,t,r){return Math.min(Math.max(e,t),r)}function ds(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function hs(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function ms(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function ps(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function ys(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function gs(e,t,r="…"){if(t<=0)return"";if(e.length<=t)return e;const n=Math.max(0,t-r.length);return`${e.slice(0,n)}${r}`}function vs(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function bs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ws(e){return typeof Element<"u"&&e instanceof Element}function Es(e){return!!(e&&typeof e=="object"&&"elements"in e)}function Ss(e){return typeof e=="function"}function As(e){return typeof e=="string"}function Cs(e){return typeof e=="number"&&!Number.isNaN(e)}function $s(e){return typeof e=="boolean"}function ks(e){return Array.isArray(e)}function Ls(e){return e instanceof Date}function xe(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function Ts(e){return typeof e=="object"&&e!==null}var Os={clone:Qn,merge:pe,pick:Un,omit:Vn,hasOwn:Wn,debounce:rs,throttle:ns,once:ss,noop:is,uid:os,isElement:ws,isCollection:Es,isEmpty:cs,isPlainObject:me,isFunction:Ss,isString:As,isNumber:Cs,isBoolean:$s,isArray:ks,isDate:Ls,isPromise:xe,isObject:Ts,parseJson:ls,sleep:as,randomInt:us,clamp:fs,inRange:ds,toNumber:hs,capitalize:ms,toKebabCase:ps,toCamelCase:ys,truncate:gs,slugify:vs,escapeRegExp:bs,ensureArray:Gn,unique:Xn,chunk:Zn,compact:es,flatten:ts},oe=[],ye=0,Je=new Set,je=new WeakMap,Ge=(e,t)=>{oe.push(e);try{return t()}finally{oe.pop()}},Ht=()=>oe[oe.length-1],Xe=e=>{oe.push(void 0);try{return e()}finally{oe.pop()}},Qt=e=>{if(ye>0){Je.add(e);return}e()},Rs=()=>{for(const e of Array.from(Je)){Je.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},Ms=()=>{ye+=1},Ns=()=>{ye<=0||(ye-=1,ye===0&&Rs())},Ut=(e,t)=>{let r=je.get(e);r||(r=new Set,je.set(e,r)),r.add(t)},_s=(e,t)=>{const r=je.get(e);r&&r.delete(t)},ge=e=>{const t=je.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},ve=e=>{Ms();try{e()}finally{Ns()}},Vt={fetch:{headers:{},parseAs:"json"},cookies:{path:"/",sameSite:"Lax",secure:!1},announcer:{politeness:"polite",atomic:!0,delay:16,clearDelay:1e3},pageMeta:{},transitions:{skipOnReducedMotion:!1,classes:[],types:[]},components:{prefix:"bq"}},be=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>be(t));if(me(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=be(n);return t}return e},Ze=be(Vt),Ds=e=>(Ze=be(pe(Vt,Ze,e)),X()),X=()=>be(Ze),et=class{constructor(e){this.compute=e,this.hasCachedValue=!1,this.dirty=!0,this.disposed=!1,this.subscribers=new Set,this.markDirty=()=>{if(this.disposed)return;this.dirty=!0;const t=Array.from(this.subscribers);for(const r of t)Qt(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=Xe(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=Ht();return e&&(this.subscribers.add(e),Ut(e,this)),this.dirty&&(this.dirty=!1,ge(this.markDirty),this.cachedValue=Ge(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=Xe(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,ge(this.markDirty),this.cachedValue=Ge(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue)}unsubscribe(e){this.subscribers.delete(e)}dispose(){this.disposed=!0,this.dirty&&(this.hasCachedValue=!1),this.dirty=!1,ge(this.markDirty),this.subscribers.clear()}},q=e=>new et(e),x=e=>{let t,r=!1;const n=()=>{if(t){try{t()}catch(i){console.error("bQuery reactive: Error in effect cleanup",i)}t=void 0}},s=()=>{if(!r){n(),ge(s);try{t=Ge(s,e)}catch(i){console.error("bQuery reactive: Error in effect",i)}}};return s(),()=>{r=!0,n(),ge(s)}},tt=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=Ht();return e&&(this.subscribers.add(e),Ut(e,this)),this._value}set value(e){if(Object.is(this._value,e))return;this._value=e;const t=Array.from(this.subscribers);for(const r of t)Qt(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)_s(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},N=e=>new tt(e),ae=e=>Xe(e),Ps=e=>{if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);try{return new Error(JSON.stringify(e))}catch{return new Error(String(e))}},Is=e=>typeof e=="function"?e():e.value,Wt=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},qs=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),xs=(e,t)=>e==null||qs(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),js=e=>typeof e=="function"?e():e,zs=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},Fs=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return e instanceof URL?new URL(e.toString(),n):new URL(e,n)},Bs=async(e,t)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const r=await e.text();if(r)try{return JSON.parse(r)}catch(n){const s=e.url?` for ${e.url}`:"";throw new Error(`Failed to parse JSON response${s} (status ${e.status}): ${n instanceof Error?n.message:String(n)}`)}},rt=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},Hs=(e,t,r)=>{const n=t instanceof Request?rt(t.method):void 0;return e??n??(r?"POST":void 0)},Qs=(e,t,r)=>e||(t instanceof Request?void 0:r),Us=e=>{const t=rt(e.method);let r;if(t!=="GET"&&t!=="HEAD"&&!e.bodyUsed)try{r=e.clone().body??void 0}catch{r=void 0}return{method:t,headers:e.headers,body:r,cache:e.cache,credentials:e.credentials,integrity:e.integrity,keepalive:e.keepalive,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,signal:e.signal}},Kt=(e,t={})=>{const r=t.immediate??!0,n=N(t.defaultValue),s=N(null),i=N("idle"),o=q(()=>i.value==="pending");let a=0,l=!1,f=()=>{};const u=()=>{a+=1,n.value=t.defaultValue,s.value=null,i.value="idle"},m=()=>{l||(l=!0,a+=1,f())},h=async()=>{if(l)return n.peek();const d=++a;i.value="pending",s.value=null;try{const c=await e(),p=t.transform?t.transform(c):c;return l||d!==a?n.peek():(n.value=p,i.value="success",t.onSuccess?.(p),p)}catch(c){const p=Ps(c);return l||d!==a||(s.value=p,i.value="error",t.onError?.(p)),n.peek()}};if(t.watch?.length){let d=!1;f=x(()=>{for(const c of t.watch??[])Is(c);if(!d){d=!0,r&&ae(()=>h());return}ae(()=>h())})}else r&&h();return{data:n,error:s,status:i,pending:o,execute:h,refresh:h,clear:u,dispose:m}},Yt=(e,t={})=>{const r=X().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch;return Kt(async()=>{const i=js(e),o=typeof i=="string"||i instanceof URL?Fs(i,t.baseUrl??r?.baseUrl):i instanceof Request&&t.query?new URL(i.url):null;o&&t.query&&zs(o,t.query);const a=Wt(r?.headers,i instanceof Request?i.headers:void 0,t.headers),l=t.body!=null,f=rt(t.method),u=Hs(f,i,l),m=u==="GET"||u==="HEAD"?u:null;if(l&&m)throw new Error(`Cannot send a request body with ${m} requests`);const h=Qs(f,i,u),d={...t,method:h,headers:a,body:xs(t.body,a)};delete d.baseUrl,delete d.query,delete d.parseAs,delete d.fetcher,delete d.defaultValue,delete d.immediate,delete d.watch,delete d.transform,delete d.onSuccess,delete d.onError;let c=o??i;i instanceof Request&&o&&o.toString()!==i.url&&(c=new Request(o.toString(),Us(i)));const p=await s(c,d);if(!p.ok)throw Object.assign(new Error(`Request failed with status ${p.status}`),{response:p,status:p.status,statusText:p.statusText});return Bs(p,n)},t)};function Vs(e={}){return(t,r={})=>{const n=e,s=pe({},n.query??{},r.query??{});return Yt(t,{...n,...r,headers:Wt(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var Ws=(e,t)=>{const r=q(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},Ks=(e,t)=>{let r=!1,n=null;try{if(n=globalThis.localStorage,n){const o=`__bquery_test_${Math.random().toString(36).slice(2,9)}__`,a="__test__";try{n.setItem(o,a),n.getItem(o),r=!0}finally{try{n.removeItem(o)}catch{}}}}catch{r=!1}let s=t;if(r&&n)try{const o=n.getItem(e);o!==null&&(s=JSON.parse(o))}catch{}const i=N(s);return r&&n&&x(()=>{try{n.setItem(e,JSON.stringify(i.value))}catch{}}),i},H=e=>({get value(){return e.value},peek(){return e.peek()}}),we=e=>e instanceof tt,nt=e=>e instanceof et,Ys=(e,t,r={})=>{const{immediate:n=!1,equals:s=Object.is}=r;let i,o=!0;return x(()=>{const a=e.value;if(o){o=!1,i=a,n&&t(a,void 0);return}s(a,i)||(t(a,i),i=a)})},Js=(e,t)=>{const{type:r}=t;if(r===String)return e;if(r===Number)return Number(e);if(r===Boolean){const n=e.trim().toLowerCase();return n===""||n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:!!e}if(r===Object||r===Array)try{return JSON.parse(e)}catch{return e}if(typeof r=="function"){const n=r,s=r;if(t.construct===!0)return Reflect.construct(s,[e]);if(t.construct===!1)return n(e);const i=r.prototype!==void 0&&r.prototype!==null,o=(i?Object.getOwnPropertyNames(r.prototype):[]).length>1,a=i&&r.prototype.constructor!==r,l=/^class\s/.test(Function.prototype.toString.call(r));if(o||a||l)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const f=n(e);if(f===void 0&&i)try{return Reflect.construct(s,[e])}catch{return f}return f}catch(f){if(f instanceof TypeError&&/cannot be invoked without 'new'|is not a function/i.test(f.message))return Reflect.construct(s,[e]);throw f}}return e},st=()=>{try{const e=globalThis;if(typeof e.__BQUERY_DEV__=="boolean")return e.__BQUERY_DEV__;const t=e.process?.env?.NODE_ENV;if(typeof t=="string")return t!=="production";const r=e.process?.versions?.node;if(typeof r=="string"&&r.length>0)return!0;const n=e.process?.release?.name;return n==="node"||n==="io.js"}catch{return!1}},Ee;function Z(e){const t=Ee;return Ee=e,t}function Jt(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){st()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function Gs(e){const t=Ee;if(!t)throw new Error("bQuery component: useSignal() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=N(e);return t.addDisposer(()=>r.dispose()),r}function Xs(e){const t=Ee;if(!t)throw new Error("bQuery component: useComputed() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=q(e);return t.addDisposer(()=>r.dispose()),r}function Zs(e){const t=Ee;if(!t)throw new Error("bQuery component: useEffect() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=x(e);return t.addDisposer(r),r}var ei=["slot"],ti=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],Gt=(e,t)=>{const r=[...ei,...t.sanitize?.allowTags??[]],n=[...ti,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),o=(f=>f===!1?!1:f==="closed"?"closed":"open")(t.shadow),a=Array.from(new Set([...Object.keys(t.props??{}),...t.observeAttributes??[]]));class l extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.missingRequiredProps=new Set,this.hasMounted=!1,o!==!1?this.renderRootNode=this.attachShadow({mode:o}):this.renderRootNode=this,this.syncProps()}static get observedAttributes(){return a}connectedCallback(){try{if(!this.hasMounted&&this.missingRequiredProps.size>0)return;if(this.hasMounted){this.scope=Jt();const u=Z(this.scope);try{t.connected?.call(this)}catch(m){this.handleError(m)}finally{Z(u)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(u){this.handleError(u)}}mount(){if(this.hasMounted)return;const u=Z(this.ensureScope());let m=!1;try{t.beforeMount?.call(this),t.connected?.call(this)}catch(h){m=!0,this.handleError(h)}finally{Z(u)}if(m){this.scope?.dispose(),this.scope=void 0;return}this.render(),this.setupSignalSubscriptions(),this.hasMounted=!0}disconnectedCallback(){try{this.signalEffectCleanup?.(),this.signalEffectCleanup=void 0,this.scope?.dispose(),this.scope=void 0,t.disconnected?.call(this)}catch(u){this.handleError(u)}}attributeChangedCallback(u,m,h){try{const d=this.cloneProps();if(this.syncProps(),t.onAttributeChanged){const c=Z(this.ensureScope());try{t.onAttributeChanged.call(this,u,m,h)}finally{Z(c)}}this.hasMounted?this.render(!0,d,{name:u,oldValue:m,newValue:h}):this.isConnected&&this.missingRequiredProps.size===0&&this.mount()}catch(d){this.handleError(d)}}adoptedCallback(){if(!t.onAdopted)return;const u=Z(this.ensureScope());try{t.onAdopted.call(this)}catch(m){this.handleError(m)}finally{Z(u)}}handleError(u){t.onError?t.onError.call(this,u):console.error(`bQuery component error in <${e}>:`,u)}ensureScope(){return this.scope??(this.scope=Jt())}setState(u,m){this.state[u]=m,this.render(!0,this.cloneProps(),void 0,!1)}getState(u){return this.state[u]}setupSignalSubscriptions(u=!1){if(this.signalEffectCleanup||s.length===0)return;let m=!0;this.signalEffectCleanup=x(()=>{try{for(const d of s)d.value;if(m){if(m=!1,u&&this.hasMounted&&this.isConnected){const d=this.cloneProps();ae(()=>{this.render(!0,d,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const h=this.cloneProps();ae(()=>{this.render(!0,h,void 0,!1)})}catch(h){this.handleError(h)}})}syncProps(){const u=t.props??{};for(const[m,h]of Object.entries(u)){const d=this.getAttribute(m);let c;if(d==null?h.required&&h.default===void 0?(this.missingRequiredProps.add(m),c=void 0):c=h.default??void 0:(this.missingRequiredProps.has(m)&&this.missingRequiredProps.delete(m),c=Js(d,h)),h.validator&&c!==void 0&&!h.validator(c))throw new Error(`bQuery component: validation failed for prop "${m}" with value ${JSON.stringify(c)}`);this.props[m]=c}}cloneProps(){return{...this.props}}render(u=!1,m,h,d=!0){try{if(u&&d&&t.beforeUpdate){if(!m)throw new Error("bQuery component: previous props are required for update renders");if(t.beforeUpdate.call(this,this.props,m)===!1)return}const c=(g,w)=>{this.dispatchEvent(new CustomEvent(g,{detail:w,bubbles:!0,composed:!0}))},p=this.renderRootNode,v=V(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:c}),{allowTags:r,allowAttributes:n});let b=null;if(t.styles&&(b=p.querySelector("style[data-bquery-component-style]")),p.innerHTML=v,t.styles){const g=b??document.createElement("style");b||g.setAttribute("data-bquery-component-style",""),g.textContent=t.styles,p.prepend(g)}u&&t.updated?.call(this,h)}catch(c){this.handleError(c)}}}return l};function ri(e,t){return Gt(e,t)}function le(e,t){const r=Gt(e,t);customElements.get(e)||customElements.define(e,r)}var Xt=Symbol("bquery.booleanAttribute"),ni=/^[^\0-\x20"'/>=]+$/,Zt=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[Xt]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},er=e=>Zt(e)?e.enabled?e.name:"":String(e??""),si={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},ii=e=>Zt(e)?e.enabled?e.name:"":er(e).replace(/[&<>"'`]/g,t=>si[t]),oi=(e,t)=>{if(!ni.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[Xt]:!0,enabled:!!t,name:e})},ce=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${er(t[s])}`,""),ai=(e,...t)=>{const r=n=>In(n)?qn(n):ii(n);return Mt(e.reduce((n,s,i)=>`${n}${s}${i<t.length?r(t[i]):""}`,""))},ze=`
|
|
2
2
|
:host {
|
|
3
3
|
color: inherit;
|
|
4
4
|
font: inherit;
|
|
5
5
|
}
|
|
6
|
-
`,
|
|
7
|
-
${
|
|
6
|
+
`,tr=`
|
|
7
|
+
${ze}
|
|
8
8
|
.field {
|
|
9
9
|
display: inline-flex;
|
|
10
10
|
flex-direction: column;
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
color: #94a3b8;
|
|
39
39
|
cursor: not-allowed;
|
|
40
40
|
}
|
|
41
|
-
`,
|
|
42
|
-
${
|
|
41
|
+
`,z=e=>It(e),it=new WeakMap,ot=(e,t)=>it.get(e)?.[t],at=(e,t,r)=>{const n=it.get(e)??{};n[t]=r,it.set(e,n)},li=(e,t,r)=>{if(r.label!==t.label||r.type!==t.type||r.placeholder!==t.placeholder||r.name!==t.name||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("input.control");return!s||s.type!==t.type||s.placeholder!==t.placeholder||s.name!==t.name||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},ci=(e,t,r)=>{if(r.label!==t.label||r.placeholder!==t.placeholder||r.name!==t.name||r.rows!==t.rows||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("textarea.control");return!s||s.placeholder!==t.placeholder||s.name!==t.name||Number(s.rows)!==t.rows||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},ui=e=>["<textarea",' part="control"',' class="control"',` placeholder="${z(e.placeholder)}"`,` name="${z(e.name)}"`,` rows="${e.rows}"`,e.disabled?" disabled":"",`>${z(e.value)}</textarea>`].join(""),fi=(e={})=>{const t=e.prefix??X().components?.prefix??"bq",r={button:`${t}-button`,card:`${t}-card`,input:`${t}-input`,textarea:`${t}-textarea`,checkbox:`${t}-checkbox`};return le(r.button,{props:{label:{type:String,default:""},variant:{type:String,default:"primary"},size:{type:String,default:"md"},type:{type:String,default:"button"},disabled:{type:Boolean,default:!1}},styles:`
|
|
42
|
+
${ze}
|
|
43
43
|
button {
|
|
44
44
|
appearance: none;
|
|
45
45
|
border: 0;
|
|
@@ -76,18 +76,18 @@
|
|
|
76
76
|
cursor: not-allowed;
|
|
77
77
|
opacity: 0.6;
|
|
78
78
|
}
|
|
79
|
-
`,render:({props:n})=>
|
|
79
|
+
`,render:({props:n})=>ce`
|
|
80
80
|
<button
|
|
81
81
|
part="button"
|
|
82
|
-
type="${
|
|
83
|
-
data-variant="${
|
|
84
|
-
data-size="${
|
|
82
|
+
type="${z(n.type)}"
|
|
83
|
+
data-variant="${z(n.variant)}"
|
|
84
|
+
data-size="${z(n.size)}"
|
|
85
85
|
${n.disabled?"disabled":""}
|
|
86
86
|
>
|
|
87
|
-
<slot>${
|
|
87
|
+
<slot>${z(n.label)}</slot>
|
|
88
88
|
</button>
|
|
89
|
-
`}),
|
|
90
|
-
${
|
|
89
|
+
`}),le(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
|
|
90
|
+
${ze}
|
|
91
91
|
article {
|
|
92
92
|
background: #fff;
|
|
93
93
|
border: 1px solid #e2e8f0;
|
|
@@ -111,37 +111,37 @@
|
|
|
111
111
|
footer {
|
|
112
112
|
margin-top: 0.75rem;
|
|
113
113
|
}
|
|
114
|
-
`,render:({props:n})=>
|
|
114
|
+
`,render:({props:n})=>ce`
|
|
115
115
|
<article part="card" data-elevated="${String(n.elevated)}">
|
|
116
|
-
${n.title?`<header part="header">${
|
|
116
|
+
${n.title?`<header part="header">${z(n.title)}</header>`:""}
|
|
117
117
|
<section part="body"><slot></slot></section>
|
|
118
|
-
${n.footer?`<footer part="footer">${
|
|
118
|
+
${n.footer?`<footer part="footer">${z(n.footer)}</footer>`:""}
|
|
119
119
|
</article>
|
|
120
|
-
`}),
|
|
120
|
+
`}),le(r.input,{props:{label:{type:String,default:""},type:{type:String,default:"text"},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},disabled:{type:Boolean,default:!1}},styles:tr,beforeUpdate(n,s){return!li(this,n,s)},connected(){const n=s=>{const i=s.target;i?.matches("input")&&(s.stopPropagation(),this.setAttribute("value",i.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:i.value},bubbles:!0,composed:!0})))};at(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=ot(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ce`
|
|
121
121
|
<label part="field" class="field">
|
|
122
|
-
${n.label?`<span part="label" class="label">${
|
|
122
|
+
${n.label?`<span part="label" class="label">${z(n.label)}</span>`:""}
|
|
123
123
|
<input
|
|
124
124
|
part="control"
|
|
125
125
|
class="control"
|
|
126
|
-
type="${
|
|
127
|
-
value="${
|
|
128
|
-
placeholder="${
|
|
129
|
-
name="${
|
|
126
|
+
type="${z(n.type)}"
|
|
127
|
+
value="${z(n.value)}"
|
|
128
|
+
placeholder="${z(n.placeholder)}"
|
|
129
|
+
name="${z(n.name)}"
|
|
130
130
|
${n.disabled?"disabled":""}
|
|
131
131
|
/>
|
|
132
132
|
</label>
|
|
133
|
-
`}),
|
|
133
|
+
`}),le(r.textarea,{props:{label:{type:String,default:""},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},rows:{type:Number,default:4},disabled:{type:Boolean,default:!1}},styles:`${tr}
|
|
134
134
|
textarea.control {
|
|
135
135
|
min-height: 6rem;
|
|
136
136
|
resize: vertical;
|
|
137
137
|
}
|
|
138
|
-
`,beforeUpdate(n,s){return!
|
|
138
|
+
`,beforeUpdate(n,s){return!ci(this,n,s)},connected(){const n=s=>{const i=s.target;i?.matches("textarea")&&(s.stopPropagation(),this.setAttribute("value",i.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:i.value},bubbles:!0,composed:!0})))};at(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=ot(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>ce`
|
|
139
139
|
<label part="field" class="field">
|
|
140
|
-
${n.label?`<span part="label" class="label">${
|
|
141
|
-
${
|
|
140
|
+
${n.label?`<span part="label" class="label">${z(n.label)}</span>`:""}
|
|
141
|
+
${ui(n)}
|
|
142
142
|
</label>
|
|
143
|
-
`}),
|
|
144
|
-
${
|
|
143
|
+
`}),le(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
|
|
144
|
+
${ze}
|
|
145
145
|
label {
|
|
146
146
|
align-items: center;
|
|
147
147
|
color: #0f172a;
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
input:disabled {
|
|
158
158
|
cursor: not-allowed;
|
|
159
159
|
}
|
|
160
|
-
`,connected(){const n=s=>{const i=s.target;i?.matches('input[type="checkbox"]')&&(s.stopPropagation(),i.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:i.checked},bubbles:!0,composed:!0})))};
|
|
160
|
+
`,connected(){const n=s=>{const i=s.target;i?.matches('input[type="checkbox"]')&&(s.stopPropagation(),i.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:i.checked},bubbles:!0,composed:!0})))};at(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=ot(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>ce`
|
|
161
161
|
<label part="label">
|
|
162
162
|
<input
|
|
163
163
|
part="control"
|
|
@@ -165,13 +165,29 @@
|
|
|
165
165
|
${n.checked?"checked":""}
|
|
166
166
|
${n.disabled?"disabled":""}
|
|
167
167
|
/>
|
|
168
|
-
<span part="text"><slot>${
|
|
168
|
+
<span part="text"><slot>${z(n.label)}</slot></span>
|
|
169
169
|
</label>
|
|
170
|
-
`}),r},he=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,ct=e=>typeof e=="string"||typeof e=="number",lt=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),J=(e,t)=>{const r=e.style;if(Array.isArray(t)){const n=t[t.length-1];if(!n)return;for(const[s,i]of Object.entries(n))if(!(s==="offset"||s==="easing"||s==="composite")&&ct(i)){const a=s.startsWith("--")?s:lt(s);r.setProperty(a,String(i))}return}for(const[n,s]of Object.entries(t)){if(n==="offset"||n==="easing"||n==="composite")continue;const i=Array.isArray(s)?s[s.length-1]:s;if(ct(i)){const a=n.startsWith("--")?n:lt(n);r.setProperty(a,String(i))}}},me=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:i=!0,onFinish:a}=t;if(i&&he())return s&&J(e,r),a?.(),Promise.resolve();const o=e;return typeof o.animate!="function"?(s&&J(e,r),a?.(),Promise.resolve()):new Promise(c=>{const l=o.animate(r,n);let d=!1;const m=()=>{d||(d=!0,s&&(typeof l.commitStyles=="function"?l.commitStyles():J(e,r)),l.cancel(),a?.(),c())};l.onfinish=m,l.finished&&l.finished.then(m).catch(m)})},_=e=>Math.min(1,Math.max(0,e)),ut=e=>_(e),ft=e=>_(e*e),dt=e=>_(1-(1-e)*(1-e)),ht=e=>_(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),mt=e=>_(e*e*e),pt=e=>_(1-Math.pow(1-e,3)),yt=e=>_(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),gt=e=>_(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),vt=e=>_(e===1?1:1-Math.pow(2,-10*e)),Rn={linear:ut,easeInQuad:ft,easeOutQuad:dt,easeInOutQuad:ht,easeInCubic:mt,easeOutCubic:pt,easeInOutCubic:yt,easeOutBack:gt,easeOutExpo:vt},Me=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},Pe=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:i}=r,a=Me(e);if(a.width===0||a.height===0)return i?.(),Promise.resolve();const o=t.left-a.left,c=t.top-a.top,l=t.width/a.width,d=t.height/a.height;if(o===0&&c===0&&l===1&&d===1)return i?.(),Promise.resolve();const m=e;return typeof m.animate!="function"?(i?.(),Promise.resolve()):(m.style.transform=`translate(${o}px, ${c}px) scale(${l}, ${d})`,m.style.transformOrigin="top left",m.offsetHeight,new Promise(y=>{const f=m.animate([{transform:`translate(${o}px, ${c}px) scale(${l}, ${d})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let u=!1;const p=()=>{u||(u=!0,m.style.transform="",m.style.transformOrigin="",i?.(),y())};f.onfinish=p,f.finished&&f.finished.then(p).catch(p)}))},Mn=async(e,t,r={})=>{await bt(e,t,r)},bt=async(e,t,r={})=>{const{stagger:n,...s}=r,i=new Map;for(const c of e)i.set(c,Me(c));t();const a=e.length,o=e.map((c,l)=>{const d=i.get(c);if(!d)return Promise.resolve();const m=n?n(l,a):0;return m>0?new Promise(y=>setTimeout(y,m)).then(()=>Pe(c,d,s)):Pe(c,d,s)});await Promise.all(o)},Pn={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)"}]},Ln=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),Nn=(e,t)=>{const r=Ln(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:i,once:a=!0,onEnter:o,...c}=t;if(typeof IntersectionObserver>"u")return r.forEach(d=>{o?.(d),me(d,c)}),()=>{};const l=new IntersectionObserver(d=>{d.forEach(m=>{if(!m.isIntersecting)return;const y=m.target;o?.(y),me(y,c),a&&l.unobserve(y)})},{root:n,rootMargin:s,threshold:i});return r.forEach(d=>l.observe(d)),()=>l.disconnect()},_n={stiffness:100,damping:10,mass:1,precision:.01},Dn=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:i}={..._n,...t};let a=e,o=0,c=e,l=null,d=null,m=null;const y=new Set,f=()=>{for(const p of y)p(a)},u=p=>{const v=m!==null?(p-m)/1e3:.016666666666666666,g=Math.min(v,1/30);m=p;const b=a-c,E=(-r*b+-n*o)/s;if(o+=E*g,a+=o*g,f(),Math.abs(o)<i&&Math.abs(b)<i){a=c,o=0,l=null,f(),d?.(),d=null;return}l=requestAnimationFrame(u)};return{to(p){return c=p,l!==null&&cancelAnimationFrame(l),d?.(),m=null,new Promise(v=>{d=v,l=requestAnimationFrame(u)})},current(){return a},stop(){l!==null&&(cancelAnimationFrame(l),l=null),o=0,m=null,d?.(),d=null},onChange(p){return y.add(p),()=>y.delete(p)}}},qn={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},jn=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(i,a=0)=>{const o=typeof n=="number"?n:n==="center"?(a-1)/2:n==="end"?a-1:0,c=Math.abs(i-o),l=a>1?Math.max(o,a-1-o):1,d=l===0?0:c/l;return r+(s?s(d)*l:c)*e}},Le=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},In=(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},Hn=e=>{const t=Le(e?.duration),r=Le(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},wt=e=>{let t=0;return e.map(r=>{const n=In(r.at,t),s=Le(r.options?.delay),i=Math.max(0,n+s),a=Hn(r.options),o=i+a;return t=Math.max(t,o),{step:r,start:i,end:o,duration:a}})},zn=async(e,t={})=>{const{stagger:r,onFinish:n}=t,s=e.length;for(let i=0;i<e.length;i+=1){const a=e[i],o=r?r(i,s):0;o>0&&await new Promise(c=>setTimeout(c,o)),await me(a.target,a)}n?.()},Bn=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],i=0,a=!1,o=!1;const{commitStyles:c=!0,respectReducedMotion:l=!0,onFinish:d}=t,m=()=>{if(!o){if(o=!0,c)for(const f of s){const{animation:u,step:p}=f;typeof u.commitStyles=="function"?u.commitStyles():J(p.target,p.keyframes),u.cancel()}n.forEach(f=>f()),d?.()}},y=()=>{s.forEach(({animation:u})=>u.cancel()),s=[],o=!1;const f=wt(r);if(i=f.length?Math.max(...f.map(u=>u.end)):0,l&&he()){c&&f.forEach(({step:u})=>J(u.target,u.keyframes)),a=!0;return}if(f.some(({step:u})=>typeof u.target.animate!="function")){c&&f.forEach(({step:u})=>J(u.target,u.keyframes)),a=!0;return}a=!1,s=f.map(({step:u,start:p})=>{const{delay:v,...g}=u.options??{};return{animation:u.target.animate(u.keyframes,{...g,delay:p,fill:g.fill??"both"}),step:u,start:p}})};return{add(f){r.push(f)},duration(){if(!r.length)return 0;if(!s.length){const f=wt(r);return Math.max(...f.map(u=>u.end))}return i},async play(){if(y(),a||s.length===0){m();return}const f=s.map(u=>u.animation.finished.catch(()=>{}));await Promise.all(f),m()},pause(){a||s.forEach(({animation:f})=>f.pause())},resume(){a||s.forEach(({animation:f})=>f.play())},stop(){s.forEach(({animation:f})=>f.cancel()),s=[],a=!1},seek(f){a||s.forEach(({animation:u})=>{u.currentTime=f})},onFinish(f){return n.add(f),()=>n.delete(f)}}},St=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Un=async e=>{const t=I().transitions,r=typeof e=="function"?{update:e,classes:t?.classes,types:t?.types,skipOnReducedMotion:t?.skipOnReducedMotion}:{...e,classes:e.classes??t?.classes,types:e.types??t?.types,skipOnReducedMotion:e.skipOnReducedMotion??t?.skipOnReducedMotion},n=r.update;if(typeof document>"u"){await n();return}const s=document,i=document.documentElement,a=St(r.classes),o=St(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&he()){await n(),r.onFinish?.();return}a.forEach(c=>i.classList.add(c));try{const c=s.startViewTransition(()=>n()),l=c.types;if(l)for(const d of o)l.add(d);await c.ready,r.onReady?.(),await c.finished,r.onFinish?.()}finally{a.forEach(c=>i.classList.remove(c))}},Fn=class{constructor(e){this.bucketName=e,this.dbPromise=null,this.storeName="blobs"}openDB(){if(this.dbPromise)return this.dbPromise;const e=`bquery-bucket-${this.bucketName}`;return this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)},n.onsuccess=()=>t(n.result),n.onerror=()=>r(n.error)}),this.dbPromise}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const i=t(r.transaction(this.storeName,e).objectStore(this.storeName));i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async put(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},Wn={async open(e){return new Fn(e)}},xn=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)}},Qn={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new xn(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},Vn=e=>{if(typeof document>"u")return null;const t=`${encodeURIComponent(e)}=`,r=document.cookie?document.cookie.split(";"):[];for(const n of r){const s=n.trim();if(s.startsWith(t)){const i=s.slice(t.length);try{return decodeURIComponent(i)}catch{return i}}}return null},Kn=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},Jn=(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("; ")},Gn=(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("; ")},Yn=(e,t={})=>{const r=I().cookies,n={path:r?.path??"/",sameSite:r?.sameSite??"Lax",secure:r?.secure??!1,watch:!0,...t};n.sameSite==="None"&&(n.secure=!0);const s=Vn(e);let i=n.defaultValue??null;if(s!==null)try{i=n.deserialize?n.deserialize(s):Kn(s)?JSON.parse(s):s??i}catch(c){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,c),i=s??i}const a=M(i);if(typeof document>"u"||n.watch===!1)return a;let o=!1;return $(()=>{const c=a.value;if(!o){o=!0;return}if(c==null){Jn(e,n);return}Gn(e,c,n)}),a},Zn={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)}},Xn=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),es=(e={})=>{const t=I().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(p){n.value=p},clear(){n.value=""},destroy(){n.value=""}};const s=r.id?document.getElementById(r.id):null,i=s??document.createElement("div"),a=!s;if(r.id&&(i.id=r.id),r.className&&(i.className=r.className),i.setAttribute("aria-live",r.politeness),i.setAttribute("aria-atomic",String(r.atomic)),i.setAttribute("role",r.politeness==="assertive"?"alert":"status"),i.setAttribute("data-bquery-announcer","true"),i.getAttribute("style")||i.setAttribute("style",Xn),a){const p=r.container??document.body??document.documentElement;if(!p)return{element:null,message:n,announce(v){n.value=v},clear(){n.value=""},destroy(){n.value=""}};p.appendChild(i)}const o=$(()=>{i.textContent=n.value});let c,l,d=!1;const m=()=>{c&&(clearTimeout(c),c=void 0),l&&(clearTimeout(l),l=void 0)};return{element:i,message:n,announce:(p,v={})=>{if(d)return;const g=v.politeness??r.politeness,b=v.delay??r.delay,E=v.clearDelay??r.clearDelay;m(),i.setAttribute("aria-live",g),i.setAttribute("role",g==="assertive"?"alert":"status"),n.value="",c=setTimeout(()=>{d||(n.value=p,E>0&&(l=setTimeout(()=>{d||(n.value="")},E)))},b)},clear:()=>{d||(m(),n.value="")},destroy:()=>{d||(d=!0,m(),n.value="",o(),a&&i.remove())}}},Et=(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)}},At=(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},ts=e=>{if(typeof document>"u")return()=>{};const t=I().pageMeta,r=e.title?t?.titleTemplate?t.titleTemplate(e.title):e.title:void 0,n=[],s=[],i=document.title;r!==void 0&&(document.title=r);const a=[...e.meta??[]];e.description&&a.unshift({name:"description",content:e.description});for(const o of a){const c=At("meta",{name:o.name,property:o.property,"http-equiv":o.httpEquiv,content:o.content});document.head.appendChild(c),n.push(c)}for(const o of e.link??[]){const c=At("link",{rel:o.rel,href:o.href,type:o.type,media:o.media,crossorigin:o.crossOrigin});document.head.appendChild(c),n.push(c)}return e.htmlAttributes&&s.push(Et(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(Et(document.body,e.bodyAttributes)),()=>{document.title=i;for(const o of s.reverse())o();for(const o of n)o.remove()}},Ct=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}},rs=class extends Ct{constructor(){super(localStorage)}},ns=class extends Ct{constructor(){super(sessionStorage)}},ss=class{constructor(e){this.options=e,this.dbPromise=null}openDB(){return this.dbPromise?this.dbPromise:(this.dbPromise=new Promise((e,t)=>{const r=indexedDB.open(this.options.name,this.options.version??1);r.onupgradeneeded=()=>{const n=r.result;n.objectStoreNames.contains(this.options.store)||n.createObjectStore(this.options.store)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)}),this.dbPromise)}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const i=t(r.transaction(this.options.store,e).objectStore(this.options.store));i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async set(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async clear(){await this.withStore("readwrite",e=>e.clear())}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},is={local(){return new rs},session(){return new ns},indexedDB(e){return new ss(e)}},$t=null,z=M({path:"",params:{},query:{},matched:null,hash:""}),kt=x(()=>z.value),G=()=>$t,Tt=e=>{$t=e},pe=async(e,t={})=>{const r=G();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},as=()=>{const e=G();e?e.back():history.back()},os=()=>{const e=G();e?e.forward():history.forward()},cs=(e,t={})=>r=>{r.preventDefault(),pe(e,t).catch(n=>{console.error("Navigation failed:",n)})},ls=e=>{const t=e??(typeof document<"u"?document.body:null);if(!t)return()=>{};const r=n=>{if(!(n instanceof MouseEvent)||n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey||typeof Element>"u"||!(n.target instanceof Element))return;const s=n.target.closest("a");if(!s||!(s instanceof(s.ownerDocument.defaultView?.HTMLAnchorElement??HTMLAnchorElement))||s.target||s.hasAttribute("download")||typeof window>"u"||s.origin!==window.location.origin)return;const i=G();if(!i){n.preventDefault(),pe(s.pathname+s.search+s.hash).catch(l=>{console.error("Navigation failed:",l)});return}const a=i.base,o=i.hash;let c;if(o&&s.hash&&s.hash.startsWith("#/"))c=s.hash.slice(1);else{let l=s.pathname;a&&a!=="/"&&l.startsWith(a)&&(l=l.slice(a.length)||"/"),c=l+s.search+s.hash}n.preventDefault(),pe(c).catch(l=>{console.error("Navigation failed:",l)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},us=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},fs=e=>{if(e==="*")return/^.*$/;const t="\0P\0",r="\0W\0";let n=e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,()=>t);return n=n.replace(/\*/g,r),n=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=n.replace(/\u0000P\u0000/g,()=>"([^/]+)"),n=n.replace(/\u0000W\u0000/g,".*"),new RegExp(`^${n}$`)},ds=e=>{const t=e.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/g);return t?t.map(r=>r.slice(1)):[]},hs=(e,t)=>{for(const r of t){const n=fs(r.path),s=e.match(n);if(s){const i=ds(r.path),a={};return i.forEach((o,c)=>{a[o]=s[c+1]||""}),{matched:r,params:a}}}return null},ye=(e,t,r,n)=>{const s=hs(e,n);return{path:e,params:s?.params??{},query:us(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},Ot=(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(...Ot(n.children,s))}return r},ms=(e,t={})=>{const r=G();if(!r)throw new Error("bQuery router: No router initialized.");const n=r.routes.find(i=>i.name===e);if(!n)throw new Error(`bQuery router: Route "${e}" not found.`);let s=n.path;for(const[i,a]of Object.entries(t))s=s.replace(`:${i}`,encodeURIComponent(a));return s},ps=(e,t=!1)=>{const r=z.value.path;return t?r===e:r.startsWith(e)},ys=(e,t=!1)=>x(()=>{const r=z.value.path;return t?r===e:r.startsWith(e)}),gs=e=>{const t=G();t&&t.destroy();const{routes:r,base:n="",hash:s=!1}=e,i=[],a=[],o=Ot(r),c=()=>{if(s){const[u,p=""]=(window.location.hash.slice(1)||"/").split("#"),[v,g=""]=u.split("?");return{pathname:v,search:g?`?${g}`:"",hash:p?`#${p}`:""}}let f=window.location.pathname;return n&&(f===n||f.startsWith(n+"/"))&&(f=f.slice(n.length)||"/"),{pathname:f,search:window.location.search,hash:window.location.hash}},l=()=>{const{pathname:f,search:u,hash:p}=c();z.value=ye(f,u,p,o)},d=async(f,u)=>{const{pathname:p,search:v,hash:g}=c(),b=ye(p,v,g,o),E=new URL(f,window.location.origin),D=ye(E.pathname,E.search,E.hash,o);for(const w of i)if(await w(D,b)===!1)return;const P=s?`#${f}`:`${n}${f}`;history[u]({},"",P),l();for(const w of a)w(z.value,b)},m=async()=>{const{pathname:f,search:u,hash:p}=c(),v=z.value,g=ye(f,u,p,o);for(const b of i)if(await b(g,v)===!1){const E=new URLSearchParams(Object.entries(v.query).flatMap(([A,T])=>Array.isArray(T)?T.map(H=>[A,H]):[[A,T]])).toString(),D=E?`?${E}`:"",P=v.hash?`#${v.hash}`:"",w=s?`#${v.path}${D}${P}`:`${n}${v.path}${D}${P}`;history.replaceState({},"",w);return}l();for(const b of a)b(z.value,v)};window.addEventListener("popstate",m),l();const y={push:f=>d(f,"pushState"),replace:f=>d(f,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:f=>history.go(f),beforeEach:f=>(i.push(f),()=>{const u=i.indexOf(f);u>-1&&i.splice(u,1)}),afterEach:f=>(a.push(f),()=>{const u=a.indexOf(f);u>-1&&a.splice(u,1)}),currentRoute:kt,routes:o,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",m),i.length=0,a.length=0,Tt(null)}};return Tt(y),y},vs=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},bs=(e,t)=>{const r=vs();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},ws=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},Ss=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},Rt=[],Es=e=>{Rt.push(e)},As=(e,t)=>{for(const r of Rt){const n=r({store:e,options:t});n&&Object.assign(e,n)}},te=new Map,Cs=e=>te.has(e),$s=(e,t)=>{te.set(e,t)},Mt=e=>te.get(e),ks=()=>Array.from(te.keys()),Ts=e=>{te.delete(e),ws(e)},Pt=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,B=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(B);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,B(n)]));if(e instanceof Set)return new Set(Array.from(e).map(B));const t={};for(const r of Object.keys(e))t[r]=B(e[r]);return t},re=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e.entries())if(!t.has(s)||!re(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.values()){let i=!1;for(const a of t.values())if(re(s,a)){i=!0;break}if(!i)return!1}return!0}if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,i)=>re(s,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(s=>re(e[s],t[s]))},Os=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const i=e[s],a=t[s];r.get(s)===a&&Pt(i)&&Pt(a)&&!re(i,a)&&n.push(s)}return n},Ne=(()=>{try{const e=globalThis.process;return!(typeof e<"u"&&e.env?.NODE_ENV==="production")}catch{return!0}})(),Lt=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if(Cs(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),Mt(t);const i=r(),a=new Map;for(const f of Object.keys(i))a.set(f,M(i[f]));const o=[],c=()=>Q(()=>({...d})),l=()=>{const f=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(o.length===0&&!f)return;const u=c();for(const p of o)p(u);Ss(t,u)},d=new Proxy({},{get:(f,u)=>{const p=u;if(a.has(p))return a.get(p).value},ownKeys:()=>Array.from(a.keys()),getOwnPropertyDescriptor:(f,u)=>{if(a.has(u))return{enumerable:!0,configurable:!0}},has:(f,u)=>a.has(u)}),m=new Map,y={};for(const f of Object.keys(i))Object.defineProperty(y,f,{get:()=>a.get(f).value,set:u=>{a.get(f).value=u,l()},enumerable:!0,configurable:!1});for(const f of Object.keys(n)){const u=n[f],p=x(()=>u(d,new Proxy({},{get:(v,g)=>{const b=g;if(m.has(b))return m.get(b).value}})));m.set(f,p),Object.defineProperty(y,f,{get:()=>p.value,enumerable:!0,configurable:!1})}for(const f of Object.keys(s)){const u=s[f];y[f]=function(...p){const v=new Proxy(y,{get:(g,b)=>typeof b=="string"&&a.has(b)?a.get(b).value:g[b],set:(g,b,E)=>typeof b=="string"&&a.has(b)?(a.get(b).value=E,l(),!0):Reflect.set(g,b,E)});return u.apply(v,p)}}return Object.defineProperties(y,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const f=r();ue(()=>{for(const[u,p]of a)p.value=f[u]}),l()},writable:!1,enumerable:!1},$subscribe:{value:f=>(o.push(f),()=>{const u=o.indexOf(f);u>-1&&o.splice(u,1)}),writable:!1,enumerable:!1},$patch:{value:f=>{ue(()=>{if(typeof f=="function"){const u=Ne?B(c()):null,p=Ne?new Map(Array.from(a.entries()).map(([g,b])=>[g,b.value])):null,v=c();if(f(v),Ne&&u&&p){const g=Os(u,v,p);g.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${g.map(String).join(", ")}.
|
|
170
|
+
`}),r},lt=null,W=()=>lt!==null?lt:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,di=e=>{lt=e},rr=e=>typeof e=="string"||typeof e=="number",nr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ue=(e,t)=>{const r=e.style;if(Array.isArray(t)){const n=t[t.length-1];if(!n)return;for(const[s,i]of Object.entries(n))if(!(s==="offset"||s==="easing"||s==="composite")&&rr(i)){const o=s.startsWith("--")?s:nr(s);r.setProperty(o,String(i))}return}for(const[n,s]of Object.entries(t)){if(n==="offset"||n==="easing"||n==="composite")continue;const i=Array.isArray(s)?s[s.length-1]:s;if(rr(i)){const o=n.startsWith("--")?n:nr(n);r.setProperty(o,String(i))}}},Fe=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:i=!0,onFinish:o}=t;if(i&&W())return s&&ue(e,r),o?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&ue(e,r),o?.(),Promise.resolve()):new Promise(l=>{const f=a.animate(r,n);let u=!1;const m=()=>{u||(u=!0,s&&(typeof f.commitStyles=="function"?f.commitStyles():ue(e,r)),f.cancel(),o?.(),l())};f.onfinish=m,f.finished&&f.finished.then(m).catch(m)})},K=e=>Math.min(1,Math.max(0,e)),sr=e=>K(e),ir=e=>K(e*e),or=e=>K(1-(1-e)*(1-e)),ar=e=>K(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),lr=e=>K(e*e*e),cr=e=>K(1-Math.pow(1-e,3)),ur=e=>K(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),fr=e=>K(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),dr=e=>K(e===1?1:1-Math.pow(2,-10*e)),hi={linear:sr,easeInQuad:ir,easeOutQuad:or,easeInOutQuad:ar,easeInCubic:lr,easeOutCubic:cr,easeInOutCubic:ur,easeOutBack:fr,easeOutExpo:dr},ct=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},ut=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:i}=r,o=ct(e);if(o.width===0||o.height===0)return i?.(),Promise.resolve();const a=t.left-o.left,l=t.top-o.top,f=t.width/o.width,u=t.height/o.height;if(a===0&&l===0&&f===1&&u===1)return i?.(),Promise.resolve();const m=e;return typeof m.animate!="function"?(i?.(),Promise.resolve()):(m.style.transform=`translate(${a}px, ${l}px) scale(${f}, ${u})`,m.style.transformOrigin="top left",m.offsetHeight,new Promise(h=>{const d=m.animate([{transform:`translate(${a}px, ${l}px) scale(${f}, ${u})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let c=!1;const p=()=>{c||(c=!0,m.style.transform="",m.style.transformOrigin="",i?.(),h())};d.onfinish=p,d.finished&&d.finished.then(p).catch(p)}))},mi=async(e,t,r={})=>{await hr(e,t,r)},hr=async(e,t,r={})=>{const{stagger:n,...s}=r,i=new Map;for(const l of e)i.set(l,ct(l));t();const o=e.length,a=e.map((l,f)=>{const u=i.get(l);if(!u)return Promise.resolve();const m=n?n(f,o):0;return m>0?new Promise(h=>setTimeout(h,m)).then(()=>ut(l,u,s)):ut(l,u,s)});await Promise.all(a)},pi={fadeIn:(e=0,t=1)=>[{opacity:e},{opacity:t}],fadeOut:(e=1,t=0)=>[{opacity:e},{opacity:t}],slideInUp:(e=16)=>[{opacity:0,transform:`translateY(${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInDown:(e=16)=>[{opacity:0,transform:`translateY(-${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInLeft:(e=16)=>[{opacity:0,transform:`translateX(${e}px)`},{opacity:1,transform:"translateX(0)"}],slideInRight:(e=16)=>[{opacity:0,transform:`translateX(-${e}px)`},{opacity:1,transform:"translateX(0)"}],scaleIn:(e=.95,t=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`}],scaleOut:(e=1,t=.95)=>[{opacity:1,transform:`scale(${e})`},{opacity:0,transform:`scale(${t})`}],pop:(e=.9,t=1.02,r=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`,offset:.6},{opacity:1,transform:`scale(${r})`}],rotateIn:(e=6)=>[{opacity:0,transform:`rotate(${e}deg) scale(0.98)`},{opacity:1,transform:"rotate(0deg) scale(1)"}]},yi=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:i=!0,onComplete:o}=r,a=e,l=t;if(typeof window>"u"||typeof document>"u"||typeof a.getBoundingClientRect!="function"||typeof l.getBoundingClientRect!="function"||typeof a.style>"u"||typeof l.style>"u")return o?.(),Promise.resolve();const f=e.getBoundingClientRect(),u=l.style.display,m=l.style.visibility,h=l.style.transform,d=l.style.opacity,c=typeof getComputedStyle=="function"?getComputedStyle(l).display:u||"block",p=c==="none"?"block":u||c||"block",v=()=>{l.style.transform=h,l.style.opacity=d};l.style.visibility="hidden",l.style.display=p;const b=t.getBoundingClientRect();if(l.style.visibility=m,a.style.display="none",c==="none"?l.style.display=p:u==="none"?l.style.display="":l.style.display=u,i&&W())return v(),o?.(),Promise.resolve();const g=f.left-b.left,w=f.top-b.top,S=f.width/(b.width||1),M=f.height/(b.height||1);if(g===0&&w===0&&S===1&&M===1)return v(),o?.(),Promise.resolve();const T=[{transform:`translate(${g}px, ${w}px) scale(${S}, ${M})`,opacity:"0.5"},{transform:"translate(0, 0) scale(1, 1)",opacity:"1"}];return typeof l.animate!="function"?(v(),o?.(),Promise.resolve()):new Promise(E=>{const k=l.animate(T,{duration:n,easing:s,fill:"forwards"});let O=!1;const C=()=>{O||(O=!0,v(),k.cancel(),o?.(),E())};k.onfinish=C,k.finished&&k.finished.then(C).catch(C)})},gi=(e,t={})=>{if(typeof window>"u"||typeof window.addEventListener!="function"||typeof window.removeEventListener!="function"||typeof requestAnimationFrame!="function"||typeof cancelAnimationFrame!="function")return()=>{};const{speed:r=.5,direction:n="vertical",respectReducedMotion:s=!0}=t,i=e,o=i.style.transform;if(s&&W())return()=>{};let a=!1,l=!1,f=null;const u=()=>{l||(l=!0,window.removeEventListener("scroll",h),f!==null&&(cancelAnimationFrame(f),f=null),a=!1,i.style.transform=o)},m=()=>{if(l)return;if(s&&W()){u();return}const d=window.scrollY,c=window.scrollX;let p=0,v=0;(n==="vertical"||n==="both")&&(v=d*r),(n==="horizontal"||n==="both")&&(p=c*r);const b=`translate3d(${p}px, ${v}px, 0)`;i.style.transform=o?`${o} ${b}`:b},h=()=>{if(!l){if(s&&W()){u();return}a||(a=!0,f=requestAnimationFrame(()=>{f=null,m(),a=!1}))}};return m(),window.addEventListener("scroll",h,{passive:!0}),u},vi=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),bi=(e,t)=>{const r=vi(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:i,once:o=!0,onEnter:a,...l}=t;if(typeof IntersectionObserver>"u")return r.forEach(u=>{a?.(u),Fe(u,l)}),()=>{};const f=new IntersectionObserver(u=>{u.forEach(m=>{if(!m.isIntersecting)return;const h=m.target;a?.(h),Fe(h,l),o&&f.unobserve(h)})},{root:n,rootMargin:s,threshold:i});return r.forEach(u=>f.observe(u)),()=>f.disconnect()},wi={stiffness:100,damping:10,mass:1,precision:.01},Ei=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:i}={...wi,...t};let o=e,a=0,l=e,f=null,u=null,m=null;const h=new Set,d=()=>{for(const p of h)p(o)},c=p=>{const v=m!==null?(p-m)/1e3:.016666666666666666,b=Math.min(v,1/30);m=p;const g=o-l,w=(-r*g+-n*a)/s;if(a+=w*b,o+=a*b,d(),Math.abs(a)<i&&Math.abs(g)<i){o=l,a=0,f=null,d(),u?.(),u=null;return}f=requestAnimationFrame(c)};return{to(p){return l=p,f!==null&&cancelAnimationFrame(f),u?.(),m=null,new Promise(v=>{u=v,f=requestAnimationFrame(c)})},current(){return o},stop(){f!==null&&(cancelAnimationFrame(f),f=null),a=0,m=null,u?.(),u=null},onChange(p){return h.add(p),()=>h.delete(p)}}},Si={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},Ai=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(i,o=0)=>{const a=typeof n=="number"?n:n==="center"?(o-1)/2:n==="end"?o-1:0,l=Math.abs(i-a),f=o>1?Math.max(a,o-1-a):1,u=f===0?0:l/f;return r+(s?s(u)*f:l)*e}},ft=e=>{if(typeof e=="number")return e;if(typeof e=="string"){const t=e.trim();if(t.endsWith("ms")){const n=Number.parseFloat(t.slice(0,-2));return Number.isFinite(n)?n:0}if(t.endsWith("s")){const n=Number.parseFloat(t.slice(0,-1));return Number.isFinite(n)?n*1e3:0}const r=Number.parseFloat(t);return Number.isFinite(r)?r:0}return 0},Ci=(e,t)=>{if(typeof e=="number")return e;if(typeof e=="string"){const r=/^([+-])=(\d+(?:\.\d+)?)$/.exec(e);if(r){const n=Number.parseFloat(r[2]);return Number.isFinite(n)?r[1]==="+"?t+n:t-n:t}}return t},$i=e=>{const t=ft(e?.duration),r=ft(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},mr=e=>{let t=0;return e.map(r=>{const n=Ci(r.at,t),s=ft(r.options?.delay),i=Math.max(0,n+s),o=$i(r.options),a=i+o;return t=Math.max(t,a),{step:r,start:i,end:a,duration:o}})},ki=async(e,t={})=>{const{stagger:r,onFinish:n}=t,s=e.length;for(let i=0;i<e.length;i+=1){const o=e[i],a=r?r(i,s):0;a>0&&await new Promise(l=>setTimeout(l,a)),await Fe(o.target,o)}n?.()},Li=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],i=0,o=!1,a=!1;const{commitStyles:l=!0,respectReducedMotion:f=!0,onFinish:u}=t,m=()=>{if(!a){if(a=!0,l)for(const d of s){const{animation:c,step:p}=d;typeof c.commitStyles=="function"?c.commitStyles():ue(p.target,p.keyframes),c.cancel()}n.forEach(d=>d()),u?.()}},h=()=>{s.forEach(({animation:c})=>c.cancel()),s=[],a=!1;const d=mr(r);if(i=d.length?Math.max(...d.map(c=>c.end)):0,f&&W()){l&&d.forEach(({step:c})=>ue(c.target,c.keyframes)),o=!0;return}if(d.some(({step:c})=>typeof c.target.animate!="function")){l&&d.forEach(({step:c})=>ue(c.target,c.keyframes)),o=!0;return}o=!1,s=d.map(({step:c,start:p})=>{const{delay:v,...b}=c.options??{};return{animation:c.target.animate(c.keyframes,{...b,delay:p,fill:b.fill??"both"}),step:c,start:p}})};return{add(d){r.push(d)},duration(){if(!r.length)return 0;if(!s.length){const d=mr(r);return Math.max(...d.map(c=>c.end))}return i},async play(){if(h(),o||s.length===0){m();return}const d=s.map(c=>c.animation.finished.catch(()=>{}));await Promise.all(d),m()},pause(){o||s.forEach(({animation:d})=>d.pause())},resume(){o||s.forEach(({animation:d})=>d.play())},stop(){s.forEach(({animation:d})=>d.cancel()),s=[],o=!1},seek(d){o||s.forEach(({animation:c})=>{c.currentTime=d})},onFinish(d){return n.add(d),()=>n.delete(d)}}},pr=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Ti=async e=>{const t=X().transitions,r=typeof e=="function"?{update:e,classes:t?.classes,types:t?.types,skipOnReducedMotion:t?.skipOnReducedMotion}:{...e,classes:e.classes??t?.classes,types:e.types??t?.types,skipOnReducedMotion:e.skipOnReducedMotion??t?.skipOnReducedMotion},n=r.update;if(typeof document>"u"){await n();return}const s=document,i=document.documentElement,o=pr(r.classes),a=pr(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&W()){await n(),r.onFinish?.();return}o.forEach(l=>i.classList.add(l));try{const l=s.startViewTransition(()=>n()),f=l.types;if(f)for(const u of a)f.add(u);await l.ready,r.onReady?.(),await l.finished,r.onFinish?.()}finally{o.forEach(l=>i.classList.remove(l))}},Oi=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:i=!1,cursorChar:o="|",loop:a=!1,loopDelay:l=1e3,respectReducedMotion:f=!0,onComplete:u}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const m=e;let h=!1,d=null,c=null,p=null,v=null;const b=()=>{if(!i)return;c=document.createElement("span"),c.setAttribute("aria-hidden","true"),c.textContent=o,m.appendChild(c);let S=!0;p=setInterval(()=>{c&&(S=!S,c.style.opacity=S?"1":"0")},530)},g=()=>{p!==null&&(clearInterval(p),p=null),c&&c.parentNode&&(c.parentNode.removeChild(c),c=null)},w=()=>{h||(h=!0,d!==null&&(clearTimeout(d),d=null),g(),v?.(),v=null)};return f&&W()?(m.textContent=t,u?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(S=>{v=S;const M=()=>{let T=0;m.textContent="",b();const E=document.createTextNode("");c?m.insertBefore(E,c):m.appendChild(E);const k=()=>{h||(T<t.length?(E.data=t.slice(0,T+1),T++,d=setTimeout(k,n)):(u?.(),a&&!h?d=setTimeout(()=>{h||(g(),M())},l):(g(),S(),v=null)))};d=setTimeout(k,s)};M()})}},Ri=class{constructor(e){this.bucketName=e,this.dbPromise=null,this.storeName="blobs"}openDB(){if(this.dbPromise)return this.dbPromise;const e=`bquery-bucket-${this.bucketName}`;return this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)},n.onsuccess=()=>t(n.result),n.onerror=()=>r(n.error)}),this.dbPromise}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const i=t(r.transaction(this.storeName,e).objectStore(this.storeName));i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async put(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},Mi={async open(e){return new Ri(e)}},Ni=class{constructor(e){this.cache=e}async add(e){await this.cache.add(e)}async addAll(e){await this.cache.addAll(e)}async put(e,t){await this.cache.put(e,t)}async match(e){return this.cache.match(e)}async remove(e){return this.cache.delete(e)}async keys(){return(await this.cache.keys()).map(e=>e.url)}},_i={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new Ni(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},Di=e=>{if(typeof document>"u")return null;const t=`${encodeURIComponent(e)}=`,r=document.cookie?document.cookie.split(";"):[];for(const n of r){const s=n.trim();if(s.startsWith(t)){const i=s.slice(t.length);try{return decodeURIComponent(i)}catch{return i}}}return null},Pi=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},Ii=(e,t)=>{if(typeof document>"u")return;const r=[`${encodeURIComponent(e)}=`,"Expires=Thu, 01 Jan 1970 00:00:00 GMT"];t.path&&r.push(`Path=${t.path}`),t.domain&&r.push(`Domain=${t.domain}`),t.sameSite&&r.push(`SameSite=${t.sameSite}`),t.secure&&r.push("Secure"),document.cookie=r.join("; ")},qi=(e,t,r)=>{if(typeof document>"u")return;const n=r.serialize?r.serialize(t):typeof t=="string"?t:JSON.stringify(t),s=[`${encodeURIComponent(e)}=${encodeURIComponent(n)}`];r.path&&s.push(`Path=${r.path}`),r.domain&&s.push(`Domain=${r.domain}`),typeof r.maxAge=="number"&&s.push(`Max-Age=${r.maxAge}`),r.expires&&s.push(`Expires=${r.expires.toUTCString()}`),r.sameSite&&s.push(`SameSite=${r.sameSite}`),r.secure&&s.push("Secure"),document.cookie=s.join("; ")},xi=(e,t={})=>{const r=X().cookies,n={path:r?.path??"/",sameSite:r?.sameSite??"Lax",secure:r?.secure??!1,watch:!0,...t};n.sameSite==="None"&&(n.secure=!0);const s=Di(e);let i=n.defaultValue??null;if(s!==null)try{i=n.deserialize?n.deserialize(s):Pi(s)?JSON.parse(s):s??i}catch(l){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,l),i=s??i}const o=N(i);if(typeof document>"u"||n.watch===!1)return o;let a=!1;return x(()=>{const l=o.value;if(!a){a=!0;return}if(l==null){Ii(e,n);return}qi(e,l,n)}),o},ji={isSupported(){return"Notification"in window},getPermission(){return this.isSupported()?Notification.permission:"denied"},async requestPermission(){return this.isSupported()?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"},send(e,t){return this.isSupported()?Notification.permission!=="granted"?(console.warn("bQuery: Notification permission not granted"),null):new Notification(e,t):(console.warn("bQuery: Notifications not supported in this browser"),null)}},zi=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),Fi=(e={})=>{const t=X().announcer,r={politeness:t?.politeness??"polite",atomic:t?.atomic??!0,delay:t?.delay??16,clearDelay:t?.clearDelay??1e3,...e},n=N("");if(typeof document>"u")return{element:null,message:n,announce(p){n.value=p},clear(){n.value=""},destroy(){n.value=""}};const s=r.id?document.getElementById(r.id):null,i=s??document.createElement("div"),o=!s;if(r.id&&(i.id=r.id),r.className&&(i.className=r.className),i.setAttribute("aria-live",r.politeness),i.setAttribute("aria-atomic",String(r.atomic)),i.setAttribute("role",r.politeness==="assertive"?"alert":"status"),i.setAttribute("data-bquery-announcer","true"),i.getAttribute("style")||i.setAttribute("style",zi),o){const p=r.container??document.body??document.documentElement;if(!p)return{element:null,message:n,announce(v){n.value=v},clear(){n.value=""},destroy(){n.value=""}};p.appendChild(i)}const a=x(()=>{i.textContent=n.value});let l,f,u=!1;const m=()=>{l&&(clearTimeout(l),l=void 0),f&&(clearTimeout(f),f=void 0)};return{element:i,message:n,announce:(p,v={})=>{if(u)return;const b=v.politeness??r.politeness,g=v.delay??r.delay,w=v.clearDelay??r.clearDelay;m(),i.setAttribute("aria-live",b),i.setAttribute("role",b==="assertive"?"alert":"status"),n.value="",l=setTimeout(()=>{u||(n.value=p,w>0&&(f=setTimeout(()=>{u||(n.value="")},w)))},g)},clear:()=>{u||(m(),n.value="")},destroy:()=>{u||(u=!0,m(),n.value="",a(),o&&i.remove())}}},yr=(e,t)=>{const r=new Map;for(const[n,s]of Object.entries(t))r.set(n,e.getAttribute(n)),e.setAttribute(n,s);return()=>{for(const[n,s]of r.entries())s==null?e.removeAttribute(n):e.setAttribute(n,s)}},gr=(e,t)=>{const r=document.createElement(e);r.setAttribute("data-bquery-page-meta","true");for(const[n,s]of Object.entries(t))s!==void 0&&r.setAttribute(n,s);return r},Bi=e=>{if(typeof document>"u")return()=>{};const t=X().pageMeta,r=e.title?t?.titleTemplate?t.titleTemplate(e.title):e.title:void 0,n=[],s=[],i=document.title;r!==void 0&&(document.title=r);const o=[...e.meta??[]];e.description&&o.unshift({name:"description",content:e.description});for(const a of o){const l=gr("meta",{name:a.name,property:a.property,"http-equiv":a.httpEquiv,content:a.content});document.head.appendChild(l),n.push(l)}for(const a of e.link??[]){const l=gr("link",{rel:a.rel,href:a.href,type:a.type,media:a.media,crossorigin:a.crossOrigin});document.head.appendChild(l),n.push(l)}return e.htmlAttributes&&s.push(yr(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(yr(document.body,e.bodyAttributes)),()=>{document.title=i;for(const a of s.reverse())a();for(const a of n)a.remove()}},vr=class{constructor(e){this.storage=e}async get(e){const t=this.storage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return t}}async set(e,t){const r=typeof t=="string"?t:JSON.stringify(t);this.storage.setItem(e,r)}async remove(e){this.storage.removeItem(e)}async clear(){this.storage.clear()}async keys(){const e=[];for(let t=0;t<this.storage.length;t++){const r=this.storage.key(t);r!==null&&e.push(r)}return e}},Hi=class extends vr{constructor(){super(localStorage)}},Qi=class extends vr{constructor(){super(sessionStorage)}},Ui=class{constructor(e){this.options=e,this.dbPromise=null}openDB(){return this.dbPromise?this.dbPromise:(this.dbPromise=new Promise((e,t)=>{const r=indexedDB.open(this.options.name,this.options.version??1);r.onupgradeneeded=()=>{const n=r.result;n.objectStoreNames.contains(this.options.store)||n.createObjectStore(this.options.store)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)}),this.dbPromise)}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const i=t(r.transaction(this.options.store,e).objectStore(this.options.store));i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async set(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async clear(){await this.withStore("readwrite",e=>e.clear())}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},Vi={local(){return new Hi},session(){return new Qi},indexedDB(e){return new Ui(e)}},br=null,Y=N({path:"",params:{},query:{},matched:null,hash:""}),wr=q(()=>Y.value),ee=()=>br,Er=e=>{br=e},Se=async(e,t={})=>{const r=ee();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},Wi=()=>{const e=ee();e?e.back():history.back()},Ki=()=>{const e=ee();e?e.forward():history.forward()},Yi="active",Ji=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),Gi=typeof HTMLElement<"u"?HTMLElement:class{},Sr=class extends Gi{constructor(...e){super(...e),this._cleanup=null,this._trackedActiveClasses=new Map,this._handleClick=t=>{t instanceof MouseEvent&&(t.defaultPrevented||t.button===0&&(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),this._navigate())))},this._handleKeydown=t=>{t instanceof KeyboardEvent&&t.key==="Enter"&&(t.preventDefault(),this._navigate())}}static get observedAttributes(){return["to","replace","exact","active-class"]}get to(){const e=this.getAttribute("to");return e==null||e.trim()===""?"/":e}set to(e){this.setAttribute("to",e)}get replace(){return this.hasAttribute("replace")}set replace(e){e?this.setAttribute("replace",""):this.removeAttribute("replace")}get exact(){return this.hasAttribute("exact")}set exact(e){e?this.setAttribute("exact",""):this.removeAttribute("exact")}get activeClass(){return this.getAttribute("active-class")??Yi}set activeClass(e){this.setAttribute("active-class",e)}connectedCallback(){this.getAttribute("role")||this.setAttribute("role","link"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this._handleClick),this.addEventListener("keydown",this._handleKeydown),this._setupActiveTracking()}disconnectedCallback(){this.removeEventListener("click",this._handleClick),this.removeEventListener("keydown",this._handleKeydown),this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses()}attributeChangedCallback(e,t,r){(e==="to"||e==="exact"||e==="active-class")&&this.isConnected&&this._setupActiveTracking()}_setupActiveTracking(){this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses();const e=this.to,t=this.exact,r=Ji(this.activeClass);this._trackedActiveClasses=new Map(r.map(n=>[n,this.classList.contains(n)])),this._cleanup=x(()=>{const n=Y.value.path,s=t?n===e:e==="/"?n==="/":n===e||n.startsWith(e.endsWith("/")?e:e+"/");for(const i of r){const o=this._trackedActiveClasses.get(i)??!1;this.classList.toggle(i,s||o)}s?this.setAttribute("aria-current","page"):this.removeAttribute("aria-current")})}_clearTrackedActiveClasses(){for(const[e,t]of this._trackedActiveClasses)this.classList.toggle(e,t);this._trackedActiveClasses.clear()}_navigate(){const e=this.to;e&&ee()&&Se(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},Xi=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",Sr)},Zi=(e,t={})=>r=>{r.preventDefault(),Se(e,t).catch(n=>{console.error("Navigation failed:",n)})},eo=e=>{const t=e??(typeof document<"u"?document.body:null);if(!t)return()=>{};const r=n=>{if(!(n instanceof MouseEvent)||n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey||typeof Element>"u"||!(n.target instanceof Element))return;const s=n.target.closest("a");if(!s||!(s instanceof(s.ownerDocument.defaultView?.HTMLAnchorElement??HTMLAnchorElement))||s.target||s.hasAttribute("download")||typeof window>"u"||s.origin!==window.location.origin)return;const i=ee();if(!i){n.preventDefault(),Se(s.pathname+s.search+s.hash).catch(f=>{console.error("Navigation failed:",f)});return}const o=i.base,a=i.hash;let l;if(a&&s.hash&&s.hash.startsWith("#/"))l=s.hash.slice(1);else{let f=s.pathname;o&&o!=="/"&&f.startsWith(o)&&(f=f.slice(o.length)||"/"),l=f+s.search+s.hash}n.preventDefault(),Se(l).catch(f=>{console.error("Navigation failed:",f)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},to=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{if(I(n))return;const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},ro=128,Ar=new Map,Cr=new Map,$r=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=ro)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},no=e=>{const t=[];let r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){n++;continue}if(s==="["&&!r){r=!0;continue}if(s==="]"&&r){r=!1;continue}if(!r){if(s==="("){t.push(!1);continue}if(s===")"){const i=t.pop()??!1,o=e[n+1];if(i&&(o==="+"||o==="*"||o==="?"||o==="{"))return!0;i&&t.length>0&&(t[t.length-1]=!0);continue}if(t.length>0){if(s==="?"&&n>0&&e[n-1]==="(")continue;(s==="+"||s==="*"||s==="?"||s==="{")&&(t[t.length-1]=!0)}}}return!1},so=e=>{let t="",r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){if(!r&&e[n+1]>="1"&&e[n+1]<="9")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);if(!r&&e[n+1]==="k"&&e[n+2]==="<")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);t+=s+e[n+1],n++;continue}if(s==="["&&!r){r=!0,t+=s;continue}if(s==="]"&&r){r=!1,t+=s;continue}if(!r&&s==="("){if(n+1<e.length&&e[n+1]==="?"){if(e[n+2]==="<"){if(e[n+3]==="="||e[n+3]==="!"){t+="(";continue}const i=e.indexOf(">",n+3);if(i===-1)throw new Error(`bQuery router: Invalid route constraint named capture group: "${e}".`);t+="(?:",n=i;continue}t+="(";continue}t+="(?:";continue}t+=s}return t},dt=e=>{const t=Ar.get(e);if(t!==void 0)return t;const r=so(e);return $r(Ar,e,r),r},kr=e=>{const t=dt(e),r=Cr.get(t);if(r)return r;if(no(t))throw new Error(`bQuery router: Route constraint contains a potentially catastrophic (ReDoS) pattern. Nested quantifiers are not allowed: "${e}".`);try{const n=new RegExp(`^(?:${t})$`);return $r(Cr,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},Ae=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),Lr=e=>Ae(e)||e!==void 0&&e>="0"&&e<="9",Tr=(e,t)=>{let r=1,n="",s=t+1,i=!1;for(;s<e.length;){const o=e[s];if(o==="\\"&&s+1<e.length){n+=o+e[s+1],s+=2;continue}if(o==="["&&!i)i=!0;else if(o==="]"&&i)i=!1;else if(!i&&o==="(")r++;else if(!i&&o===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=o,s++}return null},io=(e,t)=>{const r=Tr(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},Or=new Set,Rr=(e,t)=>{if(e[t]!==":"||!Ae(e[t+1]))return null;let r=t+2;for(;r<e.length&&Lr(e[r]);)r++;let n=r,s;if(e[r]==="("){const i=io(e,r);s=i.constraint,n=i.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},oo=e=>{if(!Or.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&Ae(e[t+1])){const r=Rr(e,t);r?.constraint&&dt(r.constraint),t=r?.nextIndex??t+1;continue}t++}Or.add(e)}},ao=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},Mr=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&Ae(e[r+1]));)r++;return e.slice(t,r)},Nr=(e,t,r,n)=>{const s=[];let i=t;for(;i<=r;){const o=e.indexOf(n,i);if(o===-1||o>r)break;s.push(o),i=o+1}return s.reverse()},lo=(e,t)=>{const r=new Map,n=(s,i)=>{const o=`${s}:${i}`;if(r.has(o))return r.get(o)??null;if(s===e.length){const u=i===t.length?{}:null;return r.set(o,u),u}const a=e[s];if(a==="*"){if(s===e.length-1){const d={};return r.set(o,d),d}const u=Mr(e,s+1),m=u.length>0?Nr(t,i,t.length,u):null,h=(m?d=>{for(const c of m){const p=d(c);if(p)return p}return null}:d=>{for(let c=t.length;c>=i;c--){const p=d(c);if(p)return p}return null})(d=>{const c=n(s+1,d);return c?(r.set(o,c),c):null});return h||(r.set(o,null),null)}const l=Rr(e,s);if(l){const u=l.constraint?kr(l.constraint):void 0,m=l.constraint?t.length:ao(t,i),h=Mr(e,l.nextIndex),d=h.length>0?Nr(t,i,m,h):null,c=(d?p=>{for(const v of d){if(v<=i)continue;const b=p(v);if(b)return b}return null}:p=>{for(let v=m;v>i;v--){const b=p(v);if(b)return b}return null})(p=>{const v=t.slice(i,p);if(u&&!u.test(v))return null;const b=n(l.nextIndex,p);if(b){const g={[l.name]:v,...b};return r.set(o,g),g}return null});return c||(r.set(o,null),null)}if(i>=t.length||a!==t[i])return r.set(o,null),null;const f=n(s+1,i+1);return r.set(o,f),f};return n(0,0)},co=(e,t)=>{for(const r of t){oo(r.path);const n=lo(r.path,e);if(n)return{matched:r,params:n}}return null},Be=(e,t,r,n)=>{const s=co(e,n);return{path:e,params:s?.params??{},query:to(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},_r=(e,t="")=>{const r=[];for(const n of e){const s=n.path==="*"?"*":`${t}${n.path}`.replace(/\/+/g,"/");r.push({...n,path:s}),n.children&&r.push(..._r(n.children,s))}return r},uo=(e,t={})=>{const r=ee();if(!r)throw new Error("bQuery router: No router initialized.");const n=r.routes.find(i=>i.name===e);if(!n)throw new Error(`bQuery router: Route "${e}" not found.`);let s="";for(let i=0;i<n.path.length;){if(n.path[i]===":"&&Ae(n.path[i+1])){let o=i+2;for(;o<n.path.length&&Lr(n.path[o]);)o++;let a=o,l=null;if(n.path[o]==="("){const m=Tr(n.path,o);if(!m)throw new Error(`bQuery router: Invalid constraint syntax in path "${n.path}" for route "${e}".`);l=m.constraint,a=m.endIndex}const f=n.path.slice(i+1,o),u=t[f];if(u===void 0)throw new Error(`bQuery router: Missing required param "${f}" for route "${e}".`);if(l&&!kr(l).test(u))throw new Error(`bQuery router: Param "${f}" with value "${u}" does not satisfy the route constraint "${l}" for route "${e}".`);s+=encodeURIComponent(u),i=a;continue}s+=n.path[i],i++}return s},fo=(e,t=!1)=>{const r=Y.value.path;return t?r===e:r.startsWith(e)},ho=(e,t=!1)=>q(()=>{const r=Y.value.path;return t?r===e:r.startsWith(e)}),mo=100,po=e=>{const t={};for(const[r,n]of Object.entries(e))I(r)||(t[r]=n);return t},yo=e=>{const t=ee();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:i=!1}=e,o=[],a=[],l=_r(r),f=new Map;let u="0",m=0,h=null;if(i&&typeof history<"u"&&"scrollRestoration"in history){h=history.scrollRestoration,history.scrollRestoration!=="manual"&&(history.scrollRestoration="manual");const E=history.state&&typeof history.state=="object"?history.state:{};if(typeof E.__bqScrollKey!="string"){const k=s?window.location.hash||"#/":`${window.location.pathname}${window.location.search}${window.location.hash}`;history.replaceState({...E,__bqScrollKey:u},"",k)}}const d=()=>history.state&&history.state.__bqScrollKey||u,c=()=>`${Date.now()}-${m++}`,p=(E=d())=>{if(i)for(f.has(E)&&f.delete(E),f.set(E,{x:window.scrollX,y:window.scrollY});f.size>mo;){const k=f.keys().next().value;if(k===void 0)break;f.delete(k)}},v=(E=d())=>{if(!i)return;const k=f.get(E);k?window.scrollTo(k.x,k.y):window.scrollTo(0,0)},b=()=>{const E=history.state&&typeof history.state=="object"?{...history.state}:{};return i&&(E.__bqScrollKey=u),E},g=()=>{if(s){const[k,O=""]=(window.location.hash.slice(1)||"/").split("#"),[C,L=""]=k.split("?");return{pathname:C,search:L?`?${L}`:"",hash:O?`#${O}`:""}}let E=window.location.pathname;return n&&(E===n||E.startsWith(n+"/"))&&(E=E.slice(n.length)||"/"),{pathname:E,search:window.location.search,hash:window.location.hash}},w=()=>{const{pathname:E,search:k,hash:O}=g();Y.value=Be(E,k,O,l)},S=async(E,k,O=new Set)=>{const{pathname:C,search:L,hash:A}=g(),$=Be(C,L,A,l),R=new URL(E,window.location.origin),P=`${R.pathname}${R.search}${R.hash}`;if(O.has(P))throw new Error(`bQuery router: redirect loop detected for path "${P}"`);O.add(P);const j=Be(R.pathname,R.search,R.hash,l);if(j.matched?.redirectTo){await S(j.matched.redirectTo,k,O);return}if(j.matched?.beforeEnter&&await j.matched.beforeEnter(j,$)===!1)return;for(const Ct of o)if(await Ct(j,$)===!1)return;p();const D=i?d():void 0,B=k==="replaceState"&&D?D:c(),ne=s?`#${E}`:`${n}${E}`,At=i&&history.state&&typeof history.state=="object"?po(history.state):{},Kl=i?{...At,__bqScrollKey:B}:{};history[k](Kl,"",ne),u=B,w(),i&&k==="pushState"&&window.scrollTo(0,0);for(const Ct of a)Ct(Y.value,$)},M=async E=>{const{pathname:k,search:O,hash:C}=g(),L=Y.value,A=Be(k,O,C,l);if(A.matched?.redirectTo){await S(A.matched.redirectTo,"replaceState");return}if(A.matched?.beforeEnter&&await A.matched.beforeEnter(A,L)===!1){const $=new URLSearchParams(Object.entries(L.query).flatMap(([D,B])=>Array.isArray(B)?B.map(ne=>[D,ne]):[[D,B]])).toString(),R=$?`?${$}`:"",P=L.hash?`#${L.hash}`:"",j=s?`#${L.path}${R}${P}`:`${n}${L.path}${R}${P}`;history.replaceState(b(),"",j);return}for(const $ of o)if(await $(A,L)===!1){const R=new URLSearchParams(Object.entries(L.query).flatMap(([B,ne])=>Array.isArray(ne)?ne.map(At=>[B,At]):[[B,ne]])).toString(),P=R?`?${R}`:"",j=L.hash?`#${L.hash}`:"",D=s?`#${L.path}${P}${j}`:`${n}${L.path}${P}${j}`;history.replaceState(b(),"",D);return}p(u),u=E.state?.__bqScrollKey??d(),w(),v(u);for(const $ of a)$(Y.value,L)};window.addEventListener("popstate",M),w();const T={push:E=>S(E,"pushState"),replace:E=>S(E,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:E=>history.go(E),beforeEach:E=>(o.push(E),()=>{const k=o.indexOf(E);k>-1&&o.splice(k,1)}),afterEach:E=>(a.push(E),()=>{const k=a.indexOf(E);k>-1&&a.splice(k,1)}),currentRoute:wr,routes:l,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",M),o.length=0,a.length=0,f.clear(),h!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=h),Er(null)}};return Er(T),T},fe=q(()=>Y.value),go={route:fe,path:q(()=>fe.value.path),params:q(()=>fe.value.params),query:q(()=>fe.value.query),hash:q(()=>fe.value.hash),matched:q(()=>fe.value.matched)},vo=()=>go,bo=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},wo=(e,t)=>{const r=bo();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},Eo=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},So=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},Dr=[],Ao=e=>{Dr.push(e)},Co=(e,t)=>{for(const r of Dr){const n=r({store:e,options:t});n&&Object.assign(e,n)}},Ce=new Map,$o=e=>Ce.has(e),ko=(e,t)=>{Ce.set(e,t)},$e=e=>Ce.get(e),ht=()=>Array.from(Ce.keys()),Lo=e=>{Ce.delete(e),Eo(e)},Pr=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,te=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(te);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,te(n)]));if(e instanceof Set)return new Set(Array.from(e).map(te));const t={};for(const r of Object.keys(e))t[r]=te(e[r]);return t},ke=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e.entries())if(!t.has(s)||!ke(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.values()){let i=!1;for(const o of t.values())if(ke(s,o)){i=!0;break}if(!i)return!1}return!0}if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,i)=>ke(s,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(s=>ke(e[s],t[s]))},To=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const i=e[s],o=t[s];r.get(s)===o&&Pr(i)&&Pr(o)&&!ke(i,o)&&n.push(s)}return n},Le=()=>st(),Ir=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if($o(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),$e(t);const i=r(),o=new Map;for(const g of Object.keys(i))o.set(g,N(i[g]));const a=[],l=[],f=(g,w,S)=>{!Le()||typeof console>"u"||typeof console.error!="function"||console.error(`[bQuery store "${t}"] Error in $onAction ${g} for action "${w}"`,S)},u=new WeakSet,m=(g,w)=>{!Le()||typeof console>"u"||typeof console.warn!="function"||u.has(g)||(u.add(g),console.warn(`[bQuery store "${t}"] Async $onAction listener detected for action "${w}". If it awaits, register after()/onError() before the first await; late registrations will not affect the current action.`))},h=(g,w,S,M)=>{try{const T=S();xe(T)&&(g==="listener"&&M&&m(M,w),T.catch(E=>{f(g,w,E)}))}catch(T){f(g,w,T)}},d=()=>ae(()=>({...p})),c=()=>{const g=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(a.length===0&&!g)return;const w=d();for(const S of a)S(w);So(t,w)},p=new Proxy({},{get:(g,w)=>{const S=w;if(o.has(S))return o.get(S).value},ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:(g,w)=>{if(o.has(w))return{enumerable:!0,configurable:!0}},has:(g,w)=>o.has(w)}),v=new Map,b={};for(const g of Object.keys(i))Object.defineProperty(b,g,{get:()=>o.get(g).value,set:w=>{o.get(g).value=w,c()},enumerable:!0,configurable:!1});for(const g of Object.keys(n)){const w=n[g],S=q(()=>w(p,new Proxy({},{get:(M,T)=>{const E=T;if(v.has(E))return v.get(E).value}})));v.set(g,S),Object.defineProperty(b,g,{get:()=>S.value,enumerable:!0,configurable:!1})}for(const g of Object.keys(s)){const w=s[g],S=g;b[S]=function(...M){const T=new Proxy(b,{get:(A,$)=>typeof $=="string"&&o.has($)?o.get($).value:A[$],set:(A,$,R)=>typeof $=="string"&&o.has($)?(o.get($).value=R,c(),!0):Reflect.set(A,$,R)});if(l.length===0)return w.apply(T,M);const E=[],k=[],O=[...l],C={name:S,store:b,args:M,after:A=>{E.push($=>A($))},onError:A=>{k.push(A)}};for(const A of O)h("listener",S,()=>A(C),A);let L;try{L=w.apply(T,M)}catch(A){for(const $ of k)h("onError",S,()=>$(A));throw A}if(xe(L))return L.then(A=>{for(const $ of E)h("after",S,()=>$(A));return A},A=>{for(const $ of k)h("onError",S,()=>$(A));throw A});for(const A of E)h("after",S,()=>A(L));return L}}return Object.defineProperties(b,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const g=r();ve(()=>{for(const[w,S]of o)S.value=g[w]}),c()},writable:!1,enumerable:!1},$subscribe:{value:g=>(a.push(g),()=>{const w=a.indexOf(g);w>-1&&a.splice(w,1)}),writable:!1,enumerable:!1},$onAction:{value:g=>(l.push(g),()=>{const w=l.indexOf(g);w>-1&&l.splice(w,1)}),writable:!1,enumerable:!1},$patch:{value:g=>{ve(()=>{if(typeof g=="function"){const w=Le(),S=w?te(d()):null,M=w?new Map(Array.from(o.entries()).map(([E,k])=>[E,k.value])):null,T=d();if(g(T),w&&S&&M){const E=To(S,T,M);E.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${E.map(String).join(", ")}.
|
|
171
171
|
Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.
|
|
172
172
|
To fix this, either:
|
|
173
173
|
1. Replace the entire object: state.user = { ...state.user, name: "New" }
|
|
174
174
|
2. Use $patchDeep() for automatic deep cloning
|
|
175
|
-
See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[g,b]of Object.entries(v))a.has(g)&&(a.get(g).value=b)}else for(const[u,p]of Object.entries(f))a.has(u)&&(a.get(u).value=p)}),l()},writable:!1,enumerable:!1},$patchDeep:{value:f=>{ue(()=>{if(typeof f=="function"){const u=B(c());f(u);for(const[p,v]of Object.entries(u))a.has(p)&&(a.get(p).value=v)}else for(const[u,p]of Object.entries(f))a.has(u)&&(a.get(u).value=B(p))}),l()},writable:!1,enumerable:!1},$state:{get:()=>c(),enumerable:!1}}),$s(t,y),As(y,e),bs(t,y),y},Rs=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Ms=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},Ps=(e,t)=>{const r=t??`bquery-store-${e.id}`,n=e.state,s=Lt({...e,state:()=>{const i=n();if(typeof window<"u")try{const a=localStorage.getItem(r);if(a)return{...i,...JSON.parse(a)}}catch{}return i}});return s.$subscribe(i=>{if(typeof window<"u")try{localStorage.setItem(r,JSON.stringify(i))}catch{}}),s},Nt=500,_t=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}},Dt=new _t(Nt),qt=new _t(Nt),Ls=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return fe(n)||nt(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),R=(e,t)=>{try{const r=Ls(t);let n=Dt.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),Dt.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},ge=(e,t)=>{try{let r=qt.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),qt.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},jt=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",i=0,a=null;for(let o=0;o<r.length;o++){const c=r[o];if(c==='"'||c==="'"||c==="`"){let l=0,d=o-1;for(;d>=0&&r[d]==="\\";)l++,d--;l%2===0&&(a===null?a=c:a===c&&(a=null)),s+=c;continue}if(a!==null){s+=c;continue}c==="("||c==="["||c==="{"?(i++,s+=c):c===")"||c==="]"||c==="}"?(i--,s+=c):c===","&&i===0?(n.push(s.trim()),s=""):s+=c}s.trim()&&n.push(s.trim());for(const o of n){let c=-1,l=0,d=null;for(let m=0;m<o.length;m++){const y=o[m];if(y==='"'||y==="'"||y==="`"){let f=0,u=m-1;for(;u>=0&&o[u]==="\\";)f++,u--;f%2===0&&(d===null?d=y:d===y&&(d=null));continue}if(d===null){if(y==="("||y==="["||y==="{")l++;else if(y===")"||y==="]"||y==="}")l--;else if(y===":"&&l===0){c=m;break}}}if(c>-1){const m=o.slice(0,c).trim().replace(/^['"]|['"]$/g,"");t[m]=o.slice(c+1).trim()}}return t},Ns=e=>(t,r,n,s)=>{const i=$(()=>{const a=R(r,n);a==null||a===!1?t.removeAttribute(e):a===!0?t.setAttribute(e,""):t.setAttribute(e,String(a))});s.push(i)},_s=(e,t,r,n)=>{let s=new Set;const i=$(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const o=jt(t);for(const[c,l]of Object.entries(o)){const d=R(l,r);e.classList.toggle(c,!!d),a.add(c)}}else if(/^\s*\[/.test(t)){const o=R(t,r);if(Array.isArray(o))for(const c of o)c&&(e.classList.add(c),a.add(c))}else{const o=R(t,r);typeof o=="string"?o.split(/\s+/).forEach(c=>{c&&(e.classList.add(c),a.add(c))}):Array.isArray(o)&&o.forEach(c=>{c&&(e.classList.add(c),a.add(c))})}for(const o of s)a.has(o)||e.classList.remove(o);s=a});n.push(i)},Ds=(e,t,r,n,s,i)=>{if(!r)return t;const a={...i,[n]:e};return s&&(a[s]=t),R(r,a)},qs=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,i,a,o)=>{const c=s.parentNode;if(!c)return;const l=i.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!l){console.error(`bQuery view: Invalid bq-for expression "${i}"`);return}const[,d,m,y]=l,f=s.getAttribute(":key")||s.getAttribute(`${t}-key`),u=s.cloneNode(!0);u.removeAttribute(`${t}-for`),u.removeAttribute(":key"),u.removeAttribute(`${t}-key`);const p=document.createComment(`bq-for: ${i}`);c.replaceChild(p,s);let v=new Map,g=[];const b=(w,A,T)=>{const H=u.cloneNode(!0),Y=[],Z=M(w),q=m?M(A):null,C={...a,[d]:Z};return m&&q&&(C[m]=q),r(H,C,t,Y),n(H,C,t,Y),{key:T,element:H,cleanups:Y,item:w,index:A,itemSignal:Z,indexSignal:q}},E=w=>{for(const A of w.cleanups)A();w.element.remove()},D=(w,A,T)=>{Object.is(w.item,A)||(w.item=A,w.itemSignal.value=A),w.index!==T&&(w.index=T,w.indexSignal&&(w.indexSignal.value=T))},P=$(()=>{const w=R(y,a);if(!Array.isArray(w)){for(const C of v.values())E(C);v.clear(),g=[];return}const A=[],T=new Map,H=new Set;w.forEach((C,O)=>{let L=Ds(C,O,f,d,m,a);H.has(L)&&(console.warn(`bq-for: Duplicate key "${String(L)}" detected at index ${O}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),L={__bqDuplicateKey:L,__bqIndex:O}),H.add(L),A.push(L),T.set(L,{item:C,index:O})});const Y=[];for(const C of g)T.has(C)||Y.push(C);for(const C of Y){const O=v.get(C);O&&(E(O),v.delete(C))}const Z=new Map;let q=p;for(let C=0;C<A.length;C++){const O=A[C],{item:L,index:Ht}=T.get(O);let N=v.get(O);N?(D(N,L,Ht),Z.set(O,N),q.nextSibling!==N.element&&q.after(N.element),q=N.element):(N=b(L,Ht,O),Z.set(O,N),q.after(N.element),q=N.element)}v=Z,g=A});o.push(()=>{P();for(const w of v.values())for(const A of w.cleanups)A();v.clear()})}},js=e=>(t,r,n,s)=>{const i=$(()=>{const a=R(r,n),o=String(a??"");t.innerHTML=e?j(o):o});s.push(i)},Is=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let i=!0;const a=$(()=>{const o=R(t,r);o&&!i?(s.replaceWith(e),i=!0):!o&&i&&(e.replaceWith(s),i=!1)});n.push(a)},Hs=(e,t,r,n)=>{const s=e,i=ge(t,r);if(!fe(i)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const a=i,o=s.type==="checkbox",c=s.type==="radio",l=()=>{o?s.checked=!!a.value:c?s.checked=a.value===s.value:s.value=String(a.value??"")},d=$(()=>{l()});n.push(d);const m=s.tagName==="SELECT"?"change":"input",y=()=>{o?a.value=s.checked:c?s.checked&&(a.value=s.value):a.value=s.value};s.addEventListener(m,y),n.push(()=>s.removeEventListener(m,y))},zs=e=>(t,r,n,s)=>{const i=a=>{const o={...n,$event:a,$el:t};if(!r.includes("(")){const c=ge(r,o);if(typeof c=="function"){c(a);return}return}ge(r,o)};t.addEventListener(e,i),s.push(()=>t.removeEventListener(e,i))};function Bs(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var Us=(e,t,r,n)=>{const s=ge(t,r);fe(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&Bs(s)&&(s.value=e,n.push(()=>{s.value=null}))},Fs=(e,t,r,n)=>{const s=e;let i=s.style.display;if(!i||i==="none"){const o=s.ownerDocument.defaultView?.getComputedStyle(s).display??"";i=o!=="none"?o:""}const a=$(()=>{const o=R(t,r);s.style.display=o?i:"none"});n.push(a)},Ws=(e,t,r,n)=>{const s=e;let i=new Set;const a=$(()=>{const o=new Set;if(t.trimStart().startsWith("{")){const c=jt(t);for(const[l,d]of Object.entries(c)){const m=R(d,r),y=l.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(y,String(m??"")),o.add(y)}}else{const c=R(t,r);if(c&&typeof c=="object")for(const[l,d]of Object.entries(c)){const m=l.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(m,String(d??"")),o.add(m)}}for(const c of i)o.has(c)||s.style.removeProperty(c);i=o});n.push(a)},xs=(e,t,r,n)=>{const s=$(()=>{const i=R(t,r);e.textContent=String(i??"")});n.push(s)},ve=(e,t,r,n,s)=>{const i=Array.from(e.attributes);for(const a of i){const{name:o,value:c}=a;if(!o.startsWith(`${r}-`))continue;const l=o.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==="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 d=l.slice(5);s.bind(d)(e,c,t,n)}else if(l.startsWith("on:")){const d=l.slice(3);s.on(d)(e,c,t,n)}}},_e=(e,t,r,n,s)=>{const i=Array.from(e.children);for(const a of i)a.hasAttribute(`${r}-for`)?ve(a,t,r,n,s):(ve(a,t,r,n,s),_e(a,t,r,n,s))},It=(e,t,r={})=>{const{prefix:n="bq",sanitize:s=!0}=r,i=typeof e=="string"?document.querySelector(e):e;if(!i)throw new Error(`bQuery view: Element "${e}" not found.`);if(i.hasAttribute(`${n}-for`))throw new Error(`bQuery view: Cannot mount on element with ${n}-for directive. Wrap the ${n}-for element in a container instead.`);const a=[],o={text:xs,html:js(s),if:Is,show:Fs,class:_s,style:Ws,model:Hs,ref:Us,for:qs({prefix:n,processElement:(l,d,m,y)=>ve(l,d,m,y,o),processChildren:(l,d,m,y)=>_e(l,d,m,y,o)}),bind:Ns,on:zs};return((l,d,m)=>{const y=l.hasAttribute(`${n}-for`);ve(l,d,n,m,o),y||_e(l,d,n,m,o)})(i,t,a),{el:i,context:t,update:l=>{Object.assign(t,l)},destroy:()=>{for(const l of a)l();a.length=0}}},Qs=(e,t={})=>r=>{const n=document.createElement("div");n.innerHTML=e.trim();const s=n.firstElementChild;if(!s)throw new Error("bQuery view: Template must contain a single root element.");if(n.childElementCount>1)throw new Error(`bQuery view: Template must contain exactly one root element, found ${n.childElementCount}.`);const{prefix:i="bq"}=t;if(s.hasAttribute(`${i}-for`)||s.hasAttribute(`${i}-if`)){const a=s.hasAttribute(`${i}-for`)?"for":"if";throw new Error(`bQuery view: Template root element cannot have ${i}-${a} directive. Wrap the ${i}-${a} element in a container instead.`)}return It(s,r,t)};h.$=ar,h.$$=or,h.BQueryCollection=ie,h.BQueryElement=F,h.Computed=Ce,h.Signal=$e,h.animate=me,h.back=as,h.batch=ue,h.bool=An,h.buckets=Wn,h.cache=Qn,h.capturePosition=Me,h.component=V,h.computed=x,h.createPersistedStore=Ps,h.createRouter=gs,h.createStore=Lt,h.createTemplate=Qs,h.createTrustedHtml=nr,h.createUseFetch=fn,h.currentRoute=kt,h.defineBqueryConfig=Zr,h.definePageMeta=ts,h.destroyStore=Ts,h.easeInCubic=mt,h.easeInOutCubic=yt,h.easeInOutQuad=ht,h.easeInQuad=ft,h.easeOutBack=gt,h.easeOutCubic=pt,h.easeOutExpo=vt,h.easeOutQuad=dt,h.easingPresets=Rn,h.effect=$,h.escapeHtml=xe,h.flip=Pe,h.flipElements=bt,h.flipList=Mn,h.forward=os,h.generateNonce=er,h.getBqueryConfig=I,h.getStore=Mt,h.getTrustedTypesPolicy=We,h.hasCSPDirective=tr,h.html=K,h.interceptLinks=ls,h.isActive=ps,h.isActiveSignal=ys,h.isComputed=nt,h.isSignal=fe,h.isTrustedTypesSupported=rr,h.keyframePresets=Pn,h.linear=ut,h.link=cs,h.linkedSignal=dn,h.listStores=ks,h.mapActions=Ms,h.mapState=Rs,h.mount=It,h.navigate=pe,h.notifications=Zn,h.persistedSignal=hn,h.prefersReducedMotion=he,h.readonly=mn,h.registerDefaultComponents=On,h.registerPlugin=Es,h.resolve=ms,h.safeHtml=Cn,h.sanitize=j,h.sanitizeHtml=j,h.scrollAnimate=Nn,h.sequence=zn,h.signal=M,h.spring=Dn,h.springPresets=qn,h.stagger=jn,h.storage=is,h.stripTags=sr,h.timeline=Bn,h.transition=Un,h.trusted=Yt,h.untrack=Q,h.useAnnouncer=es,h.useAsyncData=tt,h.useCookie=Yn,h.useFetch=rt,h.utils=Qr,h.watch=pn});
|
|
175
|
+
See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[E,k]of Object.entries(T))o.has(E)&&(o.get(E).value=k)}else for(const[w,S]of Object.entries(g))o.has(w)&&(o.get(w).value=S)}),c()},writable:!1,enumerable:!1},$patchDeep:{value:g=>{ve(()=>{if(typeof g=="function"){const w=te(d());g(w);for(const[S,M]of Object.entries(w))o.has(S)&&(o.get(S).value=M)}else for(const[w,S]of Object.entries(g))o.has(w)&&(o.get(w).value=te(S))}),c()},writable:!1,enumerable:!1},$state:{get:()=>d(),enumerable:!1}}),ko(t,b),Co(b,e),wo(t,b),b},Oo=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Ro=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},Mo="__version",No={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},qr=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},_o=(e,t)=>{const r={...e};for(const[n,s]of Object.entries(t))I(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s);return r},Do=()=>{try{return globalThis.localStorage}catch{return}},Po=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??Do(),i=r.serializer??No,o=r.version,a=r.migrate,l=n+Mo;let f=s!==void 0&&o!==void 0,u=!1,m=!1;const h=p=>{if(!s||o===void 0)return!1;try{return s.setItem(l,String(o)),!0}catch(v){return p&&Le()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(p,v),!1}},d=e.state,c=Ir({...e,state:()=>{const p=d();if(!s)return p;try{const v=s.getItem(n);if(!v)return p;const b=i.deserialize(v);if(!qr(b))return p;let g=b;if(o!==void 0&&a){const w=s.getItem(l),S=w!==null?Number(w):0,M=Number.isFinite(S)?S:0;if(M!==o){f=!1,u=!0;const T=a(g,M);if(!qr(T))return p;g=T;let E=!1;try{s.setItem(n,i.serialize(g)),E=!0,m=!0}catch(k){Le()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`,k)}E&&h(`[bQuery store "${e.id}"] Failed to persist migrated version:`)&&(u=!1)}else f=!1}return _o(p,g)}catch{return p}}});return f&&s?h():u&&m&&h(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(u=!1),c.$subscribe(p=>{if(s)try{s.setItem(n,i.serialize(p)),u&&h(`[bQuery store "${e.id}"] Failed to persist migrated version after a successful state write:`)&&(u=!1)}catch{}}),c},xr=500,jr=class{constructor(e){this.cache=new Map,this.maxSize=e}get(e){const t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}get size(){return this.cache.size}},zr=new jr(xr),Fr=new jr(xr),Io=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return we(n)||nt(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),F=(e,t)=>{try{const r=Io(t);let n=zr.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),zr.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},He=(e,t)=>{try{let r=Fr.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),Fr.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Br=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",i=0,o=null;for(let a=0;a<r.length;a++){const l=r[a];if(l==='"'||l==="'"||l==="`"){let f=0,u=a-1;for(;u>=0&&r[u]==="\\";)f++,u--;f%2===0&&(o===null?o=l:o===l&&(o=null)),s+=l;continue}if(o!==null){s+=l;continue}l==="("||l==="["||l==="{"?(i++,s+=l):l===")"||l==="]"||l==="}"?(i--,s+=l):l===","&&i===0?(n.push(s.trim()),s=""):s+=l}s.trim()&&n.push(s.trim());for(const a of n){let l=-1,f=0,u=null;for(let m=0;m<a.length;m++){const h=a[m];if(h==='"'||h==="'"||h==="`"){let d=0,c=m-1;for(;c>=0&&a[c]==="\\";)d++,c--;d%2===0&&(u===null?u=h:u===h&&(u=null));continue}if(u===null){if(h==="("||h==="["||h==="{")f++;else if(h===")"||h==="]"||h==="}")f--;else if(h===":"&&f===0){l=m;break}}}if(l>-1){const m=a.slice(0,l).trim().replace(/^['"]|['"]$/g,"");if(I(m))continue;t[m]=a.slice(l+1).trim()}}return t},qo=e=>(t,r,n,s)=>{const i=x(()=>{const o=F(r,n);o==null||o===!1?t.removeAttribute(e):o===!0?t.setAttribute(e,""):t.setAttribute(e,String(o))});s.push(i)},xo=(e,t,r,n)=>{let s=new Set;const i=x(()=>{const o=new Set;if(t.trimStart().startsWith("{")){const a=Br(t);for(const[l,f]of Object.entries(a)){const u=F(f,r);e.classList.toggle(l,!!u),o.add(l)}}else if(/^\s*\[/.test(t)){const a=F(t,r);if(Array.isArray(a))for(const l of a)l&&(e.classList.add(l),o.add(l))}else{const a=F(t,r);typeof a=="string"?a.split(/\s+/).forEach(l=>{l&&(e.classList.add(l),o.add(l))}):Array.isArray(a)&&a.forEach(l=>{l&&(e.classList.add(l),o.add(l))})}for(const a of s)o.has(a)||e.classList.remove(a);s=o});n.push(i)},jo=(e,t,r,n,s,i)=>{if(!r)return t;const o={...i,[n]:e};return s&&(o[s]=t),F(r,o)},zo=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,i,o,a)=>{const l=s.parentNode;if(!l)return;const f=i.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!f){console.error(`bQuery view: Invalid bq-for expression "${i}"`);return}const[,u,m,h]=f,d=s.getAttribute(":key")||s.getAttribute(`${t}-key`),c=s.cloneNode(!0);c.removeAttribute(`${t}-for`),c.removeAttribute(":key"),c.removeAttribute(`${t}-key`);const p=document.createComment(`bq-for: ${i}`);l.replaceChild(p,s);let v=new Map,b=[];const g=(T,E,k)=>{const O=c.cloneNode(!0),C=[],L=N(T),A=m?N(E):null,$={...o,[u]:L};return m&&A&&($[m]=A),r(O,$,t,C),n(O,$,t,C),{key:k,element:O,cleanups:C,item:T,index:E,itemSignal:L,indexSignal:A}},w=T=>{for(const E of T.cleanups)E();T.element.remove()},S=(T,E,k)=>{Object.is(T.item,E)||(T.item=E,T.itemSignal.value=E),T.index!==k&&(T.index=k,T.indexSignal&&(T.indexSignal.value=k))},M=x(()=>{const T=F(h,o);if(!Array.isArray(T)){for(const $ of v.values())w($);v.clear(),b=[];return}const E=[],k=new Map,O=new Set;T.forEach(($,R)=>{let P=jo($,R,d,u,m,o);O.has(P)&&(console.warn(`bq-for: Duplicate key "${String(P)}" detected at index ${R}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),P={__bqDuplicateKey:P,__bqIndex:R}),O.add(P),E.push(P),k.set(P,{item:$,index:R})});const C=[];for(const $ of b)k.has($)||C.push($);for(const $ of C){const R=v.get($);R&&(w(R),v.delete($))}const L=new Map;let A=p;for(let $=0;$<E.length;$++){const R=E[$],{item:P,index:j}=k.get(R);let D=v.get(R);D?(S(D,P,j),L.set(R,D),A.nextSibling!==D.element&&A.after(D.element),A=D.element):(D=g(P,j,R),L.set(R,D),A.after(D.element),A=D.element)}v=L,b=E});a.push(()=>{M();for(const T of v.values())for(const E of T.cleanups)E();v.clear()})}},Fo=e=>(t,r,n,s)=>{const i=x(()=>{const o=F(r,n),a=String(o??"");t.innerHTML=e?V(a):a});s.push(i)},Bo=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let i=!0;const o=x(()=>{const a=F(t,r);a&&!i?(s.replaceWith(e),i=!0):!a&&i&&(e.replaceWith(s),i=!1)});n.push(o)},Ho=(e,t,r,n)=>{const s=e,i=He(t,r);if(!we(i)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const o=i,a=s.type==="checkbox",l=s.type==="radio",f=()=>{a?s.checked=!!o.value:l?s.checked=o.value===s.value:s.value=String(o.value??"")},u=x(()=>{f()});n.push(u);const m=s.tagName==="SELECT"?"change":"input",h=()=>{a?o.value=s.checked:l?s.checked&&(o.value=s.value):o.value=s.value};s.addEventListener(m,h),n.push(()=>s.removeEventListener(m,h))},Qo=e=>(t,r,n,s)=>{const i=o=>{const a={...n,$event:o,$el:t};if(!r.includes("(")){const l=He(r,a);if(typeof l=="function"){l(o);return}return}He(r,a)};t.addEventListener(e,i),s.push(()=>t.removeEventListener(e,i))};function Uo(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var Vo=(e,t,r,n)=>{const s=He(t,r);we(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&Uo(s)&&(s.value=e,n.push(()=>{s.value=null}))},Wo=(e,t,r,n)=>{const s=e;let i=s.style.display;if(!i||i==="none"){const a=s.ownerDocument.defaultView?.getComputedStyle(s).display??"";i=a!=="none"?a:""}const o=x(()=>{const a=F(t,r);s.style.display=a?i:"none"});n.push(o)},Ko=(e,t,r,n)=>{const s=e;let i=new Set;const o=x(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const l=Br(t);for(const[f,u]of Object.entries(l)){const m=F(u,r),h=f.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(h,String(m??"")),a.add(h)}}else{const l=F(t,r);if(l&&typeof l=="object")for(const[f,u]of Object.entries(l)){const m=f.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(m,String(u??"")),a.add(m)}}for(const l of i)a.has(l)||s.style.removeProperty(l);i=a});n.push(o)},Yo=(e,t,r,n)=>{const s=x(()=>{const i=F(t,r);e.textContent=String(i??"")});n.push(s)},mt=null,Jo=e=>{mt=e},Go=e=>mt?mt(e):void 0,Qe=(e,t,r,n,s)=>{const i=Array.from(e.attributes);for(const o of i){const{name:a,value:l}=o;if(!a.startsWith(`${r}-`))continue;const f=a.slice(r.length+1);if(f==="for"){s.for(e,l,t,n);return}if(f==="text")s.text(e,l,t,n);else if(f==="html")s.html(e,l,t,n);else if(f==="if")s.if(e,l,t,n);else if(f==="show")s.show(e,l,t,n);else if(f==="class")s.class(e,l,t,n);else if(f==="style")s.style(e,l,t,n);else if(f==="model")s.model(e,l,t,n);else if(f==="ref")s.ref(e,l,t,n);else if(f.startsWith("bind:")){const u=f.slice(5);s.bind(u)(e,l,t,n)}else if(f.startsWith("on:")){const u=f.slice(3);s.on(u)(e,l,t,n)}else{const u=Go(f);u?u(e,l,t,n):st()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery][view] Unknown directive "${a}" (parsed as "${f}") on <${e.tagName.toLowerCase()}>. This may be a typo or a missing custom directive registration.`)}}},pt=(e,t,r,n,s)=>{const i=Array.from(e.children);for(const o of i)o.hasAttribute(`${r}-for`)?Qe(o,t,r,n,s):(Qe(o,t,r,n,s),pt(o,t,r,n,s))},yt=(e,t,r={})=>{const{prefix:n="bq",sanitize:s=!0}=r,i=typeof e=="string"?document.querySelector(e):e;if(!i)throw new Error(`bQuery view: Element "${e}" not found.`);if(i.hasAttribute(`${n}-for`))throw new Error(`bQuery view: Cannot mount on element with ${n}-for directive. Wrap the ${n}-for element in a container instead.`);const o=[],a={text:Yo,html:Fo(s),if:Bo,show:Wo,class:xo,style:Ko,model:Ho,ref:Vo,for:zo({prefix:n,processElement:(f,u,m,h)=>Qe(f,u,m,h,a),processChildren:(f,u,m,h)=>pt(f,u,m,h,a)}),bind:qo,on:Qo};return((f,u,m)=>{const h=f.hasAttribute(`${n}-for`);Qe(f,u,n,m,a),h||pt(f,u,n,m,a)})(i,t,o),{el:i,context:t,update:f=>{Object.assign(t,f)},destroy:()=>{for(const f of o)f();o.length=0}}},Xo=(e,t={})=>r=>{const n=document.createElement("div");n.innerHTML=e.trim();const s=n.firstElementChild;if(!s)throw new Error("bQuery view: Template must contain a single root element.");if(n.childElementCount>1)throw new Error(`bQuery view: Template must contain exactly one root element, found ${n.childElementCount}.`);const{prefix:i="bq"}=t;if(s.hasAttribute(`${i}-for`)||s.hasAttribute(`${i}-if`)){const o=s.hasAttribute(`${i}-for`)?"for":"if";throw new Error(`bQuery view: Template root element cannot have ${i}-${o} directive. Wrap the ${i}-${o} element in a container instead.`)}return yt(s,r,t)},Zo=e=>e===!0||e===void 0,ea=async(e,t)=>{const r=e(t),n=xe(r)?await r:r;return Zo(n)?void 0:n},ta=e=>{const t=e.initialValue,r=N(t),n=N(""),s=N(!1),i=q(()=>!Object.is(r.value,t));return{value:r,error:n,isDirty:i,isTouched:s,isPristine:q(()=>!i.value),touch:()=>{s.value=!0},reset:()=>{r.value=t,n.value="",s.value=!1}}},Hr=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await ea(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},ra=e=>{const t=Object.entries(e.fields),r={},n={};for(const[h,d]of t){const c=ta(d);r[h]=c,n[h]=c.error}const s=N(!1),i=q(()=>{for(const h of Object.keys(r))if(r[h].error.value!=="")return!1;return!0}),o=q(()=>{for(const h of Object.keys(r))if(r[h].isDirty.value)return!0;return!1}),a=async h=>{const d=r[h],c=e.fields[h];!d||!c||await Hr(d,c.validators)},l=async()=>{let h=!1;for(const[d,c]of t){const p=r[d];await Hr(p,c.validators)&&(h=!0)}if(e.crossValidators&&e.crossValidators.length>0){const d=m();for(const c of e.crossValidators){const p=await c(d);if(p){for(const[v,b]of Object.entries(p))if(b){const g=r[v];g&&(g.error.value===""&&(g.error.value=b),h=!0)}}}}return!h},f=async()=>{if(!s.value){s.value=!0;try{if(!await l())return;e.onSubmit&&await e.onSubmit(m())}finally{s.value=!1}}},u=()=>{for(const h of Object.keys(r))r[h].reset()},m=()=>{const h={};for(const d of Object.keys(r))h[d]=r[d].value.value;return h};return{fields:r,errors:n,isValid:i,isDirty:o,isSubmitting:s,handleSubmit:f,validateField:a,validate:l,reset:u,getValues:m}},na=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,sa=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},ia=(e,t)=>{const r=t??`Must be at most ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length<=e?!0:r},oa=(e,t="Invalid format")=>{const r=e.global||e.sticky?new RegExp(e.source,e.flags.replace(/[gy]/g,"")):e;return n=>{const s=typeof n=="string"?n:String(n??"");return r.lastIndex=0,r.test(s)?!0:t}},aa=(e="Invalid email address")=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r=>{const n=typeof r=="string"?r:String(r??"");return n===""||t.test(n)?!0:e}},la=(e="Invalid URL")=>t=>{const r=typeof t=="string"?t:String(t??"");if(r==="")return!0;try{return new URL(r),!0}catch{return e}},ca=(e,t)=>{const r=t??`Must be at least ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))>=e?!0:r},ua=(e,t)=>{const r=t??`Must be at most ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))<=e?!0:r},fa=(e,t)=>r=>e(r)?!0:t,da=(e,t)=>async r=>await e(r)?!0:t,Qr=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},Ur=(e,t,r)=>{const{locale:n,...s}=r??{},i=typeof e=="number"?new Date(e):e;try{return new Intl.DateTimeFormat(t,s).format(i)}catch{return i.toLocaleString()}},Vr=(e,t)=>{const r=t.split(".");let n=e;for(const s of r){if(typeof n=="string"||n[s]===void 0)return;n=n[s]}return typeof n=="string"?n:void 0},ha=(e,t)=>e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r),ma=(e,t)=>{if(!e.includes("|")||!("count"in t))return e;const r=Number(t.count),n=e.split("|").map(s=>s.trim());return n.length===3?r===0?n[0]:r===1?n[1]:n[2]:n.length===2?r===1?n[0]:n[1]:r===0&&n.length>0?n[0]:r===1&&n.length>1?n[1]:n[n.length-1]},Wr=(e,t,r,n)=>{let s;return e&&(s=Vr(e,t)),s===void 0&&n&&(s=Vr(n,t)),s===void 0?t:ha(ma(s,r),r)},Kr=(e,t)=>{const r=pe(e,t),n=s=>{if(Array.isArray(s))return s.map(o=>n(o));if(!me(s))return s;const i=Object.create(null);for(const[o,a]of Object.entries(s))I(o)||(i[o]=n(a));return i};return n(r)},pa=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=g=>Kr(Object.create(null),g),i=Object.create(null);for(const[g,w]of Object.entries(r))I(g)||(i[g]=s(w));const o=N(t),a=new Map,l=new Set(Object.keys(i));return{$locale:o,t:(g,w={})=>{const S=i[o.value];return Wr(S,g,w,n?i[n]:void 0)},tc:(g,w={})=>q(()=>{const S=i[o.value];return Wr(S,g,w,n?i[n]:void 0)}),loadLocale:(g,w)=>{I(g)||a.set(g,w)},ensureLocale:async g=>{if(I(g)||l.has(g))return;const w=a.get(g);if(!w)throw new Error(`bQuery i18n: No messages or loader registered for locale "${g}".`);const S=await w();i[g]=s(S.default??S),l.add(g)},n:(g,w)=>Qr(g,w?.locale??o.value,w),d:(g,w)=>Ur(g,w?.locale??o.value,w),getMessages:g=>{if(!I(g))return i[g]},mergeMessages:(g,w)=>{I(g)||(i[g]||(i[g]=Object.create(null),l.add(g)),i[g]=Kr(i[g],s(w)))},availableLocales:()=>{const g=new Set([...l,...a.keys()]);return Array.from(g).sort()}}},Ue=new Map,Te=new Map,ya=50,ga=e=>{const t=Ue.get(e);if(t&&t.isConnected)return t;const r=document.createElement("div");return r.setAttribute("aria-live",e),r.setAttribute("aria-atomic","true"),r.setAttribute("role",e==="assertive"?"alert":"status"),Object.assign(r.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),document.body.appendChild(r),Ue.set(e,r),r},va=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=ga(t),n=Te.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{Te.delete(t),r.isConnected&&(r.textContent=e)},ya);Te.set(t,s)},ba=()=>{for(const e of Te.values())clearTimeout(e);Te.clear();for(const[,e]of Ue)e.remove();Ue.clear()},Q=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),wa=e=>{const t=[],r=e.querySelectorAll("img");for(const n of r)n.hasAttribute("alt")?n.getAttribute("alt")===""&&!n.hasAttribute("role")&&t.push(Q("info",'Image has empty alt text. Consider adding role="presentation" if decorative.',n,"img-decorative")):t.push(Q("error",'Image is missing an alt attribute. Add alt="" for decorative images or a descriptive alt text.',n,"img-alt"));return t},Ea=e=>{const t=[],r=e.querySelectorAll("input, select, textarea");for(const n of r){const s=n.getAttribute("type");if(s==="hidden"||s==="submit"||s==="button"||s==="reset")continue;const i=n.getAttribute("id"),o=i?!!e.querySelector(`label[for="${i}"]`):!1,a=n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby"),l=n.hasAttribute("title"),f=n.closest("label")!==null;!o&&!a&&!l&&!f&&t.push(Q("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},Sa=e=>{const t=[],r=e.querySelectorAll("button");for(const s of r){const i=(s.textContent??"").trim().length>0,o=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title");!i&&!o&&!a&&t.push(Q("error","Button has no accessible name. Add text content, aria-label, or title.",s,"button-name"))}const n=e.querySelectorAll("a[href]");for(const s of n){const i=(s.textContent??"").trim().length>0,o=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title"),l=s.querySelector("img[alt]")!==null;!i&&!o&&!a&&!l&&t.push(Q("error","Link has no accessible name. Add text content, aria-label, or title.",s,"link-name"))}return t},Aa=e=>{const t=[],r=e.querySelectorAll("h1, h2, h3, h4, h5, h6");let n=0;for(const s of r){const i=parseInt(s.tagName.charAt(1),10);n>0&&i>n+1&&t.push(Q("warning",`Heading level skipped: <${s.tagName.toLowerCase()}> follows <h${n}>. Don't skip heading levels.`,s,"heading-order")),(s.textContent??"").trim().length===0&&t.push(Q("warning","Heading element is empty.",s,"heading-empty")),n=i}return t},Ca=e=>{const t=[],r=e.querySelectorAll("[aria-labelledby]");for(const s of r){const i=(s.getAttribute("aria-labelledby")??"").split(/\s+/);for(const o of i)o&&!document.getElementById(o)&&t.push(Q("error",`aria-labelledby references "${o}" which does not exist in the document.`,s,"aria-labelledby-ref"))}const n=e.querySelectorAll("[aria-describedby]");for(const s of n){const i=(s.getAttribute("aria-describedby")??"").split(/\s+/);for(const o of i)o&&!document.getElementById(o)&&t.push(Q("error",`aria-describedby references "${o}" which does not exist in the document.`,s,"aria-describedby-ref"))}return t},$a=e=>{const t=[];return(e===document.body||e===document.documentElement)&&(e.querySelector("main")||e.querySelector('[role="main"]')||t.push(Q("warning",'Page is missing a <main> landmark. Add <main> or role="main" to the primary content area.',e,"landmark-main"))),t},ka=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...wa(t),...Ea(t),...Sa(t),...Aa(t),...Ca(t),...$a(t)],n=r.filter(s=>s.severity==="error").length;return{findings:r,errors:n,warnings:r.filter(s=>s.severity==="warning").length,passed:n===0}},Yr=(e,t)=>{if(typeof e.addEventListener=="function")return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)};const r=e;if(typeof r.addListener=="function")return r.addListener(t),()=>{r.removeListener?.(t)}},Jr=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},La=()=>{const e=N("light");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function")try{const r=window.matchMedia("(prefers-color-scheme: dark)");e.value=r.matches?"dark":"light";const s=Yr(r,i=>{e.value=i.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return Jr(H(e),t)},Ta=()=>{const e=N("no-preference");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function"){let r,n,s;const i=()=>{!r||!n||!s||(r.matches?e.value="more":n.matches?e.value="less":s.matches?e.value="custom":e.value="no-preference")};try{r=window.matchMedia("(prefers-contrast: more)"),n=window.matchMedia("(prefers-contrast: less)"),s=window.matchMedia("(prefers-contrast: custom)"),i();const o=[r,n,s].map(a=>Yr(a,()=>{i()})).filter(a=>a!==void 0);o.length>0&&(t=()=>{for(const a of o)a();e.dispose()})}catch{}}return Jr(H(e),t)},Oa=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:i}=r;let o=0;const a=new Map,l=()=>Array.from(e.querySelectorAll(t)),f=c=>{for(const p of c)a.has(p)||a.set(p,p.getAttribute("tabindex"))},u=c=>{const p=l();if(p.length===0)return;f(p);const v=Math.max(0,Math.min(c,p.length-1));for(let b=0;b<p.length;b++)p[b].setAttribute("tabindex",b===v?"0":"-1");o=v,p[v].focus(),i?.(p[v],v)},m=c=>{if(c==="Home"||c==="End")return!0;switch(s){case"horizontal":return c==="ArrowLeft"||c==="ArrowRight";case"vertical":return c==="ArrowUp"||c==="ArrowDown";case"both":return c==="ArrowLeft"||c==="ArrowRight"||c==="ArrowUp"||c==="ArrowDown";default:return!1}},h=c=>{if(!m(c.key))return;const p=l();if(p.length===0)return;c.preventDefault();let v=o;switch(c.key){case"ArrowDown":case"ArrowRight":v=o+1,v>=p.length&&(v=n?0:p.length-1);break;case"ArrowUp":case"ArrowLeft":v=o-1,v<0&&(v=n?p.length-1:0);break;case"Home":v=0;break;case"End":v=p.length-1;break}u(v)},d=l();f(d);for(let c=0;c<d.length;c++)d[c].setAttribute("tabindex",c===0?"0":"-1");return e.addEventListener("keydown",h),{destroy:()=>{e.removeEventListener("keydown",h);for(const[c,p]of a)p===null?c.removeAttribute("tabindex"):c.setAttribute("tabindex",p);a.clear()},focusItem:c=>{u(c)},activeIndex:()=>o}},gt=`
|
|
176
|
+
position: absolute;
|
|
177
|
+
top: -9999px;
|
|
178
|
+
left: -9999px;
|
|
179
|
+
z-index: 999999;
|
|
180
|
+
padding: 0.5em 1em;
|
|
181
|
+
background: #000;
|
|
182
|
+
color: #fff;
|
|
183
|
+
font-size: 1rem;
|
|
184
|
+
text-decoration: none;
|
|
185
|
+
border-radius: 0 0 4px 0;
|
|
186
|
+
outline: 2px solid #4A90D9;
|
|
187
|
+
outline-offset: 2px;
|
|
188
|
+
`,Ra=`
|
|
189
|
+
top: 0;
|
|
190
|
+
left: 0;
|
|
191
|
+
`,Gr=0,de=new Map,Ma=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,Na=()=>({destroy:()=>{},element:null}),_a=(e,t={})=>{if(!Ma())return Na();const{text:r="Skip to main content",className:n="bq-skip-link"}=t;let s,i;const o=p=>{try{return document.querySelector(p)}catch{return null}},a=()=>{if(!s)return;const p=de.get(s),v=(p?.count??0)-1;v<=0?(de.delete(s),p?.target.isConnected&&p.target.id===s&&p.target.removeAttribute("id")):de.set(s,{count:v,target:p.target}),s=void 0},l=()=>{if(!i)return;const{target:p,hadTabIndex:v,previousTabIndex:b}=i;p.isConnected&&(v?p.setAttribute("tabindex",b??""):p.removeAttribute("tabindex")),i=void 0},f=p=>{if(i?.target!==p){if(l(),p.hasAttribute("tabindex")){i={target:p,hadTabIndex:!0,previousTabIndex:p.getAttribute("tabindex")};return}p.tabIndex===-1&&(i={target:p,hadTabIndex:!1,previousTabIndex:null},p.setAttribute("tabindex","-1"))}},u=(p,v)=>{if(s===v)return;a();const b=de.get(v);de.set(v,{count:(b?.count??0)+1,target:p}),s=v},m=()=>{if(e.startsWith("#")){const v=e.slice(1),b=v?document.getElementById(v):null;return b||o(e)}const p=document.getElementById(e);return p||o(e)},h=p=>{if(p.id)return de.get(p.id)?.target===p&&u(p,p.id),p.id;let v;do Gr+=1,v=`bq-skip-target-${Gr}`;while(document.getElementById(v)!==null);return p.id=v,u(p,v),v},d=document.createElement("a"),c=m();return d.href=e.startsWith("#")?e:c?`#${h(c)}`:`#${e}`,d.textContent=r,d.className=n,d.setAttribute("style",gt),d.addEventListener("focus",()=>{d.setAttribute("style",gt+Ra)}),d.addEventListener("blur",()=>{d.setAttribute("style",gt)}),d.addEventListener("click",p=>{p.preventDefault();const v=m();v&&(d.href=`#${h(v)}`,f(v),v.focus())}),document.body.firstChild?document.body.insertBefore(d,document.body.firstChild):document.body.appendChild(d),{destroy:()=>{l(),a(),d.remove()},element:d}},Da=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"details > summary","audio[controls]","video[controls]"].join(", "),vt=e=>Array.from(e.querySelectorAll(Da)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),Xr=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,Pa=(e,t={})=>{const{escapeDeactivates:r=!0,onEscape:n,initialFocus:s,returnFocus:i}=t;if(typeof document>"u"||typeof document.addEventListener!="function"||typeof document.removeEventListener!="function"){let m=!1;return{get active(){return m},release:()=>{m=!1}}}const o=document.activeElement;let a=!0;const l=m=>{if(!a)return;if(m.key==="Escape"&&r){m.preventDefault(),u.release(),n?.();return}if(m.key!=="Tab")return;const h=vt(e);if(h.length===0){m.preventDefault();return}const d=h[0],c=h[h.length-1];m.shiftKey?(document.activeElement===d||!e.contains(document.activeElement))&&(m.preventDefault(),c.focus()):(document.activeElement===c||!e.contains(document.activeElement))&&(m.preventDefault(),d.focus())};document.addEventListener("keydown",l,!0);const f=Xr(s,e);if(f)f.focus();else{const m=vt(e);m.length>0&&m[0].focus()}const u={get active(){return a},release:()=>{if(!a)return;a=!1,document.removeEventListener("keydown",l,!0);const m=Xr(i,document.body);m?m.focus():o&&o.focus&&o.focus()}};return u},Ia=e=>{e.release()},Oe=new Map,Zr=()=>{const e=Array.from(Oe.values());return e[e.length-1]},qa=(e,t)=>{if(typeof t=="object")return t;let r=null;if(t==="parent"?r=e.parentElement:r=document.querySelector(t),!r)return null;const n=r.getBoundingClientRect(),s=e.getBoundingClientRect(),i=parseFloat(e.style.left||"0"),o=parseFloat(e.style.top||"0"),a=Number.isNaN(i)?0:i,l=Number.isNaN(o)?0:o;return{left:n.left-s.left+a,top:n.top-s.top+l,right:n.right-s.right+a+(n.width-s.width),bottom:n.bottom-s.bottom+l+(n.height-s.height)}},xa=(e,t)=>t?{x:Math.max(t.left,Math.min(t.right,e.x)),y:Math.max(t.top,Math.min(t.bottom,e.y))}:e,ja=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:i=!1,ghostClass:o="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:l,onDrag:f,onDragEnd:u}=t;let m=!t.disabled,h=!1,d={x:0,y:0},c={x:0,y:0},p={x:0,y:0},v=null,b=null;const g=e.style.touchAction,w=e.style.userSelect,S=C=>({element:e,position:{...c},delta:{x:c.x-p.x,y:c.y-p.y},event:C}),M=()=>{const C=e.cloneNode(!0),L=e.getBoundingClientRect();return C.classList.add(o),C.style.position="fixed",C.style.left=`${L.left}px`,C.style.top=`${L.top}px`,C.style.width=`${L.width}px`,C.style.height=`${L.height}px`,C.style.pointerEvents="none",C.style.zIndex="999999",C.style.opacity="0.7",C.style.margin="0",document.body.appendChild(C),C},T=()=>{v&&(v.remove(),v=null),b=null},E=C=>{if(m&&!(s&&!C.target.closest(s))){if(C.preventDefault(),h=!0,d={x:C.clientX,y:C.clientY},p={...c},e.classList.add(a),e.setPointerCapture(C.pointerId),i){const L=e.getBoundingClientRect();b={x:L.left,y:L.top},v=M()}Oe.set(e,{element:e,position:c}),l?.(S(C))}},k=C=>{if(!h)return;C.preventDefault(),p={...c};let L=c.x+(C.clientX-d.x),A=c.y+(C.clientY-d.y);d={x:C.clientX,y:C.clientY},r==="x"&&(A=c.y),r==="y"&&(L=c.x);let $={x:L,y:A};if(n){const R=qa(e,n);$=xa($,R)}if(c=$,Oe.set(e,{element:e,position:c}),i&&v){const R=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};v.style.left=`${R.x+c.x}px`,v.style.top=`${R.y+c.y}px`}else e.style.transform=`translate(${c.x}px, ${c.y}px)`;f?.(S(C))},O=C=>{if(h){h=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(C.pointerId))&&e.releasePointerCapture(C.pointerId)}catch{}finally{T(),Oe.delete(e),u?.(S(C))}}};return e.addEventListener("pointerdown",E),e.addEventListener("pointermove",k),e.addEventListener("pointerup",O),e.addEventListener("pointercancel",O),e.style.touchAction="none",e.style.userSelect="none",{destroy:()=>{e.removeEventListener("pointerdown",E),e.removeEventListener("pointermove",k),e.removeEventListener("pointerup",O),e.removeEventListener("pointercancel",O),T(),Oe.delete(e),e.style.touchAction=g,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},za={passive:!0},Re=new Set,Me=null,J=null,en=()=>Array.from(Re),Fa=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",Ba=e=>{for(const t of en())t.handlePointerMove(e)},Ha=()=>{J=null;const e=Me;Me=null,e&&Ba(e)},tn=e=>{Me=e,J===null&&(J=requestAnimationFrame(Ha))},rn=e=>{J!==null&&(cancelAnimationFrame(J),J=null,Me=null);for(const t of en())t.handlePointerUp(e)},Qa=e=>{Re.size===0&&(document.addEventListener("pointermove",tn,za),document.addEventListener("pointerup",rn)),Re.add(e)},Ua=e=>{Re.delete(e),Re.size===0&&(document.removeEventListener("pointermove",tn),document.removeEventListener("pointerup",rn),J!==null&&(cancelAnimationFrame(J),J=null),Me=null)},nn=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,Va=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:i,onDragLeave:o,onDrop:a}=t;if(!Fa())return{destroy:()=>{}};let l=!1,f=null;const u=(b,g)=>({zone:e,dragged:b,event:g}),m=b=>{const g=e.getBoundingClientRect();return b.clientX>=g.left&&b.clientX<=g.right&&b.clientY>=g.top&&b.clientY<=g.bottom},h=()=>Zr()?.element??f,d=(b,g=f)=>{l&&(l=!1,e.classList.remove(r),g&&o?.(u(g,b)),f=null)},v={handlePointerMove:b=>{const g=Zr()?.element??null,w=m(b);if(!(g!==null&&g!==e&&nn(g,n))||!w){d(b,g??f);return}l?i?.(u(g,b)):(l=!0,f=g,e.classList.add(r),s?.(u(g,b)))},handlePointerUp:b=>{const g=h(),w=m(b),S=g!==null&&g!==e&&nn(g,n);w&&S&&g&&a?.(u(g,b)),l&&(l=!1,e.classList.remove(r)),f=null}};return Qa(v),{destroy:()=>{Ua(v),e.classList.remove(r),f=null}}},sn=(e,t)=>Array.from(e.querySelectorAll(t)),Wa=(e,t,r,n)=>{let s=null;for(let i=0;i<e.length;i++){const o=e[i];if(o===n)continue;const a=o.getBoundingClientRect(),l=t-(r==="y"?a.top+a.height/2:a.left+a.width/2);(s===null||l<0&&l>s.distance||s.distance>=0&&l<0&&Math.abs(l)<Math.abs(s.distance))&&l<0&&(s={element:o,index:i,distance:l})}return s?{element:s.element,index:s.index}:null},Ka=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:i="bq-sort-placeholder",sortingClass:o="bq-sorting",animationDuration:a=200,onSortStart:l,onSortMove:f,onSortEnd:u}=t;let m=!t.disabled,h=!1,d=null,c=null,p=-1,v=0,b=0,g=0,w=0;const S=(O,C,L)=>({container:e,item:O,oldIndex:C,newIndex:L}),M=O=>{if(!m)return;const C=O.target,L=sn(e,r);let A=null;for(const R of L)if(R.contains(C)){A=R;break}if(!A||s&&!C.closest(s))return;O.preventDefault(),h=!0,d=A,p=L.indexOf(A),v=O.clientY,b=O.clientX;const $=A.getBoundingClientRect();g=$.top,w=$.left,c=document.createElement("div"),c.classList.add(i),c.style.width=`${$.width}px`,c.style.height=`${$.height}px`,c.style.boxSizing="border-box",A.classList.add(o),A.style.position="fixed",A.style.width=`${$.width}px`,A.style.height=`${$.height}px`,A.style.left=`${$.left}px`,A.style.top=`${$.top}px`,A.style.zIndex="999999",A.style.pointerEvents="none",A.style.margin="0",A.parentNode?.insertBefore(c,A),e.setPointerCapture(O.pointerId),l?.(S(A,p,p))},T=O=>{if(!h||!d||!c)return;O.preventDefault();const C=O.clientX-b,L=O.clientY-v;n==="y"?d.style.top=`${g+L}px`:d.style.left=`${w+C}px`;const A=Wa(sn(e,r),n==="y"?O.clientY:O.clientX,n,d);A?e.insertBefore(c,A.element):e.appendChild(c);const $=Array.from(e.children).indexOf(c);f?.(S(d,p,$))},E=O=>{if(!h||!d||!c)return;h=!1;const C=d,L=Array.from(e.children).indexOf(c),A=c.getBoundingClientRect(),$=C.getBoundingClientRect();if(a>0){const R=A.left-$.left,P=A.top-$.top;C.style.transition=`transform ${a}ms ease`,C.style.transform=`translate(${R}px, ${P}px)`;let j=!1,D=null;const B=()=>{j||(j=!0,D!==null&&(window.clearTimeout(D),D=null),k(),u?.(S(C,p,L)))};D=window.setTimeout(()=>{B()},a+50),C.addEventListener("transitionend",B,{once:!0})}else k(),u?.(S(C,p,L));e.releasePointerCapture(O.pointerId)},k=()=>{!d||!c||(c.parentNode?.insertBefore(d,c),c.remove(),c=null,d.classList.remove(o),d.style.position="",d.style.width="",d.style.height="",d.style.left="",d.style.top="",d.style.zIndex="",d.style.pointerEvents="",d.style.margin="",d.style.transition="",d.style.transform="",d=null)};return e.addEventListener("pointerdown",M),e.addEventListener("pointermove",T),e.addEventListener("pointerup",E),e.addEventListener("pointercancel",E),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",M),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",E),e.removeEventListener("pointercancel",E),e.style.touchAction="",h&&k()},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},Ya=e=>{const t=N(!1);let r;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const i=window.matchMedia(e);t.value=i.matches;const o=a=>{t.value=a.matches};if(typeof i.addEventListener=="function")i.addEventListener("change",o),r=()=>{i.removeEventListener("change",o)};else if(typeof i.addListener=="function"){const a=i;a.addListener(o),r=()=>{a.removeListener(o)}}}catch{}const n=H(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},Ja=e=>{const t={},r=[];for(const i of Object.keys(e)){const o=e[i],a=N(!1);let l;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const m=window.matchMedia(`(min-width: ${o}px)`);a.value=m.matches;const h=d=>{a.value=d.matches};if(typeof m.addEventListener=="function")m.addEventListener("change",h),l=()=>{m.removeEventListener("change",h)};else{const d=m;typeof d.addListener=="function"&&(d.addListener(h),l=()=>{d.removeListener?.(h)})}}catch{}const f=H(a);let u=!1;Object.defineProperty(f,"destroy",{enumerable:!1,configurable:!0,value(){u||(u=!0,l?.(),a.dispose())}}),r.push(f.destroy),t[i]=f}let n=!1;const s=Object.defineProperty(t,"destroyAll",{enumerable:!1,configurable:!0,value(){n||(n=!0,r.forEach(i=>{i()}))}});return Object.prototype.hasOwnProperty.call(t,"destroy")||Object.defineProperty(s,"destroy",{enumerable:!1,configurable:!0,value:s.destroyAll}),s},on=(e,t)=>t>=e?"portrait":"landscape",Ga=()=>{const e=N({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?on(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:on(window.innerWidth,window.innerHeight)}};window.addEventListener("resize",s),t=()=>{window.removeEventListener("resize",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value:()=>{n||(n=!0,t?.(),e.dispose())}}),r},an=()=>{const e=typeof navigator<"u"&&navigator.onLine!==void 0?navigator.onLine:!0,t=(typeof navigator<"u"?navigator:void 0)?.connection;return{online:e,effectiveType:t?.effectiveType??"unknown",downlink:t?.downlink??0,rtt:t?.rtt??0}},Xa=()=>{const e=N(an());let t;if(typeof window<"u"){const s=()=>{e.value=an()};window.addEventListener("online",s),window.addEventListener("offline",s);const i=typeof navigator<"u"?navigator:void 0;i?.connection&&typeof i.connection.addEventListener=="function"&&i.connection.addEventListener("change",s),t=()=>{window.removeEventListener("online",s),window.removeEventListener("offline",s),i?.connection&&typeof i.connection.removeEventListener=="function"&&i.connection.removeEventListener("change",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},Za={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},el=()=>{const e=N({...Za});let t,r=!1;typeof navigator<"u"&&"getBattery"in navigator&&typeof navigator.getBattery=="function"&&navigator.getBattery().then(s=>{if(r)return;const i=()=>{e.value={supported:!0,charging:s.charging,chargingTime:s.chargingTime,dischargingTime:s.dischargingTime,level:s.level}};i(),s.addEventListener("chargingchange",i),s.addEventListener("chargingtimechange",i),s.addEventListener("dischargingtimechange",i),s.addEventListener("levelchange",i),t=()=>{s.removeEventListener("chargingchange",i),s.removeEventListener("chargingtimechange",i),s.removeEventListener("dischargingtimechange",i),s.removeEventListener("levelchange",i)}}).catch(()=>{});const n=H(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},ln={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},tl=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,i=N({...ln});let o;if(typeof navigator<"u"&&"geolocation"in navigator){i.value={...ln,supported:!0,loading:!0};const f={enableHighAccuracy:t,maximumAge:r,timeout:n===1/0?void 0:n},u=h=>{i.value={supported:!0,loading:!1,latitude:h.coords.latitude,longitude:h.coords.longitude,accuracy:h.coords.accuracy,altitude:h.coords.altitude,altitudeAccuracy:h.coords.altitudeAccuracy,heading:h.coords.heading,speed:h.coords.speed,timestamp:h.timestamp,error:null}},m=h=>{i.value={...i.value,loading:!1,error:h.message}};if(s){const h=navigator.geolocation.watchPosition(u,m,f);o=()=>{navigator.geolocation.clearWatch(h)}}else navigator.geolocation.getCurrentPosition(u,m,f)}const a=H(i);let l=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){l||(l=!0,o?.(),i.dispose())}}),a},rl={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},nl={alpha:null,beta:null,gamma:null,absolute:!1},sl=()=>{const e=N({...rl});let t;if(typeof window<"u"){const s=i=>{e.value={acceleration:{x:i.acceleration?.x??null,y:i.acceleration?.y??null,z:i.acceleration?.z??null},accelerationIncludingGravity:{x:i.accelerationIncludingGravity?.x??null,y:i.accelerationIncludingGravity?.y??null,z:i.accelerationIncludingGravity?.z??null},rotationRate:{alpha:i.rotationRate?.alpha??null,beta:i.rotationRate?.beta??null,gamma:i.rotationRate?.gamma??null},interval:i.interval??0}};window.addEventListener("devicemotion",s),t=()=>{window.removeEventListener("devicemotion",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},il=()=>{const e=N({...nl});let t;if(typeof window<"u"){const s=i=>{e.value={alpha:i.alpha??null,beta:i.beta??null,gamma:i.gamma??null,absolute:i.absolute??!1}};window.addEventListener("deviceorientation",s),t=()=>{window.removeEventListener("deviceorientation",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},cn="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",ol={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(cn);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(cn);return navigator.clipboard.writeText(e)}},Ne=new Set,G=new Map;Jo(e=>G.get(e));var un=e=>{G.clear();for(const[t,r]of e)G.set(t,r)},al=e=>({directive(t,r){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin directive: name must be a non-empty string");if(t.startsWith("bq-")){const n=t.slice(3);throw new Error(`bQuery plugin directive: name "${t}" must be provided without the "bq-" prefix`+(n?` (use "${n}")`:""))}if(typeof r!="function")throw new Error(`bQuery plugin directive: handler for "${t}" must be a function`);if(G.has(t))throw new Error(`bQuery plugin directive: a directive named "${t}" is already registered`);G.set(t,r)},component(t,r,n){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin component: tagName must be a non-empty string");if(!t.includes("-"))throw new Error(`bQuery plugin component: tagName "${t}" must be a valid custom element name containing a hyphen`);if(typeof r!="function")throw new Error(`bQuery plugin component: constructor for "${t}" must be a function`);if(typeof customElements>"u"){typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery] plugin component "${t}" was not registered because customElements is not available in this environment.`);return}!customElements.get(t)&&!e.some(s=>s.tagName===t)&&e.push({tagName:t,constructor:r,options:n})}}),ll=(e,t)=>{if(!e||typeof e!="object")throw new Error("bQuery plugin: use() expects a plugin object with { name, install }");if(typeof e.name!="string"||e.name.length===0)throw new Error('bQuery plugin: plugin must have a non-empty "name" property');if(typeof e.install!="function")throw new Error(`bQuery plugin: plugin "${e.name}" must have an "install" function`);if(Ne.has(e.name))return;const r=[],n=al(r),s=new Map(G);try{e.install(n,t)}catch(i){throw un(s),i}try{for(const i of r)customElements.get(i.tagName)||customElements.define(i.tagName,i.constructor,i.options)}catch(i){throw un(s),i}Ne.add(e.name)},cl=e=>Ne.has(e),ul=()=>[...Ne],fl=e=>G.get(e),dl=()=>[...G.entries()].map(([e,t])=>({name:e,handler:t})),hl=()=>{Ne.clear(),G.clear()},_e=!1,bt={},re=[],Ve=new Map,fn=0,ml=(e,t)=>{_e=e,bt=t??{},e||(re.length=0,Ve.clear(),fn=0)},pl=()=>_e,yl=(e,t,r)=>{if(_e){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");Ve.set(e,{peek:t,subscriberCount:r})}},gl=e=>{Ve.delete(e)},vl=()=>`signal_${fn++}`,dn=()=>{const e=[];for(const[t,r]of Ve)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},hn=()=>{try{return ht().map(e=>{const t=$e(e),r={};if(t&&typeof t=="object"&&"$state"in t){const n=t.$state;n&&typeof n=="object"&&Object.assign(r,n)}return{id:e,state:r}})}catch{return[]}},mn=()=>{if(typeof document>"u")return[];const e=[],t=new Set,r=document.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n].tagName.toLowerCase();if(s.includes("-")&&!t.has(s)&&typeof customElements<"u"&&customElements.get(s)){t.add(s);const i=document.querySelectorAll(s);e.push({tagName:s,instanceCount:i.length})}}return e},bl=(e,t)=>{if(!_e)return;const r={timestamp:Date.now(),type:e,detail:t};re.push(r),bt.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},wl=()=>re,El=()=>{re.length=0},Sl=()=>({enabled:_e,options:{...bt},timeline:[...re]}),Al=()=>{const e=dn();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},Cl=()=>{const e=hn();if(e.length===0){console.log("[bq:devtools] No stores registered.");return}console.table(e.map(t=>({id:t.id,state:JSON.stringify(t.state)})))},$l=()=>{const e=mn();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},kl=e=>{const t=typeof e=="number"&&e>0?re.slice(-e):re;if(t.length===0){console.log("[bq:devtools] Timeline is empty.");return}console.table(t.map(r=>({time:new Date(r.timestamp).toISOString(),type:r.type,detail:r.detail})))},pn=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),Ll=(e,t)=>{let r=1,n="",s=t+1;for(;s<e.length;){const i=e[s];if(i==="\\"&&s+1<e.length){n+=i+e[s+1],s+=2;continue}if(i==="(")r++;else if(i===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=i,s++}return null},yn=new Map,Tl=e=>{const t=dt(e),r=yn.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return yn.set(t,n),n};function Ol(e,t={}){if(!e||!e.includes("-"))throw new Error(`bQuery testing: "${e}" is not a valid custom element tag name (must contain a hyphen)`);const{props:r,slots:n,container:s=document.body}=t,i=document.createElement(e);if(r)for(const[a,l]of Object.entries(r))l!=null&&i.setAttribute(a,String(l));if(n)if(typeof n=="string")i.innerHTML=n;else{const a=[];for(const[l,f]of Object.entries(n))if(l==="default")a.push(f);else{const u=l.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");a.push(`<div slot="${u}">${f}</div>`)}i.innerHTML=a.join("")}return s.appendChild(i),{el:i,unmount:()=>{i.parentNode&&i.parentNode.removeChild(i)}}}function gn(){ve(()=>{})}function Rl(e){const t=N(e);return Object.defineProperty(t,"initialValue",{value:e,writable:!1,enumerable:!0}),t.set=function(r){t.value=r},t.reset=function(){t.value=e},t}function Ml(e,t){let r=e;t&&r.startsWith(t)&&(r=r.slice(t.length)||"/");let n="";const s=r.indexOf("#");s>=0&&(n=r.slice(s+1),r=r.slice(0,s));const i={},o=r.indexOf("?");if(o>=0){const a=r.slice(o+1);r=r.slice(0,o);for(const l of a.split("&")){const f=l.indexOf("="),u=f>=0?decodeURIComponent(l.slice(0,f)):decodeURIComponent(l),m=f>=0?decodeURIComponent(l.slice(f+1)):"",h=i[u];h!==void 0?Array.isArray(h)?h.push(m):i[u]=[h,m]:i[u]=m}}return{path:r||"/",query:i,hash:n}}function Nl(e,t){for(const r of t){const n=_l(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function _l(e,t){if(e==="*")return{};const r=new Map,n=(i,o)=>{const a=i.indexOf("/",o);return a===-1?i.length:a},s=(i,o)=>{const a=`${i}:${o}`;if(r.has(a))return r.get(a)??null;if(i===e.length){const u=o===t.length?{}:null;return r.set(a,u),u}const l=e[i];if(l==="*"){for(let u=t.length;u>=o;u--){const m=s(i+1,u);if(m)return r.set(a,m),m}return r.set(a,null),null}if(l===":"&&pn(e[i+1])){let u=i+2;for(;u<e.length&&pn(e[u]);)u++;const m=e.slice(i+1,u);let h=u,d,c=!1;if(e[u]==="("){const v=Ll(e,u);v&&(d=v.constraint,h=v.endIndex)}e[h]==="*"&&(c=!0,h++);const p=c||d?t.length:n(t,o);for(let v=p;v>o;v--){const b=t.slice(o,v);if(d&&!Tl(d).test(b))continue;const g=s(h,v);if(g){const w={[m]:b,...g};return r.set(a,w),w}}return r.set(a,null),null}if(o>=t.length||l!==t[o])return r.set(a,null),null;const f=s(i+1,o+1);return r.set(a,f),f};return s(0,0)}function Dl(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=o=>{const{path:a,query:l,hash:f}=Ml(o,r),{matched:u,params:m}=Nl(a,t);return{path:a,params:m,query:l,matched:u,hash:f}},i=N(s(n));return{push(o){i.value=s(o)},replace(o){i.value=s(o)},get currentRoute(){return i},get routes(){return t},destroy(){i.dispose()}}}function Pl(e,t,r={}){if(!e)throw new Error("bQuery testing: fireEvent requires a valid element");if(!t)throw new Error("bQuery testing: fireEvent requires an event name");const{bubbles:n=!0,cancelable:s=!0,composed:i=!0,detail:o}=r;let a;o!==void 0?a=new CustomEvent(t,{bubbles:n,cancelable:s,composed:i,detail:o}):a=new Event(t,{bubbles:n,cancelable:s,composed:i});const l=e.dispatchEvent(a);return gn(),l}async function Il(e,t={}){if(typeof e!="function")throw new Error("bQuery testing: waitFor requires a predicate function");const{timeout:r=1e3,interval:n=10}=t,s=Date.now();for(;;){try{if(await e())return}catch{}if(Date.now()-s>=r)throw new Error(`bQuery testing: waitFor timed out after ${r}ms — predicate never returned true`);await new Promise(i=>setTimeout(i,n))}}var ql=(e,t,r={})=>{const{hydrate:n=!0,...s}=r;if(!n)throw new Error("bQuery ssr: hydrateMount() requires { hydrate: true } when options are provided.");return yt(e,t,s)},We=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),wt=e=>{const t={};for(const[r,n]of Object.entries(e))I(r)||(t[r]=n);return t},vn=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),xl=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"),bn=(e={})=>{const{scriptId:t="__BQUERY_STORE_STATE__",globalKey:r="__BQUERY_INITIAL_STATE__",storeIds:n,serialize:s=JSON.stringify}=e;if(I(r))throw new Error(`serializeStoreState: invalid globalKey "${r}" - prototype-pollution keys are not allowed.`);if(I(t))throw new Error(`serializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);const i=n??ht(),o=Object.create(null);for(const u of i){if(I(u))continue;const m=$e(u);m&&(o[u]=wt(m.$state))}const a=s(o);if(typeof a!="string")throw new Error("serializeStoreState: custom serialize function must return a string.");if(s!==JSON.stringify){let u;try{u=JSON.parse(a)}catch{throw new Error("serializeStoreState: custom serialize function returned invalid JSON.")}if(!We(u))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const l=vn(a),f=vn(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${xl(t)}">window[${f}]=${l}<\/script>`}},jl=(e="__BQUERY_INITIAL_STATE__",t="__BQUERY_STORE_STATE__")=>{if(I(e))throw new Error(`deserializeStoreState: invalid globalKey "${e}" - prototype-pollution keys are not allowed.`);if(I(t))throw new Error(`deserializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);if(typeof window>"u")return{};const r=window[e];if(!r)return{};try{delete window[e]}catch{window[e]=void 0}if(typeof document<"u"&&typeof document.getElementById=="function"){const s=document.getElementById(t);s&&s.remove()}if(!We(r))return{};for(const s of Object.values(r))if(!We(s))return{};const n=Object.create(null);for(const[s,i]of Object.entries(r))I(s)||!We(i)||(n[s]=wt(i));return n},wn=(e,t)=>{const r=$e(e);r&&typeof r.$patch=="function"&&r.$patch(wt(t))},zl=e=>{for(const[t,r]of Object.entries(e))wn(t,r)},Fl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),En=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Bl=e=>En(e).replace(/"/g,"""),Hl=e=>{const t=e.toLowerCase();return t==="href"||t==="src"||t==="xlink:href"||t==="formaction"||t==="action"||t==="poster"||t==="background"||t==="cite"||t==="data"},Ql=e=>e.trim().replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),Ul=e=>{const t=Ql(e);return Lt.some(r=>t.startsWith(r))},Sn=e=>{if(e.nodeType===Node.TEXT_NODE)return En(e.textContent??"");if(e.nodeType!==Node.ELEMENT_NODE)return"";const t=e,r=t.tagName.toLowerCase();if(r==="script")return"";let n="";for(const i of t.attributes){const o=i.name.toLowerCase();o.startsWith("on")||Hl(o)&&Ul(i.value)||(n+=` ${i.name}="${Bl(i.value)}"`)}if(Fl.has(r))return`<${r}${n}>`;let s="";for(const i of t.childNodes)s+=Sn(i);return`<${r}${n}>${s}</${r}>`},An=e=>we(e)||nt(e)?e.value:e,U=(e,t)=>{const r=e.trim();if(r.startsWith("!"))return!U(r.slice(1).trim(),t);if(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);if(/^-?\d+(\.\d+)?$/.test(r))return Number(r);if(r==="true")return!0;if(r==="false")return!1;if(r==="null")return null;if(r!=="undefined"){if(/^[\w$]+(?:\.[\w$]+)*$/.test(r)){const n=r.split(".");let s=t;for(const i of n){if(s==null)return;s===t?s=An(s[i]):s=s[i]}return s}try{const n=Object.keys(t),s=n.map(i=>An(t[i]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},Vl=e=>{const t=e.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);return t?{itemName:t[1],indexName:t[2]||void 0,listExpr:t[3].trim()}:null},Et=(e,t,r,n)=>{const s=e.getAttribute(`${r}-if`);if(s!==null&&!U(s,t))return!1;const i=e.getAttribute(`${r}-show`);if(i!==null&&!U(i,t)){const h=e;h.style?h.style.display="none":e.setAttribute("style","display: none;")}const o=e.getAttribute(`${r}-text`);if(o!==null){const h=U(o,t);e.textContent=String(h??"")}const a=e.getAttribute(`${r}-html`);if(a!==null){const h=U(a,t);e.innerHTML=String(V(String(h??"")))}const l=e.getAttribute(`${r}-class`);if(l!==null){const h=l.trim();if(h.startsWith("{")){const d=h.slice(1,-1).trim().split(",");for(const c of d){const p=c.indexOf(":");if(p>-1){const v=c.slice(0,p).trim().replace(/^['"]|['"]$/g,"");U(c.slice(p+1).trim(),t)&&e.classList.add(v)}}}else{const d=U(l,t);typeof d=="string"?d.split(/\s+/).filter(Boolean).forEach(c=>e.classList.add(c)):Array.isArray(d)&&d.filter(Boolean).forEach(c=>e.classList.add(c))}}const f=e.getAttribute(`${r}-style`);if(f!==null){const h=U(f,t);if(h&&typeof h=="object"){const d=e;for(const[c,p]of Object.entries(h)){const v=c.replace(/([A-Z])/g,"-$1").toLowerCase();d.style.setProperty(v,String(p))}}}const u=Array.from(e.attributes);for(const h of u)if(h.name.startsWith(`${r}-bind:`)){const d=h.name.slice(`${r}-bind:`.length),c=U(h.value,t);c===!1||c===null||c===void 0?e.removeAttribute(d):c===!0?e.setAttribute(d,""):e.setAttribute(d,String(c))}const m=e.getAttribute(`${r}-for`);if(m!==null){const h=Vl(m);if(h){const d=U(h.listExpr,t);if(Array.isArray(d)&&e.parentNode){const c=e.parentNode;for(let p=0;p<d.length;p++){const v=d[p],b=e.cloneNode(!0);b.removeAttribute(`${r}-for`),b.removeAttribute(":key"),b.removeAttribute(`${r}-key`);const g={...t,[h.itemName]:v};h.indexName&&(g[h.indexName]=p),Et(b,g,r,n),St(b,g,r,n),c.insertBefore(b,e)}return c.removeChild(e),!0}}}return!0},St=(e,t,r,n)=>{const s=Array.from(e.children);for(const i of s){if(i.hasAttribute(`${r}-for`)){Et(i,t,r,n)||i.remove();continue}if(!Et(i,t,r,n)){i.remove();continue}St(i,t,r,n)}},Cn=(e,t)=>{const r=Array.from(e.attributes);for(const n of r)(n.name.startsWith(`${t}-`)||n.name.startsWith(":")||n.name===":key")&&e.removeAttribute(n.name);for(const n of Array.from(e.children))Cn(n,t)},Wl=(e,t,r={})=>{const{prefix:n="bq",stripDirectives:s=!1,includeStoreState:i=!1}=r;if(!e||typeof e!="string")throw new Error("bQuery SSR: template must be a non-empty string.");if(typeof DOMParser>"u")throw new Error("bQuery SSR: DOMParser is not available in this environment. Provide a DOMParser-compatible implementation before calling renderToString().");const o=new DOMParser().parseFromString(e.trim(),"text/html"),a=o.body||o.documentElement;if(!a)throw new Error("bQuery SSR: Failed to parse template.");if(St(a,t,n,o),s)for(const u of Array.from(a.children))Cn(u,n);let l="";for(const u of a.childNodes)l+=Sn(u);let f;return i&&(f=bn({storeIds:Array.isArray(i)?i:void 0}).stateJson),{html:l,storeState:f}};y.$=Yn,y.$$=Jn,y.BQueryCollection=qe,y.BQueryElement=ie,y.BqLinkElement=Sr,y.Computed=et,y.Signal=tt,y.animate=Fe,y.announceToScreenReader=va,y.auditA11y=ka,y.back=Wi,y.batch=ve,y.bool=oi,y.breakpoints=Ja,y.buckets=Mi,y.cache=_i,y.capturePosition=ct,y.clearAnnouncements=ba,y.clearTimeline=El,y.clipboard=ol,y.component=le,y.computed=q,y.createForm=ra,y.createI18n=pa,y.createPersistedStore=Po,y.createRouter=yo,y.createStore=Ir,y.createTemplate=Xo,y.createTrustedHtml=Fn,y.createUseFetch=Vs,y.currentRoute=wr,y.custom=fa,y.customAsync=da,y.defineBqueryConfig=Ds,y.defineComponent=ri,y.definePageMeta=Bi,y.deserializeStoreState=jl,y.destroyStore=Lo,y.draggable=ja,y.droppable=Va,y.easeInCubic=lr,y.easeInOutCubic=ur,y.easeInOutQuad=ar,y.easeInQuad=ir,y.easeOutBack=fr,y.easeOutCubic=cr,y.easeOutExpo=dr,y.easeOutQuad=or,y.easingPresets=hi,y.effect=x,y.email=aa,y.enableDevtools=ml,y.escapeHtml=It,y.fireEvent=Pl,y.flip=ut,y.flipElements=hr,y.flipList=mi,y.flushEffects=gn,y.formatDate=Ur,y.formatNumber=Qr,y.forward=Ki,y.generateNonce=xn,y.generateSignalLabel=vl,y.getBqueryConfig=X,y.getCustomDirective=fl,y.getCustomDirectives=dl,y.getDevtoolsState=Sl,y.getFocusableElements=vt,y.getInstalledPlugins=ul,y.getStore=$e,y.getTimeline=wl,y.getTrustedTypesPolicy=Pt,y.hasCSPDirective=jn,y.html=ce,y.hydrateMount=ql,y.hydrateStore=wn,y.hydrateStores=zl,y.inspectComponents=mn,y.inspectSignals=dn,y.inspectStores=hn,y.interceptLinks=eo,y.isActive=fo,y.isActiveSignal=ho,y.isComputed=nt,y.isDevtoolsEnabled=pl,y.isInstalled=cl,y.isSignal=we,y.isTrustedTypesSupported=zn,y.keyframePresets=pi,y.linear=sr,y.link=Zi,y.linkedSignal=Ws,y.listStores=ht,y.logComponents=$l,y.logSignals=Al,y.logStores=Cl,y.logTimeline=kl,y.mapActions=Ro,y.mapState=Oo,y.max=ua,y.maxLength=ia,y.mediaQuery=Ya,y.min=ca,y.minLength=sa,y.mockRouter=Dl,y.mockSignal=Rl,y.morphElement=yi,y.mount=yt,y.navigate=Se,y.notifications=ji,y.parallax=gi,y.pattern=oa,y.persistedSignal=Ks,y.prefersColorScheme=La,y.prefersContrast=Ta,y.prefersReducedMotion=W,y.readonly=H,y.recordEvent=bl,y.registerBqLink=Xi,y.registerDefaultComponents=fi,y.registerPlugin=Ao,y.releaseFocus=Ia,y.renderComponent=Ol,y.renderToString=Wl,y.required=na,y.resetPlugins=hl,y.resolve=uo,y.rovingTabIndex=Oa,y.safeHtml=ai,y.sanitize=V,y.sanitizeHtml=V,y.scrollAnimate=bi,y.sequence=ki,y.serializeStoreState=bn,y.setReducedMotion=di,y.signal=N,y.skipLink=_a,y.sortable=Ka,y.spring=Ei,y.springPresets=Si,y.stagger=Ai,y.storage=Vi,y.stripTags=Bn,y.timeline=Li,y.trackSignal=yl,y.transition=Ti,y.trapFocus=Pa,y.trusted=Pn,y.typewriter=Oi,y.untrack=ae,y.untrackSignal=gl,y.url=la,y.use=ll,y.useAnnouncer=Fi,y.useAsyncData=Kt,y.useBattery=el,y.useComputed=Xs,y.useCookie=xi,y.useDeviceMotion=sl,y.useDeviceOrientation=il,y.useEffect=Zs,y.useFetch=Yt,y.useGeolocation=tl,y.useNetworkStatus=Xa,y.useRoute=vo,y.useSignal=Gs,y.useViewport=Ga,y.utils=Os,y.waitFor=Il,y.watch=Ys});
|
|
176
192
|
|
|
177
193
|
//# sourceMappingURL=full.umd.js.map
|