@kabmo-labs/kabmo 0.34.0 → 0.35.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/dist/client/index.html +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/static/js/{CsvGrid-vze4m5ag.js → CsvGrid-0amzgtd7.js} +2 -2
- package/dist/client/static/js/{DocxView-jbf21gmh.js → DocxView-bxjhzxe9.js} +3 -3
- package/dist/client/static/js/{DrawioView-b52qybx5.js → DrawioView-7s1yqsf4.js} +2 -2
- package/dist/client/static/js/{ImageView-mdgzj8px.js → ImageView-ycfbn66h.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-3c49dvtt.js → LayoutWrapper-tw1q1x0g.js} +2 -2
- package/dist/client/static/js/{Modal-sqp864vd.js → Modal-wqjactyd.js} +16 -16
- package/dist/client/static/js/{PdfView-g06rxqb1.js → PdfView-x6dmtwvr.js} +1 -1
- package/dist/client/static/js/{SessionsView-521adxyr.js → SessionsView-t85wq0me.js} +1 -1
- package/dist/client/static/js/{SheetView-h8xmsz7q.js → SheetView-n52nvz8s.js} +13 -13
- package/dist/client/static/js/{SvgPreview-1j4jvcvz.js → SvgPreview-59z7syme.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-pasxh4b6.js → abnfDiagram-O67JEVCF-91gnt049.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-bajpnvy7.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ms14g0bm.js → architectureDiagram-NJMV4G6O-5b9qtff2.js} +3 -3
- package/dist/client/static/js/{astro-80bs6hvg.js → astro-31cbyw7b.js} +1 -1
- package/dist/client/static/js/bash-0h36tk0k.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-ycn78fcq.js → blockDiagram-BEXU5L5S-6f23fjkn.js} +3 -3
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-vn2gpjfm.js → c4Diagram-YGBWAQC7-76t6d3am.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fyrm1pr5.js → classDiagram-v2-NBCMYWYE-f9tb19xm.js} +3 -3
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-ea5nwvgq.js → cose-bilkent-JH36ORCC-t6nwrbwj.js} +1 -1
- package/dist/client/static/js/cpp-4wp9sy20.js +1 -0
- package/dist/client/static/js/css-c9nsbkh6.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-8q9e90m8.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-j6bsjpre.js → cynefinDiagram-VND7K2PF-69gc244j.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-4smdkwv8.js → dagre-6A5THRUB-54bry3ey.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-9sm4kqwc.js → diagram-22UHCM2B-gfkebye6.js} +5 -5
- package/dist/client/static/js/{diagram-3UASUU5V-2h3qxaed.js → diagram-3UASUU5V-a1mr319f.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-1981bc94.js → diagram-ATOU4E4O-tkyk0qbe.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-3vgsxavc.js → diagram-CDSNMT55-np0hc9m2.js} +2 -2
- package/dist/client/static/js/{diagram-MLGK6HIB-c9gf2r3f.js → diagram-MLGK6HIB-nh06fshp.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-gjqeq92d.js → diagram-MPIPVDR6-27q2veks.js} +1 -1
- package/dist/client/static/js/{dockerfile-8v935dkn.js → dockerfile-4rtt6c0f.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-4vbsgh99.js → ebnfDiagram-ZINNZB2B-x9p9jqe8.js} +1 -1
- package/dist/client/static/js/{elixir-vcbg60wv.js → elixir-rpa1g4gy.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-nca3t891.js → elk-276RUBZZ-fw7waks3.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-5kfkev03.js → erDiagram-OPXOYQCR-fdfgzr5d.js} +5 -5
- package/dist/client/static/js/{erlang-qt876zrq.js → erlang-trjm07as.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-kn4hsm3p.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ah8cvps1.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-mxc73wmq.js → ganttDiagram-FUAMR5RP-2avbqgdr.js} +2 -2
- package/dist/client/static/js/gitGraph-4MIJSDKK-hvavh16n.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-7en3ag0e.js → gitGraphDiagram-X574FWY7-9jmc0a3g.js} +2 -2
- package/dist/client/static/js/graphql-hbkmxsty.js +1 -0
- package/dist/client/static/js/html-pv88ny12.js +1 -0
- package/dist/client/static/js/{index-4g46wbdw.js → index-0v34a7wf.js} +1 -1
- package/dist/client/static/js/{index-vtbbfwx0.js → index-1wjp16f0.js} +2 -2
- package/dist/client/static/js/{index-7a64yjrm.js → index-2v1nmxwr.js} +5 -5
- package/dist/client/static/js/{index-rs80cwsv.js → index-3ecsp1rx.js} +3 -3
- package/dist/client/static/js/{index-1y9r4frb.js → index-43qpbxjv.js} +2 -2
- package/dist/client/static/js/{index-ag2rmtas.js → index-4vybd9e7.js} +1 -1
- package/dist/client/static/js/{index-ahv9y42z.js → index-6f6cmcbq.js} +2 -2
- package/dist/client/static/js/{index-vy6termr.js → index-7ct7qrsp.js} +2 -2
- package/dist/client/static/js/{index-fvmfge3p.js → index-7q02xnvq.js} +1 -1
- package/dist/client/static/js/{index-rytaa8ca.js → index-7smwzkvq.js} +2 -2
- package/dist/client/static/js/{index-nccwxv0s.js → index-8f9x7ev8.js} +1 -1
- package/dist/client/static/js/{index-7y6rpsrp.js → index-8mwragbj.js} +2 -2
- package/dist/client/static/js/{index-52rqxgya.js → index-8x9ecxb0.js} +1 -1
- package/dist/client/static/js/{index-ptcrwswj.js → index-9ketbkh6.js} +1 -1
- package/dist/client/static/js/{index-s7gkkkyz.js → index-a293pdg7.js} +2 -2
- package/dist/client/static/js/{index-vhqe0y82.js → index-a628fg4m.js} +2 -2
- package/dist/client/static/js/{index-c3ek61zv.js → index-a8ffattk.js} +2 -2
- package/dist/client/static/js/{index-a0fmsv1d.js → index-b8s3xraa.js} +6 -6
- package/dist/client/static/js/index-btr2w8cq.js +12 -0
- package/dist/client/static/js/index-dfzrpy54.js +2 -0
- package/dist/client/static/js/{index-g2dyfze9.js → index-ee2p07eg.js} +1 -1
- package/dist/client/static/js/{index-ybm2x4vh.js → index-ek2e773p.js} +1 -1
- package/dist/client/static/js/{index-4qwzxj81.js → index-fvc0x6nx.js} +3 -3
- package/dist/client/static/js/{index-3zc1b0dv.js → index-jc1yagmk.js} +2 -2
- package/dist/client/static/js/{index-p0nz38bm.js → index-jmxqefe3.js} +1 -1
- package/dist/client/static/js/{index-1ksg88qf.js → index-k7q01ye4.js} +2 -2
- package/dist/client/static/js/{index-r014brzs.js → index-kdkfyrja.js} +2 -2
- package/dist/client/static/js/{index-0vm41je9.js → index-mc4nefs7.js} +1 -1
- package/dist/client/static/js/{index-j51d5a5m.js → index-nb8tp4mj.js} +30 -30
- package/dist/client/static/js/{index-cgzrpvzj.js → index-ncrenheb.js} +172 -172
- package/dist/client/static/js/{index-f7jhhqtk.js → index-p16scjt7.js} +2 -2
- package/dist/client/static/js/{index-pm6xxwz1.js → index-pc6eg8h2.js} +2 -2
- package/dist/client/static/js/{index-zvfvqvn9.js → index-pnt0vc59.js} +2 -2
- package/dist/client/static/js/{index-jsyekbx9.js → index-py2k8std.js} +2 -2
- package/dist/client/static/js/{index-dbe6afkf.js → index-pzbssnsc.js} +2 -2
- package/dist/client/static/js/{index-qckv9nte.js → index-qqz6bcdd.js} +2 -2
- package/dist/client/static/js/{index-xx6mqpxm.js → index-rbgemjsp.js} +3 -3
- package/dist/client/static/js/{index-rzxcj7cg.js → index-rkn0bxxt.js} +1 -1
- package/dist/client/static/js/{index-76zb4m0n.js → index-rv89xpaf.js} +2 -2
- package/dist/client/static/js/index-sbd5e816.js +1 -0
- package/dist/client/static/js/{index-1b0t1428.js → index-sdby39w4.js} +3 -3
- package/dist/client/static/js/{index-ev3yt353.js → index-t6c0pd43.js} +2 -2
- package/dist/client/static/js/{index-km2zb6wk.js → index-tp7yb3bv.js} +2 -2
- package/dist/client/static/js/{index-fta1y9pc.js → index-vnw3hbeg.js} +27 -27
- package/dist/client/static/js/{index-354mqqra.js → index-vq6wts05.js} +2 -2
- package/dist/client/static/js/{index-ptcwae2n.js → index-w5373tg1.js} +2 -2
- package/dist/client/static/js/{index-cd65zqba.js → index-w7tpgt46.js} +1 -1
- package/dist/client/static/js/{index-b29afsjh.js → index-whbtxmwh.js} +2 -2
- package/dist/client/static/js/{index-2svnq5gg.js → index-xs1m0bpt.js} +1 -1
- package/dist/client/static/js/{index-eyfcm0cy.js → index-xxtsm2rb.js} +2 -2
- package/dist/client/static/js/{index-hf52f59k.js → index-y3ms153k.js} +2 -2
- package/dist/client/static/js/{index-sd66wv26.js → index-yq39qbs1.js} +2 -2
- package/dist/client/static/js/{index-j0r5hj0j.js → index-zh2jj56s.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-fmjz8qwg.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-sef80132.js → infoDiagram-VRGFBTTK-g2dky5xg.js} +1 -1
- package/dist/client/static/js/ini-72yrpvd4.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-yhvepp1q.js → ishikawaDiagram-OU5B5YK6-exrcjwp1.js} +2 -2
- package/dist/client/static/js/java-ab5tb2ra.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-5w77y95w.js → journeyDiagram-ZHPQQLJL-pn752qa5.js} +3 -3
- package/dist/client/static/js/jsx-25zj9j3k.js +1 -0
- package/dist/client/static/js/{julia-d4j6wgvf.js → julia-evn99h2m.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-02znqtna.js → kanban-definition-PNTS6WVX-v8nvr373.js} +2 -2
- package/dist/client/static/js/lua-j5w0c9wm.js +1 -0
- package/dist/client/static/js/markdown-j6hn4377.js +1 -0
- package/dist/client/static/js/{mermaid.core-a6e6vck4.js → mermaid.core-egzv89zv.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-y4n74q9x.js → mindmap-definition-NLK3R4M7-t9njmv2w.js} +2 -2
- package/dist/client/static/js/one-dark-pro-bm3r4js7.js +1 -0
- package/dist/client/static/js/one-light-e07dt7sy.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-cwr6n1cm.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-pr7ehgzb.js → pegDiagram-GJSIUBJH-zhycy2b7.js} +1 -1
- package/dist/client/static/js/{perl-srptw5vm.js → perl-506fy8m8.js} +1 -1
- package/dist/client/static/js/{php-n89g3fk7.js → php-axtsvxck.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-h1ebfzgt.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-39wpsk08.js → pieDiagram-5QR66LMP-sgctvma2.js} +2 -2
- package/dist/client/static/js/properties-q8njes42.js +1 -0
- package/dist/client/static/js/python-vqxc7181.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-esm913km.js → quadrantDiagram-O4NWA36T-kzzhdcph.js} +1 -1
- package/dist/client/static/js/r-0k5eej8m.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-k7p1m364.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-d08dw3t0.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-txnjycgk.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-p0r3cv6w.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-sryk900a.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-wy2mgya6.js → railroadDiagram-XR7U4H2S-nzjffwxm.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-6z9xdgbq.js → requirementDiagram-PLB6GJNP-tz4xxn4d.js} +1 -1
- package/dist/client/static/js/{ruby-r81ytgcm.js → ruby-qp7zfk2m.js} +1 -1
- package/dist/client/static/js/{rust-frn3szvc.js → rust-fz913fvw.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-rtmxk3ys.js → sankeyDiagram-IPEJSGJF-2wcb0xr6.js} +2 -2
- package/dist/client/static/js/{sass-9bxped7y.js → sass-gnk9vsyp.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-awzcrafg.js → sequenceDiagram-PO4LG4MO-vqgebfns.js} +5 -5
- package/dist/client/static/js/{sizeCapture-INFHLROL-03gy196j.js → sizeCapture-INFHLROL-xc314tes.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-an8v3q5n.js → stateDiagram-v2-GCMORJYK-8bd9b1h8.js} +2 -2
- package/dist/client/static/js/{svelte-mwtx07d9.js → svelte-brpgzrtv.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-n9yb4wcs.js → swimlanes-2SLR337P-t6hbdzcw.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-c1czc7kv.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-jceb575g.js → timeline-definition-EJHVYXUP-2txxasx5.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-77kj68p1.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-rw94xc82.js +1 -0
- package/dist/client/static/js/tsx-yd5wt250.js +1 -0
- package/dist/client/static/js/typescript-v7z7crfe.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-888h3100.js → usecaseDiagram-POWQR4AR-3x353hn4.js} +5 -5
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-wbfz0rzv.js → vennDiagram-UO4OBE2U-cerpss8e.js} +1 -1
- package/dist/client/static/js/{vue-c0rtg1wf.js → vue-apnkw9qy.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-18xe4fhz.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-rn8c5qf9.js → wardleyDiagram-VNRHLVJA-cx6jfsbf.js} +1 -1
- package/dist/client/static/js/xml-94fhzrfs.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8sn1apt6.js → xychartDiagram-PMCCYNJV-tgn23xj1.js} +2 -2
- package/dist/client/static/js/yaml-s8af9rnw.js +1 -0
- package/package.json +1 -1
- package/src/client/components/settings/categories/connect-settings/PairDialog.test.tsx +159 -0
- package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +36 -7
- package/src/client/components/settings/categories/connect-settings/QrCode.tsx +2 -19
- package/src/client/components/settings/categories/connect-settings/qr-image.ts +76 -0
- package/src/client/components/workspace/git-panel/init-state.test.ts +5 -0
- package/src/client/hooks/chat/composer/speech-to-text.ts +24 -17
- package/src/client/hooks/editor/file-actions.ts +3 -11
- package/src/client/hooks/editor/font.test.ts +2 -1
- package/src/client/hooks/editor/use-file-transfer.ts +2 -1
- package/src/client/lib/browser/download.ts +22 -0
- package/src/shared/lib/dictation/capture-failure.test.ts +46 -0
- package/src/shared/lib/dictation/capture-failure.ts +36 -0
- package/dist/client/static/js/architecture-7GRP2DOG-fc9kmq1w.js +0 -1
- package/dist/client/static/js/bash-b3rwyg5p.js +0 -1
- package/dist/client/static/js/cpp-y0t6mynx.js +0 -1
- package/dist/client/static/js/css-6vj0d308.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +0 -1
- package/dist/client/static/js/graphql-n43pd5fs.js +0 -1
- package/dist/client/static/js/html-dbrwss36.js +0 -1
- package/dist/client/static/js/index-231241f4.js +0 -12
- package/dist/client/static/js/index-6sf2vsp2.js +0 -1
- package/dist/client/static/js/index-h5bn97p6.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +0 -1
- package/dist/client/static/js/ini-j5dyq6gm.js +0 -1
- package/dist/client/static/js/java-g4dgwbfd.js +0 -1
- package/dist/client/static/js/jsx-7t5ecz9s.js +0 -1
- package/dist/client/static/js/lua-1g6w30de.js +0 -1
- package/dist/client/static/js/markdown-afx21x8c.js +0 -1
- package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +0 -1
- package/dist/client/static/js/one-light-y5t9x6zh.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +0 -1
- package/dist/client/static/js/properties-thd83wey.js +0 -1
- package/dist/client/static/js/python-264ns4xw.js +0 -1
- package/dist/client/static/js/r-qw82kkv9.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-nx5nfnf0.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.js +0 -1
- package/dist/client/static/js/tsx-nm94hed6.js +0 -1
- package/dist/client/static/js/typescript-0s2t05jj.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +0 -1
- package/dist/client/static/js/xml-dz51p1m3.js +0 -1
- package/dist/client/static/js/yaml-2cfkd30t.js +0 -1
package/dist/client/index.html
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
by `scripts/build-client.ts`. A page that ships an external font must
|
|
66
66
|
name it somewhere; this one did not. -->
|
|
67
67
|
<!--app-head-->
|
|
68
|
-
<link rel="stylesheet" crossorigin href="./static/js/index-2mx9ej4k.css"><script type="module" crossorigin src="./static/js/index-
|
|
68
|
+
<link rel="stylesheet" crossorigin href="./static/js/index-2mx9ej4k.css"><script type="module" crossorigin src="./static/js/index-ncrenheb.js"></script></head>
|
|
69
69
|
<body>
|
|
70
70
|
<div id="app"></div>
|
|
71
71
|
<!--app-bootstrap-->
|
package/dist/client/index.js
CHANGED
|
@@ -663,7 +663,7 @@ return u.substring(s,qi)
|
|
|
663
663
|
`:`c.headers={}
|
|
664
664
|
for(const [k,v] of c.request.headers.entries())c.headers[k]=v
|
|
665
665
|
`},listen(e){return(t,n)=>{if(typeof Bun>"u")throw Error(".listen() is designed to run on Bun only. If you are running Elysia in other environment please use a dedicated plugin or export the handler via Elysia.fetch");if(e.compile(),typeof t=="string"){if(!Cw(t))throw Error("Port must be a numeric value");t=parseInt(t)}let r=(s,{withAsync:a=!1}={})=>{let c={},l=[];if(e.event.request?.length||e.event.trace?.length||e.extender.higherOrderFunctions.length)return a?Promise.resolve(c):c;for(let[u,d]of Object.entries(s))if(u=encodeURI(u),Ow){if(!d)continue;for(let[p,m]of Object.entries(d))if(!(!m||!(p in u8))){if(m instanceof Promise){a&&(c[u]||(c[u]={}),l.push(m.then((h)=>{h instanceof Response&&(c[u][p]=h),hh(h)&&(c[u][p]=h)})));continue}!(m instanceof Response)&&!hh(m)||(c[u]||(c[u]={}),c[u][p]=m)}}else{if(!d)continue;if(d instanceof Promise){a&&(c[u]||(c[u]={}),l.push(d.then((p)=>{p instanceof Response&&(c[u]=p)})));continue}if(!(d instanceof Response))continue;c[u]=d}return a?Promise.all(l).then(()=>c):c},o=c8(gS(gS(r(e.router.response),a8(e)),e.config.serve?.routes)),i=typeof t=="object"?{development:!sa,reusePort:!0,idleTimeout:30,...e.config.serve||{},...t||{},routes:o,websocket:{...e.config.websocket||{},...AR||{},...t.websocket||{}},fetch:e.fetch}:{development:!sa,reusePort:!0,idleTimeout:30,...e.config.serve||{},routes:o,websocket:{...e.config.websocket||{},...AR||{}},port:t,fetch:e.fetch};if(e.server=Bun.serve(i),e.event.start)for(let s=0;s<e.event.start.length;s++)e.event.start[s].fn(e);n&&n(e.server),process.on("beforeExit",async()=>{if(e.server&&(await e.server.stop?.(),e.server=null,e.event.stop))for(let s=0;s<e.event.stop.length;s++)e.event.stop[s].fn(e)}),e.promisedModules.then(async()=>{e.config.aot,e.compile();let s=c8(gS(gS(await r(e.router.response,{withAsync:!0}),a8(e)),e.config.serve?.routes));e.server?.reload({...i,fetch:e.fetch,routes:s}),Bun?.gc(!1)})}},async stop(e,t){if(e.server){if(await e.server.stop(t),e.server=null,e.event.stop?.length)for(let n=0;n<e.event.stop.length;n++)e.event.stop[n].fn(e)}else console.log("Elysia isn't running. Call `app.listen` to start the server.",Error().stack)},ws(e,t,n){let{parse:r,body:o,response:i,...s}=n,a=Gt(o,{modules:e.definitions.typebox,models:e.definitions.type,normalize:e.config.normalize}),c=a?a.provider==="standard"?(u)=>a.schema["~standard"].validate(u).issues:(u)=>a.Check(u)===!1:void 0,l=Gt(i,{modules:e.definitions.typebox,models:e.definitions.type,normalize:e.config.normalize});e.route("WS",t,async(u)=>{let d=u.server??e.server,{set:p,path:m,qi:h,headers:g,query:y,params:b}=u;if(u.validator=l,n.upgrade)if(typeof n.upgrade=="function"){let S=n.upgrade(u);S instanceof Promise&&await S}else n.upgrade&&Object.assign(p.headers,n.upgrade);if(p.cookie&&je(p.cookie)){let S=sh(p.cookie);S&&(p.headers["set-cookie"]=S)}p.headers["set-cookie"]&&Array.isArray(p.headers["set-cookie"])&&(p.headers=dR(new Headers(p.headers),p.headers["set-cookie"]));let w=s8(l),C=i8(r),k;if(typeof n.beforeHandle=="function"){let S=n.beforeHandle(u);S instanceof Promise&&await S}let R=[...n.error?Array.isArray(n.error)?n.error:[n.error]:[],...(e.event.error??[]).map((S)=>typeof S=="function"?S:S.fn)].filter((S)=>S),P=R.length>0,x=P?async(S,E)=>{for(let M of R){let v=M(Object.assign(u,{error:E}));if(v instanceof Promise&&(v=await v),await w(S,v),v)break}}:()=>{};if(!d?.upgrade(u.request,{headers:je(p.headers)?p.headers:void 0,data:{...u,get id(){return k||(k=oa())},validator:l,ping(S,E){n.ping?.(S,E)},pong(S,E){n.pong?.(S,E)},open:async(S)=>{try{await w(S,n.open?.(new Gp(S,u)))}catch(E){x(S,E)}},message:async(S,E)=>{let M=await C(S,E);if(c&&c(M)){let v=new ue("message",a,M);return P?x(S,v):void S.send(v.message)}try{await w(S,n.message?.(new Gp(S,u,M),M))}catch(v){x(S,v)}},drain:async(S)=>{try{await w(S,n.drain?.(new Gp(S,u)))}catch(E){x(S,E)}},close:async(S,E,M)=>{try{await w(S,n.close?.(new Gp(S,u),E,M))}catch(v){x(S,v)}}}}))return as(400,"Expected a websocket connection")},{...s,websocket:n})}};var hS=ho?Bun.env:typeof process<"u"&&process?.env?process.env:{};var g8=/^(.+)\[(\d+)\]$/,p8=new Set(["__proto__","constructor","prototype"]),m8=(e)=>{if(p8.has(e))return!0;let t=e.match(g8);return t?p8.has(t[1]):!1},f8=(e)=>{let t=e.match(g8);return t?{name:t[1],index:parseInt(t[2],10)}:null},hSe=(e)=>{if(!(typeof e!="string"||e.charCodeAt(0)!==123))try{let t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t))return t}catch{return}},TR=(e,t,n)=>{let r=t.split("."),o=r.pop();if(m8(o)||r.some(m8))return;let i=e;for(let a of r){let c=f8(a);if(c){Array.isArray(i[c.name])||(i[c.name]=[]);let l=i[c.name][c.index],u=typeof File<"u"&&l instanceof File;(!l||typeof l!="object"||Array.isArray(l)||u)&&(i[c.name][c.index]=hSe(l)??{}),i=i[c.name][c.index]}else(!i[a]||typeof i[a]!="object")&&(i[a]={}),i=i[a]}let s=f8(o);s?(Array.isArray(i[s.name])||(i[s.name]=[]),i[s.name][s.index]=n):i[o]=n},ER=(e)=>{if(e.length===1){let o=e[0];if(typeof o=="string"&&(o.charCodeAt(0)===123||o.charCodeAt(0)===91))try{let i=JSON.parse(o);if(i&&typeof i=="object")return i}catch{}return e[0]}let t=e.find((o)=>typeof o=="string");if(!t||typeof File>"u")return e;let n=e.filter((o)=>o instanceof File);if(!n.length||t.charCodeAt(0)!==123)return e;let r;try{r=JSON.parse(t)}catch{return e}return typeof r!="object"||r===null?e:(!("file"in r)&&n.length===1?r.file=n[0]:!("files"in r)&&n.length>1&&(r.files=n),r)},RR=(e,t)=>{let n=e.schema;if(!n)return;n.$defs?.[n.$ref]&&(n=n.$defs[n.$ref]);let r=ds(n);if(r)for(let[o,i]of Object.entries(r))t[o]??=i.default};async function vu(e,t,n){let r=await t.Validate(n);if(r.issues)throw new ue(e,t,n,!1,r.issues);return r.value}var PR=(e)=>{let{mapResponse:t,mapEarlyResponse:n}=e["~adapter"].handler,r=e.setHeaders;return async(o)=>{let i=o.url,s=i.indexOf("/",11),a=i.indexOf("?",s+1),c=a===-1?i.substring(s):i.substring(s,a),l={cookie:{},status:200,headers:r?{...r}:{}},u=Object.assign({},e.singleton.decorator,{set:l,store:e.singleton.store,request:o,path:c,qi:a,error:as,status:as,redirect:ou}),d;try{if(e.event.request)for(let E=0;E<e.event.request.length;E++){let M=e.event.request[E].fn,v=M(u);if(v instanceof Promise&&(v=await v),v=n(v,l),v)return u.response=v}let p=o.method==="GET"&&o.headers.get("upgrade")?.toLowerCase()==="websocket"?"WS":o.method,m=e.router.dynamic.find(o.method,c)??e.router.dynamic.find(p,c)??e.router.dynamic.find("ALL",c);if(!m)throw u.query=a===-1?{}:dc(i.substring(a+1)),new Cp;let{handle:h,validator:g,content:y,route:b}=m.store;if(d=m.store.hooks,d.config?.mount)return await d.config.mount(o);let w;if(o.method!=="GET"&&o.method!=="HEAD")if(y)switch(y){case"application/json":w=await o.json();break;case"text/plain":w=await o.text();break;case"application/x-www-form-urlencoded":w=dc(await o.text());break;case"application/octet-stream":w=await o.arrayBuffer();break;case"multipart/form-data":{w={};let E=await o.formData(),M=new Map;E.forEach((v,N)=>{let O=M.get(N);O?O.push(v):M.set(N,[v])});for(let[v,N]of M){if(w[v])continue;let O=ER(N);v.includes(".")||v.includes("[")?TR(w,v,O):w[v]=O}break}}else{let E;if(o.body&&(E=o.headers.get("content-type")),E){let M=E.indexOf(";");if(M!==-1&&(E=E.slice(0,M)),u.contentType=E,d.parse)for(let v=0;v<d.parse.length;v++){let N=d.parse[v].fn;if(typeof N=="string")switch(N){case"json":case"application/json":w=await o.json();break;case"text":case"text/plain":w=await o.text();break;case"urlencoded":case"application/x-www-form-urlencoded":w=dc(await o.text());break;case"arrayBuffer":case"application/octet-stream":w=await o.arrayBuffer();break;case"formdata":case"multipart/form-data":{w={};let O=await o.formData(),G=new Map;O.forEach((Y,ne)=>{let J=G.get(ne);J?J.push(Y):G.set(ne,[Y])});for(let[Y,ne]of G){if(w[Y])continue;let J=ER(ne);Y.includes(".")||Y.includes("[")?TR(w,Y,J):w[Y]=J}break}default:{let O=e["~parser"][N];if(O){let G=O(u,E);if(G instanceof Promise&&(G=await G),G){w=G;break}}break}}else{let O=N(u,E);if(O instanceof Promise&&(O=await O),O){w=O;break}}}if(delete u.contentType,w===void 0)switch(E){case"application/json":w=await o.json();break;case"text/plain":w=await o.text();break;case"application/x-www-form-urlencoded":w=dc(await o.text());break;case"application/octet-stream":w=await o.arrayBuffer();break;case"multipart/form-data":{w={};let v=await o.formData(),N=new Map;v.forEach((O,G)=>{let Y=N.get(G);Y?Y.push(O):N.set(G,[O])});for(let[O,G]of N){if(w[O])continue;let Y=ER(G);O.includes(".")||O.includes("[")?TR(w,O,Y):w[O]=Y}break}}}}u.route=b,u.body=w,u.params=m?.params||void 0,u.query=a===-1?{}:dc(i.substring(a+1)),u.headers={};for(let[E,M]of o.headers.entries())u.headers[E]=M;let C={domain:e.config.cookie?.domain??g?.cookie?.config.domain,expires:e.config.cookie?.expires??g?.cookie?.config.expires,httpOnly:e.config.cookie?.httpOnly??g?.cookie?.config.httpOnly,maxAge:e.config.cookie?.maxAge??g?.cookie?.config.maxAge,path:e.config.cookie?.path??g?.cookie?.config.path,priority:e.config.cookie?.priority??g?.cookie?.config.priority,partitioned:e.config.cookie?.partitioned??g?.cookie?.config.partitioned,sameSite:e.config.cookie?.sameSite??g?.cookie?.config.sameSite,secure:e.config.cookie?.secure??g?.cookie?.config.secure,secrets:e.config.cookie?.secrets??g?.cookie?.config.secrets,sign:e.config.cookie?.sign??g?.cookie?.config.sign},k=o.headers.get("cookie");u.cookie=await nS(u.set,k,C);let R=g?.createHeaders?.();R&&RR(R,u.headers);let P=g?.createParams?.();P&&RR(P,u.params);let x=g?.createQuery?.();if(x&&RR(x,u.query),d.transform)for(let E=0;E<d.transform.length;E++){let M=d.transform[E],v=M.fn(u);if(v instanceof Promise&&(v=await v),v instanceof $t){let N=n(v,u.set);if(N)return u.response=N}M.subType==="derive"&&Object.assign(u,v)}if(g){if(R){let M=structuredClone(u.headers);for(let[v,N]of o.headers)M[v]=N;if(R.provider==="standard")u.headers=await vu("header",R,M);else if(g.headers.Check(M)===!1)throw new ue("header",g.headers,M)}else g.headers?.Decode&&(u.headers=g.headers.Decode(u.headers));if(P?.provider==="standard")u.params=await vu("params",P,u.params);else{if(P?.Check(u.params)===!1)throw new ue("params",g.params,u.params);g.params?.Decode&&(u.params=g.params.Decode(u.params))}if(g.query?.schema){let M=g.query.schema;M.$defs?.[M.$ref]&&(M=M.$defs[M.$ref]);let v=ds(M);if(v)for(let N of Object.keys(v)){let O=v[N];(O.type==="array"||O.items?.type==="string")&&typeof u.query[N]=="string"&&u.query[N]&&(u.query[N]=u.query[N].split(","))}}if(x?.provider==="standard")u.query=await vu("query",x,u.query);else{if(x?.Check(u.query)===!1)throw new ue("query",g.query,u.query);g.query?.Decode&&(u.query=g.query.Decode(u.query))}if(g.createCookie?.()){let M={};for(let[v,N]of Object.entries(u.cookie))M[v]=N.value;if(g.cookie.provider==="standard"){M=await vu("cookie",g.cookie,M);for(let v of Object.keys(M))u.cookie[v].value=M[v]}else{if(g.cookie.Check(M)===!1)throw new ue("cookie",g.cookie,M);g.cookie?.Decode&&(M=g.cookie.Decode(M))}}let E=g.createBody?.();if(E?.provider==="standard")u.body=await vu("body",E,w);else{if(E?.Check(w)===!1)throw new ue("body",g.body,w);if(g.body?.Decode){let M=g.body.Decode(w);M instanceof Promise&&(M=await M),u.body=M?.value??M}}}if(d.beforeHandle)for(let E=0;E<d.beforeHandle.length;E++){let M=d.beforeHandle[E],v=M.fn(u);if(v instanceof Promise&&(v=await v),v instanceof $t){let N=n(v,u.set);if(N)return u.response=N}if(M.subType==="resolve"){Object.assign(u,v);continue}if(v!==void 0){if(u.response=v,d.afterHandle)for(let O=0;O<d.afterHandle.length;O++){let G=d.afterHandle[O].fn(u);G instanceof Promise&&(G=await G),G&&(v=G)}let N=n(v,u.set);if(N)return u.response=N}}let S=typeof h=="function"?h(u):h;if(S instanceof Promise&&(S=await S),d.afterHandle?.length){u.response=S;for(let E=0;E<d.afterHandle.length;E++){let M=d.afterHandle[E].fn(u);M instanceof Promise&&(M=await M);let v=M instanceof $t,N=v?M.code:l.status?typeof l.status=="string"?ss[l.status]:l.status:200;v&&(l.status=N,M=M.response);let O=g?.createResponse?.()?.[N];if(O?.provider==="standard")M=await vu("response",O,M);else if(O?.Check(M)===!1)if(O?.Clean)try{let Y=O.Clean(M);if(O?.Check(Y)===!1)throw new ue("response",O,M);M=Y}catch(Y){throw Y instanceof ue?Y:new ue("response",O,M)}else throw new ue("response",O,M);if(O?.Encode&&(u.response=M=O.Encode(M)),O?.Clean)try{u.response=M=O.Clean(M)}catch{}let G=n(M,u.set);if(G!==void 0)return u.response=G}}else{let E=S instanceof $t,M=E?S.code:l.status?typeof l.status=="string"?ss[l.status]:l.status:200;E&&(l.status=M,S=S.response);let v=g?.createResponse?.()?.[M];if(v?.provider==="standard")S=await vu("response",v,S);else if(v?.Check(S)===!1)if(v?.Clean)try{let N=v.Clean(S);if(v?.Check(N)===!1)throw new ue("response",v,S);S=N}catch(N){throw N instanceof ue?N:new ue("response",v,S)}else throw new ue("response",v,S);if(v?.Encode&&(S=v.Encode(S)),v?.Clean)try{S=v.Clean(S)}catch{}}if(u.set.cookie&&C?.sign){let E=C.secrets?typeof C.secrets=="string"?C.secrets:C.secrets[0]:void 0;if(C.sign===!0){if(E)for(let[M,v]of Object.entries(u.set.cookie))u.set.cookie[M].value=await Pp(v.value,E)}else{let M=ds(g?.cookie?.schema);if(E)for(let v of C.sign)!M||!(v in M)||u.set.cookie[v]?.value&&(u.set.cookie[v].value=await Pp(u.set.cookie[v].value,E))}}return t(u.response=S,u.set)}catch(p){let m=p instanceof tu&&p.error?p.error:p;return e.handleError(u,m)}finally{let p=d?d.afterResponse:e.event.afterResponse;p&&(Pw?setImmediate(async()=>{for(let m of p)await m.fn(u)}):Promise.resolve().then(async()=>{for(let m of p)await m.fn(u)}))}}},h8=(e)=>{let{mapResponse:t}=e["~adapter"].handler;return async(n,r)=>{let o=Object.assign(n,{error:r,code:r.code});if(o.set=n.set,typeof r?.toResponse=="function"&&!(r instanceof ue)&&!(r instanceof tu))try{let i=r.toResponse();typeof i?.then=="function"&&(i=await i),i instanceof Response&&(n.set.status=i.status),n.response=i}catch{}if(!n.response&&e.event.error)for(let i=0;i<e.event.error.length;i++){let s=e.event.error[i].fn(o);if(s instanceof Promise&&(s=await s),s!=null)return n.response=t(s,n.set)}if(n.response){if(e.event.mapResponse)for(let i=0;i<e.event.mapResponse.length;i++){let s=e.event.mapResponse[i].fn(o);s instanceof Promise&&(s=await s),s!=null&&(n.response=s)}return t(n.response,n.set)}return n.set.status=r.status??500,t(typeof r.cause=="string"?r.cause:r.message,n.set)}};var y8;y8=Symbol.dispose;var ySe=class e{constructor(t={}){this.server=null,this.dependencies={},this["~Prefix"]="",this["~Singleton"]=null,this["~Definitions"]=null,this["~Metadata"]=null,this["~Ephemeral"]=null,this["~Volatile"]=null,this["~Routes"]=null,this.singleton={decorator:{},store:{},derive:{},resolve:{}},this.definitions={typebox:X.Module({}),type:{},error:{}},this.extender={macro:{},higherOrderFunctions:[]},this.validator={global:null,scoped:null,local:null,getCandidate(){return!this.global&&!this.scoped&&!this.local?{body:void 0,headers:void 0,params:void 0,query:void 0,cookie:void 0,response:void 0}:Rp(Rp(this.global,this.scoped),this.local)}},this.standaloneValidator={global:null,scoped:null,local:null},this.event={},this.router={"~http":void 0,get http(){return this["~http"]||(this["~http"]=new Bl({lazy:!0,onParam:IR.default})),this["~http"]},"~dynamic":void 0,get dynamic(){return this["~dynamic"]||(this["~dynamic"]=new Bl({onParam:IR.default})),this["~dynamic"]},static:{},response:{},history:[]},this.routeTree={},this.inference={body:!1,cookie:!1,headers:!1,query:!1,set:!1,server:!1,path:!1,route:!1,url:!1},this["~parser"]={},this.handle=async(n)=>this.fetch(n),this.handleError=async(n,r)=>(this.handleError=this.config.aot?kR(this):h8(this))(n,r),this.listen=(n,r)=>(this["~adapter"].listen(this)(n,r),this),this.stop=async(n)=>(await this["~adapter"].stop?.(this,n),this),this[y8]=()=>{this.server&&this.stop()},t.tags&&(t.detail?t.detail.tags=t.tags:t.detail={tags:t.tags}),this.config={aot:hS.ELYSIA_AOT!=="false",nativeStaticResponse:!0,encodeSchema:!0,normalize:!0,...t,prefix:t.prefix?t.prefix.charCodeAt(0)===47?t.prefix:`/${t.prefix}`:void 0,cookie:{path:"/",...t?.cookie},experimental:t?.experimental??{},seed:t?.seed===void 0?"":t?.seed},this["~adapter"]=t.adapter??(typeof Bun<"u"?d8:lh),t?.analytic&&(t?.name||t?.seed!==void 0)&&(this.telemetry={stack:Error().stack})}get store(){return this.singleton.store}get decorator(){return this.singleton.decorator}get routes(){return this.router.history}getGlobalRoutes(){return this.router.history}getGlobalDefinitions(){return this.definitions}getServer(){return this.server}getParent(){return null}get promisedModules(){return this._promisedModules||(this._promisedModules=new NE(console.error,()=>{})),this._promisedModules}env(t,n=hS){if(Gt(t,{modules:this.definitions.typebox,dynamic:!0,additionalProperties:!0,coerce:!0,sanitize:()=>this.config.sanitize}).Check(n)===!1){let r=new ue("env",t,n);throw Error(r.all.map((o)=>o.summary).join(`
|
|
666
|
-
`))}return this}wrap(t){return this.extender.higherOrderFunctions.push({checksum:na(JSON.stringify({name:this.config.name,seed:this.config.seed,content:t.toString()})),fn:t}),this}get models(){let t={};for(let n of Object.keys(this.definitions.type))t[n]=Gt(this.definitions.typebox.Import(n),{models:this.definitions.type});return t.modules=this.definitions.typebox,t}add(t,n,r,o,i){let s=i?.skipPrefix??!1,a=i?.allowMeta??!1;o??={},this.applyMacro(o);let c=[];if(o.standaloneValidator&&(c=c.concat(o.standaloneValidator)),this.standaloneValidator.local&&(c=c.concat(this.standaloneValidator.local)),this.standaloneValidator.scoped&&(c=c.concat(this.standaloneValidator.scoped)),this.standaloneValidator.global&&(c=c.concat(this.standaloneValidator.global)),n!==""&&n.charCodeAt(0)!==47&&(n="/"+n),this.config.prefix&&!s&&(n=this.config.prefix+n),o?.type)switch(o.type){case"text":o.type="text/plain";break;case"json":o.type="application/json";break;case"formdata":o.type="multipart/form-data";break;case"urlencoded":o.type="application/x-www-form-urlencoded";break;case"arrayBuffer":o.type="application/octet-stream";break;default:break}let l=this.validator.getCandidate(),u={body:o?.body??l?.body,headers:o?.headers??l?.headers,params:o?.params??l?.params,query:o?.query??l?.query,cookie:o?.cookie??l?.cookie,response:o?.response??l?.response},d=this.config.precompile===!0||typeof this.config.precompile=="object"&&this.config.precompile.compose===!0,p=()=>{let v=this.definitions.type,N=!this.config.aot,O=this.config.normalize,G=this.definitions.typebox,Y=()=>this.config.sanitize,ne=()=>{if(u.cookie||c.find((J)=>J.cookie))return e8({modules:G,validator:u.cookie,defaultConfig:this.config.cookie,normalize:O,config:u.cookie?.config??{},dynamic:N,models:v,validators:c.map((J)=>J.cookie),sanitize:Y})};return d?{body:Gt(u.body,{modules:G,dynamic:N,models:v,normalize:O,additionalCoerce:(()=>{let J=SR(u.body,v,G);return J&&F in J&&(Nn("File",J)||Nn("Files",J))?bR():ph()})(),validators:c.map((J)=>J.body),sanitize:Y}),headers:Gt(u.headers,{modules:G,dynamic:N,models:v,additionalProperties:!0,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.headers),sanitize:Y}),params:Gt(u.params,{modules:G,dynamic:N,models:v,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.params),sanitize:Y}),query:Gt(u.query,{modules:G,dynamic:N,models:v,normalize:O,coerce:!0,additionalCoerce:yR(),validators:c.map((J)=>J.query),sanitize:Y}),cookie:ne(),response:uS(u.response,{modules:G,dynamic:N,models:v,normalize:O,validators:c.map((J)=>J.response),sanitize:Y})}:{createBody(){return this.body?this.body:this.body=Gt(u.body,{modules:G,dynamic:N,models:v,normalize:O,additionalCoerce:(()=>{let J=SR(u.body,v,G);return J&&F in J&&(Nn("File",J)||Nn("Files",J))?bR():ph()})(),validators:c.map((J)=>J.body),sanitize:Y})},createHeaders(){return this.headers?this.headers:this.headers=Gt(u.headers,{modules:G,dynamic:N,models:v,normalize:O,additionalProperties:!O,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.headers),sanitize:Y})},createParams(){return this.params?this.params:this.params=Gt(u.params,{modules:G,dynamic:N,models:v,normalize:O,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.params),sanitize:Y})},createQuery(){return this.query?this.query:this.query=Gt(u.query,{modules:G,dynamic:N,models:v,normalize:O,coerce:!0,additionalCoerce:yR(),validators:c.map((J)=>J.query),sanitize:Y})},createCookie(){return this.cookie?this.cookie:this.cookie=ne()},createResponse(){return this.response?this.response:this.response=uS(u.response,{modules:G,dynamic:N,models:v,normalize:O,validators:c.map((J)=>J.response),sanitize:Y})}}};(l.body||l.cookie||l.headers||l.params||l.query||l.response)&&(o=is(o,l)),o.tags&&(o.detail?o.detail.tags=o.tags:o.detail={tags:o.tags}),je(this.config.detail)&&(o.detail=fn(Object.assign({},this.config.detail),o.detail));let m=je(this.event)?is(this.event,LE(o)):{...Z6(LE(o))};if(c.length&&Object.assign(m,{standaloneValidator:c}),this.config.aot===!1){let v=p();this.router.dynamic.add(t,n,{validator:v,hooks:m,content:o?.type,handle:r,route:n});let N=su(n,{dynamic:!0});if(n!==N&&this.router.dynamic.add(t,N,{validator:v,hooks:m,content:o?.type,handle:r,route:n}),!this.config.strictPath){let O=iu(n);this.router.dynamic.add(t,O,{validator:v,hooks:m,content:o?.type,handle:r,route:n});let G=su(O);O!==G&&this.router.dynamic.add(t,O,{validator:v,hooks:m,content:o?.type,handle:r,route:n})}this.router.history.push({method:t,path:n,composed:null,handler:r,compile:void 0,hooks:m});return}let h=this["~adapter"].handler,g=typeof r!="function"?()=>{let v=h.createNativeStaticHandler?.(r,m,{headers:Object.assign({},this.setHeaders)});return v instanceof Promise?v.then((N)=>{if(N)return N}):v?.()}:void 0,y=this.config.nativeStaticResponse===!0,b=(v)=>{!y||!g||(Ow?this.router.response[v]?this.router.response[v][t]=g():this.router.response[v]={[t]:g()}:this.router.response[v]=g())};b(n);let w,C=()=>{if(w)return w;let v=n8({app:this,path:n,method:t,hooks:m,validator:p(),handler:typeof r!="function"&&typeof h.createStaticHandler!="function"?()=>r:r,allowMeta:a,inference:this.inference});return this.router.history[R]&&(w=this.router.history[R].composed=v),v},k;if(`${t}_${n}`in this.routeTree)for(let v=0;v<this.router.history.length;v++){let N=this.router.history[v];if(N.path===n&&N.method===t){k=v;break}}else this.routeTree[`${t}_${n}`]=this.router.history.length;let R=k??this.router.history.length,P=this.router.history,x=d?C():(v)=>w?w(v):(P[R].composed=C())(v);k!==void 0?this.router.history[k]=Object.assign({method:t,path:n,composed:x,compile:C,handler:r,hooks:m},c.length?{standaloneValidators:c}:void 0,o.webSocket?{websocket:o.websocket}:void 0):this.router.history.push(Object.assign({method:t,path:n,composed:x,compile:C,handler:r,hooks:m},o.webSocket?{websocket:o.websocket}:void 0));let S={handler:d?P[R].composed:void 0,compile(){return this.handler=C()}},E=this.router.static,M=n.indexOf(":")===-1&&n.indexOf("*")===-1;if(t==="WS"){if(M){n in E?E[n][t]=R:E[n]={[t]:R};return}this.router.http.add("WS",n,S),this.config.strictPath||this.router.http.add("WS",iu(n),S);let v=su(n,{dynamic:!0});n!==v&&this.router.http.add("WS",v,S);return}if(M)n in E?E[n][t]=R:E[n]={[t]:R},this.config.strictPath||b(iu(n));else{if(this.router.http.add(t,n,S),!this.config.strictPath){let N=iu(n);b(N),this.router.http.add(t,N,S)}let v=su(n,{dynamic:!0});n!==v&&(this.router.http.add(t,v,S),b(v))}}headers(t){return t?(this.setHeaders||(this.setHeaders={}),this.setHeaders=fn(this.setHeaders,t),this):this}onStart(t){return this.on("start",t),this}onRequest(t){return this.on("request",t),this}onParse(t,n){return n?this.on(t,"parse",n):typeof t=="string"?this.on("parse",this["~parser"][t]):this.on("parse",t)}parser(t,n){return this["~parser"][t]=n,this}onTransform(t,n){return n?this.on(t,"transform",n):this.on("transform",t)}resolve(t,n){n||(n=t,t={as:"local"});let r={subType:"resolve",fn:n};return this.onBeforeHandle(t,r)}mapResolve(t,n){n||(n=t,t={as:"local"});let r={subType:"mapResolve",fn:n};return this.onBeforeHandle(t,r)}onBeforeHandle(t,n){return n?this.on(t,"beforeHandle",n):this.on("beforeHandle",t)}onAfterHandle(t,n){return n?this.on(t,"afterHandle",n):this.on("afterHandle",t)}mapResponse(t,n){return n?this.on(t,"mapResponse",n):this.on("mapResponse",t)}onAfterResponse(t,n){return n?this.on(t,"afterResponse",n):this.on("afterResponse",t)}trace(t,n){n||(n=t,t={as:"local"}),Array.isArray(n)||(n=[n]);for(let r of n)this.on(t,"trace",z5(r));return this}error(t,n){switch(typeof t){case"string":return n.prototype[au]=t,this.definitions.error[t]=n,this;case"function":return this.definitions.error=t(this.definitions.error),this}for(let[r,o]of Object.entries(t))o.prototype[au]=r,this.definitions.error[r]=o;return this}onError(t,n){return n?this.on(t,"error",n):this.on("error",t)}onStop(t){return this.on("stop",t),this}on(t,n,r){let o;switch(typeof t){case"string":o=t,r=n;break;case"object":o=n,!Array.isArray(n)&&typeof n=="object"&&(r=n);break}Array.isArray(r)?r=mn(r):typeof r=="function"?r=[{fn:r}]:r=[r];let i=r;for(let s of i)s.scope=typeof t=="string"?"local":t?.as??"local",(o==="resolve"||o==="derive")&&(s.subType=o);o!=="trace"&&(this.inference=hu({[o]:i.map((s)=>s.fn)},this.inference,this.config.sucrose));for(let s of i){let a=_6(s,"global",{skipIfHasType:!0});switch((this.config.name||this.config.seed)&&(a.checksum=na(this.config.name+JSON.stringify(this.config.seed))),o){case"start":this.event.start??=[],this.event.start.push(a);break;case"request":this.event.request??=[],this.event.request.push(a);break;case"parse":this.event.parse??=[],this.event.parse.push(a);break;case"transform":this.event.transform??=[],this.event.transform.push(a);break;case"derive":this.event.transform??=[],this.event.transform.push(mn(a,"derive"));break;case"beforeHandle":this.event.beforeHandle??=[],this.event.beforeHandle.push(a);break;case"resolve":this.event.beforeHandle??=[],this.event.beforeHandle.push(mn(a,"resolve"));break;case"afterHandle":this.event.afterHandle??=[],this.event.afterHandle.push(a);break;case"mapResponse":this.event.mapResponse??=[],this.event.mapResponse.push(a);break;case"afterResponse":this.event.afterResponse??=[],this.event.afterResponse.push(a);break;case"trace":this.event.trace??=[],this.event.trace.push(a);break;case"error":this.event.error??=[],this.event.error.push(a);break;case"stop":this.event.stop??=[],this.event.stop.push(a);break}}return this}as(t){return ia(this.event.parse,t),ia(this.event.transform,t),ia(this.event.beforeHandle,t),ia(this.event.afterHandle,t),ia(this.event.mapResponse,t),ia(this.event.afterResponse,t),ia(this.event.trace,t),ia(this.event.error,t),t==="scoped"?(this.validator.scoped=Rp(this.validator.scoped,this.validator.local),this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null)):t==="global"&&(this.validator.global=Rp(this.validator.global,Rp(this.validator.scoped,this.validator.local)),this.validator.scoped=null,this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null),this.standaloneValidator.scoped!==null&&(this.standaloneValidator.global||=[],this.standaloneValidator.global.push(...this.standaloneValidator.scoped),this.standaloneValidator.scoped=null)),this}group(t,n,r){let o=new e({...this.config,prefix:""});o.singleton={...this.singleton},o.definitions={...this.definitions},o.getServer=()=>this.getServer(),o.inference=Mw(this.inference),o.extender={...this.extender},o["~parser"]=this["~parser"],o.standaloneValidator={local:[...this.standaloneValidator.local??[]],scoped:[...this.standaloneValidator.scoped??[]],global:[...this.standaloneValidator.global??[]]};let i=typeof n=="object",s=(i?r:n)(o);return this.singleton=fn(this.singleton,o.singleton),this.definitions=fn(this.definitions,o.definitions),s.event.request?.length&&(this.event.request=[...this.event.request||[],...s.event.request||[]]),s.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...s.event.mapResponse||[]]),this.model(s.definitions.type),Object.values(o.router.history).forEach(({method:a,path:c,handler:l,hooks:u})=>{if(c=(i?"":this.config.prefix??"")+t+c,i){let{body:d,headers:p,query:m,params:h,cookie:g,response:y,...b}=n,w=u;this.applyMacro(b);let C=d||p||m||h||g||y;this.add(a,c,l,is(b,{...w||{},error:w.error?Array.isArray(w.error)?[...w.error??[],...s.event.error??[]]:[w.error,...s.event.error??[]]:s.event.error,standaloneValidator:b.standaloneValidator||w.standaloneValidator||C?[...b.standaloneValidator??[],...w.standaloneValidator??[],...C?[{body:d,headers:p,query:m,params:h,cookie:g,response:y}]:[]]:void 0}),void 0)}else this.add(a,c,l,is(u,{error:s.event.error}),{skipPrefix:!0})}),this}guard(t,n){if(!n){if(typeof t=="object"){this.applyMacro(t),t.detail&&(this.config.detail?this.config.detail=fn(Object.assign({},this.config.detail),t.detail):this.config.detail=t.detail),t.tags&&(this.config.detail?this.config.detail.tags=t.tags:this.config.detail={tags:t.tags});let i=t.as??"local";if(t.schema==="standalone"){this.standaloneValidator[i]||(this.standaloneValidator[i]=[]);let s=t?.response?typeof t.response=="string"||F in t.response||"~standard"in t.response?{200:t.response}:t?.response:void 0;this.standaloneValidator[i].push({body:t.body,headers:t.headers,params:t.params,query:t.query,response:s,cookie:t.cookie})}else this.validator[i]={body:t.body??this.validator[i]?.body,headers:t.headers??this.validator[i]?.headers,params:t.params??this.validator[i]?.params,query:t.query??this.validator[i]?.query,response:t.response??this.validator[i]?.response,cookie:t.cookie??this.validator[i]?.cookie};return t.parse&&this.on({as:i},"parse",t.parse),t.transform&&this.on({as:i},"transform",t.transform),t.derive&&this.on({as:i},"derive",t.derive),t.beforeHandle&&this.on({as:i},"beforeHandle",t.beforeHandle),t.resolve&&this.on({as:i},"resolve",t.resolve),t.afterHandle&&this.on({as:i},"afterHandle",t.afterHandle),t.mapResponse&&this.on({as:i},"mapResponse",t.mapResponse),t.afterResponse&&this.on({as:i},"afterResponse",t.afterResponse),t.error&&this.on({as:i},"error",t.error),this}return this.guard({},t)}let r=new e({...this.config,prefix:""});r.singleton={...this.singleton},r.definitions={...this.definitions},r.inference=Mw(this.inference),r.extender={...this.extender},r.getServer=()=>this.getServer();let o=n(r);if(this.singleton=fn(this.singleton,r.singleton),this.definitions=fn(this.definitions,r.definitions),o.getServer=()=>this.server,o.event.request?.length&&(this.event.request=[...this.event.request||[],...o.event.request||[]]),o.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...o.event.mapResponse||[]]),this.model(o.definitions.type),Object.values(r.router.history).forEach(({method:i,path:s,handler:a,hooks:c})=>{let{body:l,headers:u,query:d,params:p,cookie:m,response:h,...g}=t,y=l||u||d||p||m||h;this.add(i,s,a,is(g,{...c||{},error:c.error?Array.isArray(c.error)?[...c.error??[],...o.event.error??[]]:[c.error,...o.event.error??[]]:o.event.error,standaloneValidator:y?[...c.standaloneValidator??[],{body:l,headers:u,query:d,params:p,cookie:m,response:h}]:c.standaloneValidator}))}),r.promisedModules.size>0){let i=r.router.history.length;for(let s of r.promisedModules.promises)this.promisedModules.add(s.then(()=>{let{body:a,headers:c,query:l,params:u,cookie:d,response:p,...m}=t,h=a||c||l||u||d||p,g=i;i=r.router.history.length;for(let y=g;y<r.router.history.length;y++){let{method:b,path:w,handler:C,hooks:k}=r.router.history[y];this.add(b,w,C,is(m,{...k||{},error:k.error?Array.isArray(k.error)?[...k.error??[],...o.event.error??[]]:[k.error,...o.event.error??[]]:o.event.error,standaloneValidator:h?[...k.standaloneValidator??[],{body:a,headers:c,query:l,params:u,cookie:d,response:p}]:k.standaloneValidator}))}}))}return this}use(t){if(!t)return this;if(Array.isArray(t)){let n=this;for(let r of t)n=n.use(r);return n}return t instanceof Promise?(this.promisedModules.add(t.then((n)=>{if(typeof n=="function")return n(this);if(n instanceof e)return this._use(n).compile();if(n.constructor?.name==="Elysia")return this._use(n).compile();if(typeof n.default=="function")return n.default(this);if(n.default instanceof e)return this._use(n.default);if(n.constructor?.name==="Elysia")return this._use(n.default);if(n.constructor?.name==="_Elysia")return this._use(n.default);try{return this._use(n.default)}catch(r){throw console.error('Invalid plugin type. Expected Elysia instance, function, or module with "default" as Elysia instance or function that returns Elysia instance.'),r}}).then((n)=>(n&&typeof n.compile=="function"&&n.compile(),n))),this):this._use(t)}propagatePromiseModules(t){if(t.promisedModules.size<=0)return this;for(let n of t.promisedModules.promises)this.promisedModules.add(n.then((r)=>{if(!r)return;let o=this._use(r);return o instanceof Promise?o.then((i)=>{i?i.compile():r.compile()}):r.compile()}));return this}_use(t){if(typeof t=="function"){let o=t(this);return o instanceof Promise?(this.promisedModules.add(o.then((i)=>{if(i instanceof e){i.getServer=()=>this.getServer(),i.getGlobalRoutes=()=>this.getGlobalRoutes(),i.getGlobalDefinitions=()=>this.getGlobalDefinitions(),i.model(this.definitions.type),i.error(this.definitions.error);for(let{method:s,path:a,handler:c,hooks:l}of Object.values(i.router.history))this.add(s,a,c,l,void 0);return i===this?void 0:(this.propagatePromiseModules(i),i)}return typeof i=="function"?i(this):typeof i.default=="function"?i.default(this):this._use(i)}).then((i)=>(i&&typeof i.compile=="function"&&i.compile(),i))),this):o}this.propagatePromiseModules(t);let n=t.config.name,r=t.config.seed;if(t.getParent=()=>this,t.getServer=()=>this.getServer(),t.getGlobalRoutes=()=>this.getGlobalRoutes(),t.getGlobalDefinitions=()=>this.getGlobalDefinitions(),t.standaloneValidator?.scoped&&(this.standaloneValidator.local?this.standaloneValidator.local=this.standaloneValidator.local.concat(t.standaloneValidator.scoped):this.standaloneValidator.local=t.standaloneValidator.scoped),t.standaloneValidator?.global&&(this.standaloneValidator.global?this.standaloneValidator.global=this.standaloneValidator.global.concat(t.standaloneValidator.global):this.standaloneValidator.global=t.standaloneValidator.global),je(t["~parser"])&&(this["~parser"]={...t["~parser"],...this["~parser"]}),t.setHeaders&&this.headers(t.setHeaders),n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?na(n+JSON.stringify(r)):0;this.dependencies[n].some(({checksum:i})=>o===i)||(this.extender.macro={...this.extender.macro,...t.extender.macro},this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions))}else je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro}),t.extender.higherOrderFunctions.length&&(this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions));if(t.extender.higherOrderFunctions.length){BE(this.extender.higherOrderFunctions);let o=[];for(let i=0;i<this.extender.higherOrderFunctions.length;i++){let s=this.extender.higherOrderFunctions[i];s.checksum&&(o.includes(s.checksum)&&(this.extender.higherOrderFunctions.splice(i,1),i--),o.push(s.checksum))}o.length=0}this.inference=_w(this.inference,t.inference),je(t.singleton.decorator)&&this.decorate(t.singleton.decorator),je(t.singleton.store)&&this.state(t.singleton.store),je(t.definitions.type)&&this.model(t.definitions.type),je(t.definitions.error)&&this.error(t.definitions.error),je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro});for(let{method:o,path:i,handler:s,hooks:a}of Object.values(t.router.history))this.add(o,i,s,a);if(n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?na(n+JSON.stringify(r)):0;if(this.dependencies[n].some(({checksum:i})=>o===i))return this;this.dependencies[n].push(this.config?.analytic?{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies,stack:t.telemetry?.stack,routes:t.router.history,decorators:t.singleton,store:t.singleton.store,error:t.definitions.error,derive:t.event.transform?.filter((i)=>i?.subType==="derive").map((i)=>({fn:i.toString(),stack:Error().stack??""})),resolve:t.event.transform?.filter((i)=>i?.subType==="resolve").map((i)=>({fn:i.toString(),stack:Error().stack??""}))}:{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies}),je(t.event)&&(this.event=CE(this.event,ME(t.event),o))}else je(t.event)&&(this.event=CE(this.event,ME(t.event)));return t.validator.global&&(this.validator.global=is(this.validator.global,{...t.validator.global})),t.validator.scoped&&(this.validator.local=is(this.validator.local,{...t.validator.scoped})),this}macro(t,n){if(typeof t=="string"&&!n)throw Error("Macro function is required");return typeof t=="string"?this.extender.macro[t]=n:this.extender.macro={...this.extender.macro,...t},this}applyMacro(t,n=t,{iteration:r=0,applied:o={}}={}){if(r>=16)return;let i=this.extender.macro;for(let[s,a]of Object.entries(n)){if(!(s in i))continue;let c=typeof i[s]=="function"?i[s](a):i[s];if(!c||typeof i[s]=="object"&&a===!1)return;let l=na(s+JSON.stringify(c.seed??a));if(!(l in o)){o[l]=!0;for(let[u,d]of Object.entries(c))if(u!=="seed"){if(u in nF){eF(t,u,d),delete t[s];continue}if(u==="introspect"){d?.(t),delete t[s];continue}if(u==="detail"){t.detail||(t.detail={}),t.detail=fn(t.detail,d,{mergeArray:!0}),delete t[s];continue}if(u in i){this.applyMacro(t,{[u]:d},{applied:o,iteration:r+1}),delete t[s];continue}switch((u==="derive"||u==="resolve")&&typeof d=="function"&&(d={fn:d,subType:u}),typeof t[u]){case"function":t[u]=[t[u],d];break;case"object":Array.isArray(t[u])?t[u].push(d):t[u]=[t[u],d];break;case"undefined":t[u]=d;break}delete t[s]}}}}mount(t,n,r){if(t instanceof e||typeof t=="function"||t.length===0||t==="/"){let a=typeof t=="function"?t:t instanceof e?t.compile().fetch:n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),c=({request:l,path:u})=>a(new Request(Rw(l.url,u),l));return this.route("ALL","/*",c,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:a}}),this}let o=n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),i=(typeof t=="string"&&this.config.prefix?this.config.prefix+t:t).length-(t.endsWith("*")?1:0),s=({request:a,path:c})=>o(new Request(Rw(a.url,c.slice(i)||"/"),a));return this.route("ALL",t,s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this.route("ALL",t+(t.endsWith("/")?"*":"/*"),s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this}get(t,n,r){return this.add("GET",t,n,r),this}post(t,n,r){return this.add("POST",t,n,r),this}put(t,n,r){return this.add("PUT",t,n,r),this}patch(t,n,r){return this.add("PATCH",t,n,r),this}delete(t,n,r){return this.add("DELETE",t,n,r),this}options(t,n,r){return this.add("OPTIONS",t,n,r),this}all(t,n,r){return this.add("ALL",t,n,r),this}head(t,n,r){return this.add("HEAD",t,n,r),this}connect(t,n,r){return this.add("CONNECT",t,n,r),this}route(t,n,r,o){return this.add(t.toUpperCase(),n,r,o,o?.config),this}ws(t,n){return this["~adapter"].ws?this["~adapter"].ws(this,t,n):console.warn("Current adapter doesn't support WebSocket"),this}state(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return!r||!je(r)?this:n?((n in this.singleton.store)?this.singleton.store[n]=fn(this.singleton.store[n],r,{override:o==="override"}):this.singleton.store[n]=r,this):r===null?this:(this.singleton.store=fn(this.singleton.store,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r):this.singleton.store=r(this.singleton.store),this;default:return(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r),this}}decorate(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return n?((n in this.singleton.decorator)?this.singleton.decorator[n]=fn(this.singleton.decorator[n],r,{override:o==="override"}):this.singleton.decorator[n]=r,this):r===null?this:(this.singleton.decorator=fn(this.singleton.decorator,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r):this.singleton.decorator=r(this.singleton.decorator),this;default:return(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r),this}}derive(t,n){n||(n=t,t={as:"local"});let r={subType:"derive",fn:n};return this.onTransform(t,r)}model(t,n){let r=(o)=>{let i={};for(let s in o)"~standard"in o[s]||(i[s]=o[s]);return i};switch(typeof t){case"object":let o={},i=Object.entries(t);if(!i.length)return this;for(let[c,l]of i)c in this.definitions.type||("~standard"in l?this.definitions.type[c]=l:(o[c]=this.definitions.type[c]=l,o[c].$id??=`#/components/schemas/${c}`));return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...o}),this;case"function":let s=t(this.definitions.type);return this.definitions.type=s,this.definitions.typebox=X.Module(r(s)),this;case"string":if(!n)break;if(this.definitions.type[t]=n,"~standard"in n)return this;let a={...n,id:n.$id??`#/components/schemas/${t}`};return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...a}),this}return n?(this.definitions.type[t]=n,("~standard"in n)?this:(this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,[t]:n}),this)):this}Ref(t){return X.Ref(t)}mapDerive(t,n){n||(n=t,t={as:"local"});let r={subType:"mapDerive",fn:n};return this.onTransform(t,r)}affix(t,n,r){if(r==="")return this;let o=["_","-"," "],i=(l)=>l[0].toUpperCase()+l.slice(1),s=t==="prefix"?(l,u)=>o.includes(l.at(-1)??"")?l+u:l+i(u):o.includes(r.at(-1)??"")?(l,u)=>u+l:(l,u)=>u+i(l),a=(l)=>{let u={};switch(l){case"decorator":for(let d in this.singleton.decorator)u[s(r,d)]=this.singleton.decorator[d];this.singleton.decorator=u;break;case"state":for(let d in this.singleton.store)u[s(r,d)]=this.singleton.store[d];this.singleton.store=u;break;case"model":for(let d in this.definitions.type)u[s(r,d)]=this.definitions.type[d];this.definitions.type=u;break;case"error":for(let d in this.definitions.error)u[s(r,d)]=this.definitions.error[d];this.definitions.error=u;break}},c=Array.isArray(n)?n:[n];for(let l of c.some((u)=>u==="all")?["decorator","state","model","error"]:c)a(l);return this}prefix(t,n){return this.affix("prefix",t,n)}suffix(t,n){return this.affix("suffix",t,n)}compile(){return this["~adapter"].beforeCompile?.(this),this["~adapter"].isWebStandard?(this._handle=this.config.aot?mS(this):PR(this),Object.defineProperty(this,"fetch",{value:this._handle,configurable:!0,writable:!0}),typeof this.server?.reload=="function"&&this.server.reload({...this.server||{},fetch:this.fetch}),this):(typeof this.server?.reload=="function"&&this.server.reload(this.server||{}),this._handle=mS(this),this)}get fetch(){let t=this.config.aot?mS(this):PR(this);return Object.defineProperty(this,"fetch",{value:t,configurable:!0,writable:!0}),t}get modules(){return this.promisedModules}},Vo=ySe;var Vp={name:"@kabmo-labs/kabmo",version:"0.34.0",description:"Web console and diagnostic workbench for AI coding agents: Elysia + Preact on Bun.",license:"MIT",author:"Wijanarko Putra Rajeb <wijanarko.rajeb@gmail.com>",type:"module",engines:{bun:">=1.4.0"},publishConfig:{access:"public"},bin:{kabmo:"./src/cli/kabmo.js"},repository:{type:"git",url:"git+https://github.com/kabmo-labs/kabmo.git"},homepage:"https://github.com/kabmo-labs/kabmo#readme",bugs:{url:"https://github.com/kabmo-labs/kabmo/issues"},keywords:["kabmo","coding-agent","agent","console","elysia","preact","bun"],files:["src","extensions","index.html","bunfig.toml","public","tsconfig.json","marketplace","dist/client"],scripts:{dev:"bun run --hot src/server/index.ts --kabmo-server","dev:lan":"HOST=0.0.0.0 bun run --hot src/server/index.ts --kabmo-server",build:"bun run scripts/build-client.ts","editor:themes":"bun run scripts/editor-themes.mjs","icons:tints":"bun run scripts/icon-tints.mjs","icons:tints:check":"bun run scripts/icon-tints.mjs --check","editor:themes:check":"bun run scripts/editor-themes.mjs --check","omp:schema":"bun run scripts/omp-schema.mjs","omp:schema:check":"bun run scripts/omp-schema.mjs --check",start:"NODE_ENV=production bun run src/server/index.ts --kabmo-server",typecheck:"tsc",clean:"rm -rf dist",lint:"tsc --noEmit","check:fast":"bun check --no-script",test:"bun test","test:e2e":"playwright test --config tests/e2e/playwright.config.ts","readme:media":"bun run scripts/readme-media.ts","shell:wordmark":"bun run scripts/shell-wordmark.mjs","shell:docs":"bun run scripts/shell-document-types.mjs --write","shell:docs:check":"bun run scripts/shell-document-types.mjs --check","typecheck:e2e":"tsc --noEmit -p tests/e2e","typecheck:consumer":"tsc --noEmit -p tsconfig.consumer.json","publish:plugins":"bash .github/scripts/publish-plugin-packages.sh packages/kabmo-sdk packages/kabmo-ui"},dependencies:{"@codemirror/autocomplete":"6.20.4","@codemirror/commands":"6.11.1","@codemirror/language":"6.13.1","@codemirror/legacy-modes":"^6.5.5","@codemirror/lint":"^6.9.7","@codemirror/merge":"6.12.3","@codemirror/search":"6.7.2","@codemirror/state":"6.7.6","@codemirror/view":"6.43.15","@dskripchenko/drawio":"^0.1.0","@fontsource/fira-code":"^5.3.0","@kabmo-labs/kabmo-sdk":"workspace:*","@kabmo-labs/kabmo-ui":"workspace:*","@shikijs/langs":"^4.4.3","@shikijs/themes":"^4.4.3","@tailwindcss/postcss":"^4.1.14",dompurify:"^3.4.15",elysia:"^1.4.30","ghostty-web":"0.4.0-next.21.g640db46","jsonc-parser":"^3.3.1",katex:"^0.18.7","lucide-preact":"^1.47.0",mammoth:"^1.13.0",marked:"^18.0.11","marked-linkify-it":"^4.0.2",mermaid:"^12.0.0",postcss:"^8.5.16",preact:"^10.29.8","qrcode-generator":"^2.0.4",remend:"^1.3.1",ripgrep:"^0.3.1",shiki:"^4.4.3","smol-toml":"^1.9.1",tailwindcss:"^4.1.14",xlsx:"https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",yaml:"^2.9.1"},devDependencies:{"@playwright/test":"^1.64.0","@semantic-release/changelog":"^7.0.0","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^11.0.1","@semantic-release/github":"^12.0.10","@semantic-release/npm":"^13.2.0","@semantic-release/release-notes-generator":"^14.1.1","@types/bun":"1.4.4","@types/node":"^22.14.0","@types/qrcode-generator":"^0.0.16","bun-types":"1.4.4","conventional-changelog-conventionalcommits":"^9.3.1","happy-dom":"^20.14.5",jsqr:"^1.4.0","semantic-release":"^25.0.9",typescript:"~5.8.2"},overrides:{katex:"^0.18.7"},workspaces:["packages/*"]};function yS(e,t,n){let r=e.headers.get("if-none-match");if(r!==null){if(!t)return!1;let i=t.trim().replace(/^W\//,"");return r.split(",").some((s)=>s.trim().replace(/^W\//,"")===i)}let o=e.headers.get("if-modified-since");if(o&&n!==null){let i=Date.parse(o);if(!Number.isNaN(i))return Math.floor(n/1000)*1000<=i}return!1}import{brotliCompressSync as wSe,constants as SSe}from"zlib";function wo(e){if(e.buffer instanceof ArrayBuffer)return e;return new Uint8Array(e)}var CR=1024,b8=/^(text\/|application\/(json|javascript|xml|wasm|svg))/,xSe=["zstd","br","gzip"];function w8(e){return b8.test(e)}function MR(e){if(!e)return null;for(let t of xSe)if(e.includes(t))return t;return null}function OR(e,t){if(t==="zstd")return wo(Bun.zstdCompressSync(e,{level:3}));if(t==="br")return wo(wSe(e,{params:{[SSe.BROTLI_PARAM_QUALITY]:4}}));return wo(Bun.gzipSync(e,{level:6}))}async function ps(e,t){if(!t)return e;let n=e.headers.get("content-type")??"";if(n.includes("text/event-stream"))return e;if(!b8.test(n))return e;if(e.status===204||e.status===304)return e;let r=MR(t);if(!r)return e;let o=wo(new Uint8Array(await e.arrayBuffer()));if(o.byteLength<CR)return vSe(e,o);let i=OR(o,r),s=new Headers(e.headers);return s.set("content-encoding",r),s.set("content-length",String(i.byteLength)),s.append("vary","accept-encoding"),new Response(i,{status:e.status,headers:s})}function vSe(e,t){return new Response(t,{status:e.status,headers:e.headers})}var ma=Bun.env.NODE_ENV!=="production",x8="/_bun/",v8=["/_bun/client/","/_bun/asset/"],NR="/_dev-assets/",S8="no-cache";function k8(e){let t=e;for(let n of v8)t=t.replaceAll(n,NR+n.slice(x8.length));return t}function LR(e){if(!e.startsWith(NR))return null;let t=x8+e.slice(NR.length);return v8.some((n)=>t.startsWith(n))?t:null}async function A8(e,t,n,r={}){let o=LR(t);if(!o)return null;let i=await fetch(new URL(o,n),r),s=i.headers.get("content-type")??"";if(!i.ok||s.startsWith("text/html"))return new Response(`No dev asset at ${o}
|
|
666
|
+
`))}return this}wrap(t){return this.extender.higherOrderFunctions.push({checksum:na(JSON.stringify({name:this.config.name,seed:this.config.seed,content:t.toString()})),fn:t}),this}get models(){let t={};for(let n of Object.keys(this.definitions.type))t[n]=Gt(this.definitions.typebox.Import(n),{models:this.definitions.type});return t.modules=this.definitions.typebox,t}add(t,n,r,o,i){let s=i?.skipPrefix??!1,a=i?.allowMeta??!1;o??={},this.applyMacro(o);let c=[];if(o.standaloneValidator&&(c=c.concat(o.standaloneValidator)),this.standaloneValidator.local&&(c=c.concat(this.standaloneValidator.local)),this.standaloneValidator.scoped&&(c=c.concat(this.standaloneValidator.scoped)),this.standaloneValidator.global&&(c=c.concat(this.standaloneValidator.global)),n!==""&&n.charCodeAt(0)!==47&&(n="/"+n),this.config.prefix&&!s&&(n=this.config.prefix+n),o?.type)switch(o.type){case"text":o.type="text/plain";break;case"json":o.type="application/json";break;case"formdata":o.type="multipart/form-data";break;case"urlencoded":o.type="application/x-www-form-urlencoded";break;case"arrayBuffer":o.type="application/octet-stream";break;default:break}let l=this.validator.getCandidate(),u={body:o?.body??l?.body,headers:o?.headers??l?.headers,params:o?.params??l?.params,query:o?.query??l?.query,cookie:o?.cookie??l?.cookie,response:o?.response??l?.response},d=this.config.precompile===!0||typeof this.config.precompile=="object"&&this.config.precompile.compose===!0,p=()=>{let v=this.definitions.type,N=!this.config.aot,O=this.config.normalize,G=this.definitions.typebox,Y=()=>this.config.sanitize,ne=()=>{if(u.cookie||c.find((J)=>J.cookie))return e8({modules:G,validator:u.cookie,defaultConfig:this.config.cookie,normalize:O,config:u.cookie?.config??{},dynamic:N,models:v,validators:c.map((J)=>J.cookie),sanitize:Y})};return d?{body:Gt(u.body,{modules:G,dynamic:N,models:v,normalize:O,additionalCoerce:(()=>{let J=SR(u.body,v,G);return J&&F in J&&(Nn("File",J)||Nn("Files",J))?bR():ph()})(),validators:c.map((J)=>J.body),sanitize:Y}),headers:Gt(u.headers,{modules:G,dynamic:N,models:v,additionalProperties:!0,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.headers),sanitize:Y}),params:Gt(u.params,{modules:G,dynamic:N,models:v,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.params),sanitize:Y}),query:Gt(u.query,{modules:G,dynamic:N,models:v,normalize:O,coerce:!0,additionalCoerce:yR(),validators:c.map((J)=>J.query),sanitize:Y}),cookie:ne(),response:uS(u.response,{modules:G,dynamic:N,models:v,normalize:O,validators:c.map((J)=>J.response),sanitize:Y})}:{createBody(){return this.body?this.body:this.body=Gt(u.body,{modules:G,dynamic:N,models:v,normalize:O,additionalCoerce:(()=>{let J=SR(u.body,v,G);return J&&F in J&&(Nn("File",J)||Nn("Files",J))?bR():ph()})(),validators:c.map((J)=>J.body),sanitize:Y})},createHeaders(){return this.headers?this.headers:this.headers=Gt(u.headers,{modules:G,dynamic:N,models:v,normalize:O,additionalProperties:!O,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.headers),sanitize:Y})},createParams(){return this.params?this.params:this.params=Gt(u.params,{modules:G,dynamic:N,models:v,normalize:O,coerce:!0,additionalCoerce:Su(),validators:c.map((J)=>J.params),sanitize:Y})},createQuery(){return this.query?this.query:this.query=Gt(u.query,{modules:G,dynamic:N,models:v,normalize:O,coerce:!0,additionalCoerce:yR(),validators:c.map((J)=>J.query),sanitize:Y})},createCookie(){return this.cookie?this.cookie:this.cookie=ne()},createResponse(){return this.response?this.response:this.response=uS(u.response,{modules:G,dynamic:N,models:v,normalize:O,validators:c.map((J)=>J.response),sanitize:Y})}}};(l.body||l.cookie||l.headers||l.params||l.query||l.response)&&(o=is(o,l)),o.tags&&(o.detail?o.detail.tags=o.tags:o.detail={tags:o.tags}),je(this.config.detail)&&(o.detail=fn(Object.assign({},this.config.detail),o.detail));let m=je(this.event)?is(this.event,LE(o)):{...Z6(LE(o))};if(c.length&&Object.assign(m,{standaloneValidator:c}),this.config.aot===!1){let v=p();this.router.dynamic.add(t,n,{validator:v,hooks:m,content:o?.type,handle:r,route:n});let N=su(n,{dynamic:!0});if(n!==N&&this.router.dynamic.add(t,N,{validator:v,hooks:m,content:o?.type,handle:r,route:n}),!this.config.strictPath){let O=iu(n);this.router.dynamic.add(t,O,{validator:v,hooks:m,content:o?.type,handle:r,route:n});let G=su(O);O!==G&&this.router.dynamic.add(t,O,{validator:v,hooks:m,content:o?.type,handle:r,route:n})}this.router.history.push({method:t,path:n,composed:null,handler:r,compile:void 0,hooks:m});return}let h=this["~adapter"].handler,g=typeof r!="function"?()=>{let v=h.createNativeStaticHandler?.(r,m,{headers:Object.assign({},this.setHeaders)});return v instanceof Promise?v.then((N)=>{if(N)return N}):v?.()}:void 0,y=this.config.nativeStaticResponse===!0,b=(v)=>{!y||!g||(Ow?this.router.response[v]?this.router.response[v][t]=g():this.router.response[v]={[t]:g()}:this.router.response[v]=g())};b(n);let w,C=()=>{if(w)return w;let v=n8({app:this,path:n,method:t,hooks:m,validator:p(),handler:typeof r!="function"&&typeof h.createStaticHandler!="function"?()=>r:r,allowMeta:a,inference:this.inference});return this.router.history[R]&&(w=this.router.history[R].composed=v),v},k;if(`${t}_${n}`in this.routeTree)for(let v=0;v<this.router.history.length;v++){let N=this.router.history[v];if(N.path===n&&N.method===t){k=v;break}}else this.routeTree[`${t}_${n}`]=this.router.history.length;let R=k??this.router.history.length,P=this.router.history,x=d?C():(v)=>w?w(v):(P[R].composed=C())(v);k!==void 0?this.router.history[k]=Object.assign({method:t,path:n,composed:x,compile:C,handler:r,hooks:m},c.length?{standaloneValidators:c}:void 0,o.webSocket?{websocket:o.websocket}:void 0):this.router.history.push(Object.assign({method:t,path:n,composed:x,compile:C,handler:r,hooks:m},o.webSocket?{websocket:o.websocket}:void 0));let S={handler:d?P[R].composed:void 0,compile(){return this.handler=C()}},E=this.router.static,M=n.indexOf(":")===-1&&n.indexOf("*")===-1;if(t==="WS"){if(M){n in E?E[n][t]=R:E[n]={[t]:R};return}this.router.http.add("WS",n,S),this.config.strictPath||this.router.http.add("WS",iu(n),S);let v=su(n,{dynamic:!0});n!==v&&this.router.http.add("WS",v,S);return}if(M)n in E?E[n][t]=R:E[n]={[t]:R},this.config.strictPath||b(iu(n));else{if(this.router.http.add(t,n,S),!this.config.strictPath){let N=iu(n);b(N),this.router.http.add(t,N,S)}let v=su(n,{dynamic:!0});n!==v&&(this.router.http.add(t,v,S),b(v))}}headers(t){return t?(this.setHeaders||(this.setHeaders={}),this.setHeaders=fn(this.setHeaders,t),this):this}onStart(t){return this.on("start",t),this}onRequest(t){return this.on("request",t),this}onParse(t,n){return n?this.on(t,"parse",n):typeof t=="string"?this.on("parse",this["~parser"][t]):this.on("parse",t)}parser(t,n){return this["~parser"][t]=n,this}onTransform(t,n){return n?this.on(t,"transform",n):this.on("transform",t)}resolve(t,n){n||(n=t,t={as:"local"});let r={subType:"resolve",fn:n};return this.onBeforeHandle(t,r)}mapResolve(t,n){n||(n=t,t={as:"local"});let r={subType:"mapResolve",fn:n};return this.onBeforeHandle(t,r)}onBeforeHandle(t,n){return n?this.on(t,"beforeHandle",n):this.on("beforeHandle",t)}onAfterHandle(t,n){return n?this.on(t,"afterHandle",n):this.on("afterHandle",t)}mapResponse(t,n){return n?this.on(t,"mapResponse",n):this.on("mapResponse",t)}onAfterResponse(t,n){return n?this.on(t,"afterResponse",n):this.on("afterResponse",t)}trace(t,n){n||(n=t,t={as:"local"}),Array.isArray(n)||(n=[n]);for(let r of n)this.on(t,"trace",z5(r));return this}error(t,n){switch(typeof t){case"string":return n.prototype[au]=t,this.definitions.error[t]=n,this;case"function":return this.definitions.error=t(this.definitions.error),this}for(let[r,o]of Object.entries(t))o.prototype[au]=r,this.definitions.error[r]=o;return this}onError(t,n){return n?this.on(t,"error",n):this.on("error",t)}onStop(t){return this.on("stop",t),this}on(t,n,r){let o;switch(typeof t){case"string":o=t,r=n;break;case"object":o=n,!Array.isArray(n)&&typeof n=="object"&&(r=n);break}Array.isArray(r)?r=mn(r):typeof r=="function"?r=[{fn:r}]:r=[r];let i=r;for(let s of i)s.scope=typeof t=="string"?"local":t?.as??"local",(o==="resolve"||o==="derive")&&(s.subType=o);o!=="trace"&&(this.inference=hu({[o]:i.map((s)=>s.fn)},this.inference,this.config.sucrose));for(let s of i){let a=_6(s,"global",{skipIfHasType:!0});switch((this.config.name||this.config.seed)&&(a.checksum=na(this.config.name+JSON.stringify(this.config.seed))),o){case"start":this.event.start??=[],this.event.start.push(a);break;case"request":this.event.request??=[],this.event.request.push(a);break;case"parse":this.event.parse??=[],this.event.parse.push(a);break;case"transform":this.event.transform??=[],this.event.transform.push(a);break;case"derive":this.event.transform??=[],this.event.transform.push(mn(a,"derive"));break;case"beforeHandle":this.event.beforeHandle??=[],this.event.beforeHandle.push(a);break;case"resolve":this.event.beforeHandle??=[],this.event.beforeHandle.push(mn(a,"resolve"));break;case"afterHandle":this.event.afterHandle??=[],this.event.afterHandle.push(a);break;case"mapResponse":this.event.mapResponse??=[],this.event.mapResponse.push(a);break;case"afterResponse":this.event.afterResponse??=[],this.event.afterResponse.push(a);break;case"trace":this.event.trace??=[],this.event.trace.push(a);break;case"error":this.event.error??=[],this.event.error.push(a);break;case"stop":this.event.stop??=[],this.event.stop.push(a);break}}return this}as(t){return ia(this.event.parse,t),ia(this.event.transform,t),ia(this.event.beforeHandle,t),ia(this.event.afterHandle,t),ia(this.event.mapResponse,t),ia(this.event.afterResponse,t),ia(this.event.trace,t),ia(this.event.error,t),t==="scoped"?(this.validator.scoped=Rp(this.validator.scoped,this.validator.local),this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null)):t==="global"&&(this.validator.global=Rp(this.validator.global,Rp(this.validator.scoped,this.validator.local)),this.validator.scoped=null,this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null),this.standaloneValidator.scoped!==null&&(this.standaloneValidator.global||=[],this.standaloneValidator.global.push(...this.standaloneValidator.scoped),this.standaloneValidator.scoped=null)),this}group(t,n,r){let o=new e({...this.config,prefix:""});o.singleton={...this.singleton},o.definitions={...this.definitions},o.getServer=()=>this.getServer(),o.inference=Mw(this.inference),o.extender={...this.extender},o["~parser"]=this["~parser"],o.standaloneValidator={local:[...this.standaloneValidator.local??[]],scoped:[...this.standaloneValidator.scoped??[]],global:[...this.standaloneValidator.global??[]]};let i=typeof n=="object",s=(i?r:n)(o);return this.singleton=fn(this.singleton,o.singleton),this.definitions=fn(this.definitions,o.definitions),s.event.request?.length&&(this.event.request=[...this.event.request||[],...s.event.request||[]]),s.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...s.event.mapResponse||[]]),this.model(s.definitions.type),Object.values(o.router.history).forEach(({method:a,path:c,handler:l,hooks:u})=>{if(c=(i?"":this.config.prefix??"")+t+c,i){let{body:d,headers:p,query:m,params:h,cookie:g,response:y,...b}=n,w=u;this.applyMacro(b);let C=d||p||m||h||g||y;this.add(a,c,l,is(b,{...w||{},error:w.error?Array.isArray(w.error)?[...w.error??[],...s.event.error??[]]:[w.error,...s.event.error??[]]:s.event.error,standaloneValidator:b.standaloneValidator||w.standaloneValidator||C?[...b.standaloneValidator??[],...w.standaloneValidator??[],...C?[{body:d,headers:p,query:m,params:h,cookie:g,response:y}]:[]]:void 0}),void 0)}else this.add(a,c,l,is(u,{error:s.event.error}),{skipPrefix:!0})}),this}guard(t,n){if(!n){if(typeof t=="object"){this.applyMacro(t),t.detail&&(this.config.detail?this.config.detail=fn(Object.assign({},this.config.detail),t.detail):this.config.detail=t.detail),t.tags&&(this.config.detail?this.config.detail.tags=t.tags:this.config.detail={tags:t.tags});let i=t.as??"local";if(t.schema==="standalone"){this.standaloneValidator[i]||(this.standaloneValidator[i]=[]);let s=t?.response?typeof t.response=="string"||F in t.response||"~standard"in t.response?{200:t.response}:t?.response:void 0;this.standaloneValidator[i].push({body:t.body,headers:t.headers,params:t.params,query:t.query,response:s,cookie:t.cookie})}else this.validator[i]={body:t.body??this.validator[i]?.body,headers:t.headers??this.validator[i]?.headers,params:t.params??this.validator[i]?.params,query:t.query??this.validator[i]?.query,response:t.response??this.validator[i]?.response,cookie:t.cookie??this.validator[i]?.cookie};return t.parse&&this.on({as:i},"parse",t.parse),t.transform&&this.on({as:i},"transform",t.transform),t.derive&&this.on({as:i},"derive",t.derive),t.beforeHandle&&this.on({as:i},"beforeHandle",t.beforeHandle),t.resolve&&this.on({as:i},"resolve",t.resolve),t.afterHandle&&this.on({as:i},"afterHandle",t.afterHandle),t.mapResponse&&this.on({as:i},"mapResponse",t.mapResponse),t.afterResponse&&this.on({as:i},"afterResponse",t.afterResponse),t.error&&this.on({as:i},"error",t.error),this}return this.guard({},t)}let r=new e({...this.config,prefix:""});r.singleton={...this.singleton},r.definitions={...this.definitions},r.inference=Mw(this.inference),r.extender={...this.extender},r.getServer=()=>this.getServer();let o=n(r);if(this.singleton=fn(this.singleton,r.singleton),this.definitions=fn(this.definitions,r.definitions),o.getServer=()=>this.server,o.event.request?.length&&(this.event.request=[...this.event.request||[],...o.event.request||[]]),o.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...o.event.mapResponse||[]]),this.model(o.definitions.type),Object.values(r.router.history).forEach(({method:i,path:s,handler:a,hooks:c})=>{let{body:l,headers:u,query:d,params:p,cookie:m,response:h,...g}=t,y=l||u||d||p||m||h;this.add(i,s,a,is(g,{...c||{},error:c.error?Array.isArray(c.error)?[...c.error??[],...o.event.error??[]]:[c.error,...o.event.error??[]]:o.event.error,standaloneValidator:y?[...c.standaloneValidator??[],{body:l,headers:u,query:d,params:p,cookie:m,response:h}]:c.standaloneValidator}))}),r.promisedModules.size>0){let i=r.router.history.length;for(let s of r.promisedModules.promises)this.promisedModules.add(s.then(()=>{let{body:a,headers:c,query:l,params:u,cookie:d,response:p,...m}=t,h=a||c||l||u||d||p,g=i;i=r.router.history.length;for(let y=g;y<r.router.history.length;y++){let{method:b,path:w,handler:C,hooks:k}=r.router.history[y];this.add(b,w,C,is(m,{...k||{},error:k.error?Array.isArray(k.error)?[...k.error??[],...o.event.error??[]]:[k.error,...o.event.error??[]]:o.event.error,standaloneValidator:h?[...k.standaloneValidator??[],{body:a,headers:c,query:l,params:u,cookie:d,response:p}]:k.standaloneValidator}))}}))}return this}use(t){if(!t)return this;if(Array.isArray(t)){let n=this;for(let r of t)n=n.use(r);return n}return t instanceof Promise?(this.promisedModules.add(t.then((n)=>{if(typeof n=="function")return n(this);if(n instanceof e)return this._use(n).compile();if(n.constructor?.name==="Elysia")return this._use(n).compile();if(typeof n.default=="function")return n.default(this);if(n.default instanceof e)return this._use(n.default);if(n.constructor?.name==="Elysia")return this._use(n.default);if(n.constructor?.name==="_Elysia")return this._use(n.default);try{return this._use(n.default)}catch(r){throw console.error('Invalid plugin type. Expected Elysia instance, function, or module with "default" as Elysia instance or function that returns Elysia instance.'),r}}).then((n)=>(n&&typeof n.compile=="function"&&n.compile(),n))),this):this._use(t)}propagatePromiseModules(t){if(t.promisedModules.size<=0)return this;for(let n of t.promisedModules.promises)this.promisedModules.add(n.then((r)=>{if(!r)return;let o=this._use(r);return o instanceof Promise?o.then((i)=>{i?i.compile():r.compile()}):r.compile()}));return this}_use(t){if(typeof t=="function"){let o=t(this);return o instanceof Promise?(this.promisedModules.add(o.then((i)=>{if(i instanceof e){i.getServer=()=>this.getServer(),i.getGlobalRoutes=()=>this.getGlobalRoutes(),i.getGlobalDefinitions=()=>this.getGlobalDefinitions(),i.model(this.definitions.type),i.error(this.definitions.error);for(let{method:s,path:a,handler:c,hooks:l}of Object.values(i.router.history))this.add(s,a,c,l,void 0);return i===this?void 0:(this.propagatePromiseModules(i),i)}return typeof i=="function"?i(this):typeof i.default=="function"?i.default(this):this._use(i)}).then((i)=>(i&&typeof i.compile=="function"&&i.compile(),i))),this):o}this.propagatePromiseModules(t);let n=t.config.name,r=t.config.seed;if(t.getParent=()=>this,t.getServer=()=>this.getServer(),t.getGlobalRoutes=()=>this.getGlobalRoutes(),t.getGlobalDefinitions=()=>this.getGlobalDefinitions(),t.standaloneValidator?.scoped&&(this.standaloneValidator.local?this.standaloneValidator.local=this.standaloneValidator.local.concat(t.standaloneValidator.scoped):this.standaloneValidator.local=t.standaloneValidator.scoped),t.standaloneValidator?.global&&(this.standaloneValidator.global?this.standaloneValidator.global=this.standaloneValidator.global.concat(t.standaloneValidator.global):this.standaloneValidator.global=t.standaloneValidator.global),je(t["~parser"])&&(this["~parser"]={...t["~parser"],...this["~parser"]}),t.setHeaders&&this.headers(t.setHeaders),n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?na(n+JSON.stringify(r)):0;this.dependencies[n].some(({checksum:i})=>o===i)||(this.extender.macro={...this.extender.macro,...t.extender.macro},this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions))}else je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro}),t.extender.higherOrderFunctions.length&&(this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions));if(t.extender.higherOrderFunctions.length){BE(this.extender.higherOrderFunctions);let o=[];for(let i=0;i<this.extender.higherOrderFunctions.length;i++){let s=this.extender.higherOrderFunctions[i];s.checksum&&(o.includes(s.checksum)&&(this.extender.higherOrderFunctions.splice(i,1),i--),o.push(s.checksum))}o.length=0}this.inference=_w(this.inference,t.inference),je(t.singleton.decorator)&&this.decorate(t.singleton.decorator),je(t.singleton.store)&&this.state(t.singleton.store),je(t.definitions.type)&&this.model(t.definitions.type),je(t.definitions.error)&&this.error(t.definitions.error),je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro});for(let{method:o,path:i,handler:s,hooks:a}of Object.values(t.router.history))this.add(o,i,s,a);if(n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?na(n+JSON.stringify(r)):0;if(this.dependencies[n].some(({checksum:i})=>o===i))return this;this.dependencies[n].push(this.config?.analytic?{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies,stack:t.telemetry?.stack,routes:t.router.history,decorators:t.singleton,store:t.singleton.store,error:t.definitions.error,derive:t.event.transform?.filter((i)=>i?.subType==="derive").map((i)=>({fn:i.toString(),stack:Error().stack??""})),resolve:t.event.transform?.filter((i)=>i?.subType==="resolve").map((i)=>({fn:i.toString(),stack:Error().stack??""}))}:{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies}),je(t.event)&&(this.event=CE(this.event,ME(t.event),o))}else je(t.event)&&(this.event=CE(this.event,ME(t.event)));return t.validator.global&&(this.validator.global=is(this.validator.global,{...t.validator.global})),t.validator.scoped&&(this.validator.local=is(this.validator.local,{...t.validator.scoped})),this}macro(t,n){if(typeof t=="string"&&!n)throw Error("Macro function is required");return typeof t=="string"?this.extender.macro[t]=n:this.extender.macro={...this.extender.macro,...t},this}applyMacro(t,n=t,{iteration:r=0,applied:o={}}={}){if(r>=16)return;let i=this.extender.macro;for(let[s,a]of Object.entries(n)){if(!(s in i))continue;let c=typeof i[s]=="function"?i[s](a):i[s];if(!c||typeof i[s]=="object"&&a===!1)return;let l=na(s+JSON.stringify(c.seed??a));if(!(l in o)){o[l]=!0;for(let[u,d]of Object.entries(c))if(u!=="seed"){if(u in nF){eF(t,u,d),delete t[s];continue}if(u==="introspect"){d?.(t),delete t[s];continue}if(u==="detail"){t.detail||(t.detail={}),t.detail=fn(t.detail,d,{mergeArray:!0}),delete t[s];continue}if(u in i){this.applyMacro(t,{[u]:d},{applied:o,iteration:r+1}),delete t[s];continue}switch((u==="derive"||u==="resolve")&&typeof d=="function"&&(d={fn:d,subType:u}),typeof t[u]){case"function":t[u]=[t[u],d];break;case"object":Array.isArray(t[u])?t[u].push(d):t[u]=[t[u],d];break;case"undefined":t[u]=d;break}delete t[s]}}}}mount(t,n,r){if(t instanceof e||typeof t=="function"||t.length===0||t==="/"){let a=typeof t=="function"?t:t instanceof e?t.compile().fetch:n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),c=({request:l,path:u})=>a(new Request(Rw(l.url,u),l));return this.route("ALL","/*",c,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:a}}),this}let o=n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),i=(typeof t=="string"&&this.config.prefix?this.config.prefix+t:t).length-(t.endsWith("*")?1:0),s=({request:a,path:c})=>o(new Request(Rw(a.url,c.slice(i)||"/"),a));return this.route("ALL",t,s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this.route("ALL",t+(t.endsWith("/")?"*":"/*"),s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this}get(t,n,r){return this.add("GET",t,n,r),this}post(t,n,r){return this.add("POST",t,n,r),this}put(t,n,r){return this.add("PUT",t,n,r),this}patch(t,n,r){return this.add("PATCH",t,n,r),this}delete(t,n,r){return this.add("DELETE",t,n,r),this}options(t,n,r){return this.add("OPTIONS",t,n,r),this}all(t,n,r){return this.add("ALL",t,n,r),this}head(t,n,r){return this.add("HEAD",t,n,r),this}connect(t,n,r){return this.add("CONNECT",t,n,r),this}route(t,n,r,o){return this.add(t.toUpperCase(),n,r,o,o?.config),this}ws(t,n){return this["~adapter"].ws?this["~adapter"].ws(this,t,n):console.warn("Current adapter doesn't support WebSocket"),this}state(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return!r||!je(r)?this:n?((n in this.singleton.store)?this.singleton.store[n]=fn(this.singleton.store[n],r,{override:o==="override"}):this.singleton.store[n]=r,this):r===null?this:(this.singleton.store=fn(this.singleton.store,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r):this.singleton.store=r(this.singleton.store),this;default:return(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r),this}}decorate(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return n?((n in this.singleton.decorator)?this.singleton.decorator[n]=fn(this.singleton.decorator[n],r,{override:o==="override"}):this.singleton.decorator[n]=r,this):r===null?this:(this.singleton.decorator=fn(this.singleton.decorator,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r):this.singleton.decorator=r(this.singleton.decorator),this;default:return(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r),this}}derive(t,n){n||(n=t,t={as:"local"});let r={subType:"derive",fn:n};return this.onTransform(t,r)}model(t,n){let r=(o)=>{let i={};for(let s in o)"~standard"in o[s]||(i[s]=o[s]);return i};switch(typeof t){case"object":let o={},i=Object.entries(t);if(!i.length)return this;for(let[c,l]of i)c in this.definitions.type||("~standard"in l?this.definitions.type[c]=l:(o[c]=this.definitions.type[c]=l,o[c].$id??=`#/components/schemas/${c}`));return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...o}),this;case"function":let s=t(this.definitions.type);return this.definitions.type=s,this.definitions.typebox=X.Module(r(s)),this;case"string":if(!n)break;if(this.definitions.type[t]=n,"~standard"in n)return this;let a={...n,id:n.$id??`#/components/schemas/${t}`};return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...a}),this}return n?(this.definitions.type[t]=n,("~standard"in n)?this:(this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,[t]:n}),this)):this}Ref(t){return X.Ref(t)}mapDerive(t,n){n||(n=t,t={as:"local"});let r={subType:"mapDerive",fn:n};return this.onTransform(t,r)}affix(t,n,r){if(r==="")return this;let o=["_","-"," "],i=(l)=>l[0].toUpperCase()+l.slice(1),s=t==="prefix"?(l,u)=>o.includes(l.at(-1)??"")?l+u:l+i(u):o.includes(r.at(-1)??"")?(l,u)=>u+l:(l,u)=>u+i(l),a=(l)=>{let u={};switch(l){case"decorator":for(let d in this.singleton.decorator)u[s(r,d)]=this.singleton.decorator[d];this.singleton.decorator=u;break;case"state":for(let d in this.singleton.store)u[s(r,d)]=this.singleton.store[d];this.singleton.store=u;break;case"model":for(let d in this.definitions.type)u[s(r,d)]=this.definitions.type[d];this.definitions.type=u;break;case"error":for(let d in this.definitions.error)u[s(r,d)]=this.definitions.error[d];this.definitions.error=u;break}},c=Array.isArray(n)?n:[n];for(let l of c.some((u)=>u==="all")?["decorator","state","model","error"]:c)a(l);return this}prefix(t,n){return this.affix("prefix",t,n)}suffix(t,n){return this.affix("suffix",t,n)}compile(){return this["~adapter"].beforeCompile?.(this),this["~adapter"].isWebStandard?(this._handle=this.config.aot?mS(this):PR(this),Object.defineProperty(this,"fetch",{value:this._handle,configurable:!0,writable:!0}),typeof this.server?.reload=="function"&&this.server.reload({...this.server||{},fetch:this.fetch}),this):(typeof this.server?.reload=="function"&&this.server.reload(this.server||{}),this._handle=mS(this),this)}get fetch(){let t=this.config.aot?mS(this):PR(this);return Object.defineProperty(this,"fetch",{value:t,configurable:!0,writable:!0}),t}get modules(){return this.promisedModules}},Vo=ySe;var Vp={name:"@kabmo-labs/kabmo",version:"0.35.0",description:"Web console and diagnostic workbench for AI coding agents: Elysia + Preact on Bun.",license:"MIT",author:"Wijanarko Putra Rajeb <wijanarko.rajeb@gmail.com>",type:"module",engines:{bun:">=1.4.0"},publishConfig:{access:"public"},bin:{kabmo:"./src/cli/kabmo.js"},repository:{type:"git",url:"git+https://github.com/kabmo-labs/kabmo.git"},homepage:"https://github.com/kabmo-labs/kabmo#readme",bugs:{url:"https://github.com/kabmo-labs/kabmo/issues"},keywords:["kabmo","coding-agent","agent","console","elysia","preact","bun"],files:["src","extensions","index.html","bunfig.toml","public","tsconfig.json","marketplace","dist/client"],scripts:{dev:"bun run --hot src/server/index.ts --kabmo-server","dev:lan":"HOST=0.0.0.0 bun run --hot src/server/index.ts --kabmo-server",build:"bun run scripts/build-client.ts","editor:themes":"bun run scripts/editor-themes.mjs","icons:tints":"bun run scripts/icon-tints.mjs","icons:tints:check":"bun run scripts/icon-tints.mjs --check","editor:themes:check":"bun run scripts/editor-themes.mjs --check","omp:schema":"bun run scripts/omp-schema.mjs","omp:schema:check":"bun run scripts/omp-schema.mjs --check",start:"NODE_ENV=production bun run src/server/index.ts --kabmo-server",typecheck:"tsc",clean:"rm -rf dist",lint:"tsc --noEmit","check:fast":"bun check --no-script",test:"bun test","test:e2e":"playwright test --config tests/e2e/playwright.config.ts","readme:media":"bun run scripts/readme-media.ts","shell:wordmark":"bun run scripts/shell-wordmark.mjs","shell:docs":"bun run scripts/shell-document-types.mjs --write","shell:docs:check":"bun run scripts/shell-document-types.mjs --check","typecheck:e2e":"tsc --noEmit -p tests/e2e","typecheck:consumer":"tsc --noEmit -p tsconfig.consumer.json","publish:plugins":"bash .github/scripts/publish-plugin-packages.sh packages/kabmo-sdk packages/kabmo-ui"},dependencies:{"@codemirror/autocomplete":"6.20.4","@codemirror/commands":"6.11.1","@codemirror/language":"6.13.1","@codemirror/legacy-modes":"^6.5.5","@codemirror/lint":"^6.9.7","@codemirror/merge":"6.12.3","@codemirror/search":"6.7.2","@codemirror/state":"6.7.6","@codemirror/view":"6.43.15","@dskripchenko/drawio":"^0.1.0","@fontsource/fira-code":"^5.3.0","@kabmo-labs/kabmo-sdk":"workspace:*","@kabmo-labs/kabmo-ui":"workspace:*","@shikijs/langs":"^4.4.3","@shikijs/themes":"^4.4.3","@tailwindcss/postcss":"^4.1.14",dompurify:"^3.4.15",elysia:"^1.4.30","ghostty-web":"0.4.0-next.21.g640db46","jsonc-parser":"^3.3.1",katex:"^0.18.7","lucide-preact":"^1.47.0",mammoth:"^1.13.0",marked:"^18.0.11","marked-linkify-it":"^4.0.2",mermaid:"^12.0.0",postcss:"^8.5.16",preact:"^10.29.8","qrcode-generator":"^2.0.4",remend:"^1.3.1",ripgrep:"^0.3.1",shiki:"^4.4.3","smol-toml":"^1.9.1",tailwindcss:"^4.1.14",xlsx:"https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",yaml:"^2.9.1"},devDependencies:{"@playwright/test":"^1.64.0","@semantic-release/changelog":"^7.0.0","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^11.0.1","@semantic-release/github":"^12.0.10","@semantic-release/npm":"^13.2.0","@semantic-release/release-notes-generator":"^14.1.1","@types/bun":"1.4.4","@types/node":"^22.14.0","@types/qrcode-generator":"^0.0.16","bun-types":"1.4.4","conventional-changelog-conventionalcommits":"^9.3.1","happy-dom":"^20.14.5",jsqr:"^1.4.0","semantic-release":"^25.0.9",typescript:"~5.8.2"},overrides:{katex:"^0.18.7"},workspaces:["packages/*"]};function yS(e,t,n){let r=e.headers.get("if-none-match");if(r!==null){if(!t)return!1;let i=t.trim().replace(/^W\//,"");return r.split(",").some((s)=>s.trim().replace(/^W\//,"")===i)}let o=e.headers.get("if-modified-since");if(o&&n!==null){let i=Date.parse(o);if(!Number.isNaN(i))return Math.floor(n/1000)*1000<=i}return!1}import{brotliCompressSync as wSe,constants as SSe}from"zlib";function wo(e){if(e.buffer instanceof ArrayBuffer)return e;return new Uint8Array(e)}var CR=1024,b8=/^(text\/|application\/(json|javascript|xml|wasm|svg))/,xSe=["zstd","br","gzip"];function w8(e){return b8.test(e)}function MR(e){if(!e)return null;for(let t of xSe)if(e.includes(t))return t;return null}function OR(e,t){if(t==="zstd")return wo(Bun.zstdCompressSync(e,{level:3}));if(t==="br")return wo(wSe(e,{params:{[SSe.BROTLI_PARAM_QUALITY]:4}}));return wo(Bun.gzipSync(e,{level:6}))}async function ps(e,t){if(!t)return e;let n=e.headers.get("content-type")??"";if(n.includes("text/event-stream"))return e;if(!b8.test(n))return e;if(e.status===204||e.status===304)return e;let r=MR(t);if(!r)return e;let o=wo(new Uint8Array(await e.arrayBuffer()));if(o.byteLength<CR)return vSe(e,o);let i=OR(o,r),s=new Headers(e.headers);return s.set("content-encoding",r),s.set("content-length",String(i.byteLength)),s.append("vary","accept-encoding"),new Response(i,{status:e.status,headers:s})}function vSe(e,t){return new Response(t,{status:e.status,headers:e.headers})}var ma=Bun.env.NODE_ENV!=="production",x8="/_bun/",v8=["/_bun/client/","/_bun/asset/"],NR="/_dev-assets/",S8="no-cache";function k8(e){let t=e;for(let n of v8)t=t.replaceAll(n,NR+n.slice(x8.length));return t}function LR(e){if(!e.startsWith(NR))return null;let t=x8+e.slice(NR.length);return v8.some((n)=>t.startsWith(n))?t:null}async function A8(e,t,n,r={}){let o=LR(t);if(!o)return null;let i=await fetch(new URL(o,n),r),s=i.headers.get("content-type")??"";if(!i.ok||s.startsWith("text/html"))return new Response(`No dev asset at ${o}
|
|
667
667
|
`,{status:404,headers:{"content-type":"text/plain; charset=utf-8"}});let a=new Uint8Array(await i.arrayBuffer()),c=`"${Bun.hash(a).toString(16)}"`;if(yS(e,c,null))return new Response(null,{status:304,headers:{etag:c,"cache-control":S8}});return ps(new Response(a,{headers:{"content-type":s||"application/octet-stream","cache-control":S8,etag:c}}),e.headers.get("accept-encoding"))}var DR=ma?(await import("@/../index.html")).default:null;function f(e,t={}){let n=new Headers(t.headers);if(!n.has("content-type"))n.set("content-type","application/json; charset=utf-8");return new Response(JSON.stringify(e),{status:t.status??200,headers:n})}var ee={"cache-control":"no-store"};function z(e,t,n={}){let r=[];if(e.loader)r.push({method:"GET",path:t,handler:e.loader});else if(e.action)r.push({method:"GET",path:t,handler:V});if(e.action)for(let o of n.mutating??["POST","PUT","PATCH","DELETE"])r.push({method:o,path:t,handler:e.action});return r}var V=()=>ms();function ms(){return new Response(JSON.stringify({error:"Method not allowed"}),{status:405,headers:{"content-type":"application/json; charset=utf-8"}})}async function Lt(e){try{return{ok:!0,body:await e.json()}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function xn(e,t){let n=e[t];return n?n:null}function So(e,t=500){return f({error:e instanceof Error?e.message:String(e)},{status:t})}async function kSe(e){if(e instanceof Response)return e;if(e instanceof ReadableStream)return new Response(e,{headers:{"content-type":"text/event-stream","cache-control":"no-cache"}});return new Response(JSON.stringify(e??null),{status:200,headers:{"content-type":"application/json; charset=utf-8"}})}function ASe(e){return async({request:t,params:n})=>{try{let r=await kSe(await e({request:t,params:n}));return await ps(r,t.headers.get("accept-encoding"))}catch(r){let o=r instanceof Error?r.message:String(r);return new Response(JSON.stringify({error:o}),{status:500,headers:{"content-type":"application/json; charset=utf-8"}})}}}function T8(e,t){let n=e;for(let{method:r,path:o,handler:i}of t){let s=ASe(i);if(r==="GET")n=n.get(o,s);else if(r==="POST")n=n.post(o,s);else if(r==="PUT")n=n.put(o,s);else if(r==="PATCH")n=n.patch(o,s);else n=n.delete(o,s)}return n}function at(e,t,n){return[{method:"GET",path:t,handler:n??V},...["POST","PUT","PATCH","DELETE"].map((r)=>({method:r,path:t,handler:e}))]}import{existsSync as FR,realpathSync as TSe}from"fs";import{homedir as E8,tmpdir as rmt}from"os";import*as an from"path";var R8="omp",ESe=".omp";function P8(){return Bun.env.PI_CONFIG_DIR||ESe}function xo(){return an.join(E8(),P8())}function le(){let e=Bun.env.PI_CODING_AGENT_DIR;if(e)return an.resolve(e);return an.join(xo(),"agent")}function I8(){let e=Bun.env.PI_CODING_AGENT_DIR;if(e)return an.resolve(e)===an.join(xo(),"agent");return!0}function RSe(){if(process.platform!=="linux"&&process.platform!=="darwin")return;if(!I8())return;let e=Bun.env.XDG_DATA_HOME;if(!e)return;try{let t=an.join(e,R8);return FR(t)?t:void 0}catch{return}}function PSe(e){let t=RSe();return an.join(t??le(),e)}function zo(){return PSe("sessions")}function C8(){return an.join(le(),"projects.json")}function M8(){if(process.platform!=="linux"&&process.platform!=="darwin")return xo();if(!I8())return xo();let e=Bun.env.XDG_DATA_HOME;if(!e)return xo();try{let t=an.join(e,R8);return FR(t)?t:xo()}catch{return xo()}}function O8(){return an.join(M8(),"plugins")}function BR(){return an.join(M8(),"marketplaces.json")}function N8(e){let t=E8(),n=P8(),r=an.resolve(e);for(let o of[n,".git"]){let i=r;while(i!==t){if(FR(an.join(i,o)))return an.join(i,n,"plugins");let s=an.dirname(i);if(s===i)break;i=s}}return an.join(r,n,"plugins")}function ku(e){try{return TSe.native(e)}catch{return e}}async function _(e){try{return await Bun.file(e).stat(),!0}catch{return!1}}function vo(e){let t=ku(e);return t.replace(/\/+$/,"")||t}import jR from"fs";import*as wS from"path";function A(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Dn(e){let t=[];for(let n of e.split(`
|
|
668
668
|
`)){let r=n.trim();if(!r)continue;try{t.push(JSON.parse(r))}catch{}}return t}function L8(e){let t=e.endsWith("\\")?e.slice(0,-1):e;try{return JSON.parse(`"${t}"`)}catch{return t.replace(/\\n/g,`
|
|
669
669
|
`).replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}}function Ln(e,t,n=0){let r=e.indexOf(`"${t}"`,n);if(r===-1)return;let o=e.indexOf(":",r+t.length+2);if(o===-1)return;let i=o+1;while(i<e.length){let c=e.charCodeAt(i);if(c!==32&&c!==9&&c!==10&&c!==13)break;i++}if(e.charCodeAt(i)!==34)return;let s=i+1,a=!1;for(let c=s;c<e.length;c++){let l=e.charCodeAt(c);if(a){a=!1;continue}if(l===92){a=!0;continue}if(l===34)return L8(e.slice(s,c))}return L8(e.slice(s))}function F8(e){let t=0,n=0;while(n<e.length){let r=e.indexOf('"type"',n);if(r===-1)break;let o=e.indexOf(":",r+6);if(o===-1)break;if(Ln(e,"type",r)==="message")t++;n=o+1}return t}function D8(e){if(e===void 0)return;return e.trim()?e:null}function ISe(e,t){if(e?.type!=="session"||typeof e.id!=="string")return;return{id:e.id,cwd:typeof e.cwd==="string"?e.cwd:void 0,title:t===null?void 0:t??(typeof e.title==="string"?e.title:void 0),parentSession:typeof e.parentSession==="string"?e.parentSession:void 0,timestamp:typeof e.timestamp==="string"?e.timestamp:void 0}}function CSe(e,t){if(Ln(e,"type")!=="session")return;let n=Ln(e,"id");if(!n)return;return{id:n,cwd:Ln(e,"cwd"),title:t===null?void 0:t??Ln(e,"title"),parentSession:Ln(e,"parentSession"),timestamp:Ln(e,"timestamp")}}function B8(e,t){let n=t[0],r=D8(n?.type==="title"&&typeof n.title==="string"?n.title:void 0),o=ISe(t[n?.type==="title"?1:0],r);if(o)return o;let i,s=!0;for(let a of e.split(/\r?\n/)){let c=a.trim();if(!c)continue;if(s&&Ln(c,"type")==="title"){i=D8(Ln(c,"title")),s=!1;continue}return CSe(c,i)}return}var UR=4096,MSe=16384,U8=1048576;async function j8(e,t){let n=Bun.file(e),r=await n.stat(),o=Math.min(t,r.size);return{text:o>0?await n.slice(0,o).text():"",size:r.size,mtime:new Date(r.mtimeMs),mtimeMs:r.mtimeMs}}var OSe={session_exit:!0};function NSe(e){let t,n,r,o=!1;try{let a=JSON.parse(e);if(A(a))o=!0,t=a.type,n=a.customType,r=a.timestamp}catch{}if(!o)r=Ln(e,"timestamp"),t=Ln(e,"type"),n=Ln(e,"customType");let i;if(typeof r==="number"&&Number.isFinite(r))i=new Date(r);else if(typeof r==="string"){let a=new Date(r);if(!Number.isNaN(a.getTime()))i=a}if(!i)return;let s=t==="custom"&&typeof n==="string"&&OSe[n]===!0;return{at:i,lifecycle:s}}async function H8(e,t,n){if(t<=0)return;let r=MSe;for(;;){let o=Math.max(0,t-r),i;if(t<=UR)i=n;else if(o===0)try{i=await Bun.file(e).text()}catch{return}else try{i=await Bun.file(e).slice(o-1).text()}catch{return}let s=i.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u,e}from"./index-
|
|
2
|
-
`),c=o?(i,n,t)=>{s(
|
|
1
|
+
import{u,e}from"./index-ncrenheb.js";import{wc,nA,ef,Cc}from"./index-2v1nmxwr.js";function w({content:d,path:l,onChange:s}){let r=u(()=>nA(d,l),[d,l]),o=s!==void 0&&!r.truncated,a=d.endsWith(`
|
|
2
|
+
`),c=o?(i,n,t)=>{s(ef(r.header,Cc(r.rows,i,n,t),r.delimiter,a))}:void 0,h=o?(i,n)=>{let t=r.header.slice();while(t.length<=i)t.push("");t[i]=n,s(ef(t,r.rows,r.delimiter,a))}:void 0;return e(wc,{header:r.header,rows:r.rows,truncated:r.truncated,readOnlyNote:r.truncated?"This file is too large to edit in the grid — use Show source.":o?"Paste is not supported — double-click a cell to edit it.":"This grid is read-only — use Show source to edit the cells.",onEditCell:c,onEditHeader:h})}export{w as CsvGrid};
|