microui-wc 0.1.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/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +33 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- package/.github/workflows/ci.yml +42 -0
- package/.github/workflows/deploy-pages.yml +112 -0
- package/AGENTS.md +2366 -0
- package/CHANGELOG.md +47 -0
- package/CODE_OF_CONDUCT.md +59 -0
- package/CONTRIBUTING.md +156 -0
- package/LICENSE +190 -0
- package/README.md +254 -0
- package/SECURITY.md +58 -0
- package/app/.generated/routes/alerts.js +8 -0
- package/app/.generated/routes/avatars.js +8 -0
- package/app/.generated/routes/badges.js +8 -0
- package/app/.generated/routes/buttons.js +10 -0
- package/app/.generated/routes/cards.js +10 -0
- package/app/.generated/routes/checkboxes.js +9 -0
- package/app/.generated/routes/chips.js +8 -0
- package/app/.generated/routes/dropdowns.js +9 -0
- package/app/.generated/routes/home.js +7 -0
- package/app/.generated/routes/icons.js +9 -0
- package/app/.generated/routes/inputs.js +10 -0
- package/app/.generated/routes/installation.js +7 -0
- package/app/.generated/routes/layout.js +9 -0
- package/app/.generated/routes/modals.js +9 -0
- package/app/.generated/routes/navbar.js +7 -0
- package/app/.generated/routes/progress.js +9 -0
- package/app/.generated/routes/radios.js +9 -0
- package/app/.generated/routes/switches.js +9 -0
- package/app/.generated/routes/tabs.js +8 -0
- package/app/.generated/routes/toasts.js +9 -0
- package/app/index.html +67 -0
- package/app/pages/alerts.html +23 -0
- package/app/pages/avatars.html +22 -0
- package/app/pages/badges.html +22 -0
- package/app/pages/buttons.html +71 -0
- package/app/pages/cards.html +54 -0
- package/app/pages/checkboxes.html +39 -0
- package/app/pages/chips.html +23 -0
- package/app/pages/dropdowns.html +41 -0
- package/app/pages/home.html +59 -0
- package/app/pages/icons.html +29 -0
- package/app/pages/inputs.html +66 -0
- package/app/pages/installation.html +34 -0
- package/app/pages/layout.html +30 -0
- package/app/pages/modals.html +21 -0
- package/app/pages/navbar.html +22 -0
- package/app/pages/progress.html +35 -0
- package/app/pages/radios.html +40 -0
- package/app/pages/switches.html +39 -0
- package/app/pages/tabs.html +30 -0
- package/app/pages/toasts.html +22 -0
- package/app-dist/index.html +67 -0
- package/app-dist/pages/alerts.html +23 -0
- package/app-dist/pages/avatars.html +22 -0
- package/app-dist/pages/badges.html +22 -0
- package/app-dist/pages/buttons.html +71 -0
- package/app-dist/pages/cards.html +54 -0
- package/app-dist/pages/checkboxes.html +39 -0
- package/app-dist/pages/chips.html +23 -0
- package/app-dist/pages/dropdowns.html +41 -0
- package/app-dist/pages/home.html +59 -0
- package/app-dist/pages/icons.html +29 -0
- package/app-dist/pages/inputs.html +66 -0
- package/app-dist/pages/installation.html +34 -0
- package/app-dist/pages/layout.html +30 -0
- package/app-dist/pages/modals.html +21 -0
- package/app-dist/pages/navbar.html +22 -0
- package/app-dist/pages/progress.html +35 -0
- package/app-dist/pages/radios.html +40 -0
- package/app-dist/pages/switches.html +39 -0
- package/app-dist/pages/tabs.html +30 -0
- package/app-dist/pages/toasts.html +22 -0
- package/app-dist/pages.json +217 -0
- package/app-dist/routes/alerts.js +5 -0
- package/app-dist/routes/avatars.js +1 -0
- package/app-dist/routes/badges.js +1 -0
- package/app-dist/routes/buttons.js +1 -0
- package/app-dist/routes/cards.js +1 -0
- package/app-dist/routes/checkboxes.js +9 -0
- package/app-dist/routes/chips.js +4 -0
- package/app-dist/routes/chunk-019e5e2f.js +5 -0
- package/app-dist/routes/chunk-0m4j19yd.js +2 -0
- package/app-dist/routes/chunk-0tmmp5q0.js +1 -0
- package/app-dist/routes/chunk-10xn709r.js +1 -0
- package/app-dist/routes/chunk-15m2qcda.js +2 -0
- package/app-dist/routes/chunk-1bh8g23n.js +1 -0
- package/app-dist/routes/chunk-1vg0v937.js +1 -0
- package/app-dist/routes/chunk-1zvcgy3j.js +1 -0
- package/app-dist/routes/chunk-2afb0861.js +1 -0
- package/app-dist/routes/chunk-2c6ttpzt.js +5 -0
- package/app-dist/routes/chunk-3dy30fhs.js +1 -0
- package/app-dist/routes/chunk-426dnces.js +13 -0
- package/app-dist/routes/chunk-44kgxery.js +1 -0
- package/app-dist/routes/chunk-47fdnejd.js +33 -0
- package/app-dist/routes/chunk-49a6t2vq.js +1 -0
- package/app-dist/routes/chunk-4fe1rm5b.js +1 -0
- package/app-dist/routes/chunk-4ggmvkta.js +33 -0
- package/app-dist/routes/chunk-4vkz81q7.js +33 -0
- package/app-dist/routes/chunk-4w4tmj8f.js +31 -0
- package/app-dist/routes/chunk-532s62kr.js +31 -0
- package/app-dist/routes/chunk-5hm3bssy.js +33 -0
- package/app-dist/routes/chunk-5vrh24hc.js +1 -0
- package/app-dist/routes/chunk-61pcg25a.js +1 -0
- package/app-dist/routes/chunk-6nfhygvf.js +1 -0
- package/app-dist/routes/chunk-700e7je6.js +33 -0
- package/app-dist/routes/chunk-7fsn17kg.js +1 -0
- package/app-dist/routes/chunk-7k789b32.js +1 -0
- package/app-dist/routes/chunk-7r46q0ys.js +36 -0
- package/app-dist/routes/chunk-86fmc1fr.js +5 -0
- package/app-dist/routes/chunk-8qth37vw.js +1 -0
- package/app-dist/routes/chunk-924wv8n0.js +1 -0
- package/app-dist/routes/chunk-9mbhgxk9.js +1 -0
- package/app-dist/routes/chunk-a216hyd9.js +1 -0
- package/app-dist/routes/chunk-akzxykh9.js +33 -0
- package/app-dist/routes/chunk-b3dcvy8c.js +1 -0
- package/app-dist/routes/chunk-b74zahz5.js +31 -0
- package/app-dist/routes/chunk-bftj53p2.js +5 -0
- package/app-dist/routes/chunk-c01hnz3e.js +1 -0
- package/app-dist/routes/chunk-d8pvv5km.js +1 -0
- package/app-dist/routes/chunk-dev0aezr.js +2 -0
- package/app-dist/routes/chunk-dh6vnv0e.js +1 -0
- package/app-dist/routes/chunk-dn2cbpva.js +36 -0
- package/app-dist/routes/chunk-dvn0my90.js +1 -0
- package/app-dist/routes/chunk-dvq8mnve.js +36 -0
- package/app-dist/routes/chunk-e8c2gc4d.js +5 -0
- package/app-dist/routes/chunk-ejf9ak2x.js +1 -0
- package/app-dist/routes/chunk-f083m55s.js +1 -0
- package/app-dist/routes/chunk-fnrj28s1.js +31 -0
- package/app-dist/routes/chunk-fvg3yjdp.js +31 -0
- package/app-dist/routes/chunk-g7k381n1.js +1 -0
- package/app-dist/routes/chunk-h01kq2ae.js +13 -0
- package/app-dist/routes/chunk-h4dk761v.js +5 -0
- package/app-dist/routes/chunk-hmx91z2x.js +5 -0
- package/app-dist/routes/chunk-hxbg4m42.js +36 -0
- package/app-dist/routes/chunk-jbjnfp2b.js +2 -0
- package/app-dist/routes/chunk-jxtz5vv6.js +36 -0
- package/app-dist/routes/chunk-jxzcs0ey.js +36 -0
- package/app-dist/routes/chunk-kt7wwhcx.js +1 -0
- package/app-dist/routes/chunk-kzptszyc.js +33 -0
- package/app-dist/routes/chunk-mhgca4w4.js +2 -0
- package/app-dist/routes/chunk-mhswxa20.js +1 -0
- package/app-dist/routes/chunk-n8zfeex6.js +1 -0
- package/app-dist/routes/chunk-pee47b2r.js +1 -0
- package/app-dist/routes/chunk-pesmw829.js +1 -0
- package/app-dist/routes/chunk-pgc4c6f3.js +36 -0
- package/app-dist/routes/chunk-q8egegm1.js +1 -0
- package/app-dist/routes/chunk-q9mn2qyq.js +36 -0
- package/app-dist/routes/chunk-qh0rtaf3.js +5 -0
- package/app-dist/routes/chunk-qqhmk6ye.js +2 -0
- package/app-dist/routes/chunk-qrxygmf7.js +33 -0
- package/app-dist/routes/chunk-r46yzksx.js +36 -0
- package/app-dist/routes/chunk-rgpbw2w0.js +5 -0
- package/app-dist/routes/chunk-rnpzv3d8.js +2 -0
- package/app-dist/routes/chunk-s5v8cv05.js +2 -0
- package/app-dist/routes/chunk-sbwn5bpc.js +1 -0
- package/app-dist/routes/chunk-sqbg8jbt.js +33 -0
- package/app-dist/routes/chunk-sv8dqnf7.js +1 -0
- package/app-dist/routes/chunk-t67sw3za.js +1 -0
- package/app-dist/routes/chunk-tjdpqwdf.js +31 -0
- package/app-dist/routes/chunk-tq2mfghg.js +1 -0
- package/app-dist/routes/chunk-ttn10vt6.js +1 -0
- package/app-dist/routes/chunk-v2hzpjxr.js +1 -0
- package/app-dist/routes/chunk-wfjjkw9y.js +1 -0
- package/app-dist/routes/chunk-wt8cxzmf.js +31 -0
- package/app-dist/routes/chunk-x45d372k.js +5 -0
- package/app-dist/routes/chunk-y3wsazkt.js +1 -0
- package/app-dist/routes/chunk-y7pmgc7t.js +33 -0
- package/app-dist/routes/chunk-zefdt2q3.js +31 -0
- package/app-dist/routes/dropdowns.js +6 -0
- package/app-dist/routes/home.js +1 -0
- package/app-dist/routes/icons.js +1 -0
- package/app-dist/routes/inputs.js +12 -0
- package/app-dist/routes/installation.js +1 -0
- package/app-dist/routes/layout.js +1 -0
- package/app-dist/routes/modals.js +7 -0
- package/app-dist/routes/navbar.js +1 -0
- package/app-dist/routes/progress.js +1 -0
- package/app-dist/routes/radios.js +6 -0
- package/app-dist/routes/switches.js +6 -0
- package/app-dist/routes/tabs.js +1 -0
- package/app-dist/routes/toasts.js +16 -0
- package/assets/fonts/material-symbols-mini.woff2 +0 -0
- package/assets/fonts/material-symbols.woff2 +0 -0
- package/assets/fonts/roboto-400.woff2 +0 -0
- package/assets/fonts/roboto-500.woff2 +0 -0
- package/assets/fonts/roboto-700.woff2 +0 -0
- package/assets/logo-banner-400.jpg +0 -0
- package/assets/logo-banner-400.webp +0 -0
- package/assets/logo-banner-800.webp +0 -0
- package/assets/logo-banner.jpg +0 -0
- package/assets/logo-icon-64.jpg +0 -0
- package/assets/logo-icon-64.webp +0 -0
- package/assets/logo-icon.jpg +0 -0
- package/assets/logo-square.jpg +0 -0
- package/bun.lock +312 -0
- package/bunfig.toml +4 -0
- package/custom-elements.json +1916 -0
- package/demo/api/sample-data.json +38 -0
- package/demo/content/alerts.html +115 -0
- package/demo/content/avatars.html +70 -0
- package/demo/content/badges.html +65 -0
- package/demo/content/buttons.html +188 -0
- package/demo/content/callouts.html +91 -0
- package/demo/content/cards.html +121 -0
- package/demo/content/checkboxes.html +178 -0
- package/demo/content/chips.html +67 -0
- package/demo/content/codeblocks.html +101 -0
- package/demo/content/confirms.html +115 -0
- package/demo/content/datatables.html +149 -0
- package/demo/content/dividers.html +119 -0
- package/demo/content/dropdowns.html +89 -0
- package/demo/content/enterprise.html +252 -0
- package/demo/content/home.html +149 -0
- package/demo/content/icons.html +89 -0
- package/demo/content/inputs.html +135 -0
- package/demo/content/installation.html +16 -0
- package/demo/content/layout.html +136 -0
- package/demo/content/modals.html +141 -0
- package/demo/content/navbar.html +70 -0
- package/demo/content/progress.html +119 -0
- package/demo/content/radios.html +88 -0
- package/demo/content/skeletons.html +109 -0
- package/demo/content/spinners.html +96 -0
- package/demo/content/switches.html +84 -0
- package/demo/content/tables.html +124 -0
- package/demo/content/tabs.html +85 -0
- package/demo/content/toasts.html +116 -0
- package/demo/content/tooltips.html +107 -0
- package/demo/content/virtual-lists.html +233 -0
- package/demo/favicon.ico +0 -0
- package/demo/favicon.png +0 -0
- package/demo/full.html +52 -0
- package/demo/iife.html +46 -0
- package/demo/manifest.json +34 -0
- package/demo/pages/datatable-demo.html +237 -0
- package/demo/pages/prompt-ui-demo.html +218 -0
- package/demo/pages/responsive-demo.html +122 -0
- package/demo/pages/schema-form-demo.html +270 -0
- package/demo/robots.txt +6 -0
- package/demo/shell.html +712 -0
- package/demo/sw.js +387 -0
- package/dist/AGENTS.md +2366 -0
- package/dist/README.md +254 -0
- package/dist/chunks/advanced.js +174 -0
- package/dist/chunks/chunk-1nhr1wrq.js +14 -0
- package/dist/chunks/chunk-hssyjbr0.js +2 -0
- package/dist/chunks/chunk-k8etzx0z.js +2 -0
- package/dist/chunks/chunk-rr1et8fg.js +2 -0
- package/dist/chunks/chunk-sjcx4fd5.js +6 -0
- package/dist/chunks/chunk-v1c777xh.js +5 -0
- package/dist/chunks/chunk-w5k5vwjd.js +13 -0
- package/dist/chunks/core.js +10 -0
- package/dist/chunks/display.js +17 -0
- package/dist/chunks/feedback.js +15 -0
- package/dist/chunks/forms.js +48 -0
- package/dist/chunks/layout.js +9 -0
- package/dist/components/chunk-4tezav8r.js +2 -0
- package/dist/components/chunk-fqyb2pms.js +2 -0
- package/dist/components/chunk-h7cdbhxw.js +13 -0
- package/dist/components/chunk-mzd8jwrs.js +2 -0
- package/dist/components/chunk-qwmxyn8e.js +2 -0
- package/dist/components/chunk-redtk47a.js +14 -0
- package/dist/components/mu-alert.js +5 -0
- package/dist/components/mu-api-table.js +33 -0
- package/dist/components/mu-avatar.js +1 -0
- package/dist/components/mu-badge.js +1 -0
- package/dist/components/mu-bottom-nav.js +1 -0
- package/dist/components/mu-button.js +1 -0
- package/dist/components/mu-callout.js +1 -0
- package/dist/components/mu-card.js +1 -0
- package/dist/components/mu-checkbox.js +9 -0
- package/dist/components/mu-chip.js +4 -0
- package/dist/components/mu-code.js +48 -0
- package/dist/components/mu-confirm.js +10 -0
- package/dist/components/mu-container.js +1 -0
- package/dist/components/mu-datatable.js +96 -0
- package/dist/components/mu-divider.js +1 -0
- package/dist/components/mu-doc-page.js +26 -0
- package/dist/components/mu-drawer-item.js +9 -0
- package/dist/components/mu-drawer.js +1 -0
- package/dist/components/mu-dropdown.js +6 -0
- package/dist/components/mu-error-boundary.js +10 -0
- package/dist/components/mu-example.js +38 -0
- package/dist/components/mu-fetch.js +1 -0
- package/dist/components/mu-form.js +1 -0
- package/dist/components/mu-grid.js +1 -0
- package/dist/components/mu-icon.js +5 -0
- package/dist/components/mu-input.js +12 -0
- package/dist/components/mu-layout.js +1 -0
- package/dist/components/mu-lazy.js +1 -0
- package/dist/components/mu-modal.js +7 -0
- package/dist/components/mu-navbar.js +1 -0
- package/dist/components/mu-page.js +1 -0
- package/dist/components/mu-progress.js +1 -0
- package/dist/components/mu-prompt-ui.js +20 -0
- package/dist/components/mu-radio.js +6 -0
- package/dist/components/mu-repeat.js +1 -0
- package/dist/components/mu-router.js +6 -0
- package/dist/components/mu-schema-form.js +76 -0
- package/dist/components/mu-sidebar.js +1 -0
- package/dist/components/mu-skeleton.js +13 -0
- package/dist/components/mu-spinner.js +1 -0
- package/dist/components/mu-stack.js +1 -0
- package/dist/components/mu-switch.js +6 -0
- package/dist/components/mu-table.js +1 -0
- package/dist/components/mu-tabs.js +1 -0
- package/dist/components/mu-textarea.js +11 -0
- package/dist/components/mu-theme-toggle.js +5 -0
- package/dist/components/mu-toast.js +4 -0
- package/dist/components/mu-tooltip.js +10 -0
- package/dist/components/mu-virtual-list.js +33 -0
- package/dist/components.css +1 -0
- package/dist/microui.css +1 -0
- package/dist/microui.d.ts +234 -0
- package/dist/microui.esm.js +549 -0
- package/dist/microui.esm.js.map +79 -0
- package/dist/microui.min.js +549 -0
- package/dist/microui.min.js.map +79 -0
- package/dist/routes/alerts.js +1 -0
- package/dist/routes/avatars.js +1 -0
- package/dist/routes/badges.js +1 -0
- package/dist/routes/buttons.js +1 -0
- package/dist/routes/callouts.js +1 -0
- package/dist/routes/cards.js +1 -0
- package/dist/routes/checkboxes.js +9 -0
- package/dist/routes/chips.js +4 -0
- package/dist/routes/chunk-19wgcncm.js +2 -0
- package/dist/routes/chunk-1khyr3v1.js +33 -0
- package/dist/routes/chunk-4rhxe97g.js +1 -0
- package/dist/routes/chunk-5qah04bh.js +2 -0
- package/dist/routes/chunk-7gfxy70n.js +5 -0
- package/dist/routes/chunk-e86zbeta.js +1 -0
- package/dist/routes/chunk-fagt36h6.js +2 -0
- package/dist/routes/chunk-fed7zr7m.js +1 -0
- package/dist/routes/chunk-hwj7pfwp.js +1 -0
- package/dist/routes/chunk-mhvcs2f8.js +5 -0
- package/dist/routes/chunk-nv3bddmj.js +13 -0
- package/dist/routes/chunk-q3f2aeqe.js +7 -0
- package/dist/routes/chunk-qxxa8trk.js +1 -0
- package/dist/routes/chunk-rw15y9zh.js +1 -0
- package/dist/routes/chunk-sfb7x11v.js +5 -0
- package/dist/routes/chunk-swyhghrm.js +48 -0
- package/dist/routes/chunk-sxddjs2d.js +2 -0
- package/dist/routes/chunk-vby0zg5w.js +17 -0
- package/dist/routes/chunk-w6zqjqqs.js +9 -0
- package/dist/routes/chunk-z960rexd.js +38 -0
- package/dist/routes/codeblocks.js +1 -0
- package/dist/routes/confirms.js +10 -0
- package/dist/routes/datatables.js +96 -0
- package/dist/routes/dividers.js +1 -0
- package/dist/routes/dropdowns.js +6 -0
- package/dist/routes/enterprise.js +15 -0
- package/dist/routes/home.js +1 -0
- package/dist/routes/icons.js +1 -0
- package/dist/routes/inputs.js +22 -0
- package/dist/routes/installation.js +1 -0
- package/dist/routes/layout.js +1 -0
- package/dist/routes/modals.js +1 -0
- package/dist/routes/navbar.js +1 -0
- package/dist/routes/page-components.json +316 -0
- package/dist/routes/progress.js +1 -0
- package/dist/routes/radios.js +6 -0
- package/dist/routes/route-deps.json +156 -0
- package/dist/routes/shell-critical.js +1 -0
- package/dist/routes/shell-deferred.js +1 -0
- package/dist/routes/shell.js +20 -0
- package/dist/routes/skeletons.js +13 -0
- package/dist/routes/spinners.js +1 -0
- package/dist/routes/src/chunks/core.js +36 -0
- package/dist/routes/switches.js +6 -0
- package/dist/routes/tables.js +1 -0
- package/dist/routes/tabs.js +1 -0
- package/dist/routes/toasts.js +1 -0
- package/dist/routes/tooltips.js +10 -0
- package/dist/routes/virtual-lists.js +33 -0
- package/dist/styles/common.css +1 -0
- package/dist/styles/components/animations.css +1 -0
- package/dist/styles/components/avatar.css +1 -0
- package/dist/styles/components/badge.css +1 -0
- package/dist/styles/components/bottom-nav.css +1 -0
- package/dist/styles/components/button.css +1 -0
- package/dist/styles/components/card.css +1 -0
- package/dist/styles/components/checkbox.css +1 -0
- package/dist/styles/components/chip.css +1 -0
- package/dist/styles/components/datatable.css +1 -0
- package/dist/styles/components/divider.css +1 -0
- package/dist/styles/components/drawer-item.css +1 -0
- package/dist/styles/components/drawer.css +1 -0
- package/dist/styles/components/grid.css +1 -0
- package/dist/styles/components/icon.css +1 -0
- package/dist/styles/components/input.css +1 -0
- package/dist/styles/components/layout.css +1 -0
- package/dist/styles/components/navbar.css +1 -0
- package/dist/styles/components/overlays.css +1 -0
- package/dist/styles/components/progress.css +1 -0
- package/dist/styles/components/prompt-ui.css +1 -0
- package/dist/styles/components/radio.css +1 -0
- package/dist/styles/components/schema-form.css +1 -0
- package/dist/styles/components/switch.css +1 -0
- package/dist/styles/components/tabs.css +1 -0
- package/dist/styles/components/tooltip.css +1 -0
- package/dist/styles/components/virtual-list.css +1 -0
- package/dist/tokens.css +1 -0
- package/docs/api-reference.md +175 -0
- package/docs/component-schema.md +231 -0
- package/docs/components.md +269 -0
- package/docs/design-system.md +183 -0
- package/docs/getting-started.md +198 -0
- package/docs/message-protocol.md +262 -0
- package/docs/utility-classes.md +205 -0
- package/lighthouse-audit.mjs +113 -0
- package/package.json +45 -0
- package/scripts/analyze-components.js +105 -0
- package/scripts/build-app.js +193 -0
- package/scripts/build-framework.js +444 -0
- package/scripts/build-utils.js +101 -0
- package/scripts/test-isolated.js +151 -0
- package/server.js +256 -0
- package/src/chunks/advanced.js +27 -0
- package/src/chunks/core.js +61 -0
- package/src/chunks/display.js +25 -0
- package/src/chunks/feedback.js +15 -0
- package/src/chunks/forms.js +25 -0
- package/src/chunks/layout.js +27 -0
- package/src/components/mu-alert.js +96 -0
- package/src/components/mu-api-table.js +167 -0
- package/src/components/mu-avatar.js +94 -0
- package/src/components/mu-badge.js +32 -0
- package/src/components/mu-bottom-nav.js +115 -0
- package/src/components/mu-button.js +61 -0
- package/src/components/mu-callout.js +71 -0
- package/src/components/mu-card.js +36 -0
- package/src/components/mu-checkbox.js +186 -0
- package/src/components/mu-chip.js +125 -0
- package/src/components/mu-code.js +534 -0
- package/src/components/mu-confirm.js +268 -0
- package/src/components/mu-container.js +53 -0
- package/src/components/mu-datatable.js +517 -0
- package/src/components/mu-divider.js +40 -0
- package/src/components/mu-doc-page.js +100 -0
- package/src/components/mu-drawer-item.js +158 -0
- package/src/components/mu-drawer.js +305 -0
- package/src/components/mu-dropdown.js +239 -0
- package/src/components/mu-error-boundary.js +191 -0
- package/src/components/mu-example.js +335 -0
- package/src/components/mu-fetch.js +256 -0
- package/src/components/mu-form.js +133 -0
- package/src/components/mu-grid.js +63 -0
- package/src/components/mu-icon.js +211 -0
- package/src/components/mu-input.js +142 -0
- package/src/components/mu-layout.js +129 -0
- package/src/components/mu-lazy.js +94 -0
- package/src/components/mu-modal.js +160 -0
- package/src/components/mu-navbar.js +71 -0
- package/src/components/mu-page.js +77 -0
- package/src/components/mu-progress.js +54 -0
- package/src/components/mu-prompt-ui.js +382 -0
- package/src/components/mu-radio.js +200 -0
- package/src/components/mu-repeat.js +135 -0
- package/src/components/mu-router.js +169 -0
- package/src/components/mu-schema-form.js +441 -0
- package/src/components/mu-sidebar.js +81 -0
- package/src/components/mu-skeleton.js +69 -0
- package/src/components/mu-spinner.js +30 -0
- package/src/components/mu-stack.js +59 -0
- package/src/components/mu-switch.js +150 -0
- package/src/components/mu-table.js +80 -0
- package/src/components/mu-tabs.js +112 -0
- package/src/components/mu-textarea.js +96 -0
- package/src/components/mu-theme-toggle.js +52 -0
- package/src/components/mu-toast.js +151 -0
- package/src/components/mu-tooltip.js +182 -0
- package/src/components/mu-virtual-list.js +184 -0
- package/src/core/MuElement.js +562 -0
- package/src/core/agent-api.js +771 -0
- package/src/core/breakpoints.js +195 -0
- package/src/core/bus.js +378 -0
- package/src/core/component-schema.js +287 -0
- package/src/core/feature-registry.js +241 -0
- package/src/core/form-state.js +252 -0
- package/src/core/http.js +104 -0
- package/src/core/keyboard.js +105 -0
- package/src/core/layers.js +71 -0
- package/src/core/render.js +201 -0
- package/src/core/ripple.js +158 -0
- package/src/core/router.js +100 -0
- package/src/core/scheduler.js +109 -0
- package/src/core/signals.js +164 -0
- package/src/core/store.js +268 -0
- package/src/core/theme.js +68 -0
- package/src/core/transitions.js +72 -0
- package/src/core/utils.js +30 -0
- package/src/index.d.ts +234 -0
- package/src/index.js +308 -0
- package/src/styles/animations.css +252 -0
- package/src/styles/common.css +82 -0
- package/src/styles/components/animations.css +129 -0
- package/src/styles/components/avatar.css +83 -0
- package/src/styles/components/badge.css +80 -0
- package/src/styles/components/bottom-nav.css +37 -0
- package/src/styles/components/button.css +348 -0
- package/src/styles/components/card.css +138 -0
- package/src/styles/components/checkbox.css +201 -0
- package/src/styles/components/chip.css +93 -0
- package/src/styles/components/datatable.css +180 -0
- package/src/styles/components/divider.css +49 -0
- package/src/styles/components/drawer-item.css +123 -0
- package/src/styles/components/drawer.css +273 -0
- package/src/styles/components/grid.css +189 -0
- package/src/styles/components/icon.css +40 -0
- package/src/styles/components/input.css +203 -0
- package/src/styles/components/layout.css +121 -0
- package/src/styles/components/navbar.css +91 -0
- package/src/styles/components/overlays.css +329 -0
- package/src/styles/components/progress.css +79 -0
- package/src/styles/components/prompt-ui.css +286 -0
- package/src/styles/components/radio.css +17 -0
- package/src/styles/components/schema-form.css +85 -0
- package/src/styles/components/switch.css +69 -0
- package/src/styles/components/tabs.css +145 -0
- package/src/styles/components/tooltip.css +93 -0
- package/src/styles/components/virtual-list.css +36 -0
- package/src/styles/components.css +3677 -0
- package/src/styles/routes/home.css +97 -0
- package/src/styles/tokens.css +675 -0
- package/tests/agents/agent-integration.test.js +76 -0
- package/tests/benchmark.html +296 -0
- package/tests/build/scan-components.test.js +173 -0
- package/tests/components/all-components.test.js +245 -0
- package/tests/components/all-missing-components.test.js +574 -0
- package/tests/components/mu-alert.test.js +113 -0
- package/tests/components/mu-avatar.test.js +148 -0
- package/tests/components/mu-badge.test.js +92 -0
- package/tests/components/mu-button.test.js +112 -0
- package/tests/components/mu-card.test.js +89 -0
- package/tests/components/mu-checkbox.test.js +158 -0
- package/tests/components/mu-chip.test.js +118 -0
- package/tests/components/mu-container.test.js +120 -0
- package/tests/components/mu-divider.test.js +98 -0
- package/tests/components/mu-drawer-item.test.js +199 -0
- package/tests/components/mu-drawer.test.js +96 -0
- package/tests/components/mu-dropdown.test.js +125 -0
- package/tests/components/mu-form.test.js +138 -0
- package/tests/components/mu-grid.test.js +135 -0
- package/tests/components/mu-icon.test.js +110 -0
- package/tests/components/mu-input.test.js +131 -0
- package/tests/components/mu-lazy.test.js +103 -0
- package/tests/components/mu-modal.test.js +275 -0
- package/tests/components/mu-navbar.test.js +101 -0
- package/tests/components/mu-progress.test.js +115 -0
- package/tests/components/mu-radio.test.js +114 -0
- package/tests/components/mu-repeat.test.js +106 -0
- package/tests/components/mu-sidebar.test.js +126 -0
- package/tests/components/mu-skeleton.test.js +162 -0
- package/tests/components/mu-stack.test.js +143 -0
- package/tests/components/mu-switch.test.js +292 -0
- package/tests/components/mu-table.test.js +124 -0
- package/tests/components/mu-tabs.test.js +104 -0
- package/tests/components/mu-textarea.test.js +115 -0
- package/tests/components/mu-toast.test.js +321 -0
- package/tests/components/mu-tooltip.test.js +133 -0
- package/tests/components/mu-virtual-list.test.js +109 -0
- package/tests/core/MuElement.test.js +120 -0
- package/tests/core/agent-api.test.js +125 -0
- package/tests/core/all-core-modules.test.js +442 -0
- package/tests/core/bus.test.js +364 -0
- package/tests/core/component-schema.test.js +160 -0
- package/tests/core/feature-registry.test.js +198 -0
- package/tests/core/form-state.test.js +167 -0
- package/tests/core/http.test.js +119 -0
- package/tests/core/keyboard.test.js +319 -0
- package/tests/core/layers.test.js +129 -0
- package/tests/core/namespaced-stores.test.js +114 -0
- package/tests/core/render.test.js +121 -0
- package/tests/core/ripple.test.js +131 -0
- package/tests/core/router.test.js +89 -0
- package/tests/core/scheduler.test.js +121 -0
- package/tests/core/signals.test.js +128 -0
- package/tests/core/store.test.js +171 -0
- package/tests/core/transitions.test.js +82 -0
- package/tests/e2e/accessibility-harness.html +58 -0
- package/tests/e2e/accessibility.test.js +401 -0
- package/tests/e2e/agent-features.test.js +372 -0
- package/tests/e2e/card-spacing.test.js +287 -0
- package/tests/e2e/components.test.js +439 -0
- package/tests/e2e/demo-routes.test.js +478 -0
- package/tests/e2e/layout-css-fallback.test.js +334 -0
- package/tests/e2e/mu-alert.e2e.test.js +111 -0
- package/tests/e2e/mu-checkbox.test.js +489 -0
- package/tests/e2e/mu-chip.test.js +347 -0
- package/tests/e2e/mu-form.test.js +499 -0
- package/tests/e2e/mu-icon.test.js +114 -0
- package/tests/e2e/mu-radio.test.js +113 -0
- package/tests/e2e/mu-skeleton.test.js +140 -0
- package/tests/e2e/mu-switch.test.js +415 -0
- package/tests/e2e/mu-tabs.test.js +494 -0
- package/tests/e2e/mu-textarea.test.js +242 -0
- package/tests/e2e/mu-virtual-list.test.js +427 -0
- package/tests/e2e/perf-memory.test.js +161 -0
- package/tests/e2e/puppeteer-helper.js +137 -0
- package/tests/e2e/puppeteer.test.js +226 -0
- package/tests/e2e/pwa.test.js +261 -0
- package/tests/e2e/test-harness.html +319 -0
- package/tests/manual/test-components.html +120 -0
- package/tests/memory-test.html +309 -0
- package/tests/setup-dom.js +93 -0
- package/tests/visual-test.html +301 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
class z extends HTMLElement{static observedAttributes=[];static baseClass="";static cssFile=null;static _loadedCSS=new Set;static useContainment=!0;_rendered=!1;_abortController=null;_timers=new Set;_intervals=new Set;constructor(){super();this._initAgentLogger()}_initAgentLogger(){if(!window.__MICROUI_ERRORS__)window.__MICROUI_ERRORS__=[];if(!window.microUIAgent)window.microUIAgent={reset:()=>{window.__MICROUI_ERRORS__=[],console.log("[microUIAgent] Errors cleared")},getErrors:()=>window.__MICROUI_ERRORS__,hasError:($,Z)=>{return window.__MICROUI_ERRORS__.some((X)=>X.component===$.toLowerCase()&&X.code===Z)}}}logError($,Z){let X={component:this.tagName.toLowerCase(),code:$,message:Z,element:this,timestamp:Date.now()};window.__MICROUI_ERRORS__.push(X),console.warn(`[microUI] ${$}: ${Z}`,this)}connectedCallback(){if(!this._abortController)this._abortController=new AbortController;if(this.constructor.baseClass)this.classList.add(this.constructor.baseClass);if(this.constructor.useContainment&&!this.style.contain)this.style.contain="layout style";if(this.#$(),!this._rendered)this.render(),this._rendered=!0;this._loadComponentCSS(),this._inferSemanticAttributes()}#$(){this.listen(this,"click",($)=>{let Z=$.target.closest("[data-action]");if(!Z||!this.contains(Z))return;let X=Z.dataset.action;if(this.handleAction)this.handleAction(X,Z,$)})}_loadComponentCSS(){let $=this.constructor.cssFile;if(!$)return;if(z._loadedCSS.has($))return;z._loadedCSS.add($);let Z=document.createElement("link");Z.id=`mu-css-${$}`,Z.rel="stylesheet";let X="/styles/",J=document.querySelector('link[href*="/styles/"]');if(J){let Q=J.href.match(/(.*\/(?:src\/|dist\/)?styles\/)/);if(Q)X=Q[1]}else{let Q=document.querySelector('link[href*="/dist/"]');if(Q){let Y=Q.href.match(/(.*\/dist\/)/);if(Y)X=Y[1]+"styles/"}else{let Y=document.querySelector('script[src*="/src/"]');if(Y){let G=Y.src.match(/(.*\/src\/)/);if(G)X=G[1]+"styles/"}}}Z.href=`${X}components/${$}.css`,document.head.appendChild(Z)}_inferSemanticAttributes(){let $=this.tagName.toLowerCase();if(this.hasAttribute("data-mu-action"))return;let Z="",X="";switch($){case"mu-button":Z=this._inferButtonAction(),X=this._inferButtonRole();break;case"mu-input":case"mu-textarea":Z="input",X="text-field";break;case"mu-checkbox":case"mu-switch":Z="toggle",X="control";break;case"mu-dropdown":Z="select",X="selector";break;case"mu-modal":Z="dialog",X="overlay";break;case"mu-tabs":Z="navigate",X="navigation";break;case"mu-card":X="container";break}if(Z)this.setAttribute("data-mu-action",Z);if(X)this.setAttribute("data-mu-role",X)}_inferButtonAction(){let $=this.textContent?.toLowerCase().trim()||"";if(/^(save|submit|confirm|send|create|add|apply|ok|yes)$/.test($))return"submit";if(/^(cancel|close|dismiss|no|nevermind)$/.test($))return"cancel";if(/^(delete|remove|clear|trash)$/.test($))return"delete";if(/^(back|next|previous|forward|continue)$/.test($))return"navigate";return"click"}_inferButtonRole(){let $=this.getAttribute("variant");if($==="filled"||$==="elevated")return"primary-action";if($==="tonal"||$==="outlined")return"secondary-action";if($==="text")return"tertiary-action";if($==="danger")return"destructive-action";return"action"}disconnectedCallback(){if(this._abortController)this._abortController.abort(),this._abortController=null;for(let $ of this._timers)clearTimeout($);this._timers.clear();for(let $ of this._intervals)clearInterval($);this._intervals.clear(),this.cleanup()}cleanup(){}attributeChangedCallback($,Z,X){if(Z!==X&&this._rendered)this.update($,X,Z)}render(){}update($,Z,X){}setupEvents(){}attr($,Z=""){return this.getAttribute($)??Z}has($){return this.hasAttribute($)}emit($,Z={}){this.dispatchEvent(new CustomEvent($,{bubbles:!0,composed:!0,detail:Z}))}listen($,Z,X,J={}){if(!this._abortController)this._abortController=new AbortController;let Q={...J,signal:this._abortController.signal};$.addEventListener(Z,X,Q)}setTimeout($,Z){let X;return X=setTimeout(()=>{this._timers.delete(X),$()},Z),this._timers.add(X),X}setInterval($,Z){let X=setInterval($,Z);return this._intervals.add(X),X}setupActivation($){this.updateTabindex(),this.addEventListener("keydown",(Z)=>{if((Z.key==="Enter"||Z.key===" ")&&!this.has("disabled"))Z.preventDefault(),$()})}updateTabindex(){this.setAttribute("tabindex",this.has("disabled")?"-1":"0")}setDisplay($){this.style.display=$}get isDisabled(){return this.has("disabled")}}function _($,Z,X={}){if(customElements.get($))return;let J=X.priority||"user-blocking";if(typeof scheduler<"u"&&scheduler.postTask)scheduler.postTask(()=>{if(!customElements.get($))customElements.define($,Z)},{priority:J});else customElements.define($,Z)}var B=Symbol("listeners"),M6=Symbol("subCounter"),X0=Symbol("maxListeners"),T=Symbol("fastCache");var f0=Object.freeze({peerId:"self",origin:typeof globalThis.location<"u"?globalThis.location.origin:"unknown",type:"local"});class K0{constructor(){this[B]=new Map,this[M6]=0,this[X0]=10,this[T]=Object.create(null)}setMaxListeners($){return this[X0]=$,this}getMaxListeners(){return this[X0]}on($,Z,X={}){if(typeof $!=="string")throw TypeError("Signal name must be a string");if(typeof Z!=="function")throw TypeError("Handler must be a function");let J=`sub_${++this[M6]}`,Q={id:J,handler:Z,priority:X.priority??0,mode:X.mode??"async",once:X.once??!1,signal:X.signal??null};if(!this[B].has($))this[B].set($,[]);let Y=this[B].get($);if(Y.length===0||Q.priority<=Y[Y.length-1].priority)Y.push(Q);else{let W=0,D=Y.length;while(W<D){let q=W+D>>>1;if(Y[q].priority>=Q.priority)W=q+1;else D=q}Y.splice(W,0,Q)}this[T][$]=Y.map((W)=>W.handler);let G=this[X0];if(G>0&&Y.length>G)console.warn(`[CrossBus] Possible memory leak: ${Y.length} listeners for "${$}". Use setMaxListeners(n) to increase limit.`);let K=!0,U={id:J,signalName:$,get active(){return K},unsubscribe:()=>{if(K)this.#Z($,J),K=!1}};if(Q.signal)if(Q.signal.aborted)this.#Z($,J),K=!1;else Q.signal.addEventListener("abort",()=>{U.unsubscribe()},{once:!0});return U}once($,Z,X={}){return this.on($,Z,{...X,once:!0})}onFast($,Z){return(this[T][$]||=[]).push(Z),()=>{this[T][$]=this[T][$]?.filter((X)=>X!==Z)}}offFast($,Z){let X=this[T][$];if(X){let Q=X.indexOf(Z);if(Q!==-1)X.splice(Q,1)}let J=this[B].get($);if(J){let Q=J.findIndex((Y)=>Y.handler===Z);if(Q!==-1)J.splice(Q,1)}}off($,Z){if(typeof $!=="string")throw TypeError("Signal name must be a string");let X=this[B].get($);if(!X||X.length===0)return{success:!1,removedCount:0,remainingCount:0};let J=0;if(Z===void 0)J=X.length,this[B].delete($),delete this[T][$];else{let Y=X.length,G=X.filter((K)=>K.handler!==Z);if(J=Y-G.length,G.length===0)this[B].delete($),delete this[T][$];else this[B].set($,G),this[T][$]=G.map((K)=>K.handler)}let Q=this[B].get($)?.length??0;return{success:J>0,removedCount:J,remainingCount:Q}}emitSync($,Z){let X=this[T][$];if(!X)return 0;let J=X.length;if(J===1)return X[0](Z),1;if(J===2)return X[0](Z),X[1](Z),2;if(J===3)return X[0](Z),X[1](Z),X[2](Z),3;if(J===4)return X[0](Z),X[1](Z),X[2](Z),X[3](Z),4;for(let Q=0;Q<J;Q++)X[Q](Z);return J}async emit($,Z,X){if(typeof $!=="string")throw TypeError("Signal name must be a string");let J=this[B].get($),Q=this[B].has("*");if(J?.length===1&&!Q&&!X){let U=J[0],W={name:$,data:Z,messageId:crypto.randomUUID(),timestamp:Date.now(),source:f0};try{if(U.mode==="sync")await U.handler(W);else Promise.resolve().then(()=>U.handler(W))}catch(D){console.error(`[CrossBus] Handler error for "${$}":`,D)}if(U.once)this.#Z($,U.id);return 1}let Y={name:$,data:Z,messageId:crypto.randomUUID(),timestamp:Date.now(),source:X?{...f0,...X}:f0},G=this.#$($),K=[];for(let{signalName:U,entry:W}of G){try{if(W.mode==="sync")await W.handler(Y);else Promise.resolve().then(()=>W.handler(Y))}catch(D){console.error(`[CrossBus] Handler error for "${$}":`,D)}if(W.once)K.push({signalName:U,id:W.id})}for(let{signalName:U,id:W}of K)this.#Z(U,W);return G.length}hasListeners($){let Z=this[B].get($);return Z!==void 0&&Z.length>0}listenerCount($){return this[B].get($)?.length??0}getSignalNames(){return Array.from(this[B].keys())}clear(){this[B].clear();for(let $ in this[T])delete this[T][$]}#$($){let Z=this[B].get($),X=this[B].get("*"),J=null,Q=$.indexOf(":");if(Q>0){let K=$.slice(0,Q+1)+"*";J=this[B].get(K)}if(Z&&!X&&!J)return Z.map((K)=>({signalName:$,entry:K}));let Y=[Z&&{signalName:$,entries:Z},X&&{signalName:"*",entries:X},J&&{signalName:$.slice(0,Q+1)+"*",entries:J}].filter(Boolean);if(Y.length===0)return[];if(Y.length===1)return Y[0].entries.map((K)=>({signalName:Y[0].signalName,entry:K}));let G=[];for(let{signalName:K,entries:U}of Y)for(let W of U)G.push({signalName:K,entry:W});return G.sort((K,U)=>U.entry.priority-K.entry.priority),G}#Z($,Z){let X=this[B].get($);if(!X)return;let J=X.filter((Q)=>Q.id!==Z);if(J.length===0)this[B].delete($),delete this[T][$];else this[B].set($,J),this[T][$]=J.map((Q)=>Q.handler)}}var y="_cb",S=1,x=Object.freeze({SIGNAL:"sig",REQUEST:"req",RESPONSE:"res",ACK:"ack",HANDSHAKE:"hsk",HANDSHAKE_INIT:"hsk_init",HANDSHAKE_ACK:"hsk_ack",HANDSHAKE_COMPLETE:"hsk_done",PING:"png",PONG:"pog",BYE:"bye",BROADCAST:"bc"}),h0=Object.freeze({INIT:"init",INIT_SENT:"init_sent",ACK:"ack",ACK_SENT:"ack_sent",DONE:"done"}),g0=Object.freeze({CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected",RECONNECTING:"reconnecting",FAILED:"failed"}),f4=Object.freeze({IFRAME:"iframe",WORKER:"worker",SERVICE_WORKER:"sw",WINDOW:"window",PORT:"port"}),h4=Object.freeze({LOCAL:"local",SENT:"sent",ACKED:"acked",QUEUED:"queued",TIMEOUT:"timeout",FAILED:"failed"});function m($){return $!==null&&typeof $==="object"&&$[y]===S&&typeof $.id==="string"&&(typeof $.type==="string"||typeof $.t==="string")}function Y4($){if($ instanceof ArrayBuffer)return!0;if($ instanceof MessagePort)return!0;if(typeof ImageBitmap<"u"&&$ instanceof ImageBitmap)return!0;if(typeof OffscreenCanvas<"u"&&$ instanceof OffscreenCanvas)return!0;if(typeof ReadableStream<"u"&&$ instanceof ReadableStream)return!0;if(typeof WritableStream<"u"&&$ instanceof WritableStream)return!0;if(typeof TransformStream<"u"&&$ instanceof TransformStream)return!0;return!1}function Q0($,Z=new Set){if($===null||$===void 0)return Array.from(Z);if(Y4($))return Z.add($),Array.from(Z);if(Array.isArray($))for(let X of $)Q0(X,Z);else if(typeof $==="object")for(let X of Object.keys($))Q0($[X],Z);return Array.from(Z)}function u0($,Z,X={},J=null){return Object.freeze({[y]:S,version:S,id:J||crypto.randomUUID(),type:$,timestamp:Date.now(),payload:Object.freeze({...Z}),meta:Object.freeze({...X})})}function G4($,Z,X,J=null){return u0(x.SIGNAL,{name:$,data:Z,source:X,dest:J})}function K4($,Z,X,J,Q=null){return u0(x.REQUEST,{name:$,data:Z,source:X,dest:J},{},Q)}function J0($,Z,X,J=!0,Q=null){return u0(x.RESPONSE,{requestId:$,data:Z,source:X,success:J,error:Q})}var j=Object.freeze({HANDSHAKE_TIMEOUT:"ERR_HANDSHAKE_TIMEOUT",HANDSHAKE_REJECTED:"ERR_HANDSHAKE_REJECTED",ORIGIN_FORBIDDEN:"ERR_ORIGIN_FORBIDDEN",PEER_EXISTS:"ERR_PEER_EXISTS",PEER_NOT_FOUND:"ERR_PEER_NOT_FOUND",PEER_DISCONNECTED:"ERR_PEER_DISCONNECTED",RECONNECT_FAILED:"ERR_RECONNECT_FAILED",UNSUPPORTED:"ERR_UNSUPPORTED",NOT_CONNECTED:"ERR_NOT_CONNECTED",ACK_TIMEOUT:"ERR_ACK_TIMEOUT",RESPONSE_TIMEOUT:"ERR_RESPONSE_TIMEOUT",QUEUE_FULL:"ERR_QUEUE_FULL",INVALID_MESSAGE:"ERR_INVALID_MESSAGE",VERSION_MISMATCH:"ERR_VERSION_MISMATCH",CLONE_ERROR:"ERR_CLONE_ERROR",TRANSFER_ERROR:"ERR_TRANSFER_ERROR",MESSAGE_TOO_LARGE:"ERR_MESSAGE_TOO_LARGE",UNREACHABLE:"ERR_UNREACHABLE",TTL_EXCEEDED:"ERR_TTL_EXCEEDED",NO_ROUTE:"ERR_NO_ROUTE",NO_HANDLER:"ERR_NO_HANDLER",HANDLER_ERROR:"ERR_HANDLER_ERROR",HANDLER_TIMEOUT:"ERR_HANDLER_TIMEOUT",HANDLER_EXISTS:"ERR_HANDLER_EXISTS",SEND_FAILED:"ERR_SEND_FAILED",CHANNEL_FAILED:"ERR_CHANNEL_FAILED",CHANNEL_CLOSED:"ERR_CHANNEL_CLOSED",MAX_PEERS:"ERR_MAX_PEERS",MAX_PENDING:"ERR_MAX_PENDING",DESTROYED:"ERR_DESTROYED",CIRCUIT_OPEN:"ERR_CIRCUIT_OPEN",PAYLOAD_TOO_LARGE:"ERR_PAYLOAD_TOO_LARGE",RATE_LIMITED:"ERR_RATE_LIMITED",UNAUTHORIZED:"ERR_UNAUTHORIZED",INVALID_PAYLOAD:"ERR_INVALID_PAYLOAD"}),W4=Object.freeze({[j.HANDSHAKE_TIMEOUT]:{message:"Handshake timed out",retryable:!0,suggestion:"Increase timeout or check if target is loaded. Use iframe.onload before connecting."},[j.HANDSHAKE_REJECTED]:{message:"Handshake rejected by peer",retryable:!1,suggestion:"Check targetOrigin matches the peer's origin. Verify peer allows your origin."},[j.ORIGIN_FORBIDDEN]:{message:"Origin not in allowed origins list",retryable:!1,suggestion:'Add your origin to allowedOrigins option or use targetOrigin: "*" for development.'},[j.PEER_EXISTS]:{message:"Peer with this ID already exists",retryable:!1,suggestion:"Use unique peerId for each context. Try: peerId: `agent-${Date.now()}`"},[j.PEER_NOT_FOUND]:{message:"Peer not found",retryable:!1,suggestion:"Check if peer is connected using bus.peers. Wait for peer connection before request."},[j.PEER_DISCONNECTED]:{message:"Peer is disconnected",retryable:!0,suggestion:'Wait for peer to reconnect. Listen for "peer:join" event before retry.'},[j.RECONNECT_FAILED]:{message:"Max reconnection attempts reached",retryable:!1,suggestion:"Check network connectivity. Consider increasing maxRetries option."},[j.UNSUPPORTED]:{message:"Operation not supported by this environment",retryable:!1,suggestion:"This feature requires a browser environment. Check for feature availability first."},[j.NOT_CONNECTED]:{message:"Transport is not connected",retryable:!0,suggestion:"Call addTransport() and wait for connection before sending messages."},[j.ACK_TIMEOUT]:{message:"ACK not received within timeout",retryable:!0,suggestion:"Increase ackTimeout option or check peer availability."},[j.RESPONSE_TIMEOUT]:{message:"Response not received within timeout",retryable:!0,suggestion:"Increase timeout in request options: { timeout: 10000 }. Check if handler exists on peer."},[j.QUEUE_FULL]:{message:"Message queue is full",retryable:!1,suggestion:"Increase maxQueueSize or wait for queue to drain. Consider using batching plugin."},[j.INVALID_MESSAGE]:{message:"Invalid message format",retryable:!1,suggestion:"Ensure message data is JSON-serializable. Avoid DOM nodes and functions."},[j.VERSION_MISMATCH]:{message:"Protocol version mismatch",retryable:!1,suggestion:"Update CrossBus to same version on both sides."},[j.CLONE_ERROR]:{message:"Data cannot be cloned (contains functions or DOM nodes)",retryable:!1,suggestion:"Remove functions, DOM nodes, and circular references from message data."},[j.TRANSFER_ERROR]:{message:"Failed to transfer object ownership",retryable:!1,suggestion:"Ensure ArrayBuffers are not detached. Each buffer can only be transferred once."},[j.MESSAGE_TOO_LARGE]:{message:"Message exceeds maximum size",retryable:!1,suggestion:"Use streaming for large payloads or increase maxMessageSize option."},[j.UNREACHABLE]:{message:"Destination peer is unreachable",retryable:!0,suggestion:"Check if peer is still connected. Use bus.peers to list available peers."},[j.TTL_EXCEEDED]:{message:"Message TTL exceeded (possible routing loop)",retryable:!1,suggestion:"Check for circular transport configurations. Increase maxTTL if needed."},[j.NO_ROUTE]:{message:"No route to destination",retryable:!1,suggestion:"Add transport connecting to target peer. Set isHub: true on orchestrator."},[j.NO_HANDLER]:{message:"No handler registered for this request",retryable:!1,suggestion:'Register handler on target: bus.handle("handlerName", fn). Check handler name spelling.'},[j.HANDLER_ERROR]:{message:"Handler threw an exception",retryable:!1,suggestion:"Check target peer logs for error. Wrap handler in try/catch."},[j.HANDLER_TIMEOUT]:{message:"Handler did not respond within timeout",retryable:!0,suggestion:"Handler is slow. Increase timeout or optimize handler performance."},[j.HANDLER_EXISTS]:{message:"Handler already registered with this name",retryable:!1,suggestion:"Use different handler name or call bus.removeHandler() first."},[j.SEND_FAILED]:{message:"Failed to send message to peer",retryable:!0,suggestion:"Check transport status. Target window may be closed or blocked."},[j.CHANNEL_FAILED]:{message:"Failed to create direct channel",retryable:!0,suggestion:"Check browser support for MessageChannel. Retry after short delay."},[j.CHANNEL_CLOSED]:{message:"Channel was closed unexpectedly",retryable:!1,suggestion:"Target context was destroyed. Check if iframe/worker still exists."},[j.MAX_PEERS]:{message:"Maximum number of peers reached",retryable:!1,suggestion:"Increase maxPeers option or disconnect unused peers first."},[j.MAX_PENDING]:{message:"Maximum pending requests reached",retryable:!1,suggestion:"Wait for pending requests to complete. Increase maxPendingRequests option."},[j.DESTROYED]:{message:"CrossBus instance has been destroyed",retryable:!1,suggestion:"Create new CrossBus instance. Do not use bus after calling destroy()."},[j.CIRCUIT_OPEN]:{message:"Circuit breaker is open",retryable:!1,suggestion:"Too many failures. Wait for circuit to reset or call circuit.reset()."},[j.PAYLOAD_TOO_LARGE]:{message:"Payload exceeds maximum allowed size",retryable:!1,suggestion:"Reduce payload size or increase maxPayloadSize option. Consider using streaming for large data."},[j.RATE_LIMITED]:{message:"Request rate limit exceeded",retryable:!0,suggestion:"Wait before retrying. Consider adding delay or using exponential backoff."},[j.UNAUTHORIZED]:{message:"Peer is not authorized to call this handler",retryable:!1,suggestion:"Add peer to handler allowedPeers list or remove peer restrictions."},[j.INVALID_PAYLOAD]:{message:"Payload validation failed",retryable:!1,suggestion:"Check payload structure against handler requirements."}});class L extends Error{code;details;retryable;cause;timestamp;constructor($,Z,X={}){let J=W4[$]??{message:"Unknown error",retryable:!1};super(Z??J.message);if(this.name="CrossBusError",this.code=$,this.details=X.details??{},this.retryable=X.retryable??J.retryable,this.cause=X.cause,this.timestamp=Date.now(),Error.captureStackTrace)Error.captureStackTrace(this,L)}static from($,Z={}){return new L($,void 0,{details:Z})}static wrap($,Z,X={}){return new L($,Z.message,{cause:Z,details:X})}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details,retryable:this.retryable,timestamp:this.timestamp}}toString(){return`${this.name} [${this.code}]: ${this.message}`}}function v(){if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let Z=Math.random()*16|0;return($==="x"?Z:Z&3|8).toString(16)})}function C6(){if(typeof Promise.withResolvers==="function")return Promise.withResolvers();let $,Z;return{promise:new Promise((J,Q)=>{$=J,Z=Q}),resolve:$,reject:Z}}function I6($,Z,X="Operation timed out"){return Promise.race([$,new Promise((J,Q)=>{setTimeout(()=>Q(Error(X)),Z)})])}class v6 extends K0{#$=new Map;#Z=0;#X=new Map;#J=Object.create(null);#Q=Object.create(null);#Y=[];constructor(){super()}addPeer($,Z,X={}){if(this.#$.has($))throw L.from(j.PEER_EXISTS,{peerId:$});if(typeof Z!=="function")throw TypeError("sendFn must be a function");let J={peerId:$,sendFn:Z,meta:X.meta??{},origin:X.origin??"unknown",status:g0.CONNECTED,connectedAt:Date.now()};this.#$.set($,J),this.#X.set($,0),this.#J[$]=J,this.#Q[$]=Z,this.#Y.push($),this.emit("peer:added",{peerId:$,meta:J.meta})}removePeer($){let Z=this.#J[$];if(!Z)return!1;this.#$.delete($),this.#X.delete($),delete this.#J[$],delete this.#Q[$];let X=this.#Y.indexOf($);if(X!==-1)this.#Y.splice(X,1);return this.emit("peer:removed",{peerId:$,meta:Z.meta}),!0}getPeer($){return this.#J[$]}getPeerIds(){return this.#Y.slice()}get peerCount(){return this.#$.size}route($,Z={}){let{target:X,payload:J}=$;if(X)return this.#G(X,J);else{let Q=Z.exclude,Y=Q?.length?new Set(Q):null;return this.#K(J,Y)}}broadcast($,Z={}){let X=Z.exclude,J=X?.length?new Set(X):null,Q=Z.include,Y=Q?.length?new Set(Q):null,G=0,K=[];for(let[U,W]of this.#$){if(J?.has(U))continue;if(Y&&!Y.has(U))continue;if(W.status!==g0.CONNECTED)continue;try{let D=this.#W(U,$,x.BROADCAST);W.sendFn(D),G++}catch(D){console.error(`[Router] Failed to send to ${U}:`,D),K.push(U)}}return{success:K.length===0,delivered:G,failed:K}}getSequence($){return this.#X.get($)??0}setPeerStatus($,Z){let X=this.#J[$];if(X)X.status=Z,this.emit("peer:status",{peerId:$,status:Z})}clearPeers(){let $=this.#Y.slice();for(let Z of $)this.removePeer(Z)}#G($,Z){let X=this.#J[$];if(!X)return{success:!1,delivered:0,failed:[$],error:j.PEER_NOT_FOUND};if(X.status!==g0.CONNECTED)return{success:!1,delivered:0,failed:[$],error:j.PEER_DISCONNECTED};try{let J=Z&&Z._cb?Z:this.#W($,Z,x.SIGNAL);return X.sendFn(J),{success:!0,delivered:1,failed:[]}}catch(J){return console.error(`[Router] Failed to send to ${$}:`,J),{success:!1,delivered:0,failed:[$]}}}#K($,Z){return this.broadcast($,Z?{exclude:Array.from(Z)}:{})}#W($,Z,X){let J=(this.#X.get($)??0)+1;return this.#X.set($,J),{id:`msg_${++this.#Z}`,t:X,ts:Date.now(),seq:J,p:Z}}}class b6{#$=new Map;#Z=Object.create(null);#X=0;#J;#Q;constructor($={}){this.#J=$.defaultTimeout??30000,this.#Q=$.maxPending??1000}create($,Z,X={}){if(this.#Q>0&&this.#$.size>=this.#Q)throw L.from(j.MAX_PENDING,{current:this.#$.size,max:this.#Q,targetPeer:$,handlerName:Z});let J=Date.now(),Q=`req_${++this.#X}_${J}`,Y=X.timeout??this.#J,{promise:G,resolve:K,reject:U}=C6(),W={id:Q,targetPeer:$,handlerName:Z,createdAt:J,timeout:Y,resolve:K,reject:U,defaultValue:X.defaultValue};this.#$.set(Q,W),this.#Z[Q]=W;let D=I6(G,Y).catch((q)=>{if(Q in this.#Z){if(this.#$.delete(Q),delete this.#Z[Q],"defaultValue"in X)return X.defaultValue;throw L.from(j.RESPONSE_TIMEOUT,{requestId:Q,targetPeer:$,handlerName:Z,timeout:Y})}throw q});return{requestId:Q,promise:D}}resolve($,Z){let X=this.#Z[$];if(!X)return!1;if(this.#$.delete($),delete this.#Z[$],Z.success)X.resolve(Z.data);else{let J=L.from(Z.error?.code??j.HANDLER_ERROR,{requestId:$,targetPeer:X.targetPeer,handlerName:X.handlerName,originalError:Z.error});J.message=Z.error?.message??"Handler error",X.reject(J)}return!0}reject($,Z){let X=this.#Z[$];if(!X)return!1;this.#$.delete($),delete this.#Z[$];let J=Z instanceof Error?Z:Error(Z);return X.reject(J),!0}cancel($){let Z=this.#Z[$];if(!Z)return!1;return this.#$.delete($),delete this.#Z[$],Z.reject(Error("Request cancelled")),!0}cancelForPeer($){let Z=0;for(let[X,J]of this.#$)if(J.targetPeer===$)this.#$.delete(X),delete this.#Z[X],J.reject(L.from(j.PEER_DISCONNECTED,{peerId:$,requestId:X})),Z++;return Z}cancelAll(){let $=this.#$.size;for(let[Z,X]of this.#$)X.reject(Error("All requests cancelled"));this.#$.clear();for(let Z in this.#Z)delete this.#Z[Z];return $}has($){return $ in this.#Z}get($){return this.#Z[$]}get size(){return this.#$.size}getRequestIds(){return Array.from(this.#$.keys())}getForPeer($){let Z=[];for(let X of this.#$.values())if(X.targetPeer===$)Z.push(X);return Z}}class f6{#$;#Z;#X;#J;#Q=new Map;constructor($={}){this.#$=$.peerId??v(),this.#Z=$.meta??{},this.#X=$.capabilities??[],this.#J=$.timeout??1e4}get peerId(){return this.#$}createInitMessage(){return{type:x.HANDSHAKE_INIT,handshakeId:v(),peerId:this.#$,meta:this.#Z,capabilities:this.#X,timestamp:Date.now()}}createAckMessage($,Z,X){return{type:x.HANDSHAKE_ACK,handshakeId:$.handshakeId,peerId:this.#$,meta:this.#Z,capabilities:this.#X,accept:Z,reason:Z?void 0:X,timestamp:Date.now()}}createCompleteMessage($){return{type:x.HANDSHAKE_COMPLETE,handshakeId:$,confirmed:!0,timestamp:Date.now()}}async initiate($){let Z=this.createInitMessage(),{promise:X,resolve:J,reject:Q}=C6();this.#Q.set(Z.handshakeId,{phase:h0.INIT_SENT,resolve:J,reject:Q,initMsg:Z,startTime:Date.now()}),$(Z);try{return await I6(X,this.#J)}catch(Y){if(this.#Q.delete(Z.handshakeId),Y.code===j.HANDSHAKE_TIMEOUT)return{success:!1,error:j.HANDSHAKE_TIMEOUT,reason:`Handshake timeout after ${this.#J}ms`};return{success:!1,error:j.HANDSHAKE_REJECTED,reason:Y.message}}}handleMessage($,Z,X,J){switch($.type){case x.HANDSHAKE_INIT:return this.#Y($,Z,X,J);case x.HANDSHAKE_ACK:return this.#G($,Z,X);case x.HANDSHAKE_COMPLETE:return this.#K($,Z);default:return null}}hasPending($){return this.#Q.has($)}cancel($){let Z=this.#Q.get($);if(Z)Z.reject(Error("Handshake cancelled")),this.#Q.delete($)}cancelAll(){for(let[$,Z]of this.#Q)Z.reject(Error("All handshakes cancelled"));this.#Q.clear()}#Y($,Z,X,J){if(J&&!J($,Z)){let Y=this.createAckMessage($,!1,"Validation failed");return X(Y),null}let Q=this.createAckMessage($,!0);return X(Q),this.#Q.set($.handshakeId,{phase:h0.ACK_SENT,remotePeer:{peerId:$.peerId,origin:Z,meta:$.meta,capabilities:$.capabilities}}),null}#G($,Z,X){let J=this.#Q.get($.handshakeId);if(!J)return null;if(!$.accept)return J.reject(Error($.reason||"Connection rejected")),this.#Q.delete($.handshakeId),null;let Q=this.createCompleteMessage($.handshakeId);X(Q);let Y={peerId:$.peerId,origin:Z,meta:$.meta,capabilities:$.capabilities,type:"unknown",connectedAt:Date.now()};return J.resolve({success:!0,peer:Y}),this.#Q.delete($.handshakeId),Y}#K($,Z){let X=this.#Q.get($.handshakeId);if(!X||X.phase!==h0.ACK_SENT)return null;if(!$.confirmed)return this.#Q.delete($.handshakeId),null;let J={...X.remotePeer,connectedAt:Date.now()};return this.#Q.delete($.handshakeId),J}}class h6{#$=new Set;#Z=[];#X=!1;#J;constructor($={}){if(this.#X=$.allowAll??!1,this.#J=globalThis.location?.origin,$.allowed)for(let Z of $.allowed)this.#Q(Z)}isAllowed($){if(this.#X)return!0;if($==="null"||$===null)return this.#$.has("null");if(this.#$.size===0&&this.#Z.length===0)return $===this.#J;if(this.#$.has($))return!0;for(let Z of this.#Z)if(Z.test($))return!0;return!1}allow($){return this.#Q($),this}disallow($){if(this.#$.has($))return this.#$.delete($),!0;return!1}getAllowed(){return Array.from(this.#$)}clear(){this.#$.clear(),this.#Z=[]}get selfOrigin(){return this.#J}#Q($){if(typeof $!=="string")throw TypeError("Origin must be a string");if($==="*"){this.#X=!0;return}if($.includes("*")){let Z=this.#Y($);this.#Z.push(Z)}else this.#$.add($)}#Y($){let Z=$.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[a-zA-Z0-9.-]{0,253}");return new RegExp(`^${Z}$`)}}class W0 extends K0{#$;#Z;#X;#J;#Q;#Y;#G;#K=new Map;#W=[];#U=[];#D;#j;#_;#q;#z;#F;#L=new Map;#V=new Map;#H=!1;#x="[CrossBus]";#P;#A=!1;constructor($={}){super();if(this.#$=$.peerId??v(),this.#Z=$.isHub??!1,this.#D=$.meta??{},this.#j=$.capabilities??[],this.#_=$.requestTimeout??30000,this.#X=new v6,this.#J=new b6({defaultTimeout:this.#_}),this.#Q=new f6({peerId:this.#$,meta:this.#D,capabilities:this.#j,timeout:$.handshakeTimeout??1e4}),this.#Y=new h6({allowed:$.allowedOrigins??[]}),this.#G=$.contentType??"application/json",this.#q=$.maxPayloadSize??1048576,this.#z=$.maxPendingRequests??100,this.#F=$.strictMode??!1,this.#H=$.debug??!1,this.#x=$.debugPrefix??"[CrossBus]",this.#P=Date.now(),this.#S($),this.#j.push(`serializer:${this.#G}`),this.#X.on("peer:added",(Z)=>{this.emit("peer:connected",Z.data)}),this.#X.on("peer:removed",(Z)=>{this.emit("peer:disconnected",Z.data)}),this.#X.on("peer:status",(Z)=>{this.emit("peer:status",Z.data)}),this.#H)this.#w("info",`Initialized (isHub: ${this.#Z})`)}get peerId(){return this.#$}get isHub(){return this.#Z}get peerCount(){return this.#X.peerCount}get peers(){return this.#X.getPeerIds()}getPeer($){return this.#X.getPeer($)}async signal($,Z,X={}){this.#B();let J=await this.#O(this.#U,Z,{type:"signal",direction:"outbound"}),Q=G4($,J,this.#$),Y=await this.#X.broadcast(Q,X);return this.#w("out",`SIGNAL "${$}" to ${Y.delivered} peers`),Y}async request($,Z,X,J={}){if(this.#B(),this.#w("out",`REQUEST "${Z}" to ${$}`),!this.#X.getPeer($))throw L.from(j.PEER_NOT_FOUND,{peerId:$});let{requestId:Y,promise:G}=this.#J.create($,Z,{timeout:J.timeout??this.#_}),K=await this.#O(this.#U,X,{type:"request",peerId:$,handlerName:Z,direction:"outbound"}),U=K4(Z,K,this.#$,$,Y);if(!this.#X.route({target:$,payload:U}).success)throw this.#J.cancel(Y),L.from(j.SEND_FAILED,{peerId:$});return G}async broadcastRequest($,Z,X={}){this.#B();let J=X.timeout??this.#_,Q=X.ignoreErrors??!0,Y=new Set(X.exclude??[]),G=new Map,K=[];for(let U of this.#X.getPeerIds()){if(Y.has(U))continue;let W=this.request(U,$,Z,{timeout:J}).then((D)=>{G.set(U,{success:!0,data:D})}).catch((D)=>{if(Q)G.set(U,{success:!1,error:D.message});else throw D});K.push(W)}return await Promise.all(K),G}handle($,Z,X={}){if(this.#K.has($))throw L.from(j.HANDLER_EXISTS,{handlerName:$});if(X.allowedPeers||X.rateLimit||X.validatePayload)this.#V.set($,X);return this.#K.set($,Z),()=>{this.#K.delete($),this.#V.delete($)}}unhandle($){return this.#K.delete($)}hasHandler($){return this.#K.has($)}addInboundHook($,Z=10){if(typeof $!=="function")throw TypeError("hookFn must be a function");let X={fn:$,priority:Z};return this.#W.push(X),this.#W.sort((J,Q)=>J.priority-Q.priority),()=>this.removeInboundHook($)}addOutboundHook($,Z=10){if(typeof $!=="function")throw TypeError("hookFn must be a function");let X={fn:$,priority:Z};return this.#U.push(X),this.#U.sort((J,Q)=>J.priority-Q.priority),()=>this.removeOutboundHook($)}removeInboundHook($){let Z=this.#W.findIndex((X)=>X.fn===$);if(Z!==-1)return this.#W.splice(Z,1),!0;return!1}removeOutboundHook($){let Z=this.#U.findIndex((X)=>X.fn===$);if(Z!==-1)return this.#U.splice(Z,1),!0;return!1}addPeer($,Z,X={}){this.#B(),this.#X.addPeer($,Z,X)}removePeer($){return this.#J.cancelForPeer($),this.#X.removePeer($)}addTransport($,Z={}){if(this.#B(),!$||typeof $.send!=="function")throw TypeError("Transport must have a send() method");let X=Z.peerId||$.peerId||`transport-${v()}`,J=Z.origin||"*";if(typeof $.onMessage==="function")$.onMessage((Q)=>{this.handleMessage(Q,J,X)});return this.addPeer(X,(Q)=>{$.send(Q)},Z),()=>{if(this.removePeer(X),typeof $.destroy==="function")$.destroy()}}async handleMessage($,Z,X,J){if(this.#A)return;if(!this.#Y.isAllowed(Z)){console.warn(`[CrossBus] Blocked message from unauthorized origin: ${Z}`);return}let Q=$.payload??$.data??$.p,Y=$.type??$.t,G=$.handler??$.name,K=Q;if($.payload&&typeof $.payload==="object"&&!$.p){if(Y===x.SIGNAL||Y===x.BROADCAST)G=$.payload.name,K=$.payload.data;else if(Y===x.REQUEST)G=$.payload.name,K=$.payload.data;else if(Y===x.RESPONSE)K=$.payload.data}else if($.t&&!$.type&&$.p&&typeof $.p==="object"&&$.p.payload){let U=$.p;G=U.payload.name??U.name,K=U.payload.data??U.data}if(K!==void 0){let U={type:Y===x.SIGNAL?"signal":Y===x.REQUEST?"request":"response",peerId:X,handlerName:G,direction:"inbound"};K=await this.#O(this.#W,K,U)}switch(Y){case x.BROADCAST:case x.SIGNAL:if(typeof G!=="string"){console.warn("[CrossBus] Invalid signal name type");return}await this.#N(G,K,X);break;case x.REQUEST:if(typeof G!=="string"){console.warn("[CrossBus] Invalid handler name type");return}await this.#R($.id,G,K,X,J);break;case x.RESPONSE:{let{success:U,error:W}=$;if($.payload&&$.payload.success!==void 0)U=$.payload.success,W=$.payload.error;this.#T($.payload?.requestId??$.id,U,K,W);break}case x.HANDSHAKE_INIT:case x.HANDSHAKE_ACK:case x.HANDSHAKE_COMPLETE:this.#Q.handleMessage($,Z,J);break;default:console.warn(`[CrossBus] Unknown message type: ${Y}`)}}destroy(){if(this.#A)return;this.#A=!0,this.#J.cancelAll(),this.#K.clear(),this.#X.clearPeers(),this.clear(),this.emit("destroyed",{})}get isDestroyed(){return this.#A}async#N($,Z,X){await this.emit($,{payload:Z,source:X})}async#R($,Z,X,J,Q){let Y=this.#K.get(Z),G;if(!Y)G=J0($,null,this.#$,!1,{code:j.NO_HANDLER,message:"Handler not found"});else{let K=this.#y(Z,J,X);if(!K.allowed)G=J0($,null,this.#$,!1,{code:K.error?.code??j.UNAUTHORIZED,message:K.error?.message??"Security check failed"});else try{let U=await Y(X,{peerId:J,requestId:$,handlerName:Z}),W=await this.#O(this.#U,U,{type:"response",peerId:J,handlerName:Z,direction:"outbound"});G=J0($,W,this.#$,!0)}catch(U){G=J0($,null,this.#$,!1,{code:U.code??j.HANDLER_ERROR,message:U.message})}}if(Q)Q(G);else if(J)this.#X.route({target:J,payload:G})}#T($,Z,X,J){this.#J.resolve($,{requestId:$,success:Z,data:X,error:J})}#B(){if(this.#A)throw L.from(j.DESTROYED,{context:"CrossBus operation"})}async#O($,Z,X){let J=Z;for(let{fn:Q}of $)try{J=await Q(J,X)}catch(Y){console.error("[CrossBus] Hook error:",Y)}return J}#S($){if(!(typeof process<"u"?process.env?.NODE_ENV!=="production":typeof window<"u"&&window.location?.hostname==="localhost"))return;if(!$.allowedOrigins||$.allowedOrigins.length===0)console.warn(`[CrossBus Security] ⚠️ No allowedOrigins specified.
|
|
2
|
+
`+`This bus will REJECT all incoming messages from transports.
|
|
3
|
+
To receive messages, specify allowed origins:
|
|
4
|
+
allowedOrigins: ["https://trusted-domain.com"]
|
|
5
|
+
For development only: allowedOrigins: ["*"]`);if($.allowedOrigins?.includes("*")){if(console.warn(`[CrossBus Security] ⚠️ allowedOrigins: ["*"] accepts messages from ANY origin.
|
|
6
|
+
`+`This is INSECURE in production. Use specific origins instead:
|
|
7
|
+
allowedOrigins: ["https://trusted-domain.com"]
|
|
8
|
+
For production, use:
|
|
9
|
+
CrossBus.createSecure({ allowedOrigins: ["https://..."] })
|
|
10
|
+
Suppress this warning with NODE_ENV=production`),this.#F)throw Error('strictMode: allowedOrigins: ["*"] is not allowed. Use specific origins for security.')}}#y($,Z,X){let J=this.#V.get($);if(!J)return{allowed:!0};if(J.allowedPeers&&!J.allowedPeers.includes(Z))return{allowed:!1,error:L.from(j.UNAUTHORIZED,{handler:$,peer:Z,allowedPeers:J.allowedPeers})};if(J.rateLimit){let Q=`${$}:${Z}`;if(!this.#k(Q,J.rateLimit))return{allowed:!1,error:L.from(j.RATE_LIMITED,{handler:$,peer:Z,limit:J.rateLimit})}}if(J.validatePayload)try{if(!J.validatePayload(X))return{allowed:!1,error:L.from(j.INVALID_PAYLOAD,{handler:$})}}catch(Q){return{allowed:!1,error:L.from(j.INVALID_PAYLOAD,{handler:$,reason:Q?.message??"Validation error"})}}return{allowed:!0}}#k($,Z){let X=Date.now(),J=this.#L.get($);if(!J||X>=J.resetAt)return this.#L.set($,{count:1,resetAt:X+1000}),!0;if(J.count>=Z)return!1;return J.count++,!0}get maxPayloadSize(){return this.#q}get strictMode(){return this.#F}get debug(){return this.#H}get uptime(){return Date.now()-this.#P}#w($,Z){if(!this.#H)return;let X=$==="out"?"→":$==="in"?"←":$==="warn"?"⚠️":$==="error"?"❌":"ℹ️";console.log(`${this.#x} ${X} ${Z}`)}healthCheck(){let $=this.#X.getPeerIds(),Z=$.length,X="healthy";if(this.#A)X="unhealthy";else if(Z===0&&this.#Z)X="degraded";let J;if(typeof process<"u"&&process.memoryUsage)try{let Q=process.memoryUsage();J={heapUsed:Q.heapUsed,heapTotal:Q.heapTotal,rss:Q.rss}}catch{}return{status:X,peerId:this.#$,isHub:this.#Z,uptime:this.uptime,peers:{total:Z,ids:$},handlers:Array.from(this.#K.keys()),pendingRequests:this.#J.size??0,destroyed:this.#A,...J&&{memory:J}}}static createSecure($={}){if(!$.allowedOrigins||$.allowedOrigins.length===0)throw Error('createSecure() requires allowedOrigins to be specified. For development, use: new CrossBus({ allowedOrigins: ["*"] })');if($.allowedOrigins.includes("*"))throw Error('createSecure() does not allow wildcard origins. Specify exact origins: allowedOrigins: ["https://example.com"]');return new W0({strictMode:!0,maxPayloadSize:1048576,maxPendingRequests:100,requestTimeout:30000,...$})}diagnose(){let $=[],Z=[],X=[];if(this.#A)return $.push("Instance is destroyed"),Z.push("Create a new CrossBus instance"),{status:"error",issues:$,suggestions:Z,warnings:X};let J=this.#X.getPeerIds().length;if(J===0)if(this.#Z)X.push("Hub has no connected peers"),Z.push("Add transports with addTransport() or wait for agents to connect");else $.push("Agent has no connected peers"),Z.push('Add a transport to connect to hub: bus.addTransport(transport, {peerId: "hub"})');let Q=this.#K.size;if(this.#Z&&Q===0)X.push("Hub has no registered handlers"),Z.push('Register handlers with bus.handle("name", fn)');let Y=this.#J.size??0;if(Y>this.#z*0.8)X.push(`High pending request count: ${Y}/${this.#z}`),Z.push("Consider increasing maxPendingRequests or check for slow handlers");if(!this.#F)X.push("strictMode is disabled"),Z.push("For production, use CrossBus.createSecure() or set strictMode: true");let G="healthy";if($.length>0)G="error";else if(X.length>0)G="warning";return{status:G,peerId:this.#$,isHub:this.#Z,peerCount:J,handlerCount:Q,pendingRequests:Y,uptime:this.uptime,issues:$,warnings:X,suggestions:Z}}}class g6{#$;#Z;#X;#J;#Q=0;#Y=!1;#G=!1;#K;constructor($,Z,X={}){this.#$=v(),this.#Z=Z,this.#X=$,this.#J=X.chunkSize??64000,this.#K=X.meta??{}}get streamId(){return this.#$}get name(){return this.#Z}async open($){if(this.#G)return;this.#G=!0,await this.#W({st:"open",name:this.#Z,meta:{...this.#K,...$}})}async write($){if(this.#Y)throw Error("Stream already ended");if(!this.#G)await this.open();let Z,X=!1;if($ instanceof ArrayBuffer)Z=this.#D(new Uint8Array($)),X=!0;else if($ instanceof Uint8Array)Z=this.#D($),X=!0;else if(typeof $==="string"){let J=this.#U($,this.#J);for(let Q of J)await this.#W({st:"data",seq:this.#Q++,d:Q,b64:!1});return}else Z=JSON.stringify($);if(X){let J=this.#U(Z,this.#J);for(let Q of J)await this.#W({st:"data",seq:this.#Q++,d:Q,b64:!0})}else await this.#W({st:"data",seq:this.#Q++,d:Z,b64:!1})}async end($){if(this.#Y)return;this.#Y=!0,await this.#W({st:"end",seq:this.#Q,meta:$})}async abort($){if(this.#Y)return;this.#Y=!0,await this.#W({st:"error",reason:$??"Stream aborted"})}async#W($){let Z={[y]:S,t:"stream",sid:this.#$,...$};await this.#X(Z)}#U($,Z){let X=[];for(let J=0;J<$.length;J+=Z)X.push($.slice(J,J+Z));return X}#D($){let Z="";for(let X=0;X<$.length;X++)Z+=String.fromCharCode($[X]);return btoa(Z)}}class m6{#$;#Z;#X;#J=[];#Q=null;#Y=!1;#G=null;constructor($,Z,X={}){this.#$=$,this.#Z=Z,this.#X=X}get streamId(){return this.#$}get name(){return this.#Z}get meta(){return this.#X}get ended(){return this.#Y}push($){if(this.#Y)return;let Z=$.d;if($.b64)Z=this.#K(Z);if(this.#J.push(Z),this.#Q){let X=this.#Q;this.#Q=null,X()}}end($){if(this.#Y=!0,$)this.#X={...this.#X,...$};if(this.#Q){let Z=this.#Q;this.#Q=null,Z()}}error($){if(this.#Y=!0,this.#G=Error($),this.#Q){let Z=this.#Q;this.#Q=null,Z()}}async*[Symbol.asyncIterator](){while(!0){while(this.#J.length>0)yield this.#J.shift();if(this.#Y){if(this.#G)throw this.#G;return}await new Promise(($)=>{this.#Q=$})}}async collect(){let $=[],Z=!1;for await(let X of this)if($.push(X),X instanceof Uint8Array)Z=!0;if(Z){let X=$.reduce((Y,G)=>Y+G.length,0),J=new Uint8Array(X),Q=0;for(let Y of $)J.set(Y,Q),Q+=Y.length;return J}else return $.join("")}#K($){let Z=atob($),X=new Uint8Array(Z.length);for(let J=0;J<Z.length;J++)X[J]=Z.charCodeAt(J);return X}}class U4{#$=new Map;#Z=new Map;#X;constructor($){this.#X=$}createStream($,Z,X={}){return new g6(async(Q)=>{await this.#X(Z,Q)},$,X)}onStream($,Z){return this.#Z.set($,Z),()=>this.#Z.delete($)}handleMessage($,Z){if($.t!=="stream")return;let X=$.sid;switch($.st){case"open":this.#J(X,$,Z);break;case"data":this.#Q(X,$);break;case"end":this.#Y(X,$);break;case"error":this.#G(X,$);break}}#J($,Z,X){let J=this.#Z.get(Z.name);if(!J){console.warn(`[CrossBus] No handler for stream: ${Z.name}`);return}let Q=new m6($,Z.name,Z.meta);this.#$.set($,Q),J(Q).catch((Y)=>{console.error("[CrossBus] Stream handler error:",Y)})}#Q($,Z){let X=this.#$.get($);if(!X)return;X.push(Z)}#Y($,Z){let X=this.#$.get($);if(!X)return;X.end(Z.meta),this.#$.delete($)}#G($,Z){let X=this.#$.get($);if(!X)return;X.error(Z.reason),this.#$.delete($)}get activeStreamCount(){return this.#$.size}}class z4 extends K0{#$;#Z;#X=new Map;#J;#Q;#Y=null;#G=null;#K=!1;#W="online";#U={};constructor($,Z){super();if(!Z.peerId)throw Error("peerId is required");if(this.#$=Z.peerId,this.#Z=$,this.#J=Z.heartbeatInterval??15000,this.#Q=Z.timeout??45000,Z.autoStart!==!1)this.start()}get peerId(){return this.#$}get status(){return this.#W}get onlineCount(){let $=0;for(let Z of this.#X.values())if(Z.status!=="offline")$++;return $}start(){if(this.#Y)return;this.#z("join"),this.#Y=setInterval(()=>{this.#z("heartbeat")},this.#J),this.#G=setInterval(()=>{this.#q()},this.#J)}stop(){if(this.#Y)clearInterval(this.#Y),this.#Y=null;if(this.#G)clearInterval(this.#G),this.#G=null;this.#z("leave")}setStatus($,Z){if(this.#W=$,Z)this.#U={...this.#U,...Z};this.#z("update")}setMeta($){this.#U={...this.#U,...$},this.#z("update")}getOnlinePeers(){let $=[];for(let[Z,X]of this.#X)if(X.status!=="offline")$.push(Z);return $}getAllPeers(){return Array.from(this.#X.values())}getPeer($){return this.#X.get($)}isOnline($){let Z=this.#X.get($);return Z?Z.status!=="offline":!1}handleMessage($,Z){if($.t!=="presence")return;if(Z===this.#$)return;let{pt:X,status:J,meta:Q}=$,Y=Date.now();switch(X){case"join":this.#D(Z,J,Q,Y),this.#z("heartbeat");break;case"leave":this.#j(Z);break;case"heartbeat":case"update":this.#_(Z,J,Q,Y);break}}#D($,Z,X,J){let Q=!this.#X.has($);if(this.#X.set($,{peerId:$,status:Z??"online",lastSeen:J,meta:X??{}}),Q)this.emitSync("join",{peerId:$,meta:X})}#j($){let Z=this.#X.get($);if(!Z)return;Z.status="offline",this.#X.delete($),this.emitSync("leave",{peerId:$})}#_($,Z,X,J){let Q=this.#X.get($),Y=!Q||Q.status==="offline";if(!Q)Q={peerId:$,status:Z??"online",lastSeen:J,meta:X??{}},this.#X.set($,Q);else{if(Q.lastSeen=J,Z)Q.status=Z;if(X)Q.meta={...Q.meta,...X}}if(Y&&Q.status!=="offline")this.emitSync("join",{peerId:$,meta:Q.meta});else this.emitSync("update",{peerId:$,peer:Q})}#q(){let Z=Date.now()-this.#Q;for(let[X,J]of this.#X)if(J.lastSeen<Z&&J.status!=="offline")J.status="offline",this.#X.delete(X),this.emitSync("leave",{peerId:X})}async#z($){if(this.#K)return;let Z={[y]:S,t:"presence",pt:$,peerId:this.#$,status:this.#W,meta:this.#U,ts:Date.now()};try{await this.#Z(Z)}catch(X){console.error("[CrossBus] Failed to send presence:",X)}}destroy(){if(this.#K)return;this.#K=!0,this.stop(),this.#X.clear()}get isDestroyed(){return this.#K}}var Y0={contentType:"application/json",serialize:($)=>JSON.stringify($),deserialize:($)=>JSON.parse($)},p6=new Map;p6.set(Y0.contentType,Y0);function G0($){return p6.get($)||Y0}class _4{#$=null;#Z;#X;#J;#Q;#Y;#G=null;#K=null;#W=!1;static isSupported(){return typeof globalThis.postMessage==="function"||typeof Window<"u"}constructor($,Z={}){if(!this.#j($))throw TypeError("Target must support postMessage");if(this.#$=$,this.#Z=Z.targetOrigin??"*",this.#X=new Set(Z.allowedOrigins??[]),this.#J=Z.autoTransfer??!1,this.#Y=Z.contentType??"application/json",this.#Q=G0(this.#Y),(typeof process<"u"?process.env?.NODE_ENV!=="production":typeof window<"u"&&window.location?.hostname==="localhost")&&this.#Z==="*")console.warn(`[CrossBus Security] ⚠️ targetOrigin: "*" broadcasts to ANY window.
|
|
11
|
+
`+`This is INSECURE in production. Use specific origin:
|
|
12
|
+
targetOrigin: "https://iframe-domain.com"
|
|
13
|
+
Suppress this warning with NODE_ENV=production`);this.#K=this.#U.bind(this),this.#z().addEventListener("message",this.#K)}send($,Z){if(this.#W)throw L.from(j.DESTROYED,{context:"PostMessageTransport.send"});if(this.#q())throw L.from(j.PEER_DISCONNECTED,{reason:"Target window is closed"});let X={[y]:S,...$},J=X;if(this.#Y!=="application/json")J=this.#Q.serialize(X);let Q=Z;if(this.#J&&!Z){if(Q=Q0($),Q.length===0)Q=void 0}if(this.#_())this.#$.postMessage(J,Q);else this.#$.postMessage(X,this.#Z,Q)}onMessage($){if(typeof $!=="function")throw TypeError("Handler must be a function");this.#G=$}offMessage(){this.#G=null}destroy(){if(this.#W)return;if(this.#W=!0,this.#G=null,this.#K)this.#z().removeEventListener("message",this.#K),this.#K=null}get isDestroyed(){return this.#W}get targetOrigin(){return this.#Z}#U($){if(!this.#G)return;let Z=$.data;if(!m(Z))return;if($.origin&&!this.#D($.origin)){console.warn(`[CrossBus] Blocked message from unauthorized origin: ${$.origin}`);return}if(this.#$&&"postMessage"in this.#$&&!this.#_()){if($.source!==this.#$)return}try{this.#G(Z,{origin:$.origin??"worker",source:$.source??$.currentTarget})}catch(X){console.error("[CrossBus] Message handler error:",X)}}#D($){if(this.#X.size===0)return $===globalThis.location?.origin;if(this.#X.has("*"))return!0;if(this.#X.has($))return!0;for(let Z of this.#X)if(Z.includes("*")){if(new RegExp("^"+Z.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,"[a-zA-Z0-9.-]{0,253}")+"$").test($))return!0}return!1}#j($){if(!$)return!1;return typeof $.postMessage==="function"}#_(){if(typeof Worker<"u"&&this.#$ instanceof Worker)return!0;if(typeof ServiceWorker<"u"&&this.#$ instanceof ServiceWorker)return!0;if(typeof MessagePort<"u"&&this.#$ instanceof MessagePort)return!0;return!1}#q(){if(this.#_())return!1;return this.#$.closed===!0}#z(){if(typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope)return globalThis;if(this.#_())return this.#$;if(typeof window<"u")return window;return globalThis}}class u6{#$;#Z;#X;#J;#Q=null;#Y=!1;static isSupported(){return typeof BroadcastChannel<"u"}constructor($={}){if(!u6.isSupported())throw L.from(j.UNSUPPORTED,{api:"BroadcastChannel"});this.#Z=$.channelName??"crossbus:default",this.#$=new BroadcastChannel(this.#Z),this.#J=$.contentType??"application/json",this.#X=G0(this.#J),this.#$.onmessage=this.#G.bind(this),this.#$.onmessageerror=this.#K.bind(this)}send($){if(this.#Y)throw L.from(j.DESTROYED,{context:"BroadcastChannelTransport.send"});let Z={[y]:S,...$},X=Z;if(this.#J!=="application/json")X=this.#X.serialize(Z);this.#$.postMessage(X)}onMessage($){if(typeof $!=="function")throw TypeError("Handler must be a function");this.#Q=$}offMessage(){this.#Q=null}destroy(){if(this.#Y)return;if(this.#Y=!0,this.#Q=null,this.#$)this.#$.close(),this.#$=null}get channelName(){return this.#Z}get isDestroyed(){return this.#Y}#G($){if(!this.#Q)return;let Z=$.data;if(Z instanceof ArrayBuffer||Z instanceof Uint8Array)try{let X=new TextDecoder().decode(Z instanceof ArrayBuffer?new Uint8Array(Z):Z);Z=Y0.deserialize(X)}catch(X){console.warn("[CrossBus] Failed to deserialize binary message",X);return}if(!m(Z))return;try{this.#Q(Z,{origin:"broadcast"})}catch(X){console.error("[CrossBus] BroadcastChannel handler error:",X)}}#K($){console.error("[CrossBus] BroadcastChannel message error:",$)}}class m0{#$;#Z;#X;#J;#Q;#Y=null;#G=!1;#K;static isSupported(){return typeof MessageChannel<"u"}static fromPort($,Z={}){if(!($ instanceof MessagePort))throw TypeError("Port must be a MessagePort");let X=Object.create(m0.prototype);return X.#$=$,X.#Z=null,X.#X=Z.autoTransfer??!1,X.#Q=Z.contentType??"application/json",X.#J=G0(X.#Q),X.#G=!1,X.#K=!1,X.#Y=null,X.#$.onmessage=X.#W.bind(X),X.#$.onmessageerror=X.#U.bind(X),X}constructor($={}){if(!m0.isSupported())throw L.from(j.UNSUPPORTED,{api:"MessageChannel"});let Z=new MessageChannel;this.#$=Z.port1,this.#Z=Z.port2,this.#X=$.autoTransfer??!1,this.#Q=$.contentType??"application/json",this.#J=G0(this.#Q),this.#K=!0,this.#$.onmessage=this.#W.bind(this),this.#$.onmessageerror=this.#U.bind(this)}get remotePort(){return this.#Z}markRemoteTransferred(){this.#Z=null}get isInitiator(){return this.#K}send($,Z){if(this.#G)throw L.from(j.DESTROYED,{context:"MessageChannelTransport.send"});let X={[y]:S,...$},J=X;if(this.#Q!=="application/json")J=this.#J.serialize(X);let Q=Z;if(this.#X&&!Z){if(Q=Q0($),Q.length===0)Q=void 0}this.#$.postMessage(J,Q)}onMessage($){if(typeof $!=="function")throw TypeError("Handler must be a function");this.#Y=$}offMessage(){this.#Y=null}destroy(){if(this.#G)return;if(this.#G=!0,this.#Y=null,this.#$)this.#$.close(),this.#$=null;if(this.#Z)this.#Z.close(),this.#Z=null}get isDestroyed(){return this.#G}#W($){if(!this.#Y)return;let Z=$.data;if(!m(Z))return;try{this.#Y(Z,{origin:"channel"})}catch(X){console.error("[CrossBus] MessageChannel handler error:",X)}}#U($){console.error("[CrossBus] MessageChannel error:",$)}}class c6{#$=null;#Z=null;#X;#J=null;#Q=!1;static isSupported(){return typeof SharedWorker<"u"}constructor($={}){if(!c6.isSupported())throw L.from(j.UNSUPPORTED,{api:"SharedWorker"});this.#X=$.workerUrl??"/crossbus-shared-worker.js",this.#$=new SharedWorker(this.#X,$.name),this.#Z=this.#$.port,this.#Z.onmessage=this.#Y.bind(this),this.#Z.onmessageerror=this.#G.bind(this),this.#$.onerror=this.#K.bind(this),this.#Z.start()}send($,Z){if(this.#Q)throw L.from(j.DESTROYED,{context:"SharedWorkerTransport.send"});let X={[y]:S,...$};if(!this.#Z)return;if(Z&&Z.length>0)this.#Z.postMessage(X,Z);else this.#Z.postMessage(X)}onMessage($){if(typeof $!=="function")throw TypeError("Handler must be a function");this.#J=$}offMessage(){this.#J=null}destroy(){if(this.#Q)return;if(this.#Q=!0,this.#J=null,this.#Z)this.#Z.close(),this.#Z=null;this.#$=null}get workerUrl(){return this.#X}get isDestroyed(){return this.#Q}#Y($){if(!this.#J)return;if(!m($.data))return;try{this.#J($.data,{origin:"sharedworker"})}catch(Z){console.error("[CrossBus] SharedWorker handler error:",Z)}}#G($){console.error("[CrossBus] SharedWorker message error:",$)}#K($){console.error("[CrossBus] SharedWorker error:",$.message)}}class d6{#$=null;#Z=null;#X=!1;#J;#Q=null;static isSupported(){return typeof navigator<"u"&&"serviceWorker"in navigator}constructor($={}){if(!d6.isSupported())throw L.from(j.UNSUPPORTED,{api:"ServiceWorker"});this.#J=this.#Y()}get ready(){return this.#J}async#Y(){let $=await navigator.serviceWorker.ready;this.#$=$.active||navigator.serviceWorker.controller,this.#Q=this.#G.bind(this),navigator.serviceWorker.addEventListener("message",this.#Q)}send($,Z){if(this.#X)throw L.from(j.DESTROYED,{context:"ServiceWorkerTransport.send"});if(!this.#$)throw L.from(j.NOT_CONNECTED,{context:"ServiceWorkerTransport.send",reason:"No active ServiceWorker"});let X={[y]:S,...$};if(Z&&Z.length>0)this.#$.postMessage(X,Z);else this.#$.postMessage(X)}onMessage($){if(typeof $!=="function")throw TypeError("Handler must be a function");this.#Z=$}offMessage(){this.#Z=null}destroy(){if(this.#X)return;if(this.#X=!0,this.#Z=null,this.#Q)navigator.serviceWorker.removeEventListener("message",this.#Q),this.#Q=null;this.#$=null}get isDestroyed(){return this.#X}#G($){if(!this.#Z)return;if(!m($.data))return;try{this.#Z($.data,{origin:"serviceworker"})}catch(Z){console.error("[CrossBus] ServiceWorker handler error:",Z)}}}class p0{#$="none";#Z;#X;#J=null;#Q=!1;#Y=!1;#G=[];#K;#W=null;#U;#D;#j;static detectBridge(){if(globalThis.CrossBus&&typeof globalThis.CrossBus.postMessage==="function")return"android";if(globalThis.AndroidBridge&&typeof globalThis.AndroidBridge.postMessage==="function")return"android";if(globalThis.webkit?.messageHandlers?.crossbus)return"ios";return"none"}static isSupported(){return p0.detectBridge()!=="none"}constructor($={}){this.#Z=$.androidInterface??"CrossBus",this.#X=$.iosHandler??"crossbus",this.#K=$.queueWhileInit??!0,this.#U=$.heartbeatInterval??30000,this.#D=new Promise((Z)=>{this.#j=Z}),this.#_($.initTimeout??5000)}async#_($){let Z=Date.now(),X=()=>{if(this.#$=p0.detectBridge(),this.#$!=="none"){this.#q();return}if(Date.now()-Z<$)setTimeout(X,50);else console.warn("[CrossBus] No native bridge detected after timeout"),this.#Y=!0,this.#j?.()};X(),this.#z()}#q(){if(this.#Y=!0,this.#j?.(),this.#L(),this.#U>0)this.#V()}#z(){globalThis.__crossbus_receive__=(Z)=>{if(this.#Q||!this.#J)return;try{let X=typeof Z==="string"?JSON.parse(Z):Z;if(!m(X))return;this.#J(X,{bridgeType:this.#$})}catch(X){console.error("[CrossBus] Failed to parse native message:",X)}}}send($){if(this.#Q)throw L.from(j.DESTROYED,{context:"NativeBridgeTransport.send"});let Z={[y]:S,...$};if(!this.#Y&&this.#K){this.#G.push(Z);return}this.#F(Z)}#F($){let Z=JSON.stringify($);try{if(this.#$==="android"){let X=globalThis[this.#Z]||globalThis.AndroidBridge;if(X?.postMessage)X.postMessage(Z)}else if(this.#$==="ios"){let X=globalThis.webkit?.messageHandlers?.[this.#X];if(X?.postMessage)X.postMessage($)}}catch(X){console.error("[CrossBus] Failed to send to native:",X)}}#L(){while(this.#G.length>0){let $=this.#G.shift();this.#F($)}}#V(){this.#W=setInterval(()=>{if(this.#Q)return;this.#F({[y]:S,t:"hb",ts:Date.now()})},this.#U)}onMessage($){if(typeof $!=="function")throw TypeError("Handler must be a function");this.#J=$}offMessage(){this.#J=null}destroy(){if(this.#Q)return;if(this.#Q=!0,this.#J=null,this.#G=[],this.#W)clearInterval(this.#W),this.#W=null;delete globalThis.__crossbus_receive__}get isDestroyed(){return this.#Q}get bridgeType(){return this.#$}get isReady(){return this.#Y}get ready(){return this.#D}}class D4{#$;#Z;#X=null;#J;#Q;#Y;#G;#K;#W=null;#U=null;#D=null;#j=null;#_="disconnected";#q=[];#z=!1;constructor($){this.#$=$.url,this.#Z=$.peerId??v(),this.#J=$.autoReconnect??!0,this.#Q=$.reconnectDelayMs??1000,this.#Y=$.maxReconnectDelayMs??30000,this.#G=this.#Q,this.#K=$.heartbeatIntervalMs??30000}get peerId(){return this.#Z}get state(){return this.#_}get isConnected(){return this.#_==="connected"&&this.#X?.readyState===WebSocket.OPEN}async connect(){if(this.#X&&this.#X.readyState===WebSocket.OPEN)return;return this.#z=!1,this.#V("connecting"),new Promise(($,Z)=>{try{this.#X=new WebSocket(this.#$),this.#X.onopen=()=>{this.#V("connected"),this.#G=this.#Q,this.#L(),this.#H(),$()},this.#X.onmessage=(X)=>{this.#F(X)},this.#X.onclose=(X)=>{if(this.#x(),this.#V("disconnected"),!this.#z&&this.#J)this.#P()},this.#X.onerror=(X)=>{if(this.#V("error"),this.#_==="connecting")Z(Error("WebSocket connection failed"))}}catch(X){this.#V("error"),Z(X)}})}disconnect(){if(this.#z=!0,this.#x(),this.#U)clearTimeout(this.#U),this.#U=null;if(this.#X)this.#X.close(1000,"Client disconnect"),this.#X=null;this.#V("disconnected")}send($){let Z={_cb:S,_m:y,id:v(),from:this.#Z,timestamp:Date.now(),...$};if(this.isConnected&&this.#X)return this.#X.send(JSON.stringify(Z)),!0;else return this.#q.push(Z),!1}onMessage($){this.#D=$}onStateChange($){this.#j=$}#F($){try{let Z=JSON.parse($.data);if(Z.type==="pong")return;if(this.#D)this.#D(Z)}catch(Z){console.error("[WebSocketTransport] Failed to parse message:",Z)}}#L(){while(this.#q.length>0&&this.isConnected&&this.#X){let $=this.#q.shift();if($)this.#X.send(JSON.stringify($))}}#V($){if(this.#_!==$){if(this.#_=$,this.#j)this.#j($)}}#H(){if(this.#K<=0)return;this.#W=setInterval(()=>{if(this.isConnected&&this.#X)this.#X.send(JSON.stringify({type:"ping",from:this.#Z}))},this.#K)}#x(){if(this.#W)clearInterval(this.#W),this.#W=null}#P(){if(this.#U)return;this.#U=setTimeout(async()=>{this.#U=null;try{await this.connect()}catch{if(this.#G=Math.min(this.#G*2,this.#Y),this.#J&&!this.#z)this.#P()}},this.#G)}destroy(){this.disconnect(),this.#D=null,this.#j=null,this.#q=[]}}class l{#$;#Z;constructor($,Z={}){if(this.#$=$,this.#Z=new Map(Object.entries(Z)),!this.#Z.has($))this.#Z.set($,0)}get ownId(){return this.#$}get($){return this.#Z.get($)??0}tick(){let Z=this.get(this.#$)+1;return this.#Z.set(this.#$,Z),Z}update($){for(let[Z,X]of $.#Z){let J=this.get(Z);if(X>J)this.#Z.set(Z,X)}}happenedBefore($){let Z=!1,X=new Set([...this.#Z.keys(),...$.#Z.keys()]);for(let J of X){let Q=this.get(J),Y=$.get(J);if(Q>Y)return!1;if(Q<Y)Z=!0}return Z}isConcurrentWith($){return!this.happenedBefore($)&&!$.happenedBefore(this)&&!this.equals($)}equals($){let Z=new Set([...this.#Z.keys(),...$.#Z.keys()]);for(let X of Z)if(this.get(X)!==$.get(X))return!1;return!0}canDeliver($,Z){let X=$.get(Z),J=this.get(Z);if(X!==J+1)return!1;for(let[Q,Y]of $.#Z){if(Q===Z)continue;if(Y>this.get(Q))return!1}return!0}clone(){let $=Object.fromEntries(this.#Z);return new l(this.#$,$)}toJSON(){return{ownId:this.#$,counters:Object.fromEntries(this.#Z)}}static fromJSON($){return new l($.ownId,$.counters)}toString(){let $=[...this.#Z.entries()].map(([Z,X])=>`${Z}:${X}`).join(", ");return`VectorClock(${this.#$}){${$}}`}}class j4{#$;#Z;#X;#J;#Q;#Y;constructor($,Z={}){this.#$=$,this.#Z=new l($),this.#X=[],this.#J=Z.onDeliver||(()=>{}),this.#Q=Z.maxBufferSize??1000,this.#Y=Z.onBufferOverflow||null}get ownId(){return this.#$}get bufferSize(){return this.#X.length}receive($,Z){let X=l.fromJSON(Z.clock);if(this.#Z.canDeliver(X,$))this.#G($,Z,X),this.#W();else this.#K($,Z,X)}#G($,Z,X){this.#Z.update(X),this.#J(Z)}#K($,Z,X){if(this.#X.length>=this.#Q){if(this.#Y)this.#Y({senderId:$,message:Z,bufferSize:this.#X.length});return}this.#X.push({senderId:$,message:Z,clock:X})}#W(){let $=!0;while($){$=!1;for(let Z=this.#X.length-1;Z>=0;Z--){let{senderId:X,message:J,clock:Q}=this.#X[Z];if(this.#Z.canDeliver(Q,X))this.#X.splice(Z,1),this.#G(X,J,Q),$=!0}}}tick(){return this.#Z.tick(),this.#Z.clone()}getVectorClock(){return this.#Z.clone()}clear(){this.#X=[]}}var q4="0.1.0",U0="__MICROUI_CROSSBUS__",b=typeof window<"u"?window:globalThis,V4=["ui:toast","ui:modal","ui:theme","ui:tabs","ui:dropdown","ui:form","ui:grid","ui:stack","ui:virtual-list"],F4={type:"ui-framework",version:q4,description:"AI-Optimized UI Framework - Web Components Edition"};if(!b[U0])b[U0]=new W0({peerId:"microui",isHub:!0,requestTimeout:5000,capabilities:V4,meta:F4}),b[U0].setMaxListeners(100);var N=b[U0],c0="__MICROUI_COMPONENT_REGISTRY__";if(!b[c0])b[c0]=new Map;var A4=b[c0],P={on($,Z){let X=N.on($,(J)=>{Z(J.data??J)});return()=>X.unsubscribe()},once($,Z){let X=this.on($,(J)=>{X(),Z(J)})},off($,Z){N.off($,Z)},emit($,Z){return N.emitSync($,Z)},async emitAsync($,Z){return N.emit($,Z)},signal($,Z){N.signal($,Z)},async request($,Z,X){return N.request($,Z,X)},async broadcastRequest($,Z){return N.broadcastRequest($,Z)},handle($,Z){return N.handle($,Z)},unhandle($){N.unhandle($)},destroy(){N.destroy()},setMaxListeners($){N.setMaxListeners($)},get peerId(){return N.peerId},get peers(){return N.peers},get peerCount(){return N.peerCount},hasListeners($){return N.hasListeners($)},get raw(){return N}},O={TOAST_SHOW:"ui:toast:show",TOAST_DISMISS:"ui:toast:dismiss",MODAL_OPEN:"ui:modal:open",MODAL_CLOSE:"ui:modal:close",THEME_CHANGE:"ui:theme:change",TAB_CHANGE:"ui:tab:change",DROPDOWN_SELECT:"ui:dropdown:select",FORM_SUBMIT:"ui:form:submit",FORM_VALIDATE:"ui:form:validate"},d0=($,Z={})=>{P.emit(O.TOAST_SHOW,{message:$,...Z})};var z0=($,Z)=>{A4.set($,{...Z,registeredAt:Date.now()})};var f={set($){if($==="auto"){let Z=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.setAttribute("data-theme",Z?"dark":"light")}else document.documentElement.setAttribute("data-theme",$);localStorage.setItem("mu-theme",$),P.emit(O.THEME_CHANGE,{theme:$})},get(){return document.documentElement.getAttribute("data-theme")||"light"},toggle(){let $=this.get();this.set($==="dark"?"light":"dark")},init(){let $=localStorage.getItem("mu-theme");if($)this.set($);else this.set("auto");window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(Z)=>{if(localStorage.getItem("mu-theme")==="auto")document.documentElement.setAttribute("data-theme",Z.matches?"dark":"light")})}};if(typeof window<"u")f.init();function o($={}){let Z={...$},X=new Set;return{get(){return Z},set(J){Z={...Z,...J},this.notify()},update(J){let Q=J(Z);this.set(Q)},subscribe(J){return X.add(J),J(Z),()=>X.delete(J)},notify(){for(let J of X)J(Z)},reset(){Z={...$},this.notify()}}}var n=o({}),h=new Map,i=new Map,l0=!1;function _0($,Z={}){if(h.has($))return console.warn(`[microUI] Store namespace "${$}" already exists. Returning existing store.`),h.get($);let X=o(Z),J=X.set.bind(X);return X.set=function(Q){if(l0){if(!i.has($))i.set($,[]);i.get($).push({timestamp:Date.now(),state:{...X.get()}});let Y=i.get($);if(Y.length>100)Y.shift()}J(Q)},X.namespace=$,h.set($,X),X}function i0($){return h.get($)}function o0(){let $={};for(let[Z,X]of h)$[Z]=X;return $}function n0(){let $={timestamp:Date.now(),stores:{}};for(let[Z,X]of h)$.stores[Z]={...X.get()};return $.stores.__global__={...n.get()},$}function s0($,Z={}){let{createMissing:X=!1}=Z;if(!$?.stores){console.warn("[microUI] Invalid snapshot provided to restoreAppState");return}for(let[J,Q]of Object.entries($.stores)){if(J==="__global__"){n.set(Q);continue}let Y=h.get(J);if(!Y&&X)Y=_0(J,{});if(Y)Y.set(Q)}}function r0($){return i.get($)||[]}function t0(){l0=!0}function a0(){l0=!1}class l6{#$=[];#Z=null;#X="";on($,Z){let X=$.replace(/:[a-zA-Z]+/g,"([^/]+)").replace(/\//g,"\\/"),J=($.match(/:[a-zA-Z]+/g)||[]).map((Q)=>Q.slice(1));return this.#$.push({path:$,pattern:new RegExp(`^${X}$`),paramNames:J,handler:Z}),this}notFound($){return this.#Z=$,this}navigate($){window.location.hash=$}get current(){return this.#X}start(){let $=()=>{let Z=window.location.hash.slice(1)||"/";this.#X=Z;for(let X of this.#$){let J=Z.match(X.pattern);if(J){let Q={};X.paramNames.forEach((Y,G)=>{Q[Y]=J[G+1]}),X.handler(Q);return}}if(this.#Z)this.#Z(Z)};return window.addEventListener("hashchange",$),$(),this}}var e0=new l6;var $1={baseURL:"",headers:{"Content-Type":"application/json"},setBaseURL($){this.baseURL=$},setHeader($,Z){this.headers[$]=Z},async get($,Z={}){return this.request($,{...Z,method:"GET"})},async post($,Z,X={}){return this.request($,{...X,method:"POST",body:Z})},async put($,Z,X={}){return this.request($,{...X,method:"PUT",body:Z})},async delete($,Z={}){return this.request($,{...Z,method:"DELETE"})},async request($,Z={}){let X=this.baseURL+$,J={method:Z.method||"GET",headers:{...this.headers,...Z.headers}};if(Z.body)J.body=JSON.stringify(Z.body);try{let Q=await fetch(X,J);if(!Q.ok)throw new g(Q.status,Q.statusText,await Q.text());if(Q.headers.get("content-type")?.includes("application/json"))return Q.json();return Q.text()}catch(Q){if(Q instanceof g)throw Q;throw new g(0,"Network Error",Q.message)}}};class g extends Error{constructor($,Z,X){super(`HTTP ${$}: ${Z}`);this.status=$,this.statusText=Z,this.body=X}}function k($,Z,X={}){let{color:J="currentColor",centered:Q=!1}=X,Y=$.getBoundingClientRect(),G,K;if(Q||!Z)G=Y.width/2,K=Y.height/2;else{let F=Z.touches?Z.touches[0].clientX:Z.clientX,A=Z.touches?Z.touches[0].clientY:Z.clientY;G=F-Y.left,K=A-Y.top}let U=Math.max(Math.hypot(G,K),Math.hypot(Y.width-G,K),Math.hypot(G,Y.height-K),Math.hypot(Y.width-G,Y.height-K))*2,W=document.createElement("span");W.className="mu-ripple-wave",W.style.cssText=`
|
|
14
|
+
position: absolute;
|
|
15
|
+
width: ${U}px;
|
|
16
|
+
height: ${U}px;
|
|
17
|
+
left: ${G-U/2}px;
|
|
18
|
+
top: ${K-U/2}px;
|
|
19
|
+
background: ${J};
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
transform: scale(0);
|
|
22
|
+
opacity: 0.10;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
`;let D=getComputedStyle($);if(D.position==="static")$.style.position="relative";if(D.overflow!=="hidden")$.style.overflow="hidden";$.appendChild(W),W.animate([{transform:"scale(0)"},{transform:"scale(1)"}],{duration:300,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"});let q=()=>{W.animate([{opacity:"0.10"},{opacity:"0"}],{duration:150,easing:"ease-out",fill:"forwards"}).onfinish=()=>W.remove(),$.removeEventListener("pointerup",q),$.removeEventListener("pointerleave",q),$.removeEventListener("pointercancel",q)};return $.addEventListener("pointerup",q,{once:!0}),$.addEventListener("pointerleave",q,{once:!0}),$.addEventListener("pointercancel",q,{once:!0}),W}function i6($,Z={}){let X=(J)=>{if($.hasAttribute("disabled"))return;k($,J,Z)};return $.addEventListener("pointerdown",X),()=>{$.removeEventListener("pointerdown",X)}}var L4=($)=>class extends ${#$=null;initRipple(Z=this,X={}){this.#$=i6(Z,X)}disconnectedCallback(){if(this.#$)this.#$(),this.#$=null;super.disconnectedCallback?.()}};var o6=0;function p($,Z){let X=$,J=Z||`signal_${++o6}`,Q=`signal:${J}`,Y=new Set,G=()=>{if(M){let K=P.on(Q,M);Y.add(K)}return X};return G.set=(K)=>{if(X!==K){let U=X;X=K,P.emit(Q,{value:K,oldValue:U,signal:J})}},G.update=(K)=>{G.set(K(X))},G.peek=()=>X,G.signalName=J,G.subscribe=(K)=>{return P.on(Q,(U)=>K(U.value,U.oldValue))},G.dispose=()=>{for(let K of Y)K();Y.clear()},G}var M=null;function u($,Z){let X=Z||`computed_${++o6}`,J=`signal:${X}`,Q,Y=!0,G=()=>{Y=!0;let U=$();if(Q!==U)Q=U,P.emit(J,{value:U,signal:X})},K=()=>{if(Y){let U=M;M=G;try{Q=$()}finally{M=U}Y=!1}if(M)P.on(J,M);return Q};return K.signalName=X,K.subscribe=(U)=>P.on(J,(W)=>U(W.value)),K}function D0($){let Z=!1,X=[],J=()=>{if(Z)return;for(let Y of X)Y();X.length=0;let Q=M;M=J;try{$()}finally{M=Q}};return J(),()=>{Z=!0;for(let Q of X)Q()}}function Z1($){$()}function j0($,Z){if(Z.required&&!$?.trim())return"This field is required";if($&&Z.minLength&&$.length<Z.minLength)return`Minimum ${Z.minLength} characters required`;if($&&Z.maxLength&&$.length>Z.maxLength)return`Maximum ${Z.maxLength} characters allowed`;if($&&Z.pattern&&!Z.pattern.test($))return"Invalid format";if($&&Z.type==="email"){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test($))return"Invalid email address"}if($&&Z.type==="url")try{new URL($)}catch{return"Invalid URL"}if(Z.validate)return Z.validate($);return null}function X1($,Z={}){let X=Object.keys(Z),J={},Q={};for(let W of X){let D=$.querySelector(`[name="${W}"]`),q=D?.value||D?.getAttribute("value")||"";J[W]=p({value:q,error:null,touched:!1,dirty:!1},`form-${W}`),Q[W]={value:q,error:null,touched:!1,dirty:!1}}let Y=u(()=>{for(let W of X){let D=J[W]();if(j0(D.value,Z[W]||{}))return!1}return!0}),G=u(()=>{for(let W of X)if(J[W]().dirty)return!0;return!1}),K=p(!1,"form-submitting");for(let W of X){let D=$.querySelector(`[name="${W}"]`);if(!D)continue;D.addEventListener("input",(q)=>{let F=q.target.value,A=J[W](),H=j0(F,Z[W]||{});J[W].set({...A,value:F,dirty:F!==Q[W].value,error:A.touched?H:null})}),D.addEventListener("blur",()=>{let q=J[W](),F=j0(q.value,Z[W]||{});J[W].set({...q,touched:!0,error:F})})}let U=new Proxy({},{get(W,D){if(typeof D==="string"&&J[D])return J[D]();return}});return{get fields(){return U},get isValid(){return Y()},get isDirty(){return G()},get isSubmitting(){return K()},set isSubmitting(W){K.set(W)},getValues(){let W={};for(let D of X)W[D]=J[D]().value;return W},getErrors(){let W={};for(let D of X)W[D]=J[D]().error;return W},reset(){for(let W of X){J[W].set({...Q[W]});let D=$.querySelector(`[name="${W}"]`);if(D)D.value=Q[W].value}},validate(){let W=!0;for(let D of X){let q=J[D](),F=j0(q.value,Z[D]||{});if(F)W=!1;J[D].set({...q,touched:!0,error:F})}return W}}}function J1($){let Z={},X=$.querySelectorAll("[name]");for(let J of X){let Q=J.getAttribute("name");if(Q)Z[Q]=J.value||""}return Z}function q0($){let Z=$.getAttribute("aria-labelledby");if(Z){let U=Z.split(" ").map((W)=>document.getElementById(W)?.textContent).filter(Boolean).join(" ");if(U)return U}let X=$.getAttribute("aria-label");if(X)return X;if($.id){let U=document.querySelector(`label[for="${$.id}"]`);if(U)return U.textContent.trim()}let J=$.getAttribute("title");if(J)return J;let Q=$.getAttribute("role")||$.tagName.toLowerCase();if(["button","link","tab","menuitem","option","radio","checkbox"].some((U)=>Q.includes(U))){let U=$.textContent?.trim();if(U&&U.length<100)return U}let G=$.getAttribute("placeholder");if(G)return G;let K=$.getAttribute("value");if(K&&$.tagName.includes("INPUT"))return`Input: ${K}`;return $.tagName.toLowerCase().replace("mu-","")}function Y1($){let Z=[],X=$.tagName.toLowerCase();if($.hasAttribute("disabled"))return["none (disabled)"];if($.onclick||$.hasAttribute("onclick"))Z.push("click");switch(X){case"mu-button":Z.push("click");break;case"mu-checkbox":case"mu-switch":Z.push("toggle","check","uncheck");break;case"mu-input":case"mu-textarea":Z.push("type","clear","focus");break;case"mu-dropdown":Z.push("open","select","close");break;case"mu-modal":Z.push("open","close");break;case"mu-tabs":Z.push("select-tab");break;case"mu-radio":Z.push("select");break;case"mu-chip":Z.push("toggle","click");break;case"mu-confirm":Z.push("confirm","cancel");break;default:if($.classList.contains("mu-button")||$.getAttribute("role")==="button")Z.push("click")}return Z.length?Z:["focus"]}function G1($){let Z={},X=$.tagName.toLowerCase();if($.hasAttribute("checked"))Z.checked=!0;if($.hasAttribute("disabled"))Z.disabled=!0;if($.hasAttribute("open"))Z.open=!0;if($.hasAttribute("selected"))Z.selected=!0;if($.hasAttribute("active"))Z.active=!0;if($.hasAttribute("loading"))Z.loading=!0;if($.hasAttribute("value"))Z.value=$.getAttribute("value");let J=$.getAttribute("aria-checked");if(J)Z.ariaChecked=J==="true";let Q=$.getAttribute("aria-expanded");if(Q)Z.expanded=Q==="true";let Y=$.getAttribute("aria-selected");if(Y)Z.selected=Y==="true";switch(X){case"mu-input":case"mu-textarea":let G=$.querySelector("input, textarea");if(G)Z.value=G.value,Z.placeholder=G.placeholder;break;case"mu-progress":Z.value=parseFloat($.getAttribute("value")||"0"),Z.max=parseFloat($.getAttribute("max")||"100"),Z.percentage=Z.value/Z.max*100;break;case"mu-dropdown":Z.value=$.getAttribute("value"),Z.open=$.classList.contains("is-open");break}return Z}function n6($){let Z=$.tagName.toLowerCase().replace("mu-",""),X=q0($),J=G1($),Q=J.disabled?" (disabled)":"",G={button:()=>`Button "${X}"${Q}. ${J.loading?"Currently loading.":"Click to activate."}`,checkbox:()=>`Checkbox "${X}"${Q}. Currently ${J.ariaChecked||J.checked?"checked":"unchecked"}.`,switch:()=>`Toggle switch "${X}"${Q}. Currently ${J.ariaChecked||J.checked?"on":"off"}.`,input:()=>`Text input "${X}"${Q}. ${J.value?`Current value: "${J.value}"`:"Empty."} ${J.placeholder?`Placeholder: "${J.placeholder}"`:""}`,textarea:()=>`Text area "${X}"${Q}. ${J.value?`Contains: "${J.value.slice(0,50)}${J.value.length>50?"...":""}"`:"Empty."}`,dropdown:()=>`Dropdown "${X}"${Q}. ${J.value?`Selected: "${J.value}"`:"No selection."} ${J.open?"Menu is open.":"Menu is closed."}`,modal:()=>`Modal dialog${J.open?" (currently open)":" (currently closed)"}. ${X!=="modal"?`Title: "${X}"`:""}`,tabs:()=>`Tab navigation with ${$.querySelectorAll("mu-tab").length} tabs.`,tab:()=>`Tab "${X}". ${J.active?"Currently active.":"Inactive."}`,progress:()=>`Progress bar at ${Math.round(J.percentage||0)}%.`,spinner:()=>"Loading spinner indicating operation in progress.",alert:()=>`Alert message: "${$.textContent?.trim().slice(0,100)||X}"`,card:()=>`Card container${X!=="card"?` titled "${X}"`:""}.`,chip:()=>`Chip "${X}"${Q}. ${J.selected?"Selected.":"Not selected."}`,badge:()=>`Badge showing "${$.textContent?.trim()||"notification"}"`,avatar:()=>`User avatar${$.getAttribute("name")?` for "${$.getAttribute("name")}"`:""}`,icon:()=>`Icon: ${$.getAttribute("name")||"decorative"}`,confirm:()=>`Confirmation dialog. ${J.open?"Waiting for user response.":"Hidden."}`,fetch:()=>`Data fetcher${J.loading?" (loading)":""}. URL: ${$.getAttribute("url")||"not set"}`}[Z];if(G)return G();return`${Z} component${X?` "${X}"`:""}${Q}.`}function H4($){let Z=$.getBoundingClientRect();return Z.top<window.innerHeight&&Z.bottom>0&&Z.left<window.innerWidth&&Z.right>0&&Z.width>0&&Z.height>0}function c($=document.body,Z={}){let{visibleOnly:X=!1,interactiveOnly:J=!1,types:Q=null}=Z,Y=Q?Q.join(","):'[class^="mu-"]:not(.mu-ripple-wave)',G=$.querySelectorAll(Y),K=[],U=new Set(["mu-button","mu-checkbox","mu-switch","mu-input","mu-textarea","mu-dropdown","mu-radio","mu-tab","mu-chip","mu-modal","mu-confirm"]);for(let W of G){let D=W.tagName.toLowerCase();if(!D.startsWith("mu-"))continue;let q=U.has(D),F=H4(W);if(X&&!F)continue;if(J&&!q)continue;let A=W.getBoundingClientRect();K.push({tag:D,id:W.id||null,label:q0(W),description:n6(W),state:G1(W),actions:Y1(W),rect:{top:Math.round(A.top),left:Math.round(A.left),width:Math.round(A.width),height:Math.round(A.height)},interactive:q,visible:F})}return K}function V0($){let Z=typeof $==="string"?document.querySelector($):$;if(!Z)return null;return n6(Z)}function F0(){let $=new Map,Z=["mu-button","mu-input","mu-textarea","mu-checkbox","mu-switch","mu-dropdown","mu-option","mu-radio","mu-radio-group","mu-chip","mu-card","mu-tabs","mu-tab","mu-alert","mu-badge","mu-progress","mu-avatar","mu-skeleton","mu-spinner","mu-modal","mu-toast","mu-tooltip","mu-icon","mu-stack","mu-grid","mu-container","mu-navbar","mu-sidebar","mu-divider","mu-theme-toggle","mu-virtual-list","mu-lazy","mu-repeat","mu-form","mu-table","mu-confirm","mu-fetch"];for(let X of Z){let J=customElements.get(X);if(J)$.set(X,J)}return $}function A0($,Z=document.body){let X=$.toLowerCase();return c(Z).filter((Q)=>Q.label.toLowerCase().includes(X)).map((Q)=>{let Y=Q.id?`#${Q.id}`:`${Q.tag}`;return Z.querySelector(Y)}).filter(Boolean)}var Q1=!1,I=null,s=new Map;function L0($={}){let{showLabels:Z=!0,showBoxes:X=!0,markerStyle:J="badge"}=$;if(Q1)r();I=document.createElement("div"),I.id="mu-visual-markers",I.style.cssText=`
|
|
25
|
+
position: fixed;
|
|
26
|
+
inset: 0;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
z-index: 999999;
|
|
29
|
+
`,document.body.appendChild(I);let Q={B:0,I:0,C:0,S:0,D:0,M:0,T:0,R:0,O:0},Y=(K)=>{return{"mu-button":"B","mu-input":"I","mu-textarea":"I","mu-checkbox":"C","mu-switch":"S","mu-dropdown":"D","mu-modal":"M","mu-tabs":"T","mu-tab":"T","mu-radio":"R","mu-chip":"C","mu-confirm":"M"}[K]||"O"},G=c(document.body,{interactiveOnly:!0,visibleOnly:!0});for(let K of G){let U=Y(K.tag);Q[U]++;let W=`${U}${Q[U]}`,D=document.querySelector(K.id?`#${K.id}`:`${K.tag}[data-mu-action="${K.state.action||""}"]`)||document.querySelector(K.tag);if(!D)continue;let q=D.getBoundingClientRect(),F=document.createElement("div");F.className="mu-visual-marker",F.dataset.markerId=W,F.dataset.tag=K.tag,F.dataset.label=K.label;let A={B:"#7C4DFF",I:"#00BCD4",C:"#4CAF50",S:"#FF9800",D:"#2196F3",M:"#E91E63",T:"#9C27B0",R:"#795548",O:"#607D8B"}[U];if(J==="badge")F.style.cssText=`
|
|
30
|
+
position: fixed;
|
|
31
|
+
top: ${q.top-8}px;
|
|
32
|
+
left: ${q.left-8}px;
|
|
33
|
+
background: ${A};
|
|
34
|
+
color: white;
|
|
35
|
+
font: bold 11px system-ui;
|
|
36
|
+
padding: 2px 6px;
|
|
37
|
+
border-radius: 4px;
|
|
38
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
`,F.textContent=Z?`${W}`:"";else if(J==="outline"){if(F.style.cssText=`
|
|
41
|
+
position: fixed;
|
|
42
|
+
top: ${q.top}px;
|
|
43
|
+
left: ${q.left}px;
|
|
44
|
+
width: ${q.width}px;
|
|
45
|
+
height: ${q.height}px;
|
|
46
|
+
border: 2px solid ${A};
|
|
47
|
+
border-radius: 4px;
|
|
48
|
+
box-shadow: 0 0 0 1px rgba(255,255,255,0.5);
|
|
49
|
+
`,Z){let H=document.createElement("span");H.style.cssText=`
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: -18px;
|
|
52
|
+
left: -2px;
|
|
53
|
+
background: ${A};
|
|
54
|
+
color: white;
|
|
55
|
+
font: bold 10px system-ui;
|
|
56
|
+
padding: 1px 4px;
|
|
57
|
+
border-radius: 2px;
|
|
58
|
+
`,H.textContent=W,F.appendChild(H)}}I.appendChild(F),s.set(W,D)}return Q1=!0,s}function r(){if(I)I.remove(),I=null;s.clear(),Q1=!1}function H0($){return s.get($)||null}function x0(){let $={};for(let[Z,X]of s)$[Z]={tag:X.tagName.toLowerCase(),label:q0(X),actions:Y1(X)};return $}function P0(){return{name:"microui",version:"3.4.0",description:"Interact with microUI Material Design 3 web components",actions:[{name:"click_button",description:"Click a button element",parameters:{selector:{type:"string",description:'CSS selector, marker ID (e.g., "B1"), or label text',required:!0}}},{name:"fill_input",description:"Fill an input or textarea with text",parameters:{selector:{type:"string",description:'CSS selector, marker ID (e.g., "I1"), or label text',required:!0},value:{type:"string",description:"Text to enter",required:!0},clear:{type:"boolean",description:"Clear existing content first",default:!0}}},{name:"toggle_checkbox",description:"Toggle a checkbox or switch",parameters:{selector:{type:"string",description:"CSS selector, marker ID, or label text",required:!0},checked:{type:"boolean",description:"Target state (true=checked, false=unchecked)",required:!1}}},{name:"select_option",description:"Select an option in a dropdown",parameters:{selector:{type:"string",description:"CSS selector for dropdown",required:!0},value:{type:"string",description:"Option value or text to select",required:!0}}},{name:"open_modal",description:"Open a modal dialog",parameters:{selector:{type:"string",description:"CSS selector for modal",required:!0}}},{name:"close_modal",description:"Close a modal dialog",parameters:{selector:{type:"string",description:"CSS selector for modal",required:!0}}},{name:"select_tab",description:"Select a tab by index or label",parameters:{tabs_selector:{type:"string",description:"CSS selector for mu-tabs container",required:!0},index:{type:"number",description:"Tab index (0-based)",required:!1},label:{type:"string",description:"Tab label text",required:!1}}},{name:"get_component_tree",description:"Get structured tree of all microUI components",parameters:{visible_only:{type:"boolean",description:"Only include visible components",default:!0},interactive_only:{type:"boolean",description:"Only include interactive components",default:!1}}},{name:"enable_visual_markers",description:"Enable visual markers for screenshot parsing",parameters:{style:{type:"string",enum:["badge","outline"],description:"Marker visual style",default:"badge"}}},{name:"confirm_dialog",description:"Respond to a confirmation dialog",parameters:{action:{type:"string",enum:["confirm","cancel"],description:"Whether to confirm or cancel",required:!0}}}]}}var K1={getMuComponentTree:c,describe:V0,getRegisteredComponents:F0,findByLabel:A0,getAccessibleName:q0,getAvailableActions:Y1,getComponentState:G1,enableVisualMarkers:L0,disableVisualMarkers:r,getMarkerElement:H0,getMarkerMap:x0,getMCPActions:P0};var R=new Map;function B0($,Z={}){if(R.has($))return console.warn(`[microUI] Feature "${$}" already exists. Returning existing.`),R.get($);let X={name:$,config:{routes:Z.routes||[],store:Z.store||null,components:Z.components||[],meta:Z.meta||{},init:Z.init||null,destroy:Z.destroy||null},initialized:!1,registeredAt:Date.now()};if(R.set($,X),X.config.init&&typeof X.config.init==="function")try{X.config.init(),X.initialized=!0}catch(J){console.error(`[microUI] Failed to initialize feature "${$}":`,J)}return X}function O0(){let $={};for(let[Z,X]of R)$[Z]=X;return $}function w0($){return R.get($)}function N0($){return R.get($)?.config.components||[]}function x4($){return R.get($)?.config.routes||[]}function P4($){for(let Z of R.values())if(Z.config.routes.some((X)=>$.startsWith(X)))return Z;return null}function B4($){for(let Z of R.values())if(Z.config.components.includes($))return Z;return null}function s6($){let Z=R.get($);if(!Z)return;if(Z.config.destroy&&typeof Z.config.destroy==="function")try{Z.config.destroy()}catch(X){console.error(`[microUI] Error destroying feature "${$}":`,X)}R.delete($)}function R0(){let $={totalFeatures:R.size,features:[],totalRoutes:0,totalComponents:0};for(let[Z,X]of R){let J=X.config.routes.length,Q=X.config.components.length;$.features.push({name:Z,routes:J,components:Q,hasStore:!!X.config.store,initialized:X.initialized,meta:X.config.meta}),$.totalRoutes+=J,$.totalComponents+=Q}return $}function O4(){for(let $ of R.keys())s6($);R.clear()}var W1={createFeature:B0,getFeatures:O0,getFeature:w0,getFeatureComponents:N0,getFeatureRoutes:x4,getFeatureByRoute:P4,getFeatureByComponent:B4,destroyFeature:s6,getFeatureSummary:R0,clearFeatures:O4};var w=new Map,E=($,Z)=>({$schema:"https://json-schema.org/draft/2020-12/schema",$id:`https://microui.dev/schemas/${$}.json`,title:$,description:Z,type:"object",properties:{},actions:[],events:[],slots:[]});w.set("mu-button",{...E("mu-button","Interactive button element with MD3 variants"),properties:{variant:{type:"string",enum:["filled","elevated","tonal","outlined","text","danger"],default:"filled",description:"Visual style variant"},size:{type:"string",enum:["sm","md","lg"],default:"md",description:"Button size"},disabled:{type:"boolean",default:!1,description:"Whether the button is disabled"}},actions:["click"],events:["click"],slots:["default"]});w.set("mu-input",{...E("mu-input","Text input field with floating label"),properties:{type:{type:"string",enum:["text","email","password","number","tel","url"],default:"text"},variant:{type:"string",enum:["outlined","filled"],default:"outlined"},label:{type:"string",description:"Floating label text"},placeholder:{type:"string"},value:{type:"string",default:""},disabled:{type:"boolean",default:!1},required:{type:"boolean",default:!1}},actions:["focus","blur","clear"],events:["mu-input","mu-change"],slots:[]});w.set("mu-checkbox",{...E("mu-checkbox","Checkbox with optional label"),properties:{checked:{type:"boolean",default:!1},disabled:{type:"boolean",default:!1},value:{type:"string"}},actions:["toggle","check","uncheck"],events:["mu-change"],slots:["default"]});w.set("mu-switch",{...E("mu-switch","Toggle switch with on/off state"),properties:{checked:{type:"boolean",default:!1},disabled:{type:"boolean",default:!1}},actions:["toggle"],events:["mu-change"],slots:[]});w.set("mu-card",{...E("mu-card","Material Design 3 card container"),properties:{variant:{type:"string",enum:["elevated","filled","outlined"],default:"elevated"}},actions:[],events:[],slots:["default","header","footer"]});w.set("mu-modal",{...E("mu-modal","Dialog/modal overlay"),properties:{open:{type:"boolean",default:!1},closeOnEscape:{type:"boolean",default:!0},closeOnBackdrop:{type:"boolean",default:!0}},actions:["open","close"],events:["mu-open","mu-close"],slots:["default"]});w.set("mu-dropdown",{...E("mu-dropdown","Select dropdown with options"),properties:{value:{type:"string"},placeholder:{type:"string"},disabled:{type:"boolean",default:!1},required:{type:"boolean",default:!1}},actions:["open","close","select"],events:["mu-change"],slots:["default"]});w.set("mu-tabs",{...E("mu-tabs","Tab navigation container"),properties:{active:{type:"number",default:0,description:"Active tab index (0-based)"}},actions:["selectTab"],events:["mu-tab-change"],slots:["default"]});w.set("mu-alert",{...E("mu-alert","Alert/notification banner"),properties:{variant:{type:"string",enum:["info","success","warning","error"],default:"info"},dismissible:{type:"boolean",default:!1}},actions:["dismiss"],events:["mu-dismiss"],slots:["default"]});w.set("mu-stack",{...E("mu-stack","Flexbox layout container"),properties:{direction:{type:"string",enum:["row","column"],default:"column"},gap:{type:"string",enum:["xs","sm","md","lg","xl"],default:"md"},align:{type:"string",enum:["start","center","end","stretch"],default:"stretch"}},actions:[],events:[],slots:["default"]});w.set("mu-grid",{...E("mu-grid","CSS Grid layout container"),properties:{columns:{type:"string",default:"1",description:"Number of columns or CSS grid-template-columns"},gap:{type:"string",enum:["xs","sm","md","lg","xl"],default:"md"}},actions:[],events:[],slots:["default"]});function T0($){return w.get($)||null}function S0(){return new Map(w)}function y0(){return Array.from(w.keys())}function w4($){let Z={};for(let X of $){let J=w.get(X);if(J)Z[X]=J}return Z}function k0($){let Z=w.get($);if(!Z)return null;return{tag:$,description:Z.description,properties:Object.keys(Z.properties||{}),actions:Z.actions||[],events:Z.events||[]}}function N4(){let $={};for(let[Z,X]of w)$[Z]=X;return JSON.stringify($,null,2)}var U1={getComponentSchema:T0,getAllSchemas:S0,getSchemaComponents:y0,getSchemas:w4,getSchemaQuickRef:k0,exportSchemasAsJSON:N4};var r6=Object.freeze({base:1,sticky:100,dropdown:1000,drawer:1100,modal:1200,toast:1300,tooltip:1400,overlay:9999,devtools:999999});function t6(){if(document.getElementById("mu-layer-tokens"))return;let $=document.createElement("style");$.id="mu-layer-tokens",$.textContent=`:root {
|
|
59
|
+
${Object.entries(r6).map(([Z,X])=>` --z-${Z}: ${X};`).join(`
|
|
60
|
+
`)}
|
|
61
|
+
}`,document.head.appendChild($)}if(typeof window<"u")t6();class z1{#$=[];#Z=!1;constructor(){this.#X()}#X(){if(this.#Z||typeof window>"u")return;document.addEventListener("keydown",($)=>{if($.key==="Escape"&&this.#$.length>0)$.preventDefault(),$.stopPropagation(),this.#$[this.#$.length-1].callback()}),this.#Z=!0}pushEscapeHandler($,Z){let X={element:$,callback:Z};return this.#$.push(X),()=>{let J=this.#$.indexOf(X);if(J>-1)this.#$.splice(J,1)}}isTopmost($){if(this.#$.length===0)return!1;return this.#$[this.#$.length-1].element===$}get stackDepth(){return this.#$.length}}var _1=new z1;var E0={compact:600,medium:840,expanded:840};class D1{#$=new Set;#Z="expanded";#X=null;#J=null;constructor(){if(typeof window<"u")this.#Q()}#Q(){this.#X=window.matchMedia(`(max-width: ${E0.compact-1}px)`),this.#X.addEventListener("change",this.#Y),this.#J=window.matchMedia(`(min-width: ${E0.compact}px) and (max-width: ${E0.medium-1}px)`),this.#J.addEventListener("change",this.#Y),this.#G()}#Y=()=>{let $=this.#Z;if(this.#G(),$!==this.#Z)this.#K()};#G(){if(this.#X?.matches)this.#Z="compact";else if(this.#J?.matches)this.#Z="medium";else this.#Z="expanded"}#K(){this.#$.forEach(($)=>{try{$(this.#Z)}catch(Z){console.error("[Breakpoints] Listener error:",Z)}})}get current(){if(this.#X?.matches)return"compact";else if(this.#J?.matches)return"medium";return"expanded"}get isCompact(){return this.#X?.matches??!1}get isMedium(){return this.#J?.matches??!1}get isExpanded(){return!this.isCompact&&!this.isMedium}get isNotCompact(){return this.#Z!=="compact"}subscribe($){return this.#$.add($),$(this.#Z),()=>{this.#$.delete($)}}get windowWidth(){return typeof window<"u"?window.innerWidth:1200}}var C=new D1;function V($){if($==null)return"";return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var j1="startViewTransition"in document;async function q1($){if(j1)await document.startViewTransition(async()=>{await $()}).finished;else await $()}async function R4($,{name:Z="page"}={}){if(j1){let X=document.createElement("style");X.textContent=`
|
|
62
|
+
::view-transition-old(${Z}),
|
|
63
|
+
::view-transition-new(${Z}) {
|
|
64
|
+
animation-duration: 0.3s;
|
|
65
|
+
}
|
|
66
|
+
`,document.head.appendChild(X),await q1($),X.remove()}else await $()}async function T4($,Z){await q1(()=>{window.history.pushState({},"",$),Z()})}var V1="scheduler"in globalThis;async function F1($,Z="user-visible"){if(V1)return globalThis.scheduler.postTask($,{priority:Z});let X=Z==="user-blocking"?0:Z==="user-visible"?0:1;return new Promise((J)=>{setTimeout(()=>J($()),X)})}async function a6(){if(V1&&"yield"in globalThis.scheduler)return globalThis.scheduler.yield();return new Promise(($)=>setTimeout($,0))}async function S4($,Z,X=50){for(let J=0;J<$.length;J++)if(Z($[J],J),(J+1)%X===0)await a6()}function y4($){return F1($,"background")}function k4($){return F1($,"user-blocking")}function A1(){return new Promise(($)=>{requestAnimationFrame(()=>requestAnimationFrame($))})}class e6{#$=[];#Z=!1;schedule($){if(this.#$.push($),!this.#Z)this.#Z=!0,requestAnimationFrame(()=>this.#X())}#X(){let $=this.#$.slice();this.#$=[],this.#Z=!1;for(let Z of $)try{Z()}catch(X){console.error("[RenderScheduler] Error:",X)}}}var M0=new e6;function E4($,Z=JSON.stringify){let X=new Map;return(...J)=>{let Q=Z(J);if(X.has(Q))return X.get(Q);let Y=$(...J);return X.set(Q,Y),Y}}function L1($,Z=100){let X=null;return(...J)=>{if(X)clearTimeout(X);X=setTimeout(()=>$(...J),Z)}}function H1($,Z=100){let X=!1;return(...J)=>{if(!X)$(...J),X=!0,setTimeout(()=>X=!1,Z)}}function M4($,Z={}){let X=new IntersectionObserver((J)=>{for(let Q of J)if(Q.isIntersecting)$(Q.target),X.unobserve(Q.target)},{rootMargin:"100px",threshold:0,...Z});return{observe:(J)=>X.observe(J),disconnect:()=>X.disconnect()}}class $4{#$=[];#Z=[];#X=!1;read($){this.#$.push($),this.#J()}write($){this.#Z.push($),this.#J()}#J(){if(!this.#X)this.#X=!0,requestAnimationFrame(()=>this.#Q())}#Q(){let $;while($=this.#$.shift())try{$()}catch(Z){console.error(Z)}while($=this.#Z.shift())try{$()}catch(Z){console.error(Z)}if(this.#X=!1,this.#$.length||this.#Z.length)this.#J()}}var C4=new $4;async function I4($,Z,X=100){for(let J=0;J<$.length;J+=X){let Q=$.slice(J,J+X);for(let Y of Q)Z(Y,J);await new Promise((Y)=>setTimeout(Y,0))}}class x1 extends z{static baseClass="mu-stack";static observedAttributes=["direction","gap","align","justify","wrap","nowrap"];render(){this.#$()}update($,Z,X){this.#$()}#$(){let $=this.attr("direction","column"),Z=this.attr("gap","md"),X=this.attr("align","stretch"),J=this.attr("justify","flex-start"),Q=this.has("wrap"),Y=this.has("nowrap"),K=$==="row"||$==="row-reverse"?!Y:Q,U={none:"0",xs:"var(--md-sys-spacing-xs, 4px)",sm:"var(--md-sys-spacing-sm, 8px)",md:"var(--md-sys-spacing-md, 16px)",lg:"var(--md-sys-spacing-lg, 24px)",xl:"var(--md-sys-spacing-xl, 32px)"};this.style.display="flex",this.style.flexDirection=$,this.style.gap=U[Z]||Z,this.style.alignItems=X,this.style.justifyContent=J,this.style.flexWrap=K?"wrap":"nowrap",this.style.boxSizing="border-box",this.style.maxWidth="100%",this.style.minWidth="0",this.style.flexShrink="1"}}_("mu-stack",x1);class P1 extends z{static baseClass="mu-grid";static cssFile="grid";static observedAttributes=["cols","rows","gap","align"];render(){this.#$()}update($,Z,X){this.#$()}#$(){let $=this.attr("cols","1"),Z=this.attr("rows",""),X=this.attr("gap","md"),J=this.attr("align","stretch"),Q={none:"0",xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"};if(this.style.display="grid",this.style.gridTemplateColumns=$.includes("fr")||$.includes("px")?$:`repeat(${$}, 1fr)`,Z)this.style.gridTemplateRows=Z.includes("fr")||Z.includes("px")?Z:`repeat(${Z}, 1fr)`;this.style.gap=Q[X]||X,this.style.alignItems=J}}_("mu-grid",P1);class B1 extends z{static baseClass="mu-container";static observedAttributes=["size","padding","center"];render(){this.#$()}update($,Z,X){this.#$()}#$(){let $=this.attr("size","lg"),Z=this.attr("padding","md"),X=this.has("center"),J={sm:"640px",md:"768px",lg:"1024px",xl:"1280px",full:"100%"},Q={none:"0",sm:"8px",md:"16px",lg:"24px",xl:"32px"};if(this.style.maxWidth=J[$]||$,this.style.padding=Q[Z]||Z,this.style.width="100%",X)this.style.marginLeft="auto",this.style.marginRight="auto"}}_("mu-container",B1);class O1 extends z{static baseClass="mu-navbar";static cssFile="navbar";static observedAttributes=["sticky","variant"];render(){if(this.style.display="flex",this.style.alignItems="center",this.style.justifyContent="space-between",this.style.padding="0 var(--md-sys-spacing-md, 16px)",this.style.height="64px",this.style.background="var(--md-sys-color-surface-container)",this.style.borderBottom="1px solid var(--md-sys-color-outline-variant)",this.has("sticky"))this.style.position="sticky",this.style.top="0",this.style.zIndex="100"}}class w1 extends z{static baseClass="mu-navbar__brand";render(){this.style.fontWeight="600",this.style.fontSize="1.25rem"}}class N1 extends z{static baseClass="mu-navbar__links";render(){}}class R1 extends z{static baseClass="mu-navbar__actions";render(){this.style.display="flex",this.style.gap="var(--md-sys-spacing-sm, 8px)",this.style.alignItems="center"}}_("mu-navbar",O1);_("mu-navbar-brand",w1);_("mu-navbar-links",N1);_("mu-navbar-actions",R1);class T1 extends z{static baseClass="mu-sidebar";static observedAttributes=["open","width"];render(){let $=this.attr("width","250px");this.style.width=this.has("open")?$:"64px",this.style.height="100vh",this.style.background="var(--md-sys-color-surface-container)",this.style.borderRight="1px solid var(--md-sys-color-outline-variant)",this.style.transition="width var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized)",this.style.overflow="hidden",this.style.display="flex",this.style.flexDirection="column"}update($,Z,X){this.render()}toggle(){if(this.has("open"))this.removeAttribute("open");else this.setAttribute("open","");this.emit("mu-sidebar-toggle",{open:this.has("open")})}}class S1 extends z{static baseClass="mu-sidebar__item";static observedAttributes=["icon","active"];connectedCallback(){super.connectedCallback(),this.listen(this,"click",()=>{this.emit("mu-sidebar-select",{item:this})})}render(){let $=this.attr("icon",""),Z=this.textContent;if(this.style.display="flex",this.style.alignItems="center",this.style.gap="var(--md-sys-spacing-md, 16px)",this.style.padding="12px 16px",this.style.cursor="pointer",this.style.borderRadius="var(--md-sys-shape-corner-medium, 8px)",this.style.margin="4px 8px",this.style.transition="background var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard)",this.has("active"))this.style.background="var(--md-sys-color-primary-container)",this.style.color="var(--md-sys-color-on-primary-container)"}update($,Z,X){this.render()}}_("mu-sidebar",T1);_("mu-sidebar-item",S1);class y1 extends z{static baseClass="mu-divider";static cssFile="divider";static observedAttributes=["vertical","inset"];render(){let $=this.has("vertical"),Z=this.has("inset");if(this.style.display="block",this.style.background="var(--md-sys-color-outline-variant)",this.style.flexShrink="0",$)this.style.width="1px",this.style.minHeight="24px",this.style.margin=Z?"0 8px":"0";else this.style.height="1px",this.style.width="100%",this.style.margin=Z?"0 16px":"0"}update($,Z,X){this.render()}}_("mu-divider",y1);class k1 extends z{static get observedAttributes(){return["has-drawer","has-bottom-nav"]}static baseClass="mu-layout";static cssFile="layout";constructor(){super()}connectedCallback(){if(!this._slotsCaptured)this._slots={header:this.querySelector('[slot="header"]'),drawer:this.querySelector('[slot="drawer"]'),footer:this.querySelector('[slot="footer"]'),bottom:this.querySelector('[slot="bottom"]'),default:Array.from(this.children).filter(($)=>!$.hasAttribute("slot"))},this._slotsCaptured=!0;super.connectedCallback(),this._setupScrollReset(),this._updateLayout()}disconnectedCallback(){super.disconnectedCallback()}_setupScrollReset(){this.listen(window,"hashchange",()=>{let $=this.querySelector(".mu-layout-main");if($)$.scrollTop=0})}_updateLayout(){let $=this._slots.drawer!==null,Z=this._slots.bottom!==null;this.toggleAttribute("has-drawer",$),this.toggleAttribute("has-bottom-nav",Z)}render(){this.innerHTML="";let $=document.createElement("div");$.className="mu-layout-wrapper";let Z=document.createElement("header");if(Z.className="mu-layout-header",this._slots.header)Z.appendChild(this._slots.header);$.appendChild(Z);let X=document.createElement("div");X.className="mu-layout-body";let J=document.createElement("aside");if(J.className="mu-layout-drawer",this._slots.drawer)J.appendChild(this._slots.drawer);X.appendChild(J);let Q=document.createElement("div");Q.className="mu-layout-main";let Y=document.createElement("main");if(Y.className="mu-layout-content",this._slots.default)this._slots.default.forEach((U)=>Y.appendChild(U));Q.appendChild(Y),X.appendChild(Q),$.appendChild(X);let G=document.createElement("footer");if(G.className="mu-layout-footer",this._slots.footer)G.appendChild(this._slots.footer);$.appendChild(G),this.appendChild($);let K=document.createElement("div");if(K.className="mu-layout-bottom",this._slots.bottom)K.appendChild(this._slots.bottom);this.appendChild(K)}}if(!customElements.get("mu-layout"))customElements.define("mu-layout",k1);class E1 extends z{static get observedAttributes(){return["mode","open","expand-on-hover","position"]}static baseClass="mu-drawer";static cssFile="drawer";constructor(){super();this._currentMode="expanded",this._isHovering=!1,this._unsubscribe=null}get mode(){return this.getAttribute("mode")||"auto"}set mode($){this.setAttribute("mode",$)}get open(){return this.hasAttribute("open")}set open($){this.toggleAttribute("open",Boolean($))}get expandOnHover(){return this.hasAttribute("expand-on-hover")}set expandOnHover($){this.toggleAttribute("expand-on-hover",Boolean($))}get position(){return this.getAttribute("position")||"start"}set position($){this.setAttribute("position",$)}connectedCallback(){if(!this._slotsCaptured)this._slots={header:this.querySelector('[slot="header"]'),footer:this.querySelector('[slot="footer"]'),default:Array.from(this.children).filter(($)=>!$.hasAttribute("slot"))},this._slotsCaptured=!0;super.connectedCallback(),this._setupBreakpointListener(),this._setupListeners(),this._forceUpdateMode()}_getInitialMode(){let $=this.mode,Z=C.isCompact,X=C.isMedium;if($==="permanent")return"expanded";else if($==="temporary")return"hidden";else if($==="rail")return Z?"hidden":"rail";else if(Z)return"hidden";else if(X)return"rail";else return"expanded"}_forceUpdateMode(){this._currentMode=this._getInitialMode(),this._applyMode()}disconnectedCallback(){if(super.disconnectedCallback(),this._unsubscribe)this._unsubscribe(),this._unsubscribe=null;this._unsubEsc?.(),this._unsubEsc=null}attributeChangedCallback($,Z,X){if(!this.isConnected)return;if($==="open")this._updateOpenState();else if($==="mode")this._updateMode()}_setupBreakpointListener(){this._unsubscribe=C.subscribe(()=>{this._updateMode()})}_updateMode(){let $=this.mode,Z=C.isCompact,X=C.isMedium,J;if($==="permanent")J="expanded";else if($==="temporary")J="hidden";else if($==="rail")J=Z?"hidden":"rail";else if(Z)J="hidden";else if(X)J="rail";else J="expanded";if(J!==this._currentMode)this._currentMode=J,this._applyMode()}_applyMode(){let $=this.querySelector(".mu-drawer-nav");if(!$)return;if($.classList.remove("mu-drawer-mode-expanded","mu-drawer-mode-rail","mu-drawer-mode-hidden"),$.classList.add(`mu-drawer-mode-${this._currentMode}`),this.querySelectorAll("mu-drawer-item").forEach((X)=>{if(this._currentMode==="rail"&&!this._isHovering)X.setAttribute("hide-label","");else X.removeAttribute("hide-label")}),this._currentMode==="hidden"&&!this.open)this._hideScrim()}_setupListeners(){let $=this.querySelector(".mu-drawer-scrim");if($)this.listen($,"click",()=>{this.open=!1});let Z=this.querySelector(".mu-drawer-nav");if(Z&&this.expandOnHover)this.listen(Z,"mouseenter",()=>{if(this._currentMode==="rail")this._isHovering=!0,Z.classList.add("mu-drawer-expanded-hover"),this._applyMode()}),this.listen(Z,"mouseleave",()=>{if(this._currentMode==="rail")this._isHovering=!1,Z.classList.remove("mu-drawer-expanded-hover"),this._applyMode()});this.listen(this,"mu-nav-select",(X)=>{if(this._currentMode==="hidden"&&this.open)this.open=!1;this._updateActiveItem(X.detail.item)}),this._unsubEsc=null}_updateActiveItem($){this.querySelectorAll("mu-drawer-item").forEach((X)=>{X.active=X===$})}_updateOpenState(){let $=this.querySelector(".mu-drawer-nav");if(this.open){if($?.classList.add("mu-drawer-open"),this._currentMode==="hidden")this._showScrim(),this._unsubEsc=_1.pushEscapeHandler(this,()=>{this.open=!1})}else $?.classList.remove("mu-drawer-open"),this._hideScrim(),this._unsubEsc?.(),this._unsubEsc=null}_showScrim(){let $=this.querySelector(".mu-drawer-scrim");if($)$.classList.add("mu-drawer-scrim-visible")}_hideScrim(){let $=this.querySelector(".mu-drawer-scrim");if($)$.classList.remove("mu-drawer-scrim-visible")}toggle(){this.open=!this.open}render(){this.innerHTML="";let $=document.createElement("div");$.className="mu-drawer-scrim",this.appendChild($);let Z=document.createElement("nav");Z.className=`mu-drawer-nav mu-drawer-mode-${this._getInitialMode()}`,Z.setAttribute("role","navigation");let X=document.createElement("div");if(X.className="mu-drawer-header",this._slots.header)X.appendChild(this._slots.header);Z.appendChild(X);let J=document.createElement("div");if(J.className="mu-drawer-content",J.setAttribute("role","menu"),this._slots.default)this._slots.default.forEach((Q)=>J.appendChild(Q));if(Z.appendChild(J),this._slots.footer)Z.appendChild(this._slots.footer);this.appendChild(Z)}}if(!customElements.get("mu-drawer"))customElements.define("mu-drawer",E1);var C0={check:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",close:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",add:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z",remove:"M19 13H5v-2h14z",edit:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75z",delete:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z",search:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",menu:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z",chevron_right:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",chevron_left:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z",expand_more:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z",expand_less:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",home:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z",arrow_back:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z",arrow_forward:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2zm0-8h-2V7h2z",warning:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z",error:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2zm0-4h-2V7h2z",check_circle:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z",cancel:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z",success:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z",settings:"M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z",person:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",light_mode:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z",dark_mode:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z",visibility:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3",visibility_off:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z",download:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z",smart_button:"M22 9v6c0 1.1-.9 2-2 2h-1v-2h1V9H4v6h6v2H4c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2zm-7.5 11 1.09-2.41L18 16.5l-2.41-1.09L14.5 13l-1.09 2.41L11 16.5l2.41 1.09L14.5 20zm2.5-5 .62-1.38L19 14l-1.38-.62L17 12l-.62 1.38L15 14l1.38.62L17 16zm-2.5 5 1.09-2.41L18 16.5l-2.41-1.09L14.5 13l-1.09 2.41L11 16.5l2.41 1.09L14.5 20z",text_fields:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z",check_box:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",toggle_on:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5zm0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z",radio_button_checked:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",arrow_drop_down_circle:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 12-4-4h8l-4 4z",view_carousel:"M7 19h10V4H7v15zm-5-2h4V6H2v11zM18 6v11h4V6h-4z",grid_view:"M3 3v8h8V3H3zm6 6H5V5h4v4zm-6 4v8h8v-8H3zm6 6H5v-4h4v4zm4-16v8h8V3h-8zm6 6h-4V5h4v4zm-6 4v8h8v-8h-8zm6 6h-4v-4h4v4z",tab:"M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h10v4h8v10z",notifications:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z",open_in_new:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z",hourglass_empty:"M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6zm10 14.5V20H8v-3.5l4-4 4 4zm-4-5-4-4V4h8v3.5l-4 4z",account_circle:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 4c1.93 0 3.5 1.57 3.5 3.5S13.93 13 12 13s-3.5-1.57-3.5-3.5S10.07 6 12 6zm0 14c-2.03 0-4.43-.82-6.14-2.88C7.55 15.8 9.68 15 12 15s4.45.8 6.14 2.12C16.43 19.18 14.03 20 12 20z",fiber_manual_record:"M12 12m-8 0a8 8 0 1 0 16 0 8 8 0 1 0-16 0",label:"M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z",emoji_emotions:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z",business:"M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z",input:"M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zM11 16l4-4-4-4v3H1v2h10v3z",category:"M12 2l-5.5 9h11L12 2zm0 3.84L13.93 9h-3.87L12 5.84zM17.5 13c-2.49 0-4.5 2.01-4.5 4.5s2.01 4.5 4.5 4.5 4.5-2.01 4.5-4.5-2.01-4.5-4.5-4.5zm0 7c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zM3 21.5h8v-8H3v8zm2-6h4v4H5v-4z",widgets:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z",smart_toy:"M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3zM7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5zM16 17H8v-2h8v2zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13z",notification_important:"M18 16v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2zm-6 6c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm1-15.06c1.77.52 3 2.14 3 4.06v5.5l1 1v.5H7v-.5l1-1V11c0-1.92 1.23-3.54 3-4.06V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v.94zM13 11h-2v6h2v-6zm0-4h-2v2h2V7z",folder_managed:"M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-2.06 11L15 15.28 12.06 17l.78-3.33-2.59-2.24 3.41-.29L15 8l1.34 3.14 3.41.29-2.59 2.24.78 3.33z",shield:"M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z",apps:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z",monitoring:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 12h2v5H7v-5zm4-3h2v8h-2V9zm4-3h2v11h-2V6z"},t={check:"check",close:"close",add:"add",remove:"remove",edit:"edit",delete:"delete",search:"search",menu:"menu",chevron_right:"chevron_right",chevron_left:"chevron_left",expand_more:"expand_more",expand_less:"expand_less",home:"home",arrow_back:"arrow_back",arrow_forward:"arrow_forward",info:"info",warning:"warning",error:"error",success:"check_circle",check_circle:"check_circle",cancel:"cancel",settings:"settings",person:"person",light_mode:"light_mode",dark_mode:"dark_mode",sun:"light_mode",moon:"dark_mode",user:"person",visibility:"visibility",visibility_off:"visibility_off",download:"download",smart_button:"smart_button",text_fields:"text_fields",check_box:"check_box",toggle_on:"toggle_on",radio_button_checked:"radio_button_checked",arrow_drop_down_circle:"arrow_drop_down_circle",view_carousel:"view_carousel",grid_view:"grid_view",tab:"tab",notifications:"notifications",open_in_new:"open_in_new",hourglass_empty:"hourglass_empty",account_circle:"account_circle",fiber_manual_record:"fiber_manual_record",label:"label",emoji_emotions:"emoji_emotions",business:"business",input:"input",category:"category",widgets:"widgets",smart_toy:"smart_toy",notification_important:"notification_important",folder_managed:"folder_managed",shield:"shield",apps:"apps",monitoring:"monitoring",plus:"add",minus:"remove"};class M1 extends z{static baseClass="mu-icon";static cssFile="icon";static observedAttributes=["name","size","svg","filled","font"];render(){let $=this.attr("name","info"),Z=this.attr("size","24"),X=this.has("font"),J=this.has("filled");this.setAttribute("role","img"),this.setAttribute("aria-hidden","true");let Q=t[$]?$:$,Y=C0[$]||C0[t[$]];if(!X&&Y){this.innerHTML=`
|
|
67
|
+
<svg width="${Z}" height="${Z}" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
68
|
+
<path d="${Y}"></path>
|
|
69
|
+
</svg>
|
|
70
|
+
`;return}let G=t[$]||$;if(!t[$]&&!C0[$])this.logError("UNKNOWN_ICON",`Icon name "${$}" not found in predefined icons. Using font fallback.`);this.innerHTML=`<span class="material-symbols-outlined" aria-hidden="true">${G}</span>`;let K=this.querySelector("span");if(K){if(K.style.fontSize=`${Z}px`,J)K.style.fontVariationSettings="'FILL' 1"}}update($,Z,X){this.render()}}var v4=Object.keys(t),y2=Object.keys(C0);_("mu-icon",M1);class a extends z{static get observedAttributes(){return["icon","href","active","badge","disabled","layout","label"]}static baseClass="mu-drawer-item";static cssFile="drawer-item";constructor(){super();this._capturedLabel="";let $=Array.from(this.childNodes).filter((Z)=>Z.nodeType===Node.TEXT_NODE).map((Z)=>Z.textContent.trim()).join("").trim();if($)this._capturedLabel=$}get icon(){return this.getAttribute("icon")||""}set icon($){this.setAttribute("icon",$)}get href(){return this.getAttribute("href")||""}set href($){this.setAttribute("href",$)}get active(){return this.hasAttribute("active")}set active($){this.toggleAttribute("active",Boolean($))}get badge(){return this.getAttribute("badge")}set badge($){$?this.setAttribute("badge",$):this.removeAttribute("badge")}get disabled(){return this.hasAttribute("disabled")}set disabled($){this.toggleAttribute("disabled",Boolean($))}get layout(){return this.getAttribute("layout")||"horizontal"}set layout($){this.setAttribute("layout",$)}get label(){return this.getAttribute("label")||this._capturedLabel||""}set label($){this.setAttribute("label",$)}connectedCallback(){if(!this._capturedLabel&&this.hasAttribute("label"))this._capturedLabel=this.getAttribute("label");if(!this._capturedLabel&&!this.hasAttribute("label")){if(this._capturedLabel=this.textContent.trim(),this._capturedLabel)this.setAttribute("label",this._capturedLabel)}super.connectedCallback(),this._setupListeners(),this.setAttribute("tabindex","0"),this.setAttribute("role","menuitem"),this.setupActivation(()=>this._handleClick(new MouseEvent("click")))}attributeChangedCallback($,Z,X){if(Z!==X&&this.isConnected)this.render()}_setupListeners(){this.listen(this,"click",this._handleClick.bind(this))}_handleClick($){if(this.disabled){$.preventDefault();return}if(this.href){if(this.href.startsWith("#"))$.preventDefault(),window.location.hash=this.href}this.emit("mu-nav-select",{href:this.href,item:this},{bubbles:!0,composed:!0})}render(){let $=V(this.label),Z=$.length>0,X=this.badge?`<span class="mu-drawer-item-badge">${V(this.badge)}</span>`:"",J=this.href?"a":"button",Q=this.href?`href="${V(this.href)}"`:"",Y=this.disabled?this.href?'aria-disabled="true"':"disabled":"",G=$?`aria-label="${$}"`:"";this.innerHTML=`
|
|
71
|
+
<${J} class="mu-drawer-item-link" ${Q} ${Y} ${G}>
|
|
72
|
+
<span class="mu-drawer-item-icon">
|
|
73
|
+
<mu-icon name="${V(this.icon)}" size="24"></mu-icon>
|
|
74
|
+
</span>
|
|
75
|
+
${Z?`<span class="mu-drawer-item-label" aria-hidden="true">${$}</span>`:""}
|
|
76
|
+
${X}
|
|
77
|
+
</${J}>
|
|
78
|
+
`}}if(!customElements.get("mu-drawer-item"))customElements.define("mu-drawer-item",a);if(!customElements.get("mu-nav-item"))customElements.define("mu-nav-item",class extends a{connectedCallback(){if(!this.hasAttribute("layout"))this.setAttribute("layout","vertical");super.connectedCallback()}});class C1 extends z{static get observedAttributes(){return["hide-on-desktop","value"]}static baseClass="mu-bottom-nav";static cssFile="bottom-nav";constructor(){super();this._unsubscribe=null}get hideOnDesktop(){return this.hasAttribute("hide-on-desktop")}set hideOnDesktop($){this.toggleAttribute("hide-on-desktop",Boolean($))}get value(){return this.getAttribute("value")||""}set value($){this.setAttribute("value",$)}connectedCallback(){if(!this._childrenCaptured)this._userChildren=Array.from(this.children),this._childrenCaptured=!0;super.connectedCallback(),this._setupBreakpointListener(),this._setupListeners(),this._updateVisibility()}disconnectedCallback(){if(super.disconnectedCallback(),this._unsubscribe)this._unsubscribe(),this._unsubscribe=null}attributeChangedCallback($,Z,X){if(!this.isConnected)return;if($==="hide-on-desktop")this._updateVisibility()}_setupBreakpointListener(){if(this.hideOnDesktop)this._unsubscribe=C.subscribe(()=>{this._updateVisibility()})}_updateVisibility(){if(this.hideOnDesktop&&C.isNotCompact)this.style.display="none";else this.style.display=""}_setupListeners(){this.listen(this,"mu-nav-select",($)=>{this._updateActiveItem($.detail.item),this.value=$.detail.href||"",this.emit("change",{value:this.value,item:$.detail.item},{bubbles:!0})})}_updateActiveItem($){this.querySelectorAll("mu-nav-item, mu-drawer-item").forEach((X)=>{X.active=X===$})}render(){let $=document.createElement("nav");if($.className="mu-bottom-nav-nav",$.setAttribute("role","menu"),$.setAttribute("aria-label","Bottom navigation"),this.innerHTML="",this.appendChild($),this._userChildren)this._userChildren.forEach((Z)=>$.appendChild(Z))}}if(!customElements.get("mu-bottom-nav"))customElements.define("mu-bottom-nav",C1);class I1 extends z{static baseClass="mu-button";static cssFile="button";static observedAttributes=["variant","size","disabled"];connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setupActivation(()=>this.click()),this.listen(this,"pointerdown",($)=>{if(!this.isDisabled)k(this,$)})}render(){let $=this.textContent.trim();this.innerHTML=`<span class="mu-button__label">${$}</span>`,this.#$()}update($,Z,X){if($==="disabled")this.updateTabindex();this.#$()}#$(){let $=this.attr("variant","primary"),Z=this.attr("size","md"),X=["filled","elevated","tonal","outlined","text","danger","primary","secondary","ghost"];if(!X.includes($))this.logError("INVALID_VARIANT",`Invalid button variant '${$}'. Valid: ${X.join(", ")}`);if(this.className=`mu-button mu-button--${$} mu-button--${Z}`,this.has("disabled"))this.classList.add("is-disabled")}}_("mu-button",I1);class v1 extends z{static baseClass="mu-input";static cssFile="input";static observedAttributes=["type","placeholder","value","disabled","variant","size","label"];#$=null;render(){if(this.querySelector(".mu-input__field")){this.#$=this.querySelector("input"),this.#X();return}let $=this.attr("type","text"),Z=this.attr("placeholder",""),X=this.attr("label",""),J=this.attr("value",""),Q=X||Z,Y=!Q;if(!Q&&!this.getAttribute("aria-label"))this.logError("A11Y_MISSING_LABEL","Input must have a label or aria-label attribute.");let G=this.id||`mu-input-${Math.random().toString(36).substring(2,9)}`,K=V(Q),U=V(Z),W=V(J);this.innerHTML=`
|
|
79
|
+
${K?`<label class="mu-input__label" for="${G}">${K}</label>`:""}
|
|
80
|
+
<input
|
|
81
|
+
class="mu-input__field"
|
|
82
|
+
id="${G}"
|
|
83
|
+
type="${$}"
|
|
84
|
+
${Y?`placeholder="${U}"`:""}
|
|
85
|
+
${!K?`aria-label="${U||"Text input"}"`:""}
|
|
86
|
+
value="${W}"
|
|
87
|
+
${this.has("disabled")?"disabled":""}
|
|
88
|
+
/>
|
|
89
|
+
`,this.#$=this.querySelector("input"),this.#X(),this.#Z(),this.listen(this.#$,"input",(D)=>{this.#Z(),this.emit("mu-input",{value:D.target.value})}),this.listen(this.#$,"focus",()=>{this.emit("mu-focus")}),this.listen(this.#$,"blur",()=>{this.emit("mu-blur")})}#Z(){if(this.#$?.value)this.classList.add("has-value");else this.classList.remove("has-value")}update($,Z,X){if(!this.#$)return;switch($){case"value":this.#$.value=Z??"";break;case"placeholder":this.#$.placeholder=Z??"";break;case"type":this.#$.type=Z??"text";break;case"disabled":this.#$.disabled=this.has("disabled");break}this.#X()}#X(){let $=this.attr("variant","outlined"),Z=this.attr("size","md");if(this.className=`mu-input mu-input--${$} mu-input--${Z}`,this.has("disabled"))this.classList.add("is-disabled")}get value(){return this.#$?.value??""}set value($){if(this.#$)this.#$.value=$}focus(){this.#$?.focus()}}_("mu-input",v1);class b1 extends z{static baseClass="mu-textarea";static cssFile="input";static observedAttributes=["placeholder","rows","disabled","readonly","name"];#$=null;render(){if(!this.querySelector(".mu-textarea__field")){let $=V(this.attr("placeholder","")),Z=this.attr("rows","4"),X=this.has("disabled")?"disabled":"",J=this.has("readonly")?"readonly":"",Q=V(this.attr("name",""));this.innerHTML=`
|
|
90
|
+
<textarea
|
|
91
|
+
class="mu-textarea__field"
|
|
92
|
+
placeholder="${$}"
|
|
93
|
+
aria-label="${$||"Text area"}"
|
|
94
|
+
rows="${Z}"
|
|
95
|
+
name="${Q}"
|
|
96
|
+
${X}
|
|
97
|
+
${J}
|
|
98
|
+
></textarea>
|
|
99
|
+
`,this.style.display="block",this.style.position="relative"}this.#$=this.querySelector("textarea"),this.#$.style.width="100%",this.#$.style.padding="12px 16px",this.#$.style.fontSize="var(--md-sys-typescale-body-large-size, 16px)",this.#$.style.fontFamily="inherit",this.#$.style.border="1px solid var(--md-sys-color-outline)",this.#$.style.borderRadius="var(--md-sys-shape-corner-small, 4px)",this.#$.style.background="var(--md-sys-color-surface)",this.#$.style.color="var(--md-sys-color-on-surface)",this.#$.style.resize="vertical",this.#$.style.transition="border-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard)",this.#$.style.outline="none",this.#$.style.boxSizing="border-box",this.listen(this.#$,"focus",()=>{this.#$.style.borderColor="var(--md-sys-color-primary)",this.#$.style.boxShadow="inset 0 0 0 1px var(--md-sys-color-primary)"}),this.listen(this.#$,"blur",()=>{this.#$.style.borderColor="var(--md-sys-color-outline)",this.#$.style.boxShadow="none"}),this.listen(this.#$,"input",($)=>{this.emit("mu-input",{value:$.target.value})}),this.listen(this.#$,"change",($)=>{this.emit("mu-change",{value:$.target.value})})}get value(){return this.#$?.value||""}set value($){if(this.#$)this.#$.value=$}focus(){this.#$?.focus()}}_("mu-textarea",b1);class f1 extends z{static baseClass="mu-form";static observedAttributes=["action","method"];connectedCallback(){super.connectedCallback(),this.listen(this,"submit",($)=>{$.preventDefault(),this.#$()}),this.listen(this,"keydown",($)=>{if($.key==="Enter"&&$.target.matches("input"))$.preventDefault(),this.#$()})}render(){if(this.setAttribute("role","form"),this.hasAttribute("debug"))requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(!this.querySelector("mu-input, mu-button, mu-select, mu-textarea, input, button, select, textarea"))this.logError("EMPTY_FORM","Form appears to be empty. Add input controls.")})})}#$(){let $=this.getFormData(),Z=this.validate();if(Z)this.emit("mu-submit",{data:$,isValid:Z});else this.emit("mu-invalid",{data:$,errors:this.#Z()})}getFormData(){let $={};return this.querySelectorAll("mu-input[name]").forEach((Z)=>{$[Z.getAttribute("name")]=Z.value}),this.querySelectorAll("input[name], select[name], textarea[name]").forEach((Z)=>{if(Z.type==="checkbox")$[Z.name]=Z.checked;else $[Z.name]=Z.value}),$}validate(){let $=!0;return this.querySelectorAll("[required]").forEach((Z)=>{if(!(Z.value||Z.getAttribute("value")||"").trim())Z.classList.add("is-invalid"),$=!1;else Z.classList.remove("is-invalid")}),$}#Z(){let $=[];return this.querySelectorAll(".is-invalid").forEach((Z)=>{$.push({name:Z.getAttribute("name"),message:"This field is required"})}),$}reset(){this.querySelectorAll("mu-input").forEach(($)=>{$.value=""}),this.querySelectorAll("input, select, textarea").forEach(($)=>{$.value=""}),this.querySelectorAll(".is-invalid").forEach(($)=>{$.classList.remove("is-invalid")}),this.emit("mu-reset")}}_("mu-form",f1);class h1 extends z{static baseClass="mu-dropdown";static cssFile="input";static observedAttributes=["placeholder","value","disabled"];#$=null;#Z=null;#X=[];connectedCallback(){super.connectedCallback(),this.listen(window,"scroll",()=>this.#Y(),{capture:!0,passive:!0}),this.listen(window,"resize",()=>this.#Y(),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),this.#$?.remove()}render(){if(this.querySelector(".mu-dropdown__trigger")&&this.#$)return;requestAnimationFrame(()=>this.#J())}#J(){if(this.querySelector(".mu-dropdown__trigger")&&this.#$)return;let $=this.getAttribute("placeholder")||"Select",Z=this.querySelectorAll("mu-option");this.#X=Array.from(Z).map((Q)=>({value:Q.getAttribute("value")||Q.textContent.trim(),label:Q.textContent.trim()})),this.#Z=document.createElement("button"),this.#Z.className="mu-dropdown__trigger",this.#Z.type="button";let X=V($),J=`mu-dropdown-menu-${Math.random().toString(36).slice(2,9)}`;this.#Z.setAttribute("aria-haspopup","listbox"),this.#Z.setAttribute("aria-expanded","false"),this.#Z.setAttribute("aria-label",X),this.#Z.setAttribute("popovertarget",J),this.#Z.innerHTML=`
|
|
100
|
+
<span class="mu-dropdown__value">${X}</span>
|
|
101
|
+
<svg class="mu-dropdown__arrow" width="10" height="6" viewBox="0 0 10 6" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
102
|
+
<path d="M1 1l4 4 4-4"/>
|
|
103
|
+
</svg>
|
|
104
|
+
`,this.listen(this.#Z,"keydown",(Q)=>{if(!this.hasAttribute("disabled")){if(Q.key==="ArrowDown"||Q.key==="Enter"||Q.key===" ")Q.preventDefault(),this.open()}}),this.innerHTML="",this.appendChild(this.#Z),this.#$=document.createElement("div"),this.#$.id=J,this.#$.className="mu-dropdown__menu",this.#$.setAttribute("popover","auto"),this.#$.setAttribute("role","listbox"),this.#$.tabIndex=-1,this.listen(this.#$,"toggle",(Q)=>{if(Q.newState==="open")this.classList.add("is-open"),this.#Z?.setAttribute("aria-expanded","true"),this.#Y(),requestAnimationFrame(()=>{let Y=this.getAttribute("value");(Y?this.#$.querySelector(`[data-value="${Y}"]`):this.#$.firstChild)?.focus()});else this.classList.remove("is-open"),this.#Z?.setAttribute("aria-expanded","false")}),this.listen(this.#$,"keydown",(Q)=>this.#Q(Q)),this.#X.forEach((Q)=>{let Y=document.createElement("div");Y.className="mu-dropdown__option",Y.setAttribute("data-value",Q.value),Y.textContent=Q.label,Y.setAttribute("role","option"),Y.tabIndex=-1,this.listen(Y,"click",()=>this.select(Q.value,Q.label)),this.#$.appendChild(Y)}),this.appendChild(this.#$)}#Q($){let Z=Array.from(this.#$.querySelectorAll(".mu-dropdown__option")),X=document.activeElement,J=Z.indexOf(X);if($.key==="ArrowDown")$.preventDefault(),(Z[J+1]||Z[0])?.focus();else if($.key==="ArrowUp")$.preventDefault(),(Z[J-1]||Z[Z.length-1])?.focus();else if($.key==="Enter"||$.key===" "){if($.preventDefault(),J>=0){let Q=this.#X[J];this.select(Q.value,Q.label)}}else if($.key==="Escape")$.preventDefault(),this.close(),this.#Z?.focus()}#Y(){if(!this.#$||!this.#Z)return;let $=this.#Z.getBoundingClientRect(),Z=this.#$.scrollHeight||200,Q=window.innerHeight-$.bottom-8<Z&&$.top>Z?$.top-Z-4:$.bottom+4;Object.assign(this.#$.style,{position:"fixed",margin:"0",top:`${Q}px`,left:`${$.left}px`,width:`${$.width}px`,minWidth:"160px",maxHeight:"280px"})}toggle(){if(this.#$?.matches(":popover-open"))this.close();else this.open()}open(){if(this.hasAttribute("disabled")||!this.#$)return;this.#$.showPopover()}close(){if(this.#$?.matches(":popover-open"))this.#$.hidePopover()}select($,Z){let X=this.querySelector(".mu-dropdown__value");if(X)X.textContent=Z;this.setAttribute("value",$),this.#$?.querySelectorAll(".mu-dropdown__option").forEach((J)=>J.classList.toggle("is-active",J.getAttribute("data-value")===$)),this.emit("mu-select",{value:$,label:Z}),this.close()}get value(){return this.getAttribute("value")||""}set value($){this.setAttribute("value",$)}}class g1 extends z{static baseClass="mu-dropdown__option";connectedCallback(){super.connectedCallback(),this.setAttribute("role","option")}render(){}}_("mu-dropdown",h1);_("mu-option",g1);class m1 extends z{static baseClass="mu-checkbox";static cssFile="checkbox";static observedAttributes=["checked","disabled","name","label","indeterminate"];#$=null;connectedCallback(){super.connectedCallback(),this.setAttribute("role","checkbox"),this.setupActivation(()=>this.toggle()),this.listen(this,"pointerdown",($)=>{if(!this.isDisabled)k(this,$)}),this.listen(this,"click",()=>{if(!this.isDisabled)this.toggle()})}render(){if(this.querySelector(".mu-checkbox__box")){this.#Z();return}let $=V(this.attr("label","")||this.textContent);this.innerHTML=`
|
|
105
|
+
<span class="mu-checkbox__box">
|
|
106
|
+
<svg class="mu-checkbox__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
107
|
+
<path class="mu-checkbox__check" d="M4 12l6 6L20 6"/>
|
|
108
|
+
<line class="mu-checkbox__indeterminate" x1="5" y1="12" x2="19" y2="12"/>
|
|
109
|
+
</svg>
|
|
110
|
+
</span>
|
|
111
|
+
<span class="mu-checkbox__label">${$}</span>
|
|
112
|
+
`,this.style.display="inline-flex",this.style.alignItems="center",this.style.gap="12px",this.style.cursor=this.has("disabled")?"not-allowed":"pointer",this.style.userSelect="none",this.style.minHeight="48px",this.style.padding="0 4px",this.#Z()}update($,Z,X){this.#Z()}#Z(){let $=this.querySelector(".mu-checkbox__box"),Z=this.querySelector(".mu-checkbox__icon"),X=this.querySelector(".mu-checkbox__check"),J=this.querySelector(".mu-checkbox__indeterminate"),Q=this.querySelector(".mu-checkbox__label"),Y=this.has("disabled"),G=this.has("checked"),K=this.has("indeterminate"),U=G||K;if(this.style.cursor=Y?"not-allowed":"pointer",$)if($.style.width="18px",$.style.height="18px",$.style.borderRadius="2px",$.style.display="flex",$.style.alignItems="center",$.style.justifyContent="center",$.style.transition="all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard)",$.style.flexShrink="0",Y)$.style.border="2px solid color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)",$.style.background=U?"color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)":"transparent";else $.style.border=`2px solid ${U?"var(--md-sys-color-primary)":"var(--md-sys-color-outline)"}`,$.style.background=U?"var(--md-sys-color-primary)":"transparent";if(Z)Z.style.width="14px",Z.style.height="14px",Z.style.color=Y?"var(--md-sys-color-surface)":"var(--md-sys-color-on-primary)";if(X)X.style.strokeDasharray=24,X.style.strokeDashoffset=G&&!K?"0":24,X.style.transition="stroke-dashoffset 200ms var(--md-sys-motion-easing-standard, ease-out)";if(J)J.style.strokeDasharray=14,J.style.strokeDashoffset=K?"0":14,J.style.transition="stroke-dashoffset 200ms var(--md-sys-motion-easing-standard, ease-out)";if(Q)Q.style.color=Y?"color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)":"var(--md-sys-color-on-surface)";this.setAttribute("aria-checked",K?"mixed":String(G)),this.setAttribute("aria-disabled",String(Y)),this.setAttribute("tabindex",Y?"-1":"0")}toggle(){if(this.has("indeterminate"))this.removeAttribute("indeterminate");if(this.has("checked"))this.removeAttribute("checked");else this.setAttribute("checked","");this.emit("mu-change",{checked:this.has("checked"),indeterminate:!1})}get checked(){return this.has("checked")}set checked($){if($)this.setAttribute("checked","");else this.removeAttribute("checked")}get indeterminate(){return this.has("indeterminate")}set indeterminate($){if($)this.setAttribute("indeterminate","");else this.removeAttribute("indeterminate")}}_("mu-checkbox",m1);class p1 extends z{static baseClass="mu-switch";static cssFile="switch";static observedAttributes=["checked","disabled","label"];connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setupActivation(()=>this.toggle()),this.listen(this,"pointerdown",($)=>{if(!this.isDisabled)k(this,$)}),this.listen(this,"click",()=>{if(!this.isDisabled)this.toggle()})}render(){if(this.querySelector(".mu-switch__track")){this.#$();return}let $=V(this.attr("label","")||this.textContent);this.innerHTML=`
|
|
113
|
+
<span class="mu-switch__track">
|
|
114
|
+
<span class="mu-switch__thumb"></span>
|
|
115
|
+
</span>
|
|
116
|
+
${$?`<span class="mu-switch__label">${$}</span>`:""}
|
|
117
|
+
`,this.style.display="inline-flex",this.style.alignItems="center",this.style.gap="12px",this.style.cursor=this.has("disabled")?"not-allowed":"pointer",this.#$()}update($,Z,X){this.#$()}#$(){let $=this.querySelector(".mu-switch__track"),Z=this.querySelector(".mu-switch__thumb"),X=this.has("checked"),J=this.has("disabled");if(this.style.cursor=J?"not-allowed":"pointer",$)if($.style.width="52px",$.style.height="32px",$.style.borderRadius="16px",$.style.position="relative",$.style.transition="background var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard)",J)$.style.background="color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent)";else $.style.background=X?"var(--md-sys-color-primary)":"var(--md-sys-color-surface-container-highest)";if(Z){let G=X?24:16,K=X?4:8,U=X?24:6;if(Z.style.width=`${G}px`,Z.style.height=`${G}px`,Z.style.borderRadius=`${G/2}px`,Z.style.position="absolute",Z.style.top=`${K}px`,Z.style.left=`${U}px`,Z.style.transition="all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-emphasized)",J)Z.style.background="color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)",Z.style.boxShadow="none";else Z.style.background=X?"var(--md-sys-color-on-primary)":"var(--md-sys-color-outline)",Z.style.boxShadow="var(--md-sys-elevation-level1)"}let Q=this.querySelector(".mu-switch__label");if(Q)Q.style.color=J?"color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)":"var(--md-sys-color-on-surface)";this.setAttribute("aria-checked",String(X)),this.setAttribute("aria-disabled",String(J)),this.setAttribute("tabindex",J?"-1":"0");let Y=Q?.textContent||this.attr("label","");if(Y)this.setAttribute("aria-label",Y)}toggle(){if(this.has("checked"))this.removeAttribute("checked");else this.setAttribute("checked","");this.emit("mu-change",{checked:this.has("checked")})}get checked(){return this.has("checked")}set checked($){if($)this.setAttribute("checked","");else this.removeAttribute("checked")}}_("mu-switch",p1);class u1 extends z{static baseClass="mu-radio-group";static cssFile="radio";static observedAttributes=["name","value"];connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.listen(this,"pointerdown",($)=>{let Z=$.target;while(Z&&Z.tagName!=="MU-RADIO")Z=Z.parentElement;if(Z&&!Z.hasAttribute("disabled"))k(Z,$)}),this.listen(this,"click",($)=>{let Z=$.target;while(Z&&Z.tagName!=="MU-RADIO")Z=Z.parentElement;if(Z&&!Z.hasAttribute("disabled"))this.select(Z.getAttribute("value"))})}render(){this.style.display="flex",this.style.flexDirection="column",this.style.gap="8px",this.setTimeout(()=>this.#$(),0)}update($,Z,X){if($==="value")this.#$()}#$(){let $=this.attr("value","");this.querySelectorAll("mu-radio").forEach((Z)=>{if(Z.attr("value")===$)Z.setAttribute("checked","");else Z.removeAttribute("checked")})}select($){this.setAttribute("value",$),this.emit("mu-change",{value:$})}get value(){return this.attr("value","")}set value($){this.setAttribute("value",$)}}class c1 extends z{static baseClass="mu-radio";static observedAttributes=["value","checked","disabled","label"];#$="";#Z=!1;connectedCallback(){super.connectedCallback(),this.setAttribute("role","radio"),this.setupActivation(()=>{let $=this.closest("mu-radio-group");if($)$.select(this.getAttribute("value"))})}render(){if(!this.#Z)this.#$=V(this.attr("label","")||this.textContent.trim()),this.#Z=!0;this.innerHTML=`
|
|
118
|
+
<span class="mu-radio__circle">
|
|
119
|
+
<span class="mu-radio__dot"></span>
|
|
120
|
+
</span>
|
|
121
|
+
<span class="mu-radio__label">${this.#$}</span>
|
|
122
|
+
`,this.style.display="inline-flex",this.style.alignItems="center",this.style.gap="12px",this.style.cursor=this.has("disabled")?"not-allowed":"pointer",this.style.userSelect="none",this.style.minHeight="48px",this.style.padding="0 4px",this.#X()}update($,Z,X){if($==="checked"||$==="disabled")this.#X();else if($==="label"){this.#$=Z;let J=this.querySelector(".mu-radio__label");if(J)J.textContent=Z}}#X(){let $=this.querySelector(".mu-radio__circle"),Z=this.querySelector(".mu-radio__dot"),X=this.querySelector(".mu-radio__label"),J=this.has("checked"),Q=this.has("disabled");if(this.style.cursor=Q?"not-allowed":"pointer",$)if($.style.width="20px",$.style.height="20px",$.style.borderRadius="50%",$.style.display="flex",$.style.alignItems="center",$.style.justifyContent="center",$.style.transition="border-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard)",Q)$.style.border="2px solid color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)";else $.style.border=`2px solid ${J?"var(--md-sys-color-primary)":"var(--md-sys-color-outline)"}`;if(Z)if(Z.style.width="10px",Z.style.height="10px",Z.style.borderRadius="50%",Z.style.transform=J?"scale(0.5)":"scale(0)",Z.style.transition="transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard)",Q)Z.style.background="color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)";else Z.style.background="var(--md-sys-color-primary)";if(X)X.style.color=Q?"color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent)":"var(--md-sys-color-on-surface)";this.setAttribute("aria-checked",String(J)),this.setAttribute("aria-disabled",String(Q)),this.setAttribute("tabindex",Q?"-1":"0")}}_("mu-radio-group",u1);_("mu-radio",c1);class d1 extends z{static baseClass="mu-chip";static cssFile="chip";static observedAttributes=["selected","removable","variant"];#$=null;connectedCallback(){if(super.connectedCallback(),!this.#$&&!this.querySelector(".mu-chip__label"))this.#$=this.textContent.trim();this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setupActivation(()=>{if(!this.has("removable"))this.toggle()}),this.listen(this,"pointerdown",($)=>{if(!$.target.closest(".mu-chip__remove"))k(this,$)}),this.listen(this,"click",($)=>{if($.target.closest(".mu-chip__remove"))this.emit("mu-remove"),this.remove();else if(!this.has("removable"))this.toggle()})}render(){if(this.querySelector(".mu-chip__label")){this.#Z();return}let $=this.#$||this.textContent.trim(),Z=this.has("removable");this.innerHTML=`
|
|
123
|
+
<span class="mu-chip__label">${$}</span>
|
|
124
|
+
${Z?'<button class="mu-chip__remove" aria-label="Remove">✕</button>':""}
|
|
125
|
+
`,this.#Z()}update($,Z,X){this.#Z()}#Z(){let $=this.has("selected"),Z=this.attr("variant","outlined");if(this.style.display="inline-flex",this.style.alignItems="center",this.style.gap="4px",this.style.padding="8px 16px",this.style.borderRadius="8px",this.style.fontSize="var(--md-sys-typescale-label-large-size, 14px)",this.style.cursor="pointer",this.style.userSelect="none",this.style.transition="all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard)",Z==="filled"||$)this.style.background=$?"var(--md-sys-color-secondary-container)":"var(--md-sys-color-surface-container-high)",this.style.color=$?"var(--md-sys-color-on-secondary-container)":"var(--md-sys-color-on-surface)",this.style.border="1px solid transparent";else this.style.background="transparent",this.style.color="var(--md-sys-color-on-surface)",this.style.border="1px solid var(--md-sys-color-outline)";let X=this.querySelector(".mu-chip__remove");if(X)X.style.background="none",X.style.border="none",X.style.padding="0",X.style.marginLeft="4px",X.style.cursor="pointer",X.style.color="inherit",X.style.opacity="0.7"}toggle(){if(this.has("selected"))this.removeAttribute("selected");else this.setAttribute("selected","");this.emit("mu-change",{selected:this.has("selected")})}}_("mu-chip",d1);class l1 extends z{static baseClass="mu-card";static cssFile="card";static observedAttributes=["variant","padding"];connectedCallback(){super.connectedCallback(),this.#$()}render(){this.#$()}update($,Z,X){this.#$()}#$(){let $=this.attr("variant","flat"),Z=this.attr("padding","md");this.className=`mu-card mu-card--${$} mu-card--padding-${Z}`}}_("mu-card",l1);class i1 extends z{static baseClass="mu-callout";static observedAttributes=["variant","title"];render(){this.#$()}update($,Z,X){this.#$()}#$(){let $=this.attr("variant","info"),Z={info:{bg:"var(--md-sys-color-primary-container)",border:"var(--md-sys-color-primary)",text:"var(--md-sys-color-on-primary-container)"},warning:{bg:"var(--md-sys-color-error-container)",border:"var(--md-sys-color-error)",text:"var(--md-sys-color-on-error-container)"},success:{bg:"var(--md-sys-color-tertiary-container)",border:"var(--md-sys-color-tertiary)",text:"var(--md-sys-color-on-tertiary-container)"},tip:{bg:"var(--md-sys-color-secondary-container)",border:"var(--md-sys-color-secondary)",text:"var(--md-sys-color-on-secondary-container)"}},X=Z[$]||Z.info;this.style.display="block",this.style.boxSizing="border-box",this.style.maxWidth="100%",this.style.wordWrap="break-word",this.style.overflowWrap="break-word",this.style.padding="20px",this.style.marginTop="24px",this.style.marginBottom="24px",this.style.background=X.bg,this.style.borderLeft=`4px solid ${X.border}`,this.style.borderRadius="var(--md-sys-shape-corner-medium)",this.style.color=X.text,this.style.lineHeight="1.6"}}_("mu-callout",i1);class o1 extends z{static baseClass="mu-tabs";static cssFile="tabs";static observedAttributes=["active"];#$=[];#Z=null;connectedCallback(){super.connectedCallback(),this.listen(this,"click",($)=>{let Z=$.target.closest("mu-tab");if(Z){let X=this.querySelector(".mu-tabs__list"),Q=(X?Array.from(X.querySelectorAll("mu-tab")):Array.from(this.querySelectorAll("mu-tab"))).indexOf(Z);if(Q!==-1)this.setAttribute("active",Q.toString())}})}render(){if(this.querySelector(".mu-tabs__list")){this.#$=Array.from(this.querySelectorAll("mu-tab")),this.#Z=this.querySelector(".mu-tabs__list"),this.#X();return}this.#Z=document.createElement("div"),this.#Z.className="mu-tabs__list",this.#Z.setAttribute("role","tablist"),this.#$=Array.from(this.querySelectorAll("mu-tab")),this.#$.forEach(($)=>{$.setAttribute("role","tab"),this.#Z.appendChild($)}),this.appendChild(this.#Z),this.#X()}update($,Z,X){if($==="active")this.#X(),this.emit("mu-tab-change",{index:parseInt(Z)||0})}#X(){let $=parseInt(this.attr("active","0")),Z=this.#$.length;if(this.#$.forEach((X,J)=>{X.classList.toggle("is-active",J===$),X.setAttribute("aria-selected",J===$?"true":"false")}),this.#Z&&Z>0){let X=100/Z;this.#Z.style.setProperty("--indicator-width",`${X}%`),this.#Z.style.setProperty("--indicator-left",`${$*X}%`)}}}class n1 extends z{static baseClass="mu-tabs__tab";connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0")}render(){}}_("mu-tabs",o1);_("mu-tab",n1);class s1 extends z{static baseClass="mu-alert";static observedAttributes=["severity","dismissible"];#$=null;#Z=null;connectedCallback(){if(this.setAttribute("role","alert"),this.setAttribute("aria-live","polite"),!this.#Z&&!this.querySelector(".mu-alert__content")&&!this.innerHTML.trim())setTimeout(()=>{this.#Z=this.innerHTML,this.#X()},0);else{if(!this.#Z&&!this.querySelector(".mu-alert__content"))this.#Z=this.innerHTML;this.#X()}}#X(){super.connectedCallback(),this.listen(this,"click",($)=>{if($.target.classList.contains("mu-alert__close"))this.dismiss()})}dismiss(){this.emit("mu-dismiss"),this.remove()}render(){if(this.querySelector(".mu-alert__content")){this.#J();return}let $=this.attr("severity","info"),Z=this.has("dismissible"),X={success:"success",error:"error",warning:"warning",info:"info"},J=this.#Z||"",Q=X[$]||X.info;this.innerHTML=`
|
|
126
|
+
<mu-icon name="${Q}" size="24" class="mu-alert__icon"></mu-icon>
|
|
127
|
+
<span class="mu-alert__content">${J}</span>
|
|
128
|
+
${Z?'<button class="mu-alert__close" aria-label="Dismiss"><mu-icon name="close" size="18"></mu-icon></button>':""}
|
|
129
|
+
`,this.#J()}update($,Z,X){this.#J()}#J(){let $=this.attr("severity","info");this.className=`mu-alert mu-alert--${$}`}}_("mu-alert",s1);class r1 extends z{static baseClass="mu-badge";static cssFile="badge";static observedAttributes=["variant","size"];connectedCallback(){super.connectedCallback(),this.#$()}render(){this.#$()}update($,Z,X){this.#$()}#$(){let $=this.attr("variant","primary"),Z=this.attr("size","md");this.className=`mu-badge mu-badge--${$} mu-badge--${Z}`}}_("mu-badge",r1);class t1 extends z{static baseClass="mu-progress";static cssFile="progress";static observedAttributes=["value","max","variant"];#$=null;render(){if(this.querySelector(".mu-progress__bar")){this.#$=this.querySelector(".mu-progress__bar");return}this.innerHTML='<span class="mu-progress__bar"></span>',this.#$=this.querySelector(".mu-progress__bar"),this.setAttribute("role","progressbar"),this.#Z(),this.#X()}update($,Z,X){if($==="value"||$==="max")this.#Z();this.#X()}#Z(){let $=parseFloat(this.attr("value","0")),Z=parseFloat(this.attr("max","100")),X=Math.min(100,Math.max(0,$/Z*100));if(this.#$)this.#$.style.width=`${X}%`;this.setAttribute("aria-valuenow",$.toString()),this.setAttribute("aria-valuemax",Z.toString())}#X(){let $=this.attr("variant","primary");this.className=`mu-progress mu-progress--${$}`}}_("mu-progress",t1);class a1 extends z{static baseClass="mu-table";static observedAttributes=["striped","hover"];render(){this.style.display="table",this.style.width="100%",this.style.borderCollapse="collapse",this.style.fontSize="var(--md-sys-typescale-body-medium-size, 14px)"}}class e1 extends z{static baseClass="mu-table__head";render(){this.style.display="table-header-group",this.style.background="var(--md-sys-color-surface-container)"}}class $6 extends z{static baseClass="mu-table__body";render(){this.style.display="table-row-group"}}class Z6 extends z{static baseClass="mu-table__row";render(){this.style.display="table-row",this.style.borderBottom="1px solid var(--md-sys-color-outline-variant)"}}class X6 extends z{static baseClass="mu-table__header";render(){this.style.display="table-cell",this.style.padding="12px 16px",this.style.fontWeight="600",this.style.textAlign="left"}}class J6 extends z{static baseClass="mu-table__cell";render(){this.style.display="table-cell",this.style.padding="12px 16px"}}_("mu-table",a1);_("mu-thead",e1);_("mu-tbody",$6);_("mu-tr",Z6);_("mu-th",X6);_("mu-td",J6);class Q6 extends z{static baseClass="mu-avatar";static cssFile="avatar";static observedAttributes=["src","alt","initials","size"];render(){let $=this.attr("src",""),Z=this.attr("alt",""),X=this.attr("initials",""),J=this.attr("size","md"),Q={sm:"32px",md:"40px",lg:"56px",xl:"80px"},Y={sm:"12px",md:"14px",lg:"20px",xl:"28px"};this.style.width=Q[J]||J,this.style.height=Q[J]||J,this.style.borderRadius="50%",this.style.display="inline-flex",this.style.alignItems="center",this.style.justifyContent="center",this.style.overflow="hidden",this.style.background="var(--md-sys-color-primary-container)",this.style.color="var(--md-sys-color-on-primary-container)",this.style.fontSize=Y[J]||"14px",this.style.fontWeight="600",this.innerHTML="";let G="";if(Z)G=Z.split(" ").map((U)=>U[0]).join("").toUpperCase().slice(0,2);if($){let K=document.createElement("img");K.src=$,K.alt=Z,K.style.cssText="width:100%;height:100%;object-fit:cover;",K.onerror=()=>{this.innerHTML="",this.#$(X,G)},this.appendChild(K)}else this.#$(X,G)}#$($,Z){if($){let X=document.createElement("span");X.textContent=$.toUpperCase().slice(0,2),this.appendChild(X)}else if(Z){let X=document.createElement("span");X.textContent=Z,this.appendChild(X)}else{let X=document.createElementNS("http://www.w3.org/2000/svg","svg");X.setAttribute("width","60%"),X.setAttribute("height","60%"),X.setAttribute("viewBox","0 0 16 16"),X.setAttribute("fill","currentColor");let J=document.createElementNS("http://www.w3.org/2000/svg","path");J.setAttribute("d","M10.561 8.073a6.005 6.005 0 0 1 3.432 5.142.75.75 0 0 1-1.498.07 4.5 4.5 0 0 0-8.99 0 .75.75 0 0 1-1.498-.07 6.004 6.004 0 0 1 3.431-5.142 3.999 3.999 0 1 1 5.123 0ZM10.5 5a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"),X.appendChild(J),this.appendChild(X)}}update($,Z,X){this.render()}}_("mu-avatar",Q6);class Y6 extends z{static baseClass="mu-skeleton";static observedAttributes=["variant","width","height","size","lines"];render(){if(this.querySelector(".mu-skeleton__line")||this.style.animation)return;let $=this.attr("variant","rect"),Z=this.attr("width","100%"),X=this.attr("height","20px"),J=this.attr("size","40px"),Q=parseInt(this.attr("lines","1"));if(this.style.display="block",$==="text"&&Q>1)this.innerHTML=Array(Q).fill(0).map((Y,G)=>`<div class="mu-skeleton__line" style="
|
|
130
|
+
height: 16px;
|
|
131
|
+
margin-bottom: 8px;
|
|
132
|
+
width: ${G===Q-1?"70%":"100%"};
|
|
133
|
+
background: var(--md-sys-color-surface-container-highest);
|
|
134
|
+
border-radius: 4px;
|
|
135
|
+
animation: mu-skeleton-pulse 1.5s ease-in-out infinite;
|
|
136
|
+
"></div>`).join("");else this.style.width=$==="circle"?J:Z,this.style.height=$==="circle"?J:X,this.style.borderRadius=$==="circle"?"50%":"4px",this.style.background="var(--md-sys-color-surface-container-highest)",this.style.animation="mu-skeleton-pulse 1.5s ease-in-out infinite";if(!document.getElementById("mu-skeleton-styles")){let Y=document.createElement("style");Y.id="mu-skeleton-styles",Y.textContent=`
|
|
137
|
+
@keyframes mu-skeleton-pulse {
|
|
138
|
+
0%, 100% { opacity: 1; }
|
|
139
|
+
50% { opacity: 0.5; }
|
|
140
|
+
}
|
|
141
|
+
`,document.head.appendChild(Y)}}update($,Z,X){this.render()}}_("mu-skeleton",Y6);class G6 extends z{static baseClass="mu-spinner";static observedAttributes=["size","color"];render(){if(this.querySelector(".mu-spinner__circle"))return;this.innerHTML='<span class="mu-spinner__circle"></span>',this.#$()}update($,Z,X){this.#$()}#$(){let $=this.attr("size","md"),Z=this.attr("color","primary");this.className=`mu-spinner mu-spinner--${$} mu-spinner--${Z}`}}_("mu-spinner",G6);class d extends z{static baseClass="mu-modal";static cssFile="dialog";static observedAttributes=["open","size"];#$=null;connectedCallback(){if(!this.hasAttribute("data-rendered"))this._userContent=this.innerHTML,this.setAttribute("data-rendered","true");super.connectedCallback(),this.#Z()}render(){if(this.querySelector("dialog"))return;let $=this.attr("size","md"),Z=this._userContent||"";this.innerHTML=`
|
|
142
|
+
<dialog class="mu-modal__dialog mu-modal--${$}">
|
|
143
|
+
<button class="mu-modal__close" aria-label="Close">✕</button>
|
|
144
|
+
<div class="mu-modal__body">${Z}</div>
|
|
145
|
+
</dialog>
|
|
146
|
+
`,this.#$=this.querySelector("dialog")}#Z(){if(this.#$=this.querySelector("dialog"),!this.#$)return;this.listen(this.#$,"close",()=>{this.removeAttribute("open"),this.classList.remove("is-open","is-visible"),document.body.style.overflow="",this.emit("mu-close")}),this.listen(this.#$,"cancel",(Z)=>{Z.preventDefault(),this.close()}),this.listen(this.#$,"click",(Z)=>{if(Z.target===this.#$)this.close()});let $=this.querySelector(".mu-modal__close");if($)this.listen($,"click",()=>{this.close()})}update($,Z,X){if($==="open"){if(Z!==null)this.#X()}}#X(){if(!this.#$||this.#$.open)return;this.classList.add("is-open"),this.#$.showModal(),document.body.style.overflow="hidden",A1().then(()=>this.classList.add("is-visible"))}open(){this.setAttribute("open","")}close(){if(!this.#$)return;this.classList.remove("is-visible");let $=!1,Z=()=>{if($)return;if($=!0,this.#$&&this.#$.open)this.#$.close();this.removeAttribute("open"),this.classList.remove("is-open"),document.body.style.overflow="",this.emit("mu-close")},X=this.#$,J=(Q)=>{if(Q.target===X)X.removeEventListener("transitionend",J),Z()};X.addEventListener("transitionend",J),this.setTimeout(()=>{X.removeEventListener("transitionend",J),Z()},200)}}_("mu-modal",d);class K6 extends z{static baseClass="mu-toast";static cssFile="snackbar";static observedAttributes=["severity","duration","position"];#$=null;#Z=null;connectedCallback(){if(!this.#Z&&!this.querySelector(".mu-toast__content"))this.#Z=this.innerHTML;super.connectedCallback(),this.listen(this,"click",(Z)=>{if(Z.target.classList.contains("mu-toast__close"))this.dismiss()});let $=parseInt(this.attr("duration","3000"));if($>0)this.#$=this.setTimeout(()=>this.dismiss(),$)}disconnectedCallback(){super.disconnectedCallback()}render(){if(this.querySelector(".mu-toast__content")){this.#X();return}let $=this.#Z||"";this.innerHTML=`
|
|
147
|
+
<span class="mu-toast__content">${$}</span>
|
|
148
|
+
<button class="mu-toast__close" aria-label="Dismiss">✕</button>
|
|
149
|
+
`,this.#X()}update($,Z,X){this.#X()}#X(){let $=this.attr("severity","info"),Z=this.attr("position","bottom-center");this.className=`mu-toast mu-toast--${$} mu-toast--${Z}`}dismiss(){this.emit("mu-dismiss"),this.classList.add("is-exiting");let $=!1,Z=()=>{if(!$)$=!0,this.remove()};this.addEventListener("animationend",Z,{once:!0}),this.setTimeout(Z,200)}}_("mu-toast",K6);class Z4 extends z{static baseClass="mu-toast-container";connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite")}}_("mu-toast-container",Z4);var I0={show($,Z={}){let X=Z.position||"bottom-center",J=document.querySelector(`mu-toast-container[position="${X}"]`);if(!J)J=document.createElement("mu-toast-container"),J.setAttribute("position",X),document.body.appendChild(J);let Q=document.createElement("mu-toast");if(Q.textContent=$,Z.severity)Q.setAttribute("severity",Z.severity);if(Z.duration)Q.setAttribute("duration",Z.duration.toString());return J.appendChild(Q),Q}};if(typeof window<"u"&&P&&!P.hasListeners(O.TOAST_SHOW))P.on(O.TOAST_SHOW,($)=>{I0.show($.message,$)});z0("mu-toast",{signals:[O.TOAST_SHOW,O.TOAST_DISMISS],options:{severities:["info","success","warning","error"],positions:["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"],defaultDuration:3000},description:"MD3 Snackbar/Toast Notification component"});var e=8;class W6 extends z{static baseClass="mu-tooltip";static cssFile="tooltip";static observedAttributes=["content","position"];#$=null;connectedCallback(){super.connectedCallback(),this.listen(this,"mouseenter",()=>this.show()),this.listen(this,"mouseleave",()=>this.hide()),this.listen(this,"focus",()=>this.show(),{capture:!0}),this.listen(this,"blur",()=>this.hide(),{capture:!0})}render(){let $=this.attr("position","top");this.className=`mu-tooltip mu-tooltip--${$}`,this.style.position="relative",this.style.display="inline-block"}update($,Z,X){if($==="position"){let J=this.attr("position","top");this.className=`mu-tooltip mu-tooltip--${J}`}}show(){if(this.#$)return;let $=this.attr("content","");if(!$)return;let Z=this.attr("position","top");this.#$=document.createElement("div"),this.#$.className=`mu-tooltip__content mu-tooltip__content--${Z}`,this.#$.textContent=$,this.#$.setAttribute("role","tooltip"),this.#$.style.cssText=`
|
|
150
|
+
position: fixed !important;
|
|
151
|
+
top: 0 !important;
|
|
152
|
+
left: 0 !important;
|
|
153
|
+
transform: none !important;
|
|
154
|
+
visibility: hidden;
|
|
155
|
+
z-index: var(--mu-z-tooltip, 9999);
|
|
156
|
+
pointer-events: none;
|
|
157
|
+
margin: 0 !important;
|
|
158
|
+
`,document.body.appendChild(this.#$),this.#Z(Z),requestAnimationFrame(()=>{if(this.#$)this.#$.style.visibility="visible",this.#$.style.opacity="1"})}#Z($){let Z=this.getBoundingClientRect(),X=this.#$.getBoundingClientRect(),{x:J,y:Q}=this.#X($,Z,X),Y=this.#J($,J,Q,X,Z);if(Y!==$)({x:J,y:Q}=this.#X(Y,Z,X));let{innerWidth:G,innerHeight:K}=window;J=Math.max(4,Math.min(J,G-X.width-4)),Q=Math.max(4,Math.min(Q,K-X.height-4)),this.#$.style.setProperty("left",`${J}px`,"important"),this.#$.style.setProperty("top",`${Q}px`,"important")}#X($,Z,X){let J,Q;switch($){case"top":J=Z.left+(Z.width-X.width)/2,Q=Z.top-X.height-e;break;case"bottom":J=Z.left+(Z.width-X.width)/2,Q=Z.bottom+e;break;case"left":J=Z.left-X.width-e,Q=Z.top+(Z.height-X.height)/2;break;case"right":J=Z.right+e,Q=Z.top+(Z.height-X.height)/2;break;default:J=Z.left+(Z.width-X.width)/2,Q=Z.top-X.height-e}return{x:J,y:Q}}#J($,Z,X,J,Q){let{innerWidth:Y,innerHeight:G}=window;switch($){case"top":if(X<0)return"bottom";break;case"bottom":if(X+J.height>G)return"top";break;case"left":if(Z<0)return"right";break;case"right":if(Z+J.width>Y)return"left";break}return $}hide(){if(this.#$)this.#$.remove(),this.#$=null}disconnectedCallback(){super.disconnectedCallback(),this.hide()}}_("mu-tooltip",W6);var $0=null;async function U6($,Z={}){let{title:X="Confirm",confirmText:J="Confirm",cancelText:Q="Cancel",variant:Y="primary"}=Z;if($0)$0.remove();return new Promise((G)=>{let K=document.createElement("mu-confirm");K.setAttribute("title",X),K.setAttribute("message",$),K.setAttribute("confirm-text",J),K.setAttribute("cancel-text",Q),K.setAttribute("variant",Y),K.addEventListener("mu-confirm",()=>{K.remove(),$0=null,G(!0)}),K.addEventListener("mu-cancel",()=>{K.remove(),$0=null,G(!1)}),$0=K,document.body.appendChild(K),K.open()})}class z6 extends d{static baseClass="mu-confirm";static cssFile="dialog";static observedAttributes=["title","message","confirm-text","cancel-text","variant","open","size"];#$=null;connectedCallback(){if(!this.hasAttribute("data-rendered"))this.setAttribute("data-rendered","true");Object.getPrototypeOf(d.prototype).connectedCallback.call(this)}render(){if(this.querySelector("dialog"))return;let $=V(this.attr("title","Confirm")),Z=V(this.attr("message","Are you sure?")),X=V(this.attr("confirm-text","Confirm")),J=V(this.attr("cancel-text","Cancel")),Y=this.attr("variant","primary")==="danger"?"danger":"filled";this.innerHTML=`
|
|
159
|
+
<dialog class="mu-confirm__dialog">
|
|
160
|
+
<h3 class="mu-confirm__title">${$}</h3>
|
|
161
|
+
<p class="mu-confirm__message">${Z}</p>
|
|
162
|
+
<div class="mu-confirm__actions">
|
|
163
|
+
<mu-button variant="text" data-action="cancel">${J}</mu-button>
|
|
164
|
+
<mu-button variant="${Y}" data-action="confirm">${X}</mu-button>
|
|
165
|
+
</div>
|
|
166
|
+
</dialog>
|
|
167
|
+
`,this.#$=this.querySelector("dialog"),this.#Z()}handleAction($,Z,X){if($==="cancel")this.cancel();else if($==="confirm")this.confirm()}#Z(){if(this.#$=this.querySelector("dialog"),!this.#$)return;this.listen(this.#$,"close",()=>{this.removeAttribute("open"),this.classList.remove("is-open","is-visible"),document.body.style.overflow=""}),this.listen(this.#$,"cancel",($)=>{$.preventDefault(),this.cancel()}),this.listen(this.#$,"click",($)=>{if($.target===this.#$)this.cancel()})}update($,Z,X){if($==="open"){if(Z!==null)this.#X()}}#X(){if(!this.#$||this.#$.open)return;this.classList.add("is-open"),this.#$.showModal(),document.body.style.overflow="hidden";let $=this.querySelector(".mu-confirm__confirm");if($)requestAnimationFrame(()=>{requestAnimationFrame(()=>$.focus())});requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.classList.add("is-visible")})})}open(){this.setAttribute("open","")}close(){if(!this.#$)return;this.classList.remove("is-visible");let $=!1,Z=()=>{if($)return;if($=!0,this.#$&&this.#$.open)this.#$.close();this.removeAttribute("open"),this.classList.remove("is-open"),document.body.style.overflow=""},X=this.#$,J=(Q)=>{if(Q.target===X)X.removeEventListener("transitionend",J),Z()};X.addEventListener("transitionend",J),this.setTimeout(()=>{X.removeEventListener("transitionend",J),Z()},200)}confirm(){this.close(),this.emit("mu-confirm")}cancel(){this.close(),this.emit("mu-cancel")}}_("mu-confirm",z6);class _6 extends z{static baseClass="mu-router";static observedAttributes=["base","default"];#$=new Map;#Z=null;connectedCallback(){super.connectedCallback(),this.listen(window,"hashchange",()=>this.#Y()),this.#Y()}render(){this.innerHTML='<div class="mu-router__content"></div>'}get#X(){return this.attr("base","/app/pages")}get#J(){return this.attr("default","home")}get#Q(){return this.querySelector(".mu-router__content")}async#Y(){let $=window.location.hash.slice(1)||this.#J;if($===this.#Z)return;this.#Z=$,this.emit("mu-route-change",{route:$}),await this.#G($)}async#G($){let Z=this.#Q;if(!Z)return;Z.innerHTML="<mu-spinner></mu-spinner>";try{if(this.#$.has($)){Z.innerHTML=this.#$.get($),this.emit("mu-page-loaded",{route:$});return}let X=`${this.#X}/${$}.html`,J=await fetch(X);if(!J.ok)throw Error(`Page not found: ${$}`);let Q=await J.text(),K=new DOMParser().parseFromString(Q,"text/html").querySelector("mu-page");if(K){let U=K.querySelector("template"),W=U?U.innerHTML:K.innerHTML;this.#$.set($,W),Z.innerHTML=W;let D=K.querySelector('script[type="x-dependencies"]');if(D)await this.#K(D.textContent);let q=K.getAttribute("title");if(q)document.title=`${q} | microUI`}else Z.innerHTML=Q;this.emit("mu-page-loaded",{route:$})}catch(X){Z.innerHTML=`
|
|
168
|
+
<mu-alert variant="error">
|
|
169
|
+
<strong>Page not found</strong>
|
|
170
|
+
<p>Could not load page: ${V($)}</p>
|
|
171
|
+
</mu-alert>
|
|
172
|
+
`,this.emit("mu-page-error",{route:$,error:X})}}async#K($){let Z=$.split(/[\n,]/).map((X)=>X.trim()).filter((X)=>X&&X.startsWith("mu-"));for(let X of Z){if(customElements.get(X))continue;try{await import(`/dist/components/${X}.js`)}catch(J){console.warn(`[mu-router] Could not load: ${X}`,J)}}}navigate($){window.location.hash=$}get currentRoute(){return this.#Z}}_("mu-router",_6);class D6 extends z{static baseClass="mu-page";static observedAttributes=["route","title"];get route(){return this.attr("route","")}get pageTitle(){return this.attr("title","")}get dependencies(){let $=this.querySelector('script[type="x-dependencies"]');if(!$)return[];return $.textContent.split(/[\n,]/).map((Z)=>Z.trim()).filter((Z)=>Z&&Z.startsWith("mu-"))}connectedCallback(){if(super.connectedCallback(),this.querySelector("template"))this.render()}render(){let $=this.querySelector("template");if($){let Z=$.content.cloneNode(!0),X=this.querySelector('script[type="x-dependencies"]');if(this.innerHTML="",X)this.appendChild(X);this.appendChild(Z)}}}_("mu-page",D6);class j6 extends z{static baseClass="mu-theme-toggle";connectedCallback(){super.connectedCallback(),this.listen(this,"click",()=>f.toggle()),P.on(O.THEME_CHANGE,()=>this.#$())}render(){this.innerHTML=`
|
|
173
|
+
<button class="mu-theme-toggle__button" aria-label="Toggle theme">
|
|
174
|
+
<span class="mu-theme-toggle__icon"></span>
|
|
175
|
+
</button>
|
|
176
|
+
`,this.#$()}#$(){let $=f.get()==="dark",Z=this.querySelector(".mu-theme-toggle__icon");if(Z)Z.textContent=$?"☀️":"\uD83C\uDF19"}}_("mu-theme-toggle",j6);z0("mu-theme-toggle",{signals:[O.THEME_CHANGE],options:{themes:["light","dark"],emits:["click"]},description:"Theme toggle button that switches between light/dark modes"});class q6 extends z{static baseClass="mu-virtual-list";static cssFile="virtual-list";static observedAttributes=["item-height","buffer"];#$=[];#Z=($)=>`<div>${$}</div>`;#X=0;#J=0;#Q=0;#Y=null;#G=null;set items($){this.#$=$||[],this.#K()}get items(){return this.#$}set renderItem($){this.#Z=$,this.#K()}connectedCallback(){super.connectedCallback()}render(){let $=parseInt(this.attr("item-height","50"));this.innerHTML=`
|
|
177
|
+
<div class="mu-virtual-list__viewport" style="
|
|
178
|
+
height: 100%;
|
|
179
|
+
overflow-y: auto;
|
|
180
|
+
position: relative;
|
|
181
|
+
">
|
|
182
|
+
<div class="mu-virtual-list__content" style="
|
|
183
|
+
position: relative;
|
|
184
|
+
">
|
|
185
|
+
<div class="mu-virtual-list__items"></div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
`,this.#Y=this.querySelector(".mu-virtual-list__viewport"),this.#G=this.querySelector(".mu-virtual-list__content");let Z=H1(()=>{this.#X=this.#Y.scrollTop,this.#K()},16);this.listen(this.#Y,"scroll",Z),this.style.display="block",this.style.height="400px",this.style.overflow="hidden",this.#K()}#K(){if(!this.#Y||!this.#$.length)return;let $=parseInt(this.attr("item-height","50")),Z=parseInt(this.attr("buffer","5")),X=this.#Y.clientHeight,J=this.#$.length*$;this.#G.style.height=`${J}px`;let Q=Math.max(0,Math.floor(this.#X/$)-Z),Y=Math.ceil(X/$)+Z*2,G=Math.min(this.#$.length,Q+Y);if(Q!==this.#J||G!==this.#Q)this.#J=Q,this.#Q=G,this.#W()}async#W(){let $=parseInt(this.attr("item-height","50")),Z=this.querySelector(".mu-virtual-list__items");if(!Z)return;let X=this.#$.slice(this.#J,this.#Q),J=50;if(X.length>J&&"scheduler"in window){let Y=[];for(let G=0;G<X.length;G+=J){let K=X.slice(G,G+J);if(Y.push(...K.map((U,W)=>{let D=this.#J+G+W;return`
|
|
189
|
+
<div class="mu-virtual-list__item" style="
|
|
190
|
+
position: absolute;
|
|
191
|
+
top: ${D*$}px;
|
|
192
|
+
left: 0;
|
|
193
|
+
right: 0;
|
|
194
|
+
height: ${$}px;
|
|
195
|
+
" data-index="${D}" data-mu-state="visible">
|
|
196
|
+
${this.#Z(U,D)}
|
|
197
|
+
</div>
|
|
198
|
+
`})),G+J<X.length)await scheduler.yield()}Z.innerHTML=Y.join("")}else Z.innerHTML=X.map((Y,G)=>{let K=this.#J+G;return`
|
|
199
|
+
<div class="mu-virtual-list__item" style="
|
|
200
|
+
position: absolute;
|
|
201
|
+
top: ${K*$}px;
|
|
202
|
+
left: 0;
|
|
203
|
+
right: 0;
|
|
204
|
+
height: ${$}px;
|
|
205
|
+
" data-index="${K}" data-mu-state="visible">
|
|
206
|
+
${this.#Z(Y,K)}
|
|
207
|
+
</div>
|
|
208
|
+
`}).join("")}scrollToIndex($){let Z=parseInt(this.attr("item-height","50"));this.#Y.scrollTop=$*Z}}_("mu-virtual-list",q6);class V6 extends z{static baseClass="mu-lazy";static observedAttributes=["root-margin","threshold"];#$=null;#Z=!1;connectedCallback(){super.connectedCallback();let $=this.attr("root-margin","200px"),Z=parseFloat(this.attr("threshold","0"));this.#$=new IntersectionObserver((X)=>{if(X[0].isIntersecting&&!this.#Z)this.#X()},{rootMargin:$,threshold:Z}),this.#$.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#$?.disconnect()}render(){let $=this.querySelector('[slot="placeholder"]');if($)$.style.display="block";let Z=this.querySelector("template");if(Z)Z.style.display="none"}#X(){this.#Z=!0,this.#$?.disconnect();let $=this.querySelector("template"),Z=this.querySelector('[slot="placeholder"]');if($){let X=$.content.cloneNode(!0);this.appendChild(X),$.remove()}if(Z)Z.remove();this.emit("mu-loaded"),this.classList.add("is-loaded")}load(){if(!this.#Z)this.#X()}}_("mu-lazy",V6);class F6 extends z{static baseClass="mu-repeat";static observedAttributes=[];#$=[];#Z=($,Z)=>Z;#X=($)=>`<div>${JSON.stringify($)}</div>`;#J=new Map;set items($){let Z=this.#$;this.#$=$||[],M0.schedule(()=>this.#Q(Z))}get items(){return this.#$}set keyFn($){this.#Z=$}set renderItem($){this.#X=$}render(){this.style.display="contents"}#Q($){let Z=new Set,X=document.createDocumentFragment();for(let Q=0;Q<this.#$.length;Q++){let Y=this.#Z(this.#$[Q],Q);Z.add(Y)}for(let[Q,Y]of this.#J)if(!Z.has(Q))Y.remove(),this.#J.delete(Q);let J=null;for(let Q=0;Q<this.#$.length;Q++){let Y=this.#$[Q],G=this.#Z(Y,Q),K=this.#J.get(G);if(!K){let U=document.createElement("div");U.innerHTML=this.#X(Y,Q),K=U.firstElementChild||U,K.dataset.muKey=G,this.#J.set(G,K)}else{let U=this.#X(Y,Q);if(K.outerHTML!==U){let W=document.createElement("div");W.innerHTML=U;let D=W.firstElementChild||W;D.dataset.muKey=G,K.replaceWith(D),this.#J.set(G,D),K=D}}if(J){if(K.previousElementSibling!==J)J.after(K)}else if(this.firstElementChild!==K)this.prepend(K);J=K}}getElement($){return this.#J.get($)}refresh(){this.#J.clear(),this.innerHTML="",M0.schedule(()=>this.#Q([]))}}_("mu-repeat",F6);class A6 extends z{static baseClass="mu-fetch";static observedAttributes=["url","method","auto","interval"];state="idle";data=null;error=null;_controller=null;_intervalId=null;connectedCallback(){if(this._loadingTemplate=this.querySelector('template[slot="loading"]')?.innerHTML||"<mu-spinner></mu-spinner>",this._errorTemplate=this.querySelector('template[slot="error"]')?.innerHTML||'<mu-alert variant="error">Error loading data</mu-alert>',this._emptyTemplate=this.querySelector('template[slot="empty"]')?.innerHTML||"<p>No data</p>",super.connectedCallback(),this.has("auto")||this.hasAttribute("url"))this.fetch();let $=parseInt(this.attr("interval","0"));if($>0)this.setInterval(()=>this.fetch(),$)}render(){switch(this.innerHTML="",this.state){case"loading":let $=document.createElement("div");$.className="mu-fetch__loading",$.innerHTML=this._loadingTemplate,this.appendChild($);break;case"error":let Z=document.createElement("div");Z.className="mu-fetch__error";let X=this.error?.message||"Unknown error";if(this._errorTemplate&&this._errorTemplate.includes("${error}"))Z.textContent=`Error: ${X}`;else{let J=document.createElement("mu-alert");J.setAttribute("variant","error"),J.textContent=X,Z.appendChild(J)}this.appendChild(Z);break;case"success":if(!this.data||Array.isArray(this.data)&&this.data.length===0){let J=document.createElement("div");J.className="mu-fetch__empty",J.innerHTML=this._emptyTemplate,this.appendChild(J)}else{let J=document.createElement("div");if(J.className="mu-fetch__data",this.renderItem&&Array.isArray(this.data))this.data.forEach((Q)=>{let Y=this.renderItem(Q);if(Y instanceof Node)J.appendChild(Y);else{let G=document.createElement("div");G.innerHTML=Y,J.insertAdjacentHTML("beforeend",Y)}});else{let Q=document.createElement("slot");Q.name="data",J.appendChild(Q),this.emit("mu-data",{data:this.data})}this.appendChild(J)}break}}async fetch($={}){let Z=this.attr("url","");if(!Z)return console.warn("mu-fetch: No URL provided"),null;if(this._controller)this._controller.abort();this._controller=new AbortController,this.state="loading",this.error=null,this.render(),this.emit("mu-loading");try{let X=this.attr("method","GET"),J=await fetch(Z,{method:X,signal:this._controller.signal,headers:{"Content-Type":"application/json",...$.headers},...$});if(!J.ok){let Q=`HTTP ${J.status}: ${J.statusText}`;try{let Y=await J.json();if(Y.message)Q=Y.message}catch(Y){}throw Error(Q)}return this.data=await J.json(),this.state="success",this.render(),this.emit("mu-success",{data:this.data}),this.data}catch(X){if(X.name==="AbortError")return null;return this.error=X,this.state="error",this.render(),this.emit("mu-error",{error:this.error}),null}}refetch(){return this.fetch()}set renderItem($){this._renderItem=$}get renderItem(){return this._renderItem}update($,Z,X){if($==="url"&&Z!==X)this.fetch()}disconnectedCallback(){if(super.disconnectedCallback(),this._controller)this._controller.abort()}}_("mu-fetch",A6);class L6 extends z{static get observedAttributes(){return["columns","page-size","sortable","selectable","filterable","empty-message"]}static baseClass="mu-datatable";static cssFile="datatable";constructor(){super();this._data=[],this._filteredData=[],this._columns=[],this._currentPage=1,this._sortField=null,this._sortDirection="asc",this._selectedRows=new Set,this._filterValue=""}get columns(){let $=this.getAttribute("columns");if($)try{return JSON.parse($)}catch(Z){return console.warn("[mu-datatable] Invalid columns JSON:",Z),[]}return this._columns}set columns($){if(this._columns=Array.isArray($)?$:[],this.isConnected)this.render()}get pageSize(){return parseInt(this.getAttribute("page-size"))||10}set pageSize($){this.setAttribute("page-size",$)}get sortable(){return this.hasAttribute("sortable")}get selectable(){return this.hasAttribute("selectable")}get filterable(){return this.hasAttribute("filterable")}get emptyMessage(){return this.getAttribute("empty-message")||"No data available"}connectedCallback(){super.connectedCallback(),this.render()}attributeChangedCallback($,Z,X){if(this.isConnected&&Z!==X)this.render()}setData($){this._data=Array.isArray($)?$:[],this._filteredData=[...this._data],this._currentPage=1,this._selectedRows.clear(),this._applySort(),this.render(),this.emit("mu-data-change",{data:this._data,count:this._data.length},{bubbles:!0})}getData(){return[...this._data]}getSortState(){return{field:this._sortField,direction:this._sortDirection}}getSelectedRows(){return this._data.filter(($,Z)=>this._selectedRows.has(Z))}getPageInfo(){let $=Math.ceil(this._filteredData.length/this.pageSize);return{page:this._currentPage,pageSize:this.pageSize,totalPages:$,totalRows:this._filteredData.length}}goToPage($){let Z=Math.ceil(this._filteredData.length/this.pageSize)||1;this._currentPage=Math.max(1,Math.min($,Z)),this.render(),this.emit("mu-page-change",this.getPageInfo(),{bubbles:!0})}sortBy($,Z){if(this._sortField===$&&!Z)this._sortDirection=this._sortDirection==="asc"?"desc":"asc";else this._sortField=$,this._sortDirection=Z||"asc";this._applySort(),this.render(),this.emit("mu-sort-change",this.getSortState(),{bubbles:!0})}filter($){this._filterValue=$.toLowerCase(),this._applyFilter(),this._currentPage=1,this.render(!1)}_applySort(){if(!this._sortField)return;this._filteredData.sort(($,Z)=>{let X=$[this._sortField]??"",J=Z[this._sortField]??"";if(typeof X==="number"&&typeof J==="number")return this._sortDirection==="asc"?X-J:J-X;let Q=String(X).toLowerCase(),Y=String(J).toLowerCase(),G=Q.localeCompare(Y);return this._sortDirection==="asc"?G:-G})}_applyFilter(){if(!this._filterValue){this._filteredData=[...this._data];return}let $=this.columns.filter((X)=>X.filterable!==!1),Z=$.length>0?$.map((X)=>X.field):this.columns.map((X)=>X.field);this._filteredData=this._data.filter((X)=>{return Z.some((J)=>{return String(X[J]??"").toLowerCase().includes(this._filterValue)})})}_getPageData(){let $=(this._currentPage-1)*this.pageSize,Z=$+this.pageSize;return this._filteredData.slice($,Z)}_handleHeaderClick($){if(this.columns.find((X)=>X.field===$)?.sortable!==!1&&this.sortable)this.sortBy($)}_handleRowSelect($,Z){let X=(this._currentPage-1)*this.pageSize+$;if(Z)this._selectedRows.add(X);else this._selectedRows.delete(X);this.render(),this.emit("mu-selection-change",{selected:this.getSelectedRows()},{bubbles:!0})}_handleSelectAll($){let Z=this._getPageData(),X=(this._currentPage-1)*this.pageSize;Z.forEach((J,Q)=>{if($)this._selectedRows.add(X+Q);else this._selectedRows.delete(X+Q)}),this.render(),this.emit("mu-selection-change",{selected:this.getSelectedRows()},{bubbles:!0})}render($=!0){let Z=this.columns,X=this._getPageData(),{page:J,totalPages:Q,totalRows:Y}=this.getPageInfo(),G=(this._currentPage-1)*this.pageSize,K=X.length>0&&X.every((q,F)=>this._selectedRows.has(G+F)),U=this.querySelector(".mu-datatable-table tbody"),W=this.querySelector(".mu-datatable-info"),D=this.querySelector(".mu-datatable-pagination");if(!$&&U){if(U.innerHTML=this._renderTbody(X,Z,G,K),W)W.innerHTML=`${Y} row${Y!==1?"s":""}${this._selectedRows.size>0?` · ${this._selectedRows.size} selected`:""}`;if(D)D.innerHTML=this._renderPaginationContent(J,Q,Y);else if(Q>1){let q=this.querySelector(".mu-datatable-wrapper");if(q)q.insertAdjacentHTML("beforeend",this._renderPagination(J,Q,Y))}this._attachEventListeners();return}this.innerHTML=`
|
|
209
|
+
<div class="mu-datatable-wrapper">
|
|
210
|
+
${this.filterable?`
|
|
211
|
+
<div class="mu-datatable-toolbar">
|
|
212
|
+
<div class="mu-datatable-search">
|
|
213
|
+
<input
|
|
214
|
+
type="search"
|
|
215
|
+
placeholder="Search..."
|
|
216
|
+
value="${V(this._filterValue)}"
|
|
217
|
+
>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="mu-datatable-info">
|
|
220
|
+
${Y} row${Y!==1?"s":""}
|
|
221
|
+
${this._selectedRows.size>0?` · ${this._selectedRows.size} selected`:""}
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
`:""}
|
|
225
|
+
|
|
226
|
+
<table class="mu-datatable-table">
|
|
227
|
+
<thead>
|
|
228
|
+
<tr>
|
|
229
|
+
${this.selectable?`
|
|
230
|
+
<th class="mu-datatable-checkbox-cell">
|
|
231
|
+
<input
|
|
232
|
+
type="checkbox"
|
|
233
|
+
${K?"checked":""}
|
|
234
|
+
data-select-all
|
|
235
|
+
>
|
|
236
|
+
</th>
|
|
237
|
+
`:""}
|
|
238
|
+
${Z.map((q)=>{let F=q.sortable!==!1&&this.sortable,A=this._sortField===q.field,H=A?this._sortDirection==="asc"?"↑":"↓":"↕";return`
|
|
239
|
+
<th
|
|
240
|
+
class="${F?"mu-datatable-sortable":""} ${A?"mu-datatable-sorted":""}"
|
|
241
|
+
data-field="${V(q.field)}"
|
|
242
|
+
>
|
|
243
|
+
${V(q.label||q.field)}
|
|
244
|
+
${F?`<span class="mu-datatable-sort-icon">${H}</span>`:""}
|
|
245
|
+
</th>
|
|
246
|
+
`}).join("")}
|
|
247
|
+
</tr>
|
|
248
|
+
</thead>
|
|
249
|
+
<tbody>
|
|
250
|
+
${this._renderTbody(X,Z,G,K)}
|
|
251
|
+
</tbody>
|
|
252
|
+
</table>
|
|
253
|
+
|
|
254
|
+
${this._renderPagination(J,Q,Y)}
|
|
255
|
+
</div>
|
|
256
|
+
`,this._attachEventListeners()}_renderTbody($,Z,X,J){if($.length===0)return`
|
|
257
|
+
<tr>
|
|
258
|
+
<td colspan="${Z.length+(this.selectable?1:0)}" class="mu-datatable-empty-state">
|
|
259
|
+
${V(this.emptyMessage)}
|
|
260
|
+
</td>
|
|
261
|
+
</tr>
|
|
262
|
+
`;return $.map((Q,Y)=>{let G=X+Y,K=this._selectedRows.has(G);return`
|
|
263
|
+
<tr class="${K?"mu-datatable-selected":""}" data-row-index="${Y}">
|
|
264
|
+
${this.selectable?`
|
|
265
|
+
<td class="mu-datatable-checkbox-cell">
|
|
266
|
+
<input
|
|
267
|
+
type="checkbox"
|
|
268
|
+
${K?"checked":""}
|
|
269
|
+
data-row-select="${Y}"
|
|
270
|
+
>
|
|
271
|
+
</td>
|
|
272
|
+
`:""}
|
|
273
|
+
${Z.map((U)=>`
|
|
274
|
+
<td data-field="${V(U.field)}">
|
|
275
|
+
${U.render?U.render(Q[U.field],Q):V(Q[U.field]??"")}
|
|
276
|
+
</td>
|
|
277
|
+
`).join("")}
|
|
278
|
+
</tr>
|
|
279
|
+
`}).join("")}_renderPagination($,Z,X){if(Z<=1)return"";return`
|
|
280
|
+
<div class="mu-datatable-pagination">
|
|
281
|
+
${this._renderPaginationContent($,Z,X)}
|
|
282
|
+
</div>
|
|
283
|
+
`}_renderPaginationContent($,Z,X){return`
|
|
284
|
+
<div class="mu-datatable-pagination-info">
|
|
285
|
+
Showing ${($-1)*this.pageSize+1}–${Math.min($*this.pageSize,X)} of ${X}
|
|
286
|
+
</div>
|
|
287
|
+
<div class="mu-datatable-pagination-controls">
|
|
288
|
+
<button class="mu-datatable-pagination-btn" data-page="prev" ${$<=1?"disabled":""}>
|
|
289
|
+
←
|
|
290
|
+
</button>
|
|
291
|
+
${this._getPaginationButtons($,Z)}
|
|
292
|
+
<button class="mu-datatable-pagination-btn" data-page="next" ${$>=Z?"disabled":""}>
|
|
293
|
+
→
|
|
294
|
+
</button>
|
|
295
|
+
</div>
|
|
296
|
+
`}_getPaginationButtons($,Z){let X=[],J=5,Q=Math.max(1,$-Math.floor(2.5)),Y=Math.min(Z,Q+5-1);if(Y-Q<4)Q=Math.max(1,Y-5+1);for(let G=Q;G<=Y;G++)X.push(`
|
|
297
|
+
<button
|
|
298
|
+
class="mu-datatable-pagination-btn ${G===$?"mu-datatable-pagination-btn-active":""}"
|
|
299
|
+
data-page="${G}"
|
|
300
|
+
>
|
|
301
|
+
${G}
|
|
302
|
+
</button>
|
|
303
|
+
`);return X.join("")}_attachEventListeners(){this.querySelectorAll("th.mu-datatable-sortable").forEach((X)=>{this.listen(X,"click",()=>{this._handleHeaderClick(X.dataset.field)})}),this.querySelectorAll(".mu-datatable-pagination-btn[data-page]").forEach((X)=>{this.listen(X,"click",()=>{let J=X.dataset.page;if(J==="prev")this.goToPage(this._currentPage-1);else if(J==="next")this.goToPage(this._currentPage+1);else this.goToPage(parseInt(J))})}),this.querySelectorAll("[data-row-select]").forEach((X)=>{this.listen(X,"change",(J)=>{this._handleRowSelect(parseInt(X.dataset.rowSelect),J.target.checked)})});let $=this.querySelector("[data-select-all]");if($)this.listen($,"change",(X)=>{this._handleSelectAll(X.target.checked)});let Z=this.querySelector(".mu-datatable-search input");if(Z){let X=L1((J)=>this.filter(J),300);this.listen(Z,"input",(J)=>X(J.target.value))}}}if(!customElements.get("mu-datatable"))customElements.define("mu-datatable",L6);class H6 extends z{static get observedAttributes(){return["submit-label","reset-label","inline","readonly","disabled"]}static baseClass="mu-schema-form";static cssFile="schema-form";constructor(){super();this._schema=null,this._values={},this._errors={},this._touched={}}get schema(){return this._schema}set schema($){if(this._schema=$,this._initializeValues(),this.isConnected)this.render()}get submitLabel(){return this.getAttribute("submit-label")||"Submit"}get resetLabel(){return this.getAttribute("reset-label")||"Reset"}get inline(){return this.hasAttribute("inline")}get readonly(){return this.hasAttribute("readonly")}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){super.connectedCallback(),this.render()}attributeChangedCallback($,Z,X){if(this.isConnected&&Z!==X)this.render()}getValues(){return{...this._values}}setValues($){this._values={...this._values,...$},this.render()}validate(){if(!this._schema||!this._schema.properties)return!0;this._errors={};let $=this._schema.required||[];for(let[Z,X]of Object.entries(this._schema.properties)){let J=this._values[Z],Q=this._validateField(Z,J,X,$.includes(Z));if(Q.length>0)this._errors[Z]=Q}return this.render(),Object.keys(this._errors).length===0}getErrors(){return{...this._errors}}reset(){this._initializeValues(),this._errors={},this._touched={},this.render(),this.emit("mu-reset",{values:this.getValues()},{bubbles:!0})}submit(){if(this.validate())this.emit("mu-submit",this.getValues(),{bubbles:!0})}_initializeValues(){if(this._values={},!this._schema||!this._schema.properties)return;for(let[$,Z]of Object.entries(this._schema.properties))if(Z.default!==void 0)this._values[$]=Z.default;else if(Z.type==="boolean")this._values[$]=!1;else if(Z.type==="number"||Z.type==="integer")this._values[$]=null;else this._values[$]=""}_validateField($,Z,X,J){let Q=[];if(J&&(Z===""||Z===null||Z===void 0))return Q.push(`${X.title||$} is required`),Q;if(Z===""||Z===null||Z===void 0)return Q;if(X.type==="string"){if(X.minLength&&Z.length<X.minLength)Q.push(`Minimum ${X.minLength} characters`);if(X.maxLength&&Z.length>X.maxLength)Q.push(`Maximum ${X.maxLength} characters`);if(X.pattern&&!new RegExp(X.pattern).test(Z))Q.push(X.patternError||"Invalid format");if(X.format==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Z))Q.push("Invalid email address");if(X.format==="url"&&!/^https?:\/\/.+/.test(Z))Q.push("Invalid URL")}if(X.type==="number"||X.type==="integer"){let Y=Number(Z);if(isNaN(Y))Q.push("Must be a number");else{if(X.minimum!==void 0&&Y<X.minimum)Q.push(`Minimum value is ${X.minimum}`);if(X.maximum!==void 0&&Y>X.maximum)Q.push(`Maximum value is ${X.maximum}`)}}return Q}_getInputType($){if($.format==="email")return"email";if($.format==="password")return"password";if($.format==="date")return"date";if($.format==="time")return"time";if($.format==="datetime-local")return"datetime-local";if($.format==="url")return"url";if($.format==="tel")return"tel";if($.type==="number"||$.type==="integer")return"number";return"text"}_renderField($,Z,X){let J=this._values[$]??"",Q=this._errors[$]||[],Y=Q.length>0,G=V($),K=V(Z.title||$),U=V(Z.placeholder||""),W=V(Z.description||""),D=V(String(J)),q=Y?V(Q[0]):"",F=this.disabled||Z.readOnly,A=this.readonly;if(Z.type==="boolean")return`
|
|
304
|
+
<div class="mu-schema-form-field" data-field="${G}">
|
|
305
|
+
<div class="mu-schema-form-switch-row">
|
|
306
|
+
<mu-switch
|
|
307
|
+
${J?"checked":""}
|
|
308
|
+
${F?"disabled":""}
|
|
309
|
+
data-field="${G}"
|
|
310
|
+
></mu-switch>
|
|
311
|
+
<label class="mu-schema-form-switch-label">${K}</label>
|
|
312
|
+
</div>
|
|
313
|
+
${W?`<div class="mu-schema-form-description">${W}</div>`:""}
|
|
314
|
+
</div>
|
|
315
|
+
`;if(Z.enum){let v0=Z.enum.map((b0,X4)=>{let J4=V(String(b0)),Q4=V(Z.enumLabels?.[X4]||String(b0));return`<mu-option value="${J4}" ${J===b0?"selected":""}>${Q4}</mu-option>`}).join("");return`
|
|
316
|
+
<div class="mu-schema-form-field ${Y?"mu-schema-form-field-error":""}" data-field="${G}">
|
|
317
|
+
<mu-dropdown
|
|
318
|
+
label="${K}${X?" *":""}"
|
|
319
|
+
value="${D}"
|
|
320
|
+
${F?"disabled":""}
|
|
321
|
+
${X?"required":""}
|
|
322
|
+
data-field="${G}"
|
|
323
|
+
>
|
|
324
|
+
${v0}
|
|
325
|
+
</mu-dropdown>
|
|
326
|
+
${W?`<div class="mu-schema-form-description">${W}</div>`:""}
|
|
327
|
+
${Y?`<div class="mu-schema-form-error">${q}</div>`:""}
|
|
328
|
+
</div>
|
|
329
|
+
`}if(Z.type==="string"&&Z.multiline)return`
|
|
330
|
+
<div class="mu-schema-form-field ${Y?"mu-schema-form-field-error":""}" data-field="${G}">
|
|
331
|
+
<mu-textarea
|
|
332
|
+
label="${K}${X?" *":""}"
|
|
333
|
+
placeholder="${U}"
|
|
334
|
+
${F?"disabled":""}
|
|
335
|
+
${A?"readonly":""}
|
|
336
|
+
${X?"required":""}
|
|
337
|
+
data-field="${G}"
|
|
338
|
+
>${D}</mu-textarea>
|
|
339
|
+
${W?`<div class="mu-schema-form-description">${W}</div>`:""}
|
|
340
|
+
${Y?`<div class="mu-schema-form-error">${q}</div>`:""}
|
|
341
|
+
</div>
|
|
342
|
+
`;let H=this._getInputType(Z);return`
|
|
343
|
+
<div class="mu-schema-form-field ${Y?"mu-schema-form-field-error":""}" data-field="${G}">
|
|
344
|
+
<mu-input
|
|
345
|
+
type="${H}"
|
|
346
|
+
label="${K}${X?" *":""}"
|
|
347
|
+
placeholder="${U}"
|
|
348
|
+
value="${D}"
|
|
349
|
+
${F?"disabled":""}
|
|
350
|
+
${A?"readonly":""}
|
|
351
|
+
${X?"required":""}
|
|
352
|
+
${Z.minimum!==void 0?`min="${Z.minimum}"`:""}
|
|
353
|
+
${Z.maximum!==void 0?`max="${Z.maximum}"`:""}
|
|
354
|
+
${Z.minLength?`minlength="${Z.minLength}"`:""}
|
|
355
|
+
${Z.maxLength?`maxlength="${Z.maxLength}"`:""}
|
|
356
|
+
data-field="${G}"
|
|
357
|
+
></mu-input>
|
|
358
|
+
${W?`<div class="mu-schema-form-description">${W}</div>`:""}
|
|
359
|
+
${Y?`<div class="mu-schema-form-error">${q}</div>`:""}
|
|
360
|
+
</div>
|
|
361
|
+
`}render(){if(!this._schema||!this._schema.properties){this.innerHTML=`
|
|
362
|
+
<div class="mu-schema-form-empty-state">
|
|
363
|
+
Set the <code>schema</code> property to generate a form
|
|
364
|
+
</div>
|
|
365
|
+
`;return}let $=this._schema.required||[],Z=Object.entries(this._schema.properties).map(([X,J])=>this._renderField(X,J,$.includes(X))).join("");this.innerHTML=`
|
|
366
|
+
<div class="mu-schema-form ${this.inline?"mu-schema-form-inline":""}">
|
|
367
|
+
${Z}
|
|
368
|
+
|
|
369
|
+
<div class="mu-schema-form-actions">
|
|
370
|
+
<mu-button variant="filled" data-action="submit" ${this.disabled?"disabled":""}>
|
|
371
|
+
${this.submitLabel}
|
|
372
|
+
</mu-button>
|
|
373
|
+
<mu-button variant="text" data-action="reset" ${this.disabled?"disabled":""}>
|
|
374
|
+
${this.resetLabel}
|
|
375
|
+
</mu-button>
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
`,this._attachEventListeners()}_attachEventListeners(){this.querySelectorAll("mu-input").forEach(($)=>{this.listen($,"mu-input",(Z)=>{let X=$.dataset.field;if(this._values[X]=Z.detail.value,this._touched[X]=!0,this._errors[X])delete this._errors[X],$.closest(".mu-schema-form-field").classList.remove("mu-schema-form-field-error"),$.closest(".mu-schema-form-field").querySelector(".mu-schema-form-error")?.remove();this.emit("mu-change",{field:X,value:Z.detail.value,values:this.getValues()},{bubbles:!0})})}),this.querySelectorAll("mu-textarea").forEach(($)=>{this.listen($,"mu-input",(Z)=>{let X=$.dataset.field;this._values[X]=Z.detail.value,this._touched[X]=!0,this.emit("mu-change",{field:X,value:Z.detail.value,values:this.getValues()},{bubbles:!0})})}),this.querySelectorAll("mu-dropdown").forEach(($)=>{this.listen($,"mu-change",(Z)=>{let X=$.dataset.field;this._values[X]=Z.detail.value,this._touched[X]=!0,this.emit("mu-change",{field:X,value:Z.detail.value,values:this.getValues()},{bubbles:!0})})}),this.querySelectorAll("mu-switch").forEach(($)=>{this.listen($,"mu-change",(Z)=>{let X=$.dataset.field;this._values[X]=Z.detail.checked,this._touched[X]=!0,this.emit("mu-change",{field:X,value:Z.detail.checked,values:this.getValues()},{bubbles:!0})})})}handleAction($,Z,X){if($==="submit")this.submit();else if($==="reset")this.reset()}}if(!customElements.get("mu-schema-form"))customElements.define("mu-schema-form",H6);class x6 extends z{static get observedAttributes(){return["placeholder","loading","disabled","multiline"]}static baseClass="mu-prompt-input";static cssFile="prompt-ui";constructor(){super();this._value=""}get placeholder(){return this.getAttribute("placeholder")||"Type a message..."}get loading(){return this.hasAttribute("loading")}set loading($){if($)this.setAttribute("loading","");else this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}get multiline(){return this.hasAttribute("multiline")}get value(){return this._value}set value($){this._value=$;let Z=this.querySelector(".mu-prompt-input-field");if(Z)Z.value=$}connectedCallback(){super.connectedCallback(),this.render()}attributeChangedCallback($,Z,X){if(this.isConnected&&Z!==X)this.render()}_submit(){if(this.loading||this.disabled||!this._value.trim())return;this.dispatchEvent(new CustomEvent("mu-submit",{bubbles:!0,detail:{value:this._value.trim()}}))}_handleKeydown($){if($.key==="Enter"&&!$.shiftKey&&!this.multiline)$.preventDefault(),this._submit();else if($.key==="Enter"&&$.metaKey)$.preventDefault(),this._submit()}render(){let $=this.multiline;this.innerHTML=`
|
|
379
|
+
<div class="mu-prompt-input-container ${this.loading?"mu-prompt-input-loading":""}">
|
|
380
|
+
${$?`<textarea class="mu-prompt-input-field" placeholder="${this.placeholder}" ${this.disabled?"disabled":""}></textarea>`:`<input class="mu-prompt-input-field" type="text" placeholder="${this.placeholder}" ${this.disabled?"disabled":""} />`}
|
|
381
|
+
<button class="mu-prompt-input-submit" ${this.disabled||this.loading?"disabled":""}>
|
|
382
|
+
${this.loading?'<div class="mu-prompt-input-spinner"></div>':'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>'}
|
|
383
|
+
</button>
|
|
384
|
+
</div>
|
|
385
|
+
`;let Z=this.querySelector(".mu-prompt-input-field"),X=this.querySelector(".mu-prompt-input-submit");Z.value=this._value,this.listen(Z,"input",(J)=>{this._value=J.target.value,this.dispatchEvent(new CustomEvent("mu-input",{bubbles:!0,detail:{value:this._value}}))}),this.listen(Z,"keydown",(J)=>this._handleKeydown(J)),this.listen(X,"click",()=>this._submit())}}class P6 extends z{static get observedAttributes(){return["language","filename"]}static baseClass="mu-code-block";constructor(){super()}get language(){return this.getAttribute("language")||"text"}get filename(){return this.getAttribute("filename")}connectedCallback(){super.connectedCallback(),this.render()}attributeChangedCallback($,Z,X){if(this.isConnected&&Z!==X)this.render()}async _copy(){let $=this.textContent.trim();try{await navigator.clipboard.writeText($);let Z=this.querySelector(".mu-code-block-copy-btn");Z.textContent="✓ Copied",this.setTimeout(()=>{Z.textContent="Copy"},2000)}catch(Z){console.error("Failed to copy:",Z)}}render(){let $=this.textContent.trim();this.innerHTML=`
|
|
386
|
+
<div class="mu-code-block-container">
|
|
387
|
+
<div class="mu-code-block-header">
|
|
388
|
+
${this.filename?`<span class="mu-code-block-filename">${this.filename}</span>`:`<span class="mu-code-block-language">${this.language}</span>`}
|
|
389
|
+
<button class="mu-code-block-copy-btn">Copy</button>
|
|
390
|
+
</div>
|
|
391
|
+
<pre class="mu-code-block-pre"><code>${V($)}</code></pre>
|
|
392
|
+
</div>
|
|
393
|
+
`,this.listen(this.querySelector(".mu-code-block-copy-btn"),"click",()=>this._copy())}}class B6 extends z{static get observedAttributes(){return["actions"]}static baseClass="mu-agent-toolbar";constructor(){super()}get actions(){let $=this.getAttribute("actions");return $?$.split(",").map((Z)=>Z.trim()):["copy","regenerate","thumbsUp","thumbsDown"]}connectedCallback(){super.connectedCallback(),this.render()}render(){let $={copy:{icon:"\uD83D\uDCCB",label:"Copy"},regenerate:{icon:"\uD83D\uDD04",label:"Regenerate"},thumbsUp:{icon:"\uD83D\uDC4D",label:"Good response"},thumbsDown:{icon:"\uD83D\uDC4E",label:"Poor response"},edit:{icon:"✏️",label:"Edit"},share:{icon:"↗️",label:"Share"}},Z=this.actions.filter((X)=>$[X]).map((X)=>`
|
|
394
|
+
<button class="mu-agent-toolbar-btn" data-action="${X}" title="${$[X].label}">
|
|
395
|
+
${$[X].icon}
|
|
396
|
+
</button>
|
|
397
|
+
`).join("");this.innerHTML=Z}handleAction($,Z,X){this.dispatchEvent(new CustomEvent("mu-action",{bubbles:!0,detail:{action:$}}))}}class O6 extends z{static get observedAttributes(){return["role","avatar","name","timestamp"]}static baseClass="mu-message-bubble";constructor(){super();this._originalContent=null}get role(){return this.getAttribute("role")||"user"}get avatar(){return this.getAttribute("avatar")}get name(){return this.getAttribute("name")||(this.role==="user"?"You":"Assistant")}get timestamp(){return this.getAttribute("timestamp")}connectedCallback(){if(super.connectedCallback(),!this._originalContent)this._originalContent=Array.from(this.childNodes);this.render()}attributeChangedCallback($,Z,X){if(this.isConnected&&Z!==X)this.render()}render(){let $=this.role==="user",Z=$?"\uD83D\uDC64":"\uD83E\uDD16",X=$?"mu-message-bubble-user":"mu-message-bubble-assistant",J=document.createElement("div");J.className=`mu-message-bubble-message ${X}`;let Q=document.createElement("div");if(Q.className=`mu-message-bubble-avatar ${X}`,this.avatar){let W=document.createElement("img");W.src=this.avatar,W.alt=this.name,Q.appendChild(W)}else Q.textContent=Z;J.appendChild(Q);let Y=document.createElement("div");Y.className="mu-message-bubble-content";let G=document.createElement("div");G.className=`mu-message-bubble-header ${X}`;let K=document.createElement("span");if(K.className="mu-message-bubble-name",K.textContent=this.name,G.appendChild(K),this.timestamp){let W=document.createElement("span");W.className="mu-message-bubble-timestamp",W.textContent=this.timestamp,G.appendChild(W)}Y.appendChild(G);let U=document.createElement("div");if(U.className=`mu-message-bubble-bubble ${X}`,this._originalContent)this._originalContent.forEach((W)=>U.appendChild(W.cloneNode(!0)));Y.appendChild(U),J.appendChild(Y),this.innerHTML="",this.appendChild(J)}}if(!customElements.get("mu-prompt-input"))customElements.define("mu-prompt-input",x6);if(!customElements.get("mu-code-block"))customElements.define("mu-code-block",P6);if(!customElements.get("mu-agent-toolbar"))customElements.define("mu-agent-toolbar",B6);if(!customElements.get("mu-message-bubble"))customElements.define("mu-message-bubble",O6);var Z0=[];function w6(){return[...Z0]}function N6(){Z0.length=0}class R6 extends z{static baseClass="mu-error-boundary";static observedAttributes=["fallback"];#$=!1;#Z=null;#X="";connectedCallback(){super.connectedCallback(),this.#X=this.innerHTML,this.listen(this,"error",this.#Y.bind(this)),this.#J()}#J(){let $=window.onerror;window.onerror=(Z,X,J,Q,Y)=>{if(this.#Q(Y))return this.#Y({detail:{error:Y,message:Z}}),!0;if($)return $(Z,X,J,Q,Y);return!1}}#Q($){if(!$?.stack)return!1;return Array.from(this.querySelectorAll("*")).filter((X)=>X.tagName.startsWith("MU-")).map((X)=>X.tagName.toLowerCase()).some((X)=>$.stack.includes(X))}#Y($){let Z=$?.detail?.error||$?.error||$;if(this.#$)return;if(this.#$=!0,this.#Z=Z,Z0.push({timestamp:Date.now(),component:this.id||"mu-error-boundary",error:{message:Z?.message||String(Z),stack:Z?.stack,name:Z?.name},context:{originalContent:this.#X.slice(0,200),parentUrl:window.location.href}}),Z0.length>50)Z0.shift();this.#G(),this.emit("mu-error",{error:Z,boundary:this,recover:()=>this.recover()}),$?.stopPropagation?.()}#G(){let $=this.getAttribute("fallback");if($)this.innerHTML=$;else this.innerHTML=`
|
|
398
|
+
<div class="mu-error-boundary__fallback" role="alert" aria-live="polite">
|
|
399
|
+
<mu-icon name="error" style="--mu-icon-size: 48px; color: var(--md-sys-color-error);"></mu-icon>
|
|
400
|
+
<p class="mu-error-boundary__title">Something went wrong</p>
|
|
401
|
+
<p class="mu-error-boundary__message">${this.#Z?.message||"An unexpected error occurred"}</p>
|
|
402
|
+
<mu-button variant="outlined" onclick="this.closest('mu-error-boundary').recover()">
|
|
403
|
+
Try Again
|
|
404
|
+
</mu-button>
|
|
405
|
+
</div>
|
|
406
|
+
`;this.classList.add("has-error")}render(){this.style.display="block"}recover(){this.#$=!1,this.#Z=null,this.classList.remove("has-error"),this.innerHTML=this.#X,this.emit("mu-recover")}get hasError(){return this.#$}get error(){return this.#Z}}_("mu-error-boundary",R6);class T6 extends z{static baseClass="mu-code";static observedAttributes=["language"];#$=null;connectedCallback(){if(super.connectedCallback(),!this.#$&&!this.querySelector(".mu-code__content"))this.#$=this.textContent}render(){if(this.querySelector(".mu-code__content"))return;let $=this.attr("language","html"),Z=this.#$||this.innerHTML,X=document.createElement("div");X.innerHTML=Z;let J=X.textContent,Q=this.#X(J),Y=this.#J(Q,$),G=Y,K=Y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),U=this.#Z(K,$);this.innerHTML=`
|
|
407
|
+
<div class="mu-code__header">
|
|
408
|
+
<span class="mu-code__language">${$.toUpperCase()}</span>
|
|
409
|
+
<button class="mu-code__copy" title="Copy code">
|
|
410
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
411
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
|
412
|
+
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/>
|
|
413
|
+
</svg>
|
|
414
|
+
</button>
|
|
415
|
+
</div>
|
|
416
|
+
<pre class="mu-code__pre"><code class="mu-code__content">${U}</code></pre>
|
|
417
|
+
`,this.#Q(),this.#Y(G)}#Z($,Z){let X=()=>{let J=[],Q=0;return{addMarker:(K,U)=>{let W=Q++,D=String.fromCharCode(57600+W),q=String.fromCharCode(57344),F=String.fromCharCode(57345),A=q+D+F;return J.push({marker:A,content:K,className:U}),A},resolveMarkers:(K)=>{for(let{marker:U,content:W,className:D}of J)K=K.replace(U,`<span class="${D}">${W}</span>`);return K}}};if(Z==="html"||Z==="xml"){let{addMarker:J,resolveMarkers:Q}=X(),Y=$;return Y=Y.replace(/(<!--[\s\S]*?-->)/g,(G)=>J(G,"mu-code__comment")),Y=Y.replace(/(<!DOCTYPE[^&]*>)/gi,(G)=>J(G,"mu-code__keyword")),Y=Y.replace(/("[^"]*")/g,(G)=>J(G,"mu-code__string")),Y=Y.replace(/(\s)([\w-]+)(=)/g,(G,K,U,W)=>`${K}${J(U,"mu-code__attr")}${W}`),Y=Y.replace(/(<\/?)([\w-]+)/g,(G,K,U)=>`${K}${J(U,"mu-code__tag")}`),Q(Y)}if(Z==="javascript"||Z==="js"||Z==="typescript"||Z==="ts"){let{addMarker:J,resolveMarkers:Q}=X(),Y=$;return Y=Y.replace(/(\/\*[\s\S]*?\*\/)/g,(G)=>J(G,"mu-code__comment")),Y=Y.replace(/(\/\/.*)/g,(G)=>J(G,"mu-code__comment")),Y=Y.replace(/(`[^`]*`)/g,(G)=>J(G,"mu-code__string")),Y=Y.replace(/('[^']*'|"[^"]*")/g,(G)=>J(G,"mu-code__string")),Y=Y.replace(/\b(\d+\.?\d*(?:e[+-]?\d+)?)\b/gi,(G)=>J(G,"mu-code__number")),Y=Y.replace(/\b(const|let|var|function|return|if|else|for|while|do|switch|case|break|continue|class|extends|import|export|from|default|async|await|new|this|super|typeof|instanceof|in|of|try|catch|finally|throw|yield|static|get|set)\b/g,(G)=>J(G,"mu-code__keyword")),Y=Y.replace(/\b(true|false|null|undefined|NaN|Infinity)\b/g,(G)=>J(G,"mu-code__builtin")),Y=Y.replace(/\b([a-zA-Z_]\w*)\s*(?=\()/g,(G,K)=>J(K,"mu-code__function")),Q(Y)}if(Z==="css"||Z==="scss"||Z==="sass"){let{addMarker:J,resolveMarkers:Q}=X(),Y=$;return Y=Y.replace(/(\/\*[\s\S]*?\*\/)/g,(G)=>J(G,"mu-code__comment")),Y=Y.replace(/('[^']*'|"[^"]*")/g,(G)=>J(G,"mu-code__string")),Y=Y.replace(/(@[\w-]+)/g,(G)=>J(G,"mu-code__keyword")),Y=Y.replace(/\b(\d+\.?\d*)(px|em|rem|%|vh|vw|s|ms|deg|fr)\b/g,(G,K,U)=>`${J(K,"mu-code__number")}${J(U,"mu-code__builtin")}`),Y=Y.replace(/\b(\d+\.?\d*)\b/g,(G)=>J(G,"mu-code__number")),Y=Y.replace(/(#[0-9a-fA-F]{3,8})\b/g,(G)=>J(G,"mu-code__string")),Y=Y.replace(/\b([\w-]+)\s*:/g,(G,K)=>`${J(K,"mu-code__attr")}:`),Y=Y.replace(/(^|[{,\s])([.#]?[\w-]+)(?=\s*[{,])/gm,(G,K,U)=>`${K}${J(U,"mu-code__tag")}`),Q(Y)}if(Z==="json"){let{addMarker:J,resolveMarkers:Q}=X(),Y=$;return Y=Y.replace(/("[^"]*")\s*:/g,(G,K)=>`${J(K,"mu-code__attr")}:`),Y=Y.replace(/:\s*("[^"]*")/g,(G,K)=>`: ${J(K,"mu-code__string")}`),Y=Y.replace(/:\s*(-?\d+\.?\d*)/g,(G,K)=>`: ${J(K,"mu-code__number")}`),Y=Y.replace(/\b(true|false|null)\b/g,(G)=>J(G,"mu-code__builtin")),Q(Y)}if(Z==="bash"||Z==="sh"||Z==="shell"){let{addMarker:J,resolveMarkers:Q}=X(),Y=$;return Y=Y.replace(/(#.*)/g,(G)=>J(G,"mu-code__comment")),Y=Y.replace(/('[^']*'|"[^"]*")/g,(G)=>J(G,"mu-code__string")),Y=Y.replace(/(\$\{?\w+\}?)/g,(G)=>J(G,"mu-code__attr")),Y=Y.replace(/\b(cd|ls|echo|cat|grep|find|sudo|npm|npx|bun|node|git|curl|wget|mkdir|rm|cp|mv|chmod|chown)\b/g,(G)=>J(G,"mu-code__keyword")),Y=Y.replace(/(\s)(--?[\w-]+)/g,(G,K,U)=>`${K}${J(U,"mu-code__builtin")}`),Q(Y)}return $}#X($){let Z=$.split(`
|
|
418
|
+
`);while(Z.length>0&&Z[0].trim()==="")Z.shift();while(Z.length>0&&Z[Z.length-1].trim()==="")Z.pop();if(Z.length===0)return"";let X=1/0;for(let J of Z){if(J.trim()==="")continue;let Q=J.match(/^(\s*)/),Y=Q?Q[1].length:0;X=Math.min(X,Y)}if(X===1/0||X===0)return Z.join(`
|
|
419
|
+
`);return Z.map((J)=>{if(J.trim()==="")return"";return J.slice(X)}).join(`
|
|
420
|
+
`)}#J($,Z){let J=$.split(`
|
|
421
|
+
`),Q=[],Y=0;for(let G=0;G<J.length;G++){let K=J[G].trim();if(K===""){Q.push("");continue}let U=0,W=0;if(Z==="html"){let q=(K.match(/<[a-zA-Z][^>]*(?<!\/)\s*>/g)||[]).length,F=(K.match(/<\/[^>]+>/g)||[]).length,A=(K.match(/<[^>]+\/>/g)||[]).length;U=q-A,W=F}else{let q=!1,F="";for(let A=0;A<K.length;A++){let H=K[A],v0=A>0?K[A-1]:"";if((H==='"'||H==="'"||H==="`")&&v0!=="\\"){if(!q)q=!0,F=H;else if(H===F)q=!1}if(!q){if(H==="{"||H==="["||H==="(")U++;if(H==="}"||H==="]"||H===")")W++}}}if((Z==="html"?K.startsWith("</"):/^[}\]\)]/.test(K))&&W>0)Y=Math.max(0,Y-1),W--;Q.push(" ".repeat(Y)+K),Y=Math.max(0,Y+U-W)}return Q.join(`
|
|
422
|
+
`)}#Q(){if(this.style.display="block",this.style.background="var(--md-sys-color-surface-container-highest)",this.closest("mu-example"))this.style.borderTopLeftRadius="0",this.style.borderTopRightRadius="0",this.style.borderBottomLeftRadius="var(--md-sys-shape-corner-medium)",this.style.borderBottomRightRadius="var(--md-sys-shape-corner-medium)";else this.style.borderRadius="var(--md-sys-shape-corner-medium)";this.style.overflow="hidden",this.style.fontFamily="'Fira Code', 'Consolas', monospace",this.style.fontSize="13px";let Z=this.querySelector(".mu-code__header");if(Z)Z.style.display="flex",Z.style.justifyContent="space-between",Z.style.alignItems="center",Z.style.padding="8px 16px",Z.style.background="var(--md-sys-color-surface-container)",Z.style.borderBottom="1px solid var(--md-sys-color-outline-variant)";let X=this.querySelector(".mu-code__language");if(X)X.style.fontSize="11px",X.style.fontWeight="600",X.style.color="var(--md-sys-color-primary)",X.style.letterSpacing="0.5px";let J=this.querySelector(".mu-code__copy");if(J)J.style.background="transparent",J.style.border="none",J.style.cursor="pointer",J.style.color="var(--md-sys-color-on-surface-variant)",J.style.padding="4px",J.style.borderRadius="4px",J.style.display="flex",J.style.transition="all 0.2s ease";let Q=this.querySelector(".mu-code__pre");if(Q)Q.style.margin="0",Q.style.padding="16px",Q.style.overflow="auto",Q.style.maxHeight="400px";let Y=this.querySelector(".mu-code__content");if(Y)Y.style.color="var(--md-sys-color-on-surface)";let G=document.createElement("style");G.textContent=`
|
|
423
|
+
.mu-code__tag { color: var(--md-sys-color-primary); }
|
|
424
|
+
.mu-code__attr { color: var(--md-sys-color-tertiary); }
|
|
425
|
+
.mu-code__string { color: var(--md-sys-color-secondary); }
|
|
426
|
+
.mu-code__keyword { color: var(--md-sys-color-primary); font-weight: 500; }
|
|
427
|
+
.mu-code__comment { color: var(--md-sys-color-outline); font-style: italic; }
|
|
428
|
+
.mu-code__number { color: var(--md-sys-color-error); }
|
|
429
|
+
.mu-code__function { color: var(--md-sys-color-tertiary); }
|
|
430
|
+
.mu-code__builtin { color: var(--md-sys-color-primary); font-weight: 500; }
|
|
431
|
+
.mu-code__copy:hover {
|
|
432
|
+
background: var(--md-sys-color-primary-container) !important;
|
|
433
|
+
color: var(--md-sys-color-on-primary-container) !important;
|
|
434
|
+
}
|
|
435
|
+
.mu-code__copy:active {
|
|
436
|
+
background: var(--md-sys-color-primary) !important;
|
|
437
|
+
color: var(--md-sys-color-on-primary) !important;
|
|
438
|
+
transform: scale(0.95);
|
|
439
|
+
}
|
|
440
|
+
.mu-code__copy.copied {
|
|
441
|
+
background: #c8e6c9 !important;
|
|
442
|
+
color: #1b5e20 !important;
|
|
443
|
+
}
|
|
444
|
+
`;let K=document.getElementById("mu-code-styles");if(K)K.remove();G.id="mu-code-styles",document.head.appendChild(G)}#Y($){let Z=this.querySelector(".mu-code__copy");if(Z)this.listen(Z,"click",async()=>{try{await navigator.clipboard.writeText($.trim()),Z.classList.add("copied"),Z.innerHTML=`
|
|
445
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
446
|
+
<polyline points="20 6 9 17 4 12"/>
|
|
447
|
+
</svg>
|
|
448
|
+
`,this.setTimeout(()=>{Z.classList.remove("copied"),Z.innerHTML=`
|
|
449
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
450
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
|
451
|
+
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/>
|
|
452
|
+
</svg>
|
|
453
|
+
`},2000)}catch(X){console.error("Copy failed:",X)}})}}_("mu-code",T6);class S6 extends z{static baseClass="mu-api-table";static observedAttributes=["type"];render(){let $=this.attr("type","attributes"),Z=Array.from(this.querySelectorAll("mu-api-row")),X={attributes:["Name","Type","Default","Description"],properties:["Name","Type","Description"],methods:["Name","Signature","Description"],events:["Name","Detail","Description"],tokens:["Token","Default","Description"]},J=X[$]||X.attributes,Q=Z.map((Y)=>({name:Y.getAttribute("name")||"",type:Y.getAttribute("type")||"",default:Y.getAttribute("default")||"-",signature:Y.getAttribute("signature")||"",detail:Y.getAttribute("detail")||"",description:Y.textContent.trim()}));this.innerHTML=`
|
|
454
|
+
<table class="mu-api-table__table">
|
|
455
|
+
<thead>
|
|
456
|
+
<tr>
|
|
457
|
+
${J.map((Y)=>`<th>${Y}</th>`).join("")}
|
|
458
|
+
</tr>
|
|
459
|
+
</thead>
|
|
460
|
+
<tbody>
|
|
461
|
+
${Q.map((Y)=>this.#$($,Y)).join("")}
|
|
462
|
+
</tbody>
|
|
463
|
+
</table>
|
|
464
|
+
`,this.#Z()}#$($,Z){let X={name:V(Z.name),type:V(Z.type),default:V(Z.default),signature:V(Z.signature),detail:V(Z.detail),description:V(Z.description)};switch($){case"attributes":return`<tr>
|
|
465
|
+
<td><code>${X.name}</code></td>
|
|
466
|
+
<td><code class="type">${X.type}</code></td>
|
|
467
|
+
<td><code class="default">${X.default}</code></td>
|
|
468
|
+
<td>${X.description}</td>
|
|
469
|
+
</tr>`;case"properties":return`<tr>
|
|
470
|
+
<td><code>${X.name}</code></td>
|
|
471
|
+
<td><code class="type">${X.type}</code></td>
|
|
472
|
+
<td>${X.description}</td>
|
|
473
|
+
</tr>`;case"methods":return`<tr>
|
|
474
|
+
<td><code>${X.name}</code></td>
|
|
475
|
+
<td><code class="signature">${X.signature}</code></td>
|
|
476
|
+
<td>${X.description}</td>
|
|
477
|
+
</tr>`;case"events":return`<tr>
|
|
478
|
+
<td><code>${X.name}</code></td>
|
|
479
|
+
<td><code class="detail">${X.detail}</code></td>
|
|
480
|
+
<td>${X.description}</td>
|
|
481
|
+
</tr>`;case"tokens":return`<tr>
|
|
482
|
+
<td><code>${X.name}</code></td>
|
|
483
|
+
<td><code class="default">${X.default}</code></td>
|
|
484
|
+
<td>${X.description}</td>
|
|
485
|
+
</tr>`;default:return""}}#Z(){this.style.display="block",this.style.overflowX="auto",this.style.marginBottom="24px";let $=this.querySelector(".mu-api-table__table");if($)$.style.width="100%",$.style.borderCollapse="collapse",$.style.fontSize="var(--md-sys-typescale-body-medium-size)";this.querySelectorAll("th").forEach((G)=>{G.style.textAlign="left",G.style.padding="16px",G.style.height="56px",G.style.background="var(--md-sys-color-surface-container)",G.style.fontWeight="500",G.style.color="var(--md-sys-color-on-surface)",G.style.borderBottom="1px solid var(--md-sys-color-outline-variant)"}),this.querySelectorAll("td").forEach((G)=>{G.style.padding="16px",G.style.minHeight="52px",G.style.borderBottom="1px solid var(--md-sys-color-outline-variant)",G.style.verticalAlign="middle",G.style.lineHeight="1.5"}),this.querySelectorAll("code").forEach((G)=>{G.style.fontFamily="'Fira Code', monospace",G.style.fontSize="13px",G.style.padding="2px 6px",G.style.borderRadius="4px",G.style.background="var(--md-sys-color-surface-container-highest)"}),this.querySelectorAll("code.type, code.detail").forEach((G)=>{G.style.color="var(--md-sys-color-primary)"}),this.querySelectorAll("code.default").forEach((G)=>{G.style.color="var(--md-sys-color-secondary)"})}}class y6 extends z{static baseClass="mu-api-row";static observedAttributes=["name","type","default","signature","detail"];render(){}}_("mu-api-table",S6);_("mu-api-row",y6);class k6 extends z{static baseClass="mu-example";static observedAttributes=["title"];#$=!1;render(){let $=this.attr("title","Example"),Z=this.querySelector('[slot="demo"]'),X=this.querySelector('[slot="code"]'),J=Z?Z.innerHTML:"",Q=X?X.textContent:Z?Z.innerHTML:"";if(Z)Z.remove();if(X)X.remove();let Y=this.#Z(Q),G=V(Y);this.innerHTML=`
|
|
486
|
+
<div class="mu-example__card">
|
|
487
|
+
<div class="mu-example__header">
|
|
488
|
+
<span class="mu-example__title">${$}</span>
|
|
489
|
+
<div class="mu-example__actions">
|
|
490
|
+
<button class="mu-example__btn" data-action="link" title="Copy link">
|
|
491
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
492
|
+
<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/>
|
|
493
|
+
<path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>
|
|
494
|
+
</svg>
|
|
495
|
+
</button>
|
|
496
|
+
<button class="mu-example__btn" data-action="code" title="View source">
|
|
497
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
498
|
+
<polyline points="16 18 22 12 16 6"/>
|
|
499
|
+
<polyline points="8 6 2 12 8 18"/>
|
|
500
|
+
</svg>
|
|
501
|
+
</button>
|
|
502
|
+
</div>
|
|
503
|
+
</div>
|
|
504
|
+
<div class="mu-example__demo">
|
|
505
|
+
${J}
|
|
506
|
+
</div>
|
|
507
|
+
<div class="mu-example__code" style="display: none;">
|
|
508
|
+
<mu-code language="html">${G}</mu-code>
|
|
509
|
+
</div>
|
|
510
|
+
</div>
|
|
511
|
+
`,this.#X()}#Z($){let Z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),X=new Set(["a","abbr","b","bdo","br","cite","code","dfn","em","i","kbd","q","s","samp","small","span","strong","sub","sup","u","var"]),J="",Q=0,Y=" ",K=$.replace(/>\s+</g,"><").replace(/\s+/g," ").trim().split(/(<[^>]+>)/g).filter((U)=>U.trim());for(let U=0;U<K.length;U++){let W=K[U].trim();if(!W)continue;let D=W.startsWith("<"),q=W.startsWith("</"),F=W.endsWith("/>")||D&&Z.has(W.match(/<\/?(\w+)/)?.[1]?.toLowerCase());if(q)Q=Math.max(0,Q-1);let A=D?W.match(/<\/?(\w+)/)?.[1]?.toLowerCase():null,H=A&&X.has(A);if(D)if(!H||q){if(J&&!J.endsWith(`
|
|
512
|
+
`))J+=`
|
|
513
|
+
`;J+=Y.repeat(Q)+W}else J+=W;else J+=W;if(D&&!q&&!F&&!H)Q++}return J.trim()}#X(){this.style.display="block",this.style.marginBottom="24px";let $=this.querySelector(".mu-example__card");if($)$.style.background="var(--md-sys-color-surface)",$.style.border="1px solid var(--md-sys-color-outline-variant)",$.style.borderRadius="var(--md-sys-shape-corner-large)";let Z=this.querySelector(".mu-example__header");if(Z)Z.style.display="flex",Z.style.justifyContent="space-between",Z.style.alignItems="center",Z.style.padding="12px 16px",Z.style.borderBottom="1px solid var(--md-sys-color-outline-variant)",Z.style.background="var(--md-sys-color-surface-container-low)",Z.style.borderRadius="var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large) 0 0";let X=this.querySelector(".mu-example__title");if(X)X.style.fontWeight="500",X.style.fontSize="var(--md-sys-typescale-title-small-size)",X.style.color="var(--md-sys-color-on-surface)",X.style.minWidth="0",X.style.overflow="hidden",X.style.textOverflow="ellipsis",X.style.whiteSpace="nowrap";let J=this.querySelector(".mu-example__actions");if(J)J.style.display="flex",J.style.gap="4px";this.querySelectorAll(".mu-example__btn").forEach((W)=>{W.style.background="transparent",W.style.border="none",W.style.cursor="pointer",W.style.padding="8px",W.style.borderRadius="50%",W.style.color="var(--md-sys-color-on-surface-variant)",W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="center",W.style.transition="all 0.2s ease"});let Y=this.querySelector(".mu-example__demo");if(Y){Y.style.boxSizing="border-box",Y.style.width="100%",Y.style.maxWidth="100%",Y.style.padding="24px",Y.style.display="flex",Y.style.flexWrap="wrap",Y.style.gap="16px",Y.style.alignItems="center",Y.style.justifyContent="flex-start";let W=new Set(["MU-STACK","MU-GRID","MU-LAYOUT"]);Array.from(Y.children).forEach((D)=>{if(!W.has(D.tagName))D.style.flexShrink="0"})}let G=this.querySelector(".mu-example__code");if(G)G.style.borderTop="1px solid var(--md-sys-color-outline-variant)";let K=this.querySelector(".mu-example__code mu-code");if(K){K.style.borderTopLeftRadius="0",K.style.borderTopRightRadius="0",K.style.maxHeight="400px",K.style.overflow="auto";let W=K.querySelector(".mu-code__header");if(W)W.style.borderRadius="0"}let U=document.createElement("style");if(U.textContent=`
|
|
514
|
+
.mu-example__btn:hover {
|
|
515
|
+
background: var(--md-sys-color-surface-container-high) !important;
|
|
516
|
+
color: var(--md-sys-color-primary) !important;
|
|
517
|
+
}
|
|
518
|
+
.mu-example__btn.active {
|
|
519
|
+
background: var(--md-sys-color-primary-container) !important;
|
|
520
|
+
color: var(--md-sys-color-on-primary-container) !important;
|
|
521
|
+
}
|
|
522
|
+
`,!document.querySelector("#mu-example-styles"))U.id="mu-example-styles",document.head.appendChild(U)}handleAction($,Z,X){if($==="code"){let J=this.querySelector(".mu-example__code");if(J){if(this.#$=!this.#$,J.style.display=this.#$?"block":"none",Z.classList.toggle("active",this.#$),this.#$)requestAnimationFrame(()=>{requestAnimationFrame(()=>{let Q=this.closest(".mu-layout-main")||document.querySelector(".mu-layout-main")||document.documentElement,Y=J.getBoundingClientRect(),G=Q.getBoundingClientRect?.()||{top:0,bottom:window.innerHeight};if(Y.bottom>G.bottom){let K=Y.bottom-G.bottom+20;Q.scrollBy({top:K,behavior:"smooth"})}})})}}else if($==="link")this.#J(Z)}async#J($){let Z=window.location.href;try{await navigator.clipboard.writeText(Z),$.style.color="var(--md-sys-color-primary)",this.setTimeout(()=>{$.style.color=""},2000)}catch(X){console.error("Copy failed:",X)}}}_("mu-example",k6);class E6 extends z{static baseClass="mu-doc-page";static observedAttributes=["title","selector","description"];#$=0;connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>this.#Z())}render(){let $=this.attr("title","Component"),Z=this.attr("selector",""),X=this.attr("description",""),J=this.querySelector('[slot="overview"]'),Q=this.querySelector('[slot="api"]'),Y=this.querySelector('[slot="styling"]'),G=this.querySelector('[slot="examples"]'),K=J?J.innerHTML:"",U=Q?Q.innerHTML:"",W=Y?Y.innerHTML:"",D=G?G.innerHTML:"";this.innerHTML=`
|
|
523
|
+
<h1 class="page-title">${$}</h1>
|
|
524
|
+
<p class="page-subtitle">
|
|
525
|
+
${Z?`<code><${Z}></code> `:""}${X}
|
|
526
|
+
</p>
|
|
527
|
+
|
|
528
|
+
<mu-tabs active="0" class="mu-doc-page__tabs" style="margin-bottom: 24px;">
|
|
529
|
+
<mu-tab>OVERVIEW</mu-tab>
|
|
530
|
+
<mu-tab>API</mu-tab>
|
|
531
|
+
<mu-tab>STYLING</mu-tab>
|
|
532
|
+
<mu-tab>EXAMPLES</mu-tab>
|
|
533
|
+
</mu-tabs>
|
|
534
|
+
|
|
535
|
+
<div class="mu-doc-page__content mu-doc-page__overview">
|
|
536
|
+
${K}
|
|
537
|
+
</div>
|
|
538
|
+
<div class="mu-doc-page__content mu-doc-page__api" style="display: none;">
|
|
539
|
+
${U}
|
|
540
|
+
</div>
|
|
541
|
+
<div class="mu-doc-page__content mu-doc-page__styling" style="display: none;">
|
|
542
|
+
${W}
|
|
543
|
+
</div>
|
|
544
|
+
<div class="mu-doc-page__content mu-doc-page__examples" style="display: none;">
|
|
545
|
+
${D}
|
|
546
|
+
</div>
|
|
547
|
+
`,this.style.display="block"}#Z(){let $=this.querySelector(".mu-doc-page__tabs"),Z=this.querySelectorAll(".mu-doc-page__content");if($)this.listen($,"mu-tab-change",(X)=>{this.#$=X.detail.index,Z.forEach((J,Q)=>{J.style.display=Q===this.#$?"block":"none"})})}}_("mu-doc-page",E6);if(!P.hasListeners(O.TOAST_SHOW))P.on(O.TOAST_SHOW,($)=>{I0.show($.message,$)});if(typeof window<"u")window.microUI={signal:p,computed:u,effect:D0,batch:Z1,Theme:f,bus:P,UIEvents:O,showToast:d0,createStore:o,appStore:n,Router:e0,http:$1,HttpError:g,createFormState:X1,getFormValues:J1,AgentAPI:K1,getMuComponentTree:c,describeComponent:V0,findByLabel:A0,getRegisteredComponents:F0,createNamespacedStore:_0,getStore:i0,getAllStores:o0,captureAppState:n0,restoreAppState:s0,getStateHistory:r0,enableObservability:t0,disableObservability:a0,FeatureRegistry:W1,createFeature:B0,getFeatures:O0,getFeature:w0,getFeatureComponents:N0,getFeatureSummary:R0,getErrors:w6,clearErrors:N6,ComponentSchema:U1,getComponentSchema:T0,getAllSchemas:S0,getSchemaComponents:y0,getSchemaQuickRef:k0,enableVisualMarkers:L0,disableVisualMarkers:r,getMarkerMap:x0,getMarkerElement:H0,getMCPActions:P0,muConfirm:U6};export{a6 as yieldToMain,R4 as transitionNamed,q1 as transition,H1 as throttle,j1 as supportsViewTransitions,V1 as supportsScheduler,p as signal,d0 as showToast,M0 as scheduler,F1 as scheduleTask,k4 as runImmediate,y4 as runBackground,s0 as restoreAppState,S4 as processWithYield,I4 as processInChunks,T4 as navigateWithTransition,U6 as muConfirm,E4 as memo,_1 as keyboard,t6 as injectLayerTokens,$1 as http,i0 as getStore,r0 as getStateHistory,k0 as getSchemaQuickRef,y0 as getSchemaComponents,F0 as getRegisteredComponents,c as getMuComponentTree,x0 as getMarkerMap,H0 as getMarkerElement,P0 as getMCPActions,J1 as getFormValues,O0 as getFeatures,R0 as getFeatureSummary,N0 as getFeatureComponents,w0 as getFeature,w6 as getErrors,T0 as getComponentSchema,o0 as getAllStores,S0 as getAllSchemas,A0 as findByLabel,V as escapeHTML,L0 as enableVisualMarkers,t0 as enableObservability,D0 as effect,C4 as domBatch,r as disableVisualMarkers,a0 as disableObservability,V0 as describeComponent,_ as define,L1 as debounce,M4 as createVisibilityObserver,o as createStore,k as createRipple,_0 as createNamespacedStore,X1 as createFormState,B0 as createFeature,u as computed,N6 as clearErrors,n0 as captureAppState,P as bus,C as breakpoints,Z1 as batch,i6 as attachRipple,n as appStore,A1 as afterPaint,r6 as Z_INDEX,O as UIEvents,I0 as Toast,f as Theme,e0 as Router,L4 as RippleMixin,q6 as MuVirtualList,Z6 as MuTr,W6 as MuTooltip,K6 as MuToast,j6 as MuThemeToggle,e1 as MuThead,X6 as MuTh,b1 as MuTextarea,J6 as MuTd,$6 as MuTbody,o1 as MuTabs,a1 as MuTable,n1 as MuTab,p1 as MuSwitch,x1 as MuStack,G6 as MuSpinner,Y6 as MuSkeleton,S1 as MuSidebarItem,T1 as MuSidebar,H6 as MuSchemaForm,_6 as MuRouter,F6 as MuRepeat,u1 as MuRadioGroup,c1 as MuRadio,x6 as MuPromptInput,t1 as MuProgress,D6 as MuPage,g1 as MuOption,N1 as MuNavbarLinks,w1 as MuNavbarBrand,R1 as MuNavbarActions,O1 as MuNavbar,a as MuNavItem,d as MuModal,O6 as MuMessageBubble,V6 as MuLazy,k1 as MuLayout,v1 as MuInput,M1 as MuIcon,P1 as MuGrid,f1 as MuForm,A6 as MuFetch,k6 as MuExample,R6 as MuErrorBoundary,z as MuElement,h1 as MuDropdown,a as MuDrawerItem,E1 as MuDrawer,E6 as MuDocPage,y1 as MuDivider,L6 as MuDataTable,B1 as MuContainer,z6 as MuConfirm,P6 as MuCodeBlock,T6 as MuCode,d1 as MuChip,m1 as MuCheckbox,l1 as MuCard,i1 as MuCallout,I1 as MuButton,C1 as MuBottomNav,r1 as MuBadge,Q6 as MuAvatar,S6 as MuApiTable,y6 as MuApiRow,s1 as MuAlert,B6 as MuAgentToolbar,z1 as KeyboardManager,v4 as IconNames,g as HttpError,W1 as FeatureRegistry,U1 as ComponentSchema,D1 as BreakpointObserver,E0 as BREAKPOINTS,K1 as AgentAPI};
|
|
548
|
+
|
|
549
|
+
//# debugId=0E06B0D82083FD5F64756E2164756E21
|