Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
feat(cli): consolidate cli commands (#1688)
Kyle Mendell2d8f6f9e5b83
diff --git a/cli/go.mod b/cli/go.modindex 592957185..b7e8566f1 100644--- a/cli/go.mod+++ b/cli/go.mod@@ -3,12 +3,14 @@ module github.com/getarcaneapp/arcane/cligo 1.25.6require (+ github.com/charmbracelet/bubbles v0.21.0+ github.com/charmbracelet/bubbletea v1.3.4github.com/charmbracelet/fang v0.4.4+ github.com/charmbracelet/lipgloss v1.1.0github.com/charmbracelet/x/term v0.2.2github.com/fatih/color v1.18.0github.com/getarcaneapp/arcane/types v0.0.0-20260110011808-8759100aa57cgithub.com/mattn/go-runewidth v0.0.19- github.com/schollz/progressbar/v3 v3.19.0github.com/sirupsen/logrus v1.9.4github.com/spf13/cobra v1.10.2go.withmatt.com/size v0.0.0-20250220224316-11aee5773e67@@ -17,38 +19,46 @@ require (require (charm.land/lipgloss/v2 v2.0.0-beta.3.0.20251106193318-19329a3e8410 // indirect- github.com/charmbracelet/colorprofile v0.3.3 // indirect+ github.com/atotto/clipboard v0.1.4 // indirect+ github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect+ github.com/charmbracelet/colorprofile v0.4.1 // indirect+ github.com/charmbracelet/harmonica v0.2.0 // indirectgithub.com/charmbracelet/ultraviolet v0.0.0-20251106190538-99ea45596692 // indirect- github.com/charmbracelet/x/ansi v0.11.0 // indirect+ github.com/charmbracelet/x/ansi v0.11.6 // indirect+ github.com/charmbracelet/x/cellbuf v0.0.15 // indirectgithub.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444 // indirectgithub.com/charmbracelet/x/termios v0.1.1 // indirectgithub.com/charmbracelet/x/windows v0.2.2 // indirect- github.com/clipperhouse/displaywidth v0.4.1 // indirect+ github.com/clipperhouse/displaywidth v0.9.0 // indirectgithub.com/clipperhouse/stringish v0.1.1 // indirect- github.com/clipperhouse/uax29/v2 v2.3.0 // indirect+ github.com/clipperhouse/uax29/v2 v2.5.0 // indirectgithub.com/compose-spec/compose-go/v2 v2.10.1 // indirectgithub.com/distribution/reference v0.6.0 // indirectgithub.com/docker/docker v28.5.2+incompatible // indirectgithub.com/docker/go-connections v0.6.0 // indirectgithub.com/docker/go-units v0.5.0 // indirect+ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirectgithub.com/go-viper/mapstructure/v2 v2.5.0 // indirectgithub.com/inconshreveable/mousetrap v1.1.0 // indirectgithub.com/kr/pretty v0.3.1 // indirectgithub.com/lucasb-eyer/go-colorful v1.3.0 // indirectgithub.com/mattn/go-colorable v0.1.14 // indirectgithub.com/mattn/go-isatty v0.0.20 // indirect+ github.com/mattn/go-localereader v0.0.1 // indirectgithub.com/mattn/go-shellwords v1.0.12 // indirect- github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirectgithub.com/moby/docker-image-spec v1.3.1 // indirect+ github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirectgithub.com/muesli/cancelreader v0.2.2 // indirectgithub.com/muesli/mango v0.1.0 // indirectgithub.com/muesli/mango-cobra v1.2.0 // indirectgithub.com/muesli/mango-pflag v0.1.0 // indirectgithub.com/muesli/roff v0.1.0 // indirect+ github.com/muesli/termenv v0.16.0 // indirectgithub.com/opencontainers/go-digest v1.0.0 // indirectgithub.com/opencontainers/image-spec v1.1.1 // indirectgithub.com/rivo/uniseg v0.4.7 // indirectgithub.com/rogpeppe/go-internal v1.14.1 // indirect+ github.com/sahilm/fuzzy v0.1.1 // indirectgithub.com/spf13/pflag v1.0.10 // indirectgithub.com/xhit/go-str2duration/v2 v2.1.0 // indirectgithub.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect@@ -56,7 +66,6 @@ require (golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirectgolang.org/x/sync v0.19.0 // indirectgolang.org/x/sys v0.40.0 // indirect- golang.org/x/term v0.39.0 // indirectgolang.org/x/text v0.33.0 // indirectgopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect)diff --git a/cli/go.sum b/cli/go.sumindex 033931218..4b0fcc380 100644--- a/cli/go.sum+++ b/cli/go.sum@@ -1,15 +1,29 @@charm.land/lipgloss/v2 v2.0.0-beta.3.0.20251106193318-19329a3e8410 h1:D9PbaszZYpB4nj+d6HTWr1onlmlyuGVNfL9gAi8iB3k=charm.land/lipgloss/v2 v2.0.0-beta.3.0.20251106193318-19329a3e8410/go.mod h1:1qZyvvVCenJO2M1ac2mX0yyiIZJoZmDM4DG4s0udJkU=+github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=+github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=+github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=+github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY=github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E=-github.com/charmbracelet/colorprofile v0.3.3 h1:DjJzJtLP6/NZ8p7Cgjno0CKGr7wwRJGxWUwh2IyhfAI=-github.com/charmbracelet/colorprofile v0.3.3/go.mod h1:nB1FugsAbzq284eJcjfah2nhdSLppN2NqvfotkfRYP4=+github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs=+github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg=+github.com/charmbracelet/bubbletea v1.3.4 h1:kCg7B+jSCFPLYRA52SDZjr51kG/fMUEoPoZrkaDHyoI=+github.com/charmbracelet/bubbletea v1.3.4/go.mod h1:dtcUCyCGEX3g9tosuYiut3MXgY/Jsv9nKVdibKKRRXo=+github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk=+github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=github.com/charmbracelet/fang v0.4.4 h1:G4qKxF6or/eTPgmAolwPuRNyuci3hTUGGX1rj1YkHJY=github.com/charmbracelet/fang v0.4.4/go.mod h1:P5/DNb9DddQ0Z0dbc0P3ol4/ix5Po7Ofr2KMBfAqoCo=+github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=+github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=+github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=+github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=github.com/charmbracelet/ultraviolet v0.0.0-20251106190538-99ea45596692 h1:r/3jQZ1LjWW6ybp8HHfhrKrwHIWiJhUuY7wwYIWZulQ=github.com/charmbracelet/ultraviolet v0.0.0-20251106190538-99ea45596692/go.mod h1:Y8B4DzWeTb0ama8l3+KyopZtkE8fZjwRQ3aEAPEXHE0=-github.com/charmbracelet/x/ansi v0.11.0 h1:uuIVK7GIplwX6UBIz8S2TF8nkr7xRlygSsBRjSJqIvA=-github.com/charmbracelet/x/ansi v0.11.0/go.mod h1:uQt8bOrq/xgXjlGcFMc8U2WYbnxyjrKhnvTQluvfCaE=+github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=+github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=+github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=+github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=github.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444 h1:IJDiTgVE56gkAGfq0lBEloWgkXMk4hl/bmuPoicI4R0=github.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444/go.mod h1:T9jr8CzFpjhFVHjNjKwbAD7KwBNyFnj2pntAO7F2zw0=github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f h1:pk6gmGpCE7F3FcjaOEKYriCvpmIN4+6OS/RD0vm4uIA=@@ -20,14 +34,12 @@ github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo=github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM=github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k=-github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=-github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY=-github.com/clipperhouse/displaywidth v0.4.1 h1:uVw9V8UDfnggg3K2U84VWY1YLQ/x2aKSCtkRyYozfoU=-github.com/clipperhouse/displaywidth v0.4.1/go.mod h1:R+kHuzaYWFkTm7xoMmK1lFydbci4X2CicfbGstSGg0o=+github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA=+github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA=github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=-github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=-github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=+github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w94cO8U=+github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=github.com/compose-spec/compose-go/v2 v2.10.1 h1:mFbXobojGRFIVi1UknrvaDAZ+PkJfyjqkA1yseh+vAU=github.com/compose-spec/compose-go/v2 v2.10.1/go.mod h1:Ohac1SzhO/4fXXrzWIztIVB6ckmKBv1Nt5Z5mGVESUg=github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=@@ -42,6 +54,8 @@ github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMgithub.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=+github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=+github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=github.com/getarcaneapp/arcane/types v0.0.0-20260110011808-8759100aa57c h1:WF99RwEYf1ADwD91nzALE2iaT8NfdF0olUuwQQqwa3s=@@ -59,20 +73,24 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=+github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=+github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=+github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=+github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=-github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=-github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=+github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=+github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=github.com/muesli/mango v0.1.0 h1:DZQK45d2gGbql1arsYA4vfg4d7I9Hfx5rX/GCmzsAvI=@@ -83,6 +101,8 @@ github.com/muesli/mango-pflag v0.1.0 h1:UADqbYgpUyRoBja3g6LUL+3LErjpsOwaC9ywvBWegithub.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0=github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=+github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=+github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=@@ -96,8 +116,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fgithub.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=-github.com/schollz/progressbar/v3 v3.19.0 h1:Ea18xuIRQXLAUidVDox3AbwfUhD0/1IvohyTutOIFoc=-github.com/schollz/progressbar/v3 v3.19.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=+github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA=+github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=@@ -120,11 +140,10 @@ golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tgolang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=+golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=-golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY=-golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww=golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=diff --git a/cli/internal/client/client.go b/cli/internal/client/client.goindex f83bfe1cd..4a9881aad 100644--- a/cli/internal/client/client.go+++ b/cli/internal/client/client.go@@ -30,10 +30,13 @@ import ("io""net/http""net/url"+ "strings""time""github.com/getarcaneapp/arcane/cli/internal/config""github.com/getarcaneapp/arcane/cli/internal/types"+ "github.com/getarcaneapp/arcane/types/auth"+ "github.com/getarcaneapp/arcane/types/base")const (@@ -47,11 +50,12 @@ const (// HTTP requests to various API endpoints. The client automatically includes// authentication headers and handles JSON serialization.type Client struct {- baseURL string- apiKey string- jwtToken string- envID string- httpClient *http.Client+ baseURL string+ apiKey string+ jwtToken string+ refreshToken string+ envID string+ httpClient *http.Client}// New creates a new API client from the provided configuration.@@ -69,11 +73,12 @@ func New(cfg *types.Config) (*Client, error) {}return &Client{- baseURL: cfg.ServerURL,- apiKey: cfg.APIKey,- jwtToken: cfg.JWTToken,- envID: envID,- httpClient: newHTTPClientInternal(),+ baseURL: cfg.ServerURL,+ apiKey: cfg.APIKey,+ jwtToken: cfg.JWTToken,+ refreshToken: cfg.RefreshToken,+ envID: envID,+ httpClient: newHTTPClientInternal(),}, nil}@@ -90,9 +95,10 @@ func NewUnauthenticated(cfg *types.Config) (*Client, error) {}return &Client{- baseURL: cfg.ServerURL,- envID: envID,- httpClient: newHTTPClientInternal(),+ baseURL: cfg.ServerURL,+ envID: envID,+ refreshToken: cfg.RefreshToken,+ httpClient: newHTTPClientInternal(),}, nil}@@ -188,42 +194,37 @@ func (c *Client) Request(ctx context.Context, method, path string, body any) (*hfullURL := u.ResolveReference(rel).String()- var bodyReader io.Reader+ var bodyBytes []byteif body != nil {switch v := body.(type) {case []byte:- // Callers commonly pre-marshal JSON and pass the raw bytes.- // Treat as already-encoded JSON to avoid double-marshalling.- bodyReader = bytes.NewReader(v)+ bodyBytes = vcase json.RawMessage:- bodyReader = bytes.NewReader(v)+ bodyBytes = vcase io.Reader:- // Allow streaming bodies when needed.- bodyReader = v+ // Streaming bodies cannot be replayed, so skip auto-refresh.+ req, err := http.NewRequestWithContext(ctx, method, fullURL, v)+ if err != nil {+ return nil, fmt.Errorf("failed to create request: %w", err)+ }+ c.applyAuth(req)+ req.Header.Set("Content-Type", "application/json")+ req.Header.Set("Accept", "application/json")+ resp, err := c.httpClient.Do(req)+ if err != nil {+ return nil, fmt.Errorf("request failed: %w", err)+ }+ return resp, nildefault:jsonBody, err := json.Marshal(body)if err != nil {return nil, fmt.Errorf("failed to marshal request body: %w", err)}- bodyReader = bytes.NewReader(jsonBody)+ bodyBytes = jsonBody}}- req, err := http.NewRequestWithContext(ctx, method, fullURL, bodyReader)- if err != nil {- return nil, fmt.Errorf("failed to create request: %w", err)- }-- c.applyAuth(req)- req.Header.Set("Content-Type", "application/json")- req.Header.Set("Accept", "application/json")-- resp, err := c.httpClient.Do(req)- if err != nil {- return nil, fmt.Errorf("request failed: %w", err)- }-- return resp, nil+ return c.doRequest(ctx, method, fullURL, bodyBytes, true)}// RequestRaw makes an HTTP request with a raw body and custom headers.@@ -263,6 +264,37 @@ func (c *Client) RequestRaw(ctx context.Context, method, path string, body io.Rereturn resp, nil}+func (c *Client) doRequest(ctx context.Context, method, fullURL string, bodyBytes []byte, allowRefresh bool) (*http.Response, error) {+ var bodyReader io.Reader+ if bodyBytes != nil {+ bodyReader = bytes.NewReader(bodyBytes)+ }++ req, err := http.NewRequestWithContext(ctx, method, fullURL, bodyReader)+ if err != nil {+ return nil, fmt.Errorf("failed to create request: %w", err)+ }++ c.applyAuth(req)+ req.Header.Set("Content-Type", "application/json")+ req.Header.Set("Accept", "application/json")++ resp, err := c.httpClient.Do(req)+ if err != nil {+ return nil, fmt.Errorf("request failed: %w", err)+ }++ if resp.StatusCode == http.StatusUnauthorized && allowRefresh && c.jwtToken != "" && c.refreshToken != "" {+ _ = resp.Body.Close()+ if err := c.refreshAccessToken(ctx); err != nil {+ return nil, err+ }+ return c.doRequest(ctx, method, fullURL, bodyBytes, false)+ }++ return resp, nil+}+func (c *Client) applyAuth(req *http.Request) {// Prefer JWT bearer token if present.if c.jwtToken != "" {@@ -274,6 +306,75 @@ func (c *Client) applyAuth(req *http.Request) {}}+func (c *Client) refreshAccessToken(ctx context.Context) error {+ if c.refreshToken == "" {+ return fmt.Errorf("refresh token not configured; run `arcane auth login`")+ }++ refreshReq := auth.Refresh{RefreshToken: c.refreshToken}+ bodyBytes, err := json.Marshal(refreshReq)+ if err != nil {+ return fmt.Errorf("failed to marshal refresh request: %w", err)+ }++ u, err := url.Parse(c.baseURL)+ if err != nil {+ return fmt.Errorf("invalid base URL: %w", err)+ }+ refreshURL := u.ResolveReference(&url.URL{Path: types.Endpoints.AuthRefresh()}).String()++ req, err := http.NewRequestWithContext(ctx, http.MethodPost, refreshURL, bytes.NewReader(bodyBytes))+ if err != nil {+ return fmt.Errorf("failed to create refresh request: %w", err)+ }+ req.Header.Set("Content-Type", "application/json")+ req.Header.Set("Accept", "application/json")++ resp, err := c.httpClient.Do(req)+ if err != nil {+ return fmt.Errorf("token refresh failed: %w", err)+ }+ defer func() { _ = resp.Body.Close() }()++ respBody, err := io.ReadAll(resp.Body)+ if err != nil {+ return fmt.Errorf("failed to read refresh response: %w", err)+ }++ if resp.StatusCode < 200 || resp.StatusCode >= 300 {+ return fmt.Errorf("token refresh failed (status %d): %s", resp.StatusCode, strings.TrimSpace(string(respBody)))+ }++ var result base.ApiResponse[auth.TokenRefreshResponse]+ if err := json.Unmarshal(respBody, &result); err != nil {+ return fmt.Errorf("failed to parse refresh response: %w", err)+ }+ if !result.Success || result.Data.Token == "" {+ return fmt.Errorf("token refresh failed: unexpected response from server")+ }++ newRefresh := result.Data.RefreshToken+ if newRefresh == "" {+ newRefresh = c.refreshToken+ }++ c.jwtToken = result.Data.Token+ c.refreshToken = newRefresh++ cfg, err := config.Load()+ if err != nil {+ return fmt.Errorf("failed to load config: %w", err)+ }+ cfg.JWTToken = result.Data.Token+ cfg.APIKey = ""+ cfg.RefreshToken = newRefresh+ if err := config.Save(cfg); err != nil {+ return fmt.Errorf("failed to save refreshed token: %w", err)+ }++ return nil+}+// Get makes a GET request to the specified path.// It is a convenience wrapper around Request for retrieving resources.func (c *Client) Get(ctx context.Context, path string) (*http.Response, error) {diff --git a/cli/internal/config/config.go b/cli/internal/config/config.goindex 488f50640..ff3e6b9c3 100644--- a/cli/internal/config/config.go+++ b/cli/internal/config/config.go@@ -24,6 +24,7 @@ import ("fmt""os""path/filepath"+ "strings""github.com/getarcaneapp/arcane/cli/internal/types""gopkg.in/yaml.v3"@@ -39,6 +40,8 @@ const (configFileName = "arcanecli.yml")+var customConfigPath string+// DefaultConfig returns a Config with sensible default values.// The defaults are:// - ServerURL: http://localhost:3552@@ -56,6 +59,10 @@ func DefaultConfig() *types.Config {// The config file is located at ~/.config/arcanecli.yml.// Returns an error if the user's home directory cannot be determined.func ConfigPath() (string, error) {+ if customConfigPath != "" {+ return customConfigPath, nil+ }+home, err := os.UserHomeDir()if err != nil {return "", fmt.Errorf("failed to get home directory: %w", err)@@ -64,6 +71,33 @@ func ConfigPath() (string, error) {return filepath.Join(home, ".config", configFileName), nil}+// SetConfigPath overrides the default configuration file location.+// Accepts absolute or relative paths and expands a leading ~ to the home directory.+func SetConfigPath(path string) error {+ if strings.TrimSpace(path) == "" {+ customConfigPath = ""+ return nil+ }++ path = strings.TrimSpace(path)+ if path == "~" || strings.HasPrefix(path, "~/") {+ home, err := os.UserHomeDir()+ if err != nil {+ return fmt.Errorf("failed to expand config path: %w", err)+ }+ rel := strings.TrimPrefix(path, "~")+ path = filepath.Join(home, strings.TrimPrefix(rel, string(os.PathSeparator)))+ }++ absPath, err := filepath.Abs(path)+ if err != nil {+ return fmt.Errorf("failed to resolve config path: %w", err)+ }++ customConfigPath = absPath+ return nil+}+// Load reads the configuration from disk and returns it.// If the config file does not exist, default values are returned.// Returns an error if the file exists but cannot be read or parsed.diff --git a/cli/internal/output/output.go b/cli/internal/output/output.goindex 955f90770..ee4305196 100644--- a/cli/internal/output/output.go+++ b/cli/internal/output/output.go@@ -17,16 +17,28 @@ import ("regexp""strings"- "github.com/fatih/color"+ "github.com/charmbracelet/lipgloss""github.com/mattn/go-runewidth")+const arcanePurple = lipgloss.Color("#6d28d9")+var (- successColor = color.New(color.FgGreen).SprintFunc()- errorColor = color.New(color.FgRed).SprintFunc()- warnColor = color.New(color.FgYellow).SprintFunc()- infoColor = color.New(color.FgCyan).SprintFunc()- headerColor = color.New(color.FgHiWhite, color.Bold).SprintFunc()+ successStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("10"))+ errorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("9"))+ warnStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("11"))+ infoStyle = lipgloss.NewStyle().Foreground(arcanePurple)+ headerStyle = lipgloss.NewStyle().Bold(true).Foreground(arcanePurple)+ keyStyle = lipgloss.NewStyle().Bold(true)+ valueStyle = lipgloss.NewStyle().Foreground(arcanePurple)+ columnStyle = lipgloss.NewStyle().Foreground(arcanePurple)+ columnHeader = lipgloss.NewStyle().Bold(true).Foreground(arcanePurple)++ statusOnlineStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#22c55e"))+ statusOfflineStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#ef4444"))+ statusWarnStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#f59e0b"))+ statusMutedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#94a3b8"))+ enabledStyle = lipgloss.NewStyle().Foreground(arcanePurple))var ansiRegexp = regexp.MustCompile("\x1b\\[[0-9;]*[a-zA-Z]")@@ -35,35 +47,35 @@ var ansiRegexp = regexp.MustCompile("\x1b\\[[0-9;]*[a-zA-Z]")// The message is prefixed with a newline for visual separation.// Format specifiers and arguments work like fmt.Printf.func Success(format string, a ...interface{}) {- fmt.Printf("\n%s\n", successColor(fmt.Sprintf(format, a...)))+ fmt.Printf("\n%s\n", successStyle.Render(fmt.Sprintf(format, a...)))}// Error prints an error message in red.// The message is prefixed with a newline for visual separation.// Format specifiers and arguments work like fmt.Printf.func Error(format string, a ...interface{}) {- fmt.Printf("\n%s\n", errorColor(fmt.Sprintf(format, a...)))+ fmt.Printf("\n%s\n", errorStyle.Render(fmt.Sprintf(format, a...)))}// Warning prints a warning message in yellow.// The message is prefixed with a newline for visual separation.// Format specifiers and arguments work like fmt.Printf.func Warning(format string, a ...interface{}) {- fmt.Printf("\n%s\n", warnColor(fmt.Sprintf(format, a...)))+ fmt.Printf("\n%s\n", warnStyle.Render(fmt.Sprintf(format, a...)))}// Info prints an info message in cyan.// The message is prefixed with a newline for visual separation.// Format specifiers and arguments work like fmt.Printf.func Info(format string, a ...interface{}) {- fmt.Printf("\n%s\n", infoColor(fmt.Sprintf(format, a...)))+ fmt.Printf("\n%s\n", infoStyle.Render(fmt.Sprintf(format, a...)))}// Header prints a header message in bold white.// Use this to introduce sections of output. The message is prefixed// with a newline for visual separation.func Header(format string, a ...interface{}) {- fmt.Printf("\n%s\n", headerColor(fmt.Sprintf(format, a...)))+ fmt.Printf("\n%s\n", headerStyle.Render(fmt.Sprintf(format, a...)))}// Print prints a standard message without color formatting.@@ -76,7 +88,7 @@ func Print(format string, a ...interface{}) {// This is useful for displaying structured information like image details// or configuration values.func KeyValue(key string, value interface{}) {- fmt.Printf("%s: %v\n", color.New(color.Bold).Sprint(key), color.New(color.FgBlue).Sprint(value))+ fmt.Printf("%s: %v\n", keyStyle.Render(key), valueStyle.Render(fmt.Sprint(value)))}func stripAnsi(s string) string {@@ -86,6 +98,84 @@ func stripAnsi(s string) string {return ansiRegexp.ReplaceAllString(s, "")}+func hasAnsi(s string) bool {+ if s == "" {+ return false+ }+ return ansiRegexp.MatchString(s)+}++// TintStatus applies semantic status coloring to a value.+func TintStatus(value string) string {+ trimmed := strings.TrimSpace(value)+ if trimmed == "" || hasAnsi(trimmed) {+ return value+ }+ lower := strings.ToLower(trimmed)++ switch {+ case lower == "online" || lower == "running" || lower == "healthy" || lower == "active" || strings.HasPrefix(lower, "up"):+ return statusOnlineStyle.Render(trimmed)+ case lower == "offline" || lower == "stopped" || lower == "exited" || lower == "dead" || lower == "unhealthy" || lower == "failed" || strings.HasPrefix(lower, "down"):+ return statusOfflineStyle.Render(trimmed)+ case lower == "paused" || lower == "restarting" || lower == "starting" || lower == "created" || lower == "degraded":+ return statusWarnStyle.Render(trimmed)+ default:+ return statusMutedStyle.Render(trimmed)+ }+}++// TintEnabled applies tints for enabled/disabled values.+func TintEnabled(value string) string {+ trimmed := strings.TrimSpace(value)+ if trimmed == "" || hasAnsi(trimmed) {+ return value+ }+ lower := strings.ToLower(trimmed)+ switch lower {+ case "true", "yes", "enabled", "on":+ return enabledStyle.Render(trimmed)+ case "false", "no", "disabled", "off":+ return statusMutedStyle.Render(trimmed)+ default:+ return value+ }+}++// TintYesNo applies tints for yes/no style values.+func TintYesNo(value string) string {+ trimmed := strings.TrimSpace(value)+ if trimmed == "" || hasAnsi(trimmed) {+ return value+ }+ lower := strings.ToLower(trimmed)+ switch lower {+ case "true", "yes", "y", "in use":+ return statusOnlineStyle.Render(trimmed)+ case "false", "no", "n":+ return statusMutedStyle.Render(trimmed)+ default:+ return value+ }+}++// TintInsecure applies warning tints for insecure values.+func TintInsecure(value string) string {+ trimmed := strings.TrimSpace(value)+ if trimmed == "" || hasAnsi(trimmed) {+ return value+ }+ lower := strings.ToLower(trimmed)+ switch lower {+ case "true", "yes", "y", "insecure":+ return statusWarnStyle.Render(trimmed)+ case "false", "no", "n":+ return statusMutedStyle.Render(trimmed)+ default:+ return value+ }+}+// Table prints a formatted table with headers and rows.// Headers are displayed in bold cyan. The table is rendered with borders// for a clean terminal appearance. Columns are automatically aligned.@@ -97,6 +187,8 @@ func Table(headers []string, rows [][]string) {return}+ rows = tintTableRows(headers, rows)+widths := computeWidths(headers, rows)printHeader(headers, widths)for _, row := range rows {@@ -104,6 +196,37 @@ func Table(headers []string, rows [][]string) {}}+func tintTableRows(headers []string, rows [][]string) [][]string {+ if len(rows) == 0 {+ return rows+ }++ result := make([][]string, len(rows))+ for i, row := range rows {+ if len(row) == 0 {+ result[i] = row+ continue+ }+ styled := make([]string, len(row))+ copy(styled, row)+ for col := 0; col < len(row) && col < len(headers); col++ {+ header := strings.ToUpper(strings.TrimSpace(headers[col]))+ switch header {+ case "STATUS", "STATE":+ styled[col] = TintStatus(row[col])+ case "ENABLED":+ styled[col] = TintEnabled(row[col])+ case "IN USE":+ styled[col] = TintYesNo(row[col])+ case "INSECURE":+ styled[col] = TintInsecure(row[col])+ }+ }+ result[i] = styled+ }+ return result+}+func computeWidths(headers []string, rows [][]string) []int {n := len(headers)widths := make([]int, n)@@ -129,12 +252,11 @@ func computeWidths(headers []string, rows [][]string) []int {}func printHeader(headers []string, widths []int) {- headerFmt := color.New(color.Bold, color.FgHiCyan).SprintFunc()sep := " "n := len(headers)for i, h := range headers {visible := stripAnsi(h)- colored := headerFmt(h)+ colored := columnHeader.Render(h)padLen := widths[i] - runewidth.StringWidth(visible)if padLen < 0 {padLen = 0@@ -150,7 +272,6 @@ func printHeader(headers []string, widths []int) {func printRow(row []string, widths []int, n int) {sep := " "- columnFmt := color.New(color.FgYellow).SprintFunc()// Prepare lines per columncellLines := make([][]string, n)@@ -176,7 +297,7 @@ func printRow(row []string, widths []int, n int) {var rendered stringif i == 0 {- rendered = columnFmt(val)+ rendered = columnStyle.Render(val)} else {rendered = fmt.Sprint(val)}diff --git a/cli/internal/output/tui.go b/cli/internal/output/tui.gonew file mode 100644index 000000000..3c0c0030b--- /dev/null+++ b/cli/internal/output/tui.go@@ -0,0 +1,264 @@+package output++import (+ "fmt"+ "io"+ "sync"++ "github.com/charmbracelet/bubbles/progress"+ "github.com/charmbracelet/bubbles/spinner"+ tea "github.com/charmbracelet/bubbletea"+ "github.com/charmbracelet/lipgloss"+ "go.withmatt.com/size"+)++type spinnerDoneMsg struct{}++type spinnerModel struct {+ spinner spinner.Model+ label string+}++func newSpinnerModel(label string) spinnerModel {+ s := spinner.New()+ s.Spinner = spinner.Dot+ s.Style = lipgloss.NewStyle().Foreground(arcanePurple)+ return spinnerModel{spinner: s, label: label}+}++func (m spinnerModel) Init() tea.Cmd {+ return m.spinner.Tick+}++func (m spinnerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {+ switch msg := msg.(type) {+ case spinnerDoneMsg:+ return m, tea.Quit+ case tea.KeyMsg:+ switch msg.String() {+ case "q", "esc", "ctrl+c":+ return m, tea.Quit+ }+ }++ var cmd tea.Cmd+ m.spinner, cmd = m.spinner.Update(msg)+ return m, cmd+}++func (m spinnerModel) View() string {+ return fmt.Sprintf("%s %s", m.spinner.View(), m.label)+}++// Spinner renders a Bubble Tea spinner inline.+type Spinner struct {+ program *tea.Program+ done chan struct{}+}++// StartSpinner starts a spinner with the given label.+func StartSpinner(label string) *Spinner {+ model := newSpinnerModel(label)+ program := tea.NewProgram(model)+ done := make(chan struct{})++ spinner := &Spinner{program: program, done: done}+ go func() {+ _, _ = program.Run()+ close(done)+ }()++ return spinner+}++// Stop stops the spinner and moves to the next line.+func (s *Spinner) Stop() {+ if s == nil || s.program == nil {+ return+ }+ s.program.Send(spinnerDoneMsg{})+ <-s.done+ fmt.Println()+}++type progressUpdateMsg struct {+ current int64+ total int64+}++type progressLabelMsg string++type progressDoneMsg struct{}++type progressModel struct {+ progress progress.Model+ label string+ current int64+ total int64+}++func newProgressModel(label string, total int64) progressModel {+ p := progress.New(progress.WithDefaultGradient())+ p.Width = 40+ return progressModel{progress: p, label: label, total: total}+}++func (m progressModel) Init() tea.Cmd {+ return m.progress.Init()+}++func (m progressModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {+ switch msg := msg.(type) {+ case progressUpdateMsg:+ m.current = msg.current+ if msg.total > 0 {+ m.total = msg.total+ }+ case progressLabelMsg:+ m.label = string(msg)+ case progressDoneMsg:+ return m, tea.Quit+ case tea.KeyMsg:+ switch msg.String() {+ case "q", "esc", "ctrl+c":+ return m, tea.Quit+ }+ case tea.WindowSizeMsg:+ if msg.Width > 10 {+ m.progress.Width = msg.Width - 10+ }+ }++ var cmd tea.Cmd+ updated, cmd := m.progress.Update(msg)+ if model, ok := updated.(progress.Model); ok {+ m.progress = model+ }+ return m, cmd+}++func (m progressModel) View() string {+ percent := 0.0+ if m.total > 0 {+ percent = float64(m.current) / float64(m.total)+ if percent < 0 {+ percent = 0+ } else if percent > 1 {+ percent = 1+ }+ }++ bar := m.progress.ViewAs(percent)+ if m.total > 0 {+ return fmt.Sprintf("%s\n%s %s/%s", m.label, bar, safeCapacity(m.current), safeCapacity(m.total))+ }+ return fmt.Sprintf("%s\n%s", m.label, bar)+}++func safeCapacity(value int64) size.Capacity {+ if value < 0 {+ return size.Capacity(0)+ }+ return size.Capacity(uint64(value))+}++// Progress renders a Bubble Tea progress bar inline.+type Progress struct {+ program *tea.Program+ done chan struct{}++ mu sync.Mutex+ current int64+ total int64+}++// StartProgress starts a progress bar with the given label and total.+func StartProgress(label string, total int64) *Progress {+ model := newProgressModel(label, total)+ program := tea.NewProgram(model)+ done := make(chan struct{})++ progressUI := &Progress{program: program, done: done, total: total}+ go func() {+ _, _ = program.Run()+ close(done)+ }()++ return progressUI+}++// SetLabel updates the progress label.+func (p *Progress) SetLabel(label string) {+ if p == nil || p.program == nil {+ return+ }+ p.program.Send(progressLabelMsg(label))+}++// SetTotal updates the total value.+func (p *Progress) SetTotal(total int64) {+ if p == nil || p.program == nil {+ return+ }+ p.mu.Lock()+ p.total = total+ current := p.current+ p.mu.Unlock()+ p.program.Send(progressUpdateMsg{current: current, total: total})+}++// SetCurrent sets the current progress value.+func (p *Progress) SetCurrent(current int64) {+ if p == nil || p.program == nil {+ return+ }+ p.mu.Lock()+ p.current = current+ total := p.total+ p.mu.Unlock()+ p.program.Send(progressUpdateMsg{current: current, total: total})+}++// Add increments progress by the given value.+func (p *Progress) Add(delta int64) {+ if p == nil || p.program == nil {+ return+ }+ p.mu.Lock()+ p.current += delta+ current := p.current+ total := p.total+ p.mu.Unlock()+ p.program.Send(progressUpdateMsg{current: current, total: total})+}++// Stop stops the progress bar and moves to the next line.+func (p *Progress) Stop() {+ if p == nil || p.program == nil {+ return+ }+ p.program.Send(progressDoneMsg{})+ <-p.done+ fmt.Println()+}++// NewProgressReader wraps a reader to report progress updates.+func NewProgressReader(r io.Reader, progress *Progress) io.Reader {+ if progress == nil {+ return r+ }+ return &progressReader{reader: r, progress: progress}+}++type progressReader struct {+ reader io.Reader+ progress *Progress+}++func (p *progressReader) Read(buf []byte) (int, error) {+ n, err := p.reader.Read(buf)+ if n > 0 {+ p.progress.Add(int64(n))+ }+ return n, err+}diff --git a/cli/internal/prompt/prompt.go b/cli/internal/prompt/prompt.goindex 778b0f734..f0a3affed 100644--- a/cli/internal/prompt/prompt.go+++ b/cli/internal/prompt/prompt.go@@ -1,12 +1,11 @@package promptimport (- "bufio""fmt""os"- "strconv"- "strings"+ "github.com/charmbracelet/bubbles/list"+ tea "github.com/charmbracelet/bubbletea""github.com/charmbracelet/x/term")@@ -20,35 +19,96 @@ func Select(label string, options []string) (int, error) {if len(options) == 0 {return -1, fmt.Errorf("no %s options available", label)}+ if !IsInteractive() {+ return -1, fmt.Errorf("interactive terminal required")+ }- reader := bufio.NewReader(os.Stdin)- for {- fmt.Printf("\nMultiple %s match. Select one:\n", label)- for i, option := range options {- fmt.Printf(" %d) %s\n", i+1, option)- }- fmt.Printf("Enter number (1-%d): ", len(options))+ items := make([]list.Item, len(options))+ for i, option := range options {+ items[i] = selectItem{index: i, title: option}+ }- input, err := reader.ReadString('\n')- if err != nil {- return -1, fmt.Errorf("failed to read selection: %w", err)- }+ model := newSelectModel(label, items)+ program := tea.NewProgram(model)+ finalModel, err := program.Run()+ if err != nil {+ return -1, err+ }- input = strings.TrimSpace(input)- if input == "" {- return -1, fmt.Errorf("selection required")- }+ result, ok := finalModel.(selectModel)+ if !ok {+ return -1, fmt.Errorf("failed to read selection")+ }+ if result.canceled {+ return -1, fmt.Errorf("selection canceled")+ }+ if result.choice < 0 {+ return -1, fmt.Errorf("selection required")+ }+ return result.choice, nil+}- if strings.EqualFold(input, "q") || strings.EqualFold(input, "quit") {- return -1, fmt.Errorf("selection canceled")- }+type selectItem struct {+ index int+ title string+}- index, err := strconv.Atoi(input)- if err != nil || index < 1 || index > len(options) {- fmt.Println("Invalid selection. Try again or press q to cancel.")- continue- }+func (i selectItem) Title() string { return i.title }+func (i selectItem) Description() string { return "" }+func (i selectItem) FilterValue() string { return i.title }- return index - 1, nil+type selectModel struct {+ list list.Model+ choice int+ canceled bool+}++func newSelectModel(label string, items []list.Item) selectModel {+ delegate := list.NewDefaultDelegate()+ model := selectModel{list: list.New(items, delegate, 0, 0), choice: -1}+ model.list.Title = fmt.Sprintf("Select %s", label)+ model.list.SetShowStatusBar(false)+ model.list.SetFilteringEnabled(true)+ model.list.SetShowHelp(true)+ return model+}++func (m selectModel) Init() tea.Cmd {+ return nil+}++func (m selectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {+ switch msg := msg.(type) {+ case tea.WindowSizeMsg:+ width := msg.Width+ height := msg.Height - 4+ if height < 6 {+ height = 6+ }+ if width < 20 {+ width = 20+ }+ m.list.SetSize(width, height)+ return m, nil+ case tea.KeyMsg:+ switch msg.String() {+ case "q", "esc", "ctrl+c":+ m.canceled = true+ return m, tea.Quit+ case "enter":+ selected, ok := m.list.SelectedItem().(selectItem)+ if ok {+ m.choice = selected.index+ }+ return m, tea.Quit+ }}++ var cmd tea.Cmd+ m.list, cmd = m.list.Update(msg)+ return m, cmd+}++func (m selectModel) View() string {+ return "\n" + m.list.View()}diff --git a/cli/internal/types/config.go b/cli/internal/types/config.goindex d094c1e55..be984ec7e 100644--- a/cli/internal/types/config.go+++ b/cli/internal/types/config.go@@ -11,6 +11,8 @@ type Config struct {APIKey string `yaml:"api_key,omitempty"`// JWTToken is the JWT access token for authentication (sent as Authorization: Bearer)JWTToken string `yaml:"jwt_token,omitempty"`+ // RefreshToken is the refresh token for obtaining new access tokens+ RefreshToken string `yaml:"refresh_token,omitempty"`// DefaultEnvironment is the default environment ID to useDefaultEnvironment string `yaml:"default_environment,omitempty"`// LogLevel is the logging level (debug, info, warn, error, fatal, panic)diff --git a/cli/pkg/apikeys/cmd.go b/cli/pkg/admin/apikeys/cmd.gosimilarity index 100%rename from cli/pkg/apikeys/cmd.gorename to cli/pkg/admin/apikeys/cmd.godiff --git a/cli/pkg/admin/cmd.go b/cli/pkg/admin/cmd.gonew file mode 100644index 000000000..c671a0451--- /dev/null+++ b/cli/pkg/admin/cmd.go@@ -0,0 +1,23 @@+package admin++import (+ "github.com/getarcaneapp/arcane/cli/pkg/admin/apikeys"+ "github.com/getarcaneapp/arcane/cli/pkg/admin/events"+ "github.com/getarcaneapp/arcane/cli/pkg/admin/notifications"+ "github.com/getarcaneapp/arcane/cli/pkg/admin/users"+ "github.com/spf13/cobra"+)++// AdminCmd is the parent command for administrative operations.+var AdminCmd = &cobra.Command{+ Use: "admin",+ Aliases: []string{"adm"},+ Short: "Administration & platform management",+}++func init() {+ AdminCmd.AddCommand(users.UsersCmd)+ AdminCmd.AddCommand(apikeys.ApiKeysCmd)+ AdminCmd.AddCommand(events.EventsCmd)+ AdminCmd.AddCommand(notifications.NotificationsCmd)+}diff --git a/cli/pkg/events/cmd.go b/cli/pkg/admin/events/cmd.gosimilarity index 100%rename from cli/pkg/events/cmd.gorename to cli/pkg/admin/events/cmd.godiff --git a/cli/pkg/notifications/cmd.go b/cli/pkg/admin/notifications/cmd.gosimilarity index 100%rename from cli/pkg/notifications/cmd.gorename to cli/pkg/admin/notifications/cmd.godiff --git a/cli/pkg/users/cmd.go b/cli/pkg/admin/users/cmd.gosimilarity index 100%rename from cli/pkg/users/cmd.gorename to cli/pkg/admin/users/cmd.godiff --git a/cli/pkg/auth/cmd.go b/cli/pkg/auth/cmd.goindex 0fd916ec1..20eff0ff0 100644--- a/cli/pkg/auth/cmd.go+++ b/cli/pkg/auth/cmd.go@@ -142,6 +142,7 @@ var loginCmd = &cobra.Command{return fmt.Errorf("failed to load config: %w", err)}cfg.JWTToken = tokenResult.Token+ cfg.RefreshToken = tokenResult.RefreshTokencfg.APIKey = ""if err := config.Save(cfg); err != nil {return fmt.Errorf("failed to save token: %w", err)@@ -177,6 +178,7 @@ var logoutCmd = &cobra.Command{return fmt.Errorf("failed to load config: %w", err)}cfg.JWTToken = ""+ cfg.RefreshToken = ""if err := config.Save(cfg); err != nil {return fmt.Errorf("failed to clear token: %w", err)}@@ -308,6 +310,14 @@ var refreshCmd = &cobra.Command{RunE: func(cmd *cobra.Command, args []string) error {refreshToken, _ := cmd.Flags().GetString("refresh-token")+ cfg, err := config.Load()+ if err != nil {+ return fmt.Errorf("failed to load config: %w", err)+ }++ if refreshToken == "" {+ refreshToken = cfg.RefreshToken+ }if refreshToken == "" {fmt.Print("Refresh token: ")if _, err := fmt.Scanln(&refreshToken); err != nil {@@ -350,11 +360,11 @@ var refreshCmd = &cobra.Command{}// Save new JWT token to config- cfg, err := config.Load()- if err != nil {- return fmt.Errorf("failed to load config: %w", err)- }cfg.JWTToken = result.Data.Token+ cfg.APIKey = ""+ if result.Data.RefreshToken != "" {+ cfg.RefreshToken = result.Data.RefreshToken+ }if err := config.Save(cfg); err != nil {return fmt.Errorf("failed to save token: %w", err)}diff --git a/cli/pkg/config/cmd.go b/cli/pkg/config/cmd.goindex bc01969a4..f121f2636 100644--- a/cli/pkg/config/cmd.go+++ b/cli/pkg/config/cmd.go@@ -38,6 +38,7 @@ var configShowCmd = &cobra.Command{fmt.Printf("Server URL: %s\n", maskIfEmpty(cfg.ServerURL, "(not set)"))fmt.Printf("API Key: %s\n", maskAPIKey(cfg.APIKey))fmt.Printf("JWT Token: %s\n", maskAPIKey(cfg.JWTToken))+ fmt.Printf("Refresh Token: %s\n", maskAPIKey(cfg.RefreshToken))fmt.Printf("Default Environment: %s\n", maskIfEmpty(cfg.DefaultEnvironment, "0 (local)"))fmt.Printf("Log Level: %s\n", maskIfEmpty(cfg.LogLevel, "info (default)"))@@ -79,6 +80,7 @@ Examples:cfg.APIKey = setAPIKey// If switching to API key auth, clear any existing JWT token.cfg.JWTToken = ""+ cfg.RefreshToken = ""fmt.Printf("Set api_key = %s\n", maskAPIKey(setAPIKey))updated = true}@@ -87,6 +89,7 @@ Examples:cfg.JWTToken = setJWTToken// If switching to JWT auth, clear any existing API key.cfg.APIKey = ""+ cfg.RefreshToken = ""fmt.Printf("Set jwt_token = %s\n", maskAPIKey(setJWTToken))updated = true}diff --git a/cli/pkg/environments/cmd.go b/cli/pkg/environments/cmd.goindex 7574df2fc..2062aa3cd 100644--- a/cli/pkg/environments/cmd.go+++ b/cli/pkg/environments/cmd.go@@ -3,10 +3,14 @@ package environmentsimport ("encoding/json""fmt"+ "sort""strings"+ "github.com/charmbracelet/lipgloss""github.com/getarcaneapp/arcane/cli/internal/client"+ "github.com/getarcaneapp/arcane/cli/internal/config""github.com/getarcaneapp/arcane/cli/internal/output"+ "github.com/getarcaneapp/arcane/cli/internal/prompt""github.com/getarcaneapp/arcane/cli/internal/types""github.com/getarcaneapp/arcane/types/base""github.com/getarcaneapp/arcane/types/environment"@@ -19,6 +23,13 @@ var (jsonOutput bool)+var (+ statusOnlineStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#22c55e"))+ statusOfflineStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#ef4444"))+ statusMutedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#94a3b8"))+ enabledStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#6d28d9"))+)+// EnvironmentsCmd is the parent command for environment operationsvar EnvironmentsCmd = &cobra.Command{Use: "environments",@@ -193,11 +204,125 @@ var testCmd = &cobra.Command{},}+var switchCmd = &cobra.Command{+ Use: "switch",+ Short: "Switch the default environment (interactive)",+ Args: cobra.NoArgs,+ SilenceUsage: true,+ RunE: func(cmd *cobra.Command, args []string) error {+ if !prompt.IsInteractive() {+ return fmt.Errorf("interactive terminal required; run `arcane config set --environment <id>` instead")+ }++ cfg, err := config.Load()+ if err != nil {+ return fmt.Errorf("failed to load config: %w", err)+ }++ c, err := client.NewFromConfig()+ if err != nil {+ return err+ }++ path := fmt.Sprintf("%s?limit=%d", types.Endpoints.Environments(), 200)+ resp, err := c.Get(cmd.Context(), path)+ if err != nil {+ return fmt.Errorf("failed to list environments: %w", err)+ }+ defer func() { _ = resp.Body.Close() }()++ var result base.Paginated[environment.Environment]+ if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {+ return fmt.Errorf("failed to parse response: %w", err)+ }++ if len(result.Data) == 0 {+ return fmt.Errorf("no environments available")+ }++ currentEnv := cfg.DefaultEnvironment+ if strings.TrimSpace(currentEnv) == "" {+ currentEnv = "0"+ }++ envs := result.Data+ sort.SliceStable(envs, func(i, j int) bool {+ left := strings.ToLower(strings.TrimSpace(envs[i].Name))+ right := strings.ToLower(strings.TrimSpace(envs[j].Name))+ if left == "" {+ left = strings.ToLower(envs[i].ID)+ }+ if right == "" {+ right = strings.ToLower(envs[j].ID)+ }+ if left == right {+ return envs[i].ID < envs[j].ID+ }+ return left < right+ })++ options := make([]string, len(envs))+ for i, env := range envs {+ displayName := strings.TrimSpace(env.Name)+ if displayName == "" {+ displayName = env.ID+ }+ status := strings.TrimSpace(env.Status)+ if status == "" {+ status = "unknown"+ }+ var statusLabel string+ switch strings.ToLower(status) {+ case "online":+ statusLabel = statusOnlineStyle.Render(status)+ case "offline":+ statusLabel = statusOfflineStyle.Render(status)+ default:+ statusLabel = statusMutedStyle.Render(status)+ }++ enabledLabel := statusMutedStyle.Render("disabled")+ if env.Enabled {+ enabledLabel = enabledStyle.Render("enabled")+ }+ marker := " "+ if env.ID == currentEnv {+ marker = "* "+ }+ options[i] = fmt.Sprintf("%s%s (id: %s, %s, %s)", marker, displayName, env.ID, statusLabel, enabledLabel)+ }++ choice, err := prompt.Select("environment", options)+ if err != nil {+ return err+ }++ selected := envs[choice]+ if selected.ID == currentEnv {+ output.Info("Default environment already set to %s", selected.ID)+ return nil+ }++ cfg.DefaultEnvironment = selected.ID+ if err := config.Save(cfg); err != nil {+ return fmt.Errorf("failed to save config: %w", err)+ }++ output.Success("Default environment set to %s", selected.ID)+ if strings.TrimSpace(selected.Name) != "" {+ output.KeyValue("Name", selected.Name)+ }+ output.KeyValue("API URL", selected.ApiUrl)+ return nil+ },+}+func init() {EnvironmentsCmd.AddCommand(listCmd)EnvironmentsCmd.AddCommand(getCmd)EnvironmentsCmd.AddCommand(testCmd)EnvironmentsCmd.AddCommand(deleteCmd)+ EnvironmentsCmd.AddCommand(switchCmd)// List command flagslistCmd.Flags().IntVarP(&limitFlag, "limit", "n", 20, "Number of environments to show")diff --git a/cli/pkg/images/cmd.go b/cli/pkg/images/cmd.goindex 83a92c728..09f6838e0 100644--- a/cli/pkg/images/cmd.go+++ b/cli/pkg/images/cmd.go@@ -13,6 +13,7 @@// - prune: Remove unused images to reclaim disk space// - counts: Display image usage statistics// - upload: Upload a Docker image from a tar archive+// - updates: Check for image updates//// # Example Usage//@@ -50,8 +51,8 @@ import ("github.com/getarcaneapp/arcane/cli/internal/output""github.com/getarcaneapp/arcane/cli/internal/prompt""github.com/getarcaneapp/arcane/cli/internal/types"+ "github.com/getarcaneapp/arcane/cli/pkg/images/updates""github.com/getarcaneapp/arcane/types/image"- "github.com/schollz/progressbar/v3""github.com/spf13/cobra""go.withmatt.com/size")@@ -377,7 +378,7 @@ var imagesPullCmd = &cobra.Command{output.Info("Pulling image: %s", imageName)decoder := json.NewDecoder(resp.Body)- var bar *progressbar.ProgressBar+ var progressUI *output.Progressvar currentID stringfor {@@ -399,46 +400,30 @@ var imagesPullCmd = &cobra.Command{}if event.Error != "" {+ if progressUI != nil {+ progressUI.Stop()+ }return fmt.Errorf("pull error: %s", event.Error)}if event.Status == "Downloading" && event.ProgressDetail.Total > 0 {- if bar == nil || currentID != event.ID {- if bar != nil {- _ = bar.Finish()- fmt.Println()- }+ if progressUI == nil {+ progressUI = output.StartProgress("", event.ProgressDetail.Total)+ }+ if currentID != event.ID {currentID = event.ID- bar = progressbar.NewOptions64(- event.ProgressDetail.Total,- progressbar.OptionSetDescription(fmt.Sprintf("Downloading %s", event.ID)),- progressbar.OptionSetWriter(os.Stdout),- progressbar.OptionShowBytes(true),- progressbar.OptionSetWidth(15),- progressbar.OptionThrottle(65*time.Millisecond),- progressbar.OptionShowCount(),- progressbar.OptionOnCompletion(func() {- fmt.Println()- }),- progressbar.OptionSpinnerType(14),- progressbar.OptionFullWidth(),- progressbar.OptionSetTheme(progressbar.Theme{- Saucer: "=",- SaucerHead: ">",- SaucerPadding: " ",- BarStart: "[",- BarEnd: "]",- }),- )+ progressUI.SetLabel(fmt.Sprintf("Downloading %s", event.ID))+ progressUI.SetTotal(event.ProgressDetail.Total)}- _ = bar.Set64(event.ProgressDetail.Current)+ progressUI.SetCurrent(event.ProgressDetail.Current)} else {- if bar != nil {- // If we switch from downloading to something else for the same ID, finish the bar+ if progressUI != nil {+ // Stop the progress bar when the current layer completes.if event.ID == currentID && event.Status == "Download complete" {- _ = bar.Finish()- fmt.Println()- bar = nil+ progressUI.SetCurrent(event.ProgressDetail.Total)+ progressUI.SetLabel("Download complete")+ progressUI.Stop()+ progressUI = nilcurrentID = ""}}@@ -454,6 +439,10 @@ var imagesPullCmd = &cobra.Command{}}+ if progressUI != nil {+ progressUI.Stop()+ }+output.Success("Image pulled successfully")return nil@@ -484,47 +473,16 @@ var imagesPruneCmd = &cobra.Command{}jsonOutput, _ := cmd.Flags().GetBool("json")- var stopSpinner func()+ var spinner *output.Spinnerif !jsonOutput {- bar := progressbar.NewOptions(-1,- progressbar.OptionSetDescription("Pruning images..."),- progressbar.OptionSpinnerType(14),- progressbar.OptionSetWriter(os.Stdout),- progressbar.OptionClearOnFinish(),- progressbar.OptionSetWidth(10),- progressbar.OptionSetTheme(progressbar.Theme{- Saucer: "=",- SaucerHead: ">",- SaucerPadding: " ",- BarStart: "[",- BarEnd: "]",- }),- )-- done := make(chan bool)- go func() {- for {- select {- case <-done:- return- case <-time.After(100 * time.Millisecond):- _ = bar.Add(1)- }- }- }()-- stopSpinner = func() {- done <- true- _ = bar.Finish()- fmt.Println()- }+ spinner = output.StartSpinner("Pruning images...")}resp, err := c.Post(cmd.Context(), path, requestBody)- if stopSpinner != nil {- stopSpinner()+ if spinner != nil {+ spinner.Stop()}if err != nil {@@ -665,29 +623,11 @@ var imagesUploadCmd = &cobra.Command{var requestBody io.Reader = bodyjsonOutput, _ := cmd.Flags().GetBool("json")+ var progressUI *output.Progressif !jsonOutput {- bar := progressbar.NewOptions64(- int64(body.Len()),- progressbar.OptionSetDescription("Uploading"),- progressbar.OptionSetWriter(os.Stdout),- progressbar.OptionShowBytes(true),- progressbar.OptionSetWidth(15),- progressbar.OptionThrottle(65*time.Millisecond),- progressbar.OptionShowCount(),- progressbar.OptionOnCompletion(func() {- fmt.Println()- }),- progressbar.OptionSpinnerType(14),- progressbar.OptionFullWidth(),- progressbar.OptionSetTheme(progressbar.Theme{- Saucer: "=",- SaucerHead: ">",- SaucerPadding: " ",- BarStart: "[",- BarEnd: "]",- }),- )- requestBody = io.TeeReader(body, bar)+ progressUI = output.StartProgress("Uploading", int64(body.Len()))+ requestBody = output.NewProgressReader(body, progressUI)+ defer progressUI.Stop()}// Use client.RequestRaw to make the multipart request with correct headers@@ -751,6 +691,7 @@ func init() {imagesPruneCmd.Flags().BoolVar(&pruneDangling, "dangling", false, "Only remove dangling images")ImagesCmd.AddCommand(imagesCountsCmd)+ ImagesCmd.AddCommand(updates.UpdatesCmd)ImagesCmd.AddCommand(imagesUploadCmd)}diff --git a/cli/pkg/imageupdates/cmd.go b/cli/pkg/images/updates/cmd.gosimilarity index 93%rename from cli/pkg/imageupdates/cmd.gorename to cli/pkg/images/updates/cmd.goindex b7af2195f..249b551c5 100644--- a/cli/pkg/imageupdates/cmd.go+++ b/cli/pkg/images/updates/cmd.go@@ -1,4 +1,4 @@-package imageupdates+package updatesimport ("encoding/json"@@ -14,11 +14,10 @@ import (var jsonOutput bool-// ImageUpdatesCmd is the parent command for image update operations-var ImageUpdatesCmd = &cobra.Command{- Use: "image-updates",- Aliases: []string{"imgup", "updates"},- Short: "Check for image updates",+// UpdatesCmd is the parent command for image update operations.+var UpdatesCmd = &cobra.Command{+ Use: "updates",+ Short: "Check for image updates",}var checkCmd = &cobra.Command{@@ -193,10 +192,10 @@ var summaryCmd = &cobra.Command{}func init() {- ImageUpdatesCmd.AddCommand(checkCmd)- ImageUpdatesCmd.AddCommand(checkAllCmd)- ImageUpdatesCmd.AddCommand(checkImageCmd)- ImageUpdatesCmd.AddCommand(summaryCmd)+ UpdatesCmd.AddCommand(checkCmd)+ UpdatesCmd.AddCommand(checkAllCmd)+ UpdatesCmd.AddCommand(checkImageCmd)+ UpdatesCmd.AddCommand(summaryCmd)checkCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")checkAllCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")diff --git a/cli/pkg/jobschedules/cmd.go b/cli/pkg/jobs/cmd.gosimilarity index 92%rename from cli/pkg/jobschedules/cmd.gorename to cli/pkg/jobs/cmd.goindex 5f6cad96b..5934fd3c1 100644--- a/cli/pkg/jobschedules/cmd.go+++ b/cli/pkg/jobs/cmd.go@@ -1,4 +1,4 @@-package jobschedules+package jobsimport ("encoding/json"@@ -14,11 +14,11 @@ import (var jsonOutput bool-// JobSchedulesCmd is the parent command for job schedule operations.-var JobSchedulesCmd = &cobra.Command{- Use: "job-schedules",- Aliases: []string{"jobs", "job-schedule", "schedules"},- Short: "Manage background job schedules",+// JobsCmd is the parent command for job schedule operations.+var JobsCmd = &cobra.Command{+ Use: "jobs",+ Aliases: []string{"job"},+ Short: "Manage background jobs",}var getCmd = &cobra.Command{@@ -119,8 +119,8 @@ var updateCmd = &cobra.Command{}func init() {- JobSchedulesCmd.AddCommand(getCmd)- JobSchedulesCmd.AddCommand(updateCmd)+ JobsCmd.AddCommand(getCmd)+ JobsCmd.AddCommand(updateCmd)getCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")updateCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")diff --git a/cli/pkg/root.go b/cli/pkg/root.goindex a047d8af3..f5dda79f4 100644--- a/cli/pkg/root.go+++ b/cli/pkg/root.go@@ -20,9 +20,12 @@//// # Command Groups//+// - admin: Administration & platform management+// - auth: Authentication operations// - config: Manage CLI configuration-// - images: Manage Docker images// - containers: Manage containers+// - images: Manage Docker images and updates+// - jobs: Manage background jobs// - generate: Generate secrets and tokens// - version: Display version informationpackage cli@@ -36,25 +39,21 @@ import ("github.com/charmbracelet/fang""github.com/getarcaneapp/arcane/cli/internal/config""github.com/getarcaneapp/arcane/cli/internal/logger"- "github.com/getarcaneapp/arcane/cli/pkg/apikeys"+ "github.com/getarcaneapp/arcane/cli/pkg/admin""github.com/getarcaneapp/arcane/cli/pkg/auth"configClient "github.com/getarcaneapp/arcane/cli/pkg/config""github.com/getarcaneapp/arcane/cli/pkg/containers""github.com/getarcaneapp/arcane/cli/pkg/environments"- "github.com/getarcaneapp/arcane/cli/pkg/events""github.com/getarcaneapp/arcane/cli/pkg/generate""github.com/getarcaneapp/arcane/cli/pkg/images"- "github.com/getarcaneapp/arcane/cli/pkg/imageupdates"- "github.com/getarcaneapp/arcane/cli/pkg/jobschedules"+ "github.com/getarcaneapp/arcane/cli/pkg/jobs""github.com/getarcaneapp/arcane/cli/pkg/networks"- "github.com/getarcaneapp/arcane/cli/pkg/notifications""github.com/getarcaneapp/arcane/cli/pkg/projects""github.com/getarcaneapp/arcane/cli/pkg/registries""github.com/getarcaneapp/arcane/cli/pkg/settings""github.com/getarcaneapp/arcane/cli/pkg/system""github.com/getarcaneapp/arcane/cli/pkg/templates""github.com/getarcaneapp/arcane/cli/pkg/updater"- "github.com/getarcaneapp/arcane/cli/pkg/users""github.com/getarcaneapp/arcane/cli/pkg/version""github.com/getarcaneapp/arcane/cli/pkg/volumes""github.com/spf13/cobra"@@ -64,12 +63,19 @@ var (logLevel stringjsonOutput boolshowVersion bool+ configPath string)var rootCmd = &cobra.Command{Use: "arcane",Long: "Arcane CLI - The official command line interface for Arcane",- PersistentPreRun: func(cmd *cobra.Command, args []string) {+ PersistentPreRunE: func(cmd *cobra.Command, args []string) error {+ if configPath != "" {+ if err := config.SetConfigPath(configPath); err != nil {+ return err+ }+ }+// Load config to check for log level settingcfg, _ := config.Load()@@ -79,6 +85,7 @@ var rootCmd = &cobra.Command{}logger.Setup(logLevel, jsonOutput)+ return nil},RunE: func(cmd *cobra.Command, args []string) error {if showVersion {@@ -101,6 +108,7 @@ func Execute() {func init() {rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "Log level (debug, info, warn, error, fatal, panic)")+ rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "Path to config file (default ~/.config/arcanecli.yml)")rootCmd.PersistentFlags().BoolVar(&jsonOutput, "json", false, "Log in JSON format")rootCmd.Flags().BoolVarP(&showVersion, "version", "v", false, "Print version information")@@ -113,16 +121,12 @@ func init() {rootCmd.AddCommand(volumes.VolumesCmd)rootCmd.AddCommand(networks.NetworksCmd)rootCmd.AddCommand(projects.ProjectsCmd)- rootCmd.AddCommand(apikeys.ApiKeysCmd)rootCmd.AddCommand(environments.EnvironmentsCmd)- rootCmd.AddCommand(users.UsersCmd)rootCmd.AddCommand(registries.RegistriesCmd)rootCmd.AddCommand(templates.TemplatesCmd)rootCmd.AddCommand(settings.SettingsCmd)- rootCmd.AddCommand(jobschedules.JobSchedulesCmd)- rootCmd.AddCommand(notifications.NotificationsCmd)- rootCmd.AddCommand(imageupdates.ImageUpdatesCmd)+ rootCmd.AddCommand(jobs.JobsCmd)rootCmd.AddCommand(system.SystemCmd)rootCmd.AddCommand(updater.UpdaterCmd)- rootCmd.AddCommand(events.EventsCmd)+ rootCmd.AddCommand(admin.AdminCmd)}diff --git a/cli/pkg/settings/cmd.go b/cli/pkg/settings/cmd.goindex 1350ec534..773ffc31a 100644--- a/cli/pkg/settings/cmd.go+++ b/cli/pkg/settings/cmd.go@@ -7,8 +7,6 @@ import ("github.com/getarcaneapp/arcane/cli/internal/client""github.com/getarcaneapp/arcane/cli/internal/output""github.com/getarcaneapp/arcane/cli/internal/types"- "github.com/getarcaneapp/arcane/types/category"- "github.com/getarcaneapp/arcane/types/search""github.com/getarcaneapp/arcane/types/settings""github.com/spf13/cobra")@@ -18,13 +16,14 @@ var jsonOutput bool// SettingsCmd is the parent command for settings operationsvar SettingsCmd = &cobra.Command{Use: "settings",- Aliases: []string{"setting", "config"},+ Aliases: []string{"setting"},Short: "Manage settings",}-var getCmd = &cobra.Command{- Use: "get",- Short: "Get environment settings",+var listCmd = &cobra.Command{+ Use: "list",+ Aliases: []string{"ls"},+ Short: "List environment settings",SilenceUsage: true,RunE: func(cmd *cobra.Command, args []string) error {c, err := client.NewFromConfig()@@ -68,106 +67,8 @@ var getCmd = &cobra.Command{},}-var categoriesCmd = &cobra.Command{- Use: "categories",- Short: "List setting categories",- SilenceUsage: true,- RunE: func(cmd *cobra.Command, args []string) error {- c, err := client.NewFromConfig()- if err != nil {- return err- }-- resp, err := c.Get(cmd.Context(), types.Endpoints.SettingsCategories())- if err != nil {- return fmt.Errorf("failed to get categories: %w", err)- }- defer func() { _ = resp.Body.Close() }()-- var result []category.Category- if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {- return fmt.Errorf("failed to parse response: %w", err)- }-- if jsonOutput {- resultBytes, err := json.MarshalIndent(result, "", " ")- if err != nil {- return fmt.Errorf("failed to marshal JSON: %w", err)- }- fmt.Println(string(resultBytes))- return nil- }-- headers := []string{"ID", "TITLE", "DESCRIPTION"}- rows := make([][]string, len(result))- for i, cat := range result {- rows[i] = []string{- cat.ID,- cat.Title,- cat.Description,- }- }-- output.Table(headers, rows)- fmt.Printf("\nTotal: %d categories\n", len(result))- return nil- },-}--var searchCmd = &cobra.Command{- Use: "search <query>",- Short: "Search settings",- Args: cobra.ExactArgs(1),- SilenceUsage: true,- RunE: func(cmd *cobra.Command, args []string) error {- c, err := client.NewFromConfig()- if err != nil {- return err- }-- reqBody, err := json.Marshal(search.Request{Query: args[0]})- if err != nil {- return fmt.Errorf("failed to marshal request: %w", err)- }-- resp, err := c.Post(cmd.Context(), types.Endpoints.SettingsSearch(), reqBody)- if err != nil {- return fmt.Errorf("failed to search settings: %w", err)- }- defer func() { _ = resp.Body.Close() }()-- var result search.Response- if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {- return fmt.Errorf("failed to parse response: %w", err)- }-- if jsonOutput {- resultBytes, err := json.MarshalIndent(result, "", " ")- if err != nil {- return fmt.Errorf("failed to marshal JSON: %w", err)- }- fmt.Println(string(resultBytes))- return nil- }-- output.Header("Search Results")- fmt.Printf("Query: %s\n", result.Query)- fmt.Printf("Found: %d results\n\n", result.Count)-- for _, cat := range result.Results {- output.KeyValue(cat.Title, cat.Description)- }-- return nil- },-}-func init() {- SettingsCmd.AddCommand(getCmd)- SettingsCmd.AddCommand(categoriesCmd)- SettingsCmd.AddCommand(searchCmd)+ SettingsCmd.AddCommand(listCmd)- getCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")- categoriesCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")- searchCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")+ listCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")}diff --git a/frontend/project.inlang/cache/plugins/2sy648wh9sugi b/frontend/project.inlang/cache/plugins/2sy648wh9suginew file mode 100644index 000000000..1f9c4e487--- /dev/null+++ b/frontend/project.inlang/cache/plugins/2sy648wh9sugi@@ -0,0 +1,2291 @@+var __create = Object.create;+var __defProp = Object.defineProperty;+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;+var __getOwnPropNames = Object.getOwnPropertyNames;+var __getProtoOf = Object.getPrototypeOf;+var __hasOwnProp = Object.prototype.hasOwnProperty;+var __commonJS = (cb, mod) => function __require() {+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;+};+var __copyProps = (to, from, except, desc) => {+ if (from && typeof from === "object" || typeof from === "function") {+ for (let key of __getOwnPropNames(from))+ if (!__hasOwnProp.call(to, key) && key !== except)+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });+ }+ return to;+};+var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(+ // If the importer is in node compatibility mode or this is not an ESM+ // file that has been converted to a CommonJS file using a Babel-+ // compatible transform (i.e. "__esModule" has not been set), then set+ // "default" to the CommonJS "module.exports" for node compatibility.+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,+ mod+));++// ../../../node_modules/.pnpm/@[email protected]/node_modules/@sinclair/typebox/typebox.js+var require_typebox = __commonJS({+ "../../../node_modules/.pnpm/@[email protected]/node_modules/@sinclair/typebox/typebox.js"(exports) {+ "use strict";+ Object.defineProperty(exports, "__esModule", { value: true });+ exports.Type = exports.JsonType = exports.JavaScriptTypeBuilder = exports.JsonTypeBuilder = exports.TypeBuilder = exports.TypeBuilderError = exports.TransformEncodeBuilder = exports.TransformDecodeBuilder = exports.TemplateLiteralDslParser = exports.TemplateLiteralGenerator = exports.TemplateLiteralGeneratorError = exports.TemplateLiteralFinite = exports.TemplateLiteralFiniteError = exports.TemplateLiteralParser = exports.TemplateLiteralParserError = exports.TemplateLiteralResolver = exports.TemplateLiteralPattern = exports.TemplateLiteralPatternError = exports.UnionResolver = exports.KeyArrayResolver = exports.KeyArrayResolverError = exports.KeyResolver = exports.ObjectMap = exports.Intrinsic = exports.IndexedAccessor = exports.TypeClone = exports.TypeExtends = exports.TypeExtendsResult = exports.TypeExtendsError = exports.ExtendsUndefined = exports.TypeGuard = exports.TypeGuardUnknownTypeError = exports.ValueGuard = exports.FormatRegistry = exports.TypeBoxError = exports.TypeRegistry = exports.PatternStringExact = exports.PatternNumberExact = exports.PatternBooleanExact = exports.PatternString = exports.PatternNumber = exports.PatternBoolean = exports.Kind = exports.Hint = exports.Optional = exports.Readonly = exports.Transform = void 0;+ exports.Transform = Symbol.for("TypeBox.Transform");+ exports.Readonly = Symbol.for("TypeBox.Readonly");+ exports.Optional = Symbol.for("TypeBox.Optional");+ exports.Hint = Symbol.for("TypeBox.Hint");+ exports.Kind = Symbol.for("TypeBox.Kind");+ exports.PatternBoolean = "(true|false)";+ exports.PatternNumber = "(0|[1-9][0-9]*)";+ exports.PatternString = "(.*)";+ exports.PatternBooleanExact = `^${exports.PatternBoolean}$`;+ exports.PatternNumberExact = `^${exports.PatternNumber}$`;+ exports.PatternStringExact = `^${exports.PatternString}$`;+ var TypeRegistry;+ (function(TypeRegistry2) {+ const map = /* @__PURE__ */ new Map();+ function Entries() {+ return new Map(map);+ }+ TypeRegistry2.Entries = Entries;+ function Clear() {+ return map.clear();+ }+ TypeRegistry2.Clear = Clear;+ function Delete(kind) {+ return map.delete(kind);+ }+ TypeRegistry2.Delete = Delete;+ function Has(kind) {+ return map.has(kind);+ }+ TypeRegistry2.Has = Has;+ function Set2(kind, func) {+ map.set(kind, func);+ }+ TypeRegistry2.Set = Set2;+ function Get(kind) {+ return map.get(kind);+ }+ TypeRegistry2.Get = Get;+ })(TypeRegistry || (exports.TypeRegistry = TypeRegistry = {}));+ var TypeBoxError = class extends Error {+ constructor(message) {+ super(message);+ }+ };+ exports.TypeBoxError = TypeBoxError;+ var FormatRegistry;+ (function(FormatRegistry2) {+ const map = /* @__PURE__ */ new Map();+ function Entries() {+ return new Map(map);+ }+ FormatRegistry2.Entries = Entries;+ function Clear() {+ return map.clear();+ }+ FormatRegistry2.Clear = Clear;+ function Delete(format) {+ return map.delete(format);+ }+ FormatRegistry2.Delete = Delete;+ function Has(format) {+ return map.has(format);+ }+ FormatRegistry2.Has = Has;+ function Set2(format, func) {+ map.set(format, func);+ }+ FormatRegistry2.Set = Set2;+ function Get(format) {+ return map.get(format);+ }+ FormatRegistry2.Get = Get;+ })(FormatRegistry || (exports.FormatRegistry = FormatRegistry = {}));+ var ValueGuard;+ (function(ValueGuard2) {+ function IsArray(value) {+ return Array.isArray(value);+ }+ ValueGuard2.IsArray = IsArray;+ function IsBigInt(value) {+ return typeof value === "bigint";+ }+ ValueGuard2.IsBigInt = IsBigInt;+ function IsBoolean(value) {+ return typeof value === "boolean";+ }+ ValueGuard2.IsBoolean = IsBoolean;+ function IsDate(value) {+ return value instanceof globalThis.Date;+ }+ ValueGuard2.IsDate = IsDate;+ function IsNull(value) {+ return value === null;+ }+ ValueGuard2.IsNull = IsNull;+ function IsNumber(value) {+ return typeof value === "number";+ }+ ValueGuard2.IsNumber = IsNumber;+ function IsObject(value) {+ return typeof value === "object" && value !== null;+ }+ ValueGuard2.IsObject = IsObject;+ function IsString(value) {+ return typeof value === "string";+ }+ ValueGuard2.IsString = IsString;+ function IsUint8Array(value) {+ return value instanceof globalThis.Uint8Array;+ }+ ValueGuard2.IsUint8Array = IsUint8Array;+ function IsUndefined(value) {+ return value === void 0;+ }+ ValueGuard2.IsUndefined = IsUndefined;+ })(ValueGuard || (exports.ValueGuard = ValueGuard = {}));+ var TypeGuardUnknownTypeError = class extends TypeBoxError {+ };+ exports.TypeGuardUnknownTypeError = TypeGuardUnknownTypeError;+ var TypeGuard;+ (function(TypeGuard2) {+ function IsPattern(value) {+ try {+ new RegExp(value);+ return true;+ } catch {+ return false;+ }+ }+ function IsControlCharacterFree(value) {+ if (!ValueGuard.IsString(value))+ return false;+ for (let i = 0; i < value.length; i++) {+ const code = value.charCodeAt(i);+ if (code >= 7 && code <= 13 || code === 27 || code === 127) {+ return false;+ }+ }+ return true;+ }+ function IsAdditionalProperties(value) {+ return IsOptionalBoolean(value) || TSchema(value);+ }+ function IsOptionalBigInt(value) {+ return ValueGuard.IsUndefined(value) || ValueGuard.IsBigInt(value);+ }+ function IsOptionalNumber(value) {+ return ValueGuard.IsUndefined(value) || ValueGuard.IsNumber(value);+ }+ function IsOptionalBoolean(value) {+ return ValueGuard.IsUndefined(value) || ValueGuard.IsBoolean(value);+ }+ function IsOptionalString(value) {+ return ValueGuard.IsUndefined(value) || ValueGuard.IsString(value);+ }+ function IsOptionalPattern(value) {+ return ValueGuard.IsUndefined(value) || ValueGuard.IsString(value) && IsControlCharacterFree(value) && IsPattern(value);+ }+ function IsOptionalFormat(value) {+ return ValueGuard.IsUndefined(value) || ValueGuard.IsString(value) && IsControlCharacterFree(value);+ }+ function IsOptionalSchema(value) {+ return ValueGuard.IsUndefined(value) || TSchema(value);+ }+ function TAny(schema) {+ return TKindOf(schema, "Any") && IsOptionalString(schema.$id);+ }+ TypeGuard2.TAny = TAny;+ function TArray(schema) {+ return TKindOf(schema, "Array") && schema.type === "array" && IsOptionalString(schema.$id) && TSchema(schema.items) && IsOptionalNumber(schema.minItems) && IsOptionalNumber(schema.maxItems) && IsOptionalBoolean(schema.uniqueItems) && IsOptionalSchema(schema.contains) && IsOptionalNumber(schema.minContains) && IsOptionalNumber(schema.maxContains);+ }+ TypeGuard2.TArray = TArray;+ function TAsyncIterator(schema) {+ return TKindOf(schema, "AsyncIterator") && schema.type === "AsyncIterator" && IsOptionalString(schema.$id) && TSchema(schema.items);+ }+ TypeGuard2.TAsyncIterator = TAsyncIterator;+ function TBigInt(schema) {+ return TKindOf(schema, "BigInt") && schema.type === "bigint" && IsOptionalString(schema.$id) && IsOptionalBigInt(schema.exclusiveMaximum) && IsOptionalBigInt(schema.exclusiveMinimum) && IsOptionalBigInt(schema.maximum) && IsOptionalBigInt(schema.minimum) && IsOptionalBigInt(schema.multipleOf);+ }+ TypeGuard2.TBigInt = TBigInt;+ function TBoolean(schema) {+ return TKindOf(schema, "Boolean") && schema.type === "boolean" && IsOptionalString(schema.$id);+ }+ TypeGuard2.TBoolean = TBoolean;+ function TConstructor(schema) {+ return TKindOf(schema, "Constructor") && schema.type === "Constructor" && IsOptionalString(schema.$id) && ValueGuard.IsArray(schema.parameters) && schema.parameters.every((schema2) => TSchema(schema2)) && TSchema(schema.returns);+ }+ TypeGuard2.TConstructor = TConstructor;+ function TDate(schema) {+ return TKindOf(schema, "Date") && schema.type === "Date" && IsOptionalString(schema.$id) && IsOptionalNumber(schema.exclusiveMaximumTimestamp) && IsOptionalNumber(schema.exclusiveMinimumTimestamp) && IsOptionalNumber(schema.maximumTimestamp) && IsOptionalNumber(schema.minimumTimestamp) && IsOptionalNumber(schema.multipleOfTimestamp);+ }+ TypeGuard2.TDate = TDate;+ function TFunction(schema) {+ return TKindOf(schema, "Function") && schema.type === "Function" && IsOptionalString(schema.$id) && ValueGuard.IsArray(schema.parameters) && schema.parameters.every((schema2) => TSchema(schema2)) && TSchema(schema.returns);+ }+ TypeGuard2.TFunction = TFunction;+ function TInteger(schema) {+ return TKindOf(schema, "Integer") && schema.type === "integer" && IsOptionalString(schema.$id) && IsOptionalNumber(schema.exclusiveMaximum) && IsOptionalNumber(schema.exclusiveMinimum) && IsOptionalNumber(schema.maximum) && IsOptionalNumber(schema.minimum) && IsOptionalNumber(schema.multipleOf);+ }+ TypeGuard2.TInteger = TInteger;+ function TIntersect(schema) {+ return TKindOf(schema, "Intersect") && (ValueGuard.IsString(schema.type) && schema.type !== "object" ? false : true) && ValueGuard.IsArray(schema.allOf) && schema.allOf.every((schema2) => TSchema(schema2) && !TTransform(schema2)) && IsOptionalString(schema.type) && (IsOptionalBoolean(schema.unevaluatedProperties) || IsOptionalSchema(schema.unevaluatedProperties)) && IsOptionalString(schema.$id);+ }+ TypeGuard2.TIntersect = TIntersect;+ function TIterator(schema) {+ return TKindOf(schema, "Iterator") && schema.type === "Iterator" && IsOptionalString(schema.$id) && TSchema(schema.items);+ }+ TypeGuard2.TIterator = TIterator;+ function TKindOf(schema, kind) {+ return TKind(schema) && schema[exports.Kind] === kind;+ }+ TypeGuard2.TKindOf = TKindOf;+ function TKind(schema) {+ return ValueGuard.IsObject(schema) && exports.Kind in schema && ValueGuard.IsString(schema[exports.Kind]);+ }+ TypeGuard2.TKind = TKind;+ function TLiteralString(schema) {+ return TLiteral(schema) && ValueGuard.IsString(schema.const);+ }+ TypeGuard2.TLiteralString = TLiteralString;+ function TLiteralNumber(schema) {+ return TLiteral(schema) && ValueGuard.IsNumber(schema.const);+ }+ TypeGuard2.TLiteralNumber = TLiteralNumber;+ function TLiteralBoolean(schema) {+ return TLiteral(schema) && ValueGuard.IsBoolean(schema.const);+ }+ TypeGuard2.TLiteralBoolean = TLiteralBoolean;+ function TLiteral(schema) {+ return TKindOf(schema, "Literal") && IsOptionalString(schema.$id) && (ValueGuard.IsBoolean(schema.const) || ValueGuard.IsNumber(schema.const) || ValueGuard.IsString(schema.const));+ }+ TypeGuard2.TLiteral = TLiteral;+ function TNever(schema) {+ return TKindOf(schema, "Never") && ValueGuard.IsObject(schema.not) && Object.getOwnPropertyNames(schema.not).length === 0;+ }+ TypeGuard2.TNever = TNever;+ function TNot(schema) {+ return TKindOf(schema, "Not") && TSchema(schema.not);+ }+ TypeGuard2.TNot = TNot;+ function TNull(schema) {+ return TKindOf(schema, "Null") && schema.type === "null" && IsOptionalString(schema.$id);+ }+ TypeGuard2.TNull = TNull;+ function TNumber(schema) {+ return TKindOf(schema, "Number") && schema.type === "number" && IsOptionalString(schema.$id) && IsOptionalNumber(schema.exclusiveMaximum) && IsOptionalNumber(schema.exclusiveMinimum) && IsOptionalNumber(schema.maximum) && IsOptionalNumber(schema.minimum) && IsOptionalNumber(schema.multipleOf);+ }+ TypeGuard2.TNumber = TNumber;+ function TObject(schema) {+ return TKindOf(schema, "Object") && schema.type === "object" && IsOptionalString(schema.$id) && ValueGuard.IsObject(schema.properties) && IsAdditionalProperties(schema.additionalProperties) && IsOptionalNumber(schema.minProperties) && IsOptionalNumber(schema.maxProperties) && Object.entries(schema.properties).every(([key, schema2]) => IsControlCharacterFree(key) && TSchema(schema2));+ }+ TypeGuard2.TObject = TObject;+ function TPromise(schema) {+ return TKindOf(schema, "Promise") && schema.type === "Promise" && IsOptionalString(schema.$id) && TSchema(schema.item);+ }+ TypeGuard2.TPromise = TPromise;+ function TRecord(schema) {+ return TKindOf(schema, "Record") && schema.type === "object" && IsOptionalString(schema.$id) && IsAdditionalProperties(schema.additionalProperties) && ValueGuard.IsObject(schema.patternProperties) && ((schema2) => {+ const keys = Object.getOwnPropertyNames(schema2.patternProperties);+ return keys.length === 1 && IsPattern(keys[0]) && ValueGuard.IsObject(schema2.patternProperties) && TSchema(schema2.patternProperties[keys[0]]);+ })(schema);+ }+ TypeGuard2.TRecord = TRecord;+ function TRecursive(schema) {+ return ValueGuard.IsObject(schema) && exports.Hint in schema && schema[exports.Hint] === "Recursive";+ }+ TypeGuard2.TRecursive = TRecursive;+ function TRef(schema) {+ return TKindOf(schema, "Ref") && IsOptionalString(schema.$id) && ValueGuard.IsString(schema.$ref);+ }+ TypeGuard2.TRef = TRef;+ function TString(schema) {+ return TKindOf(schema, "String") && schema.type === "string" && IsOptionalString(schema.$id) && IsOptionalNumber(schema.minLength) && IsOptionalNumber(schema.maxLength) && IsOptionalPattern(schema.pattern) && IsOptionalFormat(schema.format);+ }+ TypeGuard2.TString = TString;+ function TSymbol(schema) {+ return TKindOf(schema, "Symbol") && schema.type === "symbol" && IsOptionalString(schema.$id);+ }+ TypeGuard2.TSymbol = TSymbol;+ function TTemplateLiteral(schema) {+ return TKindOf(schema, "TemplateLiteral") && schema.type === "string" && ValueGuard.IsString(schema.pattern) && schema.pattern[0] === "^" && schema.pattern[schema.pattern.length - 1] === "$";+ }+ TypeGuard2.TTemplateLiteral = TTemplateLiteral;+ function TThis(schema) {+ return TKindOf(schema, "This") && IsOptionalString(schema.$id) && ValueGuard.IsString(schema.$ref);+ }+ TypeGuard2.TThis = TThis;+ function TTransform(schema) {+ return ValueGuard.IsObject(schema) && exports.Transform in schema;+ }+ TypeGuard2.TTransform = TTransform;+ function TTuple(schema) {+ return TKindOf(schema, "Tuple") && schema.type === "array" && IsOptionalString(schema.$id) && ValueGuard.IsNumber(schema.minItems) && ValueGuard.IsNumber(schema.maxItems) && schema.minItems === schema.maxItems && // empty+ (ValueGuard.IsUndefined(schema.items) && ValueGuard.IsUndefined(schema.additionalItems) && schema.minItems === 0 || ValueGuard.IsArray(schema.items) && schema.items.every((schema2) => TSchema(schema2)));+ }+ TypeGuard2.TTuple = TTuple;+ function TUndefined(schema) {+ return TKindOf(schema, "Undefined") && schema.type === "undefined" && IsOptionalString(schema.$id);+ }+ TypeGuard2.TUndefined = TUndefined;+ function TUnionLiteral(schema) {+ return TUnion(schema) && schema.anyOf.every((schema2) => TLiteralString(schema2) || TLiteralNumber(schema2));+ }+ TypeGuard2.TUnionLiteral = TUnionLiteral;+ function TUnion(schema) {+ return TKindOf(schema, "Union") && IsOptionalString(schema.$id) && ValueGuard.IsObject(schema) && ValueGuard.IsArray(schema.anyOf) && schema.anyOf.every((schema2) => TSchema(schema2));+ }+ TypeGuard2.TUnion = TUnion;+ function TUint8Array(schema) {+ return TKindOf(schema, "Uint8Array") && schema.type === "Uint8Array" && IsOptionalString(schema.$id) && IsOptionalNumber(schema.minByteLength) && IsOptionalNumber(schema.maxByteLength);+ }+ TypeGuard2.TUint8Array = TUint8Array;+ function TUnknown(schema) {+ return TKindOf(schema, "Unknown") && IsOptionalString(schema.$id);+ }+ TypeGuard2.TUnknown = TUnknown;+ function TUnsafe(schema) {+ return TKindOf(schema, "Unsafe");+ }+ TypeGuard2.TUnsafe = TUnsafe;+ function TVoid(schema) {+ return TKindOf(schema, "Void") && schema.type === "void" && IsOptionalString(schema.$id);+ }+ TypeGuard2.TVoid = TVoid;+ function TReadonly(schema) {+ return ValueGuard.IsObject(schema) && schema[exports.Readonly] === "Readonly";+ }+ TypeGuard2.TReadonly = TReadonly;+ function TOptional(schema) {+ return ValueGuard.IsObject(schema) && schema[exports.Optional] === "Optional";+ }+ TypeGuard2.TOptional = TOptional;+ function TSchema(schema) {+ return ValueGuard.IsObject(schema) && (TAny(schema) || TArray(schema) || TBoolean(schema) || TBigInt(schema) || TAsyncIterator(schema) || TConstructor(schema) || TDate(schema) || TFunction(schema) || TInteger(schema) || TIntersect(schema) || TIterator(schema) || TLiteral(schema) || TNever(schema) || TNot(schema) || TNull(schema) || TNumber(schema) || TObject(schema) || TPromise(schema) || TRecord(schema) || TRef(schema) || TString(schema) || TSymbol(schema) || TTemplateLiteral(schema) || TThis(schema) || TTuple(schema) || TUndefined(schema) || TUnion(schema) || TUint8Array(schema) || TUnknown(schema) || TUnsafe(schema) || TVoid(schema) || TKind(schema) && TypeRegistry.Has(schema[exports.Kind]));+ }+ TypeGuard2.TSchema = TSchema;+ })(TypeGuard || (exports.TypeGuard = TypeGuard = {}));+ var ExtendsUndefined;+ (function(ExtendsUndefined2) {+ function Check(schema) {+ return schema[exports.Kind] === "Intersect" ? schema.allOf.every((schema2) => Check(schema2)) : schema[exports.Kind] === "Union" ? schema.anyOf.some((schema2) => Check(schema2)) : schema[exports.Kind] === "Undefined" ? true : schema[exports.Kind] === "Not" ? !Check(schema.not) : false;+ }+ ExtendsUndefined2.Check = Check;+ })(ExtendsUndefined || (exports.ExtendsUndefined = ExtendsUndefined = {}));+ var TypeExtendsError = class extends TypeBoxError {+ };+ exports.TypeExtendsError = TypeExtendsError;+ var TypeExtendsResult;+ (function(TypeExtendsResult2) {+ TypeExtendsResult2[TypeExtendsResult2["Union"] = 0] = "Union";+ TypeExtendsResult2[TypeExtendsResult2["True"] = 1] = "True";+ TypeExtendsResult2[TypeExtendsResult2["False"] = 2] = "False";+ })(TypeExtendsResult || (exports.TypeExtendsResult = TypeExtendsResult = {}));+ var TypeExtends;+ (function(TypeExtends2) {+ function IntoBooleanResult(result) {+ return result === TypeExtendsResult.False ? result : TypeExtendsResult.True;+ }+ function Throw(message) {+ throw new TypeExtendsError(message);+ }+ function IsStructuralRight(right) {+ return TypeGuard.TNever(right) || TypeGuard.TIntersect(right) || TypeGuard.TUnion(right) || TypeGuard.TUnknown(right) || TypeGuard.TAny(right);+ }+ function StructuralRight(left, right) {+ return TypeGuard.TNever(right) ? TNeverRight(left, right) : TypeGuard.TIntersect(right) ? TIntersectRight(left, right) : TypeGuard.TUnion(right) ? TUnionRight(left, right) : TypeGuard.TUnknown(right) ? TUnknownRight(left, right) : TypeGuard.TAny(right) ? TAnyRight(left, right) : Throw("StructuralRight");+ }+ function TAnyRight(left, right) {+ return TypeExtendsResult.True;+ }+ function TAny(left, right) {+ return TypeGuard.TIntersect(right) ? TIntersectRight(left, right) : TypeGuard.TUnion(right) && right.anyOf.some((schema) => TypeGuard.TAny(schema) || TypeGuard.TUnknown(schema)) ? TypeExtendsResult.True : TypeGuard.TUnion(right) ? TypeExtendsResult.Union : TypeGuard.TUnknown(right) ? TypeExtendsResult.True : TypeGuard.TAny(right) ? TypeExtendsResult.True : TypeExtendsResult.Union;+ }+ function TArrayRight(left, right) {+ return TypeGuard.TUnknown(left) ? TypeExtendsResult.False : TypeGuard.TAny(left) ? TypeExtendsResult.Union : TypeGuard.TNever(left) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TArray(left, right) {+ return TypeGuard.TObject(right) && IsObjectArrayLike(right) ? TypeExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !TypeGuard.TArray(right) ? TypeExtendsResult.False : IntoBooleanResult(Visit(left.items, right.items));+ }+ function TAsyncIterator(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : !TypeGuard.TAsyncIterator(right) ? TypeExtendsResult.False : IntoBooleanResult(Visit(left.items, right.items));+ }+ function TBigInt(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TBigInt(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TBooleanRight(left, right) {+ return TypeGuard.TLiteral(left) && ValueGuard.IsBoolean(left.const) ? TypeExtendsResult.True : TypeGuard.TBoolean(left) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TBoolean(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TBoolean(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TConstructor(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : !TypeGuard.TConstructor(right) ? TypeExtendsResult.False : left.parameters.length > right.parameters.length ? TypeExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === TypeExtendsResult.True) ? TypeExtendsResult.False : IntoBooleanResult(Visit(left.returns, right.returns));+ }+ function TDate(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TDate(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TFunction(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : !TypeGuard.TFunction(right) ? TypeExtendsResult.False : left.parameters.length > right.parameters.length ? TypeExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === TypeExtendsResult.True) ? TypeExtendsResult.False : IntoBooleanResult(Visit(left.returns, right.returns));+ }+ function TIntegerRight(left, right) {+ return TypeGuard.TLiteral(left) && ValueGuard.IsNumber(left.const) ? TypeExtendsResult.True : TypeGuard.TNumber(left) || TypeGuard.TInteger(left) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TInteger(left, right) {+ return TypeGuard.TInteger(right) || TypeGuard.TNumber(right) ? TypeExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeExtendsResult.False;+ }+ function TIntersectRight(left, right) {+ return right.allOf.every((schema) => Visit(left, schema) === TypeExtendsResult.True) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TIntersect(left, right) {+ return left.allOf.some((schema) => Visit(schema, right) === TypeExtendsResult.True) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TIterator(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : !TypeGuard.TIterator(right) ? TypeExtendsResult.False : IntoBooleanResult(Visit(left.items, right.items));+ }+ function TLiteral(left, right) {+ return TypeGuard.TLiteral(right) && right.const === left.const ? TypeExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TString(right) ? TStringRight(left, right) : TypeGuard.TNumber(right) ? TNumberRight(left, right) : TypeGuard.TInteger(right) ? TIntegerRight(left, right) : TypeGuard.TBoolean(right) ? TBooleanRight(left, right) : TypeExtendsResult.False;+ }+ function TNeverRight(left, right) {+ return TypeExtendsResult.False;+ }+ function TNever(left, right) {+ return TypeExtendsResult.True;+ }+ function UnwrapTNot(schema) {+ let [current, depth] = [schema, 0];+ while (true) {+ if (!TypeGuard.TNot(current))+ break;+ current = current.not;+ depth += 1;+ }+ return depth % 2 === 0 ? current : exports.Type.Unknown();+ }+ function TNot(left, right) {+ return TypeGuard.TNot(left) ? Visit(UnwrapTNot(left), right) : TypeGuard.TNot(right) ? Visit(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");+ }+ function TNull(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TNull(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TNumberRight(left, right) {+ return TypeGuard.TLiteralNumber(left) ? TypeExtendsResult.True : TypeGuard.TNumber(left) || TypeGuard.TInteger(left) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TNumber(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TInteger(right) || TypeGuard.TNumber(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function IsObjectPropertyCount(schema, count) {+ return Object.getOwnPropertyNames(schema.properties).length === count;+ }+ function IsObjectStringLike(schema) {+ return IsObjectArrayLike(schema);+ }+ function IsObjectSymbolLike(schema) {+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && TypeGuard.TUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (TypeGuard.TString(schema.properties.description.anyOf[0]) && TypeGuard.TUndefined(schema.properties.description.anyOf[1]) || TypeGuard.TString(schema.properties.description.anyOf[1]) && TypeGuard.TUndefined(schema.properties.description.anyOf[0]));+ }+ function IsObjectNumberLike(schema) {+ return IsObjectPropertyCount(schema, 0);+ }+ function IsObjectBooleanLike(schema) {+ return IsObjectPropertyCount(schema, 0);+ }+ function IsObjectBigIntLike(schema) {+ return IsObjectPropertyCount(schema, 0);+ }+ function IsObjectDateLike(schema) {+ return IsObjectPropertyCount(schema, 0);+ }+ function IsObjectUint8ArrayLike(schema) {+ return IsObjectArrayLike(schema);+ }+ function IsObjectFunctionLike(schema) {+ const length = exports.Type.Number();+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit(schema.properties["length"], length)) === TypeExtendsResult.True;+ }+ function IsObjectConstructorLike(schema) {+ return IsObjectPropertyCount(schema, 0);+ }+ function IsObjectArrayLike(schema) {+ const length = exports.Type.Number();+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit(schema.properties["length"], length)) === TypeExtendsResult.True;+ }+ function IsObjectPromiseLike(schema) {+ const then = exports.Type.Function([exports.Type.Any()], exports.Type.Any());+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit(schema.properties["then"], then)) === TypeExtendsResult.True;+ }+ function Property(left, right) {+ return Visit(left, right) === TypeExtendsResult.False ? TypeExtendsResult.False : TypeGuard.TOptional(left) && !TypeGuard.TOptional(right) ? TypeExtendsResult.False : TypeExtendsResult.True;+ }+ function TObjectRight(left, right) {+ return TypeGuard.TUnknown(left) ? TypeExtendsResult.False : TypeGuard.TAny(left) ? TypeExtendsResult.Union : TypeGuard.TNever(left) || TypeGuard.TLiteralString(left) && IsObjectStringLike(right) || TypeGuard.TLiteralNumber(left) && IsObjectNumberLike(right) || TypeGuard.TLiteralBoolean(left) && IsObjectBooleanLike(right) || TypeGuard.TSymbol(left) && IsObjectSymbolLike(right) || TypeGuard.TBigInt(left) && IsObjectBigIntLike(right) || TypeGuard.TString(left) && IsObjectStringLike(right) || TypeGuard.TSymbol(left) && IsObjectSymbolLike(right) || TypeGuard.TNumber(left) && IsObjectNumberLike(right) || TypeGuard.TInteger(left) && IsObjectNumberLike(right) || TypeGuard.TBoolean(left) && IsObjectBooleanLike(right) || TypeGuard.TUint8Array(left) && IsObjectUint8ArrayLike(right) || TypeGuard.TDate(left) && IsObjectDateLike(right) || TypeGuard.TConstructor(left) && IsObjectConstructorLike(right) || TypeGuard.TFunction(left) && IsObjectFunctionLike(right) ? TypeExtendsResult.True : TypeGuard.TRecord(left) && TypeGuard.TString(RecordKey(left)) ? (() => {+ return right[exports.Hint] === "Record" ? TypeExtendsResult.True : TypeExtendsResult.False;+ })() : TypeGuard.TRecord(left) && TypeGuard.TNumber(RecordKey(left)) ? (() => {+ return IsObjectPropertyCount(right, 0) ? TypeExtendsResult.True : TypeExtendsResult.False;+ })() : TypeExtendsResult.False;+ }+ function TObject(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : !TypeGuard.TObject(right) ? TypeExtendsResult.False : (() => {+ for (const key of Object.getOwnPropertyNames(right.properties)) {+ if (!(key in left.properties) && !TypeGuard.TOptional(right.properties[key])) {+ return TypeExtendsResult.False;+ }+ if (TypeGuard.TOptional(right.properties[key])) {+ return TypeExtendsResult.True;+ }+ if (Property(left.properties[key], right.properties[key]) === TypeExtendsResult.False) {+ return TypeExtendsResult.False;+ }+ }+ return TypeExtendsResult.True;+ })();+ }+ function TPromise(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) && IsObjectPromiseLike(right) ? TypeExtendsResult.True : !TypeGuard.TPromise(right) ? TypeExtendsResult.False : IntoBooleanResult(Visit(left.item, right.item));+ }+ function RecordKey(schema) {+ return exports.PatternNumberExact in schema.patternProperties ? exports.Type.Number() : exports.PatternStringExact in schema.patternProperties ? exports.Type.String() : Throw("Unknown record key pattern");+ }+ function RecordValue(schema) {+ return exports.PatternNumberExact in schema.patternProperties ? schema.patternProperties[exports.PatternNumberExact] : exports.PatternStringExact in schema.patternProperties ? schema.patternProperties[exports.PatternStringExact] : Throw("Unable to get record value schema");+ }+ function TRecordRight(left, right) {+ const [Key, Value] = [RecordKey(right), RecordValue(right)];+ return TypeGuard.TLiteralString(left) && TypeGuard.TNumber(Key) && IntoBooleanResult(Visit(left, Value)) === TypeExtendsResult.True ? TypeExtendsResult.True : TypeGuard.TUint8Array(left) && TypeGuard.TNumber(Key) ? Visit(left, Value) : TypeGuard.TString(left) && TypeGuard.TNumber(Key) ? Visit(left, Value) : TypeGuard.TArray(left) && TypeGuard.TNumber(Key) ? Visit(left, Value) : TypeGuard.TObject(left) ? (() => {+ for (const key of Object.getOwnPropertyNames(left.properties)) {+ if (Property(Value, left.properties[key]) === TypeExtendsResult.False) {+ return TypeExtendsResult.False;+ }+ }+ return TypeExtendsResult.True;+ })() : TypeExtendsResult.False;+ }+ function TRecord(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : !TypeGuard.TRecord(right) ? TypeExtendsResult.False : Visit(RecordValue(left), RecordValue(right));+ }+ function TStringRight(left, right) {+ return TypeGuard.TLiteral(left) && ValueGuard.IsString(left.const) ? TypeExtendsResult.True : TypeGuard.TString(left) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TString(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TString(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TSymbol(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TSymbol(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TTemplateLiteral(left, right) {+ return TypeGuard.TTemplateLiteral(left) ? Visit(TemplateLiteralResolver.Resolve(left), right) : TypeGuard.TTemplateLiteral(right) ? Visit(left, TemplateLiteralResolver.Resolve(right)) : Throw("Invalid fallthrough for TemplateLiteral");+ }+ function IsArrayOfTuple(left, right) {+ return TypeGuard.TArray(right) && left.items !== void 0 && left.items.every((schema) => Visit(schema, right.items) === TypeExtendsResult.True);+ }+ function TTupleRight(left, right) {+ return TypeGuard.TNever(left) ? TypeExtendsResult.True : TypeGuard.TUnknown(left) ? TypeExtendsResult.False : TypeGuard.TAny(left) ? TypeExtendsResult.Union : TypeExtendsResult.False;+ }+ function TTuple(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) && IsObjectArrayLike(right) ? TypeExtendsResult.True : TypeGuard.TArray(right) && IsArrayOfTuple(left, right) ? TypeExtendsResult.True : !TypeGuard.TTuple(right) ? TypeExtendsResult.False : ValueGuard.IsUndefined(left.items) && !ValueGuard.IsUndefined(right.items) || !ValueGuard.IsUndefined(left.items) && ValueGuard.IsUndefined(right.items) ? TypeExtendsResult.False : ValueGuard.IsUndefined(left.items) && !ValueGuard.IsUndefined(right.items) ? TypeExtendsResult.True : left.items.every((schema, index) => Visit(schema, right.items[index]) === TypeExtendsResult.True) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TUint8Array(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TUint8Array(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TUndefined(left, right) {+ return IsStructuralRight(right) ? StructuralRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TRecord(right) ? TRecordRight(left, right) : TypeGuard.TVoid(right) ? VoidRight(left, right) : TypeGuard.TUndefined(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TUnionRight(left, right) {+ return right.anyOf.some((schema) => Visit(left, schema) === TypeExtendsResult.True) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TUnion(left, right) {+ return left.anyOf.every((schema) => Visit(schema, right) === TypeExtendsResult.True) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TUnknownRight(left, right) {+ return TypeExtendsResult.True;+ }+ function TUnknown(left, right) {+ return TypeGuard.TNever(right) ? TNeverRight(left, right) : TypeGuard.TIntersect(right) ? TIntersectRight(left, right) : TypeGuard.TUnion(right) ? TUnionRight(left, right) : TypeGuard.TAny(right) ? TAnyRight(left, right) : TypeGuard.TString(right) ? TStringRight(left, right) : TypeGuard.TNumber(right) ? TNumberRight(left, right) : TypeGuard.TInteger(right) ? TIntegerRight(left, right) : TypeGuard.TBoolean(right) ? TBooleanRight(left, right) : TypeGuard.TArray(right) ? TArrayRight(left, right) : TypeGuard.TTuple(right) ? TTupleRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TUnknown(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function VoidRight(left, right) {+ return TypeGuard.TUndefined(left) ? TypeExtendsResult.True : TypeGuard.TUndefined(left) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function TVoid(left, right) {+ return TypeGuard.TIntersect(right) ? TIntersectRight(left, right) : TypeGuard.TUnion(right) ? TUnionRight(left, right) : TypeGuard.TUnknown(right) ? TUnknownRight(left, right) : TypeGuard.TAny(right) ? TAnyRight(left, right) : TypeGuard.TObject(right) ? TObjectRight(left, right) : TypeGuard.TVoid(right) ? TypeExtendsResult.True : TypeExtendsResult.False;+ }+ function Visit(left, right) {+ return (+ // resolvable+ TypeGuard.TTemplateLiteral(left) || TypeGuard.TTemplateLiteral(right) ? TTemplateLiteral(left, right) : TypeGuard.TNot(left) || TypeGuard.TNot(right) ? TNot(left, right) : (+ // standard+ TypeGuard.TAny(left) ? TAny(left, right) : TypeGuard.TArray(left) ? TArray(left, right) : TypeGuard.TBigInt(left) ? TBigInt(left, right) : TypeGuard.TBoolean(left) ? TBoolean(left, right) : TypeGuard.TAsyncIterator(left) ? TAsyncIterator(left, right) : TypeGuard.TConstructor(left) ? TConstructor(left, right) : TypeGuard.TDate(left) ? TDate(left, right) : TypeGuard.TFunction(left) ? TFunction(left, right) : TypeGuard.TInteger(left) ? TInteger(left, right) : TypeGuard.TIntersect(left) ? TIntersect(left, right) : TypeGuard.TIterator(left) ? TIterator(left, right) : TypeGuard.TLiteral(left) ? TLiteral(left, right) : TypeGuard.TNever(left) ? TNever(left, right) : TypeGuard.TNull(left) ? TNull(left, right) : TypeGuard.TNumber(left) ? TNumber(left, right) : TypeGuard.TObject(left) ? TObject(left, right) : TypeGuard.TRecord(left) ? TRecord(left, right) : TypeGuard.TString(left) ? TString(left, right) : TypeGuard.TSymbol(left) ? TSymbol(left, right) : TypeGuard.TTuple(left) ? TTuple(left, right) : TypeGuard.TPromise(left) ? TPromise(left, right) : TypeGuard.TUint8Array(left) ? TUint8Array(left, right) : TypeGuard.TUndefined(left) ? TUndefined(left, right) : TypeGuard.TUnion(left) ? TUnion(left, right) : TypeGuard.TUnknown(left) ? TUnknown(left, right) : TypeGuard.TVoid(left) ? TVoid(left, right) : Throw(`Unknown left type operand '${left[exports.Kind]}'`)+ )+ );+ }+ function Extends(left, right) {+ return Visit(left, right);+ }+ TypeExtends2.Extends = Extends;+ })(TypeExtends || (exports.TypeExtends = TypeExtends = {}));+ var TypeClone;+ (function(TypeClone2) {+ function ArrayType(value) {+ return value.map((value2) => Visit(value2));+ }+ function DateType(value) {+ return new Date(value.getTime());+ }+ function Uint8ArrayType(value) {+ return new Uint8Array(value);+ }+ function ObjectType(value) {+ const clonedProperties = Object.getOwnPropertyNames(value).reduce((acc, key) => ({ ...acc, [key]: Visit(value[key]) }), {});+ const clonedSymbols = Object.getOwnPropertySymbols(value).reduce((acc, key) => ({ ...acc, [key]: Visit(value[key]) }), {});+ return { ...clonedProperties, ...clonedSymbols };+ }+ function Visit(value) {+ return ValueGuard.IsArray(value) ? ArrayType(value) : ValueGuard.IsDate(value) ? DateType(value) : ValueGuard.IsUint8Array(value) ? Uint8ArrayType(value) : ValueGuard.IsObject(value) ? ObjectType(value) : value;+ }+ function Rest(schemas) {+ return schemas.map((schema) => Type2(schema));+ }+ TypeClone2.Rest = Rest;+ function Type2(schema, options = {}) {+ return { ...Visit(schema), ...options };+ }+ TypeClone2.Type = Type2;+ })(TypeClone || (exports.TypeClone = TypeClone = {}));+ var IndexedAccessor;+ (function(IndexedAccessor2) {+ function OptionalUnwrap(schema) {+ return schema.map((schema2) => {+ const { [exports.Optional]: _, ...clone } = TypeClone.Type(schema2);+ return clone;+ });+ }+ function IsIntersectOptional(schema) {+ return schema.every((schema2) => TypeGuard.TOptional(schema2));+ }+ function IsUnionOptional(schema) {+ return schema.some((schema2) => TypeGuard.TOptional(schema2));+ }+ function ResolveIntersect(schema) {+ return IsIntersectOptional(schema.allOf) ? exports.Type.Optional(exports.Type.Intersect(OptionalUnwrap(schema.allOf))) : schema;+ }+ function ResolveUnion(schema) {+ return IsUnionOptional(schema.anyOf) ? exports.Type.Optional(exports.Type.Union(OptionalUnwrap(schema.anyOf))) : schema;+ }+ function ResolveOptional(schema) {+ return schema[exports.Kind] === "Intersect" ? ResolveIntersect(schema) : schema[exports.Kind] === "Union" ? ResolveUnion(schema) : schema;+ }+ function TIntersect(schema, key) {+ const resolved = schema.allOf.reduce((acc, schema2) => {+ const indexed = Visit(schema2, key);+ return indexed[exports.Kind] === "Never" ? acc : [...acc, indexed];+ }, []);+ return ResolveOptional(exports.Type.Intersect(resolved));+ }+ function TUnion(schema, key) {+ const resolved = schema.anyOf.map((schema2) => Visit(schema2, key));+ return ResolveOptional(exports.Type.Union(resolved));+ }+ function TObject(schema, key) {+ const property = schema.properties[key];+ return ValueGuard.IsUndefined(property) ? exports.Type.Never() : exports.Type.Union([property]);+ }+ function TTuple(schema, key) {+ const items = schema.items;+ if (ValueGuard.IsUndefined(items))+ return exports.Type.Never();+ const element = items[key];+ if (ValueGuard.IsUndefined(element))+ return exports.Type.Never();+ return element;+ }+ function Visit(schema, key) {+ return schema[exports.Kind] === "Intersect" ? TIntersect(schema, key) : schema[exports.Kind] === "Union" ? TUnion(schema, key) : schema[exports.Kind] === "Object" ? TObject(schema, key) : schema[exports.Kind] === "Tuple" ? TTuple(schema, key) : exports.Type.Never();+ }+ function Resolve(schema, keys, options = {}) {+ const resolved = keys.map((key) => Visit(schema, key.toString()));+ return ResolveOptional(exports.Type.Union(resolved, options));+ }+ IndexedAccessor2.Resolve = Resolve;+ })(IndexedAccessor || (exports.IndexedAccessor = IndexedAccessor = {}));+ var Intrinsic;+ (function(Intrinsic2) {+ function Uncapitalize(value) {+ const [first, rest] = [value.slice(0, 1), value.slice(1)];+ return `${first.toLowerCase()}${rest}`;+ }+ function Capitalize(value) {+ const [first, rest] = [value.slice(0, 1), value.slice(1)];+ return `${first.toUpperCase()}${rest}`;+ }+ function Uppercase(value) {+ return value.toUpperCase();+ }+ function Lowercase(value) {+ return value.toLowerCase();+ }+ function IntrinsicTemplateLiteral(schema, mode) {+ const expression = TemplateLiteralParser.ParseExact(schema.pattern);+ const finite = TemplateLiteralFinite.Check(expression);+ if (!finite)+ return { ...schema, pattern: IntrinsicLiteral(schema.pattern, mode) };+ const strings = [...TemplateLiteralGenerator.Generate(expression)];+ const literals = strings.map((value) => exports.Type.Literal(value));+ const mapped = IntrinsicRest(literals, mode);+ const union = exports.Type.Union(mapped);+ return exports.Type.TemplateLiteral([union]);+ }+ function IntrinsicLiteral(value, mode) {+ return typeof value === "string" ? mode === "Uncapitalize" ? Uncapitalize(value) : mode === "Capitalize" ? Capitalize(value) : mode === "Uppercase" ? Uppercase(value) : mode === "Lowercase" ? Lowercase(value) : value : value.toString();+ }+ function IntrinsicRest(schema, mode) {+ if (schema.length === 0)+ return [];+ const [L, ...R] = schema;+ return [Map2(L, mode), ...IntrinsicRest(R, mode)];+ }+ function Visit(schema, mode) {+ return TypeGuard.TTemplateLiteral(schema) ? IntrinsicTemplateLiteral(schema, mode) : TypeGuard.TUnion(schema) ? exports.Type.Union(IntrinsicRest(schema.anyOf, mode)) : TypeGuard.TLiteral(schema) ? exports.Type.Literal(IntrinsicLiteral(schema.const, mode)) : schema;+ }+ function Map2(schema, mode) {+ return Visit(schema, mode);+ }+ Intrinsic2.Map = Map2;+ })(Intrinsic || (exports.Intrinsic = Intrinsic = {}));+ var ObjectMap;+ (function(ObjectMap2) {+ function TIntersect(schema, callback) {+ return exports.Type.Intersect(schema.allOf.map((inner) => Visit(inner, callback)), { ...schema });+ }+ function TUnion(schema, callback) {+ return exports.Type.Union(schema.anyOf.map((inner) => Visit(inner, callback)), { ...schema });+ }+ function TObject(schema, callback) {+ return callback(schema);+ }+ function Visit(schema, callback) {+ return schema[exports.Kind] === "Intersect" ? TIntersect(schema, callback) : schema[exports.Kind] === "Union" ? TUnion(schema, callback) : schema[exports.Kind] === "Object" ? TObject(schema, callback) : schema;+ }+ function Map2(schema, callback, options) {+ return { ...Visit(TypeClone.Type(schema), callback), ...options };+ }+ ObjectMap2.Map = Map2;+ })(ObjectMap || (exports.ObjectMap = ObjectMap = {}));+ var KeyResolver;+ (function(KeyResolver2) {+ function UnwrapPattern(key) {+ return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;+ }+ function TIntersect(schema, options) {+ return schema.allOf.reduce((acc, schema2) => [...acc, ...Visit(schema2, options)], []);+ }+ function TUnion(schema, options) {+ const sets = schema.anyOf.map((inner) => Visit(inner, options));+ return [...sets.reduce((set, outer) => outer.map((key) => sets.every((inner) => inner.includes(key)) ? set.add(key) : set)[0], /* @__PURE__ */ new Set())];+ }+ function TObject(schema, options) {+ return Object.getOwnPropertyNames(schema.properties);+ }+ function TRecord(schema, options) {+ return options.includePatterns ? Object.getOwnPropertyNames(schema.patternProperties) : [];+ }+ function Visit(schema, options) {+ return TypeGuard.TIntersect(schema) ? TIntersect(schema, options) : TypeGuard.TUnion(schema) ? TUnion(schema, options) : TypeGuard.TObject(schema) ? TObject(schema, options) : TypeGuard.TRecord(schema) ? TRecord(schema, options) : [];+ }+ function ResolveKeys(schema, options) {+ return [...new Set(Visit(schema, options))];+ }+ KeyResolver2.ResolveKeys = ResolveKeys;+ function ResolvePattern(schema) {+ const keys = ResolveKeys(schema, { includePatterns: true });+ const pattern = keys.map((key) => `(${UnwrapPattern(key)})`);+ return `^(${pattern.join("|")})$`;+ }+ KeyResolver2.ResolvePattern = ResolvePattern;+ })(KeyResolver || (exports.KeyResolver = KeyResolver = {}));+ var KeyArrayResolverError = class extends TypeBoxError {+ };+ exports.KeyArrayResolverError = KeyArrayResolverError;+ var KeyArrayResolver;+ (function(KeyArrayResolver2) {+ function Resolve(schema) {+ return Array.isArray(schema) ? schema : TypeGuard.TUnionLiteral(schema) ? schema.anyOf.map((schema2) => schema2.const.toString()) : TypeGuard.TLiteral(schema) ? [schema.const] : TypeGuard.TTemplateLiteral(schema) ? (() => {+ const expression = TemplateLiteralParser.ParseExact(schema.pattern);+ if (!TemplateLiteralFinite.Check(expression))+ throw new KeyArrayResolverError("Cannot resolve keys from infinite template expression");+ return [...TemplateLiteralGenerator.Generate(expression)];+ })() : [];+ }+ KeyArrayResolver2.Resolve = Resolve;+ })(KeyArrayResolver || (exports.KeyArrayResolver = KeyArrayResolver = {}));+ var UnionResolver;+ (function(UnionResolver2) {+ function* TUnion(union) {+ for (const schema of union.anyOf) {+ if (schema[exports.Kind] === "Union") {+ yield* TUnion(schema);+ } else {+ yield schema;+ }+ }+ }+ function Resolve(union) {+ return exports.Type.Union([...TUnion(union)], { ...union });+ }+ UnionResolver2.Resolve = Resolve;+ })(UnionResolver || (exports.UnionResolver = UnionResolver = {}));+ var TemplateLiteralPatternError = class extends TypeBoxError {+ };+ exports.TemplateLiteralPatternError = TemplateLiteralPatternError;+ var TemplateLiteralPattern;+ (function(TemplateLiteralPattern2) {+ function Throw(message) {+ throw new TemplateLiteralPatternError(message);+ }+ function Escape(value) {+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");+ }+ function Visit(schema, acc) {+ return TypeGuard.TTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : TypeGuard.TUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit(schema2, acc)).join("|")})` : TypeGuard.TNumber(schema) ? `${acc}${exports.PatternNumber}` : TypeGuard.TInteger(schema) ? `${acc}${exports.PatternNumber}` : TypeGuard.TBigInt(schema) ? `${acc}${exports.PatternNumber}` : TypeGuard.TString(schema) ? `${acc}${exports.PatternString}` : TypeGuard.TLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : TypeGuard.TBoolean(schema) ? `${acc}${exports.PatternBoolean}` : Throw(`Unexpected Kind '${schema[exports.Kind]}'`);+ }+ function Create(kinds) {+ return `^${kinds.map((schema) => Visit(schema, "")).join("")}$`;+ }+ TemplateLiteralPattern2.Create = Create;+ })(TemplateLiteralPattern || (exports.TemplateLiteralPattern = TemplateLiteralPattern = {}));+ var TemplateLiteralResolver;+ (function(TemplateLiteralResolver2) {+ function Resolve(template) {+ const expression = TemplateLiteralParser.ParseExact(template.pattern);+ if (!TemplateLiteralFinite.Check(expression))+ return exports.Type.String();+ const literals = [...TemplateLiteralGenerator.Generate(expression)].map((value) => exports.Type.Literal(value));+ return exports.Type.Union(literals);+ }+ TemplateLiteralResolver2.Resolve = Resolve;+ })(TemplateLiteralResolver || (exports.TemplateLiteralResolver = TemplateLiteralResolver = {}));+ var TemplateLiteralParserError = class extends TypeBoxError {+ };+ exports.TemplateLiteralParserError = TemplateLiteralParserError;+ var TemplateLiteralParser;+ (function(TemplateLiteralParser2) {+ function IsNonEscaped(pattern, index, char) {+ return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;+ }+ function IsOpenParen(pattern, index) {+ return IsNonEscaped(pattern, index, "(");+ }+ function IsCloseParen(pattern, index) {+ return IsNonEscaped(pattern, index, ")");+ }+ function IsSeparator(pattern, index) {+ return IsNonEscaped(pattern, index, "|");+ }+ function IsGroup(pattern) {+ if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))+ return false;+ let count = 0;+ for (let index = 0; index < pattern.length; index++) {+ if (IsOpenParen(pattern, index))+ count += 1;+ if (IsCloseParen(pattern, index))+ count -= 1;+ if (count === 0 && index !== pattern.length - 1)+ return false;+ }+ return true;+ }+ function InGroup(pattern) {+ return pattern.slice(1, pattern.length - 1);+ }+ function IsPrecedenceOr(pattern) {+ let count = 0;+ for (let index = 0; index < pattern.length; index++) {+ if (IsOpenParen(pattern, index))+ count += 1;+ if (IsCloseParen(pattern, index))+ count -= 1;+ if (IsSeparator(pattern, index) && count === 0)+ return true;+ }+ return false;+ }+ function IsPrecedenceAnd(pattern) {+ for (let index = 0; index < pattern.length; index++) {+ if (IsOpenParen(pattern, index))+ return true;+ }+ return false;+ }+ function Or(pattern) {+ let [count, start] = [0, 0];+ const expressions = [];+ for (let index = 0; index < pattern.length; index++) {+ if (IsOpenParen(pattern, index))+ count += 1;+ if (IsCloseParen(pattern, index))+ count -= 1;+ if (IsSeparator(pattern, index) && count === 0) {+ const range2 = pattern.slice(start, index);+ if (range2.length > 0)+ expressions.push(Parse(range2));+ start = index + 1;+ }+ }+ const range = pattern.slice(start);+ if (range.length > 0)+ expressions.push(Parse(range));+ if (expressions.length === 0)+ return { type: "const", const: "" };+ if (expressions.length === 1)+ return expressions[0];+ return { type: "or", expr: expressions };+ }+ function And(pattern) {+ function Group(value, index) {+ if (!IsOpenParen(value, index))+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);+ let count = 0;+ for (let scan = index; scan < value.length; scan++) {+ if (IsOpenParen(value, scan))+ count += 1;+ if (IsCloseParen(value, scan))+ count -= 1;+ if (count === 0)+ return [index, scan];+ }+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);+ }+ function Range(pattern2, index) {+ for (let scan = index; scan < pattern2.length; scan++) {+ if (IsOpenParen(pattern2, scan))+ return [index, scan];+ }+ return [index, pattern2.length];+ }+ const expressions = [];+ for (let index = 0; index < pattern.length; index++) {+ if (IsOpenParen(pattern, index)) {+ const [start, end] = Group(pattern, index);+ const range = pattern.slice(start, end + 1);+ expressions.push(Parse(range));+ index = end;+ } else {+ const [start, end] = Range(pattern, index);+ const range = pattern.slice(start, end);+ if (range.length > 0)+ expressions.push(Parse(range));+ index = end - 1;+ }+ }+ return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };+ }+ function Parse(pattern) {+ return IsGroup(pattern) ? Parse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: pattern };+ }+ TemplateLiteralParser2.Parse = Parse;+ function ParseExact(pattern) {+ return Parse(pattern.slice(1, pattern.length - 1));+ }+ TemplateLiteralParser2.ParseExact = ParseExact;+ })(TemplateLiteralParser || (exports.TemplateLiteralParser = TemplateLiteralParser = {}));+ var TemplateLiteralFiniteError = class extends TypeBoxError {+ };+ exports.TemplateLiteralFiniteError = TemplateLiteralFiniteError;+ var TemplateLiteralFinite;+ (function(TemplateLiteralFinite2) {+ function Throw(message) {+ throw new TemplateLiteralFiniteError(message);+ }+ function IsNumber(expression) {+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";+ }+ function IsBoolean(expression) {+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";+ }+ function IsString(expression) {+ return expression.type === "const" && expression.const === ".*";+ }+ function Check(expression) {+ return IsBoolean(expression) ? true : IsNumber(expression) || IsString(expression) ? false : expression.type === "and" ? expression.expr.every((expr) => Check(expr)) : expression.type === "or" ? expression.expr.every((expr) => Check(expr)) : expression.type === "const" ? true : Throw(`Unknown expression type`);+ }+ TemplateLiteralFinite2.Check = Check;+ })(TemplateLiteralFinite || (exports.TemplateLiteralFinite = TemplateLiteralFinite = {}));+ var TemplateLiteralGeneratorError = class extends TypeBoxError {+ };+ exports.TemplateLiteralGeneratorError = TemplateLiteralGeneratorError;+ var TemplateLiteralGenerator;+ (function(TemplateLiteralGenerator2) {+ function* Reduce(buffer) {+ if (buffer.length === 1)+ return yield* buffer[0];+ for (const left of buffer[0]) {+ for (const right of Reduce(buffer.slice(1))) {+ yield `${left}${right}`;+ }+ }+ }+ function* And(expression) {+ return yield* Reduce(expression.expr.map((expr) => [...Generate(expr)]));+ }+ function* Or(expression) {+ for (const expr of expression.expr)+ yield* Generate(expr);+ }+ function* Const(expression) {+ return yield expression.const;+ }+ function* Generate(expression) {+ return expression.type === "and" ? yield* And(expression) : expression.type === "or" ? yield* Or(expression) : expression.type === "const" ? yield* Const(expression) : (() => {+ throw new TemplateLiteralGeneratorError("Unknown expression");+ })();+ }+ TemplateLiteralGenerator2.Generate = Generate;+ })(TemplateLiteralGenerator || (exports.TemplateLiteralGenerator = TemplateLiteralGenerator = {}));+ var TemplateLiteralDslParser;+ (function(TemplateLiteralDslParser2) {+ function* ParseUnion(template) {+ const trim = template.trim().replace(/"|'/g, "");+ return trim === "boolean" ? yield exports.Type.Boolean() : trim === "number" ? yield exports.Type.Number() : trim === "bigint" ? yield exports.Type.BigInt() : trim === "string" ? yield exports.Type.String() : yield (() => {+ const literals = trim.split("|").map((literal) => exports.Type.Literal(literal.trim()));+ return literals.length === 0 ? exports.Type.Never() : literals.length === 1 ? literals[0] : exports.Type.Union(literals);+ })();+ }+ function* ParseTerminal(template) {+ if (template[1] !== "{") {+ const L = exports.Type.Literal("$");+ const R = ParseLiteral(template.slice(1));+ return yield* [L, ...R];+ }+ for (let i = 2; i < template.length; i++) {+ if (template[i] === "}") {+ const L = ParseUnion(template.slice(2, i));+ const R = ParseLiteral(template.slice(i + 1));+ return yield* [...L, ...R];+ }+ }+ yield exports.Type.Literal(template);+ }+ function* ParseLiteral(template) {+ for (let i = 0; i < template.length; i++) {+ if (template[i] === "$") {+ const L = exports.Type.Literal(template.slice(0, i));+ const R = ParseTerminal(template.slice(i));+ return yield* [L, ...R];+ }+ }+ yield exports.Type.Literal(template);+ }+ function Parse(template_dsl) {+ return [...ParseLiteral(template_dsl)];+ }+ TemplateLiteralDslParser2.Parse = Parse;+ })(TemplateLiteralDslParser || (exports.TemplateLiteralDslParser = TemplateLiteralDslParser = {}));+ var TransformDecodeBuilder = class {+ constructor(schema) {+ this.schema = schema;+ }+ Decode(decode) {+ return new TransformEncodeBuilder(this.schema, decode);+ }+ };+ exports.TransformDecodeBuilder = TransformDecodeBuilder;+ var TransformEncodeBuilder = class {+ constructor(schema, decode) {+ this.schema = schema;+ this.decode = decode;+ }+ Encode(encode) {+ const schema = TypeClone.Type(this.schema);+ return TypeGuard.TTransform(schema) ? (() => {+ const Encode = (value) => schema[exports.Transform].Encode(encode(value));+ const Decode = (value) => this.decode(schema[exports.Transform].Decode(value));+ const Codec = { Encode, Decode };+ return { ...schema, [exports.Transform]: Codec };+ })() : (() => {+ const Codec = { Decode: this.decode, Encode: encode };+ return { ...schema, [exports.Transform]: Codec };+ })();+ }+ };+ exports.TransformEncodeBuilder = TransformEncodeBuilder;+ var TypeOrdinal = 0;+ var TypeBuilderError = class extends TypeBoxError {+ };+ exports.TypeBuilderError = TypeBuilderError;+ var TypeBuilder = class {+ /** `[Internal]` Creates a schema without `static` and `params` types */+ Create(schema) {+ return schema;+ }+ /** `[Internal]` Throws a TypeBuilder error with the given message */+ Throw(message) {+ throw new TypeBuilderError(message);+ }+ /** `[Internal]` Discards property keys from the given record type */+ Discard(record, keys) {+ return keys.reduce((acc, key) => {+ const { [key]: _, ...rest } = acc;+ return rest;+ }, record);+ }+ /** `[Json]` Omits compositing symbols from this schema */+ Strict(schema) {+ return JSON.parse(JSON.stringify(schema));+ }+ };+ exports.TypeBuilder = TypeBuilder;+ var JsonTypeBuilder = class extends TypeBuilder {+ // ------------------------------------------------------------------------+ // Modifiers+ // ------------------------------------------------------------------------+ /** `[Json]` Creates a Readonly and Optional property */+ ReadonlyOptional(schema) {+ return this.Readonly(this.Optional(schema));+ }+ /** `[Json]` Creates a Readonly property */+ Readonly(schema) {+ return { ...TypeClone.Type(schema), [exports.Readonly]: "Readonly" };+ }+ /** `[Json]` Creates an Optional property */+ Optional(schema) {+ return { ...TypeClone.Type(schema), [exports.Optional]: "Optional" };+ }+ // ------------------------------------------------------------------------+ // Types+ // ------------------------------------------------------------------------+ /** `[Json]` Creates an Any type */+ Any(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Any" });+ }+ /** `[Json]` Creates an Array type */+ Array(schema, options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Array", type: "array", items: TypeClone.Type(schema) });+ }+ /** `[Json]` Creates a Boolean type */+ Boolean(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Boolean", type: "boolean" });+ }+ /** `[Json]` Intrinsic function to Capitalize LiteralString types */+ Capitalize(schema, options = {}) {+ return { ...Intrinsic.Map(TypeClone.Type(schema), "Capitalize"), ...options };+ }+ /** `[Json]` Creates a Composite object type */+ Composite(objects, options) {+ const intersect = exports.Type.Intersect(objects, {});+ const keys = KeyResolver.ResolveKeys(intersect, { includePatterns: false });+ const properties = keys.reduce((acc, key) => ({ ...acc, [key]: exports.Type.Index(intersect, [key]) }), {});+ return exports.Type.Object(properties, options);+ }+ /** `[Json]` Creates a Enum type */+ Enum(item, options = {}) {+ if (ValueGuard.IsUndefined(item))+ return this.Throw("Enum undefined or empty");+ const values1 = Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);+ const values2 = [...new Set(values1)];+ const anyOf = values2.map((value) => exports.Type.Literal(value));+ return this.Union(anyOf, { ...options, [exports.Hint]: "Enum" });+ }+ /** `[Json]` Creates a Conditional type */+ Extends(left, right, trueType, falseType, options = {}) {+ switch (TypeExtends.Extends(left, right)) {+ case TypeExtendsResult.Union:+ return this.Union([TypeClone.Type(trueType, options), TypeClone.Type(falseType, options)]);+ case TypeExtendsResult.True:+ return TypeClone.Type(trueType, options);+ case TypeExtendsResult.False:+ return TypeClone.Type(falseType, options);+ }+ }+ /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */+ Exclude(unionType, excludedMembers, options = {}) {+ return TypeGuard.TTemplateLiteral(unionType) ? this.Exclude(TemplateLiteralResolver.Resolve(unionType), excludedMembers, options) : TypeGuard.TTemplateLiteral(excludedMembers) ? this.Exclude(unionType, TemplateLiteralResolver.Resolve(excludedMembers), options) : TypeGuard.TUnion(unionType) ? (() => {+ const narrowed = unionType.anyOf.filter((inner) => TypeExtends.Extends(inner, excludedMembers) === TypeExtendsResult.False);+ return narrowed.length === 1 ? TypeClone.Type(narrowed[0], options) : this.Union(narrowed, options);+ })() : TypeExtends.Extends(unionType, excludedMembers) !== TypeExtendsResult.False ? this.Never(options) : TypeClone.Type(unionType, options);+ }+ /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */+ Extract(type, union, options = {}) {+ return TypeGuard.TTemplateLiteral(type) ? this.Extract(TemplateLiteralResolver.Resolve(type), union, options) : TypeGuard.TTemplateLiteral(union) ? this.Extract(type, TemplateLiteralResolver.Resolve(union), options) : TypeGuard.TUnion(type) ? (() => {+ const narrowed = type.anyOf.filter((inner) => TypeExtends.Extends(inner, union) !== TypeExtendsResult.False);+ return narrowed.length === 1 ? TypeClone.Type(narrowed[0], options) : this.Union(narrowed, options);+ })() : TypeExtends.Extends(type, union) !== TypeExtendsResult.False ? TypeClone.Type(type, options) : this.Never(options);+ }+ /** `[Json]` Returns an Indexed property type for the given keys */+ Index(schema, unresolved, options = {}) {+ return TypeGuard.TArray(schema) && TypeGuard.TNumber(unresolved) ? (() => {+ return TypeClone.Type(schema.items, options);+ })() : TypeGuard.TTuple(schema) && TypeGuard.TNumber(unresolved) ? (() => {+ const items = ValueGuard.IsUndefined(schema.items) ? [] : schema.items;+ const cloned = items.map((schema2) => TypeClone.Type(schema2));+ return this.Union(cloned, options);+ })() : (() => {+ const keys = KeyArrayResolver.Resolve(unresolved);+ const clone = TypeClone.Type(schema);+ return IndexedAccessor.Resolve(clone, keys, options);+ })();+ }+ /** `[Json]` Creates an Integer type */+ Integer(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Integer", type: "integer" });+ }+ /** `[Json]` Creates an Intersect type */+ Intersect(allOf, options = {}) {+ if (allOf.length === 0)+ return exports.Type.Never();+ if (allOf.length === 1)+ return TypeClone.Type(allOf[0], options);+ if (allOf.some((schema) => TypeGuard.TTransform(schema)))+ this.Throw("Cannot intersect transform types");+ const objects = allOf.every((schema) => TypeGuard.TObject(schema));+ const cloned = TypeClone.Rest(allOf);+ const clonedUnevaluatedProperties = TypeGuard.TSchema(options.unevaluatedProperties) ? { unevaluatedProperties: TypeClone.Type(options.unevaluatedProperties) } : {};+ return options.unevaluatedProperties === false || TypeGuard.TSchema(options.unevaluatedProperties) || objects ? this.Create({ ...options, ...clonedUnevaluatedProperties, [exports.Kind]: "Intersect", type: "object", allOf: cloned }) : this.Create({ ...options, ...clonedUnevaluatedProperties, [exports.Kind]: "Intersect", allOf: cloned });+ }+ /** `[Json]` Creates a KeyOf type */+ KeyOf(schema, options = {}) {+ return TypeGuard.TRecord(schema) ? (() => {+ const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];+ return pattern === exports.PatternNumberExact ? this.Number(options) : pattern === exports.PatternStringExact ? this.String(options) : this.Throw("Unable to resolve key type from Record key pattern");+ })() : TypeGuard.TTuple(schema) ? (() => {+ const items = ValueGuard.IsUndefined(schema.items) ? [] : schema.items;+ const literals = items.map((_, index) => exports.Type.Literal(index.toString()));+ return this.Union(literals, options);+ })() : TypeGuard.TArray(schema) ? (() => {+ return this.Number(options);+ })() : (() => {+ const keys = KeyResolver.ResolveKeys(schema, { includePatterns: false });+ if (keys.length === 0)+ return this.Never(options);+ const literals = keys.map((key) => this.Literal(key));+ return this.Union(literals, options);+ })();+ }+ /** `[Json]` Creates a Literal type */+ Literal(value, options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Literal", const: value, type: typeof value });+ }+ /** `[Json]` Intrinsic function to Lowercase LiteralString types */+ Lowercase(schema, options = {}) {+ return { ...Intrinsic.Map(TypeClone.Type(schema), "Lowercase"), ...options };+ }+ /** `[Json]` Creates a Never type */+ Never(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Never", not: {} });+ }+ /** `[Json]` Creates a Not type */+ Not(schema, options) {+ return this.Create({ ...options, [exports.Kind]: "Not", not: TypeClone.Type(schema) });+ }+ /** `[Json]` Creates a Null type */+ Null(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Null", type: "null" });+ }+ /** `[Json]` Creates a Number type */+ Number(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Number", type: "number" });+ }+ /** `[Json]` Creates an Object type */+ Object(properties, options = {}) {+ const propertyKeys = Object.getOwnPropertyNames(properties);+ const optionalKeys = propertyKeys.filter((key) => TypeGuard.TOptional(properties[key]));+ const requiredKeys = propertyKeys.filter((name) => !optionalKeys.includes(name));+ const clonedAdditionalProperties = TypeGuard.TSchema(options.additionalProperties) ? { additionalProperties: TypeClone.Type(options.additionalProperties) } : {};+ const clonedProperties = propertyKeys.reduce((acc, key) => ({ ...acc, [key]: TypeClone.Type(properties[key]) }), {});+ return requiredKeys.length > 0 ? this.Create({ ...options, ...clonedAdditionalProperties, [exports.Kind]: "Object", type: "object", properties: clonedProperties, required: requiredKeys }) : this.Create({ ...options, ...clonedAdditionalProperties, [exports.Kind]: "Object", type: "object", properties: clonedProperties });+ }+ /** `[Json]` Constructs a type whose keys are omitted from the given type */+ Omit(schema, unresolved, options = {}) {+ const keys = KeyArrayResolver.Resolve(unresolved);+ return ObjectMap.Map(this.Discard(TypeClone.Type(schema), ["$id", exports.Transform]), (object) => {+ if (ValueGuard.IsArray(object.required)) {+ object.required = object.required.filter((key) => !keys.includes(key));+ if (object.required.length === 0)+ delete object.required;+ }+ for (const key of Object.getOwnPropertyNames(object.properties)) {+ if (keys.includes(key))+ delete object.properties[key];+ }+ return this.Create(object);+ }, options);+ }+ /** `[Json]` Constructs a type where all properties are optional */+ Partial(schema, options = {}) {+ return ObjectMap.Map(this.Discard(TypeClone.Type(schema), ["$id", exports.Transform]), (object) => {+ const properties = Object.getOwnPropertyNames(object.properties).reduce((acc, key) => {+ return { ...acc, [key]: this.Optional(object.properties[key]) };+ }, {});+ return this.Object(+ properties,+ this.Discard(object, ["required"])+ /* object used as options to retain other constraints */+ );+ }, options);+ }+ /** `[Json]` Constructs a type whose keys are picked from the given type */+ Pick(schema, unresolved, options = {}) {+ const keys = KeyArrayResolver.Resolve(unresolved);+ return ObjectMap.Map(this.Discard(TypeClone.Type(schema), ["$id", exports.Transform]), (object) => {+ if (ValueGuard.IsArray(object.required)) {+ object.required = object.required.filter((key) => keys.includes(key));+ if (object.required.length === 0)+ delete object.required;+ }+ for (const key of Object.getOwnPropertyNames(object.properties)) {+ if (!keys.includes(key))+ delete object.properties[key];+ }+ return this.Create(object);+ }, options);+ }+ /** `[Json]` Creates a Record type */+ Record(key, schema, options = {}) {+ return TypeGuard.TTemplateLiteral(key) ? (() => {+ const expression = TemplateLiteralParser.ParseExact(key.pattern);+ return TemplateLiteralFinite.Check(expression) ? this.Object([...TemplateLiteralGenerator.Generate(expression)].reduce((acc, key2) => ({ ...acc, [key2]: TypeClone.Type(schema) }), {}), options) : this.Create({ ...options, [exports.Kind]: "Record", type: "object", patternProperties: { [key.pattern]: TypeClone.Type(schema) } });+ })() : TypeGuard.TUnion(key) ? (() => {+ const union = UnionResolver.Resolve(key);+ if (TypeGuard.TUnionLiteral(union)) {+ const properties = union.anyOf.reduce((acc, literal) => ({ ...acc, [literal.const]: TypeClone.Type(schema) }), {});+ return this.Object(properties, { ...options, [exports.Hint]: "Record" });+ } else+ this.Throw("Record key of type union contains non-literal types");+ })() : TypeGuard.TLiteral(key) ? (() => {+ return ValueGuard.IsString(key.const) || ValueGuard.IsNumber(key.const) ? this.Object({ [key.const]: TypeClone.Type(schema) }, options) : this.Throw("Record key of type literal is not of type string or number");+ })() : TypeGuard.TInteger(key) || TypeGuard.TNumber(key) ? (() => {+ return this.Create({ ...options, [exports.Kind]: "Record", type: "object", patternProperties: { [exports.PatternNumberExact]: TypeClone.Type(schema) } });+ })() : TypeGuard.TString(key) ? (() => {+ const pattern = ValueGuard.IsUndefined(key.pattern) ? exports.PatternStringExact : key.pattern;+ return this.Create({ ...options, [exports.Kind]: "Record", type: "object", patternProperties: { [pattern]: TypeClone.Type(schema) } });+ })() : this.Never();+ }+ /** `[Json]` Creates a Recursive type */+ Recursive(callback, options = {}) {+ if (ValueGuard.IsUndefined(options.$id))+ options.$id = `T${TypeOrdinal++}`;+ const thisType = callback({ [exports.Kind]: "This", $ref: `${options.$id}` });+ thisType.$id = options.$id;+ return this.Create({ ...options, [exports.Hint]: "Recursive", ...thisType });+ }+ /** `[Json]` Creates a Ref type. */+ Ref(unresolved, options = {}) {+ if (ValueGuard.IsString(unresolved))+ return this.Create({ ...options, [exports.Kind]: "Ref", $ref: unresolved });+ if (ValueGuard.IsUndefined(unresolved.$id))+ this.Throw("Reference target type must specify an $id");+ return this.Create({ ...options, [exports.Kind]: "Ref", $ref: unresolved.$id });+ }+ /** `[Json]` Constructs a type where all properties are required */+ Required(schema, options = {}) {+ return ObjectMap.Map(this.Discard(TypeClone.Type(schema), ["$id", exports.Transform]), (object) => {+ const properties = Object.getOwnPropertyNames(object.properties).reduce((acc, key) => {+ return { ...acc, [key]: this.Discard(object.properties[key], [exports.Optional]) };+ }, {});+ return this.Object(+ properties,+ object+ /* object used as options to retain other constraints */+ );+ }, options);+ }+ /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */+ Rest(schema) {+ return TypeGuard.TTuple(schema) && !ValueGuard.IsUndefined(schema.items) ? TypeClone.Rest(schema.items) : TypeGuard.TIntersect(schema) ? TypeClone.Rest(schema.allOf) : TypeGuard.TUnion(schema) ? TypeClone.Rest(schema.anyOf) : [];+ }+ /** `[Json]` Creates a String type */+ String(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "String", type: "string" });+ }+ /** `[Json]` Creates a TemplateLiteral type */+ TemplateLiteral(unresolved, options = {}) {+ const pattern = ValueGuard.IsString(unresolved) ? TemplateLiteralPattern.Create(TemplateLiteralDslParser.Parse(unresolved)) : TemplateLiteralPattern.Create(unresolved);+ return this.Create({ ...options, [exports.Kind]: "TemplateLiteral", type: "string", pattern });+ }+ /** `[Json]` Creates a Transform type */+ Transform(schema) {+ return new TransformDecodeBuilder(schema);+ }+ /** `[Json]` Creates a Tuple type */+ Tuple(items, options = {}) {+ const [additionalItems, minItems, maxItems] = [false, items.length, items.length];+ const clonedItems = TypeClone.Rest(items);+ const schema = items.length > 0 ? { ...options, [exports.Kind]: "Tuple", type: "array", items: clonedItems, additionalItems, minItems, maxItems } : { ...options, [exports.Kind]: "Tuple", type: "array", minItems, maxItems };+ return this.Create(schema);+ }+ /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */+ Uncapitalize(schema, options = {}) {+ return { ...Intrinsic.Map(TypeClone.Type(schema), "Uncapitalize"), ...options };+ }+ /** `[Json]` Creates a Union type */+ Union(union, options = {}) {+ return TypeGuard.TTemplateLiteral(union) ? TemplateLiteralResolver.Resolve(union) : (() => {+ const anyOf = union;+ if (anyOf.length === 0)+ return this.Never(options);+ if (anyOf.length === 1)+ return this.Create(TypeClone.Type(anyOf[0], options));+ const clonedAnyOf = TypeClone.Rest(anyOf);+ return this.Create({ ...options, [exports.Kind]: "Union", anyOf: clonedAnyOf });+ })();+ }+ /** `[Json]` Creates an Unknown type */+ Unknown(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Unknown" });+ }+ /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */+ Unsafe(options = {}) {+ return this.Create({ ...options, [exports.Kind]: options[exports.Kind] || "Unsafe" });+ }+ /** `[Json]` Intrinsic function to Uppercase LiteralString types */+ Uppercase(schema, options = {}) {+ return { ...Intrinsic.Map(TypeClone.Type(schema), "Uppercase"), ...options };+ }+ };+ exports.JsonTypeBuilder = JsonTypeBuilder;+ var JavaScriptTypeBuilder = class extends JsonTypeBuilder {+ /** `[JavaScript]` Creates a AsyncIterator type */+ AsyncIterator(items, options = {}) {+ return this.Create({ ...options, [exports.Kind]: "AsyncIterator", type: "AsyncIterator", items: TypeClone.Type(items) });+ }+ /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */+ Awaited(schema, options = {}) {+ const Unwrap = (rest) => rest.length > 0 ? (() => {+ const [L, ...R] = rest;+ return [this.Awaited(L), ...Unwrap(R)];+ })() : rest;+ return TypeGuard.TIntersect(schema) ? exports.Type.Intersect(Unwrap(schema.allOf)) : TypeGuard.TUnion(schema) ? exports.Type.Union(Unwrap(schema.anyOf)) : TypeGuard.TPromise(schema) ? this.Awaited(schema.item) : TypeClone.Type(schema, options);+ }+ /** `[JavaScript]` Creates a BigInt type */+ BigInt(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "BigInt", type: "bigint" });+ }+ /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */+ ConstructorParameters(schema, options = {}) {+ return this.Tuple([...schema.parameters], { ...options });+ }+ /** `[JavaScript]` Creates a Constructor type */+ Constructor(parameters, returns, options) {+ const [clonedParameters, clonedReturns] = [TypeClone.Rest(parameters), TypeClone.Type(returns)];+ return this.Create({ ...options, [exports.Kind]: "Constructor", type: "Constructor", parameters: clonedParameters, returns: clonedReturns });+ }+ /** `[JavaScript]` Creates a Date type */+ Date(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Date", type: "Date" });+ }+ /** `[JavaScript]` Creates a Function type */+ Function(parameters, returns, options) {+ const [clonedParameters, clonedReturns] = [TypeClone.Rest(parameters), TypeClone.Type(returns)];+ return this.Create({ ...options, [exports.Kind]: "Function", type: "Function", parameters: clonedParameters, returns: clonedReturns });+ }+ /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */+ InstanceType(schema, options = {}) {+ return TypeClone.Type(schema.returns, options);+ }+ /** `[JavaScript]` Creates an Iterator type */+ Iterator(items, options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Iterator", type: "Iterator", items: TypeClone.Type(items) });+ }+ /** `[JavaScript]` Extracts the Parameters from the given Function type */+ Parameters(schema, options = {}) {+ return this.Tuple(schema.parameters, { ...options });+ }+ /** `[JavaScript]` Creates a Promise type */+ Promise(item, options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Promise", type: "Promise", item: TypeClone.Type(item) });+ }+ /** `[Extended]` Creates a String type */+ RegExp(unresolved, options = {}) {+ const pattern = ValueGuard.IsString(unresolved) ? unresolved : unresolved.source;+ return this.Create({ ...options, [exports.Kind]: "String", type: "string", pattern });+ }+ /**+ * @deprecated Use `Type.RegExp`+ */+ RegEx(regex, options = {}) {+ return this.RegExp(regex, options);+ }+ /** `[JavaScript]` Extracts the ReturnType from the given Function type */+ ReturnType(schema, options = {}) {+ return TypeClone.Type(schema.returns, options);+ }+ /** `[JavaScript]` Creates a Symbol type */+ Symbol(options) {+ return this.Create({ ...options, [exports.Kind]: "Symbol", type: "symbol" });+ }+ /** `[JavaScript]` Creates a Undefined type */+ Undefined(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Undefined", type: "undefined" });+ }+ /** `[JavaScript]` Creates a Uint8Array type */+ Uint8Array(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Uint8Array", type: "Uint8Array" });+ }+ /** `[JavaScript]` Creates a Void type */+ Void(options = {}) {+ return this.Create({ ...options, [exports.Kind]: "Void", type: "void" });+ }+ };+ exports.JavaScriptTypeBuilder = JavaScriptTypeBuilder;+ exports.JsonType = new JsonTypeBuilder();+ exports.Type = new JavaScriptTypeBuilder();+ }+});++// src/settings.ts+var import_typebox = __toESM(require_typebox(), 1);+var pathPatternString = import_typebox.Type.String({+ // for legacy reasions locale can be specified as well+ pattern: ".*\\{languageTag|locale\\}.*\\.json$",+ examples: ["./messages/{locale}.json", "./i18n/{locale}.json"],+ title: "Path to language files",+ description: "Specify the pathPattern to locate resource files in your repository. It must include `{locale}` and end with `.json`."+});+var pathPatternArray = import_typebox.Type.Array(pathPatternString, {+ title: "Paths to language files",+ description: "Specify multiple pathPatterns to locate resource files in your repository. Each must include `{locale}` and end with `.json`."+});+var sort = import_typebox.Type.Optional(+ import_typebox.Type.Union([import_typebox.Type.Literal("asc"), import_typebox.Type.Literal("desc")], {+ title: "Sort keys",+ description: "Sort message keys when writing files."+ })+);+var PluginSettings = import_typebox.Type.Object({+ pathPattern: import_typebox.Type.Union([pathPatternString, pathPatternArray]),+ sort+});++// src/v2/parsing/serializePattern.ts+var serializedPattern = (pattern) => {+ return pattern.map((node) => {+ switch (node.type) {+ case "Text":+ return node.value;+ case "VariableReference":+ return `{${node.name}}`;+ }+ }).join("");+};++// src/v2/parsing/serializeMessage.ts+var serializeMessage = (message) => {+ const result = {};+ for (const variant of message.variants) {+ if (result[variant.languageTag] !== void 0) {+ throw new Error(+ `The message "${message.id}" has multiple variants for the language tag "${variant.languageTag}". The inlang-message-format plugin does not support multiple variants for the same language tag at the moment.`+ );+ }+ result[variant.languageTag] = serializedPattern(variant.pattern);+ }+ return result;+};++// src/v2/parsing/parsePattern.ts+var parsePattern = (pattern) => {+ const regex = /\{([^}]+)\}/g;+ let match;+ let lastIndex = 0;+ const result = [];+ while ((match = regex.exec(pattern)) !== null) {+ const name = match[1];+ const textBefore = pattern.slice(lastIndex, match.index);+ if (textBefore.length > 0) {+ result.push({ type: "Text", value: textBefore });+ }+ result.push({ type: "VariableReference", name });+ lastIndex = match.index + match[0].length;+ }+ const textAfter = pattern.slice(Math.max(0, lastIndex));+ if (textAfter.length > 0) {+ result.push({ type: "Text", value: textAfter });+ }+ return result;+};++// src/v2/parsing/parseMessage.ts+var parseMessage = (args) => {+ return {+ id: args.key,+ alias: {},+ selectors: [],+ variants: [+ {+ languageTag: args.languageTag,+ match: [],+ pattern: parsePattern(args.value)+ }+ ]+ };+};++// src/v2/plugin.ts+var pluginId = "plugin.inlang.messageFormat";+var plugin = {+ id: pluginId,+ displayName: "Inlang Message Format",+ description: "A plugin for the inlang SDK that uses a JSON file per language tag to store translations.",+ key: "inlang-message-format",+ settingsSchema: PluginSettings,+ loadMessages: async ({ settings, nodeishFs }) => {+ await maybeMigrateToV2({ settings, nodeishFs });+ const result = {};+ for (const tag of settings.languageTags) {+ try {+ const file = await nodeishFs.readFile(+ settings["plugin.inlang.messageFormat"].pathPattern.replace(+ "{languageTag}",+ tag+ ),+ {+ encoding: "utf-8"+ }+ );+ const json = JSON.parse(file);+ for (const key in json) {+ if (key === "$schema") {+ continue;+ } else if (result[key]) {+ result[key].variants = [+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion+ ...result[key].variants,+ ...parseMessage({ key, value: json[key], languageTag: tag }).variants+ ];+ } else {+ result[key] = parseMessage({+ key,+ value: json[key],+ languageTag: tag+ });+ }+ }+ } catch (error) {+ if (error?.code !== "ENOENT") {+ throw error;+ }+ }+ }+ return Object.values(result);+ },+ saveMessages: async ({ settings, nodeishFs, messages }) => {+ const result = {};+ for (const message of messages) {+ const serialized = serializeMessage(message);+ for (const [languageTag, value] of Object.entries(serialized)) {+ if (result[languageTag] === void 0) {+ result[languageTag] = {};+ }+ result[languageTag][message.id] = value;+ }+ }+ for (const [languageTag, messages2] of Object.entries(result)) {+ const path = settings["plugin.inlang.messageFormat"].pathPattern.replace(+ "{languageTag}",+ languageTag+ );+ await createDirectoryIfNotExits({ path, nodeishFs });+ await nodeishFs.writeFile(+ settings["plugin.inlang.messageFormat"].pathPattern.replace(+ "{languageTag}",+ languageTag+ ),+ // default to tab indentation+ // PS sorry for anyone who reads this code+ ((data) => JSON.stringify(data, void 0, " "))({+ $schema: "https://inlang.com/schema/inlang-message-format",+ ...messages2+ })+ );+ }+ }+};+var createDirectoryIfNotExits = async (args) => {+ try {+ await args.nodeishFs.mkdir(dirname(args.path), { recursive: true });+ } catch {+ }+};+function dirname(path) {+ if (path.length === 0) return ".";+ let code = path.charCodeAt(0);+ const hasRoot = code === 47;+ let end = -1;+ let matchedSlash = true;+ for (let i = path.length - 1; i >= 1; --i) {+ code = path.charCodeAt(i);+ if (code === 47) {+ if (!matchedSlash) {+ end = i;+ break;+ }+ } else {+ matchedSlash = false;+ }+ }+ if (end === -1) return hasRoot ? "/" : ".";+ if (hasRoot && end === 1) return "//";+ return path.slice(0, end);+}+var maybeMigrateToV2 = async (args) => {+ if (args.settings["plugin.inlang.messageFormat"].filePath == void 0) {+ return;+ }+ try {+ const file = await args.nodeishFs.readFile(+ args.settings["plugin.inlang.messageFormat"].filePath,+ {+ encoding: "utf-8"+ }+ );+ await plugin.saveMessages?.({+ messages: JSON.parse(file)["data"],+ nodeishFs: args.nodeishFs,+ settings: args.settings+ });+ console.log(+ "Migration to v2 of the inlang-message-format plugin was successful. Please delete the old messages.json file and the filePath property in the settings file of the project."+ );+ } catch {+ }+};++// src/import-export/toBeImportedFiles.ts+var toBeImportedFiles = async ({ settings }) => {+ const result = [];+ const pathPatterns = settings[PLUGIN_KEY]?.pathPattern ? Array.isArray(settings[PLUGIN_KEY].pathPattern) ? settings[PLUGIN_KEY].pathPattern : [settings[PLUGIN_KEY].pathPattern] : [];+ for (const pathPattern of pathPatterns) {+ for (const locale of settings.locales) {+ result.push({+ locale,+ path: pathPattern.replace(/{(locale|languageTag)}/, locale)+ });+ }+ }+ return result;+};++// ../../../node_modules/.pnpm/[email protected]/node_modules/flat/index.js+function isBuffer(obj) {+ return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);+}+function keyIdentity(key) {+ return key;+}+function flatten(target, opts) {+ opts = opts || {};+ const delimiter = opts.delimiter || ".";+ const maxDepth = opts.maxDepth;+ const transformKey = opts.transformKey || keyIdentity;+ const output = {};+ function step(object, prev, currentDepth) {+ currentDepth = currentDepth || 1;+ Object.keys(object).forEach(function(key) {+ const value = object[key];+ const isarray = opts.safe && Array.isArray(value);+ const type = Object.prototype.toString.call(value);+ const isbuffer = isBuffer(value);+ const isobject = type === "[object Object]" || type === "[object Array]";+ const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);+ if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {+ return step(value, newKey, currentDepth + 1);+ }+ output[newKey] = value;+ });+ }+ step(target);+ return output;+}+function unflatten(target, opts) {+ opts = opts || {};+ const delimiter = opts.delimiter || ".";+ const overwrite = opts.overwrite || false;+ const transformKey = opts.transformKey || keyIdentity;+ const result = {};+ const isbuffer = isBuffer(target);+ if (isbuffer || Object.prototype.toString.call(target) !== "[object Object]") {+ return target;+ }+ function getkey(key) {+ const parsedKey = Number(key);+ return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;+ }+ function addKeys(keyPrefix, recipient, target2) {+ return Object.keys(target2).reduce(function(result2, key) {+ result2[keyPrefix + delimiter + key] = target2[key];+ return result2;+ }, recipient);+ }+ function isEmpty(val) {+ const type = Object.prototype.toString.call(val);+ const isArray = type === "[object Array]";+ const isObject = type === "[object Object]";+ if (!val) {+ return true;+ } else if (isArray) {+ return !val.length;+ } else if (isObject) {+ return !Object.keys(val).length;+ }+ }+ target = Object.keys(target).reduce(function(result2, key) {+ const type = Object.prototype.toString.call(target[key]);+ const isObject = type === "[object Object]" || type === "[object Array]";+ if (!isObject || isEmpty(target[key])) {+ result2[key] = target[key];+ return result2;+ } else {+ return addKeys(+ key,+ result2,+ flatten(target[key], opts)+ );+ }+ }, {});+ Object.keys(target).forEach(function(key) {+ const split = key.split(delimiter).map(transformKey);+ let key1 = getkey(split.shift());+ let key2 = getkey(split[0]);+ let recipient = result;+ while (key2 !== void 0) {+ if (key1 === "__proto__") {+ return;+ }+ const type = Object.prototype.toString.call(recipient[key1]);+ const isobject = type === "[object Object]" || type === "[object Array]";+ if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") {+ return;+ }+ if (overwrite && !isobject || !overwrite && recipient[key1] == null) {+ recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};+ }+ recipient = recipient[key1];+ if (split.length > 0) {+ key1 = getkey(split.shift());+ key2 = getkey(split[0]);+ }+ }+ recipient[key1] = unflatten(target[key], opts);+ });+ return result;+}++// src/import-export/importFiles.ts+var importFiles = async ({+ files+}) => {+ const bundles = [];+ const messages = [];+ const variants = [];+ for (const file of files) {+ const json = JSON.parse(new TextDecoder().decode(file.content));+ const flattened = flatten(json, { safe: true });+ for (const key in flattened) {+ if (key === "$schema") {+ continue;+ }+ const result = parseBundle(key, file.locale, flattened[key]);+ messages.push(result.message);+ variants.push(...result.variants);+ const existingBundle = bundles.find((b) => b.id === result.bundle.id);+ if (existingBundle === void 0) {+ bundles.push(result.bundle);+ } else {+ existingBundle.declarations = unique([+ ...existingBundle.declarations,+ ...result.bundle.declarations+ ]);+ }+ }+ }+ return { bundles, messages, variants };+};+function parseBundle(key, locale, value) {+ const parsed = parseVariants(key, locale, value);+ const declarations = unique(parsed.declarations);+ const selectors = unique(parsed.selectors);+ const undeclaredSelectors = selectors.filter(+ (selector) => declarations.find((d) => d.name === selector.name) === void 0+ );+ for (const undeclaredSelector of undeclaredSelectors) {+ declarations.push({+ type: "input-variable",+ name: undeclaredSelector.name+ });+ }+ return {+ bundle: {+ id: key,+ declarations+ },+ message: {+ bundleId: key,+ selectors,+ locale+ },+ variants: parsed.variants+ };+}+function parseVariants(bundleId, locale, value) {+ if (typeof value === "string") {+ const parsed = parsePattern2(value);+ return {+ variants: [+ {+ messageBundleId: bundleId,+ messageLocale: locale,+ matches: [],+ pattern: parsed.pattern+ }+ ],+ // legacy reasons that input variables are derived from the pattern+ declarations: parsed.declarations,+ selectors: []+ };+ }+ const complexMessage = value[0];+ const variants = [];+ const selectors = (complexMessage["selectors"] ?? []).map((name) => ({+ type: "variable-reference",+ name+ }));+ const declarations = /* @__PURE__ */ new Set();+ for (const declaration of complexMessage["declarations"] ?? []) {+ declarations.add(parseDeclaration(declaration));+ }+ const detectedSelectors = /* @__PURE__ */ new Set();+ for (const [match, pattern] of Object.entries(complexMessage["match"])) {+ const parsed = parsePattern2(pattern);+ const parsedMatches = parseMatches(match);+ for (const declaration of parsed.declarations) {+ let isDuplicate = false;+ for (const existingDeclaration of declarations) {+ if (existingDeclaration.name === declaration.name) {+ isDuplicate = true;+ break;+ }+ }+ if (isDuplicate) {+ break;+ }+ declarations.add(declaration);+ }+ for (const selector of parsedMatches.selectors) {+ detectedSelectors.add(selector);+ }+ variants.push({+ messageBundleId: bundleId,+ messageLocale: locale,+ matches: parsedMatches.matches,+ pattern: parsed.pattern+ });+ }+ return {+ variants,+ declarations: Array.from(declarations),+ selectors: unique([...selectors, ...Array.from(detectedSelectors)])+ };+}+function parsePattern2(value) {+ const pattern = [];+ const declarations = [];+ let buffer = "";+ const flushBuffer = () => {+ if (buffer.length > 0) {+ pattern.push({ type: "text", value: buffer });+ buffer = "";+ }+ };+ for (let index = 0; index < value.length; index += 1) {+ const char = value[index];+ if (char === "\\") {+ const next = value[index + 1];+ if (next === "{" || next === "}" || next === "\\") {+ buffer += next;+ index += 1;+ continue;+ }+ buffer += char;+ continue;+ }+ if (char === "{") {+ let variableName = "";+ let closingIndex = -1;+ for (let cursor = index + 1; cursor < value.length; cursor += 1) {+ const current = value[cursor];+ if (current === "}") {+ closingIndex = cursor;+ break;+ }+ variableName += current;+ }+ if (closingIndex === -1) {+ buffer += char;+ continue;+ }+ flushBuffer();+ declarations.push({+ type: "input-variable",+ name: variableName+ });+ pattern.push({+ type: "expression",+ arg: { type: "variable-reference", name: variableName }+ });+ index = closingIndex;+ continue;+ }+ buffer += char;+ }+ flushBuffer();+ return {+ declarations,+ pattern+ };+}+function parseMatches(value) {+ const stripped = value.replace(" ", "");+ const matches = [];+ const selectors = [];+ const parts = stripped.split(",");+ for (const part of parts) {+ const [key, value2] = part.split("=");+ if (!key || !value2) {+ continue;+ }+ if (value2 === "*") {+ matches.push({+ type: "catchall-match",+ key+ });+ } else {+ matches.push({+ type: "literal-match",+ key,+ value: value2+ });+ }+ selectors.push({+ type: "variable-reference",+ name: key+ });+ }+ return { matches, selectors };+}+var unique = (arr) => [...new Set(arr.map((item) => JSON.stringify(item)))].map(+ (item) => JSON.parse(item)+);+function parseDeclaration(value) {+ if (value.startsWith("input")) {+ return {+ type: "input-variable",+ name: value.slice(6).trim()+ };+ } else if (value.startsWith("local")) {+ const match = value.match(/local (\w+) = (\w+): (\w+)(.*)/);+ const [, name, ref, fn, optionsString] = match;+ const options = optionsString?.trim().split(/\s+/).map((pair) => {+ const [key, value2] = pair.split("=");+ return key && value2 ? {+ name: key,+ value: { type: "literal", value: value2 }+ } : null;+ }).filter(Boolean);+ return {+ type: "local-variable",+ name: name.trim(),+ value: {+ type: "expression",+ arg: {+ type: "variable-reference",+ name: ref.trim()+ },+ annotation: fn ? {+ type: "function-reference",+ name: fn.trim(),+ options: options ?? []+ } : void 0+ }+ };+ }+ throw new Error("Unsupported declaration type");+}++// src/utils/sortKeys.ts+var compare = (direction) => (a, b) => direction === "desc" ? b.localeCompare(a) : a.localeCompare(b);+var sortObjectKeys = (value, direction) => {+ if (Array.isArray(value)) {+ return value.map((entry) => sortObjectKeys(entry, direction));+ }+ if (value === null || typeof value !== "object") {+ return value;+ }+ const sorted = {};+ for (const [key, entry] of Object.entries(value).sort(+ (a, b) => compare(direction)(a[0], b[0])+ )) {+ sorted[key] = sortObjectKeys(entry, direction);+ }+ return sorted;+};+var sortMessageKeys = (value, direction) => {+ const sorted = {};+ for (const [key, entry] of Object.entries(value).sort(+ (a, b) => compare(direction)(a[0], b[0])+ )) {+ sorted[key] = sortObjectKeys(entry, direction);+ }+ return sorted;+};++// src/import-export/exportFiles.ts+var exportFiles = async ({+ bundles,+ messages,+ variants,+ settings+}) => {+ const files = {};+ for (const message of messages) {+ const bundle = bundles.find((b) => b.id === message.bundleId);+ const variantsOfMessage = [+ ...variants.reduce((r, v) => {+ if (v.messageId === message.id) r.set(JSON.stringify(v.matches), v);+ return r;+ }, /* @__PURE__ */ new Map()).values()+ ];+ files[message.locale] = {+ ...files[message.locale],+ ...serializeMessage2(bundle, message, variantsOfMessage)+ };+ }+ const result = [];+ for (const locale in files) {+ const sortDirection = settings?.["plugin.inlang.messageFormat"]?.sort ?? void 0;+ const unflattened = unflatten(files[locale]);+ const sortedMessages = sortDirection ? sortMessageKeys(unflattened, sortDirection) : unflattened;+ result.push({+ locale,+ // beautify the json+ content: new TextEncoder().encode(+ JSON.stringify(+ {+ // increase DX by providing auto complete in IDEs+ $schema: "https://inlang.com/schema/inlang-message-format",+ ...sortedMessages+ },+ void 0,+ " "+ )+ ),+ name: locale + ".json"+ });+ }+ return result;+};+function serializeMessage2(bundle, message, variants) {+ const key = message.bundleId;+ const value = serializeVariants(bundle, message, variants);+ return { [key]: value };+}+function serializeVariants(bundle, message, variants) {+ if (variants.length === 1) {+ if (message.selectors.length === 0 && bundle.declarations.some((d) => d.type !== "input-variable") === false) {+ return serializePattern(variants[0].pattern);+ }+ }+ const entries = [];+ for (const variant of variants) {+ if (variant.matches.length === 0) {+ for (const part of variant.pattern) {+ if (part.type === "expression" && part.arg.type === "variable-reference") {+ variant.matches.push({ key: part.arg.name, type: "catchall-match" });+ }+ }+ }+ const pattern = serializePattern(variant.pattern);+ const match = serializeMatcher(variant.matches);+ entries.push([match, pattern]);+ }+ return [+ {+ // naively adding all declarations, even if unused in the variants+ // can be optimized later.+ declarations: bundle.declarations.sort((a, b) => a.name.localeCompare(b.name)).map(serializeDeclaration).sort(),+ selectors: message.selectors.map((s) => s.name).sort(),+ match: Object.fromEntries(entries)+ }+ ];+}+function serializePattern(pattern) {+ let result = "";+ for (const part of pattern) {+ if (part.type === "text") {+ result += escapePatternText(part.value);+ } else if (part.arg.type === "variable-reference") {+ result += `{${part.arg.name}}`;+ } else {+ throw new Error("Unsupported expression type");+ }+ }+ return result;+}+function escapePatternText(value) {+ return value.replace(/\\/g, "\\\\").replace(/{/g, "\\{").replace(/}/g, "\\}");+}+function serializeMatcher(matches) {+ const parts = matches.sort((a, b) => a.key.localeCompare(b.key)).map(+ (match) => match.type === "literal-match" ? `${match.key}=${match.value}` : `${match.key}=*`+ );+ return parts.join(", ");+}+function serializeDeclaration(declaration) {+ if (declaration.type === "input-variable") {+ return `input ${declaration.name}`;+ } else if (declaration.type === "local-variable") {+ let result = "";+ if (declaration.value.arg.type === "variable-reference") {+ result = `local ${declaration.name} = ${declaration.value.arg.name}`;+ } else if (declaration.value.arg.type === "literal") {+ result = `local ${declaration.name} = "${declaration.value.arg.value}"`;+ }+ if (declaration.value.annotation) {+ result += `: ${declaration.value.annotation.name}`;+ }+ if (declaration.value.annotation?.options) {+ for (const option of declaration.value?.annotation?.options ?? []) {+ if (option.value.type !== "literal") {+ throw new Error("Unsupported option type");+ }+ result += ` ${option.name}=${option.value.value}`;+ }+ }+ return result;+ }+ throw new Error("Unsupported declaration type");+}++// src/plugin.ts+var PLUGIN_KEY = "plugin.inlang.messageFormat";+var plugin2 = {+ key: PLUGIN_KEY,+ // legacy v2 stuff for backwards compatibility+ // given that most people don't have a major version+ // pinning in their settings+ id: plugin.id,+ // @ts-expect-error - displayName is not in the v2 plugin+ displayName: plugin.displayName,+ // @ts-expect-error - description is not in the v2 plugin+ description: plugin.description,+ loadMessages: plugin.loadMessages,+ saveMessages: plugin.saveMessages,+ settingsSchema: PluginSettings,+ toBeImportedFiles,+ importFiles,+ exportFiles+};++// src/index.ts+var index_default = plugin2;+export {+ index_default as default+};diff --git a/frontend/project.inlang/cache/plugins/ygx0uiahq6uw b/frontend/project.inlang/cache/plugins/ygx0uiahq6uwnew file mode 100644index 000000000..3df4ca4e5--- /dev/null+++ b/frontend/project.inlang/cache/plugins/ygx0uiahq6uw@@ -0,0 +1,26 @@+var Kt=Object.create;var Pt=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var nn=(p,c)=>()=>(c||p((c={exports:{}}).exports,c),c.exports);var en=(p,c,s,r)=>{if(c&&typeof c=="object"||typeof c=="function")for(let i of Xt(c))!tn.call(p,i)&&i!==s&&Pt(p,i,{get:()=>c[i],enumerable:!(r=Ht(c,i))||r.enumerable});return p};var rn=(p,c,s)=>(s=p!=null?Kt(Yt(p)):{},en(c||!p||!p.__esModule?Pt(s,"default",{value:p,enumerable:!0}):s,p));var It=nn((G,gt)=>{(function(p,c){typeof G=="object"&&typeof gt=="object"?gt.exports=c():typeof define=="function"&&define.amd?define([],c):typeof G=="object"?G.Parsimmon=c():p.Parsimmon=c()})(typeof self<"u"?self:G,function(){return function(p){var c={};function s(r){if(c[r])return c[r].exports;var i=c[r]={i:r,l:!1,exports:{}};return p[r].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=p,s.c=c,s.d=function(r,i,d){s.o(r,i)||Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:d})},s.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},s.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return s.d(i,"a",i),i},s.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},s.p="",s(s.s=0)}([function(p,c,s){"use strict";function r(t){if(!(this instanceof r))return new r(t);this._=t}var i=r.prototype;function d(t,n){for(var e=0;e<t;e++)n(e)}function b(t,n,e){return function(u,o){d(o.length,function(a){u(o[a],a,o)})}(function(u,o,a){n=t(n,u,o,a)},e),n}function S(t,n){return b(function(e,u,o,a){return e.concat([t(u,o,a)])},[],n)}function dt(t,n){var e={v:0,buf:n};return d(t,function(){var u;e={v:e.v<<1|(u=e.buf,u[0]>>7),buf:function(o){var a=b(function(f,l,h,x){return f.concat(h===x.length-1?Buffer.from([l,0]).readUInt16BE(0):x.readUInt16BE(h))},[],o);return Buffer.from(S(function(f){return(f<<1&65535)>>8},a))}(e.buf)}}),e}function ht(){return typeof Buffer<"u"}function J(){if(!ht())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function mt(t){J();var n=b(function(a,f){return a+f},0,t);if(n%8!=0)throw new Error("The bits ["+t.join(", ")+"] add up to "+n+" which is not an even number of bytes; the total should be divisible by 8");var e,u=n/8,o=(e=function(a){return a>48},b(function(a,f){return a||(e(f)?f:a)},null,t));if(o)throw new Error(o+" bit range requested exceeds 48 bit (6 byte) Number max.");return new r(function(a,f){var l=u+f;return l>a.length?w(f,u.toString()+" bytes"):m(l,b(function(h,x){var y=dt(x,h.buf);return{coll:h.coll.concat(y.v),buf:y.buf}},{coll:[],buf:a.slice(f,l)},t).coll)})}function _(t,n){return new r(function(e,u){return J(),u+n>e.length?w(u,n+" bytes for "+t):m(u+n,e.slice(u,u+n))})}function Z(t,n){if(typeof(e=n)!="number"||Math.floor(e)!==e||n<0||n>6)throw new Error(t+" requires integer length in range [0, 6].");var e}function K(t){return Z("uintBE",t),_("uintBE("+t+")",t).map(function(n){return n.readUIntBE(0,t)})}function H(t){return Z("uintLE",t),_("uintLE("+t+")",t).map(function(n){return n.readUIntLE(0,t)})}function X(t){return Z("intBE",t),_("intBE("+t+")",t).map(function(n){return n.readIntBE(0,t)})}function Y(t){return Z("intLE",t),_("intLE("+t+")",t).map(function(n){return n.readIntLE(0,t)})}function U(t){return t instanceof r}function A(t){return{}.toString.call(t)==="[object Array]"}function W(t){return ht()&&Buffer.isBuffer(t)}function m(t,n){return{status:!0,index:t,value:n,furthest:-1,expected:[]}}function w(t,n){return A(n)||(n=[n]),{status:!1,index:-1,value:null,furthest:t,expected:n}}function B(t,n){if(!n||t.furthest>n.furthest)return t;var e=t.furthest===n.furthest?function(u,o){if(function(){if(r._supportsSet!==void 0)return r._supportsSet;var O=typeof Set<"u";return r._supportsSet=O,O}()&&Array.from){for(var a=new Set(u),f=0;f<o.length;f++)a.add(o[f]);var l=Array.from(a);return l.sort(),l}for(var h={},x=0;x<u.length;x++)h[u[x]]=!0;for(var y=0;y<o.length;y++)h[o[y]]=!0;var L=[];for(var E in h)({}).hasOwnProperty.call(h,E)&&L.push(E);return L.sort(),L}(t.expected,n.expected):n.expected;return{status:t.status,index:t.index,value:t.value,furthest:n.furthest,expected:e}}var tt={};function vt(t,n){if(W(t))return{offset:n,line:-1,column:-1};t in tt||(tt[t]={});for(var e=tt[t],u=0,o=0,a=0,f=n;f>=0;){if(f in e){u=e[f].line,a===0&&(a=e[f].lineStart);break}(t.charAt(f)===`+`||t.charAt(f)==="\r"&&t.charAt(f+1)!==`+`)&&(o++,a===0&&(a=f+1)),f--}var l=u+o,h=n-a;return e[n]={line:l,lineStart:a},{offset:n,line:l+1,column:h+1}}function Q(t){if(!U(t))throw new Error("not a parser: "+t)}function nt(t,n){return typeof t=="string"?t.charAt(n):t[n]}function F(t){if(typeof t!="number")throw new Error("not a number: "+t)}function I(t){if(typeof t!="function")throw new Error("not a function: "+t)}function T(t){if(typeof t!="string")throw new Error("not a string: "+t)}var Qt=2,Ft=3,P=8,Nt=5*P,zt=4*P,yt=" ";function et(t,n){return new Array(n+1).join(t)}function rt(t,n,e){var u=n-t.length;return u<=0?t:et(e,u)+t}function bt(t,n,e,u){return{from:t-n>0?t-n:0,to:t+e>u?u:t+e}}function Rt(t,n){var e,u,o,a,f,l=n.index,h=l.offset,x=1;if(h===t.length)return"Got the end of the input";if(W(t)){var y=h-h%P,L=h-y,E=bt(y,Nt,zt+P,t.length),O=S(function(v){return S(function(z){return rt(z.toString(16),2,"0")},v)},function(v,z){var R=v.length,q=[],C=0;if(R<=z)return[v.slice()];for(var D=0;D<R;D++)q[C]||q.push([]),q[C].push(v[D]),(D+1)%z==0&&C++;return q}(t.slice(E.from,E.to).toJSON().data,P));a=function(v){return v.from===0&&v.to===1?{from:v.from,to:v.to}:{from:v.from/P,to:Math.floor(v.to/P)}}(E),u=y/P,e=3*L,L>=4&&(e+=1),x=2,o=S(function(v){return v.length<=4?v.join(" "):v.slice(0,4).join(" ")+" "+v.slice(4).join(" ")},O),(f=(8*(a.to>0?a.to-1:a.to)).toString(16).length)<2&&(f=2)}else{var N=t.split(/\r\n|[\n\r\u2028\u2029]/);e=l.column-1,u=l.line-1,a=bt(u,Qt,Ft,N.length),o=N.slice(a.from,a.to),f=a.to.toString().length}var Zt=u-a.from;return W(t)&&(f=(8*(a.to>0?a.to-1:a.to)).toString(16).length)<2&&(f=2),b(function(v,z,R){var q,C=R===Zt,D=C?"> ":yt;return q=W(t)?rt((8*(a.from+R)).toString(16),f,"0"):rt((a.from+R+1).toString(),f," "),[].concat(v,[D+q+" | "+z],C?[yt+et(" ",f)+" | "+rt("",e," ")+et("^",x)]:[])},[],o).join(`+`)}function xt(t,n){return[`+`,"-- PARSING FAILED "+et("-",50),`++`,Rt(t,n),`++`,(e=n.expected,e.length===1?`Expected:++`+e[0]:`Expected one of the following:++`+e.join(", ")),`+`].join("");var e}function wt(t){return t.flags!==void 0?t.flags:[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.unicode?"u":"",t.sticky?"y":""].join("")}function ut(){for(var t=[].slice.call(arguments),n=t.length,e=0;e<n;e+=1)Q(t[e]);return r(function(u,o){for(var a,f=new Array(n),l=0;l<n;l+=1){if(!(a=B(t[l]._(u,o),a)).status)return a;f[l]=a.value,o=a.index}return B(m(o,f),a)})}function k(){var t=[].slice.call(arguments);if(t.length===0)throw new Error("seqMap needs at least one argument");var n=t.pop();return I(n),ut.apply(null,t).map(function(e){return n.apply(null,e)})}function it(){var t=[].slice.call(arguments),n=t.length;if(n===0)return ot("zero alternates");for(var e=0;e<n;e+=1)Q(t[e]);return r(function(u,o){for(var a,f=0;f<t.length;f+=1)if((a=B(t[f]._(u,o),a)).status)return a;return a})}function Et(t,n){return st(t,n).or(M([]))}function st(t,n){return Q(t),Q(n),k(t,n.then(t).many(),function(e,u){return[e].concat(u)})}function V(t){T(t);var n="'"+t+"'";return r(function(e,u){var o=u+t.length,a=e.slice(u,o);return a===t?m(o,a):w(u,n)})}function j(t,n){(function(o){if(!(o instanceof RegExp))throw new Error("not a regexp: "+o);for(var a=wt(o),f=0;f<a.length;f++){var l=a.charAt(f);if(l!=="i"&&l!=="m"&&l!=="u"&&l!=="s")throw new Error('unsupported regexp flag "'+l+'": '+o)}})(t),arguments.length>=2?F(n):n=0;var e=function(o){return RegExp("^(?:"+o.source+")",wt(o))}(t),u=""+t;return r(function(o,a){var f=e.exec(o.slice(a));if(f){if(0<=n&&n<=f.length){var l=f[0],h=f[n];return m(a+l.length,h)}return w(a,"valid match group (0 to "+f.length+") in "+u)}return w(a,u)})}function M(t){return r(function(n,e){return m(e,t)})}function ot(t){return r(function(n,e){return w(e,t)})}function at(t){if(U(t))return r(function(n,e){var u=t._(n,e);return u.index=e,u.value="",u});if(typeof t=="string")return at(V(t));if(t instanceof RegExp)return at(j(t));throw new Error("not a string, regexp, or parser: "+t)}function Bt(t){return Q(t),r(function(n,e){var u=t._(n,e),o=n.slice(e,u.index);return u.status?w(e,'not "'+o+'"'):m(e,null)})}function ft(t){return I(t),r(function(n,e){var u=nt(n,e);return e<n.length&&t(u)?m(e+1,u):w(e,"a character/byte matching "+t)})}function St(t,n){arguments.length<2&&(n=t,t=void 0);var e=r(function(u,o){return e._=n()._,e._(u,o)});return t?e.desc(t):e}function lt(){return ot("fantasy-land/empty")}i.parse=function(t){if(typeof t!="string"&&!W(t))throw new Error(".parse must be called with a string or Buffer as its argument");var n,e=this.skip(pt)._(t,0);return n=e.status?{status:!0,value:e.value}:{status:!1,index:vt(t,e.furthest),expected:e.expected},delete tt[t],n},i.tryParse=function(t){var n=this.parse(t);if(n.status)return n.value;var e=xt(t,n),u=new Error(e);throw u.type="ParsimmonError",u.result=n,u},i.assert=function(t,n){return this.chain(function(e){return t(e)?M(e):ot(n)})},i.or=function(t){return it(this,t)},i.trim=function(t){return this.wrap(t,t)},i.wrap=function(t,n){return k(t,this,n,function(e,u){return u})},i.thru=function(t){return t(this)},i.then=function(t){return Q(t),ut(this,t).map(function(n){return n[1]})},i.many=function(){var t=this;return r(function(n,e){for(var u=[],o=void 0;;){if(!(o=B(t._(n,e),o)).status)return B(m(e,u),o);if(e===o.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");e=o.index,u.push(o.value)}})},i.tieWith=function(t){return T(t),this.map(function(n){if(function(o){if(!A(o))throw new Error("not an array: "+o)}(n),n.length){T(n[0]);for(var e=n[0],u=1;u<n.length;u++)T(n[u]),e+=t+n[u];return e}return""})},i.tie=function(){return this.tieWith("")},i.times=function(t,n){var e=this;return arguments.length<2&&(n=t),F(t),F(n),r(function(u,o){for(var a=[],f=void 0,l=void 0,h=0;h<t;h+=1){if(l=B(f=e._(u,o),l),!f.status)return l;o=f.index,a.push(f.value)}for(;h<n&&(l=B(f=e._(u,o),l),f.status);h+=1)o=f.index,a.push(f.value);return B(m(o,a),l)})},i.result=function(t){return this.map(function(){return t})},i.atMost=function(t){return this.times(0,t)},i.atLeast=function(t){return k(this.times(t),this.many(),function(n,e){return n.concat(e)})},i.map=function(t){I(t);var n=this;return r(function(e,u){var o=n._(e,u);return o.status?B(m(o.index,t(o.value)),o):o})},i.contramap=function(t){I(t);var n=this;return r(function(e,u){var o=n.parse(t(e.slice(u)));return o.status?m(u+e.length,o.value):o})},i.promap=function(t,n){return I(t),I(n),this.contramap(t).map(n)},i.skip=function(t){return ut(this,t).map(function(n){return n[0]})},i.mark=function(){return k($,this,$,function(t,n,e){return{start:t,value:n,end:e}})},i.node=function(t){return k($,this,$,function(n,e,u){return{name:t,value:e,start:n,end:u}})},i.sepBy=function(t){return Et(this,t)},i.sepBy1=function(t){return st(this,t)},i.lookahead=function(t){return this.skip(at(t))},i.notFollowedBy=function(t){return this.skip(Bt(t))},i.desc=function(t){A(t)||(t=[t]);var n=this;return r(function(e,u){var o=n._(e,u);return o.status||(o.expected=t),o})},i.fallback=function(t){return this.or(M(t))},i.ap=function(t){return k(t,this,function(n,e){return n(e)})},i.chain=function(t){var n=this;return r(function(e,u){var o=n._(e,u);return o.status?B(t(o.value)._(e,o.index),o):o})},i.concat=i.or,i.empty=lt,i.of=M,i["fantasy-land/ap"]=i.ap,i["fantasy-land/chain"]=i.chain,i["fantasy-land/concat"]=i.concat,i["fantasy-land/empty"]=i.empty,i["fantasy-land/of"]=i.of,i["fantasy-land/map"]=i.map;var $=r(function(t,n){return m(n,vt(t,n))}),Ct=r(function(t,n){return n>=t.length?w(n,"any character/byte"):m(n+1,nt(t,n))}),Dt=r(function(t,n){return m(t.length,t.slice(n))}),pt=r(function(t,n){return n<t.length?w(n,"EOF"):m(n,null)}),Ut=j(/[0-9]/).desc("a digit"),Wt=j(/[0-9]*/).desc("optional digits"),Tt=j(/[a-z]/i).desc("a letter"),Vt=j(/[a-z]*/i).desc("optional letters"),$t=j(/\s*/).desc("optional whitespace"),Gt=j(/\s+/).desc("whitespace"),_t=V("\r"),jt=V(`+`),Lt=V(`\r+`),Ot=it(Lt,jt,_t).desc("newline"),Jt=it(Ot,pt);r.all=Dt,r.alt=it,r.any=Ct,r.cr=_t,r.createLanguage=function(t){var n={};for(var e in t)({}).hasOwnProperty.call(t,e)&&function(u){n[u]=St(function(){return t[u](n)})}(e);return n},r.crlf=Lt,r.custom=function(t){return r(t(m,w))},r.digit=Ut,r.digits=Wt,r.empty=lt,r.end=Jt,r.eof=pt,r.fail=ot,r.formatError=xt,r.index=$,r.isParser=U,r.lazy=St,r.letter=Tt,r.letters=Vt,r.lf=jt,r.lookahead=at,r.makeFailure=w,r.makeSuccess=m,r.newline=Ot,r.noneOf=function(t){return ft(function(n){return t.indexOf(n)<0}).desc("none of '"+t+"'")},r.notFollowedBy=Bt,r.of=M,r.oneOf=function(t){for(var n=t.split(""),e=0;e<n.length;e++)n[e]="'"+n[e]+"'";return ft(function(u){return t.indexOf(u)>=0}).desc(n)},r.optWhitespace=$t,r.Parser=r,r.range=function(t,n){return ft(function(e){return t<=e&&e<=n}).desc(t+"-"+n)},r.regex=j,r.regexp=j,r.sepBy=Et,r.sepBy1=st,r.seq=ut,r.seqMap=k,r.seqObj=function(){for(var t,n={},e=0,u=(t=arguments,Array.prototype.slice.call(t)),o=u.length,a=0;a<o;a+=1){var f=u[a];if(!U(f)){if(A(f)&&f.length===2&&typeof f[0]=="string"&&U(f[1])){var l=f[0];if(Object.prototype.hasOwnProperty.call(n,l))throw new Error("seqObj: duplicate key "+l);n[l]=!0,e++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(e===0)throw new Error("seqObj expects at least one named parser, found zero");return r(function(h,x){for(var y,L={},E=0;E<o;E+=1){var O,N;if(A(u[E])?(O=u[E][0],N=u[E][1]):(O=null,N=u[E]),!(y=B(N._(h,x),y)).status)return y;O&&(L[O]=y.value),x=y.index}return B(m(x,L),y)})},r.string=V,r.succeed=M,r.takeWhile=function(t){return I(t),r(function(n,e){for(var u=e;u<n.length&&t(nt(n,u));)u++;return m(u,n.slice(e,u))})},r.test=ft,r.whitespace=Gt,r["fantasy-land/empty"]=lt,r["fantasy-land/of"]=M,r.Binary={bitSeq:mt,bitSeqObj:function(t){J();var n={},e=0,u=S(function(a){if(A(a)){var f=a;if(f.length!==2)throw new Error("["+f.join(", ")+"] should be length 2, got length "+f.length);if(T(f[0]),F(f[1]),Object.prototype.hasOwnProperty.call(n,f[0]))throw new Error("duplicate key in bitSeqObj: "+f[0]);return n[f[0]]=!0,e++,f}return F(a),[null,a]},t);if(e<1)throw new Error("bitSeqObj expects at least one named pair, got ["+t.join(", ")+"]");var o=S(function(a){return a[0]},u);return mt(S(function(a){return a[1]},u)).map(function(a){return b(function(f,l){return l[0]!==null&&(f[l[0]]=l[1]),f},{},S(function(f,l){return[f,a[l]]},o))})},byte:function(t){if(J(),F(t),t>255)throw new Error("Value specified to byte constructor ("+t+"=0x"+t.toString(16)+") is larger in value than a single byte.");var n=(t>15?"0x":"0x0")+t.toString(16);return r(function(e,u){var o=nt(e,u);return o===t?m(u+1,o):w(u,n)})},buffer:function(t){return _("buffer",t).map(function(n){return Buffer.from(n)})},encodedString:function(t,n){return _("string",n).map(function(e){return e.toString(t)})},uintBE:K,uint8BE:K(1),uint16BE:K(2),uint32BE:K(4),uintLE:H,uint8LE:H(1),uint16LE:H(2),uint32LE:H(4),intBE:X,int8BE:X(1),int16BE:X(2),int32BE:X(4),intLE:Y,int8LE:Y(1),int16LE:Y(2),int32LE:Y(4),floatBE:_("floatBE",4).map(function(t){return t.readFloatBE(0)}),floatLE:_("floatLE",4).map(function(t){return t.readFloatLE(0)}),doubleBE:_("doubleBE",8).map(function(t){return t.readDoubleBE(0)}),doubleLE:_("doubleLE",8).map(function(t){return t.readDoubleLE(0)})},p.exports=r}])})});var g=rn(It(),1),un=/import\s+(?:\*\s+as\s+m|\{\s*[^}]*\bm\b[^}]*\})/,on=p=>{let c="",s=0,r=p.length,i="code";for(;s<r;){let d=p[s],b=p[s+1];if(i==="code"){if(d==="/"&&b==="/"){i="singleLineComment",c+=" ",s+=2;continue}if(d==="/"&&b==="*"){i="multiLineComment",c+=" ",s+=2;continue}if(d==="'"){i="singleQuote",c+=" ",s+=1;continue}if(d==='"'){i="doubleQuote",c+=" ",s+=1;continue}if(d==="`"){i="template",c+=" ",s+=1;continue}c+=d,s+=1;continue}if(i==="singleLineComment"){d===`+`?(i="code",c+=`+`):c+=" ",s+=1;continue}if(i==="multiLineComment"){if(d==="*"&&b==="/"){i="code",c+=" ",s+=2;continue}c+=d===`+`?`+`:" ",s+=1;continue}if(i==="singleQuote"){if(d==="\\"&&s+1<r){c+=" ",s+=2;continue}if(d==="'"){i="code",c+=" ",s+=1;continue}c+=d===`+`?`+`:" ",s+=1;continue}if(i==="doubleQuote"){if(d==="\\"&&s+1<r){c+=" ",s+=2;continue}if(d==='"'){i="code",c+=" ",s+=1;continue}c+=d===`+`?`+`:" ",s+=1;continue}if(i==="template"){if(d==="\\"&&s+1<r){c+=" ",s+=2;continue}if(d==="`"){i="code",c+=" ",s+=1;continue}c+=d===`+`?`+`:" ",s+=1;continue}}return c},an=p=>g.default.createLanguage({entry:c=>g.default.alt(c.findMessage,g.default.any).many().map(s=>s.flatMap(r=>r)).map(s=>s.filter(r=>typeof r=="object").flat().filter(r=>r!==null)),findReference:function(c){return g.default.seq(g.default.regex(/(import \* as m)|(import { m })/),c.findMessage.many())},dotNotation:()=>g.default.seqMap(g.default.string("."),g.default.index,g.default.regex(/\w+/),g.default.index,(c,s,r,i)=>({messageId:r,start:s,end:i})),doubleQuote:()=>g.default.seqMap(g.default.string('"'),g.default.index,g.default.regex(/[\w.]+/),g.default.string('"'),(c,s,r)=>({messageId:r,start:s})),singleQuote:()=>g.default.seqMap(g.default.string("'"),g.default.index,g.default.regex(/[\w.]+/),g.default.string("'"),(c,s,r)=>({messageId:r,start:s})),bracketNotation:c=>g.default.seqMap(g.default.string("["),g.default.alt(c.doubleQuote,c.singleQuote),g.default.string("]"),g.default.index,(s,r,i,d)=>({messageId:r.messageId,start:r.start,end:d})),findMessage:c=>g.default.seqMap(g.default.index,g.default.regex(/.*?m/s),g.default.alt(c.dotNotation,c.bracketNotation).or(g.default.succeed(null)),g.default.regex(/\((?:[^()]|\([^()]*\))*\)/).or(g.default.succeed("")),(s,r,i,d)=>{let b=s.offset+r.length-1,S=b>0?p[b-1]??"":"";return!(b===0||!/[a-zA-Z0-9/]/.test(S))||i===null?null:{messageId:`${i.messageId}`,position:{start:{line:i.start.line,character:i.start.column},end:{line:i.end.line,character:i.end.column+d.length}}}})});function kt(p){try{let c=p?on(p):"";return!c||!un.test(c)?[]:an(p).entry.tryParse(p)}catch{return[]}}function ct(p){let c=p.trim().replace(/[^a-zA-Z0-9\s_.]/g,"").replace(/[\s.]+/g,"_");return/^[0-9]/.test(c)&&(c="_"+c),c}var Mt={messageReferenceMatchers:[async p=>kt(p.documentText)],extractMessageOptions:[{callback:p=>{let c=ct(p.bundleId);return{bundleId:c,messageReplacement:`{m.${c}()}`}}},{callback:p=>{let c=ct(p.bundleId);return{bundleId:c,messageReplacement:`m.${c}()`}}}],documentSelectors:[{language:"typescriptreact"},{language:"javascript"},{language:"typescript"},{language:"svelte"},{language:"astro"},{language:"vue"}]};var qt="plugin.inlang.mFunctionMatcher",At={id:qt,displayName:"Inlang M Function Matcher",description:"A plugin for the inlang SDK that uses a JSON file per language tag to store translations.",key:qt,meta:{"app.inlang.ideExtension":Mt}};var xn=At;export{xn as default};diff --git a/go.work.sum b/go.work.sumindex 236d3e922..1e6a56b8e 100644--- a/go.work.sum+++ b/go.work.sum@@ -56,6 +56,7 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0/go.mod h1:ZPpqegjbE99EPKsu3iUWV22A04wzGPcAY/ziSIQEEgs=github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 h1:Ron4zCA/yk6U7WOBXhTJcDpsUBG9npumK6xw2auFltQ=github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0/go.mod h1:cSgYe11MCNYunTnRXrKiR/tHc0eoKjICUuWpNZoVCOo=+github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=github.com/Microsoft/go-winio v0.4.21/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=@@ -125,13 +126,18 @@ github.com/aws/smithy-go v1.22.5 h1:P9ATCXPMb2mPjYBgueqJNCA5S9UfktsW0tTxi+a7eqw=github.com/aws/smithy-go v1.22.5/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=github.com/bitly/go-hostpool v0.1.0 h1:XKmsF6k5el6xHG3WPJ8U0Ku/ye7njX7W81Ng7O2ioR0=github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=+github.com/bits-and-blooms/bitset v1.24.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=github.com/bits-and-blooms/bitset v1.24.3 h1:Bte86SlO3lwPQqww+7BE9ZuUCKIjfqnG5jtEyqA9y9Y=github.com/bits-and-blooms/bitset v1.24.3/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=+github.com/bits-and-blooms/bitset v1.24.4/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=github.com/bwesterb/go-ristretto v1.2.3 h1:1w53tCkGhCQ5djbat3+MH0BAQ5Kfgbt56UZQ/JMzngw=github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=+github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=+github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=+github.com/charmbracelet/x/ansi v0.11.3/go.mod h1:yI7Zslym9tCJcedxz5+WBq+eUGMJT0bM06Fqy1/Y4dI=github.com/checkpoint-restore/checkpointctl v1.4.0 h1:3kRns56TArwiyHOMakaumUgSZZlB1hZBkjVgR6IeZ3E=github.com/checkpoint-restore/checkpointctl v1.4.0/go.mod h1:ynQ52zQBazgcTZuxpwTFzRinIcAf0haDTC1X1LA/FKA=github.com/checkpoint-restore/go-criu/v7 v7.2.0 h1:qGiWA4App1gGlEfIJ68WR9jbezV9J7yZdjzglezcqKo=@@ -140,6 +146,9 @@ github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGIgithub.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=github.com/cilium/ebpf v0.16.0 h1:+BiEnHL6Z7lXnlGUsXQPPAE7+kenAd4ES8MQ5min0Ok=github.com/cilium/ebpf v0.16.0/go.mod h1:L7u2Blt2jMM/vLAVgjxluxtBKlz3/GWjB0dMOEngfwE=+github.com/clipperhouse/displaywidth v0.4.1 h1:uVw9V8UDfnggg3K2U84VWY1YLQ/x2aKSCtkRyYozfoU=+github.com/clipperhouse/displaywidth v0.4.1/go.mod h1:R+kHuzaYWFkTm7xoMmK1lFydbci4X2CicfbGstSGg0o=+github.com/clipperhouse/displaywidth v0.6.1/go.mod h1:R+kHuzaYWFkTm7xoMmK1lFydbci4X2CicfbGstSGg0o=github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk=github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=@@ -388,6 +397,7 @@ github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWgithub.com/markbates/pkger v0.15.1 h1:3MPelV53RnGSW07izx5xGxl4e/sdRD6zqseIk0rMASY=github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI=github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=+github.com/mattn/go-runewidth v0.0.17/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=@@ -459,6 +469,7 @@ github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA=github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo=github.com/proglottis/gpgme v0.1.5 h1:KCGyOw8sQ+SI96j6G8D8YkOGn+1TwbQTT9/zQXoVlz0=github.com/proglottis/gpgme v0.1.5/go.mod h1:5LoXMgpE4bttgwwdv9bLs/vwqv3qV7F4glEEZ7mRKrM=+github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79 h1:V7x0hCAgL8lNGezuex1RW1sh7VXXCqfw8nXZti66iFg=