@rynx-ai/server 0.1.11-beta.4 → 0.1.11-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control-api.d.ts +17 -4
- package/dist/control-api.js +722 -84
- package/dist/control-web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/control-web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/control-web/assets/abap-CLvhMVsD.js +1 -0
- package/dist/control-web/assets/abnfDiagram-VRR7QNED-D_NL89dn.js +1 -0
- package/dist/control-web/assets/actionscript-3--17pq3dv.js +1 -0
- package/dist/control-web/assets/ada-C5qYipkI.js +1 -0
- package/dist/control-web/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/control-web/assets/angular-html-DlZBZkSp.js +1 -0
- package/dist/control-web/assets/angular-ts-BVPGOT0K.js +1 -0
- package/dist/control-web/assets/apache-U0d_L8uA.js +1 -0
- package/dist/control-web/assets/apex-CGTLDQj6.js +1 -0
- package/dist/control-web/assets/apl-cDmXqmZ-.js +1 -0
- package/dist/control-web/assets/applescript-CCn79oCD.js +1 -0
- package/dist/control-web/assets/ara-4CJ0cIlV.js +1 -0
- package/dist/control-web/assets/arc-Pry-7G1_.js +1 -0
- package/dist/control-web/assets/architecture-TIHT7OUA-C9wU1KtW.js +1 -0
- package/dist/control-web/assets/architectureDiagram-ZJ3FMSHR-CV0rxVH6.js +36 -0
- package/dist/control-web/assets/array-BifhSqXX.js +1 -0
- package/dist/control-web/assets/asciidoc-DE70LPWp.js +1 -0
- package/dist/control-web/assets/asm-Cmm7eHzH.js +1 -0
- package/dist/control-web/assets/astro-B1Q6BwBx.js +1 -0
- package/dist/control-web/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/control-web/assets/awk-BWXHIvNe.js +1 -0
- package/dist/control-web/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/control-web/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/control-web/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/control-web/assets/ballerina-B7ZEbQpA.js +1 -0
- package/dist/control-web/assets/bat-Bo4NYOV-.js +1 -0
- package/dist/control-web/assets/beancount-D-usSTwE.js +1 -0
- package/dist/control-web/assets/berry-DKpUyyne.js +1 -0
- package/dist/control-web/assets/bibtex-Ci_nEsc7.js +1 -0
- package/dist/control-web/assets/bicep-CUHmPFLl.js +1 -0
- package/dist/control-web/assets/bird2-C2hNVINV.js +1 -0
- package/dist/control-web/assets/blade-Xpu-LGTm.js +1 -0
- package/dist/control-web/assets/blockDiagram-677ZJIJ3-Cc7nrkZh.js +132 -0
- package/dist/control-web/assets/bsl-BkkzgIyY.js +1 -0
- package/dist/control-web/assets/c-iCihek07.js +1 -0
- package/dist/control-web/assets/c3-CnJL0r0V.js +1 -0
- package/dist/control-web/assets/c4Diagram-LMCZKHZV-BPRU9m-F.js +10 -0
- package/dist/control-web/assets/cadence-CQ2zXKGN.js +1 -0
- package/dist/control-web/assets/cairo-DLTphjLi.js +1 -0
- package/dist/control-web/assets/catppuccin-frappe-3VR1Za6u.js +1 -0
- package/dist/control-web/assets/catppuccin-latte-DwIHMF0Q.js +1 -0
- package/dist/control-web/assets/catppuccin-macchiato-DYnBP6_5.js +1 -0
- package/dist/control-web/assets/catppuccin-mocha-DYhrFGRu.js +1 -0
- package/dist/control-web/assets/channel-BFm2_j8K.js +1 -0
- package/dist/control-web/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/control-web/assets/chunk-32BRIVSS-Bbq3O54m.js +1 -0
- package/dist/control-web/assets/chunk-52WLFC77-sD4al-Ob.js +10 -0
- package/dist/control-web/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/control-web/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
- package/dist/control-web/assets/chunk-C7G6YPKG-DqHaDS1O.js +1 -0
- package/dist/control-web/assets/chunk-EX3LRPZG-36GNQ5wp.js +231 -0
- package/dist/control-web/assets/chunk-HOUHSVGY-DeZ63q1j.js +1 -0
- package/dist/control-web/assets/chunk-ICXQ74PX-D2yF6lD_.js +2 -0
- package/dist/control-web/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/control-web/assets/chunk-KEIR6QF5-BICK3FdT.js +161 -0
- package/dist/control-web/assets/chunk-MOJQB5TN-CdaKyBz5.js +88 -0
- package/dist/control-web/assets/chunk-OGEWGWER-eOXC7kiH.js +1 -0
- package/dist/control-web/assets/chunk-PUDLZKDR-6w0LILL_.js +156 -0
- package/dist/control-web/assets/chunk-Q4XR5HBZ-CXgD5TGL.js +70 -0
- package/dist/control-web/assets/chunk-RYQCIY6F-BsoV8yK2.js +1 -0
- package/dist/control-web/assets/chunk-V7JOEXUC-BfoZ78b6.js +206 -0
- package/dist/control-web/assets/chunk-VR4S4FIN-BW2gCEMQ.js +1 -0
- package/dist/control-web/assets/chunk-WYO6CB5R-CHn7hulw.js +128 -0
- package/dist/control-web/assets/chunk-XXDRQBXY-DqAYeljN.js +1 -0
- package/dist/control-web/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/control-web/assets/chunk-ZGVPDNZ5-CmFP0-fr.js +62 -0
- package/dist/control-web/assets/clarity-SemFz856.js +1 -0
- package/dist/control-web/assets/classDiagram-OUVF2IWQ-CUe_bETB.js +1 -0
- package/dist/control-web/assets/classDiagram-v2-EOCWNBFH-CUe_bETB.js +1 -0
- package/dist/control-web/assets/clojure-DqKBuwfJ.js +1 -0
- package/dist/control-web/assets/cmake-Bj61d0ZC.js +1 -0
- package/dist/control-web/assets/cobol-BsV-839J.js +1 -0
- package/dist/control-web/assets/codeowners-C8r90Shi.js +1 -0
- package/dist/control-web/assets/codeql-oeQT6MSM.js +1 -0
- package/dist/control-web/assets/coffee-CiiSLhB6.js +1 -0
- package/dist/control-web/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/dist/control-web/assets/coq-BrsZFFmf.js +1 -0
- package/dist/control-web/assets/cose-bilkent-JH36ORCC-lJEhNiw_.js +1 -0
- package/dist/control-web/assets/cpp-DjoE5qBx.js +1 -0
- package/dist/control-web/assets/crystal-DDxHDkHz.js +1 -0
- package/dist/control-web/assets/csharp-Ct8U2NOr.js +1 -0
- package/dist/control-web/assets/css-LjpOdHib.js +1 -0
- package/dist/control-web/assets/csv-Dx-8-gkx.js +1 -0
- package/dist/control-web/assets/cue-CE9AQfxI.js +1 -0
- package/dist/control-web/assets/cynefin-VYW2F7L2-NaLr7Qlq.js +1 -0
- package/dist/control-web/assets/cynefinDiagram-TSTJHNR4-C90wpjAI.js +62 -0
- package/dist/control-web/assets/cypher-ClKdZ_lG.js +1 -0
- package/dist/control-web/assets/cytoscape.esm-B-NFISlW.js +321 -0
- package/dist/control-web/assets/d-qD-0Kul2.js +1 -0
- package/dist/control-web/assets/dagre-Buvkdvvj.js +1 -0
- package/dist/control-web/assets/dagre-VKFMJZFB-BxrPFWTb.js +4 -0
- package/dist/control-web/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/control-web/assets/dart-DkHntEIa.js +1 -0
- package/dist/control-web/assets/dax-BkyTk9wS.js +1 -0
- package/dist/control-web/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/control-web/assets/desktop-Dlh5hvp9.js +1 -0
- package/dist/control-web/assets/diagram-FQU43EPY-VIQINsvz.js +3 -0
- package/dist/control-web/assets/diagram-G47NLZAW-DFeAfYXn.js +24 -0
- package/dist/control-web/assets/diagram-NH7WQ7WH-ATzdppDd.js +24 -0
- package/dist/control-web/assets/diagram-OA4YK3LP-DJZpWmbl.js +30 -0
- package/dist/control-web/assets/diagram-WEI45ONY-CqDHcW3g.js +41 -0
- package/dist/control-web/assets/diff-woXpYk--.js +1 -0
- package/dist/control-web/assets/dist-Dx9YWgcW.js +153 -0
- package/dist/control-web/assets/dist-v5Q1xZ2K.js +1 -0
- package/dist/control-web/assets/docker-IyjqRm3v.js +1 -0
- package/dist/control-web/assets/dotenv-_5a1GRtc.js +1 -0
- package/dist/control-web/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/control-web/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/control-web/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/dist/control-web/assets/ebnfDiagram-CCIWWBDH-DnP6dHND.js +1 -0
- package/dist/control-web/assets/edge-8z7Jp9dO.js +1 -0
- package/dist/control-web/assets/elixir-CUV54ev5.js +1 -0
- package/dist/control-web/assets/elm-o4NJxfws.js +1 -0
- package/dist/control-web/assets/emacs-lisp-C9PiwqqW.js +1 -0
- package/dist/control-web/assets/erDiagram-Q63AITRT-Bo8bFqrZ.js +85 -0
- package/dist/control-web/assets/erb-CIsHcwm1.js +1 -0
- package/dist/control-web/assets/erlang-Cphh6RMH.js +1 -0
- package/dist/control-web/assets/eventmodeling-45OFAUF4-DTN8wqsu.js +1 -0
- package/dist/control-web/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/control-web/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/control-web/assets/fennel-DQxkIbk2.js +1 -0
- package/dist/control-web/assets/fish-BJitypiv.js +1 -0
- package/dist/control-web/assets/flowDiagram-23GEKE2U-BwjqRyvd.js +1 -0
- package/dist/control-web/assets/fluent-C03EYrpw.js +1 -0
- package/dist/control-web/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/dist/control-web/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/dist/control-web/assets/fsharp-D13ZGOAj.js +1 -0
- package/dist/control-web/assets/ganttDiagram-NO4QXBWP-kxQaBTzd.js +292 -0
- package/dist/control-web/assets/gdresource-C0sCabJj.js +1 -0
- package/dist/control-web/assets/gdscript-Cp2uCuqX.js +1 -0
- package/dist/control-web/assets/gdshader-CBce3t8t.js +1 -0
- package/dist/control-web/assets/genie-CV2tkWYe.js +1 -0
- package/dist/control-web/assets/gherkin-DExj1W_8.js +1 -0
- package/dist/control-web/assets/git-commit-BSykSTBG.js +1 -0
- package/dist/control-web/assets/git-rebase-BDPpS8w6.js +1 -0
- package/dist/control-web/assets/gitGraph-TEB2WS4Q-a646NnuJ.js +1 -0
- package/dist/control-web/assets/gitGraphDiagram-IHSO6WYX-BBe0q0At.js +106 -0
- package/dist/control-web/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/control-web/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/control-web/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/control-web/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/control-web/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/control-web/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/control-web/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/control-web/assets/gleam-CSRkHgEL.js +1 -0
- package/dist/control-web/assets/glimmer-js-OEO36pDk.js +1 -0
- package/dist/control-web/assets/glimmer-ts-BnAPyISE.js +1 -0
- package/dist/control-web/assets/glsl-D5MA2a_X.js +1 -0
- package/dist/control-web/assets/gn-ilITqXS6.js +1 -0
- package/dist/control-web/assets/gnuplot-7GGW24-e.js +1 -0
- package/dist/control-web/assets/go-BJwz_mda.js +1 -0
- package/dist/control-web/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/control-web/assets/graphql-Ctjuxyvl.js +1 -0
- package/dist/control-web/assets/groovy-CacY0gHj.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/control-web/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/control-web/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/control-web/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/control-web/assets/hack-D_mkkoLd.js +1 -0
- package/dist/control-web/assets/haml-mpgecWZ6.js +1 -0
- package/dist/control-web/assets/handlebars-CAx_777f.js +1 -0
- package/dist/control-web/assets/haskell-D8IpX4py.js +1 -0
- package/dist/control-web/assets/haxe-OTjmBuCE.js +1 -0
- package/dist/control-web/assets/hcl-Dh228itO.js +1 -0
- package/dist/control-web/assets/highlighted-body-OFNGDK62-DVCHy9oI.js +1 -0
- package/dist/control-web/assets/hjson-CxZEssPk.js +1 -0
- package/dist/control-web/assets/hlsl-Cvrh5tZx.js +1 -0
- package/dist/control-web/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/control-web/assets/horizon-bright-Br1oVSNq.js +1 -0
- package/dist/control-web/assets/houston-CsvMBhTu.js +1 -0
- package/dist/control-web/assets/html-B2lrdnWr.js +1 -0
- package/dist/control-web/assets/html-derivative-CDfZYcul.js +1 -0
- package/dist/control-web/assets/http-kmH8AyfE.js +1 -0
- package/dist/control-web/assets/hurl-DCZHXKU4.js +1 -0
- package/dist/control-web/assets/hxml-B0Qn7Nwc.js +1 -0
- package/dist/control-web/assets/hy-CZbG8q4J.js +1 -0
- package/dist/control-web/assets/imba-DsUTQ-LC.js +1 -0
- package/dist/control-web/assets/index-D7URT6K_.js +140 -0
- package/dist/control-web/assets/index-uEpvRMX9.css +1 -0
- package/dist/control-web/assets/info-DKCQHKI2-Cp_JrY-b.js +1 -0
- package/dist/control-web/assets/infoDiagram-FWYZ7A6U-CAm-h4F_.js +2 -0
- package/dist/control-web/assets/ini-B5eOa1yu.js +1 -0
- package/dist/control-web/assets/init-C-OQMol4.js +1 -0
- package/dist/control-web/assets/ishikawaDiagram-FXEZZL3T-O17pqcWr.js +70 -0
- package/dist/control-web/assets/java-DdHNQ9hk.js +1 -0
- package/dist/control-web/assets/javascript-obGGvMPs.js +1 -0
- package/dist/control-web/assets/jinja-BMiPVedm.js +1 -0
- package/dist/control-web/assets/jison-CBjhYtSs.js +1 -0
- package/dist/control-web/assets/journeyDiagram-5HDEW3XC-DQ-JuSoR.js +139 -0
- package/dist/control-web/assets/json-DAgxKhMr.js +1 -0
- package/dist/control-web/assets/json5-BR5RXkoi.js +1 -0
- package/dist/control-web/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/control-web/assets/jsonl-CmCQp5Yx.js +1 -0
- package/dist/control-web/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/dist/control-web/assets/jssm-DXw9l8Rf.js +1 -0
- package/dist/control-web/assets/jsx-gTgmArGx.js +1 -0
- package/dist/control-web/assets/julia-CjHxn3vf.js +1 -0
- package/dist/control-web/assets/just-DMArCiVH.js +1 -0
- package/dist/control-web/assets/kanagawa-dragon-CXtmUGW6.js +1 -0
- package/dist/control-web/assets/kanagawa-lotus-BN08jTvb.js +1 -0
- package/dist/control-web/assets/kanagawa-wave-CTweb8Dz.js +1 -0
- package/dist/control-web/assets/kanban-definition-HUTT4EX6-Cgv3kPbm.js +89 -0
- package/dist/control-web/assets/katex-CyHG4N6b.js +1 -0
- package/dist/control-web/assets/kdl-CsD5j6eV.js +1 -0
- package/dist/control-web/assets/kotlin-DhhofPvG.js +1 -0
- package/dist/control-web/assets/kusto-BUv0MjJC.js +1 -0
- package/dist/control-web/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/control-web/assets/latex-D9bvcAJr.js +1 -0
- package/dist/control-web/assets/lean-CewbzKMR.js +1 -0
- package/dist/control-web/assets/less-DVTAwKKz.js +1 -0
- package/dist/control-web/assets/lib-BZ_F5vVH.js +1 -0
- package/dist/control-web/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/control-web/assets/line-DUsXzGJZ.js +1 -0
- package/dist/control-web/assets/linear-DmucvK78.js +1 -0
- package/dist/control-web/assets/liquid-CCX5qouA.js +1 -0
- package/dist/control-web/assets/llvm-Cm23YOpf.js +1 -0
- package/dist/control-web/assets/log-BNLmms1o.js +1 -0
- package/dist/control-web/assets/logo-Cluzi2Zq.js +1 -0
- package/dist/control-web/assets/lua-FONpmTUP.js +1 -0
- package/dist/control-web/assets/luau-CNKltnaQ.js +1 -0
- package/dist/control-web/assets/make-Dixweg8N.js +1 -0
- package/dist/control-web/assets/map-BaFkSB1l.js +1 -0
- package/dist/control-web/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/control-web/assets/markdown-streamdown-4N4AcNp5.js +433 -0
- package/dist/control-web/assets/markdown-streamdown-DEcVZfaU.css +1 -0
- package/dist/control-web/assets/marko-oPGh3KfH.js +1 -0
- package/dist/control-web/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/control-web/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/control-web/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/control-web/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/control-web/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/control-web/assets/matlab-D7qyCx1q.js +1 -0
- package/dist/control-web/assets/mdc-B_uQHOlt.js +1 -0
- package/dist/control-web/assets/mdx-DQZ5AkYe.js +1 -0
- package/dist/control-web/assets/mermaid-Bk4SNUv9.js +1 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-BElZGKGd.js +1 -0
- package/dist/control-web/assets/mermaid-parser.core-VMln12Kd.js +7 -0
- package/dist/control-web/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/control-web/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/control-web/assets/mindmap-definition-LN4V7U3C-Bn0lH-UM.js +96 -0
- package/dist/control-web/assets/mipsasm-BMqwQI7S.js +1 -0
- package/dist/control-web/assets/mojo-BgCJLMeH.js +1 -0
- package/dist/control-web/assets/monokai-CdkpiU2Y.js +1 -0
- package/dist/control-web/assets/moonbit-CaWjb8XO.js +1 -0
- package/dist/control-web/assets/move-B1IS1UjX.js +1 -0
- package/dist/control-web/assets/narrat-_X_XdTYD.js +1 -0
- package/dist/control-web/assets/nextflow-Bbiyy34d.js +1 -0
- package/dist/control-web/assets/nextflow-groovy-Dc_ddanL.js +1 -0
- package/dist/control-web/assets/nginx-BTMw9COX.js +1 -0
- package/dist/control-web/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/control-web/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/control-web/assets/nim-8PQFL6ZB.js +1 -0
- package/dist/control-web/assets/nix-IvuFDN5E.js +1 -0
- package/dist/control-web/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/control-web/assets/nushell-DcLAeLz5.js +1 -0
- package/dist/control-web/assets/objective-c-D1A_Heim.js +1 -0
- package/dist/control-web/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/dist/control-web/assets/ocaml-O90oeIOV.js +1 -0
- package/dist/control-web/assets/odin-B1RWQWA5.js +1 -0
- package/dist/control-web/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/dist/control-web/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/control-web/assets/openscad-BUDT5pXO.js +1 -0
- package/dist/control-web/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/control-web/assets/packet-7NZHBO7P-Zw8iJ8lo.js +1 -0
- package/dist/control-web/assets/pascal-4ZHwLPI5.js +1 -0
- package/dist/control-web/assets/path-fybaL0A-.js +1 -0
- package/dist/control-web/assets/pegDiagram-2B236MQR-CtF7vVs_.js +1 -0
- package/dist/control-web/assets/perl-Vf0i0hAx.js +1 -0
- package/dist/control-web/assets/php-am1OsKhm.js +1 -0
- package/dist/control-web/assets/pie-RZYD4A2V-su_3QGU2.js +1 -0
- package/dist/control-web/assets/pieDiagram-ENE6RG2P-BkMUBLE1.js +39 -0
- package/dist/control-web/assets/pkl-ot-7Btpt.js +1 -0
- package/dist/control-web/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/control-web/assets/plsql-DGHpHOYJ.js +1 -0
- package/dist/control-web/assets/po-BiJDBrnU.js +1 -0
- package/dist/control-web/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/control-web/assets/polar-C7UOKdEL.js +1 -0
- package/dist/control-web/assets/postcss-BXeXVLqQ.js +1 -0
- package/dist/control-web/assets/powerquery-DNMTfnFr.js +1 -0
- package/dist/control-web/assets/powershell-DshXNtvi.js +1 -0
- package/dist/control-web/assets/prisma-BsRQq5mF.js +1 -0
- package/dist/control-web/assets/prolog-iXnhIJG7.js +1 -0
- package/dist/control-web/assets/proto-DB4EqR-F.js +1 -0
- package/dist/control-web/assets/pug-DO6yvBr3.js +1 -0
- package/dist/control-web/assets/puppet-CDv2pdJW.js +1 -0
- package/dist/control-web/assets/purescript-9MfHhQsQ.js +1 -0
- package/dist/control-web/assets/python-gzcpVVnB.js +1 -0
- package/dist/control-web/assets/qml-_a-QhfPD.js +1 -0
- package/dist/control-web/assets/qmldir-DCQb3MpD.js +1 -0
- package/dist/control-web/assets/qss-Fe1Jh2GI.js +1 -0
- package/dist/control-web/assets/quadrantDiagram-ABIIQ3AL-ba-VaqMe.js +7 -0
- package/dist/control-web/assets/r-D6UWEOL2.js +1 -0
- package/dist/control-web/assets/racket-DcIDlBhZ.js +1 -0
- package/dist/control-web/assets/radar-I7S5WNFK-Dat0rqem.js +1 -0
- package/dist/control-web/assets/railroad-3IZDKUUU-Dh2-s8r8.js +1 -0
- package/dist/control-web/assets/railroad-abnf-AHOZXSZD-CNUwq0JR.js +1 -0
- package/dist/control-web/assets/railroad-ebnf-EBAXGLYW-RHr0duea.js +1 -0
- package/dist/control-web/assets/railroad-peg-LSFZ7HO6-CVBWS2eU.js +1 -0
- package/dist/control-web/assets/railroadDiagram-RFXS5EU6-BiJX3SY-.js +1 -0
- package/dist/control-web/assets/raku-B3gFvitq.js +1 -0
- package/dist/control-web/assets/razor-CMVBVp3T.js +1 -0
- package/dist/control-web/assets/red-CJ3rzSJv.js +1 -0
- package/dist/control-web/assets/reg-CRGYupPL.js +1 -0
- package/dist/control-web/assets/regexp-DR20uMnK.js +1 -0
- package/dist/control-web/assets/rel-BtDbiS_P.js +1 -0
- package/dist/control-web/assets/requirementDiagram-TGXJPOKE-CFfakCzs.js +84 -0
- package/dist/control-web/assets/riscv-Ckw8ddFX.js +1 -0
- package/dist/control-web/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/dist/control-web/assets/ron-VUp2lXgN.js +1 -0
- package/dist/control-web/assets/rose-pine-BthvhNj6.js +1 -0
- package/dist/control-web/assets/rose-pine-dawn-Dg85fqjY.js +1 -0
- package/dist/control-web/assets/rose-pine-moon-hon4tzzS.js +1 -0
- package/dist/control-web/assets/rosmsg-CAekHB0j.js +1 -0
- package/dist/control-web/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/control-web/assets/rst-CgIrbW_q.js +1 -0
- package/dist/control-web/assets/ruby-Dp6Zud9H.js +1 -0
- package/dist/control-web/assets/rust-Cfkwpbl8.js +1 -0
- package/dist/control-web/assets/sankeyDiagram-HTMAVEWB-jgDi0God.js +40 -0
- package/dist/control-web/assets/sas-B6p8-ynO.js +1 -0
- package/dist/control-web/assets/sass-DXrisJhu.js +1 -0
- package/dist/control-web/assets/scala-DKOlJaKm.js +1 -0
- package/dist/control-web/assets/scheme-DQCgrYNe.js +1 -0
- package/dist/control-web/assets/scss-DcoSS-ti.js +1 -0
- package/dist/control-web/assets/sdbl-bTVj8UrX.js +1 -0
- package/dist/control-web/assets/sequenceDiagram-DBY2YBRQ-DBfyyb0N.js +162 -0
- package/dist/control-web/assets/shaderlab-TOUzSsQk.js +1 -0
- package/dist/control-web/assets/shellscript-Da78Ox-3.js +1 -0
- package/dist/control-web/assets/shellsession-CVsQGYfZ.js +1 -0
- package/dist/control-web/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
- package/dist/control-web/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/control-web/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/control-web/assets/smalltalk-B16xEiuN.js +1 -0
- package/dist/control-web/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/control-web/assets/solarized-dark-DV17i1UV.js +1 -0
- package/dist/control-web/assets/solarized-light-DSh2HLQt.js +1 -0
- package/dist/control-web/assets/solidity-CKzVLygQ.js +1 -0
- package/dist/control-web/assets/soy-B5n_eHSp.js +1 -0
- package/dist/control-web/assets/sparql-D_iOobhT.js +1 -0
- package/dist/control-web/assets/splunk-BC2Px7Mm.js +1 -0
- package/dist/control-web/assets/sql-ClgswhA6.js +1 -0
- package/dist/control-web/assets/src-B6xuSHsQ.js +1 -0
- package/dist/control-web/assets/ssh-config-BgfXC-Er.js +1 -0
- package/dist/control-web/assets/stata-RoaAgbqU.js +1 -0
- package/dist/control-web/assets/stateDiagram-2N3HPSRC-Dwb_ncVi.js +1 -0
- package/dist/control-web/assets/stateDiagram-v2-6OUMAXLB-DI0opaA1.js +1 -0
- package/dist/control-web/assets/stylus-B6D30XZt.js +1 -0
- package/dist/control-web/assets/surrealql-DIn4NJsS.js +1 -0
- package/dist/control-web/assets/svelte-CIt8Fl9I.js +1 -0
- package/dist/control-web/assets/swift-DonLKvLd.js +1 -0
- package/dist/control-web/assets/swimlanes-5IMT3BWC-DW0LuiIV.js +2 -0
- package/dist/control-web/assets/swimlanesDiagram-G3AALYLV-DDTVjcOR.js +8 -0
- package/dist/control-web/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/control-web/assets/system-verilog-DJ5XKQeo.js +1 -0
- package/dist/control-web/assets/systemd-BxMlprV5.js +1 -0
- package/dist/control-web/assets/talonscript-CohzipZa.js +1 -0
- package/dist/control-web/assets/tasl-DMoTqEGO.js +1 -0
- package/dist/control-web/assets/tcl-CZd0xW_V.js +1 -0
- package/dist/control-web/assets/templ-BREsJpNc.js +1 -0
- package/dist/control-web/assets/terraform-DswuEJGm.js +1 -0
- package/dist/control-web/assets/tex-0w6-Dtgt.js +1 -0
- package/dist/control-web/assets/timeline-definition-FHXFAJF6-DeX4B_B8.js +120 -0
- package/dist/control-web/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/control-web/assets/toml-CcmNWLt0.js +1 -0
- package/dist/control-web/assets/treeView-QDETBFTQ-D1UXtICj.js +1 -0
- package/dist/control-web/assets/treemap-6X3UGDF4-CrppzjZH.js +1 -0
- package/dist/control-web/assets/ts-tags-q3pptdMi.js +1 -0
- package/dist/control-web/assets/tsv-sltzmVWM.js +1 -0
- package/dist/control-web/assets/tsx-CUOciP0b.js +1 -0
- package/dist/control-web/assets/turtle-ByJddavk.js +1 -0
- package/dist/control-web/assets/twig-LIeLXgf5.js +1 -0
- package/dist/control-web/assets/typescript-BydbNFcO.js +1 -0
- package/dist/control-web/assets/typespec-B88KGewJ.js +1 -0
- package/dist/control-web/assets/typst-DI99ib-x.js +1 -0
- package/dist/control-web/assets/v-DETTlOr0.js +1 -0
- package/dist/control-web/assets/vala-zf12oZj6.js +1 -0
- package/dist/control-web/assets/vb-Djn5o6TS.js +1 -0
- package/dist/control-web/assets/vennDiagram-L72KCM5P-BYpf-7VR.js +34 -0
- package/dist/control-web/assets/verilog-CiiDBU1e.js +1 -0
- package/dist/control-web/assets/vesper-D5bVUKB1.js +1 -0
- package/dist/control-web/assets/vhdl-BroJfC0k.js +1 -0
- package/dist/control-web/assets/viml-DvXPmvsu.js +1 -0
- package/dist/control-web/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/control-web/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/control-web/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/control-web/assets/vue-DVSfBueU.js +1 -0
- package/dist/control-web/assets/vue-html-DkKkQnZL.js +1 -0
- package/dist/control-web/assets/vue-vine-pWqEcBkW.js +1 -0
- package/dist/control-web/assets/vyper-CgoNMtux.js +1 -0
- package/dist/control-web/assets/wardley-OPB4EBWU-B9rA0UsV.js +1 -0
- package/dist/control-web/assets/wardleyDiagram-EHGQE667-BdvAUa5F.js +78 -0
- package/dist/control-web/assets/wasm-BnjxR4X6.js +1 -0
- package/dist/control-web/assets/wasm-ByWQv1Qj.js +1 -0
- package/dist/control-web/assets/wenyan-C8pVoKbM.js +1 -0
- package/dist/control-web/assets/wgsl-BsKzXJz4.js +1 -0
- package/dist/control-web/assets/wikitext-ClFFjSW2.js +1 -0
- package/dist/control-web/assets/wit-DdvCle-K.js +1 -0
- package/dist/control-web/assets/wolfram-DLL8P-h_.js +1 -0
- package/dist/control-web/assets/xml-BlnrEAEy.js +1 -0
- package/dist/control-web/assets/xsl-BOPS8gLt.js +1 -0
- package/dist/control-web/assets/xychartDiagram-FW5EYKEG-BaEV3pGm.js +7 -0
- package/dist/control-web/assets/yaml-Du_6cdrH.js +1 -0
- package/dist/control-web/assets/zenscript-BnlCZFoB.js +1 -0
- package/dist/control-web/assets/zig-CMLA9XwU.js +1 -0
- package/dist/control-web/index.html +3 -2
- package/dist/control-web-dist.d.ts +1 -1
- package/dist/control-web-dist.js +4 -2
- package/dist/desktop-browser-host.d.ts +3 -1
- package/dist/desktop-browser-host.js +39 -4
- package/dist/direct-runtime-server.js +187 -153
- package/dist/machine-session-service.d.ts +105 -15
- package/dist/machine-session-service.js +781 -87
- package/dist/remote-runtime-dispatcher.d.ts +2 -2
- package/dist/remote-runtime-dispatcher.js +42 -2
- package/dist/remote-runtime-session-projection.d.ts +1 -0
- package/dist/remote-runtime-session-projection.js +12 -0
- package/dist/server.d.ts +64 -11
- package/dist/server.js +422 -55
- package/dist/session-browser-service.d.ts +24 -4
- package/dist/session-browser-service.js +127 -1
- package/dist/session-pending-inputs.d.ts +42 -0
- package/dist/session-pending-inputs.js +87 -0
- package/dist/session-portal.d.ts +54 -0
- package/dist/session-portal.js +997 -0
- package/dist/session-runtime-index.d.ts +3 -6
- package/dist/session-runtime-index.js +96 -38
- package/dist/session-terminal-host.d.ts +22 -2
- package/dist/session-terminal-host.js +66 -83
- package/dist/terminal-ws.d.ts +4 -1
- package/dist/terminal-ws.js +93 -27
- package/package.json +7 -7
- package/dist/control-web/assets/highlighted-body-OFNGDK62-DWWsUtHF.js +0 -1
- package/dist/control-web/assets/index-BnX7NWJX.js +0 -689
- package/dist/control-web/assets/index-CUoWRX2i.css +0 -32
- package/dist/control-web/assets/mermaid-GHXKKRXX-C1fxAgiw.js +0 -131
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-streamdown-4N4AcNp5.js","assets/rolldown-runtime-hePW80VL.js","assets/lib-BZ_F5vVH.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/chunk-WYO6CB5R-CHn7hulw.js","assets/chunk-ICXQ74PX-D2yF6lD_.js","assets/dist-v5Q1xZ2K.js","assets/chunk-HOUHSVGY-DeZ63q1j.js","assets/chunk-Q4XR5HBZ-CXgD5TGL.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-eOXC7kiH.js","assets/chunk-C7G6YPKG-DqHaDS1O.js","assets/chunk-ZGVPDNZ5-CmFP0-fr.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-52WLFC77-sD4al-Ob.js","assets/line-DUsXzGJZ.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/markdown-streamdown-DEcVZfaU.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var n=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),r=t(((e,t)=>{t.exports=n()})),i=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),a=t(((e,t)=>{t.exports=i()})),o=t((e=>{var t=r();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),s=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=o()})),c=t((e=>{var t=a(),n=r(),i=s();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=a;break}if(c===r){s=!0,r=i,n=a;break}c=c.sibling}if(!s){for(c=a.child;c;){if(c===n){s=!0,n=a,r=i;break}if(c===r){s=!0,r=a,n=i;break}c=c.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},te=[],ne=-1;function re(e){return{current:e}}function R(e){0>ne||(e.current=te[ne],te[ne]=null,ne--)}function ie(e,t){ne++,te[ne]=e.current,e.current=t}var ae=re(null),oe=re(null),se=re(null),ce=re(null);function le(e,t){switch(ie(se,t),ie(oe,e),ie(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kd(t),e=qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(ae),ie(ae,e)}function ue(){R(ae),R(oe),R(se)}function de(e){e.memoizedState!==null&&ie(ce,e);var t=ae.current,n=qd(t,e.type);t!==n&&(ie(oe,e),ie(ae,n))}function fe(e){oe.current===e&&(R(ae),R(oe)),ce.current===e&&(R(ce),rp._currentValue=ee)}var pe,me;function he(e){if(pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||``,me=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+pe+e+me}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ge=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?he(n):``}function ve(e,t){switch(e.tag){case 26:case 27:case 5:return he(e.type);case 16:return he(`Lazy`);case 13:return e.child!==t&&t!==null?he(`Suspense Fallback`):he(`Suspense`);case 19:return he(`SuspenseList`);case 0:case 15:return _e(e.type,!1);case 11:return _e(e.type.render,!1);case 1:return _e(e.type,!0);case 31:return he(`Activity`);default:return``}}function ye(e){try{var t=``,n=null;do t+=ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var be=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,Ce=t.unstable_shouldYield,we=t.unstable_requestPaint,Te=t.unstable_now,Ee=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,je=t.unstable_IdlePriority,Me=t.log,Ne=t.unstable_setDisableYieldValue,Pe=null,Fe=null;function Ie(e){if(typeof Me==`function`&&Ne(e),Fe&&typeof Fe.setStrictMode==`function`)try{Fe.setStrictMode(Pe,e)}catch{}}var Le=Math.clz32?Math.clz32:Be,Re=Math.log,ze=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(Re(e)/ze|0)|0}var Ve=256,He=262144,Ue=4194304;function We(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ge(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=We(n))):i=We(o):i=We(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=We(n))):i=We(o)):i=We(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Je(){var e=Ue;return Ue<<=1,!(Ue&62914560)&&(Ue=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Le(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Le(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function $e(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Le(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function et(e,t){var n=t&-t;return n=n&42?1:tt(n),(n&(e.suspendedLanes|t))===0?n:0}function tt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=L.p;return e===0?(e=window.event,e===void 0?32:yp(e.type)):e}function it(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,ct=`__reactContainer$`+at,lt=`__reactEvents$`+at,ut=`__reactListeners$`+at,dt=`__reactHandles$`+at,ft=`__reactResources$`+at,pt=`__reactMarker$`+at;function mt(e){delete e[ot],delete e[st],delete e[lt],delete e[ut],delete e[dt]}function ht(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ct]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=gf(e);e!==null;){if(n=e[ot])return n;e=gf(e)}return t}e=n,n=e.parentNode}return null}function gt(e){if(e=e[ot]||e[ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function vt(e){var t=e[ft];return t||=e[ft]={hoistableStyles:new Map,hoistableScripts:new Map},t}function yt(e){e[pt]=!0}var bt=new Set,xt={};function St(e,t){Ct(e,t),Ct(e+`Capture`,t)}function Ct(e,t){for(xt[e]=t,e=0;e<t.length;e++)bt.add(t[e])}var wt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Tt={},Et={};function Dt(e){return be.call(Et,e)?!0:be.call(Tt,e)?!1:wt.test(e)?Et[e]=!0:(Tt[e]=!0,!1)}function Ot(e,t,n){if(Dt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function kt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function At(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function jt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Mt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Nt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Pt(e){if(!e._valueTracker){var t=Mt(e)?`checked`:`value`;e._valueTracker=Nt(e,t,``+e[t])}}function Ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Mt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function It(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Lt=/[\n"\\]/g;function Rt(e){return e.replace(Lt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function zt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+jt(t)):e.value!==``+jt(t)&&(e.value=``+jt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Vt(e,o,jt(n)):Vt(e,o,jt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+jt(s):e.removeAttribute(`name`)}function Bt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Pt(e);return}n=n==null?``:``+jt(n),t=t==null?n:``+jt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Pt(e)}function Vt(e,t,n){t===`number`&&It(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ht(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+jt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ut(e,t,n){if(t!=null&&(t=``+jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+jt(n)}function Wt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(F(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=jt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Pt(e)}function Gt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function qt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Kt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Jt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&qt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&qt(e,a,t[a])}function Yt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Zt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qt(e){return Zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function $t(){}var en=null;function tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nn=null,rn=null;function an(e){var t=gt(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(zt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Rt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[st]||null;if(!i)throw Error(o(90));zt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ft(r)}break a;case`textarea`:Ut(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ht(e,!!n.multiple,t,!1)}}}var on=!1;function sn(e,t,n){if(on)return e(t,n);on=!0;try{return e(t)}finally{if(on=!1,(nn!==null||rn!==null)&&(Su(),nn&&(t=nn,e=rn,rn=nn=null,an(t),e)))for(t=0;t<e.length;t++)an(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,"passive",{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return mn=i.slice(e,1<r?1-r:void 0)}function gn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _n(){return!0}function vn(){return!1}function yn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?_n:vn,this.isPropagationStopped=vn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=h({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=h({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ln,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(h({},Dn,{dataTransfer:0})),z=yn(h({},Sn,{relatedTarget:0})),An=yn(h({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),jn=yn(h({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Mn=yn(h({},bn,{data:0})),Nn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Pn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Fn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function In(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Fn[e])?!!t[e]:!1}function Ln(){return In}var Rn=yn(h({},Sn,{key:function(e){if(e.key){var t=Nn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Pn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ln,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),zn=yn(h({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Bn=yn(h({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ln})),Vn=yn(h({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Hn=yn(h({},Dn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Un=yn(h({},bn,{newState:0,oldState:0})),Wn=[9,13,27,32],Gn=ln&&`CompositionEvent`in window,Kn=null;ln&&`documentMode`in document&&(Kn=document.documentMode);var qn=ln&&`TextEvent`in window&&!Kn,Jn=ln&&(!Gn||Kn&&8<Kn&&11>=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=hn(),mn=pn=fn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Jn&&t.locale!==`ko`?null:t.data;default:return null}}var nr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!nr[e.type]:t===`textarea`}function ir(e,t,n,r){nn?rn?rn.push(r):rn=[r]:nn=r,t=Ad(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ar=null,or=null;function sr(e){Sd(e,0)}function cr(e){if(Ft(_t(e)))return e}function lr(e,t){if(e===`change`)return t}var ur=!1;if(ln){var dr;if(ln){var fr=`oninput`in document;if(!fr){var pr=document.createElement(`div`);pr.setAttribute(`oninput`,`return;`),fr=typeof pr.oninput==`function`}dr=fr}else dr=!1;ur=dr&&(!document.documentMode||9<document.documentMode)}function mr(){ar&&(ar.detachEvent(`onpropertychange`,hr),or=ar=null)}function hr(e){if(e.propertyName===`value`&&cr(or)){var t=[];ir(t,or,e,tn(e)),sn(sr,t)}}function gr(e,t,n){e===`focusin`?(mr(),ar=t,or=n,ar.attachEvent(`onpropertychange`,hr)):e===`focusout`&&mr()}function _r(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return cr(or)}function vr(e,t){if(e===`click`)return cr(t)}function B(e,t){if(e===`input`||e===`change`)return cr(t)}function yr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var br=typeof Object.is==`function`?Object.is:yr;function xr(e,t){if(br(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!be.call(t,i)||!br(e[i],t[i]))return!1}return!0}function Sr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Cr(e,t){var n=Sr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Sr(n)}}function wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=It(e.document)}return t}function Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Dr=ln&&`documentMode`in document&&11>=document.documentMode,Or=null,kr=null,Ar=null,jr=!1;function Mr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jr||Or==null||Or!==It(r)||(r=Or,`selectionStart`in r&&Er(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&xr(Ar,r)||(Ar=r,r=Ad(kr,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Or)))}function Nr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Pr={animationend:Nr(`Animation`,`AnimationEnd`),animationiteration:Nr(`Animation`,`AnimationIteration`),animationstart:Nr(`Animation`,`AnimationStart`),transitionrun:Nr(`Transition`,`TransitionRun`),transitionstart:Nr(`Transition`,`TransitionStart`),transitioncancel:Nr(`Transition`,`TransitionCancel`),transitionend:Nr(`Transition`,`TransitionEnd`)},Fr={},Ir={};ln&&(Ir=document.createElement(`div`).style,`AnimationEvent`in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),`TransitionEvent`in window||delete Pr.transitionend.transition);function Lr(e){if(Fr[e])return Fr[e];if(!Pr[e])return e;var t=Pr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ir)return Fr[e]=t[n];return e}var Rr=Lr(`animationend`),zr=Lr(`animationiteration`),Br=Lr(`animationstart`),Vr=Lr(`transitionrun`),Hr=Lr(`transitionstart`),Ur=Lr(`transitioncancel`),Wr=Lr(`transitionend`),Gr=new Map,Kr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Kr.push(`scrollEnd`);function qr(e,t){Gr.set(e,t),St(t,[e])}var Jr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Yr=[],Xr=0,Zr=0;function Qr(){for(var e=Xr,t=Zr=Xr=0;t<e;){var n=Yr[t];Yr[t++]=null;var r=Yr[t];Yr[t++]=null;var i=Yr[t];Yr[t++]=null;var a=Yr[t];if(Yr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ni(n,i,a)}}function $r(e,t,n,r){Yr[Xr++]=e,Yr[Xr++]=t,Yr[Xr++]=n,Yr[Xr++]=r,Zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ei(e,t,n,r){return $r(e,t,n,r),ri(e)}function ti(e,t){return $r(e,null,null,t),ri(e)}function ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Le(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ri(e){if(50<pu)throw pu=0,mu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ii={};function ai(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function oi(e,t,n,r){return new ai(e,t,n,r)}function si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ci(e,t){var n=e.alternate;return n===null?(n=oi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function li(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ui(e,t,n,r,i,a){var s=0;if(r=e,typeof e==`function`)si(e)&&(s=1);else if(typeof e==`string`)s=Jf(e,n,ae.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=oi(31,n,t,i),e.elementType=k,e.lanes=a,e;case y:return di(n.children,i,a,t);case b:s=8,i|=24;break;case x:return e=oi(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=oi(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=oi(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=oi(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function di(e,t,n,r){return e=oi(7,e,r,t),e.lanes=n,e}function fi(e,t,n){return e=oi(6,e,null,t),e.lanes=n,e}function pi(e){var t=oi(18,null,null,0);return t.stateNode=e,t}function mi(e,t,n){return t=oi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var hi=new WeakMap;function gi(e,t){if(typeof e==`object`&&e){var n=hi.get(e);return n===void 0?(t={value:e,source:t,stack:ye(t)},hi.set(e,t),t):n}return{value:e,source:t,stack:ye(t)}}var _i=[],vi=0,yi=null,bi=0,xi=[],Si=0,Ci=null,wi=1,Ti=``;function Ei(e,t){_i[vi++]=bi,_i[vi++]=yi,yi=e,bi=t}function V(e,t,n){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,Ci=e;var r=wi;e=Ti;var i=32-Le(r)-1;r&=~(1<<i),n+=1;var a=32-Le(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,wi=1<<32-Le(t)+i|n<<i|r,Ti=a+e}else wi=1<<a|n<<i|r,Ti=e}function Di(e){e.return!==null&&(Ei(e,1),V(e,1,0))}function Oi(e){for(;e===yi;)yi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null;for(;e===Ci;)Ci=xi[--Si],xi[Si]=null,Ti=xi[--Si],xi[Si]=null,wi=xi[--Si],xi[Si]=null}function ki(e,t){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,wi=t.id,Ti=t.overflow,Ci=e}var Ai=null,ji=null,Mi=!1,Ni=null,Pi=!1,Fi=Error(o(519));function Ii(e){throw Hi(gi(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Fi}function Li(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:Cd(`cancel`,t),Cd(`close`,t);break;case`iframe`:case`object`:case`embed`:Cd(`load`,t);break;case`video`:case`audio`:for(n=0;n<bd.length;n++)Cd(bd[n],t);break;case`source`:Cd(`error`,t);break;case`img`:case`image`:case`link`:Cd(`error`,t),Cd(`load`,t);break;case`details`:Cd(`toggle`,t);break;case`input`:Cd(`invalid`,t),Bt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Cd(`invalid`,t);break;case`textarea`:Cd(`invalid`,t),Wt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Id(t.textContent,n)?(r.popover!=null&&(Cd(`beforetoggle`,t),Cd(`toggle`,t)),r.onScroll!=null&&Cd(`scroll`,t),r.onScrollEnd!=null&&Cd(`scrollend`,t),r.onClick!=null&&(t.onclick=$t),t=!0):t=!1,t||Ii(e,!0)}function Ri(e){for(Ai=e.return;Ai;)switch(Ai.tag){case 5:case 31:case 13:Pi=!1;return;case 27:case 3:Pi=!0;return;default:Ai=Ai.return}}function zi(e){if(e!==Ai)return!1;if(!Mi)return Ri(e),Mi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Jd(e.type,e.memoizedProps)),n=!n),n&&ji&&Ii(e),Ri(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));ji=hf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));ji=hf(e)}else t===27?(t=ji,nf(e.type)?(e=mf,mf=null,ji=e):ji=t):ji=Ai?pf(e.stateNode.nextSibling):null;return!0}function Bi(){ji=Ai=null,Mi=!1}function Vi(){var e=Ni;return e!==null&&(eu===null?eu=e:eu.push.apply(eu,e),Ni=null),e}function Hi(e){Ni===null?Ni=[e]:Ni.push(e)}var Ui=re(null),H=null,Wi=null;function Gi(e,t,n){ie(Ui,t._currentValue),t._currentValue=n}function Ki(e){e._currentValue=Ui.current,R(Ui)}function qi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ji(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),qi(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),qi(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function U(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;br(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===ce.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[rp]:e.push(rp))}i=i.return}e!==null&&Ji(t,e,n,r),t.flags|=262144}function Yi(e){for(e=e.firstContext;e!==null;){if(!br(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Xi(e){H=e,Wi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Zi(e){return $i(H,e)}function Qi(e,t){return H===null&&Xi(e),$i(e,t)}function $i(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Wi===null){if(e===null)throw Error(o(308));Wi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wi=Wi.next=t;return n}var ea=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ta=t.unstable_scheduleCallback,na=t.unstable_NormalPriority,ra={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ia(){return{controller:new ea,data:new Map,refCount:0}}function aa(e){e.refCount--,e.refCount===0&&ta(na,function(){e.controller.abort()})}var oa=null,sa=0,ca=0,la=null;function ua(e,t){if(oa===null){var n=oa=[];sa=0,ca=md(),la={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return sa++,t.then(da,da),t}function da(){if(--sa===0&&oa!==null){la!==null&&(la.status=`fulfilled`);var e=oa;oa=null,ca=0,la=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var pa=I.S;I.S=function(e,t){ru=Te(),typeof t==`object`&&t&&typeof t.then==`function`&&ua(e,t),pa!==null&&pa(e,t)};var ma=re(null);function ha(){var e=ma.current;return e===null?zl.pooledCache:e}function W(e,t){t===null?ie(ma,ma.current):ie(ma,t.pool)}function ga(){var e=ha();return e===null?null:{parent:ra._currentValue,pool:e}}var _a=Error(o(460)),va=Error(o(474)),ya=Error(o(542)),ba={then:function(){}};function xa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Sa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($t,$t),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e;default:if(typeof t.status==`string`)t.then($t,$t);else{if(e=zl,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e}throw wa=t,_a}}function Ca(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(wa=e,_a):e}}var wa=null;function Ta(){if(wa===null)throw Error(o(459));var e=wa;return wa=null,e}function Ea(e){if(e===_a||e===ya)throw Error(o(483))}var Da=null,Oa=0;function ka(e){var t=Oa;return Oa+=1,Da===null&&(Da=[]),Sa(Da,e,t)}function Aa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ja(e,t){throw t.$$typeof===g?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ci(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=fi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&Ca(a)===t.type)?(t=i(t,n.props),Aa(t,n),t.return=e,t):(t=ui(n.type,n.key,n.props,null,e.mode,r),Aa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=mi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=di(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=fi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ui(t.type,t.key,t.props,null,e.mode,n),Aa(n,t),n.return=e,n;case v:return t=mi(t,e.mode,n),t.return=e,t;case O:return t=Ca(t),f(e,t,n)}if(F(t)||M(t))return t=di(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ka(t),n);if(t.$$typeof===C)return f(e,Qi(e,t),n);ja(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ca(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ka(n),r);if(n.$$typeof===C)return p(e,t,Qi(e,n),r);ja(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ca(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ka(r),i);if(r.$$typeof===C)return m(e,t,n,Qi(t,r),i);ja(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Mi&&Ei(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Mi&&Ei(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Mi&&Ei(i,h),l}function g(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Mi&&Ei(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return Mi&&Ei(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Mi&&Ei(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ca(l)===r.type){n(e,r.sibling),c=i(r,a.props),Aa(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=di(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ui(a.type,a.key,a.props,null,e.mode,c),Aa(c,a),c.return=e,e=c)}return s(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(a,e.mode,c),c.return=e,e=c}return s(e);case O:return a=Ca(a),b(e,r,a,c)}if(F(a))return h(e,r,a,c);if(M(a)){if(l=M(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,ka(a),c);if(a.$$typeof===C)return b(e,r,Qi(e,a),c);ja(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=fi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===_a||t===ya)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Rl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=la;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===ca&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Jl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ga(n[e],t)}var qa=re(null),Ja=re(0);function Ya(e,t){e=Kl,ie(Ja,e),ie(qa,t),Kl=e|t.baseLanes}function Xa(){ie(Ja,Kl),ie(qa,qa.current)}function Za(){Kl=Ja.current,R(qa),R(Ja)}var Qa=re(null),$a=null;function eo(e){var t=e.alternate;ie(ao,ao.current&1),ie(Qa,e),$a===null&&(t===null||qa.current!==null||t.memoizedState!==null)&&($a=e)}function to(e){ie(ao,ao.current),ie(Qa,e),$a===null&&($a=e)}function no(e){e.tag===22?(ie(ao,ao.current),ie(Qa,e),$a===null&&($a=e)):ro(e)}function ro(){ie(ao,ao.current),ie(Qa,Qa.current)}function io(e){R(Qa),$a===e&&($a=null),R(ao)}var ao=re(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||uf(n)||df(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var so=0,G=null,co=null,lo=null,uo=!1,fo=!1,po=!1,mo=0,ho=0,go=null,_o=0;function vo(){throw Error(o(321))}function yo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!br(e[n],t[n]))return!1;return!0}function bo(e,t,n,r,i,a){return so=a,G=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Ls:Rs,po=!1,a=n(r,i),po=!1,fo&&(a=So(t,n,r,i)),xo(e),a}function xo(e){I.H=Is;var t=co!==null&&co.next!==null;if(so=0,lo=co=G=null,uo=!1,ho=0,go=null,t)throw Error(o(300));e===null||tc||(e=e.dependencies,e!==null&&Yi(e)&&(tc=!0))}function So(e,t,n,r){G=e;var i=0;do{if(fo&&(go=null),ho=0,fo=!1,25<=i)throw Error(o(301));if(i+=1,lo=co=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}I.H=zs,a=t(n,r)}while(fo);return a}function Co(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?Ao(t):t,e=e.useState()[0],(co===null?null:co.memoizedState)!==e&&(G.flags|=1024),t}function wo(){var e=mo!==0;return mo=0,e}function To(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Eo(e){if(uo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}uo=!1}so=0,lo=co=G=null,fo=!1,ho=mo=0,go=null}function Do(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lo===null?G.memoizedState=lo=e:lo=lo.next=e,lo}function Oo(){if(co===null){var e=G.alternate;e=e===null?null:e.memoizedState}else e=co.next;var t=lo===null?G.memoizedState:lo.next;if(t!==null)lo=t,co=e;else{if(e===null)throw G.alternate===null?Error(o(467)):Error(o(310));co=e,e={memoizedState:co.memoizedState,baseState:co.baseState,baseQueue:co.baseQueue,queue:co.queue,next:null},lo===null?G.memoizedState=lo=e:lo=lo.next=e}return lo}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ao(e){var t=ho;return ho+=1,go===null&&(go=[]),e=Sa(go,e,t),t=G,(lo===null?t.memoizedState:lo.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Ls:Rs),e}function jo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Ao(e);if(e.$$typeof===C)return Zi(e)}throw Error(o(438,String(e)))}function Mo(e){var t=null,n=G.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=G.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ko(),G.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){return Fo(Oo(),co,e)}function Fo(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(so&f)===f:(q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ca&&(d=!0);else if((so&p)===p){u=u.next,p===ca&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,G.lanes|=p,Jl|=p;f=u.action,po&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,G.lanes|=f,Jl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!br(a,e.memoizedState)&&(tc=!0,d&&(n=la,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Io(e){var t=Oo(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);br(a,t.memoizedState)||(tc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Lo(e,t,n){var r=G,i=Oo(),a=Mi;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!br((co||i).memoizedState,n);if(s&&(i.memoizedState=n,tc=!0),i=i.queue,cs(Bo.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||lo!==null&&lo.memoizedState.tag&1){if(r.flags|=2048,rs(9,{destroy:void 0},zo.bind(null,r,i,n,t),null),zl===null)throw Error(o(349));a||so&127||Ro(r,t,n)}return n}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=G.updateQueue,t===null?(t=ko(),G.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!br(e,n)}catch{return!0}}function Ho(e){var t=ti(e,2);t!==null&&_u(t,e,2)}function Uo(e){var t=Do();if(typeof e==`function`){var n=e;if(e=n(),po){Ie(!0);try{n()}finally{Ie(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t}function Wo(e,t,n,r){return e.baseState=n,Fo(e,co,typeof r==`function`?r:No)}function Go(e,t,n,r,i){if(Ns(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};I.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Ko(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Ko(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),qo(e,t,s)}catch(n){Yo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),qo(e,t,a)}catch(n){Yo(e,t,n)}}function qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Jo(e,t,n)},function(n){return Yo(e,t,n)}):Jo(e,t,n)}function Jo(e,t,n){t.status=`fulfilled`,t.value=n,Xo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ko(e,n)))}function Yo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Xo(t),t=t.next;while(t!==r)}e.action=null}function Xo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zo(e,t){return t}function Qo(e,t){if(Mi){var n=zl.formState;if(n!==null){a:{var r=G;if(Mi){if(ji){b:{for(var i=ji,a=Pi;i.nodeType!==8;){if(!a){i=null;break b}if(i=pf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ji=pf(i.nextSibling),r=i.data===`F!`;break a}}Ii(r)}r=!1}r&&(t=n[0])}}return n=Do(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zo,lastRenderedState:t},n.queue=r,n=As.bind(null,G,r),r.dispatch=n,r=Uo(!1),a=Ms.bind(null,G,!1,r.queue),r=Do(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Go.bind(null,G,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function $o(e){return es(Oo(),co,e)}function es(e,t,n){if(t=Fo(e,t,Zo)[0],e=Po(No)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Ao(t)}catch(e){throw e===_a?ya:e}else r=t;t=Oo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(G.flags|=2048,rs(9,{destroy:void 0},ts.bind(null,i,n),null)),[r,a,e]}function ts(e,t){e.action=t}function ns(e){var t=Oo(),n=co;if(n!==null)return es(t,n,e);Oo(),t=t.memoizedState,n=Oo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=G.updateQueue,t===null&&(t=ko(),G.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function is(){return Oo().memoizedState}function as(e,t,n,r){var i=Do();G.flags|=e,i.memoizedState=rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function os(e,t,n,r){var i=Oo();r=r===void 0?null:r;var a=i.memoizedState.inst;co!==null&&r!==null&&yo(r,co.memoizedState.deps)?i.memoizedState=rs(t,a,n,r):(G.flags|=e,i.memoizedState=rs(1|t,a,n,r))}function ss(e,t){as(8390656,8,e,t)}function cs(e,t){os(2048,8,e,t)}function ls(e){G.flags|=4;var t=G.updateQueue;if(t===null)t=ko(),G.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function us(e){var t=Oo().memoizedState;return ls({ref:t,nextImpl:e}),function(){if(Rl&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function ds(e,t){return os(4,2,e,t)}function fs(e,t){return os(4,4,e,t)}function ps(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ms(e,t,n){n=n==null?null:n.concat([e]),os(4,4,ps.bind(null,t,e),n)}function hs(){}function gs(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&yo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function _s(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&yo(t,r[1]))return r[0];if(r=e(),po){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r}function vs(e,t,n){return n===void 0||so&1073741824&&!(q&261930)?e.memoizedState=t:(e.memoizedState=n,e=gu(),G.lanes|=e,Jl|=e,n)}function ys(e,t,n,r){return br(n,t)?n:qa.current===null?!(so&42)||so&1073741824&&!(q&261930)?(tc=!0,e.memoizedState=n):(e=gu(),G.lanes|=e,Jl|=e,t):(e=vs(e,n,r),br(e,t)||(tc=!0),e)}function bs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,Ms(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?js(e,t,fa(c,r),hu(e)):js(e,t,r,hu(e))}catch(n){js(e,t,{then:function(){},status:`rejected`,reason:n},hu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function xs(){}function Ss(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=Cs(e).queue;bs(e,i,t,ee,n===null?xs:function(){return ws(e),n(r)})}function Cs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ws(e){var t=Cs(e);t.next===null&&(t=e.alternate.memoizedState),js(e,t.next.queue,{},hu())}function Ts(){return Zi(rp)}function Es(){return Oo().memoizedState}function Ds(){return Oo().memoizedState}function Os(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=hu();e=Ra(n);var r=za(t,e,n);r!==null&&(_u(r,t,n),Ba(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function ks(e,t,n){var r=hu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ns(e)?Ps(t,n):(n=ei(e,t,n,r),n!==null&&(_u(n,e,r),Fs(n,t,r)))}function As(e,t,n){js(e,t,n,hu())}function js(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ns(e))Ps(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,br(s,o))return $r(e,t,i,0),zl===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return _u(n,e,r),Fs(n,t,r),!0}return!1}function Ms(e,t,n,r){if(r={lane:2,revertLane:md(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ns(e)){if(t)throw Error(o(479))}else t=ei(e,n,r,2),t!==null&&_u(t,e,2)}function Ns(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ps(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Is={readContext:Zi,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Is.useEffectEvent=vo;var Ls={readContext:Zi,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,useEffect:ss,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),as(4194308,4,ps.bind(null,t,e),n)},useLayoutEffect:function(e,t){return as(4194308,4,e,t)},useInsertionEffect:function(e,t){as(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){Ie(!0);try{n(t)}finally{Ie(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ks.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=As.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:hs,useDeferredValue:function(e,t){return vs(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=bs.bind(null,G,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,i=Do();if(Mi){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),zl===null)throw Error(o(349));q&127||Ro(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ss(Bo.bind(null,r,a,e),[e]),r.flags|=2048,rs(9,{destroy:void 0},zo.bind(null,r,a,n,t),null),n},useId:function(){var e=Do(),t=zl.identifierPrefix;if(Mi){var n=Ti,r=wi;n=(r&~(1<<32-Le(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=_o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ts,useFormState:Qo,useActionState:Qo,useOptimistic:function(e){var t=Do();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ms.bind(null,G,!0,n),n.dispatch=t,[e,t]},useMemoCache:Mo,useCacheRefresh:function(){return Do().memoizedState=Os.bind(null,G)},useEffectEvent:function(e){var t=Do(),n={impl:e};return t.memoizedState=n,function(){if(Rl&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Rs={readContext:Zi,use:jo,useCallback:gs,useContext:Zi,useEffect:cs,useImperativeHandle:ms,useInsertionEffect:ds,useLayoutEffect:fs,useMemo:_s,useReducer:Po,useRef:is,useState:function(){return Po(No)},useDebugValue:hs,useDeferredValue:function(e,t){return ys(Oo(),co.memoizedState,e,t)},useTransition:function(){var e=Po(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:Es,useHostTransitionStatus:Ts,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){return Wo(Oo(),co,e,t)},useMemoCache:Mo,useCacheRefresh:Ds};Rs.useEffectEvent=us;var zs={readContext:Zi,use:jo,useCallback:gs,useContext:Zi,useEffect:cs,useImperativeHandle:ms,useInsertionEffect:ds,useLayoutEffect:fs,useMemo:_s,useReducer:Io,useRef:is,useState:function(){return Io(No)},useDebugValue:hs,useDeferredValue:function(e,t){var n=Oo();return co===null?vs(n,e,t):ys(n,co.memoizedState,e,t)},useTransition:function(){var e=Io(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:Es,useHostTransitionStatus:Ts,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){var n=Oo();return co===null?(n.baseState=e,[e,n.queue.dispatch]):Wo(n,co,e,t)},useMemoCache:Mo,useCacheRefresh:Ds};zs.useEffectEvent=us;function Bs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Vs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ra(r);i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(_u(t,e,r),Ba(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ra(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(_u(t,e,r),Ba(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=hu(),r=Ra(n);r.tag=2,t!=null&&(r.callback=t),t=za(e,r,n),t!==null&&(_u(t,e,n),Ba(t,e,n))}};function Hs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!xr(n,r)||!xr(i,a):!0}function Us(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Vs.enqueueReplaceState(t,t.state,null)}function Ws(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Gs(e){Jr(e)}function Ks(e){console.error(e)}function qs(e){Jr(e)}function Js(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ys(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Xs(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){Js(e,t)},n}function Zs(e){return e=Ra(e),e.tag=3,e}function Qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ys(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ys(t,n,r),typeof i!=`function`&&(ou===null?ou=new Set([this]):ou.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function $s(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&U(t,n,i,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?ku():n.alternate===null&&ql===0&&(ql=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Ju(e,r,i)),!1;case 22:return n.flags|=65536,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Ju(e,r,i)),!1}throw Error(o(435,n.tag))}return Ju(e,r,i),ku(),!1}if(Mi)return t=Qa.current,t===null?(r!==Fi&&(t=Error(o(423),{cause:r}),Hi(gi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=gi(r,n),i=Xs(e.stateNode,r,i),Va(e,i),ql!==4&&(ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Fi&&(e=Error(o(422),{cause:r}),Hi(gi(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=gi(a,n),$l===null?$l=[a]:$l.push(a),ql!==4&&(ql=2),t===null)return!0;r=gi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Xs(n.stateNode,r,e),Va(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(ou===null||!ou.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Zs(i),Qs(i,e,n,r),Va(n,i),!1}n=n.return}while(n!==null);return!1}var ec=Error(o(461)),tc=!1;function nc(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function rc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Xi(t),r=bo(e,t,n,o,a,i),s=wo(),e!==null&&!tc?(To(e,t,i),Dc(e,t,i)):(Mi&&s&&Di(t),t.flags|=1,nc(e,t,r,i),t.child)}function ic(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ac(e,t,a,r,i)):(e=ui(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Oc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?xr:n,n(o,r)&&e.ref===t.ref)return Dc(e,t,i)}return t.flags|=1,e=ci(a,r),e.ref=t.ref,e.return=t,t.child=e}function ac(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(xr(a,r)&&e.ref===t.ref){if(tc=!1,t.pendingProps=r=a,Oc(e,i))e.flags&131072&&(tc=!0);else return t.lanes=e.lanes,Dc(e,t,i)}}return pc(e,t,n,r,i)}function oc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return cc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&W(t,a===null?null:a.cachePool),a===null?Xa():Ya(t,a),no(t);else return r=t.lanes=536870912,cc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&W(t,null),Xa(),ro(t)):(W(t,a.cachePool),Ya(t,a),ro(t),t.memoizedState=null);return nc(e,t,i,n),t.child}function sc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function cc(e,t,n,r,i){var a=ha();return a=a===null?null:{parent:ra._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&W(t,null),Xa(),no(t),e!==null&&U(e,t,r,!0),t.childLanes=i,null}function lc(e,t){return t=Sc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function uc(e,t,n){return Na(t,e.child,null,n),e=lc(t,t.pendingProps),e.flags|=2,io(t),t.memoizedState=null,e}function dc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(Mi){if(r.mode===`hidden`)return e=lc(t,r),t.lanes=536870912,sc(null,e);if(to(t),(e=ji)?(e=lf(e,Pi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Ii(t);return t.lanes=536870912,null}return lc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(to(t),i){if(t.flags&256)t.flags&=-257,t=uc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558))}else if(tc||U(e,t,n,!1),i=(n&e.childLanes)!==0,tc||i){if(r=zl,r!==null&&(s=et(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,ti(e,s),_u(r,e,s),ec;ku(),t=uc(e,t,n)}else e=a.treeContext,ji=pf(s.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=lc(t,r),t.flags|=4096;return t}return e=ci(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function pc(e,t,n,r,i){return Xi(t),n=bo(e,t,n,r,void 0,i),r=wo(),e!==null&&!tc?(To(e,t,i),Dc(e,t,i)):(Mi&&r&&Di(t),t.flags|=1,nc(e,t,n,i),t.child)}function mc(e,t,n,r,i,a){return Xi(t),t.updateQueue=null,n=So(t,r,n,i),xo(e),r=wo(),e!==null&&!tc?(To(e,t,a),Dc(e,t,a)):(Mi&&r&&Di(t),t.flags|=1,nc(e,t,n,a),t.child)}function hc(e,t,n,r,i){if(Xi(t),t.stateNode===null){var a=ii,o=n.contextType;typeof o==`object`&&o&&(a=Zi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Vs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ia(t),o=n.contextType,a.context=typeof o==`object`&&o?Zi(o):ii,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Bs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Vs.enqueueReplaceState(a,a.state,null),Wa(t,r,a,i),Ua(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ws(n,s);a.props=c;var l=a.context,u=n.contextType;o=ii,typeof u==`object`&&u&&(o=Zi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Us(t,a,r,o),Fa=!1;var f=t.memoizedState;a.state=f,Wa(t,r,a,i),Ua(),l=t.memoizedState,s||f!==l||Fa?(typeof d==`function`&&(Bs(t,n,d,r),l=t.memoizedState),(c=Fa||Hs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,La(e,t),o=t.memoizedProps,u=Ws(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ii,typeof l==`object`&&l&&(c=Zi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Us(t,a,r,c),Fa=!1,f=t.memoizedState,a.state=f,Wa(t,r,a,i),Ua();var p=t.memoizedState;o!==d||f!==p||Fa||e!==null&&e.dependencies!==null&&Yi(e.dependencies)?(typeof s==`function`&&(Bs(t,n,s,r),p=t.memoizedState),(u=Fa||Hs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Yi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,fc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Na(t,e.child,null,i),t.child=Na(t,null,n,i)):nc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Dc(e,t,i),e}function gc(e,t,n,r){return Bi(),t.flags|=256,nc(e,t,n,r),t.child}var _c={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vc(e){return{baseLanes:e,cachePool:ga()}}function yc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Zl),e}function bc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:!!(ao.current&2)),s&&(i=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Mi){if(i?eo(t):ro(t),(e=ji)?(e=lf(e,Pi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Ii(t);return df(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(ro(t),i=t.mode,c=Sc({mode:`hidden`,children:c},i),r=di(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=vc(n),r.childLanes=yc(e,s,n),t.memoizedState=_c,sc(null,r)):(eo(t),xc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(eo(t),t.flags&=-257,t=Cc(e,t,n)):t.memoizedState===null?(ro(t),c=r.fallback,i=t.mode,r=Sc({mode:`visible`,children:r.children},i),c=di(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Na(t,e.child,null,n),r=t.child,r.memoizedState=vc(n),r.childLanes=yc(e,s,n),t.memoizedState=_c,t=sc(null,r)):(ro(t),t.child=e.child,t.flags|=128,t=null);else if(eo(t),df(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(o(419)),r.stack=``,r.digest=s,Hi({value:r,source:null,stack:null}),t=Cc(e,t,n)}else if(tc||U(e,t,n,!1),s=(n&e.childLanes)!==0,tc||s){if(s=zl,s!==null&&(r=et(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ti(e,r),_u(s,e,r),ec;uf(c)||ku(),t=Cc(e,t,n)}else uf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ji=pf(c.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=xc(t,r.children),t.flags|=4096);return t}return i?(ro(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ci(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=di(c,i,n,null),c.flags|=2):c=ci(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,sc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=vc(n):(i=c.cachePool,i===null?i=ga():(l=ra._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=yc(e,s,n),t.memoizedState=_c,sc(e.child,r)):(eo(t),n=e.child,e=n.sibling,n=ci(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function xc(e,t){return t=Sc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Sc(e,t){return e=oi(22,e,null,t),e.lanes=0,e}function Cc(e,t,n){return Na(t,e.child,null,n),e=xc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qi(e.return,t,n)}function Tc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Ec(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ao.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ie(ao,o),nc(e,t,r,n),r=Mi?bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wc(e,n,t);else if(e.tag===19)wc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Tc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Tc(t,!0,n,null,a,r);break;case`together`:Tc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Dc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(U(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=ci(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ci(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Oc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Yi(e)))}function kc(e,t,n){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),Gi(t,ra,e.memoizedState.cache),Bi();break;case 27:case 5:de(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:Gi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(eo(t),e=Dc(e,t,n),e===null?null:e.sibling):bc(e,t,n):(eo(t),t.flags|=128,null);eo(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(U(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Ec(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ie(ao,ao.current),r)break;return null;case 22:return t.lanes=0,oc(e,t,n,t.pendingProps);case 24:Gi(t,ra,e.memoizedState.cache)}return Dc(e,t,n)}function Ac(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)tc=!0;else{if(!Oc(e,n)&&!(t.flags&128))return tc=!1,kc(e,t,n);tc=!!(e.flags&131072)}}else tc=!1,Mi&&t.flags&1048576&&V(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ca(t.elementType),t.type=e,typeof e==`function`)si(e)?(r=Ws(e,r),t.tag=1,t=hc(null,t,e,r,n)):(t.tag=0,t=pc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=rc(null,t,e,r,n);break a}if(i===D){t.tag=14,t=ic(null,t,e,r,n);break a}}throw t=P(e)||e,Error(o(306,t,``))}}return t;case 0:return pc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Ws(r,t.pendingProps),hc(e,t,r,i,n);case 3:a:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,La(e,t),Wa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Gi(t,ra,r),r!==a.cache&&Ji(t,[ra],n,!0),Ua(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=gc(e,t,r,n);break a}if(r!==i){i=gi(Error(o(424)),t),Hi(i),t=gc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ji=pf(e.firstChild),Ai=t,Mi=!0,Ni=null,Pi=!0,n=Pa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Bi(),r===i){t=Dc(e,t,n);break a}nc(e,t,r,n)}t=t.child}return t;case 26:return fc(e,t),e===null?(n=Pf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Mi||(n=t.type,e=t.pendingProps,r=Gd(se.current).createElement(n),r[ot]=t,r[st]=e,zd(r,n,e),yt(r),t.stateNode=r):t.memoizedState=Pf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return de(t),e===null&&Mi&&(r=t.stateNode=_f(t.type,t.pendingProps,se.current),Ai=t,Pi=!0,i=ji,nf(t.type)?(mf=i,ji=pf(r.firstChild)):ji=i),nc(e,t,t.pendingProps.children,n),fc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Mi&&((i=r=ji)&&(r=sf(r,t.type,t.pendingProps,Pi),r===null?i=!1:(t.stateNode=r,Ai=t,ji=pf(r.firstChild),Pi=!1,i=!0)),i||Ii(t)),de(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,Jd(i,a)?r=null:s!==null&&Jd(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=bo(e,t,Co,null,null,n),rp._currentValue=i),fc(e,t),nc(e,t,r,n),t.child;case 6:return e===null&&Mi&&((e=n=ji)&&(n=cf(n,t.pendingProps,Pi),n===null?e=!1:(t.stateNode=n,Ai=t,ji=null,e=!0)),e||Ii(t)),null;case 13:return bc(e,t,n);case 4:return le(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Na(t,null,r,n):nc(e,t,r,n),t.child;case 11:return rc(e,t,t.type,t.pendingProps,n);case 7:return nc(e,t,t.pendingProps,n),t.child;case 8:return nc(e,t,t.pendingProps.children,n),t.child;case 12:return nc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Gi(t,t.type,r.value),nc(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Xi(t),i=Zi(i),r=r(i),t.flags|=1,nc(e,t,r,n),t.child;case 14:return ic(e,t,t.type,t.pendingProps,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 19:return Ec(e,t,n);case 31:return dc(e,t,n);case 22:return oc(e,t,n,t.pendingProps);case 24:return Xi(t),r=Zi(ra),e===null?(i=ha(),i===null&&(i=zl,a=ia(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Ia(t),Gi(t,ra,i)):((e.lanes&n)!==0&&(La(e,t),Wa(t,null,null,n),Ua()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Gi(t,ra,r),r!==i.cache&&Ji(t,[ra],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Gi(t,ra,r))),nc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function jc(e){e.flags|=4}function Mc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Eu())e.flags|=8192;else throw wa=ba,va}}else e.flags&=-16777217}function Nc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Yf(t)){if(Eu())e.flags|=8192;else throw wa=ba,va}}function Pc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Je(),e.lanes|=t,Ql|=t)}function Fc(e,t){if(!Mi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ic(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Lc(e,t,n){var r=t.pendingProps;switch(Oi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ic(t),null;case 1:return Ic(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ki(ra),ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(zi(t)?jc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Vi())),Ic(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(jc(t),a===null?(Ic(t),Mc(t,i,null,r,n)):(Ic(t),Nc(t,a))):a?a===e.memoizedState?(Ic(t),t.flags&=-16777217):(jc(t),Ic(t),Nc(t,a)):(e=e.memoizedProps,e!==r&&jc(t),Ic(t),Mc(t,i,e,r,n)),null;case 27:if(fe(t),n=se.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Ic(t),null}e=ae.current,zi(t)?Li(t,e):(e=_f(i,r,n),t.stateNode=e,jc(t))}return Ic(t),null;case 5:if(fe(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Ic(t),null}if(a=ae.current,zi(t))Li(t,a);else{var s=Gd(se.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[ot]=t,a[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(zd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&jc(t)}}return Ic(t),Mc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=se.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ai,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||Ii(t,!0)}else e=Gd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Ic(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[ot]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(o(558))}return Ic(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[ot]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),i=!1}else i=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Pc(t,t.updateQueue),Ic(t),null);case 4:return ue(),e===null&&Ed(t.stateNode.containerInfo),Ic(t),null;case 10:return Ki(t.type),Ic(t),null;case 19:if(R(ao),r=t.memoizedState,r===null)return Ic(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Fc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=oo(e),a!==null){for(t.flags|=128,Fc(r,!1),e=a.updateQueue,t.updateQueue=e,Pc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return ie(ao,ao.current&1|2),Mi&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Te()>iu&&(t.flags|=128,i=!0,Fc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=oo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Pc(t,e),Fc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!Mi)return Ic(t),null}else 2*Te()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,i=!0,Fc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Ic(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,n=ao.current,ie(ao,i?n&1|2:n&1),Mi&&Ei(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ic(t),t.subtreeFlags&6&&(t.flags|=8192)):Ic(t),n=t.updateQueue,n!==null&&Pc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ki(ra),Ic(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Rc(e,t){switch(Oi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ki(ra),ue(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fe(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(o(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(ao),null;case 4:return ue(),null;case 10:return Ki(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&R(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ki(ra),null;case 25:return null;default:return null}}function zc(e,t){switch(Oi(t),t.tag){case 3:Ki(ra),ue();break;case 26:case 27:case 5:fe(t);break;case 4:ue();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:R(ao);break;case 10:Ki(t.type);break;case 22:case 23:io(t),Za(),e!==null&&R(ma);break;case 24:Ki(ra)}}function Bc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){qu(t,t.return,e)}}function Vc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){qu(t,t.return,e)}}function Hc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){qu(e,e.return,t)}}}function Uc(e,t,n){n.props=Ws(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){qu(e,t,n)}}function Wc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){qu(e,t,n)}}function Gc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){qu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){qu(e,t,n)}else n.current=null}}function Kc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){qu(e,e.return,t)}}function qc(e,t,n){try{var r=e.stateNode;Bd(r,e.type,n,t),r[st]=t}catch(t){qu(e,e.return,t)}}function Jc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&nf(e.type)||e.tag===4}function Yc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&nf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$t));else if(r!==4&&(r===27&&nf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&nf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zd(t,r,n),t[ot]=e,t[st]=n}catch(t){qu(e,e.return,t)}}var $c=!1,el=!1,tl=!1,nl=typeof WeakSet==`function`?WeakSet:Set,rl=null;function il(e,t){if(e=e.containerInfo,Ud=fp,e=Tr(e),Er(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==a||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===a&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Wd={focusedElem:e,selectionRange:n},fp=!1,rl=t;rl!==null;)if(t=rl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,rl=e;else for(;rl!==null;){switch(t=rl,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Ws(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){qu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)of(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:of(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,rl=e;break}rl=t.return}}function al(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:bl(e,n),r&4&&Bc(5,n);break;case 1:if(bl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){qu(n,n.return,e)}else{var i=Ws(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){qu(n,n.return,e)}}}r&64&&Hc(n),r&512&&Wc(n,n.return);break;case 3:if(bl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ka(e,t)}catch(e){qu(n,n.return,e)}}break;case 27:t===null&&r&4&&Qc(n);case 26:case 5:bl(e,n),t===null&&r&4&&Kc(n),r&512&&Wc(n,n.return);break;case 12:bl(e,n);break;case 31:bl(e,n),r&4&&dl(e,n);break;case 13:bl(e,n),r&4&&fl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Zu.bind(null,n),ff(e,n))));break;case 22:if(r=n.memoizedState!==null||$c,!r){t=t!==null&&t.memoizedState!==null||el,i=$c;var a=el;$c=r,(el=t)&&!a?Sl(e,n,!!(n.subtreeFlags&8772)):bl(e,n),$c=i,el=a}break;case 30:break;default:bl(e,n)}}function ol(e){var t=e.alternate;t!==null&&(e.alternate=null,ol(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var sl=null,cl=!1;function ll(e,t,n){for(n=n.child;n!==null;)ul(e,t,n),n=n.sibling}function ul(e,t,n){if(Fe&&typeof Fe.onCommitFiberUnmount==`function`)try{Fe.onCommitFiberUnmount(Pe,n)}catch{}switch(n.tag){case 26:el||Gc(n,t),ll(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:el||Gc(n,t);var r=sl,i=cl;nf(n.type)&&(sl=n.stateNode,cl=!1),ll(e,t,n),vf(n.stateNode),sl=r,cl=i;break;case 5:el||Gc(n,t);case 6:if(r=sl,i=cl,sl=null,ll(e,t,n),sl=r,cl=i,sl!==null){if(cl)try{(sl.nodeType===9?sl.body:sl.nodeName===`HTML`?sl.ownerDocument.body:sl).removeChild(n.stateNode)}catch(e){qu(n,t,e)}else try{sl.removeChild(n.stateNode)}catch(e){qu(n,t,e)}}break;case 18:sl!==null&&(cl?(e=sl,rf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Rp(e)):rf(sl,n.stateNode));break;case 4:r=sl,i=cl,sl=n.stateNode.containerInfo,cl=!0,ll(e,t,n),sl=r,cl=i;break;case 0:case 11:case 14:case 15:Vc(2,n,t),el||Vc(4,n,t),ll(e,t,n);break;case 1:el||(Gc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Uc(n,t,r)),ll(e,t,n);break;case 21:ll(e,t,n);break;case 22:el=(r=el)||n.memoizedState!==null,ll(e,t,n),el=r;break;default:ll(e,t,n)}}function dl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Rp(e)}catch(e){qu(t,t.return,e)}}}function fl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Rp(e)}catch(e){qu(t,t.return,e)}}function pl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new nl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new nl),t;default:throw Error(o(435,e.tag))}}function ml(e,t){var n=pl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Qu.bind(null,e,t);t.then(r,r)}})}function hl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(nf(c.type)){sl=c.stateNode,cl=!1;break a}break;case 5:sl=c.stateNode,cl=!1;break a;case 3:case 4:sl=c.stateNode.containerInfo,cl=!0;break a}c=c.return}if(sl===null)throw Error(o(160));ul(a,s,i),sl=null,cl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_l(t,e),t=t.sibling}var gl=null;function _l(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:hl(t,e),vl(e),r&4&&(Vc(3,e,e.return),Bc(3,e),Vc(5,e,e.return));break;case 1:hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),r&64&&$c&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=gl;if(hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[pt]||a[ot]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),zd(a,r,n),a[ot]=e,yt(a),r=a;break a;case`link`:var s=Kf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}a=i.createElement(r),zd(a,r,n),i.head.appendChild(a);break;case`meta`:if(s=Kf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}a=i.createElement(r),zd(a,r,n),i.head.appendChild(a);break;default:throw Error(o(468,r))}a[ot]=e,yt(a),r=a}e.stateNode=r}else qf(i,e.type,e.stateNode)}else e.stateNode=Vf(i,r,e.memoizedProps)}else a===r?r===null&&e.stateNode!==null&&qc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?qf(i,e.type,e.stateNode):Vf(i,r,e.memoizedProps))}break;case 27:hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),n!==null&&r&4&&qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),e.flags&32){i=e.stateNode;try{Gt(i,``)}catch(t){qu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,qc(e,i,n===null?i:n.memoizedProps)),r&1024&&(tl=!0);break;case 6:if(hl(t,e),vl(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){qu(e,e.return,t)}}break;case 3:if(Gf=null,i=gl,gl=xf(t.containerInfo),hl(t,e),gl=i,vl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Rp(t.containerInfo)}catch(t){qu(e,e.return,t)}tl&&(tl=!1,yl(e));break;case 4:r=gl,gl=xf(e.stateNode.containerInfo),hl(t,e),vl(e),gl=r;break;case 12:hl(t,e),vl(e);break;case 31:hl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 13:hl(t,e),vl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nu=Te()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=$c,d=el;if($c=u||i,el=d||l,hl(t,e),el=d,$c=u,vl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||$c||el||xl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)s=a.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){qu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){qu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?af(m,!0):af(l.stateNode,!1)}catch(e){qu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ml(e,n))));break;case 19:hl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 30:break;case 21:break;default:hl(t,e),vl(e)}}function vl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Jc(r)){n=r;break}r=r.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var i=n.stateNode;Zc(e,Yc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Gt(a,``),n.flags&=-33),Zc(e,Yc(e),a);break;case 3:case 4:var s=n.stateNode.containerInfo;Xc(e,Yc(e),s);break;default:throw Error(o(161))}}catch(t){qu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function bl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)al(e,t.alternate,t),t=t.sibling}function xl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Vc(4,t,t.return),xl(t);break;case 1:Gc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Uc(t,t.return,n),xl(t);break;case 27:vf(t.stateNode);case 26:case 5:Gc(t,t.return),xl(t);break;case 22:t.memoizedState===null&&xl(t);break;case 30:xl(t);break;default:xl(t)}e=e.sibling}}function Sl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Sl(i,a,n),Bc(4,a);break;case 1:if(Sl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){qu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ga(c[i],s)}catch(e){qu(r,r.return,e)}}n&&o&64&&Hc(a),Wc(a,a.return);break;case 27:Qc(a);case 26:case 5:Sl(i,a,n),n&&r===null&&o&4&&Kc(a),Wc(a,a.return);break;case 12:Sl(i,a,n);break;case 31:Sl(i,a,n),n&&o&4&&dl(i,a);break;case 13:Sl(i,a,n),n&&o&4&&fl(i,a);break;case 22:a.memoizedState===null&&Sl(i,a,n),Wc(a,a.return);break;case 30:break;default:Sl(i,a,n)}t=t.sibling}}function Cl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&aa(n))}function wl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e))}function Tl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)El(e,t,n,r),t=t.sibling}function El(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Tl(e,t,n,r),i&2048&&Bc(9,t);break;case 1:Tl(e,t,n,r);break;case 3:Tl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e)));break;case 12:if(i&2048){Tl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){qu(t,t.return,e)}}else Tl(e,t,n,r);break;case 31:Tl(e,t,n,r);break;case 13:Tl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Tl(e,t,n,r):(a._visibility|=2,Dl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Tl(e,t,n,r):Ol(e,t),i&2048&&Cl(o,t);break;case 24:Tl(e,t,n,r),i&2048&&wl(t.alternate,t);break;default:Tl(e,t,n,r)}}function Dl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Dl(a,o,s,c,i),Bc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Dl(a,o,s,c,i)):u._visibility&2?Dl(a,o,s,c,i):Ol(a,o),i&&l&2048&&Cl(o.alternate,o);break;case 24:Dl(a,o,s,c,i),i&&l&2048&&wl(o.alternate,o);break;default:Dl(a,o,s,c,i)}t=t.sibling}}function Ol(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ol(n,r),i&2048&&Cl(r.alternate,r);break;case 24:Ol(n,r),i&2048&&wl(r.alternate,r);break;default:Ol(n,r)}t=t.sibling}}var kl=8192;function Al(e,t,n){if(e.subtreeFlags&kl)for(e=e.child;e!==null;)jl(e,t,n),e=e.sibling}function jl(e,t,n){switch(e.tag){case 26:Al(e,t,n),e.flags&kl&&e.memoizedState!==null&&Xf(n,gl,e.memoizedState,e.memoizedProps);break;case 5:Al(e,t,n);break;case 3:case 4:var r=gl;gl=xf(e.stateNode.containerInfo),Al(e,t,n),gl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=kl,kl=16777216,Al(e,t,n),kl=r):Al(e,t,n));break;default:Al(e,t,n)}}function Ml(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Fl(r,e)}Ml(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)K(e),e=e.sibling}function K(e){switch(e.tag){case 0:case 11:case 15:Nl(e),e.flags&2048&&Vc(9,e,e.return);break;case 3:Nl(e);break;case 12:Nl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):Nl(e);break;default:Nl(e)}}function Pl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Fl(r,e)}Ml(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Vc(8,t,t.return),Pl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Fl(e,t){for(;rl!==null;){var n=rl;switch(n.tag){case 0:case 11:case 15:Vc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:aa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,rl=r;else a:for(n=e;rl!==null;){r=rl;var i=r.sibling,a=r.return;if(ol(r),r===n){rl=null;break a}if(i!==null){i.return=a,rl=i;break a}rl=a}}}var Il={getCacheForType:function(e){var t=Zi(ra),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Zi(ra).controller.signal}},Ll=typeof WeakMap==`function`?WeakMap:Map,Rl=0,zl=null,Bl=null,q=0,Vl=0,Hl=null,Ul=!1,Wl=!1,Gl=!1,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=null,eu=null,tu=!1,nu=0,ru=0,iu=1/0,au=null,ou=null,su=0,cu=null,lu=null,J=0,uu=0,du=null,fu=null,pu=0,mu=null;function hu(){return Rl&2&&q!==0?q&-q:I.T===null?rt():md()}function gu(){if(Zl===0){if(!(q&536870912)||Mi){var e=He;He<<=1,!(He&3932160)&&(He=262144),Zl=e}else Zl=536870912}return e=Qa.current,e!==null&&(e.flags|=32),Zl}function _u(e,t,n){(e===zl&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)&&(wu(e,0),xu(e,q,Zl,!1)),Xe(e,n),(!(Rl&2)||e!==zl)&&(e===zl&&(!(Rl&2)&&(Yl|=n),ql===4&&xu(e,q,Zl,!1)),od(e))}function vu(e,t,n){if(Rl&6)throw Error(o(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ke(e,t),i=r?Mu(e,t):Au(e,t,!0),a=r;do{if(i===0){Wl&&!r&&xu(e,t,0,!1);break}if(n=e.current.alternate,a&&!bu(n)){i=Au(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=$l;var l=c.current.memoizedState.isDehydrated;if(l&&(wu(c,s).flags|=256),s=Au(c,s,!1),s!==2){if(Gl&&!l){c.errorRecoveryDisabledLanes|=a,Yl|=a,i=4;break a}a=eu,eu=i,a!==null&&(eu===null?eu=a:eu.push.apply(eu,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){wu(e,0),xu(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:xu(r,t,Zl,!Ul);break a;case 2:eu=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=nu+300-Te(),10<i)){if(xu(r,t,Zl,!Ul),Ge(r,0,!0)!==0)break a;J=t,r.timeoutHandle=Zd(yu.bind(null,r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,a,`Throttled`,-0,0),i);break a}yu(r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,a,null,-0,0)}break}while(1);od(e)}function yu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$t},jl(t,a,d);var m=(a&62914560)===a?nu-Te():(a&4194048)===a?ru-Te():0;if(m=Qf(d,m),m!==null){J=a,e.cancelPendingCommit=m(zu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),xu(e,a,o,!l);return}}zu(e,t,a,n,r,i,o,s,c)}function bu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!br(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xu(e,t,n,r){t&=~Xl,t&=~Yl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Le(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Qe(e,n,t)}function Su(){return Rl&6?!0:(sd(0,!1),!1)}function Cu(){if(Bl!==null){if(Vl===0)var e=Bl.return;else e=Bl,Wi=H=null,Eo(e),Da=null,Oa=0,e=Bl;for(;e!==null;)zc(e.alternate,e),e=e.return;Bl=null}}function wu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),J=0,Cu(),zl=e,Bl=n=ci(e.current,null),q=t,Vl=0,Hl=null,Ul=!1,Wl=Ke(e,t),Gl=!1,Ql=Zl=Xl=Yl=Jl=ql=0,eu=$l=null,tu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Le(r),a=1<<i;t|=e[i],r&=~a}return Kl=t,Qr(),n}function Tu(e,t){G=null,I.H=Is,t===_a||t===ya?(t=Ta(),Vl=3):t===va?(t=Ta(),Vl=4):Vl=t===ec?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Hl=t,Bl===null&&(ql=1,Js(e,gi(t,e.current)))}function Eu(){var e=Qa.current;return e===null?!0:(q&4194048)===q?$a===null:(q&62914560)===q||q&536870912?e===$a:!1}function Du(){var e=I.H;return I.H=Is,e===null?Is:e}function Ou(){var e=I.A;return I.A=Il,e}function ku(){ql=4,Ul||(q&4194048)!==q&&Qa.current!==null||(Wl=!0),!(Jl&134217727)&&!(Yl&134217727)||zl===null||xu(zl,q,Zl,!1)}function Au(e,t,n){var r=Rl;Rl|=2;var i=Du(),a=Ou();(zl!==e||q!==t)&&(au=null,wu(e,t)),t=!1;var o=ql;a:do try{if(Vl!==0&&Bl!==null){var s=Bl,c=Hl;switch(Vl){case 8:Cu(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=Vl;if(Vl=0,Hl=null,Iu(e,s,c,l),n&&Wl){o=0;break a}break;default:l=Vl,Vl=0,Hl=null,Iu(e,s,c,l)}}ju(),o=ql;break}catch(t){Tu(e,t)}while(1);return t&&e.shellSuspendCounter++,Wi=H=null,Rl=r,I.H=i,I.A=a,Bl===null&&(zl=null,q=0,Qr()),o}function ju(){for(;Bl!==null;)Pu(Bl)}function Mu(e,t){var n=Rl;Rl|=2;var r=Du(),i=Ou();zl!==e||q!==t?(au=null,iu=Te()+500,wu(e,t)):Wl=Ke(e,t);a:do try{if(Vl!==0&&Bl!==null){t=Bl;var a=Hl;b:switch(Vl){case 1:Vl=0,Hl=null,Iu(e,t,a,1);break;case 2:case 9:if(xa(a)){Vl=0,Hl=null,Fu(t);break}t=function(){Vl!==2&&Vl!==9||zl!==e||(Vl=7),od(e)},a.then(t,t);break a;case 3:Vl=7;break a;case 4:Vl=5;break a;case 7:xa(a)?(Vl=0,Hl=null,Fu(t)):(Vl=0,Hl=null,Iu(e,t,a,7));break;case 5:var s=null;switch(Bl.tag){case 26:s=Bl.memoizedState;case 5:case 27:var c=Bl;if(s?Yf(s):c.stateNode.complete){Vl=0,Hl=null;var l=c.sibling;if(l!==null)Bl=l;else{var u=c.return;u===null?Bl=null:(Bl=u,Lu(u))}break b}}Vl=0,Hl=null,Iu(e,t,a,5);break;case 6:Vl=0,Hl=null,Iu(e,t,a,6);break;case 8:Cu(),ql=6;break a;default:throw Error(o(462))}}Nu();break}catch(t){Tu(e,t)}while(1);return Wi=H=null,I.H=r,I.A=i,Rl=n,Bl===null?(zl=null,q=0,Qr(),ql):0}function Nu(){for(;Bl!==null&&!Ce();)Pu(Bl)}function Pu(e){var t=Ac(e.alternate,e,Kl);e.memoizedProps=e.pendingProps,t===null?Lu(e):Bl=t}function Fu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=mc(n,t,t.pendingProps,t.type,void 0,q);break;case 11:t=mc(n,t,t.pendingProps,t.type.render,t.ref,q);break;case 5:Eo(t);default:zc(n,t),t=Bl=li(t,Kl),t=Ac(n,t,Kl)}e.memoizedProps=e.pendingProps,t===null?Lu(e):Bl=t}function Iu(e,t,n,r){Wi=H=null,Eo(t),Da=null,Oa=0;var i=t.return;try{if($s(e,i,t,n,q)){ql=1,Js(e,gi(n,e.current)),Bl=null;return}}catch(t){if(i!==null)throw Bl=i,t;ql=1,Js(e,gi(n,e.current)),Bl=null;return}t.flags&32768?(Mi||r===1?e=!0:Wl||q&536870912?e=!1:(Ul=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ru(t,e)):Lu(t)}function Lu(e){var t=e;do{if(t.flags&32768){Ru(t,Ul);return}e=t.return;var n=Lc(t.alternate,t,Kl);if(n!==null){Bl=n;return}if(t=t.sibling,t!==null){Bl=t;return}Bl=t=e}while(t!==null);ql===0&&(ql=5)}function Ru(e,t){do{var n=Rc(e.alternate,e);if(n!==null){n.flags&=32767,Bl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Bl=e;return}Bl=e=n}while(e!==null);ql=6,Bl=null}function zu(e,t,n,r,i,a,s,c,l){e.cancelPendingCommit=null;do Wu();while(su!==0);if(Rl&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(a=t.lanes|t.childLanes,a|=Zr,Ze(e,n,a,s,c,l),e===zl&&(Bl=zl=null,q=0),lu=t,cu=e,J=n,uu=a,du=i,fu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,$u(ke,function(){return Gu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=I.T,I.T=null,i=L.p,L.p=2,s=Rl,Rl|=4;try{il(e,t,n)}finally{Rl=s,L.p=i,I.T=r}}su=1,Bu(),Vu(),Hu()}}function Bu(){if(su===1){su=0;var e=cu,t=lu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Rl;Rl|=4;try{_l(t,e);var a=Wd,o=Tr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&wr(s.ownerDocument.documentElement,s)){if(c!==null&&Er(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Cr(s,h),v=Cr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}fp=!!Ud,Wd=Ud=null}finally{Rl=i,L.p=r,I.T=n}}e.current=t,su=2}}function Vu(){if(su===2){su=0;var e=cu,t=lu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Rl;Rl|=4;try{al(e,t.alternate,t)}finally{Rl=i,L.p=r,I.T=n}}su=3}}function Hu(){if(su===4||su===3){su=0,we();var e=cu,t=lu,n=J,r=fu;t.subtreeFlags&10256||t.flags&10256?su=5:(su=0,lu=cu=null,Uu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ou=null),nt(n),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot==`function`)try{Fe.onCommitFiberRoot(Pe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}J&3&&Wu(),od(e),i=e.pendingLanes,n&261930&&i&42?e===mu?pu++:(pu=0,mu=e):pu=0,sd(0,!1)}}function Uu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,aa(t)))}function Wu(){return Bu(),Vu(),Hu(),Gu()}function Gu(){if(su!==5)return!1;var e=cu,t=uu;uu=0;var n=nt(J),r=I.T,i=L.p;try{L.p=32>n?32:n,I.T=null,n=du,du=null;var a=cu,s=J;if(su=0,lu=cu=null,J=0,Rl&6)throw Error(o(331));var c=Rl;if(Rl|=4,K(a.current),El(a,a.current,s,n),Rl=c,sd(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot==`function`)try{Fe.onPostCommitFiberRoot(Pe,a)}catch{}return!0}finally{L.p=i,I.T=r,Uu(e,t)}}function Ku(e,t,n){t=gi(n,t),t=Xs(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Xe(e,2),od(e))}function qu(e,t,n){if(e.tag===3)Ku(e,e,n);else for(;t!==null;){if(t.tag===3){Ku(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=gi(n,e),n=Zs(2),r=za(t,n,2),r!==null&&(Qs(n,r,t,e),Xe(r,2),od(r));break}}t=t.return}}function Ju(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ll;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Gl=!0,i.add(n),e=Yu.bind(null,e,t,n),t.then(e,e))}function Yu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,zl===e&&(q&n)===n&&(ql===4||ql===3&&(q&62914560)===q&&300>Te()-nu?!(Rl&2)&&wu(e,0):Xl|=n,Ql===q&&(Ql=0)),od(e)}function Xu(e,t){t===0&&(t=Je()),e=ti(e,t),e!==null&&(Xe(e,t),od(e))}function Zu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xu(e,n)}function Qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),Xu(e,n)}function $u(e,t){return xe(e,t)}var ed=null,td=null,nd=!1,rd=!1,id=!1,ad=0;function od(e){e!==td&&e.next===null&&(td===null?ed=td=e:td=td.next=e),rd=!0,nd||(nd=!0,pd())}function sd(e,t){if(!id&&rd){id=!0;do for(var n=!1,r=ed;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Le(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,fd(r,a))}else a=q,a=Ge(r,r===zl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ke(r,a)||(n=!0,fd(r,a))}r=r.next}while(n);id=!1}}function cd(){ld()}function ld(){rd=nd=!1;var e=0;ad!==0&&Xd()&&(e=ad);for(var t=Te(),n=null,r=ed;r!==null;){var i=r.next,a=ud(r,t);a===0?(r.next=null,n===null?ed=i:n.next=i,i===null&&(td=n)):(n=r,(e!==0||a&3)&&(rd=!0)),r=i}su!==0&&su!==5||sd(e,!1),ad!==0&&(ad=0)}function ud(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Le(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=qe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=zl,n=q,n=Ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Se(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ke(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Se(r),nt(n)){case 2:case 8:n=Oe;break;case 32:n=ke;break;case 268435456:n=je;break;default:n=ke}return r=dd.bind(null,e),n=xe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Se(r),e.callbackPriority=2,e.callbackNode=null,2}function dd(e,t){if(su!==0&&su!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wu()&&e.callbackNode!==n)return null;var r=q;return r=Ge(e,e===zl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(vu(e,r,t),ud(e,Te()),e.callbackNode!=null&&e.callbackNode===n?dd.bind(null,e):null)}function fd(e,t){if(Wu())return null;vu(e,t,!0)}function pd(){ef(function(){Rl&6?xe(De,cd):ld()})}function md(){if(ad===0){var e=ca;e===0&&(e=Ve,Ve<<=1,!(Ve&261888)&&(Ve=256)),ad=e}return ad}function hd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Qt(``+e)}function gd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function _d(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=hd((i[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?hd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ad!==0){var e=o?gd(i,o):new FormData(i);Ss(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?gd(i,o):new FormData(i),Ss(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var vd=0;vd<Kr.length;vd++){var yd=Kr[vd];qr(yd.toLowerCase(),`on`+(yd[0].toUpperCase()+yd.slice(1)))}qr(Rr,`onAnimationEnd`),qr(zr,`onAnimationIteration`),qr(Br,`onAnimationStart`),qr(`dblclick`,`onDoubleClick`),qr(`focusin`,`onFocus`),qr(`focusout`,`onBlur`),qr(Vr,`onTransitionRun`),qr(Hr,`onTransitionStart`),qr(Ur,`onTransitionCancel`),qr(Wr,`onTransitionEnd`),Ct(`onMouseEnter`,[`mouseout`,`mouseover`]),Ct(`onMouseLeave`,[`mouseout`,`mouseover`]),Ct(`onPointerEnter`,[`pointerout`,`pointerover`]),Ct(`onPointerLeave`,[`pointerout`,`pointerover`]),St(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),St(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),St(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),St(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var bd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),xd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(bd));function Sd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}}}}function Cd(e,t){var n=t[lt];n===void 0&&(n=t[lt]=new Set);var r=e+`__bubble`;n.has(r)||(Dd(t,e,2,!1),n.add(r))}function wd(e,t,n){var r=0;t&&(r|=4),Dd(n,e,r,t)}var Td=`_reactListening`+Math.random().toString(36).slice(2);function Ed(e){if(!e[Td]){e[Td]=!0,bt.forEach(function(t){t!==`selectionchange`&&(xd.has(t)||wd(t,!1,e),wd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Td]||(t[Td]=!0,wd(`selectionchange`,!1,t))}}function Dd(e,t,n,r){switch(yp(t)){case 2:var i=pp;break;case 8:i=mp;break;default:i=hp}n=i.bind(null,t,n,e),i=void 0,!un||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Od(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=ht(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}sn(function(){var r=a,i=tn(n),o=[];a:{var s=Gr.get(e);if(s!==void 0){var c=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:c=Rn;break;case`focusin`:u=`focus`,c=z;break;case`focusout`:u=`blur`,c=z;break;case`beforeblur`:case`afterblur`:c=z;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Bn;break;case Rr:case zr:case Br:c=An;break;case Wr:c=Vn;break;case`scroll`:case`scrollend`:c=Cn;break;case`wheel`:c=Hn;break;case`copy`:case`cut`:case`paste`:c=jn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=zn;break;case`toggle`:case`beforetoggle`:c=Un}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=cn(m,p),g!=null&&d.push(kd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==en&&(u=n.relatedTarget||n.fromElement)&&(ht(u)||u[ct]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?ht(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:_t(c),h=u==null?s:_t(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,ht(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=jd,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&Md(o,s,c,d,!1),u!==null&&f!==null&&Md(o,f,u,d,!0)}}a:{if(s=r?_t(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=lr;else if(rr(s)){if(ur)v=B;else{v=_r;var y=gr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Yt(r.elementType)&&(v=lr):v=vr;if(v&&=v(e,r)){ir(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Vt(s,`number`,s.value)}switch(y=r?_t(r):window,e){case`focusin`:(rr(y)||y.contentEditable===`true`)&&(Or=y,kr=r,Ar=null);break;case`focusout`:Ar=kr=Or=null;break;case`mousedown`:jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:jr=!1,Mr(o,n,i);break;case`selectionchange`:if(Dr)break;case`keydown`:case`keyup`:Mr(o,n,i)}var b;if(Gn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else $n?Zn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Jn&&n.locale!==`ko`&&($n||x!==`onCompositionStart`?x===`onCompositionEnd`&&$n&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,$n=!0)),y=Ad(r,x),0<y.length&&(x=new Mn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Qn(n),b!==null&&(x.data=b)))),(b=qn?er(e,n):tr(e,n))&&(x=Ad(r,`onBeforeInput`),0<x.length&&(y=new Mn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),_d(o,e,r,n,i)}Sd(o,t)})}function kd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ad(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=cn(e,n),i!=null&&r.unshift(kd(e,i,a)),i=cn(e,t),i!=null&&r.push(kd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function jd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Md(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=cn(n,a),l!=null&&o.unshift(kd(n,l,c))):i||(l=cn(n,a),l!=null&&o.push(kd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Nd=/\r\n?/g,Pd=/\u0000|\uFFFD/g;function Fd(e){return(typeof e==`string`?e:``+e).replace(Nd,`
|
|
10
|
+
`).replace(Pd,``)}function Id(e,t){return t=Fd(t),Fd(e)===t}function Ld(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,a);break;case`data`:if(t!==`object`){kt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&Ld(e,t,`name`,i.name,i,null),Ld(e,t,`formEncType`,i.formEncType,i,null),Ld(e,t,`formMethod`,i.formMethod,i,null),Ld(e,t,`formTarget`,i.formTarget,i,null)):(Ld(e,t,`encType`,i.encType,i,null),Ld(e,t,`method`,i.method,i,null),Ld(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&Cd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Cd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Cd(`beforetoggle`,e),Cd(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Xt.get(n)||n,Ot(e,n,r))}}function Rd(e,t,n,r,i,a){switch(n){case`style`:Jt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&Cd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Cd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[st]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ot(e,n,r)}}}function zd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Cd(`error`,e),Cd(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Ld(e,t,a,s,n,null)}}i&&Ld(e,t,`srcSet`,n.srcSet,n,null),r&&Ld(e,t,`src`,n.src,n,null);return;case`input`:Cd(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:Ld(e,t,r,d,n,null)}}Bt(e,a,c,l,u,s,i,!1);return;case`select`:for(i in Cd(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Ld(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in Cd(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:Ld(e,t,s,c,n,null)}Wt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Ld(e,t,l,r,n,null)}return;case`dialog`:Cd(`beforetoggle`,e),Cd(`toggle`,e),Cd(`cancel`,e),Cd(`close`,e);break;case`iframe`:case`object`:Cd(`load`,e);break;case`video`:case`audio`:for(r=0;r<bd.length;r++)Cd(bd[r],e);break;case`image`:Cd(`error`,e),Cd(`load`,e);break;case`details`:Cd(`toggle`,e);break;case`embed`:case`source`:case`link`:Cd(`error`,e),Cd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Ld(e,t,u,r,n,null)}return;default:if(Yt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Rd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Ld(e,t,c,r,n,null))}function Bd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Ld(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&Ld(e,t,p,m,r,f)}}zt(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Ld(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:s=a;default:a!==l&&Ld(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Ld(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&Ld(e,t,s,i,r,a)}Ut(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Ld(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Ld(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Ld(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:Ld(e,t,u,p,r,m)}return;default:if(Yt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Rd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Rd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Ld(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Ld(e,t,f,p,r,m)}function Vd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Hd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Vd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Vd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Ud=null,Wd=null;function Gd(e){return e.nodeType===9?e:e.ownerDocument}function Kd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function qd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Jd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Yd=null;function Xd(){var e=window.event;return e&&e.type===`popstate`?e!==Yd&&(Yd=e,!0):(Yd=null,!1)}var Zd=typeof setTimeout==`function`?setTimeout:void 0,Qd=typeof clearTimeout==`function`?clearTimeout:void 0,$d=typeof Promise==`function`?Promise:void 0,ef=typeof queueMicrotask==`function`?queueMicrotask:$d===void 0?Zd:function(e){return $d.resolve(null).then(e).catch(tf)};function tf(e){setTimeout(function(){throw e})}function nf(e){return e===`head`}function rf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Rp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)vf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,vf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&vf(e.ownerDocument.body)}n=i}while(n);Rp(t)}function af(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function of(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:of(n),mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function sf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=pf(e.nextSibling),e===null)break}return null}function cf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=pf(e.nextSibling),e===null))return null;return e}function lf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=pf(e.nextSibling),e===null))return null;return e}function uf(e){return e.data===`$?`||e.data===`$~`}function df(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function ff(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function pf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var mf=null;function hf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return pf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function gf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function _f(e,t,n){switch(t=Gd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function vf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(e)}var yf=new Map,bf=new Set;function xf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Sf=L.d;L.d={f:Cf,r:wf,D:Df,C:Of,L:kf,m:Af,X:Mf,S:jf,M:Nf};function Cf(){var e=Sf.f(),t=Su();return e||t}function wf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?ws(t):Sf.r(e)}var Tf=typeof document>`u`?null:document;function Ef(e,t,n){var r=Tf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bf.has(i)||(bf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),zd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Df(e){Sf.D(e),Ef(`dns-prefetch`,e,null)}function Of(e,t){Sf.C(e,t),Ef(`preconnect`,e,t)}function kf(e,t,n){Sf.L(e,t,n);var r=Tf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Ff(e);break;case`script`:a=zf(e)}yf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),yf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(If(a))||t===`script`&&r.querySelector(Bf(a))||(t=r.createElement(`link`),zd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Af(e,t){Sf.m(e,t);var n=Tf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zf(e)}if(!yf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),yf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bf(a)))return}r=n.createElement(`link`),zd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function jf(e,t,n){Sf.S(e,t,n);var r=Tf;if(r&&e){var i=vt(r).hoistableStyles,a=Ff(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(If(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=yf.get(a))&&Uf(e,n);var c=o=r.createElement(`link`);yt(c),zd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Hf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Mf(e,t){Sf.X(e,t);var n=Tf;if(n&&e){var r=vt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=h({src:e,async:!0},t),(t=yf.get(i))&&Wf(e,t),a=n.createElement(`script`),yt(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t){Sf.M(e,t);var n=Tf;if(n&&e){var r=vt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=yf.get(i))&&Wf(e,t),a=n.createElement(`script`),yt(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t,n,r){var i=(i=se.current)?xf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Ff(n.href),n=vt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Ff(n.href);var a=vt(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(If(e)))&&!a._p&&(s.instance=a,s.state.loading=5),yf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},yf.set(e,n),a||Rf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=zf(n),n=vt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Ff(e){return`href="`+Rt(e)+`"`}function If(e){return`link[rel="stylesheet"][`+e+`]`}function Lf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Rf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),zd(t,`link`,n),yt(t),e.head.appendChild(t))}function zf(e){return`[src="`+Rt(e)+`"]`}function Bf(e){return`script[async]`+e}function Vf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),zd(r,`style`,i),Hf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Ff(n.href);var a=e.querySelector(If(i));if(a)return t.state.loading|=4,t.instance=a,yt(a),a;r=Lf(n),(i=yf.get(i))&&Uf(r,i),a=(e.ownerDocument||e).createElement(`link`),yt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),zd(a,`link`,r),t.state.loading|=4,Hf(a,n.precedence,e),t.instance=a;case`script`:return a=zf(n.src),(i=e.querySelector(Bf(a)))?(t.instance=i,yt(i),i):(r=n,(i=yf.get(a))&&(r=h({},n),Wf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),yt(i),zd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Hf(r,n.precedence,e));return t.instance}function Hf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Wf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Gf=null;function Kf(e,t,n){if(Gf===null){var r=new Map,i=Gf=new Map;i.set(n,r)}else i=Gf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[pt]||a[ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function qf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Jf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Yf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Ff(r.href),a=t.querySelector(If(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=$f.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Lf(r),(i=yf.get(i))&&Uf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),zd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=$f.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Zf=0;function Qf(e,t){return e.stylesheets&&e.count===0&&tp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&tp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Zf===0&&(Zf=62500*Hd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Zf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function $f(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ep=null;function tp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ep=new Map,t.forEach(np,e),ep=null,$f.call(e))}function np(e,t){if(!(t.state.loading&4)){var n=ep.get(e);if(n)var r=n.get(null);else{n=new Map,ep.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=$f.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var rp={$$typeof:C,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function ip(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ap(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ip(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=oi(3,null,null,t),e.current=a,a.stateNode=e,t=ia(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ia(a),e}function op(e){return e?(e=ii,e):ii}function sp(e,t,n,r,i,a){i=op(i),r.context===null?r.context=i:r.pendingContext=i,r=Ra(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=za(e,r,t),n!==null&&(_u(n,e,t),Ba(n,e,t))}function cp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lp(e,t){cp(e,t),(e=e.alternate)&&cp(e,t)}function up(e){if(e.tag===13||e.tag===31){var t=ti(e,67108864);t!==null&&_u(t,e,67108864),lp(e,67108864)}}function dp(e){if(e.tag===13||e.tag===31){var t=hu();t=tt(t);var n=ti(e,t);n!==null&&_u(n,e,t),lp(e,t)}}var fp=!0;function pp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,hp(e,t,n,r)}finally{L.p=a,I.T=i}}function mp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,hp(e,t,n,r)}finally{L.p=a,I.T=i}}function hp(e,t,n,r){if(fp){var i=gp(r);if(i===null)Od(e,t,r,_p,n),Op(e,r);else if(Ap(i,e,t,n,r))r.stopPropagation();else if(Op(e,r),t&4&&-1<Dp.indexOf(e)){for(;i!==null;){var a=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Le(o);s.entanglements[1]|=c,o&=~c}od(a),!(Rl&6)&&(iu=Te()+500,sd(0,!1))}}break;case 31:case 13:s=ti(a,2),s!==null&&_u(s,a,2),Su(),lp(a,2)}if(a=gp(r),a===null&&Od(e,t,r,_p,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Od(e,t,r,null,n)}}function gp(e){return e=tn(e),vp(e)}var _p=null;function vp(e){if(_p=null,e=ht(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return _p=e,null}function yp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ee()){case De:return 2;case Oe:return 8;case ke:case Ae:return 32;case je:return 268435456;default:return 32}default:return 32}}var bp=!1,xp=null,Sp=null,Cp=null,wp=new Map,Tp=new Map,Ep=[],Dp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Op(e,t){switch(e){case`focusin`:case`focusout`:xp=null;break;case`dragenter`:case`dragleave`:Sp=null;break;case`mouseover`:case`mouseout`:Cp=null;break;case`pointerover`:case`pointerout`:wp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Tp.delete(t.pointerId)}}function kp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=gt(t),t!==null&&up(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ap(e,t,n,r,i){switch(t){case`focusin`:return xp=kp(xp,e,t,n,r,i),!0;case`dragenter`:return Sp=kp(Sp,e,t,n,r,i),!0;case`mouseover`:return Cp=kp(Cp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return wp.set(a,kp(wp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Tp.set(a,kp(Tp.get(a)||null,e,t,n,r,i)),!0}return!1}function jp(e){var t=ht(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,it(e.priority,function(){dp(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,it(e.priority,function(){dp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Mp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(n),t!==null&&up(t),e.blockedOn=n,!1;t.shift()}return!0}function Np(e,t,n){Mp(e)&&n.delete(t)}function Pp(){bp=!1,xp!==null&&Mp(xp)&&(xp=null),Sp!==null&&Mp(Sp)&&(Sp=null),Cp!==null&&Mp(Cp)&&(Cp=null),wp.forEach(Np),Tp.forEach(Np)}function Fp(e,n){e.blockedOn===n&&(e.blockedOn=null,bp||(bp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Pp)))}var Ip=null;function Lp(e){Ip!==e&&(Ip=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ip===e&&(Ip=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(vp(r||n)===null)continue;break}var a=gt(n);a!==null&&(e.splice(t,3),t-=3,Ss(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Rp(e){function t(t){return Fp(t,e)}xp!==null&&Fp(xp,e),Sp!==null&&Fp(Sp,e),Cp!==null&&Fp(Cp,e),wp.forEach(t),Tp.forEach(t);for(var n=0;n<Ep.length;n++){var r=Ep[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ep.length&&(n=Ep[0],n.blockedOn===null);)jp(n),n.blockedOn===null&&Ep.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[st]||null;if(typeof a==`function`)o||Lp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(vp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Lp(n)}}}function zp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Bp(e){this._internalRoot=e}Vp.prototype.render=Bp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;sp(n,hu(),e,t,null,null)},Vp.prototype.unmount=Bp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sp(e.current,2,null,e,null,null),Su(),t[ct]=null}};function Vp(e){this._internalRoot=e}Vp.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ep.length&&t!==0&&t<Ep[n].priority;n++);Ep.splice(n,0,e),n===0&&jp(e)}};var Hp=n.version;if(Hp!==`19.2.7`)throw Error(o(527,Hp,`19.2.7`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Up={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Wp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wp.isDisabled&&Wp.supportsFiber)try{Pe=Wp.inject(Up),Fe=Wp}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(o(299));var n=!1,r=``,i=Gs,a=Ks,s=qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=ap(e,1,!1,null,null,n,r,null,i,a,s,zp),e[ct]=t.current,Ed(e),new Bp(t)}})),l=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=c()})),u=e(r(),1),d=e(s(),1),f=l(),p=`modulepreload`,m=function(e){return`/`+e},h={},g=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=m(t,n),t=s(t),t in h)return;h[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:p,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},_=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,v=/^[\\/]{2}/;function y(e,t){return t+e.replace(/\\/g,`/`)}var b=`popstate`;function x(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function S(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return D(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:O(t)}return A(t,n,null,e)}function C(e,t){if(e===!1||e==null)throw Error(t)}function w(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function T(){return Math.random().toString(36).substring(2,10)}function E(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function D(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?k(t):t,state:n,key:t&&t.key||r||T(),mask:i}}function O({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function k(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function A(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=x(e)?e:D(h.location,e,t);n&&n(r,e),l=u()+1;let d=E(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=x(e)?e:D(h.location,e,t);n&&n(r,e),l=u();let i=E(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return j(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(b,d),c=e,()=>{i.removeEventListener(b,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function j(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),C(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:O(t);return i=i.replace(/ $/,`%20`),!n&&v.test(i)&&(i=r+i),new URL(i,r)}function M(e,t,n=`/`){return N(e,t,n,!1)}function N(e,t,n,r,i){let a=pe((typeof t==`string`?k(t):t).pathname||`/`,n);if(a==null)return null;let o=i??P(e),s=null,c=fe(a);for(let e=0;s==null&&e<o.length;++e)s=ce(o[e],c,r);return s}function P(e){let t=F(e);return L(t),t}function F(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;C(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=xe([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(C(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),F(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:oe(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=de(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of I(e.path))a(e,t,!0,n)}),t}function I(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=I(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function L(e){e.sort((e,t)=>e.score===t.score?se(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ee=/^:[\w-]+$/,te=3,ne=2,re=1,R=10,ie=-2,ae=e=>e===`*`;function oe(e,t){let n=e.split(`/`),r=n.length;return n.some(ae)&&(r+=ie),t&&(r+=ne),n.filter(e=>!ae(e)).reduce((e,t)=>e+(ee.test(t)?te:t===``?re:R),r)}function se(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ce(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ue(u,l,s.matcher,s.compiledParams):le(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=le({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:xe([a,d.pathname]),pathnameBase:Ce(xe([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=xe([a,d.pathnameBase]))}return o}function le(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=de(e.path,e.caseSensitive,e.end);return ue(e,t,n,r)}function ue(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function de(e,t=!1,n=!0){w(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function fe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return w(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function pe(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function me(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?k(e):e,a;return n?(n=be(n),a=n.startsWith(`/`)?he(n.substring(1),`/`):he(n,t)):a=t,{pathname:a,search:we(r),hash:Te(i)}}function he(e,t){let n=Se(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ge(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _e(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ve(e){let t=_e(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function ye(e,t,n,r=!1){let i;typeof e==`string`?i=k(e):(i={...e},C(!i.pathname||!i.pathname.includes(`?`),ge(`?`,`pathname`,`search`,i)),C(!i.pathname||!i.pathname.includes(`#`),ge(`#`,`pathname`,`hash`,i)),C(!i.search||!i.search.includes(`#`),ge(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=me(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var be=e=>e.replace(/[\\/]{2,}/g,`/`),xe=e=>be(e.join(`/`)),Se=e=>e.replace(/\/+$/,``),Ce=e=>Se(e).replace(/^\/*/,`/`),we=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Te=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ee=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function De(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Oe(e){return xe(e.map(e=>e.route.path).filter(Boolean))||`/`}var ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ae(e,t){let n=e;if(typeof n!=`string`||!_.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ke)try{let e=new URL(window.location.href),r=v.test(n)?new URL(y(n,e.protocol)):new URL(n),a=pe(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{w(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var je=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(je);var Me=[`GET`,...je];new Set(Me);var Ne=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Pe(e){try{return Ne.includes(new URL(e).protocol)}catch{return!1}}var Fe=u.createContext(null);Fe.displayName=`DataRouter`;var Ie=u.createContext(null);Ie.displayName=`DataRouterState`;var Le=u.createContext(!1);function Re(){return u.useContext(Le)}var ze=u.createContext({isTransitioning:!1});ze.displayName=`ViewTransition`;var Be=u.createContext(new Map);Be.displayName=`Fetchers`;var Ve=u.createContext(null);Ve.displayName=`Await`;var He=u.createContext(null);He.displayName=`Navigation`;var Ue=u.createContext(null);Ue.displayName=`Location`;var We=u.createContext({outlet:null,matches:[],isDataRoute:!1});We.displayName=`Route`;var Ge=u.createContext(null);Ge.displayName=`RouteError`;var Ke=`REACT_ROUTER_ERROR`,qe=`REDIRECT`,Je=`ROUTE_ERROR_RESPONSE`;function Ye(e){if(e.startsWith(`${Ke}:${qe}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Xe(e){if(e.startsWith(`${Ke}:${Je}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ee(t.status,t.statusText,t.data)}catch{}}function Ze(e,{relative:t}={}){C(Qe(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=u.useContext(He),{hash:i,pathname:a,search:o}=at(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:xe([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Qe(){return u.useContext(Ue)!=null}function $e(){return C(Qe(),`useLocation() may be used only in the context of a <Router> component.`),u.useContext(Ue).location}var et=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function tt(e){u.useContext(He).static||u.useLayoutEffect(e)}function nt(){let{isDataRoute:e}=u.useContext(We);return e?St():rt()}function rt(){C(Qe(),`useNavigate() may be used only in the context of a <Router> component.`);let e=u.useContext(Fe),{basename:t,navigator:n}=u.useContext(He),{matches:r}=u.useContext(We),{pathname:i}=$e(),a=JSON.stringify(ve(r)),o=u.useRef(!1);return tt(()=>{o.current=!0}),u.useCallback((r,s={})=>{if(w(o.current,et),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=ye(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:xe([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}u.createContext(null);function it(){let{matches:e}=u.useContext(We);return e[e.length-1]?.params??{}}function at(e,{relative:t}={}){let{matches:n}=u.useContext(We),{pathname:r}=$e(),i=JSON.stringify(ve(n));return u.useMemo(()=>ye(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ot(e,t){return st(e,t)}function st(e,t,n){C(Qe(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=u.useContext(He),{matches:i}=u.useContext(We),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;wt(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
11
|
+
|
|
12
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=$e(),f;if(t){let e=typeof t==`string`?k(t):t;C(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let p=f.pathname||`/`,m=p;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let h=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):M(e,{pathname:m});w(l||h!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),w(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=mt(h&&h.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:xe([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:xe([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&g?u.createElement(Ue.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},g):g}function ct(){let e=xt(),t=De(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=u.createElement(u.Fragment,null,u.createElement(`p`,null,`💿 Hey developer 👋`),u.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,u.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,u.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),u.createElement(u.Fragment,null,u.createElement(`h2`,null,`Unexpected Application Error!`),u.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?u.createElement(`pre`,{style:i},n):null,o)}var lt=u.createElement(ct,null),ut=class extends u.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Xe(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:u.createElement(We.Provider,{value:this.props.routeContext},u.createElement(Ge.Provider,{value:e,children:this.props.component}));return this.context?u.createElement(ft,{error:e},t):t}};ut.contextType=Le;var dt=new WeakMap;function ft({children:e,error:t}){let{basename:n}=u.useContext(He);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ye(t.digest);if(e){let r=dt.get(t);if(r)throw r;let i=Ae(e.location,n),a=i.absoluteURL||i.to;if(Pe(a))throw Error(`Invalid redirect location`);if(ke&&!dt.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw dt.set(t,n),n}}return u.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function pt({routeContext:e,match:t,children:n}){let r=u.useContext(Fe);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),u.createElement(We.Provider,{value:e},n)}function mt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);C(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Oe(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let d,f=!1,p=null,m=null;r&&(d=a&&n.route.id?a[n.route.id]:void 0,p=n.route.errorElement||lt,o&&(s<0&&c===0?(wt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):s===c&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(i.slice(0,c+1)),g=()=>{let t;return t=d?p:f?m:n.route.Component?u.createElement(n.route.Component,null):n.route.element?n.route.element:e,u.createElement(pt,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?u.createElement(ut,{location:r.location,revalidation:r.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:l}):g()},null)}function ht(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gt(e){let t=u.useContext(Fe);return C(t,ht(e)),t}function _t(e){let t=u.useContext(Ie);return C(t,ht(e)),t}function vt(e){let t=u.useContext(We);return C(t,ht(e)),t}function yt(e){let t=vt(e),n=t.matches[t.matches.length-1];return C(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function bt(){return yt(`useRouteId`)}function xt(){let e=u.useContext(Ge),t=_t(`useRouteError`),n=yt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function St(){let{router:e}=gt(`useNavigate`),t=yt(`useNavigate`),n=u.useRef(!1);return tt(()=>{n.current=!0}),u.useCallback(async(r,i={})=>{w(n.current,et),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ct={};function wt(e,t,n){!t&&!Ct[e]&&(Ct[e]=!0,w(!1,n))}u.memo(Tt);function Tt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return st(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Et({to:e,replace:t,state:n,relative:r}){C(Qe(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=u.useContext(He);w(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=u.useContext(We),{pathname:o}=$e(),s=nt(),c=ye(e,ve(a),o,r===`path`),l=JSON.stringify(c);return u.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Dt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){C(!Qe(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=u.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=k(n));let{pathname:l=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`,mask:h}=n,g=u.useMemo(()=>{let e=pe(l,s);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m,mask:h},navigationType:r}},[s,l,d,f,p,m,r,h]);return w(g!=null,`<Router basename="${s}"> is not able to match the URL "${l}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:u.createElement(He.Provider,{value:c},u.createElement(Ue.Provider,{children:t,value:g}))}u.Component;var Ot=`get`,kt=`application/x-www-form-urlencoded`;function At(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function jt(e){return At(e)&&e.tagName.toLowerCase()===`button`}function Mt(e){return At(e)&&e.tagName.toLowerCase()===`form`}function Nt(e){return At(e)&&e.tagName.toLowerCase()===`input`}function Pt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ft(e,t){return e.button===0&&(!t||t===`_self`)&&!Pt(e)}function It(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Lt(e,t){let n=It(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Rt=null;function zt(){if(Rt===null)try{new FormData(document.createElement(`form`),0),Rt=!1}catch{Rt=!0}return Rt}var Bt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Vt(e){return e!=null&&!Bt.has(e)?(w(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${kt}"`),null):e}function Ht(e,t){let n,r,i,a,o;if(Mt(e)){let o=e.getAttribute(`action`);r=o?pe(o,t):null,n=e.getAttribute(`method`)||Ot,i=Vt(e.getAttribute(`enctype`))||kt,a=new FormData(e)}else if(jt(e)||Nt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?pe(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ot,i=Vt(e.getAttribute(`formenctype`))||Vt(o.getAttribute(`enctype`))||kt,a=new FormData(o,e),!zt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(At(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ot,r=null,i=kt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Ut(e,t){if(e===!1||e==null)throw Error(t)}function Wt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&pe(i.pathname,t)===`/`?`${Se(t)}/_root.${r}`:`${Se(i.pathname)}.${r}`,i}async function Gt(e,t){if(e.id in t)return t[e.id];try{let n=await g(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Kt(e){return e!=null&&typeof e.page==`string`}function qt(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Jt(e,t,n){return $t((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Gt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(qt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Yt(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Xt(e,t,{includeHydrateFallback:n}={}){return Zt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Zt(e){return[...new Set(e)]}function Qt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function $t(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Kt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Qt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function en(){let e=u.useContext(Fe);return Ut(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function tn(){let e=u.useContext(Ie);return Ut(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var nn=u.createContext(void 0);nn.displayName=`FrameworkContext`;function rn(){let e=u.useContext(nn);return Ut(e,`You must render this element inside a <HydratedRouter> element`),e}function an(e,t){let n=u.useContext(nn),[r,i]=u.useState(!1),[a,o]=u.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:d,onTouchStart:f}=t,p=u.useRef(null);u.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),u.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return n?e===`intent`?[a,p,{onFocus:on(s,m),onBlur:on(c,h),onMouseEnter:on(l,m),onMouseLeave:on(d,h),onTouchStart:on(f,m)}]:[a,p,{}]:[!1,p,{}]}function on(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function sn({page:e,...t}){let n=Re(),{nonce:r}=rn(),{router:i}=en(),a=u.useMemo(()=>M(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?u.createElement(ln,{page:e,matches:a,...t}):u.createElement(un,{page:e,matches:a,...t})):null}function cn(e){let{manifest:t,routeModules:n}=rn(),[r,i]=u.useState([]);return u.useEffect(()=>{let r=!1;return Jt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ln({page:e,matches:t,...n}){let r=$e(),{future:i}=rn(),{basename:a}=en(),o=u.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Wt(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return u.createElement(u.Fragment,null,o.map(e=>u.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function un({page:e,matches:t,...n}){let r=$e(),{future:i,manifest:a,routeModules:o}=rn(),{basename:s}=en(),{loaderData:c,matches:l}=tn(),d=u.useMemo(()=>Yt(e,t,l,a,r,`data`),[e,t,l,a,r]),f=u.useMemo(()=>Yt(e,t,l,a,r,`assets`),[e,t,l,a,r]),p=u.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let u=Wt(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,d,t,e,o]),m=u.useMemo(()=>Xt(f,a),[f,a]),h=cn(f);return u.createElement(u.Fragment,null,p.map(e=>u.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>u.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>u.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function dn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}u.Component;var fn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{fn&&(window.__reactRouterVersion=`7.18.1`)}catch{}function pn({basename:e,children:t,useTransitions:n,window:r}){let i=u.useRef();i.current??=S({window:r,v5Compat:!0});let a=i.current,[o,s]=u.useState({action:a.action,location:a.location}),c=u.useCallback(e=>{n===!1?s(e):u.startTransition(()=>s(e))},[n]);return u.useLayoutEffect(()=>a.listen(c),[a,c]),u.createElement(Dt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var mn=u.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:v,useTransitions:y}=u.useContext(He),b=typeof l==`string`&&_.test(l),x=Ae(l,g);l=x.to;let S=Ze(l,{relative:r}),C=$e(),w=null;if(o){let e=ye(o,[],C.mask?C.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:xe([g,e.pathname])),w=v.createHref(e)}let[T,E,D]=an(n,m),O=yn(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:d,relative:r,viewTransition:f,defaultShouldRevalidate:p,useTransitions:y});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(x.isExternal||i),j=u.createElement(`a`,{...m,...D,href:(A?w:void 0)||x.absoluteURL||S,onClick:A?k:e,ref:dn(h,E),target:c,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?u.createElement(u.Fragment,null,j,u.createElement(sn,{page:S})):j});mn.displayName=`Link`;var hn=u.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let d=at(a,{relative:c.relative}),f=$e(),p=u.useContext(Ie),{navigator:m,basename:h}=u.useContext(He),g=p!=null&&Tn(d)&&o===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=pe(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return u.createElement(mn,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});hn.displayName=`NavLink`;var gn=u.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ot,action:s,onSubmit:c,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=u.useContext(He),v=Cn(),y=wn(s,{relative:l}),b=o.toLowerCase()===`get`?`get`:`post`,x=typeof s==`string`&&_.test(s);return u.createElement(`form`,{ref:h,method:b,action:y,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,m=()=>v(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&n!==!1?u.startTransition(()=>m()):m()},...m,"data-discover":!x&&e===`render`?`true`:void 0})});gn.displayName=`Form`;function _n(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vn(e){let t=u.useContext(Fe);return C(t,_n(e)),t}function yn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let d=nt(),f=$e(),p=at(e,{relative:o});return u.useCallback(m=>{if(Ft(m,t)){m.preventDefault();let t=n===void 0?O(f)===O(p):n,h=()=>d(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?u.startTransition(()=>h()):h()}},[f,d,p,n,r,i,t,e,a,o,s,c,l])}function bn(e){w(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=u.useRef(It(e)),n=u.useRef(!1),r=$e(),i=u.useMemo(()=>Lt(r.search,n.current?null:t.current),[r.search]),a=nt();return[i,u.useCallback((e,t)=>{let r=It(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var xn=0,Sn=()=>`__${String(++xn)}__`;function Cn(){let{router:e}=vn(`useSubmit`),{basename:t}=u.useContext(He),n=bt(),r=e.fetch,i=e.navigate;return u.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ht(e,t);if(a.navigate===!1){let e=a.fetcherKey||Sn();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function wn(e,{relative:t}={}){let{basename:n}=u.useContext(He),r=u.useContext(We);C(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...at(e||`.`,{relative:t})},o=$e();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:xe([n,a.pathname])),O(a)}function Tn(e,{relative:t}={}){let n=u.useContext(ze);C(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=vn(`useViewTransitionState`),i=at(e,{relative:t});if(!n.isTransitioning)return!1;let a=pe(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=pe(n.nextLocation.pathname,r)||n.nextLocation.pathname;return le(i.pathname,o)!=null||le(i.pathname,a)!=null}var En=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Dn=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),On={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},kn=(0,u.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,u.createElement)(`svg`,{ref:c,...On,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Dn(`lucide`,i),...s},[...o.map(([e,t])=>(0,u.createElement)(e,t)),...Array.isArray(a)?a:[a]])),z=(e,t)=>{let n=(0,u.forwardRef)(({className:n,...r},i)=>(0,u.createElement)(kn,{ref:i,iconNode:t,className:Dn(`lucide-${En(e)}`,n),...r}));return n.displayName=`${e}`,n},An=z(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),jn=z(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Mn=z(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Nn=z(`Cable`,[[`path`,{d:`M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1`,key:`10bnsj`}],[`path`,{d:`M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9`,key:`1eqmu1`}],[`path`,{d:`M21 21v-2h-4`,key:`14zm7j`}],[`path`,{d:`M3 5h4V3`,key:`z442eg`}],[`path`,{d:`M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3`,key:`ebdjd7`}]]),Pn=z(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fn=z(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),In=z(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ln=z(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Rn=z(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),zn=z(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Bn=z(`CircleArrowUp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),Vn=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Hn=z(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Un=z(`CircleSlash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),Wn=z(`CircleStop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),Gn=z(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Kn=z(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),qn=z(`Command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Jn=z(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Yn=z(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Xn=z(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Zn=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Qn=z(`Eraser`,[[`path`,{d:`m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21`,key:`182aya`}],[`path`,{d:`M22 21H7`,key:`t4ddhn`}],[`path`,{d:`m5 11 9 9`,key:`1mo9qw`}]]),$n=z(`Expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16.2V21h-4.8`,key:`1hrera`}],[`path`,{d:`M21 7.8V3h-4.8`,key:`ul1q53`}],[`path`,{d:`M3 16.2V21h4.8`,key:`1x04uo`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 7.8V3h4.8`,key:`1ijppm`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),er=z(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),tr=z(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),nr=z(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),rr=z(`Fingerprint`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),ir=z(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),ar=z(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),or=z(`FolderPlus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),sr=z(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),cr=z(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),lr=z(`GitFork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),ur=z(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),dr=z(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),fr=z(`ImageOff`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),pr=z(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),mr=z(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),hr=z(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),gr=z(`LayoutDashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),_r=z(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),vr=z(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),B=z(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),yr=z(`MapPin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),br=z(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),xr=z(`MonitorSmartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),Sr=z(`MonitorUp`,[[`path`,{d:`m9 10 3-3 3 3`,key:`11gsxs`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]),Cr=z(`Monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),wr=z(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),Tr=z(`MousePointerBan`,[[`path`,{d:`M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z`,key:`11pp1i`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}],[`path`,{d:`m11.8 11.8 8.4 8.4`,key:`oogvdj`}]]),Er=z(`MousePointerClick`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),Dr=z(`PackagePlus`,[[`path`,{d:`M16 16h6`,key:`100bgy`}],[`path`,{d:`M19 13v6`,key:`85cyf1`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Or=z(`PackageSearch`,[[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]),kr=z(`PanelLeftClose`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Ar=z(`PanelLeftOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),jr=z(`PanelRightClose`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Mr=z(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Nr=z(`Paperclip`,[[`path`,{d:`M13.234 20.252 21 12.3`,key:`1cbrk9`}],[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486`,key:`1pkts6`}]]),Pr=z(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Fr=z(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Ir=z(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Lr=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Rr=z(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),zr=z(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Br=z(`RotateCw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Vr=z(`ScanEye`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]),Hr=z(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Ur=z(`Send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Wr=z(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Gr=z(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Kr=z(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),qr=z(`Share2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),Jr=z(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Yr=z(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Xr=z(`ShieldOff`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Zr=z(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Qr=z(`Shrink`,[[`path`,{d:`m15 15 6 6m-6-6v4.8m0-4.8h4.8`,key:`17vawe`}],[`path`,{d:`M9 19.8V15m0 0H4.2M9 15l-6 6`,key:`chjx8e`}],[`path`,{d:`M15 4.2V9m0 0h4.8M15 9l6-6`,key:`lav6yq`}],[`path`,{d:`M9 4.2V9m0 0H4.2M9 9 3 3`,key:`1pxi2q`}]]),$r=z(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),ei=z(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ti=z(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ni=z(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ri=z(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ii=z(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),ai=z(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),oi=z(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),si=z(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),ci=z(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),li=z(`Unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),ui=z(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),di=z(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),fi=z(`Zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);function pi(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var mi=e=>{switch(e){case`success`:return _i;case`info`:return yi;case`warning`:return vi;case`error`:return bi;default:return null}},hi=Array(12).fill(0),gi=({visible:e,className:t})=>u.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},u.createElement(`div`,{className:`sonner-spinner`},hi.map((e,t)=>u.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),_i=u.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},u.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),vi=u.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},u.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),yi=u.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},u.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),bi=u.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},u.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),xi=u.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},u.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),u.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Si=()=>{let[e,t]=u.useState(document.hidden);return u.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Ci=1,wi=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Ci++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],u.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Ei(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!u.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!u.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!u.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!u.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Ci++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ti=(e,t)=>{let n=t?.id||Ci++;return wi.addToast({title:e,...t,id:n}),n},Ei=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,V=Object.assign(Ti,{success:wi.success,info:wi.info,warning:wi.warning,error:wi.error,custom:wi.custom,message:wi.message,promise:wi.promise,dismiss:wi.dismiss,loading:wi.loading},{getHistory:()=>wi.toasts,getToasts:()=>wi.getActiveToasts()});pi(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Di(e){return e.label!==void 0}var Oi=3,ki=`24px`,Ai=`16px`,ji=4e3,Mi=356,Ni=14,Pi=45,Fi=200;function Ii(...e){return e.filter(Boolean).join(` `)}function Li(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Ri=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:d,removeToast:f,defaultRichColors:p,closeButton:m,style:h,cancelButtonStyle:g,actionButtonStyle:_,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=u.useState(null),[k,A]=u.useState(null),[j,M]=u.useState(!1),[N,P]=u.useState(!1),[F,I]=u.useState(!1),[L,ee]=u.useState(!1),[te,ne]=u.useState(!1),[re,R]=u.useState(0),[ie,ae]=u.useState(0),oe=u.useRef(n.duration||b||ji),se=u.useRef(null),ce=u.useRef(null),le=c===0,ue=c+1<=o,de=n.type,fe=n.dismissible!==!1,pe=n.className||``,me=n.descriptionClassName||``,he=u.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ge=u.useMemo(()=>n.closeButton??m,[n.closeButton,m]),_e=u.useMemo(()=>n.duration||b||ji,[n.duration,b]),ve=u.useRef(0),ye=u.useRef(0),be=u.useRef(0),xe=u.useRef(null),[Se,Ce]=x.split(`-`),we=u.useMemo(()=>s.reduce((e,t,n)=>n>=he?e:e+t.height,0),[s,he]),Te=Si(),Ee=n.invert||t,De=de===`loading`;ye.current=u.useMemo(()=>he*S+we,[he,we]),u.useEffect(()=>{oe.current=_e},[_e]),u.useEffect(()=>{M(!0)},[]),u.useEffect(()=>{let e=ce.current;if(e){let t=e.getBoundingClientRect().height;return ae(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),u.useLayoutEffect(()=>{if(!j)return;let e=ce.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ae(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Oe=u.useCallback(()=>{P(!0),R(ye.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{f(n)},Fi)},[n,f,a,ye]);u.useEffect(()=>{if(n.promise&&de===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return d||i||Te?(()=>{if(be.current<ve.current){let e=new Date().getTime()-ve.current;oe.current-=e}be.current=new Date().getTime()})():oe.current!==1/0&&(ve.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Oe()},oe.current)),()=>clearTimeout(e)},[d,i,n,de,Te,Oe]),u.useEffect(()=>{n.delete&&(Oe(),n.onDismiss==null||n.onDismiss.call(n,n))},[Oe,n.delete]);function ke(){return T?.loading?u.createElement(`div`,{className:Ii(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":de===`loading`},T.loading):u.createElement(gi,{className:Ii(w?.loader,n?.classNames?.loader),visible:de===`loading`})}let Ae=n.icon||T?.[de]||mi(de);return u.createElement(`li`,{tabIndex:0,ref:ce,className:Ii(v,pe,w?.toast,n?.classNames?.toast,w?.default,w?.[de],n?.classNames?.[de]),"data-sonner-toast":``,"data-rich-colors":n.richColors??p,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":te,"data-removed":N,"data-visible":ue,"data-y-position":Se,"data-x-position":Ce,"data-index":c,"data-front":le,"data-swiping":F,"data-dismissible":fe,"data-type":de,"data-invert":Ee,"data-swipe-out":L,"data-swipe-direction":k,"data-expanded":!!(d||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${N?re:ye.current}px`,"--initial-height":C?`auto`:`${ie}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),xe.current=null},onPointerDown:e=>{e.button!==2&&(De||!fe||(se.current=new Date,R(ye.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),xe.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!fe)return;xe.current=null;let e=Number(ce.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ce.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-se.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Pi||a>.11){R(ye.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Oe(),ee(!0);return}var o,s;(o=ce.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ce.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),ne(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!xe.current||!fe||window.getSelection()?.toString().length>0)return;let i=t.clientY-xe.current.y,a=t.clientX-xe.current.x,o=e.swipeDirections??Li(x);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&O(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`)){if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`))){if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ne(!0),(n=ce.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ce.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ge&&!n.jsx&&de!==`loading`?u.createElement(`button`,{"aria-label":E,"data-disabled":De,"data-close-button":!0,onClick:De||!fe?()=>{}:()=>{Oe(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Ii(w?.closeButton,n?.classNames?.closeButton)},T?.close??xi):null,(de||n.icon||n.promise)&&n.icon!==null&&(T?.[de]!==null||n.icon)?u.createElement(`div`,{"data-icon":``,className:Ii(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||ke():null,n.type===`loading`?null:Ae):null,u.createElement(`div`,{"data-content":``,className:Ii(w?.content,n?.classNames?.content)},u.createElement(`div`,{"data-title":``,className:Ii(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?u.createElement(`div`,{"data-description":``,className:Ii(y,me,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),u.isValidElement(n.cancel)?n.cancel:n.cancel&&Di(n.cancel)?u.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{Di(n.cancel)&&fe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Oe())},className:Ii(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,u.isValidElement(n.action)?n.action:n.action&&Di(n.action)?u.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||_,onClick:e=>{Di(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Oe())},className:Ii(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function zi(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Bi(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Ai:ki;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var Vi=u.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:f,theme:p=`light`,richColors:m,duration:h,style:g,visibleToasts:_=Oi,toastOptions:v,dir:y=zi(),gap:b=Ni,icons:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=u.useState([]),T=u.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=u.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=u.useState([]),[k,A]=u.useState(!1),[j,M]=u.useState(!1),[N,P]=u.useState(p===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:p),F=u.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=u.useRef(null),ee=u.useRef(!1),te=u.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||wi.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return u.useEffect(()=>wi.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{d.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[C]),u.useEffect(()=>{if(p!==`system`){P(p);return}if(p===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[p]),u.useEffect(()=>{C.length<=1&&A(!1)},[C]),u.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),u.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,ee.current=!1)}},[F.current]),u.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?u.createElement(`ol`,{key:t,dir:y===`auto`?zi():y,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":N,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${Mi}px`,"--gap":`${b}px`,...g,...Bi(l,f)},onBlur:e=>{ee.current&&!e.currentTarget.contains(e.relatedTarget)&&(ee.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ee.current||(ee.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>u.createElement(Ri,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:m,duration:v?.duration??h,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:_,closeButton:v?.closeButton??s,interacting:j,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:te,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:b,expanded:k,swipeDirections:e.swipeDirections}))):null}))}),Hi=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ui=t(((e,t)=>{t.exports=Hi()})),H=Ui();function Wi(e,t=[]){let n=[];function r(t,r){let i=u.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=u.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,d=u.useContext(l);if(d)return d;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>u.createContext(e));return function(n){let r=n?.[e]||t;return u.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Gi(i,...t)]}function Gi(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function Ki(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function qi(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ki(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ki(e[t],null)}}}}function Ji(...e){return u.useCallback(qi(...e),e)}typeof window<`u`&&window.document&&window.document.createElement;function U(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}var Yi=globalThis?.document?u.useLayoutEffect:()=>{},Xi=u.useId||(()=>void 0),Zi=0;function Qi(e){let[t,n]=u.useState(Xi());return Yi(()=>{e||n(e=>e??String(Zi++))},[e]),e||(t?`radix-${t}`:``)}var $i=u.useInsertionEffect||Yi;function ea({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=ta({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=u.useRef(e!==void 0);u.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,u.useCallback(t=>{if(s){let n=na(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function ta({defaultProp:e,onChange:t}){let[n,r]=u.useState(e),i=u.useRef(n),a=u.useRef(t);return $i(()=>{a.current=t},[t]),u.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function na(e){return typeof e==`function`}function ra(e){let t=u.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];da(r)&&typeof ha==`function`&&(r=ha(r._payload)),u.Children.forEach(r,e=>{if(la(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;da(n)&&typeof ha==`function`&&(n=ha(n._payload)),a=oa(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=u.cloneElement(a,void 0,s):!o&&u.Children.count(r)===1&&u.isValidElement(r)&&(a=r);let c=a?ca(a):void 0,l=Ji(n,c);if(!a){if(r||r===0)throw Error(o?ma(e):pa(e));return r}let d=sa(i,a.props??{});return a.type!==u.Fragment&&(d.ref=n?l:c),u.cloneElement(a,d)});return t.displayName=`${e}.Slot`,t}var ia=ra(`Slot`),aa=Symbol.for(`radix.slottable`),oa=(e,t)=>{if(`child`in e.props){let t=e.props.child;return u.isValidElement(t)?u.cloneElement(t,void 0,e.props.children(t.props.children)):null}return u.isValidElement(t)?t:null};function sa(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ca(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function la(e){return u.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===aa}var ua=Symbol.for(`react.lazy`);function da(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===ua&&`_payload`in e&&fa(e._payload)}function fa(e){return typeof e==`object`&&!!e&&`then`in e}var pa=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,ma=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ha=u.use,W=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ra(`Primitive.${t}`),r=u.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ga(e,t){e&&d.flushSync(()=>e.dispatchEvent(t))}function _a(e){let t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>((...e)=>t.current?.(...e)),[])}var va=`DismissableLayer`,ya=`dismissableLayer.update`,ba=`dismissableLayer.pointerDownOutside`,xa=`dismissableLayer.focusOutside`,Sa,Ca=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),wa=u.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,d=u.useContext(Ca),[f,p]=u.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=u.useState({}),g=Ji(t,p),_=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=v?_.indexOf(v):-1,b=f?_.indexOf(f):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=u.useRef(!1),w=ka(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:u.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...d.branches].some(t=>t.contains(e));return S&&!t},[d.branches,S])}),T=Aa(e=>{if(r&&C.current)return;let t=e.target;[...d.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),E=f?b===_.length-1:!1,D=_a(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return u.useEffect(()=>{if(E)return m.addEventListener(`keydown`,D,{capture:!0}),()=>m.removeEventListener(`keydown`,D,{capture:!0})},[m,E,D]),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Sa=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),ja(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Sa))}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),ja())},[f,d]),u.useEffect(()=>{let e=()=>h({});return document.addEventListener(ya,e),()=>document.removeEventListener(ya,e)},[]),(0,H.jsx)(W.div,{...l,ref:g,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:U(e.onFocusCapture,T.onFocusCapture),onBlurCapture:U(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:U(e.onPointerDownCapture,w.onPointerDownCapture)})});wa.displayName=va;var Ta=`DismissableLayerBranch`,Ea=u.forwardRef((e,t)=>{let n=u.useContext(Ca),r=u.useRef(null),i=Ji(t,r);return u.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,H.jsx)(W.div,{...e,ref:i})});Ea.displayName=Ta;function Da(){let e=u.useContext(Ca),[t,n]=u.useState(null);return u.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var Oa=()=>!0;function ka(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Oa}=t,s=_a(e),c=u.useRef(!1),l=u.useRef(!1),d=u.useRef(new Map),f=u.useRef(()=>{});return u.useEffect(()=>{function e(){l.current=!1,i.current=!1,d.current.clear()}function t(){return Array.from(d.current.values()).some(Boolean)}function u(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||d.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&f.current()},0)}function p(e){l.current&&d.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let u=function(){n.removeEventListener(`click`,f.current);let r=t();e(),r||Ma(ba,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,f.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,d.current.clear(),!r||a.button!==0?u():(n.removeEventListener(`click`,f.current),f.current=u,n.addEventListener(`click`,f.current,{once:!0}))}else n.removeEventListener(`click`,f.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,u,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,f.current);for(let e of h)n.removeEventListener(e,u,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function Aa(e,t=globalThis?.document){let n=_a(e),r=u.useRef(!1);return u.useEffect(()=>{let e=e=>{e.target&&!r.current&&Ma(xa,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ja(){let e=new CustomEvent(ya);document.dispatchEvent(e)}function Ma(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ga(i,a):i.dispatchEvent(a)}var Na=`focusScope.autoFocusOnMount`,Pa=`focusScope.autoFocusOnUnmount`,Fa={bubbles:!1,cancelable:!0},Ia=`FocusScope`,La=u.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=u.useState(null),l=_a(i),d=_a(a),f=u.useRef(null),p=Ji(t,c),m=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?f.current=t:Wa(f.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Wa(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Wa(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),u.useEffect(()=>{if(s){Ga.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Na,Fa);s.addEventListener(Na,l),s.dispatchEvent(t),t.defaultPrevented||(Ra(Ja(Ba(s)),{select:!0}),document.activeElement===e&&Wa(s))}return()=>{s.removeEventListener(Na,l),setTimeout(()=>{let t=new CustomEvent(Pa,Fa);s.addEventListener(Pa,d),s.dispatchEvent(t),t.defaultPrevented||Wa(e??document.body,{select:!0}),s.removeEventListener(Pa,d),Ga.remove(m)},0)}}},[s,l,d,m]);let h=u.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=za(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Wa(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Wa(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,H.jsx)(W.div,{tabIndex:-1,...o,ref:p,onKeyDown:h})});La.displayName=Ia;function Ra(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Wa(r,{select:t}),document.activeElement!==n)return}function za(e){let t=Ba(e);return[Va(t,e),Va(t.reverse(),e)]}function Ba(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Va(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Ha(r,{upTo:t})))return r}function Ha(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Ua(e){return e instanceof HTMLInputElement&&`select`in e}function Wa(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ua(e)&&t&&e.select()}}var Ga=Ka();function Ka(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=qa(e,t),e.unshift(t)},remove(t){e=qa(e,t),e[0]?.resume()}}}function qa(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Ja(e){return e.filter(e=>e.tagName!==`A`)}var Ya=`Portal`,Xa=u.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=u.useState(!1);Yi(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?d.createPortal((0,H.jsx)(W.div,{...r,ref:t}),o):null});Xa.displayName=Ya;function Za(e,t){return u.useReducer((e,n)=>t[e][n]??e,e)}var Qa=e=>{let{present:t,children:n}=e,r=$a(t),i=typeof n==`function`?n({present:r.isPresent}):u.Children.only(n),a=to(r.ref,ro(i));return typeof n==`function`||r.isPresent?u.cloneElement(i,{ref:a}):null};Qa.displayName=`Presence`;function $a(e){let[t,n]=u.useState(),r=u.useRef(null),i=u.useRef(e),a=u.useRef(`none`),o=u.useRef(void 0),[s,c]=Za(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return u.useEffect(()=>{s===`mounted`?(a.current=o.current??no(r.current),o.current=void 0):a.current=`none`},[s]),Yi(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=no(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Yi(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=no(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=no(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:u.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=no(t)}else r.current=null;n(e)},[])}}function eo(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function to(...e){let t=u.useRef(e);return t.current=e,u.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=eo(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():eo(n[e],null)}}},[])}function no(e){return e?.animationName||`none`}function ro(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var io=0,ao=null;function oo(){u.useEffect(()=>{ao||={start:so(),end:so()};let{start:e,end:t}=ao;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),io++,()=>{io===1&&(ao?.start.remove(),ao?.end.remove(),ao=null),io=Math.max(0,io-1)}},[])}function so(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var G=function(){return G=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},G.apply(this,arguments)};function co(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function lo(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var uo=`right-scroll-bar-position`,fo=`width-before-scroll-bar`,po=`with-scroll-bars-hidden`,mo=`--removed-body-scroll-bar-size`;function ho(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function go(e,t){var n=(0,u.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var _o=typeof window<`u`?u.useLayoutEffect:u.useEffect,vo=new WeakMap;function yo(e,t){var n=go(t||null,function(t){return e.forEach(function(e){return ho(e,t)})});return _o(function(){var t=vo.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ho(e,null)}),i.forEach(function(e){r.has(e)||ho(e,a)})}vo.set(n,e)},[e]),n}function bo(e){return e}function xo(e,t){t===void 0&&(t=bo);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function So(e){e===void 0&&(e={});var t=xo(null);return t.options=G({async:!0,ssr:!1},e),t}var Co=function(e){var t=e.sideCar,n=co(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return u.createElement(r,G({},n))};Co.isSideCarExport=!0;function wo(e,t){return e.useMedium(t),Co}var To=So(),Eo=function(){},Do=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:Eo,onWheelCapture:Eo,onTouchMoveCapture:Eo}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=co(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=yo([n,t]),w=G(G({},x),i);return u.createElement(u.Fragment,null,d&&u.createElement(S,{sideCar:To,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?u.cloneElement(u.Children.only(s),G(G({},w),{ref:C})):u.createElement(y,G({},w,{className:c,ref:C}),s))});Do.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Do.classNames={fullWidth:fo,zeroRight:uo};var Oo=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ko(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Oo();return t&&e.setAttribute(`nonce`,t),e}function Ao(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function jo(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Mo=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ko())&&(Ao(t,n),jo(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},No=function(){var e=Mo();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Po=function(){var e=No();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Fo={left:0,top:0,right:0,gap:0},Io=function(e){return parseInt(e||``,10)||0},Lo=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Io(n),Io(r),Io(i)]},Ro=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Fo;var t=Lo(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},zo=Po(),Bo=`data-scroll-locked`,Vo=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
13
|
+
.${po} {
|
|
14
|
+
overflow: hidden ${r};
|
|
15
|
+
padding-right: ${s}px ${r};
|
|
16
|
+
}
|
|
17
|
+
body[${Bo}] {
|
|
18
|
+
overflow: hidden ${r};
|
|
19
|
+
overscroll-behavior: contain;
|
|
20
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
21
|
+
padding-left: ${i}px;
|
|
22
|
+
padding-top: ${a}px;
|
|
23
|
+
padding-right: ${o}px;
|
|
24
|
+
margin-left:0;
|
|
25
|
+
margin-top:0;
|
|
26
|
+
margin-right: ${s}px ${r};
|
|
27
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.${uo} {
|
|
31
|
+
right: ${s}px ${r};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.${fo} {
|
|
35
|
+
margin-right: ${s}px ${r};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.${uo} .${uo} {
|
|
39
|
+
right: 0 ${r};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.${fo} .${fo} {
|
|
43
|
+
margin-right: 0 ${r};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
body[${Bo}] {
|
|
47
|
+
${mo}: ${s}px;
|
|
48
|
+
}
|
|
49
|
+
`},Ho=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Uo=function(){u.useEffect(function(){return document.body.setAttribute(Bo,(Ho()+1).toString()),function(){var e=Ho()-1;e<=0?document.body.removeAttribute(Bo):document.body.setAttribute(Bo,e.toString())}},[])},Wo=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Uo();var a=u.useMemo(function(){return Ro(i)},[i]);return u.createElement(zo,{styles:Vo(a,!t,i,n?``:`!important`)})},Go=!1;if(typeof window<`u`)try{var Ko=Object.defineProperty({},"passive",{get:function(){return Go=!0,!0}});window.addEventListener(`test`,Ko,Ko),window.removeEventListener(`test`,Ko,Ko)}catch{Go=!1}var qo=Go?{passive:!1}:!1,Jo=function(e){return e.tagName===`TEXTAREA`},Yo=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Jo(e)&&n[t]===`visible`)},Xo=function(e){return Yo(e,`overflowY`)},Zo=function(e){return Yo(e,`overflowX`)},Qo=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),ts(e,r)){var i=ns(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$o=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},es=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ts=function(e,t){return e===`v`?Xo(t):Zo(t)},ns=function(e,t){return e===`v`?$o(t):es(t)},rs=function(e,t){return e===`h`&&t===`rtl`?-1:1},is=function(e,t,n,r,i){var a=rs(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=ns(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&ts(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},as=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},os=function(e){return[e.deltaX,e.deltaY]},ss=function(e){return e&&`current`in e?e.current:e},cs=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ls=function(e){return`
|
|
50
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
51
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
52
|
+
`},us=0,ds=[];function fs(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),i=u.useState(us++)[0],a=u.useState(Po)[0],o=u.useRef(e);u.useEffect(function(){o.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=lo([e.lockRef.current],(e.shards||[]).map(ss),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=u.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=as(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Qo(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Qo(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return is(h,t,e,h===`h`?s:c,!0)},[]),c=u.useCallback(function(e){var n=e;if(!(!ds.length||ds[ds.length-1]!==a)){var r=`deltaY`in n?os(n):as(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&cs(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ss).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=u.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ps(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=u.useCallback(function(e){n.current=as(e),r.current=void 0},[]),f=u.useCallback(function(t){l(t.type,os(t),t.target,s(t,e.lockRef.current))},[]),p=u.useCallback(function(t){l(t.type,as(t),t.target,s(t,e.lockRef.current))},[]);u.useEffect(function(){return ds.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,qo),document.addEventListener(`touchmove`,c,qo),document.addEventListener(`touchstart`,d,qo),function(){ds=ds.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,qo),document.removeEventListener(`touchmove`,c,qo),document.removeEventListener(`touchstart`,d,qo)}},[]);var m=e.removeScrollBar,h=e.inert;return u.createElement(u.Fragment,null,h?u.createElement(a,{styles:ls(i)}):null,m?u.createElement(Wo,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ps(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ms=wo(To,fs),hs=u.forwardRef(function(e,t){return u.createElement(Do,G({},e,{ref:t,sideCar:ms}))});hs.classNames=Do.classNames;var gs=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},_s=new WeakMap,vs=new WeakMap,ys={},bs=0,xs=function(e){return e&&(e.host||xs(e.parentNode))},Ss=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=xs(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Cs=function(e,t,n,r){var i=Ss(t,Array.isArray(e)?e:[e]);ys[n]||(ys[n]=new WeakMap);var a=ys[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(_s.get(e)||0)+1,l=(a.get(e)||0)+1;_s.set(e,c),a.set(e,l),o.push(e),c===1&&i&&vs.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),bs++,function(){o.forEach(function(e){var t=_s.get(e)-1,i=a.get(e)-1;_s.set(e,t),a.set(e,i),t||(vs.has(e)||e.removeAttribute(r),vs.delete(e)),i||e.removeAttribute(n)}),bs--,bs||(_s=new WeakMap,_s=new WeakMap,vs=new WeakMap,ys={})}},ws=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||gs(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Cs(r,i,n,`aria-hidden`)):function(){return null}},Ts=`Dialog`,[Es,Ds]=Wi(Ts),[Os,ks]=Es(Ts),As=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=u.useRef(null),c=u.useRef(null),[l,d]=ea({prop:r,defaultProp:i??!1,onChange:a,caller:Ts});return(0,H.jsx)(Os,{scope:t,triggerRef:s,contentRef:c,contentId:Qi(),titleId:Qi(),descriptionId:Qi(),open:l,onOpenChange:d,onOpenToggle:u.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};As.displayName=Ts;var js=`DialogTrigger`,Ms=u.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ks(js,n),a=Ji(t,i.triggerRef);return(0,H.jsx)(W.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Qs(i.open),...r,ref:a,onClick:U(e.onClick,i.onOpenToggle)})});Ms.displayName=js;var Ns=`DialogPortal`,[Ps,Fs]=Es(Ns,{forceMount:void 0}),Is=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=ks(Ns,t);return(0,H.jsx)(Ps,{scope:t,forceMount:n,children:u.Children.map(r,e=>(0,H.jsx)(Qa,{present:n||a.open,children:(0,H.jsx)(Xa,{asChild:!0,container:i,children:e})}))})};Is.displayName=Ns;var Ls=`DialogOverlay`,Rs=u.forwardRef((e,t)=>{let n=Fs(Ls,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ks(Ls,e.__scopeDialog);return a.modal?(0,H.jsx)(Qa,{present:r||a.open,children:(0,H.jsx)(Bs,{...i,ref:t})}):null});Rs.displayName=Ls;var zs=ra(`DialogOverlay.RemoveScroll`),Bs=u.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ks(Ls,n),a=Ji(t,Da());return(0,H.jsx)(hs,{as:zs,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(W.div,{"data-state":Qs(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),Vs=`DialogContent`,Hs=u.forwardRef((e,t)=>{let n=Fs(Vs,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ks(Vs,e.__scopeDialog);return(0,H.jsx)(Qa,{present:r||a.open,children:a.modal?(0,H.jsx)(Us,{...i,ref:t}):(0,H.jsx)(Ws,{...i,ref:t})})});Hs.displayName=Vs;var Us=u.forwardRef((e,t)=>{let n=ks(Vs,e.__scopeDialog),r=u.useRef(null),i=Ji(t,n.contentRef,r);return u.useEffect(()=>{let e=r.current;if(e)return ws(e)},[]),(0,H.jsx)(Gs,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:U(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault())})}),Ws=u.forwardRef((e,t)=>{let n=ks(Vs,e.__scopeDialog),r=u.useRef(!1),i=u.useRef(!1);return(0,H.jsx)(Gs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Gs=u.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ks(Vs,n);return oo(),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(La,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(wa,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Qs(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),Ks=`DialogTitle`,qs=u.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ks(Ks,n);return(0,H.jsx)(W.h2,{id:i.titleId,...r,ref:t})});qs.displayName=Ks;var Js=`DialogDescription`,Ys=u.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ks(Js,n);return(0,H.jsx)(W.p,{id:i.descriptionId,...r,ref:t})});Ys.displayName=Js;var Xs=`DialogClose`,Zs=u.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ks(Xs,n);return(0,H.jsx)(W.button,{type:`button`,...r,ref:t,onClick:U(e.onClick,()=>i.onOpenChange(!1))})});Zs.displayName=Xs;function Qs(e){return e?`open`:`closed`}var $s=`AlertDialog`,[ec,tc]=Wi($s,[Ds]),nc=Ds(),rc=e=>{let{__scopeAlertDialog:t,...n}=e,r=nc(t);return(0,H.jsx)(As,{...r,...n,modal:!0})};rc.displayName=$s;var ic=`AlertDialogTrigger`,ac=u.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=nc(n);return(0,H.jsx)(Ms,{...i,...r,ref:t})});ac.displayName=ic;var oc=`AlertDialogPortal`,sc=e=>{let{__scopeAlertDialog:t,...n}=e,r=nc(t);return(0,H.jsx)(Is,{...r,...n})};sc.displayName=oc;var cc=`AlertDialogOverlay`,lc=u.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=nc(n);return(0,H.jsx)(Rs,{...i,...r,ref:t})});lc.displayName=cc;var uc=`AlertDialogContent`,[dc,fc]=ec(uc),pc=u.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=nc(n),o=Ji(t,u.useRef(null)),s=u.useRef(null);return(0,H.jsx)(dc,{scope:n,cancelRef:s,children:(0,H.jsx)(Hs,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:U(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});pc.displayName=uc;var mc=`AlertDialogTitle`,hc=u.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=nc(n);return(0,H.jsx)(qs,{...i,...r,ref:t})});hc.displayName=mc;var gc=`AlertDialogDescription`,_c=u.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=nc(n);return(0,H.jsx)(Ys,{...i,...r,ref:t})});_c.displayName=gc;var vc=`AlertDialogAction`,yc=u.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=nc(n);return(0,H.jsx)(Zs,{...i,...r,ref:t})});yc.displayName=vc;var bc=`AlertDialogCancel`,xc=u.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=fc(bc,n),a=nc(n),o=Ji(t,i);return(0,H.jsx)(Zs,{...a,...r,ref:o})});xc.displayName=bc;var Sc=rc,Cc=ac,wc=sc,Tc=lc,Ec=pc,Dc=yc,Oc=xc,kc=hc,Ac=_c;function jc(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=jc(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Mc(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=jc(e))&&(r&&(r+=` `),r+=t);return r}var Nc=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Pc=(e,t)=>({classGroupId:e,validator:t}),Fc=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ic=`-`,Lc=[],Rc=`arbitrary..`,zc=e=>{let t=Hc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Vc(e);let n=e.split(Ic);return Bc(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Nc(i,t):t:i||Lc}return n[e]||Lc}}},Bc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Bc(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Ic):e.slice(t).join(Ic),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Vc=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Rc+r:void 0})(),Hc=e=>{let{theme:t,classGroups:n}=e;return Uc(n,t)},Uc=(e,t)=>{let n=Fc();for(let r in e){let i=e[r];Wc(i,n,r,t)}return n},Wc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Gc(i,t,n,r)}},Gc=(e,t,n,r)=>{if(typeof e==`string`){Kc(e,t,n);return}if(typeof e==`function`){qc(e,t,n,r);return}Jc(e,t,n,r)},Kc=(e,t,n)=>{let r=e===``?t:Yc(t,e);r.classGroupId=n},qc=(e,t,n,r)=>{if(Xc(e)){Wc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Pc(n,e))},Jc=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Wc(o,Yc(t,a),n,r)}},Yc=(e,t)=>{let n=e,r=t.split(Ic),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Fc(),n.nextPart.set(t,i)),n=i}return n},Xc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Zc=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Qc=`!`,$c=`:`,el=[],tl=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),nl=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===$c){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Qc)?(c=s.slice(0,-1),l=!0):s.startsWith(Qc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return tl(t,l,c,u)};if(t){let e=t+$c,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):tl(el,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},rl=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},il=e=>({cache:Zc(e.cacheSize),parseClassName:nl(e),sortModifiers:rl(e),postfixLookupClassGroupIds:al(e),...zc(e)}),al=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},ol=/\s+/,sl=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(ol),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Qc:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},cl=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ll(n))&&(i&&(i+=` `),i+=r);return i},ll=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ll(e[r]))&&(n&&(n+=` `),n+=t);return n},ul=(e,...t)=>{let n,r,i,a,o=o=>(n=il(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=sl(e,n);return i(e,a),a};return a=o,(...e)=>a(cl(...e))},dl=[],fl=e=>{let t=t=>t[e]||dl;return t.isThemeGetter=!0,t},pl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ml=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hl=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gl=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_l=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,vl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yl=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xl=e=>hl.test(e),Sl=e=>!!e&&!Number.isNaN(Number(e)),Cl=e=>!!e&&Number.isInteger(Number(e)),wl=e=>e.endsWith(`%`)&&Sl(e.slice(0,-1)),Tl=e=>gl.test(e),El=()=>!0,Dl=e=>_l.test(e)&&!vl.test(e),Ol=()=>!1,kl=e=>yl.test(e),Al=e=>bl.test(e),jl=e=>!K(e)&&!q(e),Ml=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Nl=e=>Jl(e,Ql,Ol),K=e=>pl.test(e),Pl=e=>Jl(e,$l,Dl),Fl=e=>Jl(e,eu,Sl),Il=e=>Jl(e,nu,El),Ll=e=>Jl(e,tu,Ol),Rl=e=>Jl(e,Xl,Ol),zl=e=>Jl(e,Zl,Al),Bl=e=>Jl(e,ru,kl),q=e=>ml.test(e),Vl=e=>Yl(e,$l),Hl=e=>Yl(e,tu),Ul=e=>Yl(e,Xl),Wl=e=>Yl(e,Ql),Gl=e=>Yl(e,Zl),Kl=e=>Yl(e,ru,!0),ql=e=>Yl(e,nu,!0),Jl=(e,t,n)=>{let r=pl.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Yl=(e,t,n=!1)=>{let r=ml.exec(e);return r?r[1]?t(r[1]):n:!1},Xl=e=>e===`position`||e===`percentage`,Zl=e=>e===`image`||e===`url`,Ql=e=>e===`length`||e===`size`||e===`bg-size`,$l=e=>e===`length`,eu=e=>e===`number`,tu=e=>e===`family-name`,nu=e=>e===`number`||e===`weight`,ru=e=>e===`shadow`,iu=ul(()=>{let e=fl(`color`),t=fl(`font`),n=fl(`text`),r=fl(`font-weight`),i=fl(`tracking`),a=fl(`leading`),o=fl(`breakpoint`),s=fl(`container`),c=fl(`spacing`),l=fl(`radius`),u=fl(`shadow`),d=fl(`inset-shadow`),f=fl(`text-shadow`),p=fl(`drop-shadow`),m=fl(`blur`),h=fl(`perspective`),g=fl(`aspect`),_=fl(`ease`),v=fl(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),q,K],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[q,K,c],T=()=>[xl,`full`,`auto`,...w()],E=()=>[Cl,`none`,`subgrid`,q,K],D=()=>[`auto`,{span:[`full`,Cl,q,K]},Cl,q,K],O=()=>[Cl,`auto`,q,K],k=()=>[`auto`,`min`,`max`,`fr`,q,K],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[xl,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[xl,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[xl,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,q,K],L=()=>[...b(),Ul,Rl,{position:[q,K]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,Wl,Nl,{size:[q,K]}],ne=()=>[wl,Vl,Pl],re=()=>[``,`none`,`full`,l,q,K],R=()=>[``,Sl,Vl,Pl],ie=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[Sl,wl,Ul,Rl],se=()=>[``,`none`,m,q,K],ce=()=>[`none`,Sl,q,K],le=()=>[`none`,Sl,q,K],ue=()=>[Sl,q,K],de=()=>[xl,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Tl],breakpoint:[Tl],color:[El],container:[Tl],"drop-shadow":[Tl],ease:[`in`,`out`,`in-out`],font:[jl],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Tl],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Tl],shadow:[Tl],spacing:[`px`,Sl],text:[Tl],"text-shadow":[Tl],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,xl,K,q,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,q,K]}],"container-named":[Ml],columns:[{columns:[Sl,K,q,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Cl,`auto`,q,K]}],basis:[{basis:[xl,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Sl,xl,`auto`,`initial`,`none`,K]}],grow:[{grow:[``,Sl,q,K]}],shrink:[{shrink:[``,Sl,q,K]}],order:[{order:[Cl,`first`,`last`,`none`,q,K]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,Vl,Pl]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ql,Il]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,wl,K]}],"font-family":[{font:[Hl,Ll,t]}],"font-features":[{"font-features":[K]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,q,K]}],"line-clamp":[{"line-clamp":[Sl,`none`,q,Fl]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,q,K]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,q,K]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ie(),`wavy`]}],"text-decoration-thickness":[{decoration:[Sl,`from-font`,`auto`,q,Pl]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Sl,`auto`,q,K]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Cl,q,K]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,q,K]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,q,K]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:te()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Cl,q,K],radial:[``,q,K],conic:[Cl,q,K]},Gl,zl]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ie(),`hidden`,`none`]}],"divide-style":[{divide:[...ie(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ie(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Sl,q,K]}],"outline-w":[{outline:[``,Sl,Vl,Pl]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Kl,Bl]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Kl,Bl]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Sl,Pl]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Kl,Bl]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Sl,q,K]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Sl]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[q,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Sl]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,q,K]}],filter:[{filter:[``,`none`,q,K]}],blur:[{blur:se()}],brightness:[{brightness:[Sl,q,K]}],contrast:[{contrast:[Sl,q,K]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Kl,Bl]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Sl,q,K]}],"hue-rotate":[{"hue-rotate":[Sl,q,K]}],invert:[{invert:[``,Sl,q,K]}],saturate:[{saturate:[Sl,q,K]}],sepia:[{sepia:[``,Sl,q,K]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,q,K]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[Sl,q,K]}],"backdrop-contrast":[{"backdrop-contrast":[Sl,q,K]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Sl,q,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Sl,q,K]}],"backdrop-invert":[{"backdrop-invert":[``,Sl,q,K]}],"backdrop-opacity":[{"backdrop-opacity":[Sl,q,K]}],"backdrop-saturate":[{"backdrop-saturate":[Sl,q,K]}],"backdrop-sepia":[{"backdrop-sepia":[``,Sl,q,K]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,q,K]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Sl,`initial`,q,K]}],ease:[{ease:[`linear`,`initial`,_,q,K]}],delay:[{delay:[Sl,q,K]}],animate:[{animate:[`none`,v,q,K]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,q,K]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[q,K,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":[`translate-none`],zoom:[{zoom:[Cl,q,K]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,q,K]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,q,K]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Sl,Vl,Pl,Fl]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function au(...e){return iu(Mc(e))}var ou=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,su=Mc,cu=(e,t)=>n=>{if(t?.variants==null)return su(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ou(t)||ou(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return su(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},lu=cu(`group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding text-sm font-medium transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)]`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}}),J=u.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,H.jsx)(r?ia:`button`,{ref:a,"data-slot":`button`,"data-variant":t??`default`,"data-size":n??`default`,className:au(lu({variant:t,size:n,className:e})),...i}));J.displayName=`Button`;function uu(e){return(0,H.jsx)(Sc,{"data-slot":`alert-dialog`,...e})}var du=u.forwardRef((e,t)=>(0,H.jsx)(Cc,{ref:t,"data-slot":`alert-dialog-trigger`,...e}));du.displayName=Cc.displayName;function fu(e){return(0,H.jsx)(wc,{"data-slot":`alert-dialog-portal`,...e})}var pu=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Tc,{ref:n,"data-slot":`alert-dialog-overlay`,className:au(`fixed inset-0 z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0`,e),...t}));pu.displayName=Tc.displayName;var mu=u.forwardRef(({className:e,size:t=`default`,...n},r)=>(0,H.jsxs)(fu,{children:[(0,H.jsx)(pu,{}),(0,H.jsx)(Ec,{ref:r,"data-slot":`alert-dialog-content`,"data-size":t,className:au(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] min-w-0 -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0`,e),...n})]}));mu.displayName=Ec.displayName;function hu({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:au(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function gu({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:au(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function _u({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-media`,className:au(`mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6`,e),...t})}var vu=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(kc,{ref:n,"data-slot":`alert-dialog-title`,className:au(`text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t}));vu.displayName=kc.displayName;var yu=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Ac,{ref:n,"data-slot":`alert-dialog-description`,className:au(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}));yu.displayName=Ac.displayName;var bu=u.forwardRef(({className:e,variant:t=`default`,size:n=`default`,...r},i)=>(0,H.jsx)(J,{variant:t,size:n,asChild:!0,children:(0,H.jsx)(Dc,{ref:i,"data-slot":`alert-dialog-action`,className:au(e),...r})}));bu.displayName=Dc.displayName;var xu=u.forwardRef(({className:e,variant:t=`outline`,size:n=`default`,...r},i)=>(0,H.jsx)(J,{variant:t,size:n,asChild:!0,children:(0,H.jsx)(Oc,{ref:i,"data-slot":`alert-dialog-cancel`,className:au(e),...r})}));xu.displayName=Oc.displayName;function Su(e){return(0,H.jsx)(As,{"data-slot":`dialog`,...e})}var Cu=u.forwardRef((e,t)=>(0,H.jsx)(Ms,{ref:t,"data-slot":`dialog-trigger`,...e}));Cu.displayName=Ms.displayName;function wu(e){return(0,H.jsx)(Is,{"data-slot":`dialog-portal`,...e})}var Tu=u.forwardRef((e,t)=>(0,H.jsx)(Zs,{ref:t,"data-slot":`dialog-close`,...e}));Tu.displayName=Zs.displayName;var Eu=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Rs,{ref:n,"data-slot":`dialog-overlay`,className:au(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0`,e),...t}));Eu.displayName=Rs.displayName;var Du=u.forwardRef(({className:e,children:t,showCloseButton:n=!0,...r},i)=>(0,H.jsxs)(wu,{children:[(0,H.jsx)(Eu,{}),(0,H.jsxs)(Hs,{ref:i,"data-slot":`dialog-content`,className:au(`fixed top-1/2 left-1/2 z-50 grid w-full min-w-0 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0`,e),...r,children:[t,n&&(0,H.jsx)(Zs,{"data-slot":`dialog-close`,asChild:!0,children:(0,H.jsxs)(J,{variant:`ghost`,size:`icon-sm`,className:`absolute top-2 right-2`,children:[(0,H.jsx)(di,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]}));Du.displayName=Hs.displayName;function Ou({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-header`,className:au(`flex flex-col gap-2`,e),...t})}function ku({className:e,showCloseButton:t=!1,children:n,...r}){return(0,H.jsxs)(`div`,{"data-slot":`dialog-footer`,className:au(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,H.jsx)(Zs,{asChild:!0,children:(0,H.jsx)(J,{variant:`outline`,children:`Close`})})]})}var Au=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(qs,{ref:n,"data-slot":`dialog-title`,className:au(`text-base leading-none font-medium`,e),...t}));Au.displayName=qs.displayName;var ju=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Ys,{ref:n,"data-slot":`dialog-description`,className:au(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}));ju.displayName=Ys.displayName;function Mu(e){let t=e+`CollectionProvider`,[n,r]=Wi(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=u.useRef(null),a=u.useRef(new Map).current;return(0,H.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=ra(s),l=u.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=Ji(t,a(s,n).collectionRef);return(0,H.jsx)(c,{ref:i,children:r})});l.displayName=s;let d=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=ra(d),m=u.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=u.useRef(null),s=Ji(t,o),c=a(d,n);return u.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,H.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=d;function h(t){let n=a(e+`CollectionConsumer`,t);return u.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:m},h,r]}var Nu=u.createContext(void 0);function Pu(e){let t=u.useContext(Nu);return e||t||`ltr`}var Fu=[`top`,`right`,`bottom`,`left`],Iu=Math.min,Lu=Math.max,Ru=Math.round,zu=Math.floor,Bu=e=>({x:e,y:e}),Vu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Hu(e,t,n){return Lu(e,Iu(t,n))}function Uu(e,t){return typeof e==`function`?e(t):e}function Wu(e){return e.split(`-`)[0]}function Gu(e){return e.split(`-`)[1]}function Ku(e){return e===`x`?`y`:`x`}function qu(e){return e===`y`?`height`:`width`}function Ju(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Yu(e){return Ku(Ju(e))}function Xu(e,t,n){n===void 0&&(n=!1);let r=Gu(e),i=Yu(e),a=qu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ad(o)),[o,ad(o)]}function Zu(e){let t=ad(e);return[Qu(e),t,Qu(t)]}function Qu(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var $u=[`left`,`right`],ed=[`right`,`left`],td=[`top`,`bottom`],nd=[`bottom`,`top`];function rd(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ed:$u:t?$u:ed;case`left`:case`right`:return t?td:nd;default:return[]}}function id(e,t,n,r){let i=Gu(e),a=rd(Wu(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Qu)))),a}function ad(e){let t=Wu(e);return Vu[t]+e.slice(t.length)}function od(e){return{top:0,right:0,bottom:0,left:0,...e}}function sd(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:od(e)}function cd(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ld(e,t,n){let{reference:r,floating:i}=e,a=Ju(t),o=Yu(t),s=qu(o),c=Wu(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Gu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1)}return p}async function ud(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Uu(t,e),p=sd(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=cd(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=cd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var dd=50,fd=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ud},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ld(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<dd&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ld(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},pd=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Uu(e,t)||{};if(l==null)return{};let d=sd(u),f={x:n,y:r},p=Yu(i),m=qu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Iu(d[_],T),D=Iu(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Hu(O,A,k),M=!c.arrow&&Gu(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),md=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Uu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Wu(r),_=Ju(o),v=Wu(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ad(o)]:Zu(o)),x=p!==`none`;!d&&x&&b.push(...id(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Xu(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Ju(t)||T.every(e=>Ju(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ju(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function hd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gd(e){return Fu.some(t=>e[t]>=0)}var _d=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Uu(e,t);switch(i){case`referenceHidden`:{let e=hd(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:gd(e)}}}case`escaped`:{let e=hd(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:gd(e)}}}default:return{}}}}},vd=new Set([`left`,`top`]);async function yd(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Wu(n),s=Gu(n),c=Ju(n)===`y`,l=vd.has(o)?-1:1,u=a&&c?-1:1,d=Uu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var bd=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await yd(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},xd=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Uu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ju(Wu(i)),p=Ku(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Hu(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Hu(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Sd=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Uu(e,t),u={x:n,y:r},d=Ju(i),f=Ku(d),p=u[f],m=u[d],h=Uu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=vd.has(Wu(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Cd=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Uu(e,t),u=await o.detectOverflow(t,l),d=Wu(i),f=Gu(i),p=Ju(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Iu(h-u[g],v),x=Iu(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Lu(u.left,0),t=Lu(u.right,0),n=Lu(u.top,0),r=Lu(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Lu(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Lu(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function wd(){return typeof window<`u`}function Td(e){return Od(e)?(e.nodeName||``).toLowerCase():`#document`}function Ed(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Dd(e){return((Od(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Od(e){return wd()?e instanceof Node||e instanceof Ed(e).Node:!1}function kd(e){return wd()?e instanceof Element||e instanceof Ed(e).Element:!1}function Ad(e){return wd()?e instanceof HTMLElement||e instanceof Ed(e).HTMLElement:!1}function jd(e){return!wd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ed(e).ShadowRoot}function Md(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ud(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Nd(e){return/^(table|td|th)$/.test(Td(e))}function Pd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Fd=/transform|translate|scale|rotate|perspective|filter/,Id=/paint|layout|strict|content/,Ld=e=>!!e&&e!==`none`,Rd;function zd(e){let t=kd(e)?Ud(e):e;return Ld(t.transform)||Ld(t.translate)||Ld(t.scale)||Ld(t.rotate)||Ld(t.perspective)||!Vd()&&(Ld(t.backdropFilter)||Ld(t.filter))||Fd.test(t.willChange||``)||Id.test(t.contain||``)}function Bd(e){let t=Gd(e);for(;Ad(t)&&!Hd(t);){if(zd(t))return t;if(Pd(t))return null;t=Gd(t)}return null}function Vd(){return Rd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Rd}function Hd(e){return/^(html|body|#document)$/.test(Td(e))}function Ud(e){return Ed(e).getComputedStyle(e)}function Wd(e){return kd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gd(e){if(Td(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||jd(e)&&e.host||Dd(e);return jd(t)?t.host:t}function Kd(e){let t=Gd(e);return Hd(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ad(t)&&Md(t)?t:Kd(t)}function qd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Kd(e),i=r===e.ownerDocument?.body,a=Ed(r);if(i){let e=Jd(a);return t.concat(a,a.visualViewport||[],Md(r)?r:[],e&&n?qd(e):[])}return t.concat(r,qd(r,[],n))}function Jd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yd(e){let t=Ud(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ad(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ru(n)!==a||Ru(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Xd(e){return kd(e)?e:e.contextElement}function Zd(e){let t=Xd(e);if(!Ad(t))return Bu(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Yd(t),o=(a?Ru(n.width):n.width)/r,s=(a?Ru(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Qd=Bu(0);function $d(e){let t=Ed(e);return!Vd()||!t.visualViewport?Qd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ef(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ed(e)?!1:t}function tf(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Xd(e),o=Bu(1);t&&(r?kd(r)&&(o=Zd(r)):o=Zd(e));let s=ef(a,n,r)?$d(a):Bu(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ed(a),t=r&&kd(r)?Ed(r):r,n=e,i=Jd(n);for(;i&&r&&t!==n;){let e=Zd(i),t=i.getBoundingClientRect(),r=Ud(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ed(i),i=Jd(n)}}return cd({width:u,height:d,x:c,y:l})}function nf(e,t){let n=Wd(e).scrollLeft;return t?t.left+n:tf(Dd(e)).left+n}function rf(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-nf(e,n),y:n.top+t.scrollTop}}function af(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Dd(r),s=t?Pd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Bu(1),u=Bu(0),d=Ad(r);if((d||!d&&!a)&&((Td(r)!==`body`||Md(o))&&(c=Wd(r)),d)){let e=tf(r);l=Zd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?rf(o,c):Bu(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function of(e){return Array.from(e.getClientRects())}function sf(e){let t=Dd(e),n=Wd(e),r=e.ownerDocument.body,i=Lu(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Lu(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+nf(e),s=-n.scrollTop;return Ud(r).direction===`rtl`&&(o+=Lu(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var cf=25;function lf(e,t){let n=Ed(e),r=Dd(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Vd();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=nf(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=cf&&(a-=o)}else l<=cf&&(a+=l);return{width:a,height:o,x:s,y:c}}function uf(e,t){let n=tf(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ad(e)?Zd(e):Bu(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function df(e,t,n){let r;if(t===`viewport`)r=lf(e,n);else if(t===`document`)r=sf(Dd(e));else if(kd(t))r=uf(t,n);else{let n=$d(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return cd(r)}function ff(e,t){let n=Gd(e);return n===t||!kd(n)||Hd(n)?!1:Ud(n).position===`fixed`||ff(n,t)}function pf(e,t){let n=t.get(e);if(n)return n;let r=qd(e,[],!1).filter(e=>kd(e)&&Td(e)!==`body`),i=null,a=Ud(e).position===`fixed`,o=a?Gd(e):e;for(;kd(o)&&!Hd(o);){let t=Ud(o),n=zd(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Md(o)&&!n&&ff(e,o))?r=r.filter(e=>e!==o):i=t,o=Gd(o)}return t.set(e,r),r}function mf(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Pd(t)?[]:pf(t,this._c):[].concat(n),r],o=df(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=df(t,a[e],i);s=Lu(n.top,s),c=Iu(n.right,c),l=Iu(n.bottom,l),u=Lu(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function hf(e){let{width:t,height:n}=Yd(e);return{width:t,height:n}}function gf(e,t,n){let r=Ad(t),i=Dd(t),a=n===`fixed`,o=tf(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Bu(0);function l(){c.x=nf(i)}if(r||!r&&!a){if((Td(t)!==`body`||Md(i))&&(s=Wd(t)),r){let e=tf(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l()}a&&!r&&i&&l();let u=i&&!r&&!a?rf(i,s):Bu(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function _f(e){return Ud(e).position===`static`}function vf(e,t){if(!Ad(e)||Ud(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Dd(e)===n&&(n=n.ownerDocument.body),n}function yf(e,t){let n=Ed(e);if(Pd(e))return n;if(!Ad(e)){let t=Gd(e);for(;t&&!Hd(t);){if(kd(t)&&!_f(t))return t;t=Gd(t)}return n}let r=vf(e,t);for(;r&&Nd(r)&&_f(r);)r=vf(r,t);return r&&Hd(r)&&_f(r)&&!zd(r)?n:r||Bd(e)||n}var bf=async function(e){let t=this.getOffsetParent||yf,n=this.getDimensions,r=await n(e.floating);return{reference:gf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xf(e){return Ud(e).direction===`rtl`}var Sf={convertOffsetParentRelativeRectToViewportRelativeRect:af,getDocumentElement:Dd,getClippingRect:mf,getOffsetParent:yf,getElementRects:bf,getClientRects:of,getDimensions:hf,getScale:Zd,isElement:kd,isRTL:xf};function Cf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wf(e,t){let n=null,r,i=Dd(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=zu(d),h=zu(i.clientWidth-(u+f)),g=zu(i.clientHeight-(d+p)),_=zu(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Lu(0,Iu(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Cf(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Tf(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Xd(e),u=i||a?[...l?qd(l):[],...t?qd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?wf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?tf(e):null;c&&g();function g(){let t=tf(e);h&&!Cf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ef=bd,Df=xd,Of=md,kf=Cd,Af=_d,jf=pd,Mf=Sd,Nf=(e,t,n)=>{let r=new Map,i={platform:Sf,...n},a={...i.platform,_c:r};return fd(e,t,{...i,platform:a})},Pf=typeof document<`u`?u.useLayoutEffect:function(){};function Ff(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ff(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ff(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function If(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lf(e,t){let n=If(e);return Math.round(t*n)/n}function Rf(e){let t=u.useRef(e);return Pf(()=>{t.current=e}),t}function zf(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[f,p]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=u.useState(r);Ff(m,r)||h(r);let[g,_]=u.useState(null),[v,y]=u.useState(null),b=u.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=u.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=u.useRef(null),T=u.useRef(null),E=u.useRef(f),D=c!=null,O=Rf(c),k=Rf(i),A=Rf(l),j=u.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};k.current&&(e.platform=k.current),Nf(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Ff(E.current,t)&&(E.current=t,d.flushSync(()=>{p(t)}))})},[m,t,n,k,A]);Pf(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[l]);let M=u.useRef(!1);Pf(()=>(M.current=!0,()=>{M.current=!1}),[]),Pf(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=u.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=u.useMemo(()=>({reference:S,floating:C}),[S,C]),F=u.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Lf(P.floating,f.x),r=Lf(P.floating,f.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...If(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:j,refs:N,elements:P,floatingStyles:F}),[f,j,N,P,F])}var Bf=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:jf({element:r.current,padding:i}).fn(n):r?jf({element:r,padding:i}).fn(n):{}}}},Vf=(e,t)=>{let n=Ef(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hf=(e,t)=>{let n=Df(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uf=(e,t)=>({fn:Mf(e).fn,options:[e,t]}),Wf=(e,t)=>{let n=Of(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gf=(e,t)=>{let n=kf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kf=(e,t)=>{let n=Af(e);return{name:n.name,fn:n.fn,options:[e,t]}},qf=(e,t)=>{let n=Bf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jf=`Arrow`,Yf=u.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,H.jsx)(W.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,H.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Yf.displayName=Jf;var Xf=Yf;function Zf(e){let[t,n]=u.useState(void 0);return Yi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}var Qf=`Popper`,[$f,ep]=Wi(Qf),[tp,np]=$f(Qf),rp=e=>{let{__scopePopper:t,children:n}=e,[r,i]=u.useState(null),[a,o]=u.useState(void 0);return(0,H.jsx)(tp,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};rp.displayName=Qf;var ip=`PopperAnchor`,ap=u.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=np(ip,n),o=u.useRef(null),s=a.onAnchorChange,c=Ji(t,u.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=u.useRef(null);u.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let d=a.placementState&&hp(a.placementState),f=d?.[0],p=d?.[1];return r?null:(0,H.jsx)(W.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:c})});ap.displayName=ip;var op=`PopperContent`,[sp,cp]=$f(op),lp=u.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=np(op,n),[v,y]=u.useState(null),b=Ji(t,y),[x,S]=u.useState(null),C=Zf(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(pp),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=zf({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Tf(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[Vf({mainAxis:i+T,alignmentAxis:o}),c&&Hf({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?Uf():void 0,...A}),c&&Wf({...A}),Gf({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&qf({element:x,padding:s}),mp({arrowWidth:w,arrowHeight:T}),p&&Kf({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),I=_.setPlacementState;Yi(()=>(I(N),()=>{I(void 0)}),[N,I]);let[L,ee]=hp(N),te=_a(h);Yi(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,R=F.arrow?.centerOffset!==0,[ie,ae]=u.useState();return Yi(()=>{v&&ae(window.getComputedStyle(v).zIndex)},[v]),(0,H.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ie,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,H.jsx)(sp,{scope:n,placedSide:L,placedAlign:ee,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:R,children:(0,H.jsx)(W.div,{"data-side":L,"data-align":ee,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});lp.displayName=op;var up=`PopperArrow`,dp={top:`bottom`,right:`left`,bottom:`top`,left:`right`},fp=u.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=cp(up,n),a=dp[i.placedSide];return(0,H.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,H.jsx)(Xf,{...r,ref:t,style:{...r.style,display:`block`}})})});fp.displayName=up;function pp(e){return e!==null}var mp=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=hp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function hp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var gp=rp,_p=ap,vp=lp,yp=fp,bp=!1;function xp(){let[e,t]=u.useState(bp);return u.useEffect(()=>{bp||(bp=!0,t(!0))},[]),e}var Sp=u.useSyncExternalStore;function Cp(){return()=>{}}function wp(){return Sp(Cp,()=>!0,()=>!1)}var Tp=typeof Sp==`function`?wp:xp,Ep=`rovingFocusGroup.onEntryFocus`,Dp={bubbles:!1,cancelable:!0},Op=`RovingFocusGroup`,[kp,Ap,jp]=Mu(Op),[Mp,Np]=Wi(Op,[jp]),[Pp,Fp]=Mp(Op),Ip=u.forwardRef((e,t)=>(0,H.jsx)(kp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(kp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(Lp,{...e,ref:t})})}));Ip.displayName=Op;var Lp=u.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...f}=e,p=u.useRef(null),m=Ji(t,p),h=Pu(a),[g,_]=ea({prop:o,defaultProp:s??null,onChange:c,caller:Op}),[v,y]=u.useState(!1),b=_a(l),x=Ap(n),S=u.useRef(!1),[C,w]=u.useState(0);return u.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(Ep,b),()=>e.removeEventListener(Ep,b)},[b]),(0,H.jsx)(Pp,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:u.useCallback(e=>_(e),[_]),onItemShiftTab:u.useCallback(()=>y(!0),[]),onFocusableItemAdd:u.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:u.useCallback(()=>w(e=>e-1),[]),children:(0,H.jsx)(W.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:`none`,...e.style},onMouseDown:U(e.onMouseDown,()=>{S.current=!0}),onFocus:U(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Ep,Dp);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Up([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),d)}}S.current=!1}),onBlur:U(e.onBlur,()=>y(!1))})})}),Rp=`RovingFocusGroupItem`,zp=u.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Qi(),l=a||c,d=Fp(Rp,n),f=d.currentTabStopId===l,p=Ap(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=d,_=Tp();return Yi(()=>{if(!(!_||!r))return m(),()=>h()},[_,r,m,h]),u.useEffect(()=>{if(!(_||!r))return m(),()=>h()},[_,r,m,h]),(0,H.jsx)(kp.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(W.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:U(e.onMouseDown,e=>{r?d.onItemFocus(l):e.preventDefault()}),onFocus:U(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:U(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Hp(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?Wp(n,r+1):n.slice(r+1)}setTimeout(()=>Up(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:g!=null}):o})})});zp.displayName=Rp;var Bp={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Vp(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Hp(e,t,n){let r=Vp(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Bp[r]}function Up(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Wp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gp=Ip,Kp=zp,qp=[`Enter`,` `],Jp=[`ArrowDown`,`PageUp`,`Home`],Yp=[`ArrowUp`,`PageDown`,`End`],Xp=[...Jp,...Yp],Zp={ltr:[...qp,`ArrowRight`],rtl:[...qp,`ArrowLeft`]},Qp={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},$p=`Menu`,[em,tm,nm]=Mu($p),[rm,im]=Wi($p,[nm,ep,Np]),am=ep(),om=Np(),[sm,cm]=rm($p),[lm,um]=rm($p),dm=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=am(t),[c,l]=u.useState(null),d=u.useRef(!1),f=_a(a),p=Pu(i);return u.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),u.useEffect(()=>{if(!n)return;let e=()=>f(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,H.jsx)(gp,{...s,children:(0,H.jsx)(sm,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:l,children:(0,H.jsx)(lm,{scope:t,onClose:u.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:o,children:r})})})};dm.displayName=$p;var fm=`MenuAnchor`,pm=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=am(n);return(0,H.jsx)(_p,{...i,...r,ref:t})});pm.displayName=fm;var mm=`MenuPortal`,[hm,gm]=rm(mm,{forceMount:void 0}),_m=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=cm(mm,t);return(0,H.jsx)(hm,{scope:t,forceMount:n,children:(0,H.jsx)(Qa,{present:n||a.open,children:(0,H.jsx)(Xa,{asChild:!0,container:i,children:r})})})};_m.displayName=mm;var vm=`MenuContent`,[ym,bm]=rm(vm),xm=u.forwardRef((e,t)=>{let n=gm(vm,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=cm(vm,e.__scopeMenu),o=um(vm,e.__scopeMenu);return(0,H.jsx)(em.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(Qa,{present:r||a.open,children:(0,H.jsx)(em.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(Sm,{...i,ref:t}):(0,H.jsx)(Cm,{...i,ref:t})})})})}),Sm=u.forwardRef((e,t)=>{let n=cm(vm,e.__scopeMenu),r=u.useRef(null),i=Ji(t,r);return u.useEffect(()=>{let e=r.current;if(e)return ws(e)},[]),(0,H.jsx)(Tm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Cm=u.forwardRef((e,t)=>{let n=cm(vm,e.__scopeMenu);return(0,H.jsx)(Tm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wm=ra(`MenuContent.ScrollLock`),Tm=u.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=cm(vm,n),v=um(vm,n),y=am(n),b=om(n),x=tm(n),[S,C]=u.useState(null),w=u.useRef(null),T=Ji(t,w,_.onContentChange),E=u.useRef(0),D=u.useRef(``),O=u.useRef(0),k=u.useRef(null),A=u.useRef(`right`),j=u.useRef(0),M=h?hs:u.Fragment,N=h?{as:wm,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=lh(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};u.useEffect(()=>()=>window.clearTimeout(E.current),[]),oo();let F=u.useCallback(e=>A.current===k.current?.side&&dh(e,k.current?.area),[]);return(0,H.jsx)(ym,{scope:n,searchRef:D,onItemEnter:u.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:u.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:u.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:u.useCallback(e=>{k.current=e},[]),children:(0,H.jsx)(M,{...N,children:(0,H.jsx)(La,{asChild:!0,trapped:i,onMountAutoFocus:U(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(wa,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,H.jsx)(Gp,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:U(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(vp,{role:`menu`,"aria-orientation":`vertical`,"data-state":ih(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:U(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!Xp.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Yp.includes(e.key)&&a.reverse(),sh(a)}),onBlur:U(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:U(e.onPointerMove,fh(e=>{let t=e.target,n=j.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>j.current?`right`:`left`;A.current=t,j.current=e.clientX}}))})})})})})})});xm.displayName=vm;var Em=`MenuGroup`,Dm=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(W.div,{role:`group`,...r,ref:t})});Dm.displayName=Em;var Om=`MenuLabel`,km=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(W.div,{...r,ref:t})});km.displayName=Om;var Am=`MenuItem`,jm=`menu.itemSelect`,Mm=u.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=u.useRef(null),o=um(Am,e.__scopeMenu),s=bm(Am,e.__scopeMenu),c=Ji(t,a),l=u.useRef(!1),d=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(jm,{bubbles:!0,cancelable:!0});e.addEventListener(jm,e=>r?.(e),{once:!0}),ga(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,H.jsx)(Nm,{...i,ref:c,disabled:n,onClick:U(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:U(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:U(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&qp.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Mm.displayName=Am;var Nm=u.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=bm(Am,n),s=om(n),c=u.useRef(null),l=Ji(t,c),[d,f]=u.useState(!1),[p,m]=u.useState(``);return u.useEffect(()=>{let e=c.current;e&&m((e.textContent??``).trim())},[a.children]),(0,H.jsx)(em.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,H.jsx)(Kp,{asChild:!0,...s,focusable:!r,children:(0,H.jsx)(W.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:U(e.onPointerMove,fh(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:U(e.onPointerLeave,fh(e=>o.onItemLeave(e))),onFocus:U(e.onFocus,()=>f(!0)),onBlur:U(e.onBlur,()=>f(!1))})})})}),Pm=`MenuCheckboxItem`,Fm=u.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(Um,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(Mm,{role:`menuitemcheckbox`,"aria-checked":ah(n)?`mixed`:n,...i,ref:t,"data-state":oh(n),onSelect:U(i.onSelect,()=>r?.(ah(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Fm.displayName=Pm;var Im=`MenuRadioGroup`,[Lm,Rm]=rm(Im,{value:void 0,onValueChange:()=>{}}),zm=u.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=_a(r);return(0,H.jsx)(Lm,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,H.jsx)(Dm,{...i,ref:t})})});zm.displayName=Im;var Bm=`MenuRadioItem`,Vm=u.forwardRef((e,t)=>{let{value:n,...r}=e,i=Rm(Bm,e.__scopeMenu),a=n===i.value;return(0,H.jsx)(Um,{scope:e.__scopeMenu,checked:a,children:(0,H.jsx)(Mm,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":oh(a),onSelect:U(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Vm.displayName=Bm;var Hm=`MenuItemIndicator`,[Um,Wm]=rm(Hm,{checked:!1}),Gm=u.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Wm(Hm,n);return(0,H.jsx)(Qa,{present:r||ah(a.checked)||a.checked===!0,children:(0,H.jsx)(W.span,{...i,ref:t,"data-state":oh(a.checked)})})});Gm.displayName=Hm;var Km=`MenuSeparator`,qm=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(W.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});qm.displayName=Km;var Jm=`MenuArrow`,Ym=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=am(n);return(0,H.jsx)(yp,{...i,...r,ref:t})});Ym.displayName=Jm;var Xm=`MenuSub`,[Zm,Qm]=rm(Xm),$m=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=cm(Xm,t),o=am(t),[s,c]=u.useState(null),[l,d]=u.useState(null),f=_a(i);return u.useEffect(()=>(a.open===!1&&f(!1),()=>f(!1)),[a.open,f]),(0,H.jsx)(gp,{...o,children:(0,H.jsx)(sm,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:d,children:(0,H.jsx)(Zm,{scope:t,contentId:Qi(),triggerId:Qi(),trigger:s,onTriggerChange:c,children:n})})})};$m.displayName=Xm;var eh=`MenuSubTrigger`,th=u.forwardRef((e,t)=>{let n=cm(eh,e.__scopeMenu),r=um(eh,e.__scopeMenu),i=Qm(eh,e.__scopeMenu),a=bm(eh,e.__scopeMenu),o=u.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},d=u.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);u.useEffect(()=>d,[d]),u.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let f=Ji(t,i.onTriggerChange);return(0,H.jsx)(pm,{asChild:!0,...l,children:(0,H.jsx)(Nm,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":ih(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:U(e.onPointerMove,fh(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:U(e.onPointerLeave,fh(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:U(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(a.searchRef.current===``||t.key!==` `)&&Zp[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});th.displayName=eh;var nh=`MenuSubContent`,rh=u.forwardRef((e,t)=>{let n=gm(vm,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=cm(vm,e.__scopeMenu),s=um(vm,e.__scopeMenu),c=Qm(nh,e.__scopeMenu),l=u.useRef(null),d=Ji(t,l);return(0,H.jsx)(em.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(Qa,{present:r||o.open,children:(0,H.jsx)(em.Slot,{scope:e.__scopeMenu,children:(0,H.jsx)(Tm,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:d,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:U(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:U(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:U(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Qp[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});rh.displayName=nh;function ih(e){return e?`open`:`closed`}function ah(e){return e===`indeterminate`}function oh(e){return ah(e)?`indeterminate`:e?`checked`:`unchecked`}function sh(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ch(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function lh(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ch(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function uh(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function dh(e,t){return t?uh({x:e.clientX,y:e.clientY},t):!1}function fh(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ph=dm,mh=pm,hh=_m,gh=xm,_h=Dm,vh=km,yh=Mm,bh=Fm,xh=zm,Sh=Vm,Ch=Gm,wh=qm,Th=Ym,Eh=$m,Dh=th,Oh=rh,kh=`DropdownMenu`,[Ah,jh]=Wi(kh,[im]),Mh=im(),[Nh,Ph]=Ah(kh),Fh=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Mh(t),l=u.useRef(null),[d,f]=ea({prop:i,defaultProp:a??!1,onChange:o,caller:kh});return(0,H.jsx)(Nh,{scope:t,triggerId:Qi(),triggerRef:l,contentId:Qi(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(e=>!e),[f]),modal:s,children:(0,H.jsx)(ph,{...c,open:d,onOpenChange:f,dir:r,modal:s,children:n})})};Fh.displayName=kh;var Ih=`DropdownMenuTrigger`,Lh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ph(Ih,n),o=Mh(n),s=Ji(t,a.triggerRef);return(0,H.jsx)(mh,{asChild:!0,...o,children:(0,H.jsx)(W.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:U(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:U(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Lh.displayName=Ih;var Rh=`DropdownMenuPortal`,zh=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Mh(t);return(0,H.jsx)(hh,{...r,...n})};zh.displayName=Rh;var Bh=`DropdownMenuContent`,Vh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ph(Bh,n),a=Mh(n),o=u.useRef(!1);return(0,H.jsx)(gh,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:U(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Vh.displayName=Bh;var Hh=`DropdownMenuGroup`,Uh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(_h,{...i,...r,ref:t})});Uh.displayName=Hh;var Wh=`DropdownMenuLabel`,Gh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(vh,{...i,...r,ref:t})});Gh.displayName=Wh;var Kh=`DropdownMenuItem`,qh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(yh,{...i,...r,ref:t})});qh.displayName=Kh;var Jh=`DropdownMenuCheckboxItem`,Yh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(bh,{...i,...r,ref:t})});Yh.displayName=Jh;var Xh=`DropdownMenuRadioGroup`,Zh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(xh,{...i,...r,ref:t})});Zh.displayName=Xh;var Qh=`DropdownMenuRadioItem`,$h=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(Sh,{...i,...r,ref:t})});$h.displayName=Qh;var eg=`DropdownMenuItemIndicator`,tg=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(Ch,{...i,...r,ref:t})});tg.displayName=eg;var ng=`DropdownMenuSeparator`,rg=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(wh,{...i,...r,ref:t})});rg.displayName=ng;var ig=`DropdownMenuArrow`,ag=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(Th,{...i,...r,ref:t})});ag.displayName=ig;var og=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Mh(t),[s,c]=ea({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,H.jsx)(Eh,{...o,open:s,onOpenChange:c,children:n})},sg=`DropdownMenuSubTrigger`,cg=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(Dh,{...i,...r,ref:t})});cg.displayName=sg;var lg=`DropdownMenuSubContent`,ug=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Mh(n);return(0,H.jsx)(Oh,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});ug.displayName=lg;var dg=Fh,fg=Lh,pg=zh,mg=Vh,hg=Gh,gg=qh,_g=rg,vg=og,yg=cg,bg=ug;function xg(e){return(0,H.jsx)(dg,{"data-slot":`dropdown-menu`,...e})}var Sg=u.forwardRef((e,t)=>(0,H.jsx)(fg,{ref:t,"data-slot":`dropdown-menu-trigger`,...e}));Sg.displayName=fg.displayName;var Cg=u.forwardRef(({className:e,sideOffset:t=4,collisionPadding:n=8,...r},i)=>(0,H.jsx)(pg,{children:(0,H.jsx)(mg,{ref:i,"data-slot":`dropdown-menu-content`,sideOffset:t,collisionPadding:n,className:au(`cn-menu-translucent z-50 min-w-36 origin-[var(--radix-dropdown-menu-content-transform-origin)] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));Cg.displayName=mg.displayName;var wg=u.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,H.jsx)(gg,{ref:r,"data-slot":`dropdown-menu-item`,"data-variant":t,className:au(`relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,t===`destructive`&&`text-destructive focus:bg-destructive/10 focus:text-destructive dark:focus:bg-destructive/20`,e),...n}));wg.displayName=gg.displayName;var Tg=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(hg,{ref:n,"data-slot":`dropdown-menu-label`,className:au(`px-2 py-1.5 text-xs font-medium text-muted-foreground`,e),...t}));Tg.displayName=hg.displayName;var Eg=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(_g,{ref:n,"data-slot":`dropdown-menu-separator`,className:au(`-mx-1 my-1 h-px bg-border`,e),...t}));Eg.displayName=_g.displayName;function Dg(e){return(0,H.jsx)(vg,{"data-slot":`dropdown-menu-sub`,...e})}var Og=u.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(yg,{ref:r,"data-slot":`dropdown-menu-sub-trigger`,className:au(`flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[t,(0,H.jsx)(`span`,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`,children:`›`})]}));Og.displayName=yg.displayName;var kg=u.forwardRef(({className:e,sideOffset:t=6,collisionPadding:n=8,...r},i)=>(0,H.jsx)(pg,{children:(0,H.jsx)(bg,{ref:i,"data-slot":`dropdown-menu-sub-content`,sideOffset:t,collisionPadding:n,className:au(`cn-menu-translucent z-50 min-w-48 overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r})}));kg.displayName=bg.displayName;var Ag=u.forwardRef(({className:e,type:t,...n},r)=>(0,H.jsx)(`input`,{ref:r,type:t,"data-slot":`input`,className:au(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n}));Ag.displayName=`Input`;function jg({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,className:au(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Mg({idPrefix:e,fields:t,activeFieldId:n,answers:r,otherValues:i,otherSelections:a,errors:o={},disabled:s=!1,onNavigate:c,onAnswerChange:l,onOtherValueChange:d,onOtherSelectionChange:f}){let p=u.useRef(null),m=u.useRef(void 0),h=u.useRef(void 0),g=t.findIndex(e=>e.id===n),_=g>=0?g:0,v=t[_],y=v?o[v.id]:void 0,b=v?r[v.id]:void 0;if(u.useEffect(()=>{if(!v)return;let e=m.current!==void 0&&m.current!==v.id,t=!!y&&h.current!==y;if(m.current=v.id,h.current=y,!e&&!t)return;let n=p.current;(n?.querySelector(`input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])`)??n?.querySelector(`input:checked:not([disabled])`)??n?.querySelector(`input:not([disabled]), textarea:not([disabled])`))?.focus()},[y,v]),!v)return null;let x=`${e}-field-${_}`,S=v.description?`${x}-description`:void 0,C=y?`${x}-error`:void 0,w=[S,C].filter(Boolean).join(` `)||void 0;return(0,H.jsxs)(`div`,{className:`grid gap-3`,children:[t.length>1&&(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{"aria-live":`polite`,className:`font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground`,children:[`Question `,_+1,` of `,t.length]}),(0,H.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:v.required?`Required`:`Optional`})]}),(0,H.jsx)(`div`,{role:`progressbar`,"aria-label":`Question progress`,"aria-valuemin":1,"aria-valuemax":t.length,"aria-valuenow":_+1,className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${(_+1)/t.length*100}%`}})})]}),(0,H.jsx)(`div`,{ref:p,children:v.type===`text`?(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsxs)(`label`,{htmlFor:x,className:`text-xs font-medium text-foreground`,children:[v.label,v.required&&(0,H.jsx)(Fg,{})]}),v.description&&(0,H.jsx)(`p`,{id:S,className:`text-[11px] leading-relaxed text-muted-foreground`,children:v.description}),v.multiline&&!v.secret?(0,H.jsx)(jg,{id:x,value:typeof b==`string`?b:``,disabled:s,placeholder:v.placeholder,"aria-invalid":y?!0:void 0,"aria-describedby":w,required:v.required,onChange:e=>l(v.id,e.target.value)}):(0,H.jsx)(Ag,{id:x,type:v.secret?`password`:`text`,autoComplete:`off`,value:typeof b==`string`?b:``,disabled:s,placeholder:v.placeholder,"aria-invalid":y?!0:void 0,"aria-describedby":w,required:v.required,onChange:e=>l(v.id,e.target.value)}),(0,H.jsx)(Pg,{id:C,error:y})]}):(0,H.jsxs)(`fieldset`,{disabled:s,role:v.multiple?void 0:`radiogroup`,"aria-required":!v.multiple&&v.required?!0:void 0,"aria-invalid":y?!0:void 0,"aria-describedby":w,className:`grid gap-1.5`,children:[(0,H.jsxs)(`legend`,{className:`text-xs font-medium text-foreground`,children:[v.label,v.required&&(0,H.jsx)(Fg,{})]}),v.description&&(0,H.jsx)(`p`,{id:S,className:`text-[11px] leading-relaxed text-muted-foreground`,children:v.description}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[v.options.map((e,t)=>{let n=`${x}-option-${t}`,r=v.multiple?Array.isArray(b)&&b.includes(e.value):a[v.id]!==!0&&b===e.value;return(0,H.jsx)(Ng,{id:n,name:v.multiple?void 0:x,type:v.multiple?`checkbox`:`radio`,checked:r,label:e.label,description:e.description,onChange:t=>{if(v.multiple){let n=Array.isArray(b)?b:[];l(v.id,t?[...n.filter(t=>t!==e.value),e.value]:n.filter(t=>t!==e.value))}else l(v.id,e.value),f(v.id,!1)}},e.value)}),v.allowOther&&(0,H.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-border bg-background/60 px-2.5 py-2 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5`,children:[(0,H.jsx)(Ng,{id:`${x}-other`,name:v.multiple?void 0:x,type:v.multiple?`checkbox`:`radio`,checked:a[v.id]===!0,label:`Other`,embedded:!0,onChange:e=>{f(v.id,e),e&&!v.multiple&&l(v.id,``)}}),(0,H.jsx)(Ag,{value:i[v.id]??``,disabled:s||a[v.id]!==!0,"aria-label":`Other answer for ${v.label}`,"aria-invalid":y?!0:void 0,"aria-describedby":w,placeholder:`Enter another answer`,onChange:e=>d(v.id,e.target.value)})]}),!v.required&&!v.multiple&&(a[v.id]===!0||typeof b==`string`&&b.length>0)&&(0,H.jsx)(J,{type:`button`,size:`xs`,variant:`ghost`,className:`justify-self-start text-muted-foreground`,onClick:()=>{l(v.id,``),f(v.id,!1)},children:`Clear selection`})]}),(0,H.jsx)(Pg,{id:C,error:y})]})}),t.length>1&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-t border-border/70 pt-2`,children:[(0,H.jsxs)(J,{type:`button`,size:`xs`,variant:`ghost`,disabled:s||_===0,onClick:()=>c(t[_-1].id),children:[(0,H.jsx)(In,{}),`Previous`]}),(0,H.jsxs)(J,{type:`button`,size:`xs`,variant:`outline`,disabled:s||_===t.length-1,onClick:()=>c(t[_+1].id),children:[`Next`,(0,H.jsx)(Ln,{})]})]})]})}function Ng({id:e,name:t,type:n,checked:r,label:i,description:a,embedded:o=!1,onChange:s}){return(0,H.jsxs)(`label`,{htmlFor:e,className:au(`flex cursor-pointer items-start gap-2 text-xs text-foreground`,!o&&`rounded-lg border border-border bg-background/60 px-2.5 py-2 transition-colors hover:bg-muted/60 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5`),children:[(0,H.jsxs)(`span`,{className:`relative mt-0.5 size-4 shrink-0`,children:[(0,H.jsx)(`input`,{id:e,type:n,name:t,checked:r,className:`peer size-4 appearance-none rounded-sm border border-input bg-background outline-none transition-colors checked:border-primary checked:bg-primary focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-60`,onChange:e=>s(e.target.checked)}),(0,H.jsx)(Pn,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 size-4 stroke-[3] text-primary-foreground opacity-0 peer-checked:opacity-100`})]}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block`,children:i}),a&&(0,H.jsx)(`span`,{className:`mt-0.5 block text-[11px] leading-relaxed text-muted-foreground`,children:a})]})]})}function Pg({id:e,error:t}){return t?(0,H.jsx)(`p`,{id:e,role:`alert`,className:`text-[11px] text-destructive`,children:t}):null}function Fg(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`ml-0.5 text-destructive`,children:`*`}),(0,H.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})}function Ig({className:e,size:t=`default`,...n}){return(0,H.jsxs)(`div`,{"data-slot":`native-select-wrapper`,"data-size":t,className:au(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,e),children:[(0,H.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...n}),(0,H.jsx)(Fn,{"aria-hidden":`true`,"data-slot":`native-select-icon`,className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`})]})}var Lg=Object.defineProperty,Rg=(e,t)=>Lg(e,`name`,{value:t,configurable:!0});function zg(e,t){return u.useReducer((e,n)=>t[e][n]??e,e)}Rg(zg,`useStateMachine`);var Bg=Rg(e=>{let{present:t,children:n}=e,r=Vg(t),i=typeof n==`function`?n({present:r.isPresent}):u.Children.only(n),a=Ug(r.ref,Gg(i));return typeof n==`function`||r.isPresent?u.cloneElement(i,{ref:a}):null},`Presence`);function Vg(e){let[t,n]=u.useState(),r=u.useRef(null),i=u.useRef(e),a=u.useRef(`none`),o=u.useRef(void 0),[s,c]=zg(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return u.useEffect(()=>{s===`mounted`?(a.current=o.current??Wg(r.current),o.current=void 0):a.current=`none`},[s]),Yi(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Wg(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Yi(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Rg(a=>{let o=Wg(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Rg(e=>{e.target===t&&(a.current=Wg(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:u.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Wg(t)}else r.current=null;n(e)},[])}}Rg(Vg,`usePresence`);function Hg(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Rg(Hg,`setRef`);function Ug(...e){let t=u.useRef(e);return t.current=e,u.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Hg(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Hg(n[e],null)}}},[])}Rg(Ug,`useStableComposedRefs`);function Wg(e){return e?.animationName||`none`}Rg(Wg,`getAnimationName`);function Gg(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Rg(Gg,`getElementRef`);function Kg(e,[t,n]){return Math.min(n,Math.max(t,e))}var qg=Object.defineProperty,Jg=(e,t)=>qg(e,`name`,{value:t,configurable:!0}),Yg=!!(typeof window<`u`&&window.document&&window.document.createElement);function Xg(e,t,{checkForDefaultPrevented:n=!0}={}){return Jg(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Jg(Xg,`composeEventHandlers`);function Zg(e){if(!Yg)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Jg(Zg,`getOwnerWindow`);function Qg(e){if(!Yg)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Jg(Qg,`getOwnerDocument`);function $g(e,t=!1){let{activeElement:n}=Qg(e);if(!n?.nodeName)return null;if(e_(n)&&n.contentDocument)return $g(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=Qg(n).getElementById(e);if(t)return t}}return n}Jg($g,`getActiveElement`);function e_(e){return e.tagName===`IFRAME`}Jg(e_,`isFrame`);var t_=Object.defineProperty,n_=(e,t)=>t_(e,`name`,{value:t,configurable:!0});function r_(e,t){return u.useReducer((e,n)=>t[e][n]??e,e)}n_(r_,`useStateMachine`);var i_=`ScrollArea`,[a_,o_]=Wi(i_),[s_,c_]=a_(i_),l_=u.forwardRef(n_(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=u.useState(null),[l,d]=u.useState(null),[f,p]=u.useState(null),[m,h]=u.useState(null),[g,_]=u.useState(null),[v,y]=u.useState(0),[b,x]=u.useState(0),[S,C]=u.useState(!1),[w,T]=u.useState(!1),E=Ji(t,c),D=Pu(i);return(0,H.jsx)(s_,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:d,content:f,onContentChange:p,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,H.jsx)(W.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":v+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),u_=`ScrollAreaViewport`,d_=u.forwardRef(n_(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=c_(u_,n),s=Ji(t,u.useRef(null),o.onViewportChange);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f_,{nonce:i}),(0,H.jsx)(W.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,H.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),f_=u.memo(n_(function({nonce:e}){return(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),p_=`ScrollAreaScrollbar`,m_=u.forwardRef(n_(function(e,t){let{forceMount:n,...r}=e,i=c_(p_,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return u.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,H.jsx)(h_,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,H.jsx)(g_,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,H.jsx)(__,{...r,ref:t,forceMount:n}):i.type===`always`?(0,H.jsx)(v_,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),h_=u.forwardRef(n_(function(e,t){let{forceMount:n,...r}=e,i=c_(p_,e.__scopeScrollArea),[a,o]=u.useState(!1);return u.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=n_(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=n_(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,H.jsx)(Bg,{present:n||a,children:(0,H.jsx)(__,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),g_=u.forwardRef(n_(function(e,t){let{forceMount:n,...r}=e,i=c_(p_,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=R_(()=>c(`SCROLL_END`),100),[s,c]=r_(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return u.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),u.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=n_(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,H.jsx)(Bg,{present:n||s!==`hidden`,children:(0,H.jsx)(v_,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:Xg(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:Xg(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),__=u.forwardRef(n_(function(e,t){let n=c_(p_,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=u.useState(!1),s=e.orientation===`horizontal`,c=R_(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return z_(n.viewport,c),z_(n.content,c),(0,H.jsx)(Bg,{present:r||a,children:(0,H.jsx)(v_,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),v_=u.forwardRef(n_(function(e,t){let{orientation:n=`vertical`,...r}=e,i=c_(p_,e.__scopeScrollArea),a=u.useRef(null),o=u.useRef(0),[s,c]=u.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=j_(s.viewport,s.content),d={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:n_(e=>a.current=e,`onThumbChange`),onThumbPointerUp:n_(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:n_(e=>o.current=e,`onThumbPointerDown`)};function f(e,t){return N_(e,o.current,s,t)}return n_(f,`getScrollPosition`),n===`horizontal`?(0,H.jsx)(y_,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=P_(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=f(e,i.dir))}}):n===`vertical`?(0,H.jsx)(b_,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=P_(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=f(e))}}):null},`ScrollAreaScrollbarVisible`)),y_=u.forwardRef(n_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=c_(p_,e.__scopeScrollArea),[o,s]=u.useState(),c=u.useRef(null),l=Ji(t,c,a.onScrollbarXChange);return u.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(C_,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":M_(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),I_(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:A_(o.paddingLeft),paddingEnd:A_(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),b_=u.forwardRef(n_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=c_(p_,e.__scopeScrollArea),[o,s]=u.useState(),c=u.useRef(null),l=Ji(t,c,a.onScrollbarYChange);return u.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(C_,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":M_(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),I_(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:A_(o.paddingTop),paddingEnd:A_(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[x_,S_]=a_(p_),C_=u.forwardRef(n_(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:d,onResize:f,...p}=e,m=c_(p_,n),[h,g]=u.useState(null),_=Ji(t,g),v=u.useRef(null),y=u.useRef(``),b=m.viewport,x=r.content-r.viewport,S=_a(d),C=_a(c),w=R_(f,10);function T(e){if(v.current){let t=e.clientX-v.current.left,n=e.clientY-v.current.top;l({x:t,y:n})}}return n_(T,`handleDragScroll`),u.useEffect(()=>{let e=n_(e=>{let t=e.target;h?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,h,x,S]),u.useEffect(C,[r,C]),z_(h,w),z_(m.content,w),(0,H.jsx)(x_,{scope:n,scrollbar:h,hasThumb:i,onThumbChange:_a(a),onThumbPointerUp:_a(o),onThumbPositionChange:C,onThumbPointerDown:_a(s),children:(0,H.jsx)(W.div,{...p,ref:_,style:{position:`absolute`,...p.style},onPointerDown:Xg(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),v.current=h.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,m.viewport&&(m.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:Xg(e.onPointerMove,T),onPointerUp:Xg(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=``),v.current=null})})})},`ScrollAreaScrollbarImpl`)),w_=`ScrollAreaThumb`,T_=u.forwardRef(n_(function(e,t){let{forceMount:n,...r}=e,i=S_(w_,e.__scopeScrollArea);return(0,H.jsx)(Bg,{present:n||i.hasThumb,children:(0,H.jsx)(E_,{ref:t,...r})})},`ScrollAreaThumb`)),E_=u.forwardRef(n_(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=c_(w_,n),o=S_(w_,n),{onThumbPositionChange:s}=o,c=Ji(t,o.onThumbChange),l=u.useRef(void 0),d=R_(()=>{l.current&&=(l.current(),void 0)},100);return u.useEffect(()=>{let e=a.viewport;if(e){let t=n_(()=>{if(d(),!l.current){let t=L_(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,d,s]),(0,H.jsx)(W.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:Xg(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:Xg(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),D_=`ScrollAreaCorner`,O_=u.forwardRef(n_(function(e,t){let n=c_(D_,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,H.jsx)(k_,{...e,ref:t}):null},`ScrollAreaCorner`)),k_=u.forwardRef(n_(function(e,t){let{__scopeScrollArea:n,...r}=e,i=c_(D_,n),[a,o]=u.useState(0),[s,c]=u.useState(0),l=!!(a&&s),{onCornerWidthChange:d,onCornerHeightChange:f}=i;return z_(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),z_(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),u.useEffect(()=>()=>{d(0),f(0)},[d,f]),l?(0,H.jsx)(W.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function A_(e){return e?parseInt(e,10):0}n_(A_,`toInt`);function j_(e,t){let n=e/t;return isNaN(n)?0:n}n_(j_,`getThumbRatio`);function M_(e){let t=j_(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}n_(M_,`getThumbSize`);function N_(e,t,n,r=`ltr`){let i=M_(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return F_([c,l],d)(e)}n_(N_,`getScrollPositionFromPointer`);function P_(e,t,n=`ltr`){let r=M_(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Kg(e,n===`ltr`?[0,o]:[o*-1,0]);return F_([0,o],[0,s])(c)}n_(P_,`getThumbOffsetFromScroll`);function F_(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}n_(F_,`linearScale`);function I_(e,t){return e>0&&e<t}n_(I_,`isScrollingWithinScrollbarBounds`);var L_=n_((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return n_((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function R_(e,t){let n=_a(e),r=u.useRef(0);return u.useEffect(()=>()=>window.clearTimeout(r.current),[]),u.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}n_(R_,`useDebounceCallback`);function z_(e,t){let n=_a(t);Yi(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}n_(z_,`useResizeObserver`);var B_=l_,V_=d_,H_=O_,U_=u.forwardRef(({className:e,children:t,viewportClassName:n,viewportRef:r,viewportProps:i,scrollbars:a=`vertical`,type:o=`auto`,...s},c)=>(0,H.jsxs)(B_,{ref:c,"data-slot":`scroll-area`,type:o,className:au(`relative overflow-hidden`,e),...s,children:[(0,H.jsx)(V_,{ref:r,"data-slot":`scroll-area-viewport`,className:au(`size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-2 focus-visible:ring-[var(--ring)]/45`,a===`vertical`&&`[&>div]:!block [&>div]:min-w-0 [&>div]:w-full`,n),...i,children:t}),a!==`horizontal`&&(0,H.jsx)(W_,{orientation:`vertical`}),a!==`vertical`&&(0,H.jsx)(W_,{orientation:`horizontal`}),(0,H.jsx)(H_,{"data-slot":`scroll-area-corner`})]}));U_.displayName=B_.displayName;var W_=u.forwardRef(({className:e,orientation:t=`vertical`,style:n,...r},i)=>(0,H.jsx)(m_,{ref:i,"data-slot":`scroll-area-scrollbar`,orientation:t,className:au(`group flex touch-none select-none p-px transition-colors`,t===`vertical`&&`h-full w-2`,t===`horizontal`&&`h-2 flex-col`,e),style:{...t===`vertical`?{right:2}:{bottom:2},...n},...r,children:(0,H.jsx)(T_,{"data-slot":`scroll-area-thumb`,className:au(`relative flex-1 rounded-full bg-[var(--scrollbar-thumb)] transition-colors group-hover:bg-[var(--scrollbar-thumb-hover)] active:bg-[var(--scrollbar-thumb-active)]`,t===`vertical`?`min-h-8 w-full`:`h-full min-w-8`)})}));W_.displayName=m_.displayName;function G_(e){let t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var K_=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),q_=`VisuallyHidden`,J_=u.forwardRef((e,t)=>(0,H.jsx)(W.span,{...e,ref:t,style:{...K_,...e.style}}));J_.displayName=q_;var Y_=[` `,`Enter`,`ArrowUp`,`ArrowDown`],X_=[` `,`Enter`],Z_=`Select`,[Q_,$_,ev]=Mu(Z_),[tv,nv]=Wi(Z_,[ev,ep]),rv=ep(),[iv,av]=tv(Z_),[ov,sv]=tv(Z_),cv=`SelectProvider`;function lv(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=rv(t),[v,y]=u.useState(null),[b,x]=u.useState(null),[S,C]=u.useState(!1),w=Pu(l),[T,E]=ea({prop:r,defaultProp:i??!1,onChange:a,caller:Z_}),[D,O]=ea({prop:o,defaultProp:s,onChange:c,caller:Z_}),k=u.useRef(null),A=u.useRef(D);u.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=()=>O(A.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,O]);let j=!v||!!h||!!v.closest(`form`),[M,N]=u.useState(new Set),P=Qi(),F=Array.from(M).map(e=>e.props.value).join(`;`),I=u.useCallback(e=>{N(t=>new Set(t).add(e))},[]),L=u.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),ee={required:m,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:P,value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:M,nativeSelectKey:F,isFormControl:j};return(0,H.jsx)(gp,{..._,children:(0,H.jsx)(iv,{scope:t,...ee,children:(0,H.jsx)(Q_.Provider,{scope:t,children:(0,H.jsx)(ov,{scope:t,onNativeOptionAdd:I,onNativeOptionRemove:L,children:ly(g)?g(ee):n})})})})}lv.displayName=cv;var uv=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,H.jsx)(lv,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[n,e?(0,H.jsx)(cy,{__scopeSelect:t}):null]})})};uv.displayName=Z_;var dv=`SelectTrigger`,fv=u.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=rv(n),o=av(dv,n),s=o.disabled||r,c=Ji(t,o.onTriggerChange),l=$_(n),d=u.useRef(`touch`),[f,p,m]=dy(e=>{let t=l().filter(e=>!e.disabled),n=fy(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),h=e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,H.jsx)(_p,{asChild:!0,...a,children:(0,H.jsx)(W.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":uy(o.value)?``:void 0,...i,ref:c,onClick:U(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:U(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:U(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&Y_.includes(e.key)&&(h(),e.preventDefault())})})})});fv.displayName=dv;var pv=`SelectValue`,mv=u.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=av(pv,n),{onValueNodeHasChildrenChange:l}=c,d=a!==void 0,f=Ji(t,c.onValueNodeChange);Yi(()=>{l(d)},[l,d]);let p=uy(c.value);return(0,H.jsx)(W.span,{...s,asChild:!p&&s.asChild,ref:f,style:{pointerEvents:`none`},children:(0,H.jsx)(u.Fragment,{children:p?o:a},p?`placeholder`:`value`)})});mv.displayName=pv;var hv=`SelectIcon`,gv=u.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(W.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});gv.displayName=hv;var _v=`SelectPortal`,[vv,yv]=tv(_v,{forceMount:void 0}),bv=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,H.jsx)(vv,{scope:e.__scopeSelect,forceMount:n,children:(0,H.jsx)(Xa,{asChild:!0,...r})})};bv.displayName=_v;var xv=`SelectContent`,Sv=u.forwardRef((e,t)=>{let n=yv(xv,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=av(xv,e.__scopeSelect),[o,s]=u.useState();return Yi(()=>{s(new DocumentFragment)},[]),(0,H.jsx)(Qa,{present:r||a.open,children:({present:e})=>e?(0,H.jsx)(kv,{...i,ref:t}):(0,H.jsx)(Cv,{...i,fragment:o})})});Sv.displayName=xv;var Cv=u.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?d.createPortal((0,H.jsx)(Tv,{scope:n,children:(0,H.jsx)(Q_.Slot,{scope:n,children:(0,H.jsx)(`div`,{ref:t,children:r})})}),i):null});Cv.displayName=`SelectContentFragment`;var wv=10,[Tv,Ev]=tv(xv),Dv=`SelectContentImpl`,Ov=ra(`SelectContent.RemoveScroll`),kv=u.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_,...v}=e,y=av(xv,n),[b,x]=u.useState(null),[S,C]=u.useState(null),w=Ji(t,x),[T,E]=u.useState(null),[D,O]=u.useState(null),k=$_(n),[A,j]=u.useState(!1),M=u.useRef(!1);u.useEffect(()=>{if(b)return ws(b)},[b]),oo();let N=u.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=u.useCallback(()=>N([T,b]),[N,T,b]);u.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;u.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),u.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,ee]=dy(e=>{let t=k().filter(e=>!e.disabled),n=fy(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),te=u.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),ne=u.useCallback(()=>b?.focus(),[b]),re=u.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),R=r===`popper`?Nv:jv,ie=R===Nv?{side:s,sideOffset:c,align:l,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_}:{};return(0,H.jsx)(Tv,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:te,selectedItem:T,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:L,children:(0,H.jsx)(hs,{as:Ov,allowPinchZoom:!0,children:(0,H.jsx)(La,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:U(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(wa,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,H.jsx)(R,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...ie,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:U(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ee(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});kv.displayName=Dv;var Av=`SelectItemAlignedPosition`,jv=u.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=av(xv,n),o=Ev(xv,n),[s,c]=u.useState(null),[l,d]=u.useState(null),f=Ji(t,d),p=$_(n),m=u.useRef(!1),h=u.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:y}=o,b=u.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&g&&_&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-wv,d=Kg(a,[wv,Math.max(wv,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-wv,d=Kg(a,[wv,Math.max(wv,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=p(),c=window.innerHeight-wv*2,u=g.scrollHeight,d=window.getComputedStyle(l),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+u+b+y,S=Math.min(_.offsetHeight*5,x),C=window.getComputedStyle(g),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-wv,D=c-E,O=_.offsetHeight/2,k=_.offsetTop+O,A=f+h+k,j=x-A;if(A<=E){let e=o.length>0&&_===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-g.offsetTop-g.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&_===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+g.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,g.scrollTop=A-E+g.offsetTop}s.style.margin=`${wv}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,s,l,g,_,v,a.dir,r]);Yi(()=>b(),[b]);let[x,S]=u.useState();Yi(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);let C=u.useCallback(e=>{e&&h.current===!0&&(b(),y?.(),h.current=!1)},[b,y]);return(0,H.jsx)(Pv,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:C,children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,H.jsx)(W.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});jv.displayName=Av;var Mv=`SelectPopperPosition`,Nv=u.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=wv,...a}=e,o=rv(n);return(0,H.jsx)(vp,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Nv.displayName=Mv;var[Pv,Fv]=tv(xv,{}),Iv=`SelectViewport`,Lv=u.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Ev(Iv,n),o=Fv(Iv,n),s=Ji(t,a.onViewportChange),c=u.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,H.jsx)(Q_.Slot,{scope:n,children:(0,H.jsx)(W.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:U(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-wv*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Lv.displayName=Iv;var Rv=`SelectGroup`,[zv,Bv]=tv(Rv),Vv=u.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Qi();return(0,H.jsx)(zv,{scope:n,id:i,children:(0,H.jsx)(W.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Vv.displayName=Rv;var Hv=`SelectLabel`,Uv=u.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Bv(Hv,n);return(0,H.jsx)(W.div,{id:i.id,...r,ref:t})});Uv.displayName=Hv;var Wv=`SelectItem`,[Gv,Kv]=tv(Wv),qv=u.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=av(Wv,n),c=Ev(Wv,n),l=s.value===r,[d,f]=u.useState(a??``),[p,m]=u.useState(!1),h=Ji(t,_a(e=>c.itemRefCallback?.(e,r,i))),g=Qi(),_=u.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,H.jsx)(Gv,{scope:n,value:r,disabled:i,textId:g,isSelected:l,onItemTextChange:u.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(Q_.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,H.jsx)(W.div,{role:`option`,"aria-labelledby":g,"data-highlighted":p?``:void 0,"aria-selected":l&&p,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:U(o.onFocus,()=>m(!0)),onBlur:U(o.onBlur,()=>m(!1)),onClick:U(o.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:U(o.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:U(o.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:U(o.onPointerMove,e=>{_.current=e.pointerType,i?c.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:U(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:U(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(X_.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});qv.displayName=Wv;var Jv=`SelectItemText`,Yv=u.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=av(Jv,n),s=Ev(Jv,n),c=Kv(Jv,n),l=sv(Jv,n),[f,p]=u.useState(null),m=_a(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),h=Ji(t,p,c.onItemTextChange,m),g=f?.textContent,_=u.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=l;return Yi(()=>(v(_),()=>y(_)),[v,y,_]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(W.span,{id:c.textId,...a,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!uy(o.value)?d.createPortal(a.children,o.valueNode):null]})});Yv.displayName=Jv;var Xv=`SelectItemIndicator`,Zv=u.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Kv(Xv,n).isSelected?(0,H.jsx)(W.span,{"aria-hidden":!0,...r,ref:t}):null});Zv.displayName=Xv;var Qv=`SelectScrollUpButton`,$v=u.forwardRef((e,t)=>{let n=Ev(Qv,e.__scopeSelect),r=Fv(Qv,e.__scopeSelect),[i,a]=u.useState(!1),o=Ji(t,r.onScrollButtonChange);return Yi(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(ny,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});$v.displayName=Qv;var ey=`SelectScrollDownButton`,ty=u.forwardRef((e,t)=>{let n=Ev(ey,e.__scopeSelect),r=Fv(ey,e.__scopeSelect),[i,a]=u.useState(!1),o=Ji(t,r.onScrollButtonChange);return Yi(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(ny,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ty.displayName=ey;var ny=u.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Ev(`SelectScrollButton`,n),o=u.useRef(null),s=$_(n),c=u.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Yi(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(W.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:U(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:U(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:U(i.onPointerLeave,()=>{c()})})}),ry=`SelectSeparator`,iy=u.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,H.jsx)(W.div,{"aria-hidden":!0,...r,ref:t})});iy.displayName=ry;var ay=`SelectArrow`,oy=u.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=rv(n);return Ev(ay,n).position===`popper`?(0,H.jsx)(yp,{...i,...r,ref:t}):null});oy.displayName=ay;var sy=`SelectBubbleInput`,cy=u.forwardRef(({__scopeSelect:e,...t},n)=>{let r=av(sy,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=u.useRef(null),h=Ji(n,m),g=i??``,_=G_(g),v=Array.from(f).some(e=>(e.props.value??``)===``);return u.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(_!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[_,g]),(0,H.jsxs)(W.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:d,onChange:e=>a(e.target.value),...t,style:{...K_,...t.style},ref:h,defaultValue:g,children:[uy(i)&&!v?(0,H.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});cy.displayName=sy;function ly(e){return typeof e==`function`}function uy(e){return e===``||e===void 0}function dy(e){let t=_a(e),n=u.useRef(``),r=u.useRef(0),i=u.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=u.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function fy(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=py(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function py(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function my(e){return(0,H.jsx)(uv,{"data-slot":`select`,...e})}var hy=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Vv,{ref:n,"data-slot":`select-group`,className:au(`scroll-my-1 p-1`,e),...t}));hy.displayName=Vv.displayName;var gy=u.forwardRef((e,t)=>(0,H.jsx)(mv,{ref:t,"data-slot":`select-value`,...e}));gy.displayName=mv.displayName;var _y=u.forwardRef(({className:e,size:t=`default`,children:n,...r},i)=>(0,H.jsxs)(fv,{ref:i,"data-slot":`select-trigger`,"data-size":t,className:au(`flex w-full min-w-0 items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,H.jsx)(gv,{asChild:!0,children:(0,H.jsx)(Fn,{"aria-hidden":`true`,className:`pointer-events-none size-4 shrink-0 text-muted-foreground`})})]}));_y.displayName=fv.displayName;var vy=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)($v,{ref:n,"data-slot":`select-scroll-up-button`,className:au(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,H.jsx)(Rn,{"aria-hidden":`true`})}));vy.displayName=$v.displayName;var yy=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(ty,{ref:n,"data-slot":`select-scroll-down-button`,className:au(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,H.jsx)(Fn,{"aria-hidden":`true`})}));yy.displayName=ty.displayName;var by=u.forwardRef(({className:e,children:t,position:n=`popper`,align:r=`center`,sideOffset:i=4,collisionPadding:a=8,...o},s)=>(0,H.jsx)(bv,{children:(0,H.jsxs)(Sv,{ref:s,"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,position:n,align:r,sideOffset:i,collisionPadding:a,className:au(`cn-menu-translucent relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 origin-[var(--radix-select-content-transform-origin)] overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`w-[var(--radix-select-trigger-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),...o,children:[(0,H.jsx)(vy,{}),(0,H.jsx)(Lv,{"data-position":n,className:au(`p-1`,n===`popper`&&`min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,H.jsx)(yy,{})]})}));by.displayName=Sv.displayName;var xy=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Uv,{ref:n,"data-slot":`select-label`,className:au(`px-1.5 py-1 text-xs text-muted-foreground`,e),...t}));xy.displayName=Uv.displayName;var Sy=u.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(qv,{ref:r,"data-slot":`select-item`,className:au(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,H.jsx)(Zv,{children:(0,H.jsx)(Pn,{"aria-hidden":`true`,className:`pointer-events-none`})})}),(0,H.jsx)(Yv,{children:t})]}));Sy.displayName=qv.displayName;var Cy=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(iy,{ref:n,"data-slot":`select-separator`,className:au(`pointer-events-none -mx-1 my-1 h-px bg-border`,e),...t}));Cy.displayName=iy.displayName;var wy=Object.defineProperty,Ty=(e,t)=>wy(e,`name`,{value:t,configurable:!0}),Ey=!!(typeof window<`u`&&window.document&&window.document.createElement);function Dy(e,t,{checkForDefaultPrevented:n=!0}={}){return Ty(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Ty(Dy,`composeEventHandlers`);function Oy(e){if(!Ey)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Ty(Oy,`getOwnerWindow`);function ky(e){if(!Ey)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Ty(ky,`getOwnerDocument`);function Ay(e,t=!1){let{activeElement:n}=ky(e);if(!n?.nodeName)return null;if(jy(n)&&n.contentDocument)return Ay(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ky(n).getElementById(e);if(t)return t}}return n}Ty(Ay,`getActiveElement`);function jy(e){return e.tagName===`IFRAME`}Ty(jy,`isFrame`);var My=Object.defineProperty,Ny=(e,t)=>My(e,`name`,{value:t,configurable:!0});function Py(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ny(Py,`setRef`);function Fy(...e){return t=>{let n=!1,r=e.map(e=>{let r=Py(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Py(e[t],null)}}}}Ny(Fy,`composeRefs`);function Iy(...e){return u.useCallback(Fy(...e),e)}Ny(Iy,`useComposedRefs`);var Ly=Object.defineProperty,Ry=(e,t)=>Ly(e,`name`,{value:t,configurable:!0});function zy(e,t){let n=u.createContext(t);n.displayName=e+`Context`;let r=Ry(e=>{let{children:t,...r}=e,i=u.useMemo(()=>r,Object.values(r));return(0,H.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=u.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Ry(i,`useContext`),[r,i]}Ry(zy,`createContext`);function By(e,t=[]){let n=[];function r(t,r){let i=u.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Ry(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=u.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,d=u.useContext(l);if(d)return d;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Ry(s,`useContext`),[o,s]}Ry(r,`createContext`);let i=Ry(()=>{let t=n.map(e=>u.createContext(e));return Ry(function(n){let r=n?.[e]||t;return u.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Vy(i,...t)]}Ry(By,`createContextScope`);function Vy(...e){let t=e[0];if(e.length===1)return t;let n=Ry(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Ry(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Ry(Vy,`composeContextScopes`);var Hy=globalThis?.document?u.useLayoutEffect:()=>{},Uy=Object.defineProperty,Wy=(e,t)=>Uy(e,`name`,{value:t,configurable:!0}),Gy=u.useEffectEvent,Ky=u.useInsertionEffect;function qy(e){if(typeof Gy==`function`)return Gy(e);let t=u.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Ky==`function`?Ky(()=>{t.current=e}):Hy(()=>{t.current=e}),u.useMemo(()=>((...e)=>t.current?.(...e)),[])}Wy(qy,`useEffectEvent`);var Jy=Object.defineProperty,Yy=(e,t)=>Jy(e,`name`,{value:t,configurable:!0}),Xy=u.useInsertionEffect||Hy;function Zy({prop:e,defaultProp:t,onChange:n=Yy(()=>{},`onChange`),caller:r}){let[i,a,o]=Qy({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,u.useCallback(t=>{if(s){let n=$y(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}Yy(Zy,`useControllableState`);function Qy({defaultProp:e,onChange:t}){let[n,r]=u.useState(e),i=u.useRef(n),a=u.useRef(t);return Xy(()=>{a.current=t},[t]),u.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}Yy(Qy,`useUncontrolledState`);function $y(e){return typeof e==`function`}Yy($y,`isFunction`);var eb=Symbol(`RADIX:SYNC_STATE`);function tb(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=qy(o),d=[{...n,state:a}];r&&d.push(r);let[f,p]=u.useReducer((t,n)=>{if(n.type===eb)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...d),m=f.state,h=u.useRef(m);u.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=u.useMemo(()=>i===void 0?f:{...f,state:i},[f,i]);return u.useEffect(()=>{c&&!Object.is(i,f.state)&&p({type:eb,state:i})},[i,f.state,c]),[g,p]}Yy(tb,`useControllableStateReducer`);var nb=Object.defineProperty,rb=(e,t)=>nb(e,`name`,{value:t,configurable:!0});function ib(e){let[t,n]=u.useState(void 0);return Hy(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}rb(ib,`useSize`);var ab=Object.defineProperty,ob=(e,t)=>ab(e,`name`,{value:t,configurable:!0}),sb=ob(((e,t)=>{let n={...t};for(let r in t){let i=e[r],a=t[r];if(/^on[A-Z]/.test(r)){if(i&&a){let e=typeof i==`function`,t=typeof a==`function`;n[r]=(...n)=>{let r=t?a(...n):void 0;return e&&i(...n),r}}else i&&(n[r]=i)}else r===`style`?n[r]={...typeof i==`object`?i:null,...typeof a==`object`?a:null}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=cb(a,i))}return{...e,...n}}),`mergeProps`);function cb(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}ob(cb,`concatAriaDescribedby`);var lb=u.createContext(sb);lb.displayName=`SlotContext`;function ub(e){let t=u.forwardRef((t,n)=>{let r=u.useContext(lb),{children:i,mergeProps:a=r,...o}=t,s=null,c=!1,l=[];_b(i)&&typeof xb==`function`&&(i=xb(i._payload)),u.Children.forEach(i,e=>{if(hb(e)){c=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;_b(n)&&typeof xb==`function`&&(n=xb(n._payload)),s=pb(t,n),l.push(s?.props?.children)}else l.push(e)}),s?s=u.cloneElement(s,void 0,l):!c&&u.Children.count(i)===1&&u.isValidElement(i)&&(s=i);let d=s?mb(s):void 0,f=Iy(n,d);if(!s){if(i||i===0)throw Error(c?bb(e):yb(e));return i}let p=a(o,s.props??{});return s.type!==u.Fragment&&(p.ref=n?f:d),u.cloneElement(s,p)});return t.displayName=`${e}.Slot`,t}ob(ub,`createSlot`);var db=Symbol.for(`radix.slottable`);function fb(e){let t=ob(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=db,t}ob(fb,`createSlottable`);var pb=ob((e,t)=>{if(`child`in e.props){let t=e.props.child;return u.isValidElement(t)?u.cloneElement(t,void 0,e.props.children(t.props.children)):null}return u.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function mb(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ob(mb,`getElementRef`);function hb(e){return u.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===db}ob(hb,`isSlottable`);var gb=Symbol.for(`react.lazy`);function _b(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===gb&&`_payload`in e&&vb(e._payload)}ob(_b,`isLazyComponent`);function vb(e){return typeof e==`object`&&!!e&&`then`in e}ob(vb,`isPromiseLike`);var yb=ob(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),bb=ob(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),xb=u.use,Sb=Object.defineProperty,Cb=(e,t)=>Sb(e,`name`,{value:t,configurable:!0}),wb=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ub(`Primitive.${t}`),r=u.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Tb(e,t){e&&d.flushSync(()=>e.dispatchEvent(t))}Cb(Tb,`dispatchDiscreteCustomEvent`);var Eb=Object.defineProperty,Db=(e,t)=>Eb(e,`name`,{value:t,configurable:!0}),Ob=`Switch`,[kb,Ab]=By(Ob),[jb,Mb]=kb(Ob);function Nb(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=Zy({prop:n,defaultProp:i??!1,onChange:c,caller:Ob}),[h,g]=u.useState(null),[_,v]=u.useState(null),y=u.useRef(!1),[b,x]=u.useReducer(e=>e+1,0),S={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:y,userInteractionCount:b,onUserInteraction:x,required:l,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,H.jsx)(jb,{scope:t,...S,children:Vb(f)?f(S):r})}Db(Nb,`SwitchProvider`);var Pb=`SwitchTrigger`,Fb=u.forwardRef(Db(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:h,bubbleInput:g}=Mb(Pb,e),_=Iy(r,d),v=u.useRef(c);return u.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=Db(()=>f(v.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,f]),(0,H.jsx)(wb.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Hb(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:_,onClick:Dy(t,e=>{m(),f(e=>!e),g&&h&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})})},`SwitchTrigger`)),Ib=u.forwardRef(Db(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,H.jsx)(Nb,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Fb,{...d,ref:t,__scopeSwitch:n}),e&&(0,H.jsx)(Bb,{__scopeSwitch:n})]})})},`Switch`)),Lb=`SwitchThumb`,Rb=u.forwardRef(Db(function(e,t){let{__scopeSwitch:n,...r}=e,i=Mb(Lb,n);return(0,H.jsx)(wb.span,{"data-state":Hb(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),zb=`SwitchBubbleInput`,Bb=u.forwardRef(Db(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:d,name:f,value:p,form:m,bubbleInput:h,setBubbleInput:g}=Mb(zb,e),_=Iy(r,g),v=ib(i),y=u.useRef(!1),b=u.useRef(s),x=u.useRef(o);u.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),y.current=!1}},[h,s,a,o]);let S=u.useRef(s);return(0,H.jsx)(wb.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:d,name:f,value:p,form:m,...n,tabIndex:-1,ref:_,onClick:Dy(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function Vb(e){return typeof e==`function`}Db(Vb,`isFunction`);function Hb(e){return e?`checked`:`unchecked`}Db(Hb,`getState`);var Ub=u.forwardRef(({className:e,size:t=`default`,...n},r)=>(0,H.jsx)(Ib,{ref:r,"data-slot":`switch`,"data-size":t,className:au(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-[state=unchecked]:bg-input/80`,e),...n,children:(0,H.jsx)(Rb,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground`})}));Ub.displayName=Ib.displayName;var Wb=`Tabs`,[Gb,Kb]=Wi(Wb,[Np]),qb=Np(),[Jb,Yb]=Gb(Wb),Xb=u.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Pu(s),[d,f]=ea({prop:r,onChange:i,defaultProp:a??``,caller:Wb});return(0,H.jsx)(Jb,{scope:n,baseId:Qi(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,H.jsx)(W.div,{dir:u,"data-orientation":o,...l,ref:t})})});Xb.displayName=Wb;var Zb=`TabsList`,Qb=u.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Yb(Zb,n),o=qb(n);return(0,H.jsx)(Gp,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,H.jsx)(W.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Qb.displayName=Zb;var $b=`TabsTrigger`,ex=u.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Yb($b,n),s=qb(n),c=rx(o.baseId,r),l=ix(o.baseId,r),u=r===o.value;return(0,H.jsx)(Kp,{asChild:!0,...s,focusable:!i,active:u,children:(0,H.jsx)(W.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:U(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:U(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:U(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});ex.displayName=$b;var tx=`TabsContent`,nx=u.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Yb(tx,n),c=rx(s.baseId,r),l=ix(s.baseId,r),d=r===s.value,f=u.useRef(d);return u.useEffect(()=>{let e=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,H.jsx)(Qa,{present:i||d,children:({present:n})=>(0,H.jsx)(W.div,{"data-state":d?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?`0s`:void 0},children:n&&a})})});nx.displayName=tx;function rx(e,t){return`${e}-trigger-${t}`}function ix(e,t){return`${e}-content-${t}`}var ax=Xb,ox=Qb,sx=ex,cx=nx;function lx(e){return(0,H.jsx)(ax,{"data-slot":`tabs`,...e})}var ux=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(ox,{ref:n,"data-slot":`tabs-list`,className:au(`inline-flex h-9 items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground`,e),...t}));ux.displayName=`TabsList`;var dx=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(sx,{ref:n,"data-slot":`tabs-trigger`,className:au(`inline-flex h-7 items-center justify-center whitespace-nowrap rounded-md border border-transparent px-3 text-sm font-medium transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-border data-[state=active]:bg-background data-[state=active]:text-foreground`,e),...t}));dx.displayName=`TabsTrigger`;var fx=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(cx,{ref:n,"data-slot":`tabs-content`,className:au(`mt-4 outline-none`,e),...t}));fx.displayName=`TabsContent`;var px={sessions:`/sessions`,emulator:`/settings/emulator`,overview:`/settings/overview`,runtimes:`/settings/runtimes`,providers:`/settings/providers`,projects:`/settings/projects`,agents:`/settings/agents`,skills:`/settings/skills`,plugins:`/settings/plugins`,localRuntime:`/settings/local-runtime`,computerUse:`/settings/computer-use`},mx=`/settings`,hx=px.overview,gx=`/runtimes/:runtimeSelector/sessions`,_x=`/runtimes/:runtimeSelector/sessions/:sessionId`,vx=`!invalid-runtime-owner`,yx=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,bx={emulator:`/emulator`,overview:`/overview`,runtimes:`/runtimes`,providers:`/providers`,projects:`/projects`,agents:`/agents`,skills:`/skills`,plugins:`/plugins`},xx={"/settings/updates":`${px.overview}#software-update`,"/settings/daemon":`${px.localRuntime}#runtime`,"/settings/command":`${px.localRuntime}#terminal-command`,"/settings/computer":`${px.computerUse}#permissions`,"/settings/inspection":`${px.computerUse}#chrome-inspection`},Sx=[`localRuntime`,`computerUse`];function Cx(e){return Sx.includes(e)}function wx(e,t){return!Cx(e)||t}function Tx(e){let t=e.length>1?e.replace(/\/+$/,``):e;return Dx(t)||t===px.sessions||t.startsWith(`${px.sessions}/`)?`sessions`:Object.entries(px).find(([,e])=>e===t)?.[0]??`sessions`}function Ex(e,t=!0){let n=Tx(e);return n===`sessions`||!wx(n,t)?null:n}function Dx(e){let t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return kx(decodeURIComponent(t[1]))}catch{return vx}}function Ox(e){let t=new URLSearchParams(e).getAll(`runtime`);return t.length===0?null:t.length===1?kx(t[0]):vx}function kx(e){return yx.test(e)?e:vx}function Ax(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function jx(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function Mx(e,t){let n=e?.returnTo;return typeof n==`string`&&n.startsWith(`/`)&&!n.startsWith(`//`)&&n!==`/settings`&&!n.startsWith(`/settings/`)?n:t}var Nx=`/api/plugins/install-preparations`,Px=`/api/plugin-marketplaces`,Fx=/^[A-Za-z0-9_-]{32,128}$/;function Ix(e){if(!Fx.test(e))throw Error(`invalid plugin preparation token`);return`${Nx}/${encodeURIComponent(e)}`}function Lx(e){return`${Ix(e)}/commit`}function Rx(){return typeof window>`u`?void 0:window.rynxSessionPortal}function zx(e){let t=Rx(),n=t?.portalId;if(!n)return e;let r=new URL(e,`http://session-portal.local`);return r.searchParams.set(`portal`,n),t.embedOrigin&&r.searchParams.set(`embed_origin`,t.embedOrigin),`${r.pathname}${r.search}${r.hash}`}function Bx(e){let t=new Headers(e),n=Rx(),r=n?.portalId;return r&&t.set(`x-rynx-session-portal`,r),n?.secret&&t.set(`x-rynx-session-portal-secret`,n.secret),t}function Vx(e){let t=Rx(),n=t?.portalId;n&&e.set(`portal`,n),t?.secret&&e.set(`portal_secret`,t.secret)}var Hx=class extends Error{status;code;outcome;constructor(e,t,n,r){super(e),this.name=`ApiRequestError`,this.status=t,this.code=n,this.outcome=r}};function Ux(e){return e instanceof Hx&&(e.outcome===`not_started`||[400,403,404,409,413].includes(e.status))}var Wx=`/api/runtimes/capability`,Gx=`x-rynx-runtime-capability`,Kx;async function qx(e,t,n){let r=location.protocol===`https:`?`wss`:`ws`,i=await Qx(n.refreshCapability),a=new URLSearchParams({capability:i,role:n.role??`owner`,cols:String(n.cols),rows:String(n.rows)});return Vx(a),`${r}://${location.host}/api/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/terminal?${a.toString()}`}function Jx(e){let t=location.protocol===`https:`?`wss`:`ws`,n=new URLSearchParams;e&&n.set(`device`,e);let r=n.toString();return`${t}://${location.host}/api/emulator/touch${r?`?${r}`:``}`}async function Yx(e,t,n,r){let i=r?`${sS(r,e)}/interactions/${encodeURIComponent(t)}/resolve`:`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}/resolve`,a={method:`POST`,body:JSON.stringify({resolution:n})};return(r?await $x(i,a):await Xx(i,a)).disposition}async function Xx(e,t={}){return Zx(e,{},t)}async function Zx(e,t,n={}){let r=Bx(n.headers);n.body&&!r.has(`content-type`)&&r.set(`content-type`,`application/json`);let i=await fetch(e,{...n,headers:r});if(!i.ok){let e=`${i.status}`,t,n;try{let r=await i.json();typeof r.error==`string`&&(t=r.error,e=r.error),typeof r.code==`string`&&(t=r.code),(r.outcome===`not_started`||r.outcome===`unknown`)&&(n=r.outcome)}catch{}throw new Hx(e,i.status,t,n)}let a=await i.text();return a?JSON.parse(a):t}async function Qx(e=!1){return e&&(Kx=void 0),Kx||=Xx(Wx,{cache:`no-store`}).then(({capability:e})=>{if(typeof e!=`string`||!/^[A-Za-z0-9_-]{43}$/.test(e))throw Error(`invalid Runtime Web capability`);return e}).catch(e=>{throw Kx=void 0,e}),Kx}async function $x(e,t){let n=async n=>{let r=Bx(t.headers);return r.set(Gx,n),Xx(e,{...t,headers:r})},r=await Qx();try{return await n(r)}catch(e){if(!(e instanceof Error)||e.message!==`invalid_runtime_capability`)throw e;return Kx=void 0,n(await Qx())}}async function eS(e,t={}){let n=Bx(t.headers),r=await fetch(e,{...t,headers:n});if(!r.ok){let e=`${r.status}`;try{let t=await r.json();t.error&&(e=t.error)}catch{}throw Error(e)}return r.blob()}async function tS(e,t,n,r){let i=Bx({"content-type":`application/json`});await rS(await fetch(e,{method:`POST`,headers:i,body:t===void 0?void 0:JSON.stringify(t),signal:r}),n)}async function nS(e,t,n){await rS(await fetch(e,{signal:n,headers:Bx()}),t)}async function rS(e,t){if(!e.ok||!e.body){let t=`${e.status}`,n,r;try{let i=await e.json();i.error&&(n=i.error,t=i.error),i.code&&(n=i.code),(i.outcome===`not_started`||i.outcome===`unknown`)&&(r=i.outcome)}catch{}throw new Hx(t,e.status,n,r)}let n=e.body.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)break;i+=r.decode(a,{stream:!0});let o;for(;(o=i.indexOf(`
|
|
53
|
+
|
|
54
|
+
`))!==-1;){let e=i.slice(0,o);i=i.slice(o+2);let n=iS(e);n&&t(n)}}}function iS(e){let t=`message`,n=``;for(let r of e.split(`
|
|
55
|
+
`))r.startsWith(`event:`)?t=r.slice(6).trim():r.startsWith(`data:`)&&(n+=r.slice(5).trim());if(!t&&!n)return null;let r={};try{n&&(r=JSON.parse(n))}catch{}return{event:t,data:r}}function aS(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function oS(e,t,n){let r=aS(e,t);return e?$x(r,n):Xx(r,n)}function sS(e,t,n){let r=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return r;let i=`${r}/${encodeURIComponent(t)}`;return n?`${i}/${n}`:i}function cS(e,t){let n=`/api/runtimes/${encodeURIComponent(e)}/projects`;return t===void 0?n:`${n}/${encodeURIComponent(t)}`}function lS(e,t,...n){let r=`${sS(e,t)}/browser`;return n.length===0?r:`${r}/${n.map(e=>encodeURIComponent(e)).join(`/`)}`}function uS(e,t,n){let r=`${sS(e,t)}/emulator`;return n?`${r}/${n}`:r}function dS(e,t,n){let r=new URLSearchParams({bindingId:n});return zx(`${sS(e,t)}/emulator/frame?${r.toString()}`)}function fS(e,t,n,r,i){return $x(lS(e,t,`pages`,r,i),{method:`POST`,body:JSON.stringify({browserGeneration:n})})}function pS(e,t,n){return e?sS(e,t,n):`/api/sessions/${encodeURIComponent(t)}/${n}`}var Y={meta:()=>Xx(`/api/meta`),listRuntimeShareAddresses:()=>Xx(`/api/runtime-server/share-addresses`,{cache:`no-store`}).then(e=>e.addresses),shareRuntime:e=>$x(`/api/runtime-server/share`,{method:`POST`,body:JSON.stringify(e)}),listRuntimeAccess:()=>Xx(`/api/runtime-server/access`).then(e=>e.clients),revokeRuntimeAccess:e=>$x(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:`DELETE`}),deleteRevokedRuntimeAccess:e=>$x(`/api/runtime-server/access/${encodeURIComponent(e)}/record`,{method:`DELETE`}),listRuntimes:()=>Xx(`/api/runtimes`).then(e=>e.runtimes),listProviderClis:e=>Xx(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:`no-store`}),startProviderCliOperation:(e,t,n)=>$x(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${n}`,{method:`POST`,body:JSON.stringify({})}),getProviderCliJob:(e,t)=>Xx(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:`no-store`}).then(e=>e.job),pairRuntime:e=>$x(`/api/runtimes/pair`,{method:`POST`,body:JSON.stringify(e)}),testRuntime:e=>$x(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:`POST`,body:JSON.stringify({})}),forgetRuntime:e=>$x(`/api/runtimes/${encodeURIComponent(e)}`,{method:`DELETE`}),getRuntimeBrowserState:(e,t)=>Zx(lS(e,t),null),getRuntimeBrowserRequestHeaders:(e,t)=>$x(lS(e,t,`request-headers`),{cache:`no-store`}),updateRuntimeBrowserRequestHeaders:(e,t)=>$x(lS(e,t.sessionId,`request-headers`),{method:`PUT`,body:JSON.stringify({expectedRevision:t.expectedRevision,enabled:t.enabled,headers:t.headers})}),openRuntimeBrowser:(e,t,n)=>$x(lS(e,t,`open`),{method:`POST`,body:JSON.stringify(n===void 0?{}:{url:n})}),closeRuntimeBrowser:(e,t,n)=>$x(lS(e,t,`close`),{method:`POST`,body:JSON.stringify({browserGeneration:n})}),createRuntimeBrowserPage:(e,t,n,r)=>$x(lS(e,t,`pages`),{method:`POST`,body:JSON.stringify({browserGeneration:n,...r===void 0?{}:{url:r}})}),closeRuntimeBrowserPage:(e,t,n,r)=>fS(e,t,n,r,`close`),activateRuntimeBrowserPage:(e,t,n,r)=>fS(e,t,n,r,`activate`),navigateRuntimeBrowserPage:(e,t,n,r,i)=>$x(lS(e,t,`pages`,r,`navigate`),{method:`POST`,body:JSON.stringify({browserGeneration:n,url:i})}),backRuntimeBrowserPage:(e,t,n,r)=>fS(e,t,n,r,`back`),forwardRuntimeBrowserPage:(e,t,n,r)=>fS(e,t,n,r,`forward`),reloadRuntimeBrowserPage:(e,t,n,r)=>fS(e,t,n,r,`reload`),getSessionEmulator:(e,t)=>Xx(uS(e,t)).then(e=>e.binding),listSessionEmulatorDevices:(e,t)=>Xx(uS(e,t,`devices`)).then(e=>e.devices),attachSessionEmulator:(e,t,n)=>$x(uS(e,t,`attach`),{method:`POST`,body:JSON.stringify({device:n})}),detachSessionEmulator:(e,t,n)=>$x(uS(e,t,`detach`),{method:`POST`,body:JSON.stringify({bindingId:n})}),tapSessionEmulator:(e,t,n,r,i)=>$x(uS(e,t,`tap`),{method:`POST`,body:JSON.stringify({bindingId:n,x:r,y:i})}),gestureSessionEmulator:(e,t,n,r)=>$x(uS(e,t,`gesture`),{method:`POST`,body:JSON.stringify({bindingId:n,points:r})}),buttonSessionEmulator:(e,t,n,r)=>$x(uS(e,t,`button`),{method:`POST`,body:JSON.stringify({bindingId:n,name:r})}),sessionEmulatorFrameBlob:(e,t,n,r)=>eS(dS(e,t,n),{signal:r,cache:`no-store`}),listPlugins:()=>Xx(`/api/plugins`).then(e=>e.plugins),listPluginMarketplaces:()=>Xx(Px,{cache:`no-store`}).then(e=>e.marketplaces),addPluginMarketplace:e=>$x(Px,{method:`POST`,headers:{"x-rynx-console":`1`},body:JSON.stringify(e)}),refreshPluginMarketplace:e=>$x(`${Px}/${encodeURIComponent(e)}/refresh`,{method:`POST`,headers:{"x-rynx-console":`1`},body:`{}`}),removePluginMarketplace:e=>$x(`${Px}/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"x-rynx-console":`1`}}),preparePluginInstallation:(e,t)=>$x(Nx,{method:`POST`,headers:{"x-rynx-console":`1`},body:JSON.stringify(e),signal:t}),commitPluginInstallation:(e,t,n)=>$x(Lx(e),{method:`POST`,headers:{"x-rynx-console":`1`},body:JSON.stringify(t),signal:n}),cancelPluginInstallation:e=>$x(Ix(e),{method:`DELETE`,headers:{"x-rynx-console":`1`}}),setPluginEnabled:(e,t)=>$x(`/api/plugins/${encodeURIComponent(e)}/${t?`enable`:`disable`}`,{method:`POST`,headers:{"x-rynx-console":`1`},body:`{}`}).then(e=>e.plugin),pluginSettingsUi:(e,t)=>Xx(`/api/plugins/${encodeURIComponent(e)}/settings-ui`,{cache:`no-store`,signal:t}),pluginSettingsCall:(e,t,n,r,i)=>$x(`/api/plugins/${encodeURIComponent(e)}/settings`,{method:`POST`,headers:{"x-rynx-console":`1`},body:JSON.stringify({generation:t,method:n,params:r}),signal:i}).then(e=>e.result),emulatorDevices:e=>Xx(aS(e,`devices`)).then(e=>e.devices),activeEmulator:e=>Xx(aS(e,`active`)).then(e=>e.active),attachEmulator:(e,t)=>oS(t,`attach`,{method:`POST`,body:JSON.stringify({device:e})}),tapEmulator:(e,t,n,r)=>oS(r,`tap`,{method:`POST`,body:JSON.stringify({x:e,y:t,device:n})}),gestureEmulator:(e,t,n)=>oS(n,`gesture`,{method:`POST`,body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,n)=>oS(n,`button`,{method:`POST`,body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>oS(t,`shutdown`,{method:`POST`,body:JSON.stringify({device:e})}),emulatorVideoStreamUrl:e=>`/api/emulator/video${e?`?device=${encodeURIComponent(e)}`:``}`,emulatorFrameBlob:e=>eS(`/api/emulator/frame${e?`?device=${encodeURIComponent(e)}`:``}`),screenshotEmulator:(e,t)=>Xx(`/api/emulator/screenshot`,{method:`POST`,body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>eS(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>Xx(`/api/agents`).then(e=>e.agents),getAgent:e=>Xx(`/api/agents/${encodeURIComponent(e)}`),listAgentRuntimeOptions:(e=!1)=>Xx(`/api/agents/runtime-options${e?`?refresh=1`:``}`,{cache:`no-store`}).then(e=>e.runtimes),createAgent:e=>Xx(`/api/agents`,{method:`POST`,body:JSON.stringify(e)}),updateAgent:(e,t)=>Xx(`/api/agents/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(t)}),deleteAgent:e=>Xx(`/api/agents/${encodeURIComponent(e)}`,{method:`DELETE`}),listProjects:e=>Xx(cS(e),{cache:`no-store`}).then(e=>e.projects),createProject:(e,t)=>$x(cS(e),{method:`POST`,body:JSON.stringify(t)}).then(e=>e.project),updateProject:(e,t,n)=>$x(cS(e,t),{method:`PUT`,body:JSON.stringify(n)}).then(e=>e.project),deleteProject:(e,t)=>$x(cS(e,t),{method:`DELETE`}),listSkills:()=>Xx(`/api/skills`).then(e=>e.skills),getSkill:e=>Xx(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>Xx(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>Xx(`/api/skills`,{method:`POST`,body:JSON.stringify(e)}).then(e=>e.skills),scanLocalSkills:e=>Xx(`/api/skills/local-scan`,{method:`POST`,body:JSON.stringify({runtime:e})}).then(e=>e.candidates),importLocalSkills:(e,t)=>Xx(`/api/skills/local-import`,{method:`POST`,body:JSON.stringify({runtime:e,keys:t})}).then(e=>e.results),importSkillArchive:(e,t)=>Xx(`/api/skills/import-archive`,{method:`POST`,body:JSON.stringify({filename:e,contentBase64:t})}).then(e=>e.results),deleteSkill:e=>Xx(`/api/skills/${encodeURIComponent(e)}`,{method:`DELETE`}),listSessions:e=>Xx(e?sS(e):`/api/sessions`).then(e=>e.sessions),listSessionAgentOptions:e=>Xx(`${sS(e)}/agent-options`).then(e=>e.agents),listSessionLaunchOptions:e=>Xx(`${sS(e)}/launch-options`),getSessionExecutionSettings:(e,t)=>Xx(sS(e,t,`execution`),{cache:`no-store`}),updateSessionExecutionSettings:(e,t,n)=>$x(sS(e,t,`execution`),{method:`PUT`,body:JSON.stringify(n)}),createSession:(e,t)=>{let n=t?sS(t):`/api/sessions`,r={method:`POST`,body:JSON.stringify(e)};return t?$x(n,r):Xx(n,r)},forkSession:(e,t,n)=>$x(sS(e,t,`fork`),{method:`POST`,body:JSON.stringify(n)}),sendSessionMessage:(e,t,n,r,i)=>i?$x(sS(i,e,`messages`),{method:`POST`,body:JSON.stringify(typeof t==`string`?{message:t}:t),signal:r}):tS(`/api/sessions/${encodeURIComponent(e)}/messages`,typeof t==`string`?{message:t}:t,n,r),getSessionResourcePolicy:(e,t)=>Xx(`${sS(e,t,`resources`)}/policy`,{cache:`no-store`}),uploadSessionResource:(e,t,n,r,i,a)=>$x(sS(e,t,`resources`),{method:`POST`,body:n,signal:a,headers:{"content-type":n.type||`application/octet-stream`,"x-rynx-resource-type":i,"x-rynx-upload-id":r,"x-rynx-filename":encodeURIComponent(n.name)}}).then(e=>e.resource),deleteSessionResource:(e,t,n)=>$x(`${sS(e,t,`resources`)}/${encodeURIComponent(n)}`,{method:`DELETE`}),sessionResourceContentUrl:(e,t,n)=>zx(`${sS(e,t,`resources`)}/${encodeURIComponent(n.resourceId)}/content`),sessionItemFileContentUrl:(e,t,n,r)=>zx(`${sS(e,t,`items`)}/${encodeURIComponent(n)}/files/${r}/content`),sessionWorkspaceFileContentUrl:(e,t,n)=>zx(`${sS(e,t)}/workspace/files/content?${new URLSearchParams({path:n}).toString()}`),enqueueSessionMessage:(e,t,n)=>$x(sS(e,t,`messages/queue`),{method:`POST`,body:JSON.stringify({message:n})}),startSessionTerminal:(e,t)=>$x(sS(e,t,`terminal/start`),{method:`POST`,body:`{}`}),streamSession:(e,t,n,r)=>nS(pS(r,e,`stream`),t,n),getSessionHistory:e=>Xx(`/api/sessions/${encodeURIComponent(e)}/history`).then(e=>e.items),getSessionSnapshot:(e,t,n)=>Xx(pS(n,e,`snapshot`),{signal:t}),getSessionSnapshotPage:(e,t,n,r)=>{let i=new URLSearchParams;t!==void 0&&i.set(`afterId`,t);let a=i.size>0?`?${i.toString()}`:``;return Xx(`${pS(r,e,`snapshot-page`)}${a}`,{signal:n})},closeSession:(e,t)=>{let n=t?sS(t,e):`/api/sessions/${encodeURIComponent(e)}`,r={method:`DELETE`};return t?$x(n,r):Xx(n,r)},interruptSession:(e,t)=>{let n=pS(t,e,`interrupt`),r={method:`POST`};return t?$x(n,r):Xx(n,r)}},mS=`rynx.control.runtime-target.v1`,hS={selector:`local`,daemonId:`local`,displayName:`This device`,binding:`local`};function gS(e){if(!e)return`local`;try{return e.getItem(`rynx.control.runtime-target.v1`)?.trim()||`local`}catch{return`local`}}function _S(e,t){if(e)try{e.setItem(mS,t)}catch{}}function vS(e){let t=new Map;for(let n of e)!n.selector||t.has(n.selector)||t.set(n.selector,n);return t.has(`local`)||t.set(`local`,hS),[...t.values()].sort((e,t)=>e.selector===`local`?-1:t.selector===`local`?1:e.displayName.localeCompare(t.displayName))}var yS=(0,u.createContext)(null);function bS({children:e}){let t=Rx(),n=$e(),r=nt(),i=Dx(n.pathname)??(n.pathname===px.sessions?Ox(n.search):null),[a,o]=(0,u.useState)(()=>gS(typeof window>`u`?void 0:window.localStorage)),s=i??a,[c,l]=(0,u.useState)([hS]),d=(0,u.useCallback)(e=>{l(vS(e))},[]),f=(0,u.useCallback)(async()=>{if(t){d([hS]);return}try{d(await Y.listRuntimes())}catch(e){V.error(`Failed to load Runtimes: ${e.message}`)}},[t,d]);(0,u.useEffect)(()=>{f()},[f]),(0,u.useEffect)(()=>{!i||i===`!invalid-runtime-owner`||(o(i),_S(typeof window>`u`?void 0:window.localStorage,i))},[i]);let p=(0,u.useCallback)(e=>{let t=e.trim();t&&(o(t),_S(typeof window>`u`?void 0:window.localStorage,t),(n.pathname===px.sessions||n.pathname.startsWith(`${px.sessions}/`)||Dx(n.pathname)!==null)&&i!==t&&r(zx(jx(t))))},[n.pathname,r,i]),m=(0,u.useMemo)(()=>{let e=c.find(e=>e.selector===s)??(s===`!invalid-runtime-owner`?{selector:s,daemonId:s,displayName:`Invalid Runtime URL`,binding:`direct`}:{selector:s,daemonId:s,displayName:`${s} (unavailable)`,binding:s===`local`?`local`:`direct`}),t=s!==`local`;return{runtimes:c,runtimeSelector:s,runtimeRoute:t?s:void 0,selectedRuntime:e,isRemoteRuntime:t,selectRuntime:p,refreshRuntimes:f,updateRuntimes:d}},[f,s,c,p,d]);return(0,H.jsx)(yS.Provider,{value:m,children:e})}function xS(){let e=(0,u.useContext)(yS);if(!e)throw Error(`useRuntimeTarget must be used inside RuntimeTargetProvider`);return e}var SS=`!add-runtime`;function CS(){let e=$e(),t=nt(),{runtimes:n,runtimeSelector:r,selectedRuntime:i,selectRuntime:a}=xS(),o=n.some(e=>e.selector===r)?n:[...n,i];return(0,H.jsx)(`div`,{className:`ml-auto w-44 max-w-full sm:w-60`,children:(0,H.jsxs)(my,{value:r,onValueChange:n=>{if(n===SS){t(px.runtimes,{state:{returnTo:`${e.pathname}${e.search}${e.hash}`}});return}a(n)},children:[(0,H.jsxs)(_y,{className:`h-10 w-full min-w-0 gap-1.5 border-0 bg-transparent px-2 font-mono text-[10px] shadow-none hover:bg-[var(--accent)] focus-visible:ring-2 sm:h-7`,"aria-label":`Active Runtime`,children:[(0,H.jsx)(`span`,{className:`hidden shrink-0 uppercase tracking-[0.12em] text-[var(--muted-foreground)] sm:inline`,children:`Runtime ·`}),(0,H.jsx)(gy,{placeholder:`Select Runtime`})]}),(0,H.jsxs)(by,{align:`end`,children:[o.map(e=>{let t=e.binding===`local`?hr:Wr;return(0,H.jsx)(Sy,{value:e.selector,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(t,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.displayName})]})},e.selector)}),(0,H.jsx)(Cy,{}),(0,H.jsx)(Sy,{value:SS,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(Ir,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{children:`Add Runtime…`})]})})]})]})})}function wS(){return typeof window>`u`?null:window.rynxDesktopIntegration??null}function TS(e){return e.globalCli.state===`foreign`||e.globalCli.state===`unwritable`}function ES(e,t){return!e.runtime.ready||!e.builtinSkill.ready?!1:e.globalCli.state===`installed`&&!e.globalCli.canInstall||e.globalCli.state===`development`||TS(e)&&t}var DS=(0,u.createContext)({status:null,operation:null,error:null,checkForUpdates:async()=>null,installUpdate:async()=>null});function OS({children:e}){let t=wS(),[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(!t)return;let e=!0,n=t.onAppUpdateStatus(t=>{e&&(r(t),t.error||s(null))});return t.getAppUpdateStatus().then(t=>{e&&r(t)}).catch(t=>{e&&s(AS(t))}),()=>{e=!1,n()}},[t]);let c=(0,u.useCallback)(async()=>{if(!t)return null;a(`check`),s(null);try{let e=await t.checkForAppUpdates();return r(e),e}catch(e){return s(AS(e)),null}finally{a(null)}},[t]),l=(0,u.useCallback)(async()=>{if(!t)return null;a(`install`),s(null);try{let e=await t.installAppUpdate();return r(e),e}catch(e){return s(AS(e)),null}finally{a(null)}},[t]),d=(0,u.useMemo)(()=>({status:n,operation:i,error:o,checkForUpdates:c,installUpdate:l}),[c,o,l,i,n]);return(0,H.jsx)(DS.Provider,{value:d,children:e})}function kS(){return(0,u.useContext)(DS)}function AS(e){return e instanceof Error?e.message:String(e)}function jS(){let{status:e,operation:t,error:n,installUpdate:r}=kS();if(!e?.availableVersion||e.phase!==`downloading`&&e.phase!==`ready`&&e.phase!==`installing`)return null;let i=t===`install`||e.phase===`installing`,a=e.phase===`ready`&&!i,o=n??e.error;return(0,H.jsxs)(`div`,{className:`group/update relative flex shrink-0 items-center`,children:[(0,H.jsxs)(J,{variant:`ghost`,size:`icon-xs`,className:`relative text-[var(--primary)] hover:text-[var(--primary)]`,"aria-label":`Rynx ${e.availableVersion} update available`,"aria-haspopup":`dialog`,children:[e.phase===`downloading`||i?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(Bn,{}),(0,H.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 rounded-full bg-[var(--primary)] ring-2 ring-[var(--background)]`,"aria-hidden":`true`})]}),(0,H.jsx)(`div`,{role:`dialog`,"aria-label":`Rynx update`,className:`invisible absolute bottom-full right-0 z-50 w-72 translate-y-1 pb-2 opacity-0 transition-[opacity,transform,visibility] duration-150 group-hover/update:visible group-hover/update:translate-y-0 group-hover/update:opacity-100 group-focus-within/update:visible group-focus-within/update:translate-y-0 group-focus-within/update:opacity-100`,children:(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--border)] bg-[var(--popover)] p-3 font-sans text-[var(--popover-foreground)] shadow-xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]`,children:a?(0,H.jsx)(Bn,{className:`size-4`}):e.phase===`downloading`?(0,H.jsx)(Yn,{className:`size-4`}):(0,H.jsx)(B,{className:`size-4 animate-spin`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-xs font-semibold text-[var(--foreground)]`,children:a?`Update ready`:i?`Preparing update`:`Downloading update`}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-4 text-[var(--muted-foreground)]`,children:a?`${e.appName} ${e.availableVersion} is ready to install.`:i?`Rynx will restart when the local Runtime is safe to stop.`:`${e.appName} ${e.availableVersion} is downloading in the background.`})]})]}),a&&(0,H.jsxs)(J,{size:`sm`,className:`mt-3 w-full`,onClick:()=>void r(),children:[(0,H.jsx)(Bn,{}),`Restart to update`]}),o&&(0,H.jsx)(`p`,{className:`mt-2 text-[10px] leading-4 text-[var(--destructive)]`,children:o})]})})]})}function X(...e){return iu(Mc(e))}function MS({children:e,theme:t,onToggleTheme:n}){let r=$e(),i=Rx(),{runtimeSelector:a}=xS(),o=Tx(r.pathname),s=r.pathname===`/settings`||r.pathname.startsWith(`/settings/`),c=Mx(r.state,jx(a)),l=s?c:hx,u=s?void 0:{returnTo:`${r.pathname}${r.search}${r.hash}`};return(0,H.jsxs)(`div`,{className:`grid h-dvh min-h-0 grid-rows-[minmax(0,1fr)_2.5rem] overflow-hidden bg-[var(--background)] sm:grid-rows-[minmax(0,1fr)_2rem]`,children:[(0,H.jsx)(`main`,{className:`min-h-0 overflow-hidden focus:outline-none`,children:e}),(0,H.jsxs)(`footer`,{className:`app-no-drag flex min-w-0 items-center gap-3 border-t border-[var(--border)] bg-[var(--muted)]/24 px-2 font-mono text-[10px] text-[var(--muted-foreground)] sm:px-3`,children:[(0,H.jsx)(`span`,{className:`hidden truncate uppercase tracking-[0.12em] min-[480px]:block`,children:s?o===`emulator`?`Emulator · local device`:`Settings · local configuration`:`Session workbench`}),(0,H.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-1.5`,children:[i?(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 px-1`,children:[(0,H.jsx)(`span`,{className:`text-[var(--foreground)]`,children:`Rynx Sessions`}),i.access===`read_only`&&(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`· read only`})]}):s?(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 px-1`,children:[(0,H.jsx)(`span`,{className:`text-[var(--foreground)]`,children:`Control Plane`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:`This device`})]}):(0,H.jsx)(CS,{}),(0,H.jsx)(`span`,{className:`h-3.5 w-px bg-[var(--border)]`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[!i&&(0,H.jsx)(jS,{}),(0,H.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`shrink-0`,onClick:n,"aria-label":t===`dark`?`Use light mode`:`Use dark mode`,title:t===`dark`?`Light mode`:`Dark mode`,children:t===`dark`?(0,H.jsx)(ai,{}):(0,H.jsx)(wr,{})}),!i&&(0,H.jsx)(J,{asChild:!0,variant:`ghost`,size:`icon-xs`,className:X(`shrink-0`,s&&`text-[var(--primary)]`),children:(0,H.jsx)(hn,{to:l,state:u,"aria-label":s?`Back to app`:`Settings`,title:s?`Back to app`:`Settings`,children:(0,H.jsx)(Kr,{})})})]})]})]})]})}var NS=`/assets/rynx-wordmark-LL1QRYHD.png`;function PS({bridge:e,children:t}){let[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(`refresh`),[c,l]=(0,u.useState)(!1),d=(0,u.useCallback)(async(t=!1)=>{s(`refresh`),a(null);try{let n=await e.getStatus(t);ES(n,!1)?r(await e.completeOnboarding()):r(n)}catch(e){a(e.message)}finally{s(null)}},[e]);(0,u.useEffect)(()=>{e.initialOnboardingCompleted||d()},[e.initialOnboardingCompleted,d]);let f=n?ES(n,c):!1;async function p(){let t=n?.globalCli.path;if(t){s(`install`),a(null);try{let n=await e.installCli(t);l(!1),ES(n,!1)?r(await e.completeOnboarding()):r(n)}catch(t){a(t.message);try{r(await e.getStatus(!0))}catch{}}finally{s(null)}}}async function m(){s(`runtime`),a(null);try{r(await e.restartDaemon())}catch(e){a(e.message)}finally{s(null)}}async function h(){if(!(!n||!f)){s(`complete`),a(null);try{r(await e.completeOnboarding())}catch(e){a(e.message)}finally{s(null)}}}if(e.initialOnboardingCompleted||n?.onboardingCompleted)return t;let g=!!(n?.runtime.ready&&n?.builtinSkill.ready);return(0,H.jsxs)(`div`,{className:`grid h-dvh min-h-0 overflow-hidden bg-[var(--background)] md:grid-cols-[15rem_minmax(0,1fr)]`,children:[(0,H.jsxs)(`aside`,{className:`app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] bg-[var(--muted)]/18 p-4 md:border-r md:border-b-0 md:p-5`,children:[(0,H.jsx)(`img`,{src:NS,alt:`rynx`,className:`h-5 w-auto dark:brightness-0 dark:invert`}),(0,H.jsxs)(`div`,{className:`app-no-drag mt-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,H.jsx)(`p`,{className:`label-caps text-[10px] text-[var(--primary)]`,children:`Setup`}),(0,H.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--muted-foreground)]`,children:`1/1`})]}),(0,H.jsx)(`ol`,{className:`mt-3`,"aria-label":`Setup steps`,children:(0,H.jsxs)(`li`,{"aria-current":`step`,className:`flex items-center gap-2 rounded-lg bg-[var(--muted)] px-3 py-2.5 text-sm font-medium text-[var(--foreground)] ring-1 ring-inset ring-[var(--border)]`,children:[(0,H.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-full bg-[var(--primary)] text-[10px] font-semibold text-[var(--primary-foreground)]`,children:`1`}),(0,H.jsx)(`span`,{className:`truncate`,children:`Terminal command`})]})})]})]}),(0,H.jsxs)(`main`,{className:`app-no-drag relative min-h-0 overflow-auto`,children:[(0,H.jsx)(`div`,{className:`desktop-macos-home-titlebar`,"aria-hidden":`true`}),(0,H.jsx)(`div`,{className:`grid min-h-full place-items-center px-5 py-12 sm:px-8 md:px-12`,children:(0,H.jsxs)(`section`,{className:`w-full max-w-xl`,"aria-labelledby":`onboarding-command-title`,children:[(0,H.jsx)(FS,{titleId:`onboarding-command-title`,title:`Set up the Terminal command`,description:`Install one small command so Rynx is available from any Terminal.`}),(0,H.jsx)(`div`,{className:`mt-7 rounded-lg border border-[var(--border)] bg-[var(--card)] p-5 shadow-sm`,"aria-busy":o!==null,children:n?g?(0,H.jsx)(IS,{status:n,pending:o,acknowledged:c,onAcknowledgedChange:l,onInstall:()=>void p(),onRefresh:()=>void d(!0),onContinue:()=>void h()}):(0,H.jsx)(LS,{status:n,pending:o,onRetry:()=>void m()}):(0,H.jsxs)(`div`,{className:`flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[o===`refresh`&&(0,H.jsx)(B,{className:`size-4 animate-spin`}),o===`refresh`?`Getting Rynx ready…`:`Setup status is unavailable.`]})}),i&&(0,H.jsxs)(`div`,{role:`alert`,className:`mt-5 flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]`,children:[(0,H.jsx)(zn,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsx)(`span`,{children:i})]})]})})]})]})}function FS({titleId:e,title:t,description:n}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{id:e,className:`text-2xl font-semibold tracking-tight`,children:t}),(0,H.jsx)(`p`,{className:`mt-2 max-w-lg text-sm leading-6 text-[var(--muted-foreground)]`,children:n})]})}function IS({status:e,pending:t,acknowledged:n,onAcknowledgedChange:r,onInstall:i,onRefresh:a,onContinue:o}){let s=e.globalCli.state===`installed`,c=e.globalCli.state===`development`,l=s&&!e.globalCli.canInstall,u=TS(e),d=ES(e,n);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:l?`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]`:`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:l?(0,H.jsx)(Pn,{className:`size-4`}):(0,H.jsx)(qn,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:`Terminal command`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:RS(e)})]})]}),u&&(0,H.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--background))] p-3 text-xs`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked),className:`mt-0.5 size-4 shrink-0 accent-[var(--primary)]`}),(0,H.jsxs)(`span`,{children:[`Continue without Terminal access. I'll resolve the`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`rynx`}),` command later.`]})]}),(0,H.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2`,children:[e.globalCli.canInstall&&(0,H.jsxs)(J,{disabled:t!==null,onClick:i,children:[t===`install`&&(0,H.jsx)(B,{className:`animate-spin`}),`Install command`]}),(l||c||u)&&(0,H.jsxs)(J,{disabled:t!==null||!d,onClick:o,children:[`Continue`,(0,H.jsx)(jn,{})]}),(0,H.jsxs)(J,{variant:`outline`,disabled:t!==null,onClick:a,children:[(0,H.jsx)(zr,{className:t===`refresh`?`animate-spin`:``}),`Check again`]})]})]})}function LS({status:e,pending:t,onRetry:n}){return(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]`,children:(0,H.jsx)(zn,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:e.builtinSkill.ready?`Rynx couldn’t finish starting`:`Rynx needs to be reinstalled`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:e.builtinSkill.ready?`Try again to continue.`:`A required app component is unavailable. Reinstall Rynx, then open it again.`}),e.builtinSkill.ready&&(0,H.jsxs)(J,{className:`mt-4`,variant:`outline`,disabled:t!==null,onClick:n,children:[t===`runtime`&&(0,H.jsx)(B,{className:`animate-spin`}),`Try again`]})]})]})}function RS(e){switch(e.globalCli.state){case`installed`:return e.globalCli.canInstall?`Install the rynx command to use Rynx from Terminal.`:`Rynx is ready to use from Terminal.`;case`missing`:return`Install the rynx command to use Rynx from Terminal.`;case`stale`:return`An older rynx command was found. Repair it to continue.`;case`foreign`:return`Another command named rynx already exists. Resolve it later in Settings.`;case`development`:return`Terminal command registration is disabled in development builds.`;case`unwritable`:return`Rynx could not install the command automatically. Resolve it later in Settings.`;case`error`:return`Rynx could not check the command. Check again before continuing.`}}function zS({bridge:e}){let[t,n]=(0,u.useState)(null),[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(null),s=(0,u.useRef)(!1),c=(0,u.useRef)(0),l=(0,u.useCallback)(e=>{e.requestId<=c.current||(c.current=e.requestId,n(e),i(!1),o(null),s.current=!1)},[]);(0,u.useEffect)(()=>{let t=!0,n=e.onQuitPrompt(e=>{t&&l(e)});return e.getPendingQuitPrompt().then(e=>{t&&e&&l(e)}).catch(()=>{}),()=>{t=!1,n()}},[l,e]);let d=(0,u.useCallback)(async()=>{if(!(!t||r||s.current)){s.current=!0;try{let r=await e.respondToQuit(t.requestId,`cancel`);if(r.outcome===`failed`){o(r.message);return}if(r.outcome===`quitting`){i(!0);return}r.outcome===`cancelled`&&(n(null),o(null))}catch{o(`Rynx couldn’t dismiss the quit request. Try again.`)}finally{s.current=!1}}},[e,t,r]),f=(0,u.useCallback)(async()=>{if(!(!t||t.kind!==`active-work`||s.current)){s.current=!0,i(!0),o(null);try{let r=await e.respondToQuit(t.requestId,`force`);r.outcome===`failed`?(o(r.message),i(!1)):r.outcome===`cancelled`&&(n(null),i(!1))}catch{o(`Rynx couldn’t stop the running work. Try again.`),i(!1)}finally{s.current=!1}}},[e,t]),p=t?.kind===`active-work`;return(0,H.jsx)(uu,{open:t!==null,onOpenChange:e=>{e||d()},children:(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsx)(_u,{className:`bg-destructive/10 text-destructive`,children:(0,H.jsx)(ci,{"aria-hidden":`true`})}),(0,H.jsx)(vu,{children:p?`Quit Rynx?`:`Rynx couldn’t quit`}),(0,H.jsx)(yu,{children:p?`Work is still running. Quitting now will stop it and close the open workspace.`:`Rynx couldn’t stop its local service safely. Keep the app open and try again.`})]}),a&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{disabled:r,children:p?`Keep working`:`Close`}),p&&(0,H.jsx)(J,{type:`button`,variant:`destructive`,disabled:r,onClick:()=>void f(),children:r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(B,{className:`animate-spin motion-reduce:animate-none`}),`Quitting…`]}):`Quit anyway`})]})]})})}var BS=[{label:`General`,items:[{id:`overview`,label:`Overview`,icon:gr},{id:`projects`,label:`Projects`,icon:ir}]},{label:`Connections`,items:[{id:`localRuntime`,label:`Local Runtime`,icon:qn},{id:`runtimes`,label:`Runtimes`,icon:Wr}]},{label:`AI Capabilities`,items:[{id:`providers`,label:`Providers`,icon:ti},{id:`agents`,label:`Agents`,icon:Mn},{id:`skills`,label:`Skills`,icon:ei}]},{label:`Integrations`,items:[{id:`computerUse`,label:`Computer Use`,icon:Cr},{id:`emulator`,label:`Emulator`,icon:$r},{id:`plugins`,label:`Plugins`,icon:Rr}]}];function VS({activeView:e,desktopIntegrationAvailable:t,children:n}){let r=nt(),i=$e(),{runtimeSelector:a}=xS(),o=Mx(i.state,jx(a)),s={returnTo:o},c=BS.map(e=>({...e,items:e.items.filter(({id:e})=>wx(e,t))})).filter(e=>e.items.length>0),l=c.flatMap(e=>e.items);return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-[var(--background)] md:grid md:grid-cols-[14rem_minmax(0,1fr)]`,children:[(0,H.jsxs)(`aside`,{className:`hidden min-h-0 flex-col border-r border-[var(--border)] bg-[var(--muted)]/18 md:flex`,children:[(0,H.jsxs)(`div`,{className:`app-drag-region desktop-macos-titlebar-inset border-b border-[var(--border)] p-2.5`,children:[(0,H.jsx)(`div`,{className:`mb-2 flex h-7 items-center px-0.5`,children:(0,H.jsxs)(hn,{to:o,className:`app-no-drag flex w-fit items-center gap-2`,"aria-label":`Rynx`,children:[(0,H.jsx)(`img`,{src:NS,alt:`rynx`,className:`h-5 w-auto dark:brightness-0 dark:invert`}),(0,H.jsx)(`span`,{className:`label-caps text-[8px] text-[var(--muted-foreground)]`,children:`control`})]})}),(0,H.jsx)(J,{asChild:!0,variant:`ghost`,size:`sm`,className:`app-no-drag w-full justify-start gap-2 px-2`,children:(0,H.jsxs)(hn,{to:o,children:[(0,H.jsx)(An,{className:`size-3.5`}),`Back to app`]})})]}),(0,H.jsx)(U_,{className:`min-h-0 flex-1`,children:(0,H.jsx)(`nav`,{className:`space-y-4 p-3`,"aria-label":`Settings`,children:c.map(t=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`label-caps mb-1 px-2 text-[9px] text-[var(--muted-foreground)]`,children:t.label}),(0,H.jsx)(`div`,{className:`grid gap-0.5`,children:t.items.map(({id:t,label:n,icon:r})=>(0,H.jsxs)(hn,{to:px[t],state:s,"aria-current":e===t?`page`:void 0,className:X(`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors`,e===t?`bg-[var(--primary)]/10 text-[var(--primary)]`:`text-[var(--muted-foreground)] hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]`),children:[(0,H.jsx)(r,{className:`size-3.5 shrink-0`}),n]},t))})]},t.label))})})]}),(0,H.jsxs)(`div`,{className:`app-drag-region flex h-14 shrink-0 items-center gap-2 border-b border-[var(--border)] bg-[var(--muted)]/18 px-3 md:hidden`,children:[(0,H.jsx)(hn,{to:o,className:`app-no-drag shrink-0`,"aria-label":`Rynx`,children:(0,H.jsx)(`img`,{src:NS,alt:`rynx`,className:`h-5 w-auto dark:brightness-0 dark:invert`})}),(0,H.jsx)(J,{asChild:!0,variant:`ghost`,size:`sm`,className:`app-no-drag shrink-0 gap-1.5 px-2`,children:(0,H.jsxs)(hn,{to:o,children:[(0,H.jsx)(An,{className:`size-3.5`}),`Back`]})}),(0,H.jsx)(Ig,{"aria-label":`Settings page`,value:e,className:`ml-auto min-w-0 flex-1`,onChange:e=>r(px[e.target.value],{state:s}),children:l.map(({id:e,label:t})=>(0,H.jsx)(`option`,{value:e,children:t},e))})]}),e===`emulator`?(0,H.jsx)(`section`,{className:`min-h-0 flex-1 overflow-hidden`,children:n}):(0,H.jsx)(U_,{className:`min-h-0 flex-1`,children:(0,H.jsx)(`section`,{className:`p-4 sm:p-6`,children:n})})]})}var HS=`Label`,US=u.forwardRef((e,t)=>(0,H.jsx)(W.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));US.displayName=HS;var WS=US,GS=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(WS,{ref:n,className:X(`text-xs font-medium text-[var(--muted-foreground)]`,e),...t}));GS.displayName=`Label`;function KS({onInstalled:e,triggerLabel:t=`Install skill`,triggerVariant:n=`default`}){let[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(``),[s,c]=(0,u.useState)(``),[l,d]=(0,u.useState)(``),[f,p]=(0,u.useState)(!1);function m(){o(``),c(``),d(``)}let h=(()=>{let e=a.trim();return!e||!s.trim()?e:`${e}#${s.trim()}`})(),g=!!s.trim()&&a.includes(`#`);async function _(){let t=h;if(t){if(g){V.error(`Source already pins a ref with '#' — clear one of the two.`);return}p(!0);try{let n=await Y.installSkill({tool:`skills-cli`,source:t,...l.trim()?{skill:l.trim()}:{}});V.success(`Installed ${l.trim()||t}`),e(n),m(),i(!1)}catch(e){V.error(`Install failed: ${e.message}`)}finally{p(!1)}}}let v=[`npx skills add`,h||`<source>`,l.trim()&&`--skill ${l.trim()}`].filter(Boolean).join(` `);return(0,H.jsxs)(Su,{open:r,onOpenChange:e=>{i(e),e||m()},children:[(0,H.jsx)(Cu,{asChild:!0,children:(0,H.jsxs)(J,{size:`sm`,variant:n,children:[(0,H.jsx)(Ir,{}),` `,t]})}),(0,H.jsxs)(Du,{children:[(0,H.jsxs)(Ou,{children:[(0,H.jsx)(Au,{children:`Install a skill`}),(0,H.jsxs)(ju,{children:[`From the open skills ecosystem (skills.sh). Runs `,(0,H.jsx)(`code`,{children:`npx skills add`}),` into the global catalog (`,(0,H.jsx)(`code`,{children:`~/.rynx/skills`}),`).`]})]}),(0,H.jsxs)(`div`,{className:`grid gap-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsxs)(GS,{children:[`Source `,(0,H.jsx)(`span`,{className:`text-[var(--destructive)]`,children:`*`})]}),(0,H.jsx)(Ag,{value:a,autoFocus:!0,placeholder:`vercel-labs/skills or https://github.com/owner/repo`,onChange:e=>o(e.target.value)}),(0,H.jsxs)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:[`A repo (`,(0,H.jsx)(`code`,{children:`owner/repo`}),`), a git URL, or a namespace.`]})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{children:`Skill`}),(0,H.jsx)(Ag,{value:l,placeholder:`find-skills`,onChange:e=>d(e.target.value)}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Optional — when a repo ships several.`})]}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{children:`Branch`}),(0,H.jsx)(Ag,{value:s,placeholder:`main`,onChange:e=>c(e.target.value)}),(0,H.jsxs)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:[`Optional — a git ref, sent as `,(0,H.jsx)(`code`,{children:`#<branch>`}),`.`]})]})]}),(0,H.jsx)(`pre`,{className:`overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2.5 font-mono text-xs text-[var(--muted-foreground)]`,children:v})]}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(J,{variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,H.jsx)(J,{onClick:_,disabled:f||!a.trim(),children:f?`Installing…`:`Install`})]})]})]})}var qS=[`codex`,`traex`,`claude`],JS=[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],YS=[`read-only`,`workspace-write`,`danger-full-access`],XS=[`never`,`on-failure`,`on-request`,`untrusted`],ZS=[`acceptEdits`,`auto`,`bypassPermissions`,`manual`,`dontAsk`,`plan`];function QS({value:e,onChange:t}){return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsx)(aC,{label:`Display name`,help:`Shown in the UI; the id (left) is the directory name.`,children:(0,H.jsx)(Ag,{value:e.name??``,placeholder:`My agent`,onChange:n=>t({...e,name:n.target.value})})}),(0,H.jsx)(aC,{label:`Description`,children:(0,H.jsx)(Ag,{value:e.description??``,placeholder:`What this agent does`,onChange:n=>t({...e,description:n.target.value})})}),(0,H.jsx)(aC,{label:`Instructions`,help:`Inline system prompt, or a path to a .md under the agent dir.`,children:(0,H.jsx)(jg,{value:e.instructions??``,className:`min-h-[14rem]`,placeholder:`You are a helpful agent.`,onChange:n=>t({...e,instructions:n.target.value})})})]})}function $S({value:e,onChange:t}){let n=e.executor??{},r=n.retry??{},[i,a]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=!1;return Y.listAgentRuntimeOptions().then(t=>!e&&a(t)).catch(t=>{e||(a([]),V.error(`Load runtime options failed: ${t.message}`))}),()=>{e=!0}},[]);let o=r=>t({...e,executor:{...n,...r}}),s=i=>t({...e,executor:{...n,retry:{...r,...i}}}),c=i?.find(e=>e.id===(n.runtime??`codex`)),l=c?.models??[],d=l.find(e=>e.id===n.model)?.reasoningOptions.map(e=>e.value)??JS;return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(aC,{label:`Runtime`,children:[(0,H.jsx)(sC,{value:n.runtime,options:i?.length?i.map(e=>e.id):qS,required:!0,onChange:e=>{if(!e)return;let t=i?.find(t=>t.id===e),n=t?.models.find(e=>e.isDefault)??t?.models[0];o({runtime:e,model:n?.id,reasoningEffort:n?.defaultReasoningEffort})}}),c&&!c.available&&(0,H.jsxs)(`p`,{className:`text-xs text-[var(--warning)]`,children:[c.name,` is not installed on this machine.`]})]}),(0,H.jsx)(aC,{label:`Reasoning effort`,children:(0,H.jsx)(sC,{value:n.reasoningEffort,options:d.length>0?d:JS,onChange:e=>o({reasoningEffort:e})})})]}),(0,H.jsx)(aC,{label:`Model`,help:`Blank inherits the runtime default.`,children:l.length>0?(0,H.jsxs)(my,{value:n.model??``,onValueChange:e=>o({model:e,reasoningEffort:void 0}),children:[(0,H.jsx)(_y,{children:(0,H.jsx)(gy,{placeholder:`runtime default`})}),(0,H.jsxs)(by,{children:[n.model&&!l.some(e=>e.id===n.model)&&(0,H.jsxs)(Sy,{value:n.model,children:[n.model,` · custom`]}),l.map(e=>(0,H.jsxs)(Sy,{value:e.id,children:[e.label,e.isDefault?` · default`:``]},e.id))]})]}):(0,H.jsx)(Ag,{value:n.model??``,placeholder:`runtime default`,onChange:e=>o({model:e.target.value||void 0})})}),(0,H.jsx)(`div`,{className:`label-caps pt-1 text-xs text-[var(--muted-foreground)]`,children:`Execution budget`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsx)(aC,{label:`Timeout (s)`,help:`End-to-end wall-clock cap.`,children:(0,H.jsx)(cC,{value:n.timeout,onChange:e=>o({timeout:e})})}),(0,H.jsx)(aC,{label:`Max iterations`,help:`claude only (→ --max-turns).`,children:(0,H.jsx)(cC,{value:n.maxIterations,onChange:e=>o({maxIterations:e})})}),(0,H.jsx)(aC,{label:`Context window`,help:`codex/traex token budget.`,children:(0,H.jsx)(cC,{value:n.contextWindow,onChange:e=>o({contextWindow:e})})}),(0,H.jsx)(aC,{label:`Retry: max retries`,children:(0,H.jsx)(cC,{value:r.maxRetries,onChange:e=>s({maxRetries:e})})}),(0,H.jsx)(aC,{label:`Retry: timeout/req (s)`,children:(0,H.jsx)(cC,{value:r.timeoutPerRequestSeconds,onChange:e=>s({timeoutPerRequestSeconds:e})})})]})]})}function eC({value:e,onChange:t}){let n=e.osEnv??{},r=r=>t({...e,osEnv:{...n,...r}}),i=e.executor?.runtime??`codex`;return(0,H.jsx)(`div`,{className:`grid gap-4`,children:(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[i===`claude`?(0,H.jsx)(aC,{label:`Permission mode`,help:`Claude's approval axis (--permission-mode).`,children:(0,H.jsx)(sC,{value:n.permissionMode,options:ZS,onChange:e=>r({permissionMode:e})})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(aC,{label:`Sandbox`,children:(0,H.jsx)(sC,{value:n.sandbox,options:YS,onChange:e=>r({sandbox:e})})}),(0,H.jsx)(aC,{label:`Approval policy`,help:`Codex's approval axis.`,children:(0,H.jsx)(sC,{value:n.approvalPolicy,options:XS,onChange:e=>r({approvalPolicy:e})})})]}),(0,H.jsx)(aC,{label:`Full auto`,children:(0,H.jsxs)(`label`,{className:`flex h-8 items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`size-4`,checked:!!n.fullAuto,onChange:e=>r({fullAuto:e.target.checked||void 0})}),(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:`enable`})]})})]})})}function tC({value:e,onChange:t}){let n=e.tools??{},r=r=>t({...e,tools:{...n,...r}});return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsx)(aC,{label:`Allowed tools`,help:`claude only; codex/traex ignore.`,children:(0,H.jsx)(lC,{items:n.allowed??[],placeholder:`ToolName`,onChange:e=>r({allowed:e})})}),(0,H.jsx)(aC,{label:`Disallowed tools`,children:(0,H.jsx)(lC,{items:n.disallowed??[],placeholder:`ToolName`,onChange:e=>r({disallowed:e})})}),(0,H.jsx)(aC,{label:`MCP servers`,help:`HTTP transport only.`,children:(0,H.jsx)(uC,{rows:n.mcp??[],onChange:e=>r({mcp:e})})})]})}function nC({value:e,onChange:t}){let n=e.skills??[],[r,i]=(0,u.useState)(null);(0,u.useEffect)(()=>{Y.listSkills().then(i).catch(e=>{i([]),V.error(`Load skills failed: ${e.message}`)})},[]);let a=new Set(n.map(e=>e.name)),o=r=>{r.ref&&t({...e,skills:[...n,{...r.ref}]})},s=r=>t({...e,skills:n.filter(e=>e.name!==r)}),c=new Set((r??[]).map(e=>e.name)),l=n.map(e=>e.name).filter(e=>!c.has(e));return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsx)(aC,{label:`Skills`,help:`Empty = no skills (hermetic). Each selection copies the skill's install recipe into the spec, so the agent installs its own skills wherever it runs.`,children:r===null?(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Loading…`}):r.length===0&&l.length===0?(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`No skills installed yet — install one below.`}):(0,H.jsxs)(`div`,{className:`grid gap-0.5 rounded-md border border-[var(--border)] p-1.5`,children:[r.map(e=>(0,H.jsxs)(`label`,{className:`flex items-start gap-2 rounded-sm p-1.5 `+(e.ref?`cursor-pointer hover:bg-[var(--muted)]/50`:`opacity-60`),children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0`,disabled:!e.ref,checked:a.has(e.name),onChange:t=>t.target.checked?o(e):s(e.name)}),(0,H.jsxs)(`span`,{className:`grid`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-sm`,children:[e.name,!e.ref&&(0,H.jsx)(`span`,{className:`ml-1 text-xs text-[var(--warning)]`,children:`(no install recipe — reinstall to make selectable)`})]}),(0,H.jsx)(`span`,{className:`line-clamp-2 text-xs text-[var(--muted-foreground)]`,children:e.description})]})]},e.name)),l.map(e=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2 rounded-sm p-1.5`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`size-4 shrink-0`,checked:!0,onChange:()=>s(e)}),(0,H.jsxs)(`span`,{className:`font-mono text-sm`,children:[e,` `,(0,H.jsx)(`span`,{className:`text-xs text-[var(--muted-foreground)]`,children:`(declared in the spec; installs at run time)`})]})]},e))]})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(KS,{onInstalled:i,triggerVariant:`outline`})})]})}function rC(e){let{skills:t,...n}=e,r=iC(n)??{};return Array.isArray(t)&&t.length>0&&(r.skills=t),r}function iC(e){if(Array.isArray(e)){let t=e.map(iC).filter(e=>e!==void 0);return t.length>0?t:void 0}if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e)){let e=iC(r);e!==void 0&&(t[n]=e)}return Object.keys(t).length>0?t:void 0}if(typeof e==`string`){let t=e.trim();return t===``?void 0:t}return e}function aC({label:e,help:t,children:n}){return(0,H.jsxs)(`div`,{className:`grid content-start gap-1.5`,children:[(0,H.jsx)(GS,{children:e}),n,t&&(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:t})]})}var oC=`__default__`;function sC({value:e,options:t,onChange:n,disabled:r,required:i}){return(0,H.jsxs)(my,{value:e??(i?t[0]:oC),disabled:r,onValueChange:e=>n(e===oC?void 0:e),children:[(0,H.jsx)(_y,{children:(0,H.jsx)(gy,{})}),(0,H.jsxs)(by,{children:[!i&&(0,H.jsx)(Sy,{value:oC,children:(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:`Unset`})}),t.map(e=>(0,H.jsx)(Sy,{value:e,children:e},e))]})]})}function cC({value:e,onChange:t}){return(0,H.jsx)(Ag,{type:`number`,value:e??``,onChange:e=>{let n=e.target.value;t(n===``?void 0:Number(n))}})}function lC({items:e,placeholder:t,onChange:n}){let r=(t,r)=>n(e.map((e,n)=>n===t?r:e)),i=t=>n(e.filter((e,n)=>n!==t));return(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[e.map((e,n)=>(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(Ag,{value:e,placeholder:t,onChange:e=>r(n,e.target.value)}),(0,H.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>i(n),children:(0,H.jsx)(di,{})})]},n)),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,className:`justify-self-start`,onClick:()=>n([...e,``]),children:[(0,H.jsx)(Ir,{}),` Add`]})]})}function uC({rows:e,onChange:t}){let n=(0,u.useRef)(0),[r,i]=(0,u.useState)(()=>e.map(()=>n.current++)),a=(n,r)=>t(e.map((e,t)=>t===n?{...e,...r}:e)),o=n=>{t(e.filter((e,t)=>t!==n)),i(r.filter((e,t)=>t!==n))};return(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[e.map((e,t)=>(0,H.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-[var(--border)] p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(Ag,{className:`w-1/3`,value:e.name??``,placeholder:`name`,onChange:e=>a(t,{name:e.target.value})}),(0,H.jsx)(`span`,{className:`label-caps rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]`,children:`HTTP`}),(0,H.jsx)(Ag,{value:e.url??``,placeholder:`https://server/mcp`,onChange:e=>a(t,{url:e.target.value})}),(0,H.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>o(t),children:(0,H.jsx)(di,{})})]}),(0,H.jsx)(dC,{headers:e.headers??{},onChange:e=>a(t,{headers:e})})]},r[t]??t)),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,className:`justify-self-start`,onClick:()=>{t([...e,{name:``,url:``}]),i([...r,n.current++])},children:[(0,H.jsx)(Ir,{}),` Add MCP server`]})]})}function dC({headers:e,onChange:t}){let[n,r]=(0,u.useState)(()=>Object.entries(e).map(([e,t])=>({k:e,v:t})));function i(e){r(e);let n={};for(let{k:t,v:r}of e){let e=t.trim();e&&(n[e]=r)}t(Object.keys(n).length>0?n:void 0)}let a=(e,t)=>i(n.map((n,r)=>r===e?{...n,...t}:n)),o=e=>i(n.filter((t,n)=>n!==e));return(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[n.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(Ag,{className:`w-1/3 font-mono text-xs`,value:e.k,placeholder:`Header`,onChange:e=>a(t,{k:e.target.value})}),(0,H.jsx)(Ag,{className:`font-mono text-xs`,value:e.v,placeholder:`value`,onChange:e=>a(t,{v:e.target.value})}),(0,H.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>o(t),children:(0,H.jsx)(di,{})})]},t)),(0,H.jsxs)(J,{variant:`ghost`,size:`sm`,className:`justify-self-start text-[var(--muted-foreground)]`,onClick:()=>i([...n,{k:``,v:``}]),children:[(0,H.jsx)(Ir,{}),` Add header`]})]})}function fC({className:e,...t}){return(0,H.jsx)(`div`,{className:X(`glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]`,e),...t})}function pC({className:e,...t}){return(0,H.jsx)(`div`,{className:X(`flex items-center justify-between gap-3 px-5 py-4 border-b border-[var(--border)]`,e),...t})}function mC({className:e,...t}){return(0,H.jsx)(`h3`,{className:X(`text-sm font-semibold tracking-tight`,e),...t})}function hC({className:e,...t}){return(0,H.jsx)(`div`,{className:X(`p-5`,e),...t})}var gC=/^[a-z0-9][a-z0-9-]{0,63}$/,_C=[{id:`identity`,label:`Identity`,blurb:`Name, description, and system instructions.`},{id:`model`,label:`Model & Budget`,blurb:`Runtime, model, reasoning effort, and execution limits.`},{id:`environment`,label:`Environment`,blurb:`Sandbox and per-runtime approval behavior.`},{id:`tools`,label:`Tools & MCP`,blurb:`Allowed/disallowed tools and MCP servers.`},{id:`skills`,label:`Skills`,blurb:`Which skills this agent can use.`},{id:`review`,label:`Review`,blurb:`Confirm and save.`}];function vC({initial:e,onClose:t,onSaved:n}){let r=e.id===``,[i,a]=(0,u.useState)(e.id),[o,s]=(0,u.useState)(e.spec),[c,l]=(0,u.useState)(`identity`),[d,f]=(0,u.useState)(`form`),[p,m]=(0,u.useState)(()=>JSON.stringify(e.spec,null,2)),[h,g]=(0,u.useState)(!1);function _(e){if(e!==d){if(e===`json`)m(JSON.stringify(o,null,2)),f(`json`);else try{s(JSON.parse(p)),f(`form`)}catch(e){V.error(`Invalid JSON: ${e.message}`)}}}async function v(){let t=i.trim();if(r&&!gC.test(t))return l(`identity`),V.error(t?`Invalid agent id — use lowercase letters, digits, or hyphens`:`Agent id is required`);let a;if(d===`json`)try{a=JSON.parse(p)}catch(e){return V.error(`Invalid JSON: ${e.message}`)}else a=o;g(!0);try{r?await Y.createAgent({...rC(a),id:i.trim()}):await Y.updateAgent(e.id,rC(a)),V.success(`Agent "${i}" saved`),await n()}catch(e){V.error(`Save failed: ${e.message}`)}finally{g(!1)}}return(0,H.jsxs)(`div`,{className:`grid gap-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex w-fit items-center gap-1 text-xs text-[var(--muted-foreground)] hover:text-[var(--foreground)]`,children:[(0,H.jsx)(An,{className:`size-3.5`}),` Agents`]}),(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:r?`New agent`:`Edit "${e.id}"`})]}),(0,H.jsx)(`div`,{className:`inline-flex rounded-md border border-[var(--border)] p-0.5`,children:[`form`,`json`].map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>_(e),className:X(`rounded-sm px-3 py-1 text-sm capitalize transition-colors`,d===e?`bg-[var(--primary)] text-[var(--primary-foreground)]`:`text-[var(--muted-foreground)] hover:text-[var(--foreground)]`),children:e},e))})]}),d===`json`?(0,H.jsx)(jg,{value:p,onChange:e=>m(e.target.value),className:`min-h-[28rem] font-mono text-xs`}):(0,H.jsxs)(`div`,{className:`grid grid-cols-[12rem_1fr] gap-6`,children:[(0,H.jsx)(`nav`,{className:`sticky top-6 grid h-fit gap-0.5`,children:_C.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(e.id),className:X(`rounded-md px-3 py-2 text-left text-sm transition-colors`,c===e.id?`bg-[var(--muted)] font-medium text-[var(--foreground)]`:`text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50`),children:e.label},e.id))}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:yC(c).label}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:yC(c).blurb})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] p-5`,children:[c===`identity`&&(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsxs)(GS,{children:[`Agent ID `,(0,H.jsx)(`span`,{className:`text-[var(--destructive)]`,children:`*`})]}),(0,H.jsx)(Ag,{value:i,disabled:!r,onChange:e=>a(e.target.value),placeholder:`polly`,"aria-invalid":r&&i.trim()!==``&&!gC.test(i.trim())}),r&&i.trim()!==``&&!gC.test(i.trim())?(0,H.jsx)(`p`,{className:`text-xs text-[var(--destructive)]`,children:`Use 1–64 lowercase letters, digits, or hyphens, starting with a letter or digit.`}):(0,H.jsxs)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:[`The config directory name. References (`,(0,H.jsx)(`code`,{children:`/agent <id>`}),`, bindings) use it; it can't change after creation.`]})]}),(0,H.jsx)(QS,{value:o,onChange:s})]}),c===`model`&&(0,H.jsx)($S,{value:o,onChange:s}),c===`environment`&&(0,H.jsx)(eC,{value:o,onChange:s}),c===`tools`&&(0,H.jsx)(tC,{value:o,onChange:s}),c===`skills`&&(0,H.jsx)(nC,{value:o,onChange:s}),c===`review`&&(0,H.jsx)(bC,{id:i,spec:o})]})]})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-[var(--border)] pt-4`,children:[(0,H.jsx)(J,{variant:`outline`,onClick:t,children:`Cancel`}),(0,H.jsx)(J,{onClick:v,disabled:h,children:h?`Saving…`:`Save`})]})]})}function yC(e){return _C.find(t=>t.id===e)??_C[0]}function bC({id:e,spec:t}){let n=rC(t),r=[[`Agent ID`,e||`—`],[`Display name`,t.name?.trim()||`—`],[`Runtime`,t.executor?.runtime??`default`],[`Model`,t.executor?.model?.trim()||`runtime default`],[`Skills`,xC(t.skills)],[`MCP servers`,String(t.tools?.mcp?.filter(e=>e.url?.trim()).length??0)]];return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsx)(`dl`,{className:`grid grid-cols-[10rem_1fr] gap-x-4 gap-y-2 text-sm`,children:r.map(([e,t])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{className:`text-[var(--muted-foreground)]`,children:e}),(0,H.jsx)(`dd`,{className:`font-medium`,children:t})]},e))}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{children:`Resulting spec`}),(0,H.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs`,children:JSON.stringify({id:e||void 0,...n},null,2)})]})]})}function xC(e){return e?.length?`${e.length} declared`:`None`}var SC=/^[a-z0-9][a-z0-9-]{0,63}$/;function CC({agents:e,onChange:t}){let[n,r]=(0,u.useState)(e[0]?.id??``),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1),[p,m]=(0,u.useState)([]),[h,g]=(0,u.useState)([]),[_,v]=(0,u.useState)(!1);(0,u.useEffect)(()=>{n&&e.some(e=>e.id===n)||r(e[0]?.id??``)},[e,n]),(0,u.useEffect)(()=>{if(!n){a(null);return}let e=!1;return s(!0),Y.getAgent(n).then(t=>{e||a(t)}).catch(t=>!e&&V.error(`Load agent failed: ${t.message}`)).finally(()=>!e&&s(!1)),()=>{e=!0}},[n]);async function y(e=!1){v(!0);try{let[t,n]=await Promise.all([Y.listAgentRuntimeOptions(e),Y.listSkills()]);m(t),g(n)}catch(e){V.error(`Load local options failed: ${e.message}`)}finally{v(!1)}}async function b(e){try{let t=await Y.getAgent(e);delete t.id,l({id:e,spec:t})}catch(e){V.error(`Load failed: ${e.message}`)}}if(c)return(0,H.jsx)(vC,{initial:c,onClose:()=>l(null),onSaved:async()=>{let e=c.id;l(null),await t(),r(e),a(await Y.getAgent(e))}});let x=new Set(e.map(e=>e.runtime).filter(Boolean)),S=e.reduce((e,t)=>e+(t.skillCount??0),0);return(0,H.jsxs)(`div`,{className:`grid gap-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Agents`}),(0,H.jsxs)(`p`,{className:`mt-1 text-sm text-[var(--muted-foreground)]`,children:[`Local Agent profiles discovered from `,(0,H.jsx)(`code`,{children:`~/.rynx/agents`}),`.`]})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(J,{variant:`outline`,onClick:()=>void t(),children:[(0,H.jsx)(zr,{}),` Refresh`]}),(0,H.jsxs)(J,{onClick:()=>{f(!0),y()},children:[(0,H.jsx)(Ir,{}),` New agent`]})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(DC,{label:`agents`,value:e.length,detail:`Local registered profiles`}),(0,H.jsx)(DC,{label:`runtimes`,value:x.size,detail:`Runtimes currently used`}),(0,H.jsx)(DC,{label:`skill bindings`,value:S,detail:`Explicit Skill references`})]}),(0,H.jsxs)(`div`,{className:`grid min-h-[620px] gap-4 lg:grid-cols-[320px_minmax(0,1fr)]`,children:[(0,H.jsxs)(fC,{className:`overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[var(--border)] px-4 py-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Agent list`}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--muted-foreground)]`,children:e.length})]}),(0,H.jsxs)(`div`,{className:`grid gap-2 p-2`,children:[e.length===0&&(0,H.jsx)(`div`,{className:`rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-sm text-[var(--muted-foreground)]`,children:`No local Agents registered yet.`}),e.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:X(`flex w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors`,n===e.id?`border-[var(--primary)] bg-[var(--primary)]/10`:`border-[var(--border)] hover:bg-[var(--muted)]/45`),children:[(0,H.jsx)(`span`,{className:`mt-0.5 grid size-9 shrink-0 place-items-center rounded-md bg-violet-500/10 text-violet-600`,children:(0,H.jsx)(Mn,{className:`size-4`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name??e.id}),n===e.id&&(0,H.jsx)(Ln,{className:`size-4 shrink-0 text-[var(--primary)]`})]}),e.description&&(0,H.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-[var(--muted-foreground)]`,children:e.description}),(0,H.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-1.5 text-[10px] text-[var(--muted-foreground)]`,children:[(0,H.jsx)(`span`,{className:`rounded bg-[var(--muted)] px-1.5 py-1`,children:e.runtime??`default runtime`}),(0,H.jsxs)(`span`,{className:`rounded bg-[var(--muted)] px-1.5 py-1`,children:[e.skillCount??0,` skills`]})]})]})]},e.id))]})]}),(0,H.jsx)(wC,{id:n,detail:i,loading:o,onEdit:()=>void b(n),onDeleted:t})]}),(0,H.jsx)(TC,{open:d,onOpenChange:f,runtimes:p,skills:h,loading:_,onRefresh:()=>y(!0),onCreated:async e=>{f(!1),await t(),r(e)}})]})}function wC({id:e,detail:t,loading:n,onEdit:r,onDeleted:i}){if(!e)return(0,H.jsx)(fC,{className:`p-6 text-sm text-[var(--muted-foreground)]`,children:`Select an Agent to inspect its configuration.`});if(n||!t)return(0,H.jsx)(fC,{className:`p-6 text-sm text-[var(--muted-foreground)]`,children:`Loading Agent configuration…`});let a=t.skills??[];return(0,H.jsxs)(fC,{className:`overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-[var(--border)] px-5 py-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:t.name??e}),(0,H.jsx)(`code`,{className:`text-[10px] text-[var(--muted-foreground)]`,children:e})]}),t.description&&(0,H.jsx)(`p`,{className:`mt-1 text-sm text-[var(--muted-foreground)]`,children:t.description})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(J,{variant:`outline`,size:`sm`,onClick:r,children:[(0,H.jsx)(Pr,{}),` Edit configuration`]}),(0,H.jsx)(EC,{id:e,onChange:i})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-6 p-5`,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(OC,{label:`Runtime`,value:t.executor?.runtime??`default`}),(0,H.jsx)(OC,{label:`Model`,value:t.executor?.model??`runtime default`}),(0,H.jsx)(OC,{label:`Reasoning`,value:t.executor?.reasoningEffort??`runtime default`})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`div`,{className:`label-caps text-[10px] text-[var(--muted-foreground)]`,children:`instructions`}),(0,H.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4 text-sm leading-6`,children:t.instructions||`No inline instructions.`})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`div`,{className:`label-caps text-[10px] text-[var(--muted-foreground)]`,children:`skills`}),(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:a.length===0?(0,H.jsx)(`span`,{className:`text-sm text-[var(--muted-foreground)]`,children:`No Skills bound.`}):a.map(e=>(0,H.jsx)(`span`,{className:`rounded-md bg-[var(--muted)] px-2 py-1 font-mono text-xs`,children:e.name},e.name))})]})]})]})}function TC({open:e,onOpenChange:t,runtimes:n,skills:r,loading:i,onRefresh:a,onCreated:o}){let[s,c]=(0,u.useState)(``),[l,d]=(0,u.useState)(``),[f,p]=(0,u.useState)(!1),[m,h]=(0,u.useState)(``),[g,_]=(0,u.useState)(`You are a helpful agent.`),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(new Set),[E,D]=(0,u.useState)(!1),O=n.filter(e=>e.available),k=n.find(e=>e.id===v),A=k?.models.find(e=>e.id===b);(0,u.useEffect)(()=>{if(!e||v)return;let t=O[0];if(!t)return;let n=t.models.find(e=>e.isDefault)??t.models[0];y(t.id),x(n?.id??``),C(n?.defaultReasoningEffort??``)},[O,e,v,n]);function j(){c(``),d(``),p(!1),h(``),_(`You are a helpful agent.`),y(``),x(``),C(``),T(new Set)}function M(e){let t=n.find(t=>t.id===e),r=t?.models.find(e=>e.isDefault)??t?.models[0];y(e),x(r?.id??``),C(r?.defaultReasoningEffort??``)}async function N(){let e=l.trim();if(!SC.test(e)||!s.trim()||!g.trim()||!v)return;let t=r.filter(e=>w.has(e.name)&&e.ref).map(e=>({...e.ref}));D(!0);try{await Y.createAgent({id:e,name:s.trim(),...m.trim()?{description:m.trim()}:{},instructions:g.trim(),executor:{runtime:v,...b?{model:b}:{},...S?{reasoningEffort:S}:{},timeout:1800,retry:{maxRetries:2}},osEnv:{sandbox:`danger-full-access`,approvalPolicy:`never`},...t.length?{skills:t}:{}}),V.success(`Agent "${s.trim()}" created`),j(),await o(e)}catch(e){V.error(`Create Agent failed: ${e.message}`)}finally{D(!1)}}let P=!!(SC.test(l.trim())&&s.trim()&&g.trim()&&v);return(0,H.jsx)(Su,{open:e,onOpenChange:e=>{t(e),e||j()},children:(0,H.jsxs)(Du,{className:`max-h-[85vh] overflow-y-auto sm:max-w-2xl`,children:[(0,H.jsx)(Ou,{children:(0,H.jsx)(Au,{children:`Create local Agent`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(kC,{label:`Name`,children:(0,H.jsx)(Ag,{value:s,autoFocus:!0,onChange:e=>{let t=e.target.value;c(t),f||d(AC(t))}})}),(0,H.jsx)(kC,{label:`Agent ID`,children:(0,H.jsx)(Ag,{value:l,onChange:e=>{p(!0),d(e.target.value)},"aria-invalid":!!l&&!SC.test(l)})})]}),(0,H.jsx)(kC,{label:`Description`,children:(0,H.jsx)(Ag,{value:m,onChange:e=>h(e.target.value)})}),(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(kC,{label:`Runtime`,children:(0,H.jsxs)(my,{value:v,onValueChange:M,disabled:i||n.length===0,children:[(0,H.jsx)(_y,{children:(0,H.jsx)(gy,{placeholder:`No runtime found`})}),(0,H.jsx)(by,{children:n.map(e=>(0,H.jsxs)(Sy,{value:e.id,disabled:!e.available,children:[e.name,e.available?``:` · missing`]},e.id))})]})}),(0,H.jsx)(kC,{label:`Model`,children:(0,H.jsxs)(my,{value:b,onValueChange:e=>{x(e),C(k?.models.find(t=>t.id===e)?.defaultReasoningEffort??``)},disabled:!k||k.models.length===0,children:[(0,H.jsx)(_y,{children:(0,H.jsx)(gy,{placeholder:`Runtime default`})}),(0,H.jsx)(by,{children:k?.models.map(e=>(0,H.jsxs)(Sy,{value:e.id,children:[e.label,e.isDefault?` · default`:``]},e.id))})]})}),(0,H.jsx)(kC,{label:`Reasoning`,children:(0,H.jsxs)(my,{value:S||`__default__`,onValueChange:e=>C(e===`__default__`?``:e),children:[(0,H.jsx)(_y,{children:(0,H.jsx)(gy,{})}),(0,H.jsxs)(by,{children:[(0,H.jsx)(Sy,{value:`__default__`,children:`Runtime default`}),A?.reasoningOptions.map(e=>(0,H.jsx)(Sy,{value:e.value,children:e.label},e.value))]})]})})]}),O.length===0&&!i&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-dashed border-[var(--border)] px-3 py-2 text-xs text-[var(--muted-foreground)]`,children:[`No local coding runtime was discovered.`,(0,H.jsxs)(J,{size:`sm`,variant:`outline`,onClick:()=>void a(),children:[(0,H.jsx)(zr,{}),` Scan`]})]}),(0,H.jsx)(kC,{label:`Instructions`,children:(0,H.jsx)(jg,{className:`min-h-32`,value:g,onChange:e=>_(e.target.value)})}),(0,H.jsxs)(`fieldset`,{className:`rounded-lg border border-[var(--border)] p-3`,children:[(0,H.jsx)(`legend`,{className:`label-caps px-1 text-[10px] text-[var(--muted-foreground)]`,children:`skills · optional`}),(0,H.jsxs)(`div`,{className:`grid max-h-40 gap-1 overflow-y-auto`,children:[r.filter(e=>e.ref).length===0&&(0,H.jsx)(`div`,{className:`py-2 text-xs text-[var(--muted-foreground)]`,children:`No selectable local Skills.`}),r.filter(e=>e.ref).map(e=>(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md px-2 py-2 hover:bg-[var(--muted)]/50`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4`,checked:w.has(e.name),onChange:()=>T(t=>{let n=new Set(t);return n.has(e.name)?n.delete(e.name):n.add(e.name),n})}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`block font-mono text-sm`,children:e.name}),(0,H.jsx)(`span`,{className:`line-clamp-1 text-xs text-[var(--muted-foreground)]`,children:e.description})]})]},e.name))]})]})]}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,H.jsx)(J,{disabled:!P||E,onClick:()=>void N(),children:E?`Creating…`:`Create`})]})]})})}function EC({id:e,onChange:t}){return(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsx)(J,{variant:`ghost`,size:`sm`,className:`text-[var(--destructive)]`,children:(0,H.jsx)(si,{})})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsxs)(vu,{children:[`Delete Agent "`,e,`"?`]}),(0,H.jsx)(yu,{children:`Removes its local config directory. Existing Session snapshots are unaffected.`})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:async()=>{try{await Y.deleteAgent(e),V.success(`Agent "${e}" deleted`),await t()}catch(e){V.error(`Delete failed: ${e.message}`)}},children:`Delete`})]})]})]})}function DC({label:e,value:t,detail:n}){return(0,H.jsxs)(fC,{className:`p-4`,children:[(0,H.jsx)(`div`,{className:`label-caps text-[10px] text-[var(--muted-foreground)]`,children:e}),(0,H.jsx)(`div`,{className:`mt-2 text-2xl font-semibold`,children:t}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:n})]})}function OC({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] bg-[var(--muted)]/20 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`label-caps text-[10px] text-[var(--muted-foreground)]`,children:e}),(0,H.jsx)(`div`,{className:`mt-1 truncate text-sm`,children:t})]})}function kC({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{children:e}),t]})}function AC(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,64)}var jC=cu(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium`,{variants:{variant:{default:`border-transparent bg-[var(--secondary)] text-[var(--secondary-foreground)]`,success:`border-transparent bg-[var(--success)]/15 text-[var(--success)]`,warning:`border-transparent bg-[var(--warning)]/15 text-[var(--warning)]`,destructive:`border-transparent bg-[var(--destructive)]/15 text-[var(--destructive)]`,outline:`text-[var(--muted-foreground)]`}},defaultVariants:{variant:`default`}});function MC({className:e,variant:t,...n}){return(0,H.jsx)(`span`,{className:X(jC({variant:t}),e),...n})}async function NC(e,t){if(typeof navigator<`u`&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),`clipboard`}catch{}if(!t||typeof document>`u`)return`unavailable`;t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length);try{if(typeof document.execCommand==`function`&&document.execCommand(`copy`))return`selection`}catch{}return`selected`}var PC=`127.0.0.1:9333`;function FC({embedded:e=!1}={}){let t=wS(),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(null),[s,c]=(0,u.useState)(`load`),l=(0,u.useCallback)(async()=>{if(!t){c(null),o(`Chrome inspection is available only in the Rynx app.`);return}c(`load`),o(null);try{i(await t.getChromeInspectionStatus())}catch(e){o(e.message)}finally{c(null)}},[t]);(0,u.useEffect)(()=>{l()},[l]);async function d(e){if(t){c(`save`),o(null);try{i(await t.configureChromeInspection(e))}catch(e){let t=e.message;o(t),V.error(`Could not update Chrome inspection: ${t}`)}finally{c(null)}}}async function f(){let e=await NC(PC,n.current);e===`clipboard`||e===`selection`?V.success(`Address copied`):e===`selected`?V.info(`Address selected — copy it manually`):V.error(`Copy is unavailable`)}let p=r?.settings,m=s!==null;return(0,H.jsxs)(`div`,{id:e?`chrome-inspection`:void 0,className:e?`grid scroll-mt-6 gap-5`:`grid max-w-3xl gap-5`,children:[!e&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Chrome inspection`}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`Inspect Rynx-managed browser pages with Chrome DevTools.`})]}),(0,H.jsxs)(fC,{"aria-busy":s!==null,children:[(0,H.jsxs)(pC,{children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(mC,{children:`DevTools discovery`}),r&&(0,H.jsx)(IC,{status:r})]}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Chrome connects to one local address and discovers the browsers you choose.`})]}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:m,onClick:()=>void l(),children:[(0,H.jsx)(zr,{className:s===`load`?`animate-spin`:``}),`Check`]})]}),(0,H.jsxs)(hC,{className:`grid gap-5`,children:[r&&p?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(LC,{title:`Enable Chrome inspection`,description:`Make the selected browser pages available to Chrome DevTools.`,children:(0,H.jsx)(Ub,{"aria-label":`Enable Chrome inspection`,checked:p.enabled,disabled:m,onCheckedChange:e=>void d({...p,enabled:e})})}),(0,H.jsx)(`div`,{className:`h-px bg-[var(--border)]`}),(0,H.jsxs)(`div`,{className:`grid gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:`Browsers to include`}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-[var(--muted-foreground)]`,children:`Only selected browser pages appear in Chrome.`})]}),(0,H.jsx)(RC,{title:`This device`,detail:`Browser pages managed by Rynx on this device`,checked:p.includeLocal,disabled:m||!p.enabled,onChange:e=>void d({...p,includeLocal:e})}),r.remotes.map(e=>(0,H.jsx)(RC,{title:e.displayName,detail:BC(e.status),badge:e.status,checked:p.remoteDaemonIds.includes(e.daemonId),disabled:m||!p.enabled||e.status===`incompatible`,onChange:t=>void d({...p,remoteDaemonIds:t?[...p.remoteDaemonIds,e.daemonId]:p.remoteDaemonIds.filter(t=>t!==e.daemonId)})},e.daemonId))]}),(0,H.jsx)(`div`,{className:`h-px bg-[var(--border)]`}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:`Connect Chrome once`}),(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs leading-5 text-[var(--muted-foreground)]`,children:[`Open `,(0,H.jsx)(`span`,{className:`font-mono`,children:`chrome://inspect`}),`, choose`,` `,(0,H.jsx)(`strong`,{children:`Configure…`}),`, then add this address.`]})]}),(0,H.jsxs)(`div`,{className:`flex max-w-sm gap-2`,children:[(0,H.jsx)(Ag,{ref:n,value:PC,readOnly:!0,"aria-label":`Chrome inspection address`,className:`font-mono`}),(0,H.jsxs)(J,{variant:`outline`,onClick:()=>void f(),"aria-label":`Copy Chrome inspection address`,children:[(0,H.jsx)(Jn,{}),`Copy`]})]})]}),r.runtime.state===`error`&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] p-3 text-xs text-[var(--warning)]`,children:[(0,H.jsx)(ci,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`font-medium`,children:`Chrome inspection could not start`}),(0,H.jsx)(`div`,{className:`mt-0.5 text-[var(--foreground)]`,children:r.runtime.error})]})]}),(0,H.jsxs)(`div`,{role:`note`,className:`flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_30%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_6%,var(--background))] p-3 text-xs leading-5`,children:[(0,H.jsx)(ci,{className:`mt-0.5 size-4 shrink-0 text-[var(--destructive)]`}),(0,H.jsx)(`span`,{children:`Any process on this device can use this address to fully control every browser exposed here. Enable it only while you need DevTools.`})]})]}):(0,H.jsxs)(`div`,{className:`flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[s===`load`&&(0,H.jsx)(B,{className:`size-4 animate-spin`}),s===`load`?`Loading Chrome inspection…`:`Chrome inspection settings are unavailable.`]}),a&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]`,children:[(0,H.jsx)(ci,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsx)(`span`,{children:a})]})]})]})]})}function IC({status:e}){return e.runtime.state===`listening`?(0,H.jsxs)(MC,{variant:`success`,children:[(0,H.jsx)(Pn,{className:`size-3`}),`Listening`]}):e.runtime.state===`error`?(0,H.jsx)(MC,{variant:`warning`,children:`Needs attention`}):(0,H.jsx)(MC,{variant:`outline`,children:`Off`})}function LC({title:e,description:t,children:n}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:e}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-[var(--muted-foreground)]`,children:t})]}),n]})}function RC({title:e,detail:t,badge:n,checked:r,disabled:i,onChange:a}){return(0,H.jsxs)(`label`,{className:X(`flex items-center gap-3 rounded-lg border border-[var(--border)] px-3 py-2.5`,i&&`opacity-55`),children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:r,disabled:i,onChange:e=>a(e.target.checked),className:`size-4 accent-[var(--primary)]`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-sm font-medium`,children:[e,n&&(0,H.jsx)(MC,{variant:n===`ready`?`success`:n===`offline`?`warning`:`outline`,children:zC(n)})]}),(0,H.jsx)(`span`,{className:`block text-xs text-[var(--muted-foreground)]`,children:t})]})]})}function zC(e){return e===`ready`?`Ready`:e===`offline`?`Offline`:`Incompatible`}function BC(e){return e===`ready`?`Available now`:e===`offline`?`Currently unavailable`:`Update this Runtime before selecting it`}function VC({embedded:e=!1}={}){let t=wS(),[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(`refresh`),c=(0,u.useCallback)(async()=>{if(t){s(`refresh`),a(null);try{r(await t.getStatus())}catch(e){a(e.message)}finally{s(null)}}},[t]);(0,u.useEffect)(()=>{c()},[c]);async function l(e){if(t){s(`permission`),a(null);try{await t.openSystemSettings(e),V.message(`After granting access, return to Rynx and click Check again.`)}catch(e){let t=e.message;a(t),V.error(`Could not open System Settings: ${t}`)}finally{s(null)}}}return(0,H.jsxs)(`div`,{id:e?`permissions`:void 0,className:e?`grid scroll-mt-6 gap-5`:`grid max-w-3xl gap-5`,children:[!e&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Computer integration`}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`Review the macOS permissions for the separate Computer Use integration. Browser and Emulator automation stay in the bundled rynx-cli Skill.`})]}),(0,H.jsxs)(fC,{"aria-busy":o!==null,children:[(0,H.jsxs)(pC,{children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(mC,{children:`macOS permissions`}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`This page checks readiness only. Permissions remain under your control in System Settings.`})]}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o!==null,onClick:()=>void c(),children:[(0,H.jsx)(zr,{className:o===`refresh`?`animate-spin`:``}),`Check`]})]}),(0,H.jsxs)(hC,{className:`grid gap-3`,children:[n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(HC,{icon:(0,H.jsx)(Vr,{className:`size-4`}),ready:n.permissions.accessibility===`granted`,title:`Accessibility`,description:UC(n.permissions.accessibility,`Granted and ready for a Computer Use provider.`),action:n.permissions.accessibility===`granted`?void 0:(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o!==null,onClick:()=>void l(`accessibility`),children:[(0,H.jsx)(er,{}),`Open Settings`]})}),(0,H.jsx)(HC,{icon:(0,H.jsx)(Sr,{className:`size-4`}),ready:n.permissions.screenRecording===`granted`,title:`Screen Recording`,description:UC(n.permissions.screenRecording,`Granted and ready for a Computer Use provider.`),action:n.permissions.screenRecording===`granted`?void 0:(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o!==null,onClick:()=>void l(`screen-recording`),children:[(0,H.jsx)(er,{}),`Open Settings`]})})]}):(0,H.jsxs)(`div`,{className:`flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[o===`refresh`&&(0,H.jsx)(B,{className:`size-4 animate-spin`}),o===`refresh`?`Checking integrations…`:`Integration status is unavailable.`]}),i&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]`,children:[(0,H.jsx)(zn,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsx)(`span`,{children:i})]})]})]})]})}function HC({icon:e,ready:t,title:n,description:r,action:i}){return(0,H.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center`,children:[(0,H.jsx)(`span`,{className:t?`grid size-9 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]`:`grid size-9 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]`,children:t?(0,H.jsx)(Pn,{className:`size-4`}):e}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:n}),(0,H.jsx)(MC,{variant:t?`success`:`warning`,children:t?`Ready`:`Needs access`})]}),(0,H.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-[var(--muted-foreground)]`,children:r})]}),i&&(0,H.jsx)(`div`,{className:`sm:justify-self-end`,children:i})]})}function UC(e,t){switch(e){case`granted`:return t;case`not-granted`:return`Not granted. Open System Settings to allow access.`;case`unknown`:return`Rynx could not determine this permission. Open System Settings to verify it.`}}function WC(){return(0,H.jsxs)(`div`,{className:`grid max-w-3xl gap-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Computer Use`}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`Configure macOS permissions and Chrome DevTools access for computer automation.`})]}),(0,H.jsx)(VC,{embedded:!0}),(0,H.jsx)(FC,{embedded:!0})]})}var GC=700,KC=250,qC=33333,JC=new Uint8Array([0,0,0,1]);function YC(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function XC(e,t){for(let n=t;n<=e.length-3;n+=1)if(e[n]===0&&e[n+1]===0){if(e[n+2]===1)return{index:n,length:3};if(n<=e.length-4&&e[n+2]===0&&e[n+3]===1)return{index:n,length:4}}return null}function ZC(e,t){let n=YC(e,t),r=XC(n,0);if(!r)return{nals:[],pending:n.slice(Math.max(0,n.length-4))};let i=[],a=r.index,o=r.index+r.length,s=XC(n,o);for(;s;)s.index>o&&i.push(n.slice(o,s.index)),a=s.index,o=s.index+s.length,s=XC(n,o);return{nals:i,pending:n.slice(a)}}function QC(e){return e[0]&31}function $C(e){if(QC(e)!==7||e.length<4)return null;let t=e=>e.toString(16).padStart(2,`0`).toUpperCase();return`avc1.${t(e[1])}${t(e[2])}${t(e[3])}`}function ew(e){let t=e.reduce((e,t)=>e+JC.length+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(JC,r),r+=JC.length,n.set(t,r),r+=t.length;return n}function tw(e){let t=QC(e);return t===1||t===5}function nw(e){return e.some(e=>QC(e)===5)}function rw(e,t,n,r){(e.width!==n||e.height!==r)&&(e.width=n,e.height=r);let i=e.getContext(`2d`);i&&i.drawImage(t,0,0,n,r)}function iw(e,t){return new Promise((n,r)=>{if(t.aborted){r(t.reason);return}let i=window.setTimeout(n,e);t.addEventListener(`abort`,()=>{window.clearTimeout(i),r(t.reason)},{once:!0})})}function aw(e){return e instanceof Error?e.message:String(e)}function ow(e){return e instanceof DOMException&&e.name===`AbortError`}function sw({device:e,alt:t,mediaRef:n,onFrameSize:r}){let i=(0,u.useRef)(null),a=(0,u.useRef)(!1),o=(0,u.useRef)(!1),s=(0,u.useRef)(null),[c,l]=(0,u.useState)(`video`),[d,f]=(0,u.useState)(!1),[p,m]=(0,u.useState)(`Loading preview...`),h=(0,u.useCallback)(e=>{i.current=e,n?.(e)},[n]),g=(0,u.useCallback)(()=>{a.current||(a.current=!0,f(!0),m(``))},[]),_=(0,u.useCallback)((e,t)=>{let n=s.current;(n?.width!==e||n.height!==t)&&(s.current={width:e,height:t},r?.(e,t))},[r]);return(0,u.useEffect)(()=>{a.current=!1,o.current=!1,s.current=null,f(!1),m(`Loading preview...`),l(`video`)},[e]),(0,u.useEffect)(()=>{if(c!==`video`||a.current)return;let t=!1;return(async()=>{try{let n=await Y.emulatorFrameBlob(e);if(t||a.current)return;let r=await createImageBitmap(n);try{let e=i.current;e&&!a.current&&(rw(e,r,r.width,r.height),_(r.width,r.height),g())}finally{r.close()}}catch{}})(),()=>{t=!0}},[e,g,c,_]),(0,u.useEffect)(()=>{if(c!==`video`)return;if(!(`VideoDecoder`in window)||!(`EncodedVideoChunk`in window)){m(`Video decoder unavailable`),l(`fallback`);return}let t=new AbortController,n=e=>{let t=i.current;try{if(t){let n=e.displayWidth||e.codedWidth,r=e.displayHeight||e.codedHeight;rw(t,e,n,r),_(n,r),o.current=!0,g()}}finally{e.close()}};return(async()=>{for(;!t.signal.aborted;){let r=null,i=null,a=new Uint8Array,s=[],c=!1,u=0,d=`avc1.42E01F`,f=async()=>{if(r)return r;let e={codec:d,optimizeForLatency:!0,avc:{format:`annexb`}};if(!(await VideoDecoder.isConfigSupported(e)).supported)throw Error(`Unsupported Android video codec: ${d}`);return r=new VideoDecoder({output:n,error:e=>{m(e.message)}}),r.configure(e),r},p=async()=>{if(!c){s=[];return}let e=await f(),t=nw(s),n=ew(s),r=u;u+=qC,s=[],c=!1,!(e.decodeQueueSize>2&&!t)&&e.decode(new EncodedVideoChunk({type:t?`key`:`delta`,timestamp:r,duration:qC,data:n}))},h=async e=>{let t=$C(e);t&&(d=t),(QC(e)===9||tw(e))&&c&&await p(),s.push(e),tw(e)&&(c=!0)};try{let n=await fetch(Y.emulatorVideoStreamUrl(e),{cache:`no-store`,signal:t.signal});if(!n.ok||!n.body)throw Error(`Android video stream failed: ${n.status}`);for(i=n.body.getReader();;){let{done:e,value:t}=await i.read();if(e)break;let n=ZC(a,t);a=n.pending;for(let e of n.nals)await h(e)}let o=ZC(a,JC);for(let e of o.nals)await h(e);await p(),r?.state===`configured`&&await r.flush()}catch(e){if(t.signal.aborted||ow(e))break;if(m(aw(e)),!o.current){l(`fallback`);break}}finally{try{i?.releaseLock()}catch{}r?.state!==`closed`&&r?.close()}t.signal.aborted||await iw(KC,t.signal).catch(()=>{})}})(),()=>{t.abort()}},[e,g,c,_]),(0,u.useEffect)(()=>{if(c!==`fallback`)return;let t=!1,n,r=async()=>{try{let n=await Y.emulatorFrameBlob(e);if(t)return;let r=await createImageBitmap(n);try{let e=i.current;e&&(rw(e,r,r.width,r.height),_(r.width,r.height),g())}finally{r.close()}}catch(e){t||m(aw(e))}finally{t||(n=window.setTimeout(r,GC))}};return r(),()=>{t=!0,n&&window.clearTimeout(n)}},[e,g,c,_]),(0,H.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,H.jsx)(`canvas`,{ref:h,"aria-label":t,width:720,height:1520,className:`pointer-events-none h-full w-full select-none object-contain`}),!d&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 grid place-items-center px-5 text-center text-sm text-zinc-400`,children:p})]})}var cw=8,lw=.012,uw=1500,dw=35,fw=260,pw=40,mw=3,hw=5e3,gw=750;function _w(e){return[e.backend,e.isDefault?`default`:void 0,e.detail].filter(Boolean).join(` · `)}function vw(e,t,n){return Math.max(t,Math.min(n,e))}function yw(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function bw(e){let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;let n=`naturalWidth`in e?e.naturalWidth||t.width:e.width||t.width,r=`naturalHeight`in e?e.naturalHeight||t.height:e.height||t.height;if(n<=0||r<=0)return t;let i=n/r;if(t.width/t.height>i){let e=t.height*i;return new DOMRect(t.left+(t.width-e)/2,t.top,e,t.height)}let a=t.width/i;return new DOMRect(t.left,t.top+(t.height-a)/2,t.width,a)}function xw(e,t,n){if(!e)return null;let r=bw(e);if(!r)return null;let i=(t.clientX-r.left)/r.width,a=(t.clientY-r.top)/r.height;return!n&&(i<0||i>1||a<0||a>1)?null:{x:vw(i,0,1),y:vw(a,0,1)}}function Sw(e){return new Promise(t=>setTimeout(t,e))}function Cw(e){let t=new TextEncoder().encode(JSON.stringify(e)),n=new Uint8Array(1+t.length);return n[0]=mw,n.set(t,1),n.buffer}function ww(){let[e,t]=(0,u.useState)([]),[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(!0),[o,s]=(0,u.useState)(null),[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1),[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(0),x=(0,u.useRef)(null),S=(0,u.useRef)(null),C=(0,u.useRef)(null),w=(0,u.useRef)(null),T=(0,u.useRef)(null),E=(0,u.useRef)(null),D=(0,u.useCallback)(async()=>{a(!0);try{let[e,n]=await Promise.all([Y.emulatorDevices(),Y.activeEmulator()]);t(e),r(n)}catch(e){V.error(`Failed to load emulator: ${e.message}`)}finally{a(!1)}},[]);(0,u.useEffect)(()=>{D()},[D]),(0,u.useEffect)(()=>()=>{C.current!==null&&window.clearTimeout(C.current),S.current!==null&&window.clearTimeout(S.current)},[]),(0,u.useEffect)(()=>()=>{let e=w.current?.socket;w.current=null,e&&e.readyState!==WebSocket.CLOSED&&e.close()},[n?.wsUrl]),(0,u.useEffect)(()=>{if(n?.backend!==`android`){let e=T.current?.socket;T.current=null,e&&e.readyState!==WebSocket.CLOSED&&e.close();return}return R(n.deviceUdid).catch(()=>{}),()=>{let e=T.current?.socket;T.current=null,e&&e.readyState!==WebSocket.CLOSED&&e.close()}},[n?.backend,n?.deviceUdid]);let O=n?.streamUrl??null,k=O&&y>0?`${O}${O.includes(`?`)?`&`:`?`}rynx_preview_retry=${y}`:O,A=n?.backend===`android`&&!n.streamUrl,j=!!(O||A),M=h===null?void 0:{aspectRatio:h,width:`min(100%, calc(100cqh * ${h}))`},N=(0,u.useCallback)((e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return;let n=e/t;g(e=>e!==null&&Math.abs(e-n)<1e-4?e:n)},[]),P=(0,u.useCallback)(()=>{S.current!==null&&(window.clearTimeout(S.current),S.current=null)},[]),F=(0,u.useCallback)((e,t)=>{P(),N(e,t),v(!0)},[P,N]),I=(0,u.useCallback)(()=>{v(!1),S.current===null&&(S.current=window.setTimeout(()=>{S.current=null,b(e=>e+1)},gw))},[]);(0,u.useEffect)(()=>{if(P(),g(null),v(!1),b(0),!O)return;let e=()=>{let e=x.current;e instanceof HTMLImageElement&&e.naturalWidth>0&&e.naturalHeight>0&&F(e.naturalWidth,e.naturalHeight)};e();let t=window.setInterval(e,500);return()=>window.clearInterval(t)},[P,n?.attachedAt,n?.deviceUdid,F,O]),(0,u.useEffect)(()=>{if(!O||_)return;let e=window.setTimeout(I,hw);return()=>window.clearTimeout(e)},[y,_,O,I]);async function L(e){if(n){m(`home`);try{await Y.buttonEmulator(e,n.deviceUdid)}catch(t){V.error(`${e===`appswitch`?`App switcher`:`Home`} failed: ${t.message}`)}finally{m(null)}}}function ee(){if(!(!n||p)){if(C.current!==null){window.clearTimeout(C.current),C.current=null,L(`appswitch`);return}C.current=window.setTimeout(()=>{C.current=null,L(`home`)},fw)}}async function te(e,t){let i=n?.deviceUdid===e;C.current!==null&&(window.clearTimeout(C.current),C.current=null),l(e),i&&m(`shutdown`);try{await Y.shutdownEmulator(e),i&&r(null),V.success(`Shutdown ${t}`),D()}catch(e){V.error(`Shutdown failed: ${e.message}`)}finally{l(null),i&&m(null)}}async function ne(e){s(e.id);try{let t=await Y.attachEmulator(e.id);r(t),V.success(`Attached ${t.deviceName??t.deviceUdid}`),D()}catch(e){V.error(`Attach failed: ${e.message}`)}finally{s(null)}}function re(e){let t=w.current;if(t?.url===e){if(t.socket?.readyState===WebSocket.OPEN)return Promise.resolve(t.socket);if(t.connecting)return t.connecting}else t?.socket&&t.socket.readyState!==WebSocket.CLOSED&&t.socket.close();let n={url:e,socket:null,connecting:null},r=new Promise((t,r)=>{let i=new WebSocket(e),a=window.setTimeout(()=>{i.close(),r(Error(`Timed out connecting to emulator gesture stream.`))},1500),o=()=>window.clearTimeout(a);i.binaryType=`arraybuffer`,i.addEventListener(`open`,()=>{o(),n.socket=i,n.connecting=null,t(i)},{once:!0}),i.addEventListener(`error`,()=>{o(),n.connecting=null,r(Error(`Failed to connect to emulator gesture stream.`))},{once:!0}),i.addEventListener(`close`,()=>{w.current?.socket===i&&(w.current=null)})});return n.connecting=r,w.current=n,r}function R(e){let t=T.current;if(t?.device===e){if(t.socket?.readyState===WebSocket.OPEN)return Promise.resolve(t.socket);if(t.connecting)return t.connecting}else t?.socket&&t.socket.readyState!==WebSocket.CLOSED&&t.socket.close();let n={device:e,socket:null,connecting:null},r=new Promise((t,r)=>{let i=new WebSocket(Jx(e)),a=!1,o=window.setTimeout(()=>{a||(a=!0,i.close(),r(Error(`Timed out connecting to Android touch stream.`)))},uw),s=()=>window.clearTimeout(o);i.addEventListener(`message`,e=>{if(!a&&typeof e.data==`string`)try{let o=JSON.parse(e.data);o.t===`opened`?(a=!0,s(),n.socket=i,n.connecting=null,t(i)):o.t===`error`&&(a=!0,s(),n.connecting=null,r(Error(o.message??`Android touch stream failed.`)))}catch{}}),i.addEventListener(`error`,()=>{a||(a=!0,s(),n.connecting=null,r(Error(`Failed to connect to Android touch stream.`)))},{once:!0}),i.addEventListener(`close`,()=>{s(),n.connecting=null,a||(a=!0,r(Error(`Android touch stream closed before it was ready.`))),T.current?.socket===i&&(T.current=null)})});return n.connecting=r,T.current=n,r}async function ie(e,t){if(e.backend===`android`){if(e.liveFailed)return!1;try{return(await R(e.device)).send(JSON.stringify(t)),e.sentLiveFrames+=1,!0}catch(t){return e.liveFailed=!0,e.sentLiveFrames>0&&V.error(`Android touch stream failed: ${t.message}`),!1}}if(!e.wsUrl||e.liveFailed)return!1;try{return(await re(e.wsUrl)).send(Cw(t)),e.sentLiveFrames+=1,!0}catch(t){return e.liveFailed=!0,e.sentLiveFrames>0&&V.error(`Gesture stream failed: ${t.message}`),!1}}function ae(e,t){Y.gestureEmulator([{type:`begin`,x:e.x,y:e.y}],t).catch(e=>{V.error(`Tap failed: ${e.message}`)})}function oe(e,t){Y.gestureEmulator(e,t).catch(e=>{V.error(`Gesture failed: ${e.message}`)})}function se(e){if(!n||!j||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0)return;let t=xw(x.current,e,!1);t&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),E.current={backend:n.backend,pointerId:e.pointerId,device:n.deviceUdid,wsUrl:n.backend===`ios`?n.wsUrl:void 0,startClientX:e.clientX,startClientY:e.clientY,lastPoint:t,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:`begin`,x:t.x,y:t.y}]},ie(E.current,{type:`begin`,x:t.x,y:t.y}),f(!0))}function ce(e){let t=E.current;if(!t||t.pointerId!==e.pointerId)return;let n=xw(x.current,e,!0);if(!n)return;e.preventDefault();let r=Math.hypot(e.clientX-t.startClientX,e.clientY-t.startClientY)>cw,i=yw(n,t.lastPoint)>lw;if(t.lastPoint=n,r&&(i||!t.moved)){t.moved=!0;let e={type:`move`,x:n.x,y:n.y};t.points.push(e),ie(t,e)}}async function le(e){let t=E.current;if(!t||t.pointerId!==e.pointerId)return;e.preventDefault();let n=xw(x.current,e,!0)??t.lastPoint,r=Math.hypot(e.clientX-t.startClientX,e.clientY-t.startClientY)>cw;E.current=null,f(!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}let i={type:`end`,x:n.x,y:n.y};if((t.backend===`android`||t.wsUrl)&&!t.liveFailed&&(!t.moved&&!r&&await Sw(t.backend===`android`?dw:pw),await ie(t,i)||t.sentLiveFrames>0))return;if(!t.moved&&!r){ae(n,t.device);return}let a=[...t.points],o=a[a.length-1];o&&yw(o,n)<=.001?a[a.length-1]=i:a.push(i),oe(a,t.device)}function ue(e){let t=E.current;!t||t.pointerId!==e.pointerId||(E.current=null,f(!1),(t.backend===`android`||t.wsUrl)&&!t.liveFailed&&ie(t,{type:`end`,x:t.lastPoint.x,y:t.lastPoint.y}))}return(0,H.jsxs)(`div`,{className:`grid h-full min-h-0 gap-3 p-3 sm:p-4 lg:grid-cols-[minmax(0,360px)_minmax(360px,1fr)]`,children:[(0,H.jsxs)(fC,{className:`flex h-full min-h-0 flex-col overflow-hidden p-0`,children:[(0,H.jsxs)(pC,{className:`px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(mC,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Cr,{className:`size-4`}),`Preview`]}),(0,H.jsx)(`div`,{className:`label-caps mt-1 truncate text-[10px] text-[var(--muted-foreground)]`,children:n?`This device · ${n.backend} · ${n.deviceName??n.deviceUdid}`:`This device · not attached`})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,H.jsx)(J,{variant:`outline`,size:`icon`,className:`size-8`,onClick:ee,disabled:!n||p!==null,"aria-label":`Home or app switcher`,title:`Home · double-click for app switcher`,children:(0,H.jsx)(dr,{className:X(p===`home`&&`animate-pulse`)})}),(0,H.jsx)(J,{variant:`outline`,size:`icon`,className:`size-8`,onClick:()=>{n&&te(n.deviceUdid,n.deviceName??n.deviceUdid)},disabled:!n||p!==null||c!==null,"aria-label":`Shutdown emulator`,title:`Shutdown`,children:(0,H.jsx)(Lr,{className:X(p===`shutdown`&&`animate-pulse`)})}),(0,H.jsx)(J,{variant:`outline`,size:`icon`,className:`size-8`,onClick:()=>void D(),disabled:i,"aria-label":`Refresh emulator`,title:`Refresh`,children:(0,H.jsx)(zr,{className:X(i&&`animate-spin`)})})]})]}),(0,H.jsxs)(hC,{className:`relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3`,style:{containerType:`size`},"aria-busy":j&&!_,children:[j?(0,H.jsx)(`div`,{className:X(`relative grid touch-none select-none place-items-center overflow-hidden bg-black`,_?`max-h-full max-w-full rounded-md border border-[var(--border)] shadow-sm`:`pointer-events-none absolute inset-0`,_&&(d?`cursor-grabbing`:`cursor-crosshair`)),style:_?M:void 0,onPointerDown:se,onPointerMove:ce,onPointerUp:le,onPointerCancel:ue,children:O?(0,H.jsx)(`img`,{ref:e=>{x.current=e},src:k??void 0,alt:n?.deviceName??n?.deviceUdid,className:`pointer-events-none absolute inset-0 h-full w-full select-none object-contain`,onLoad:e=>{F(e.currentTarget.naturalWidth,e.currentTarget.naturalHeight)},onError:I,draggable:!1},`${n?.deviceUdid}:${n?.attachedAt}:${y}`):n&&A?(0,H.jsx)(sw,{device:n.deviceUdid,alt:n.deviceName??n.deviceUdid,mediaRef:e=>{x.current=e},onFrameSize:F},n.deviceUdid):null}):(0,H.jsx)(`div`,{className:`grid h-full w-full place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]`,children:n?`${n.backend} preview unavailable`:`No active emulator`}),j&&!_&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 grid place-items-center bg-[var(--background)] text-[var(--muted-foreground)]`,role:`status`,"aria-live":`polite`,children:(0,H.jsxs)(`div`,{className:`grid place-items-center gap-2 text-xs`,children:[(0,H.jsx)(zr,{className:`size-4 animate-spin text-[var(--primary)]`}),(0,H.jsx)(`span`,{children:`Loading preview…`})]})})]})]}),(0,H.jsxs)(fC,{className:`flex h-full min-h-0 flex-col overflow-hidden p-0`,children:[(0,H.jsxs)(pC,{children:[(0,H.jsxs)(mC,{className:`flex items-center gap-2`,children:[(0,H.jsx)($r,{className:`size-4`}),`Devices`]}),(0,H.jsx)(`div`,{className:`label-caps text-[10px] text-[var(--muted-foreground)]`,children:e.length})]}),(0,H.jsx)(hC,{className:`min-h-0 flex-1 p-0`,children:e.length===0?(0,H.jsx)(`div`,{className:`px-5 py-8 text-sm text-[var(--muted-foreground)]`,children:i?`Loading...`:`No devices`}):(0,H.jsx)(U_,{className:`h-full min-h-0`,children:(0,H.jsx)(`ul`,{className:`grid grid-cols-1 content-start gap-2 p-3 sm:grid-cols-2 2xl:grid-cols-3`,children:e.map(e=>{let t=n?.deviceUdid===e.id,r=o===e.id,i=c===e.id;return(0,H.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--background)] px-3 py-2.5`,children:[(0,H.jsx)($r,{className:`size-4 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,H.jsxs)(MC,{variant:e.state===`booted`?`success`:e.state===`shutdown`?`outline`:`warning`,className:`h-5 shrink-0 gap-1 px-2 py-0 font-mono text-[9px] uppercase`,children:[(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`,"aria-hidden":`true`}),e.state]})]}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]`,title:_w(e),children:_w(e)})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(J,{size:`xs`,variant:t?`outline`:`default`,onClick:()=>void ne(e),disabled:r||c!==null,children:r?`Attaching…`:t?`Reattach`:`Attach`}),e.state===`booted`&&(0,H.jsx)(J,{size:`icon-xs`,variant:`destructive`,onClick:()=>void te(e.id,e.name),disabled:o!==null||c!==null,"aria-label":`Shutdown ${e.name}`,title:`Shutdown ${e.name}`,children:(0,H.jsx)(Lr,{className:X(i&&`animate-pulse`)})})]})]},`${e.backend}:${e.id}`)})})})})]})]})}function Tw({embedded:e=!1}={}){let t=wS(),[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(!1),c=(0,u.useCallback)(async()=>{if(t){s(!0),a(null);try{r(await t.getStatus())}catch(e){a(e.message)}finally{s(!1)}}},[t]);(0,u.useEffect)(()=>{c()},[c]);async function l(e){if(!(!t||e===n?.runtime.lifecycleMode)){s(!0),a(null);try{r(await t.setDaemonLifecycleMode(e)),V.success(e===`resident`?`Runtime will stay available after Rynx quits`:`Runtime will now follow the Rynx app lifecycle`)}catch(e){let t=e.message;a(t),V.error(`Could not change Runtime mode: ${t}`)}finally{s(!1)}}}async function d(){if(t){s(!0),a(null);try{r(await t.restartDaemon()),V.success(`Local Runtime restarted`)}catch(e){let t=e.message;a(t),V.error(`Could not restart Runtime: ${t}`)}finally{s(!1)}}}return(0,H.jsxs)(`div`,{id:e?`runtime`:void 0,className:e?`grid scroll-mt-6 gap-5`:`grid max-w-3xl gap-5`,children:[!e&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Daemon`}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`Choose whether the local Runtime follows the Desktop app or stays available in the background.`})]}),(0,H.jsxs)(fC,{"aria-busy":o,children:[(0,H.jsxs)(pC,{children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(mC,{children:`Runtime lifecycle`}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`This setting applies to the Runtime bundled with Rynx.`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o,onClick:()=>void c(),children:[(0,H.jsx)(zr,{className:o?`animate-spin`:``}),`Check`]}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o,onClick:()=>void d(),children:[(0,H.jsx)(zr,{}),`Restart`]})]})]}),(0,H.jsxs)(hC,{className:`grid gap-5`,children:[n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-[var(--border)] p-4`,children:[(0,H.jsx)(`span`,{className:n.runtime.ready?`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]`:`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]`,children:(0,H.jsx)(Wr,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:`Runtime status`}),(0,H.jsx)(MC,{variant:n.runtime.ready?`success`:`warning`,children:Ew(n.runtime.state)}),(0,H.jsx)(MC,{variant:`outline`,children:n.runtime.managedBy===`app`?`Managed by app`:n.runtime.managedBy===`external`?`External`:`Not managed`})]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:n.runtime.detail??Dw(n)})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(GS,{htmlFor:`daemon-lifecycle-mode`,children:`Lifecycle`}),(0,H.jsxs)(Ig,{id:`daemon-lifecycle-mode`,value:n.runtime.lifecycleMode,disabled:o,className:`max-w-sm`,onChange:e=>void l(e.target.value),children:[(0,H.jsx)(`option`,{value:`follow-app`,children:`Follow Rynx app`}),(0,H.jsx)(`option`,{value:`resident`,children:`Stay available in background`})]}),(0,H.jsx)(`p`,{className:`max-w-2xl text-xs leading-5 text-[var(--muted-foreground)]`,children:n.runtime.lifecycleMode===`follow-app`?`The Runtime and its embedded Browser Host start with Rynx and stop when the app fully quits. Closing a window does not quit the app.`:`The Runtime and its embedded Browser Host keep running when the app quits, so Terminals, agents, and Session browsers remain available.`})]})]}):(0,H.jsxs)(`div`,{className:`flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[o&&(0,H.jsx)(B,{className:`size-4 animate-spin`}),o?`Checking Runtime…`:`Runtime status is unavailable.`]}),i&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]`,children:[(0,H.jsx)(zn,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsx)(`span`,{children:i})]})]})]})]})}function Ew(e){switch(e){case`starting`:return`Starting`;case`running`:return`Running`;case`stopped`:return`Stopped`;case`busy`:return`Busy`;case`error`:return`Error`}}function Dw(e){let t=[e.runtime.version?`Version ${e.runtime.version}`:null,e.runtime.pid?`PID ${e.runtime.pid}`:null].filter(Boolean);return t.length>0?t.join(` · `):`No additional Runtime details.`}function Ow({embedded:e=!1}={}){let t=wS(),[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(`refresh`),c=(0,u.useCallback)(async(e=!1)=>{if(t){s(`refresh`),a(null);try{r(await t.getStatus(e))}catch(e){a(e.message)}finally{s(null)}}},[t]);(0,u.useEffect)(()=>{c()},[c]);async function l(e){if(t){s(`install`),a(null);try{r(await t.installCli(e)),V.success(`Terminal command installed`)}catch(e){let n=e.message;a(n),V.error(`Could not install the Terminal command: ${n}`);try{r(await t.getStatus(!0))}catch{}}finally{s(null)}}}async function d(e){if(t){s(`remove`),a(null);try{r(await t.removeCli(e)),V.success(`Terminal command removed`)}catch(e){let n=e.message;a(n),V.error(`Could not remove the Terminal command: ${n}`);try{r(await t.getStatus(!0))}catch{}}finally{s(null)}}}let f=n?.globalCli,p=f?.state===`installed`,m=f?.state===`development`,h=f?.state===`installed`&&f.canInstall&&!!(f.path&&f.target&&f.path!==f.target);return(0,H.jsxs)(`div`,{id:e?`terminal-command`:void 0,className:e?`grid scroll-mt-6 gap-5`:`grid max-w-3xl gap-5`,children:[!e&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Terminal command`}),(0,H.jsxs)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:[`Install or remove the `,(0,H.jsx)(`code`,{className:`font-mono`,children:`rynx`}),` command used in Terminal.`]})]}),(0,H.jsxs)(fC,{"aria-busy":o!==null,children:[(0,H.jsxs)(pC,{children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(mC,{children:`Shell access`}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Removing the command does not uninstall Rynx or delete its data.`})]}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o!==null,onClick:()=>void c(!0),children:[(0,H.jsx)(zr,{className:o===`refresh`?`animate-spin`:``}),`Check`]})]}),(0,H.jsxs)(hC,{className:`grid gap-3`,children:[f?(0,H.jsxs)(`div`,{className:`grid gap-4 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center`,children:[(0,H.jsx)(`span`,{className:p?`grid size-10 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]`:m?`grid size-10 place-items-center rounded-lg bg-[var(--muted)] text-[var(--muted-foreground)]`:`grid size-10 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]`,children:p?(0,H.jsx)(Pn,{className:`size-5`}):(0,H.jsx)(qn,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`font-mono text-sm font-medium`,children:`rynx`}),(0,H.jsx)(MC,{variant:p?`success`:m?`outline`:`warning`,children:kw(f.state)})]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:Aw(f)}),f.path&&(0,H.jsx)(`code`,{className:`mt-1 block break-all font-mono text-[11px] text-[var(--muted-foreground)]`,children:f.path}),h&&f.target&&(0,H.jsxs)(`p`,{className:`mt-1 break-all text-[11px] text-[var(--muted-foreground)]`,children:[`Recommended: `,(0,H.jsx)(`code`,{className:`font-mono`,children:f.target})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 sm:justify-self-end`,children:[f.canInstall&&(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o!==null,onClick:()=>f.path&&void l(f.path),children:[o===`install`&&(0,H.jsx)(B,{className:`animate-spin`}),h?`Move command`:f.state===`stale`?`Repair command`:`Install command`]}),f.canRemove&&(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:o!==null,children:[(0,H.jsx)(si,{}),`Remove command`]})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsx)(vu,{children:`Remove the Terminal command?`}),(0,H.jsx)(yu,{children:`This removes only the shell command link that points to this Rynx app. The app, Runtime, settings, and workspace data remain installed.`})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:()=>f.path&&void d(f.path),children:`Remove command`})]})]})]})]})]}):(0,H.jsxs)(`div`,{className:`flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[o===`refresh`&&(0,H.jsx)(B,{className:`size-4 animate-spin`}),o===`refresh`?`Checking command…`:`Command status is unavailable.`]}),i&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]`,children:[(0,H.jsx)(zn,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsx)(`span`,{children:i})]})]})]})]})}function kw(e){switch(e){case`installed`:return`Installed`;case`missing`:return`Not installed`;case`stale`:return`Needs repair`;case`foreign`:return`Managed externally`;case`development`:return`Development build`;case`unwritable`:case`error`:return`Unavailable`}}function Aw(e){switch(e.state){case`installed`:return e.canInstall?`The command is ready. You can move it to the recommended location.`:`The command is ready to use from Terminal.`;case`missing`:return`Install the command to use Rynx from Terminal.`;case`stale`:return`Update the command registration to use this Rynx app.`;case`foreign`:return`Another program owns the active command. Rynx will not replace or remove it.`;case`development`:return`Global Terminal command registration is disabled in development builds. Install a packaged Rynx app to manage the rynx command.`;case`unwritable`:return`Rynx could not find a supported location for the command.`;case`error`:return`Rynx could not check the command.`}}function jw(){return(0,H.jsxs)(`div`,{className:`grid max-w-3xl gap-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Local Runtime`}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`Manage the Runtime bundled with Rynx and its Terminal command.`})]}),(0,H.jsx)(Tw,{embedded:!0}),(0,H.jsx)(Ow,{embedded:!0})]})}function Mw(){let{status:e,operation:t,error:n,checkForUpdates:r,installUpdate:i}=kS(),a=t!==null||e?.phase===`checking`||e?.phase===`downloading`||e?.phase===`installing`,o=n??e?.error;async function s(){let e=await r();e&&(e.error?V.error(`Could not check for updates: ${e.error}`):e.phase===`idle`?V.success(`${e.appName} is up to date`):e.availableVersion&&V.message(`Rynx ${e.availableVersion} is available`))}return(0,H.jsxs)(fC,{id:`software-update`,className:`scroll-mt-6`,"aria-busy":a,children:[(0,H.jsxs)(pC,{children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(mC,{children:`Software update`}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Review the installed Desktop version and check GitHub Releases for updates.`})]}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:a||!e?.supported,onClick:()=>void s(),children:[(0,H.jsx)(zr,{className:t===`check`||e?.phase===`checking`?`animate-spin`:``}),`Check for updates`]})]}),(0,H.jsxs)(hC,{className:`grid gap-4`,children:[e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-[var(--border)] p-4`,children:[(0,H.jsx)(`span`,{className:Pw(e),children:(0,H.jsx)(Nw,{status:e})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:e.appName}),(0,H.jsxs)(MC,{variant:`outline`,children:[`Version `,e.currentVersion]}),(0,H.jsx)(MC,{variant:e.channel===`preview`?`warning`:`default`,children:Iw(e.channel)})]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:Fw(e)}),e.lastCheckedAt&&(0,H.jsxs)(`p`,{className:`mt-1 text-[10px] text-[var(--muted-foreground)]`,children:[`Last checked `,Lw(e.lastCheckedAt)]})]}),e.phase===`ready`&&(0,H.jsxs)(J,{size:`sm`,disabled:t===`install`,onClick:()=>void i(),children:[t===`install`?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(Bn,{}),`Restart to update`]})]}),!e.supported&&(0,H.jsx)(`div`,{className:`rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3 text-xs leading-5 text-[var(--muted-foreground)]`,children:`Automatic updates are available in signed release builds. Local development builds display their version here but do not contact the release feed.`})]}):(0,H.jsxs)(`div`,{className:`flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),`Loading version information…`]}),o&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]`,children:[(0,H.jsx)(zn,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsx)(`span`,{children:o})]})]})]})}function Nw({status:e}){return e.phase===`checking`||e.phase===`installing`?(0,H.jsx)(B,{className:`size-5 animate-spin`}):e.phase===`downloading`?(0,H.jsx)(Yn,{className:`size-5`}):e.phase===`ready`?(0,H.jsx)(Bn,{className:`size-5`}):(0,H.jsx)(Vn,{className:`size-5`})}function Pw(e){return e.phase===`downloading`||e.phase===`ready`||e.phase===`installing`?`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]`:`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]`}function Fw(e){if(!e.supported)return`This local build does not check for automatic updates.`;switch(e.phase){case`disabled`:return`Automatic updates are disabled for this build.`;case`idle`:return e.error?`The last update check did not complete.`:e.lastCheckedAt?`This version is up to date.`:`Ready to check for updates.`;case`checking`:return`Checking GitHub Releases for a newer version…`;case`downloading`:return`Rynx ${e.availableVersion??``} is downloading in the background.`;case`ready`:return`Rynx ${e.availableVersion??``} is ready. Restart to finish the update.`;case`installing`:return`Preparing the Runtime and restarting Rynx safely…`}}function Iw(e){switch(e){case`local`:return`Local build`;case`preview`:return`Preview channel`;case`stable`:return`Stable channel`}}function Lw(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function Rw({plugins:e,agents:t,desktopIntegrationAvailable:n}){let r=nt(),i=e=>r(px[e]),a=e.filter(e=>e.enabled).length,o=e.filter(e=>e.runtimeState===`running`).length;return(0,H.jsxs)(`div`,{className:`grid gap-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Overview`}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`Plugins own integrations and their settings; agents define task behavior.`})]}),(0,H.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,H.jsx)(zw,{icon:Rr,label:`Plugins`,value:e.length,sub:`${a} enabled · ${o} healthy`,onClick:()=>i(`plugins`)}),(0,H.jsx)(zw,{icon:Mn,label:`Agents`,value:t.length,sub:t.length===1?`1 defined`:`${t.length} defined`,onClick:()=>i(`agents`)})]}),(0,H.jsxs)(fC,{children:[(0,H.jsxs)(pC,{children:[(0,H.jsx)(mC,{children:`Plugins`}),(0,H.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>i(`plugins`),children:`Manage`})]}),(0,H.jsx)(hC,{className:`p-0`,children:e.length===0?(0,H.jsxs)(`div`,{className:`px-5 py-10 text-center text-sm text-[var(--muted-foreground)]`,children:[`No plugins installed. Add one from a Market or a Git repository with the Rynx CLI.`,(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(J,{size:`sm`,onClick:()=>i(`plugins`),children:`View plugins`})})]}):(0,H.jsx)(`ul`,{className:`divide-y divide-[var(--border)]`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.pluginId}),(0,H.jsxs)(`div`,{className:`label-caps text-[10px] text-[var(--muted-foreground)]`,children:[e.id,` · v`,e.version]})]}),(0,H.jsx)(`span`,{className:`rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px] text-[var(--muted-foreground)]`,children:e.enabled?e.runtimeState:`disabled`})]},e.id))})})]}),n&&(0,H.jsx)(Mw,{})]})}function zw({icon:e,label:t,value:n,sub:r,onClick:i}){return(0,H.jsx)(fC,{children:(0,H.jsxs)(`button`,{onClick:i,className:`flex w-full items-start gap-4 rounded-xl p-5 text-left transition-colors hover:bg-[var(--muted)]/40`,children:[(0,H.jsx)(`span`,{className:`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(e,{className:`size-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-3xl font-semibold leading-none tabular-nums`,children:n}),(0,H.jsx)(`div`,{className:`label-caps mt-1.5 text-[11px] text-[var(--muted-foreground)]`,children:t}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:r})]})]})})}function Bw({description:e=`You're about to visit an external website. Review the complete destination before continuing.`,onConfirm:t,onOpenChange:n,open:r,url:i}){let[a,o]=(0,u.useState)(!1);(0,u.useEffect)(()=>{r||o(!1)},[r]);let s=async()=>{try{await navigator.clipboard.writeText(i),o(!0)}catch{}};return(0,H.jsx)(uu,{open:r,onOpenChange:n,children:(0,H.jsxs)(mu,{className:`sm:max-w-xl`,children:[(0,H.jsxs)(hu,{children:[(0,H.jsx)(_u,{children:(0,H.jsx)(er,{})}),(0,H.jsx)(vu,{children:`Open external link?`}),(0,H.jsx)(yu,{children:e})]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`code`,{className:`block max-h-48 overflow-auto whitespace-pre-wrap break-all rounded-lg border border-[var(--border)] bg-[var(--muted)]/40 py-3 pr-11 pl-3 font-mono text-xs leading-relaxed text-[var(--foreground)]`,children:i}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute top-2 right-2`,"aria-label":a?`Link copied`:`Copy link`,title:a?`Link copied`:`Copy link`,onClick:()=>void s(),children:a?(0,H.jsx)(Pn,{}):(0,H.jsx)(Jn,{})})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{onClick:t,children:`Open link`})]})]})})}function Vw(e){let t=Hw(e)?e.url:void 0;if(typeof t!=`string`||!t.trim())throw Error(`external URL is required`);let n;try{n=new URL(t)}catch{throw Error(`external URL is invalid`)}if(n.protocol!==`https:`)throw Error(`only HTTPS links may be opened`);if(n.username||n.password)throw Error(`external URLs must not contain credentials`);return n.href}function Hw(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Uw=1048576,Ww=16,Gw=3e4,Kw=2e3,qw=/^[A-Za-z][A-Za-z0-9._:-]{0,127}$/;function Jw({plugins:e,theme:t,onChange:n}){let[r,i]=(0,u.useState)(),[a,o]=(0,u.useState)(),[s,c]=(0,u.useState)(`discover`),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(),[m,h]=(0,u.useState)(!0),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(),[b,x]=(0,u.useState)(),[S,C]=(0,u.useState)(),[w,T]=(0,u.useState)(!1),E=(0,u.useRef)(0),D=(0,u.useRef)(!1),O=(0,u.useRef)(!1),k=e.find(e=>e.id===r),A=(0,u.useCallback)(async()=>{let e=++E.current;h(!0);try{let t=await Y.listPluginMarketplaces();if(e!==E.current)return!0;let r=D.current;return D.current=!1,d(t),p(void 0),r&&n(),!0}catch(t){return e!==E.current||(D.current=!0,p(t.message),!1)}finally{e===E.current&&h(!1)}},[n]);(0,u.useEffect)(()=>{let e=!1,t,n=async()=>{!await A()&&!e&&(t=window.setTimeout(()=>void n(),Kw))};return n(),()=>{e=!0,t!==void 0&&window.clearTimeout(t),E.current+=1}},[A]),(0,u.useEffect)(()=>{r&&!k&&i(void 0)},[k,r]);let j=async e=>{o(e.id);try{await Y.setPluginEnabled(e.id,!e.enabled),await n()}catch(t){V.error(`Failed to ${e.enabled?`disable`:`enable`} plugin: ${t.message}`)}finally{o(void 0)}},M=async e=>{x(e);try{C(await Y.preparePluginInstallation({operation:`install`,marketplacePlugin:e}))}catch(t){V.error(`Could not prepare ${e}: ${t.message}`)}finally{x(void 0)}},N=async e=>{x(e);try{let t=await Y.preparePluginInstallation({operation:`update`,pluginId:e});if(t.unchanged){await Y.cancelPluginInstallation(t.token).catch(()=>!1),V.info(`${e} is already up to date.`);return}C(t)}catch(t){V.error(`Could not prepare update for ${e}: ${t.message}`)}finally{x(void 0)}},P=()=>{let e=S;C(void 0),e&&Y.cancelPluginInstallation(e.token).catch(()=>!1)},F=async()=>{if(!S)return;let e=!!S.existing;T(!0);try{let t=await Y.commitPluginInstallation(S.token,{overwrite:!!S.existing,expectedDigest:S.artifact.digest});C(void 0),V.success(`${e?`Updated`:`Installed`} ${t.plugin.id} v${t.plugin.version}.`+(e?` No Rynx restart required.`:``)),await n(),c(`installed`)}catch(t){C(void 0),V.error(`${e?`Update`:`Installation`} failed: ${t.message}`)}finally{T(!1)}},I=async e=>{if(!O.current){O.current=!0,y(e.id);try{await Y.refreshPluginMarketplace(e.id),await Promise.all([A(),n()]),V.success(`Refreshed ${e.id}`)}catch(e){V.error(`Market refresh failed: ${e.message}`)}finally{O.current=!1,y(void 0)}}},L=async e=>{if(!O.current){O.current=!0,y(e.id);try{await Y.removePluginMarketplace(e.id),await A(),V.success(`Removed ${e.id}`)}catch(e){V.error(`Market removal failed: ${e.message}`)}finally{O.current=!1,y(void 0)}}};return k?.hasSettingsUi?(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsxs)(J,{variant:`outline`,size:`sm`,className:`shrink-0`,onClick:()=>i(void 0),children:[(0,H.jsx)(An,{}),`Plugins`]}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:[k.pluginId,` settings`]}),(0,H.jsx)(aT,{plugin:k})]}),(0,H.jsxs)(`div`,{className:`truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:[`Sandboxed plugin UI · `,k.id,` · v`,k.version]})]})]}),(0,H.jsx)(fC,{className:`overflow-hidden`,children:(0,H.jsx)(hC,{className:`p-0`,children:(0,H.jsx)(oT,{plugin:k,theme:t,onChange:n})})})]}):(0,H.jsxs)(`div`,{className:`grid gap-5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Plugins`}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`Discover plugins from trusted Markets, then review their source and executable entries before installation.`})]}),(0,H.jsxs)(J,{size:`sm`,className:`shrink-0`,onClick:()=>_(!0),children:[(0,H.jsx)(Ir,{}),`Add Market`]})]}),(0,H.jsxs)(lx,{value:s,onValueChange:c,children:[(0,H.jsxs)(ux,{"aria-label":`Plugin management views`,children:[(0,H.jsxs)(dx,{value:`discover`,className:`gap-1.5 leading-none`,children:[`Discover`,(0,H.jsx)(`span`,{className:`text-xs font-normal leading-none tabular-nums`,children:l?.reduce((e,t)=>e+t.plugins.length,0)??0})]}),(0,H.jsxs)(dx,{value:`installed`,className:`gap-1.5 leading-none`,children:[`Installed`,(0,H.jsx)(`span`,{className:`text-xs font-normal leading-none tabular-nums`,children:e.length})]}),(0,H.jsxs)(dx,{value:`markets`,className:`gap-1.5 leading-none`,children:[`Markets`,(0,H.jsx)(`span`,{className:`text-xs font-normal leading-none tabular-nums`,children:l?.length??0})]})]}),(0,H.jsx)(fx,{value:`discover`,children:l===null&&f?(0,H.jsx)(rT,{error:f,retrying:m,onRetry:()=>void A()}):(0,H.jsx)(Yw,{markets:l,installed:e,preparingId:b,onAddMarket:()=>_(!0),onInstall:e=>void M(e)})}),(0,H.jsx)(fx,{value:`installed`,children:(0,H.jsx)(Xw,{plugins:e,mutatingId:a,preparingId:b,onBrowse:()=>c(`discover`),onConfigure:i,onUpdate:e=>void N(e),onChangeEnabled:e=>void j(e)})}),(0,H.jsx)(fx,{value:`markets`,children:l===null&&f?(0,H.jsx)(rT,{error:f,retrying:m,onRetry:()=>void A()}):(0,H.jsx)(Zw,{markets:l,mutatingId:v,onAdd:()=>_(!0),onRefresh:e=>void I(e),onRemove:e=>void L(e)})})]}),(0,H.jsx)(Qw,{open:g,onOpenChange:_,onAdded:async e=>{await A(),c(`discover`),V.success(`Added ${e.id}`)}}),(0,H.jsx)($w,{preparation:S,committing:w,onCancel:P,onCommit:()=>void F()})]})}function Yw({markets:e,installed:t,preparingId:n,onAddMarket:r,onInstall:i}){let[a,o]=(0,u.useState)(``),s=new Set(t.map(e=>e.id)),c=(e??[]).flatMap(e=>e.plugins.map(t=>({id:`${t.id}@${e.id}`,pluginId:t.id,market:e}))),l=a.trim().toLowerCase(),d=l?c.filter(({id:e})=>e.includes(l)):c;return e===null?(0,H.jsx)(nT,{label:`Loading plugin catalogs…`}):e.length===0?(0,H.jsx)(tT,{icon:ii,title:`Add a Market to discover plugins`,description:`A Market is a Git or local catalog. Adding it downloads metadata only and never installs plugin code.`,action:(0,H.jsxs)(J,{size:`sm`,onClick:r,children:[(0,H.jsx)(Ir,{}),` Add Market`]})}):(0,H.jsxs)(fC,{children:[(0,H.jsxs)(pC,{className:`flex-col items-stretch gap-3 sm:flex-row sm:items-center`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(mC,{children:`Available plugins`}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Catalog entries stay inert until you review and install one.`})]}),(0,H.jsxs)(`div`,{className:`relative w-full sm:w-64`,children:[(0,H.jsx)(Hr,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]`}),(0,H.jsx)(Ag,{"aria-label":`Search available plugins`,className:`pl-8`,value:a,placeholder:`Search plugins or Markets`,onChange:e=>o(e.target.value)})]})]}),(0,H.jsx)(hC,{className:`p-0`,children:d.length===0?(0,H.jsxs)(`div`,{className:`px-5 py-10 text-center text-sm text-[var(--muted-foreground)]`,children:[`No catalog entries match “`,a.trim(),`”.`]}):(0,H.jsx)(`div`,{className:`divide-y divide-[var(--border)]`,children:d.map(({id:e,pluginId:t,market:r})=>{let a=s.has(e),o=n===e;return(0,H.jsxs)(`article`,{className:`flex flex-col gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 sm:flex-row sm:items-center`,children:[(0,H.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(Rr,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`strong`,{className:`text-sm`,children:t}),(0,H.jsx)(MC,{variant:`outline`,className:`font-mono`,children:r.id})]}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:e})]}),(0,H.jsx)(J,{size:`sm`,variant:a?`outline`:`default`,disabled:a||!!n,onClick:()=>i(e),children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Pn,{}),` Installed`]}):o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(B,{className:`animate-spin`}),` Preparing…`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Yn,{}),` Install`]})})]},e)})})})]})}function Xw({plugins:e,mutatingId:t,preparingId:n,onBrowse:r,onConfigure:i,onUpdate:a,onChangeEnabled:o}){return e.length===0?(0,H.jsx)(tT,{icon:Or,title:`No plugins installed`,description:`Browse your registered Markets and review a plugin before installing it.`,action:(0,H.jsxs)(J,{size:`sm`,onClick:r,children:[(0,H.jsx)(Or,{}),` Browse plugins`]})}):(0,H.jsx)(`div`,{className:`grid gap-3`,children:e.map(e=>(0,H.jsx)(fC,{children:(0,H.jsxs)(hC,{className:`flex flex-col gap-4 sm:flex-row sm:items-center`,children:[(0,H.jsx)(`span`,{className:`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(Rr,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`strong`,{className:`text-sm`,children:e.pluginId}),(0,H.jsx)(aT,{plugin:e}),(0,H.jsx)(MC,{variant:`outline`,children:e.marketplaceId})]}),(0,H.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:[`v`,e.version]}),e.runtimeError&&(0,H.jsxs)(`div`,{className:`mt-2 flex items-start gap-1.5 text-xs text-[var(--danger)]`,children:[(0,H.jsx)(ci,{className:`mt-0.5 size-3.5 shrink-0`}),e.runtimeError]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.hasSettingsUi&&(0,H.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>i(e.id),children:[(0,H.jsx)(Gr,{}),`Configure`]}),e.updateState!==`current`&&(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:!!n||t!==void 0,onClick:()=>a(e.id),children:[(0,H.jsx)(zr,{className:n===e.id?`animate-spin`:``}),n===e.id?`Checking…`:e.updateState===`available`?`Update`:`Check for updates`]}),(0,H.jsx)(Ub,{"aria-label":`${e.enabled?`Disable`:`Enable`} ${e.pluginId}`,checked:e.enabled,disabled:t===e.id,onCheckedChange:()=>o(e)})]})]})},e.id))})}function Zw({markets:e,mutatingId:t,onAdd:n,onRefresh:r,onRemove:i}){return e===null?(0,H.jsx)(nT,{label:`Loading Markets…`}):e.length===0?(0,H.jsx)(tT,{icon:ii,title:`No Markets registered`,description:`Add a trusted Git repository or local catalog to make its plugins discoverable.`,action:(0,H.jsxs)(J,{size:`sm`,onClick:n,children:[(0,H.jsx)(Ir,{}),` Add Market`]})}):(0,H.jsxs)(fC,{children:[(0,H.jsxs)(pC,{children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(mC,{children:`Registered Markets`}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Built-in Markets update with Rynx. User-added Markets can be refreshed independently.`})]}),(0,H.jsxs)(J,{size:`sm`,variant:`outline`,onClick:n,children:[(0,H.jsx)(Ir,{}),` Add Market`]})]}),(0,H.jsx)(hC,{className:`p-0`,children:(0,H.jsx)(`div`,{className:`divide-y divide-[var(--border)]`,children:e.map(e=>(0,H.jsxs)(`article`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center`,children:[(0,H.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(ii,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`strong`,{className:`font-mono text-sm`,children:e.id}),(0,H.jsx)(MC,{variant:`outline`,children:e.builtIn?`Built-in`:e.source}),(0,H.jsxs)(MC,{variant:`default`,children:[e.plugins.length,` plugins`]})]}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:e.builtIn?`Managed by Rynx · updated ${new Date(e.refreshedAt).toLocaleString()}`:`${e.id} · ${iT(e.resolvedRevision)} · refreshed ${new Date(e.refreshedAt).toLocaleString()}`})]}),!e.builtIn&&(0,H.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,H.jsxs)(J,{size:`sm`,variant:`outline`,disabled:t!==void 0,onClick:()=>r(e),children:[(0,H.jsx)(zr,{className:t===e.id?`animate-spin`:``}),`Refresh`]}),(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsx)(J,{size:`icon-sm`,variant:`ghost`,disabled:t!==void 0,"aria-label":`Remove ${e.id}`,children:(0,H.jsx)(si,{})})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsx)(vu,{children:`Remove this Market?`}),(0,H.jsxs)(yu,{children:[e.id,` will disappear from Discover. A Market with installed plugins cannot be removed until those plugins are uninstalled.`]})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:()=>i(e),children:`Remove Market`})]})]})]})]})]},e.id))})})]})}function Qw({open:e,onOpenChange:t,onAdded:n}){let[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)(!1),s=()=>{i(``),t(!1)},c=async()=>{if(r.trim()){o(!0);try{let e=await Y.addPluginMarketplace({source:r.trim()});s(),await n(e)}catch(e){V.error(`Could not add Market: ${e.message}`)}finally{o(!1)}}};return(0,H.jsx)(Su,{open:e,onOpenChange:e=>{a||(e?t(!0):s())},children:(0,H.jsxs)(Du,{className:`sm:max-w-lg`,showCloseButton:!a,children:[(0,H.jsxs)(Ou,{children:[(0,H.jsx)(Au,{children:`Add a Market`}),(0,H.jsxs)(ju,{children:[`Register a Git repository or local directory containing`,` `,(0,H.jsx)(`code`,{children:`.rynx-plugin/marketplace.json`}),`. This reads the catalog only.`]})]}),(0,H.jsx)(`div`,{className:`grid gap-4`,children:(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{htmlFor:`market-source`,children:`Source`}),(0,H.jsx)(Ag,{id:`market-source`,autoFocus:!0,value:r,placeholder:`owner/repo or https://github.com/owner/repo`,onChange:e=>i(e.target.value)}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`GitHub shorthand, a credential-free Git URL, or an absolute local path.`})]})}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(J,{variant:`outline`,disabled:a,onClick:s,children:`Cancel`}),(0,H.jsxs)(J,{disabled:a||!r.trim(),onClick:()=>void c(),children:[a?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(ii,{}),a?`Adding…`:`Add Market`]})]})]})})}function $w({preparation:e,committing:t,onCancel:n,onCommit:r}){let i=e?.artifact;return(0,H.jsx)(Su,{open:!!e,onOpenChange:e=>{!e&&!t&&n()},children:(0,H.jsx)(Du,{className:`max-h-[calc(100dvh-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-2xl`,children:e&&i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Ou,{className:`px-5 pb-4 pr-12 pt-5`,children:[(0,H.jsxs)(Au,{children:[`Review `,e.existing?`plugin update`:`plugin installation`]}),(0,H.jsx)(ju,{children:`Rynx inspected an immutable package snapshot. Confirm its source and executable entries before the active installation changes.`})]}),(0,H.jsx)(U_,{className:`min-h-0`,children:(0,H.jsxs)(`div`,{className:`grid gap-3 px-5 pb-5`,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`strong`,{children:i.pluginId}),(0,H.jsx)(MC,{variant:`outline`,children:i.marketplaceId}),(0,H.jsxs)(MC,{variant:`default`,children:[`v`,i.version]})]}),(0,H.jsx)(`div`,{className:`font-mono text-[10px] text-[var(--muted-foreground)]`,children:i.id}),(0,H.jsx)(`div`,{className:`break-all font-mono text-[10px] leading-relaxed text-[var(--muted-foreground)]`,children:i.digest}),(0,H.jsxs)(`dl`,{className:`grid gap-2 border-t border-[var(--border)] pt-3 text-xs`,children:[(0,H.jsx)(eT,{label:`Source`,children:i.resolvedSource.type===`git`?i.resolvedSource.repository:`Local directory (path hidden)`}),(0,H.jsx)(eT,{label:`Subdirectory`,children:i.resolvedSource.subdirectory}),i.resolvedSource.type===`git`&&(0,H.jsx)(eT,{label:`Commit`,children:i.resolvedSource.commit})]}),(i.runtimeEntry||i.settingsBackgroundEntry||i.commandsEntry||i.settingsUiEntry||i.skillDirectory)&&(0,H.jsxs)(`div`,{className:`grid gap-2 border-t border-[var(--border)] pt-3`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium`,children:`Included components`}),(0,H.jsxs)(`dl`,{className:`grid gap-2 text-xs`,children:[i.runtimeEntry&&(0,H.jsx)(eT,{label:i.runtimeEntry.type===`module`?`Runtime module`:`Runtime process`,children:i.runtimeEntry.type===`module`?i.runtimeEntry.entry:[i.runtimeEntry.command,...i.runtimeEntry.args].join(` `)}),i.commandsEntry&&(0,H.jsx)(eT,{label:`Commands`,children:i.commandsEntry}),i.settingsUiEntry&&(0,H.jsx)(eT,{label:`Settings UI`,children:i.settingsUiEntry}),i.settingsBackgroundEntry&&(0,H.jsx)(eT,{label:i.settingsBackgroundEntry.type===`module`?`Settings background`:`Settings process`,children:i.settingsBackgroundEntry.type===`module`?i.settingsBackgroundEntry.entry:[i.settingsBackgroundEntry.command,...i.settingsBackgroundEntry.args].join(` `)}),i.skillDirectory&&(0,H.jsx)(eT,{label:`Skills`,children:i.skillDirectory})]})]})]}),e.existing&&(0,H.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--warning)]/35 bg-[var(--warning)]/10 p-3 text-xs`,children:[(0,H.jsx)(ci,{className:`mt-0.5 size-4 shrink-0 text-[var(--warning)]`}),`This replaces `,e.existing.id,` v`,e.existing.version,`. Its enabled state and plugin-owned data are retained.`]})]})}),(0,H.jsxs)(ku,{className:`mx-0 mb-0 rounded-none rounded-b-xl px-5 py-3`,children:[(0,H.jsx)(J,{variant:`outline`,disabled:t,onClick:n,children:`Cancel`}),(0,H.jsxs)(J,{disabled:t,onClick:r,children:[t?(0,H.jsx)(B,{className:`animate-spin`}):e.existing?(0,H.jsx)(zr,{}):(0,H.jsx)(Yn,{}),t?e.existing?`Updating…`:`Installing…`:e.existing?`Update plugin`:`Install plugin`]})]})]})})})}function eT({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`grid gap-0.5 sm:grid-cols-[7rem_minmax(0,1fr)] sm:gap-3`,children:[(0,H.jsx)(`dt`,{className:`text-[var(--muted-foreground)]`,children:e}),(0,H.jsx)(`dd`,{className:`min-w-0`,children:(0,H.jsx)(`code`,{className:`break-all text-[11px]`,children:t})})]})}function tT({icon:e,title:t,description:n,action:r}){return(0,H.jsx)(fC,{children:(0,H.jsxs)(hC,{className:`grid justify-items-center gap-3 py-12 text-center`,children:[(0,H.jsx)(`span`,{className:`grid size-11 place-items-center rounded-xl bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(e,{className:`size-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:t}),(0,H.jsx)(`p`,{className:`mt-1 max-w-md text-xs text-[var(--muted-foreground)]`,children:n})]}),r]})})}function nT({label:e}){return(0,H.jsx)(fC,{children:(0,H.jsxs)(hC,{className:`flex items-center justify-center gap-2 py-12 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),e]})})}function rT({error:e,retrying:t,onRetry:n}){return(0,H.jsx)(fC,{role:`alert`,children:(0,H.jsxs)(hC,{className:`grid justify-items-center gap-3 py-12 text-center`,children:[(0,H.jsx)(`span`,{className:`grid size-11 place-items-center rounded-xl bg-[var(--danger)]/10 text-[var(--danger)]`,children:(0,H.jsx)(ci,{className:`size-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:`Rynx Runtime is unavailable`}),(0,H.jsx)(`p`,{className:`mt-1 max-w-md text-xs text-[var(--muted-foreground)]`,children:`Plugin catalogs could not be loaded. Rynx will retry automatically.`}),(0,H.jsx)(`p`,{className:`mt-2 max-w-md break-all font-mono text-[10px] text-[var(--danger)]`,children:e})]}),(0,H.jsxs)(J,{size:`sm`,variant:`outline`,disabled:t,onClick:n,children:[(0,H.jsx)(zr,{className:t?`animate-spin`:``}),t?`Retrying…`:`Retry now`]})]})})}function iT(e){return e===`local`||e.length<=12?e:e.slice(0,12)}function aT({plugin:e}){if(!e.enabled)return null;let t=e.runtimeState,n=t===`absent`?`Unavailable`:t.charAt(0).toUpperCase()+t.slice(1);return(0,H.jsx)(`span`,{className:X(`rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px]`,t===`running`&&`text-[var(--success)]`,(t===`failed`||t===`degraded`)&&`text-[var(--danger)]`,(t===`stopped`||t===`absent`)&&`text-[var(--muted-foreground)]`),children:n})}function oT({plugin:e,theme:t,onChange:n}){let r=(0,u.useRef)(null),i=(0,u.useRef)(()=>void 0),a=(0,u.useRef)(null),o=(0,u.useRef)(void 0),s=(0,u.useRef)(void 0),[c,l]=(0,u.useState)(),[d,f]=(0,u.useState)(),[p,m]=(0,u.useState)(),h=(0,u.useCallback)((e,t)=>{let n=Vw(e);return s.current?Promise.reject(Error(`another external link confirmation is already open`)):new Promise((e,r)=>{let i=!1,a,o=()=>{t.removeEventListener(`abort`,c),s.current===a&&(s.current=void 0,m(void 0))},c=()=>{i||(i=!0,o(),r(Error(`external link request was cancelled`)))};a={url:n,settle(t){i||(i=!0,o(),t&&window.open(n,`_blank`,`noopener,noreferrer`),e({opened:t}))}},s.current=a,m(a),t.aborted?c():t.addEventListener(`abort`,c,{once:!0})})},[]);(0,u.useEffect)(()=>{let t=new AbortController;return i.current(),o.current=void 0,l(void 0),f(void 0),Y.pluginSettingsUi(e.id,t.signal).then(l).catch(e=>{t.signal.aborted||f(e.message)}),()=>{t.abort(),i.current()}},[e.id,e.updatedAt]),(0,u.useEffect)(()=>{a.current?.postMessage(sT(t))},[t]);let g=(0,u.useCallback)(()=>{if(i.current(),!c||!r.current?.contentWindow)return;let o=new MessageChannel,s=new Set,l=new Set,u=!0,d=0,f=e=>{if(!u)return;let t=uT(e);o.port1.postMessage(t)};o.port1.onmessage=t=>{let r=lT(t.data);if(!r.ok){f({id:r.id,error:r.error});return}if(l.has(r.id)){f({id:r.id,error:`duplicate request id`});return}if(d>=Ww){f({id:r.id,error:`too many requests in flight`});return}l.add(r.id),d+=1;let i=new AbortController;s.add(i);let a=window.setTimeout(()=>i.abort(),Gw);cT(e.id,c.generation,h,r.method,r.params,i.signal).then(e=>{f({id:r.id,result:e}),r.method!==`host.openExternal`&&n()}).catch(e=>{f({id:r.id,error:i.signal.aborted?`request timed out`:e.message})}).finally(()=>{window.clearTimeout(a),s.delete(i),l.delete(r.id),--d})},o.port1.onmessageerror=()=>{f({id:null,error:`invalid plugin UI message`})},o.port1.start(),a.current=o.port1,r.current.contentWindow.postMessage({type:`rynx-plugin-connect`,pluginId:e.id,appearance:{colorScheme:t}},`*`,[o.port2]),i.current=()=>{if(u){u=!1;for(let e of s)e.abort();s.clear(),l.clear(),a.current===o.port1&&(a.current=null),o.port1.close(),o.port2.close()}}},[c,n,e.id,h,t]),_=(0,u.useCallback)(()=>{if(c){if(o.current===c.generation){i.current();return}o.current=c.generation,g()}},[g,c]);return d?(0,H.jsx)(`div`,{className:`p-5 text-sm text-[var(--danger)]`,children:d}):c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`iframe`,{ref:r,title:`${e.pluginId} settings`,className:`h-[calc(100dvh-10rem)] min-h-[28rem] max-h-[64rem] w-full border-0 bg-[var(--background)]`,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:c.html,onLoad:_}),(0,H.jsx)(Bw,{open:!!p,url:p?.url??``,onOpenChange:e=>{e||p?.settle(!1)},description:(0,H.jsxs)(H.Fragment,{children:[`The `,e.pluginId,` plugin wants to open this address in a new browser tab. Review the complete destination before continuing.`]}),onConfirm:()=>p?.settle(!0)})]}):(0,H.jsx)(`div`,{className:`p-5 text-sm text-[var(--muted-foreground)]`,children:`Loading plugin UI…`})}function sT(e){return{type:`rynx-host-appearance`,appearance:{colorScheme:e}}}async function cT(e,t,n,r,i,a){if(r===`host.openExternal`)return n(i,a);if(r.startsWith(`host.`))throw Error(`unknown Rynx host settings method "${r}"`);return Y.pluginSettingsCall(e,t,r,i,a)}function lT(e){let t;try{t=dT(e)}catch{return{ok:!1,id:null,error:`request is not serializable`}}if(t>Uw)return{ok:!1,id:null,error:`request exceeds 1 MiB`};if(typeof e!=`object`||!e||Array.isArray(e))return{ok:!1,id:null,error:`request must be an object`};let n=e,r=typeof n.id==`string`||typeof n.id==`number`&&Number.isSafeInteger(n.id)?n.id:null;return r===null||typeof n.method!=`string`||!qw.test(n.method)?{ok:!1,id:r,error:`request id or method is invalid`}:{ok:!0,id:r,method:n.method,params:n.params}}function uT(e){try{return dT(e)<=Uw?e:{id:fT(e),error:`response exceeds 1 MiB`}}catch{return{id:fT(e),error:`response is not serializable`}}}function dT(e){return new TextEncoder().encode(JSON.stringify(e)).byteLength}function fT(e){if(typeof e!=`object`||!e)return null;let t=e.id;return typeof t==`string`||typeof t==`number`?t:null}function pT(e){let t=[...new Set(e.directories.map(e=>e.trim()).filter(Boolean))],n=e.primary.trim();return{name:e.name.trim()||mT(n),directories:t,primary:n}}function mT(e){let t=e.trim().replace(/[\\/]+$/,``);if(!t||/^[A-Za-z]:$/.test(t))return``;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}var hT={name:``,directories:[],primary:``},gT=`local`;function _T(){let e=$e(),[t,n]=(0,u.useState)([]),[r,i]=(0,u.useState)(!0),[a,o]=(0,u.useState)(),[s,c]=(0,u.useState)(()=>e.state?.createProject===!0?`new`:null),l=(0,u.useRef)(0);async function d(e=!1){let t=++l.current;e&&i(!0);try{let e=await Y.listProjects(gT);if(t!==l.current)return;n(e),o(void 0)}catch(e){if(t!==l.current)return;n([]),o(`Could not load projects: ${e.message}`)}finally{t===l.current&&i(!1)}}return(0,u.useEffect)(()=>(n([]),o(void 0),i(!0),d(),()=>{l.current+=1}),[]),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(fC,{children:[(0,H.jsxs)(pC,{className:`flex-wrap`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(mC,{children:[`Projects`,` `,(0,H.jsx)(`span`,{className:`ml-1 text-[var(--muted-foreground)]`,children:t.length})]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:`Reusable source directories stored on This device.`})]}),(0,H.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none`,children:(0,H.jsxs)(J,{size:`sm`,onClick:()=>c(`new`),children:[(0,H.jsx)(Ir,{}),` New project`]})})]}),(0,H.jsx)(hC,{className:`p-0`,children:r?(0,H.jsxs)(`div`,{className:`flex min-h-36 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]`,role:`status`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),` Loading projects…`]}):a?(0,H.jsxs)(`div`,{className:`grid min-h-36 place-items-center gap-3 px-5 py-8 text-center`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Projects are unavailable`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:a})]}),(0,H.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void d(!0),children:`Retry`})]}):t.length===0?(0,H.jsx)(`div`,{className:`grid min-h-44 place-items-center px-5 py-8 text-center`,children:(0,H.jsxs)(`div`,{className:`max-w-sm`,children:[(0,H.jsx)(`span`,{className:`mx-auto flex size-10 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(ar,{className:`size-5`})}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:`No projects on this device`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:`Save one or more directories so a new Session can start in the same workspace.`}),(0,H.jsxs)(J,{className:`mt-4`,size:`sm`,onClick:()=>c(`new`),children:[(0,H.jsx)(Ir,{}),` New project`]})]})}):(0,H.jsx)(`ul`,{className:`divide-y divide-[var(--border)]`,children:t.map(e=>(0,H.jsx)(vT,{project:e,onEdit:()=>c(e),onDeleted:()=>void d()},e.id))})})]}),(0,H.jsx)(yT,{open:s!==null,project:s===`new`?void 0:s??void 0,onOpenChange:e=>{e||c(null)},onSaved:async()=>{c(null),await d()}},s===`new`?`new`:s?.id??`closed`)]})}function vT({project:e,onEdit:t,onDeleted:n}){let[r,i]=(0,u.useState)(!1);async function a(){i(!0);try{await Y.deleteProject(gT,e.id),V.success(`Project "${e.name}" removed`),n()}catch(e){V.error(`Delete failed: ${e.message}`)}finally{i(!1)}}return(0,H.jsxs)(`li`,{className:`grid gap-3 px-5 py-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(sr,{className:`size-4 shrink-0 text-[var(--primary)]`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),(0,H.jsxs)(`span`,{className:`rounded-md bg-[var(--muted)] px-1.5 py-0.5 font-mono text-[9px] text-[var(--muted-foreground)]`,children:[e.directories.length,` `,e.directories.length===1?`folder`:`folders`]})]}),(0,H.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5 pl-6 font-mono text-[10px] text-[var(--muted-foreground)]`,children:[(0,H.jsx)(ri,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`truncate`,title:e.primary,children:e.primary})]})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-1.5`,children:[(0,H.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:t,children:[(0,H.jsx)(Pr,{}),` Edit`]}),(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--destructive)]`,"aria-label":`Delete ${e.name}`,disabled:r,children:r?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(si,{})})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsxs)(vu,{children:[`Remove project “`,e.name,`”?`]}),(0,H.jsx)(yu,{children:`This removes only the saved project. It does not delete any directories or affect existing Sessions.`})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:()=>void a(),children:`Remove project`})]})]})]})]})]})}function yT({open:e,project:t,onOpenChange:n,onSaved:r}){let i=wS(),a=!!i?.chooseDirectory,[o,s]=(0,u.useState)(()=>t?{name:t.name,directories:[...t.directories],primary:t.primary}:{...hT}),[c,l]=(0,u.useState)(!1),[d,f]=(0,u.useState)(!1),p=(0,u.useMemo)(()=>bT(o),[o]);function m(){s(e=>({...e,directories:[...e.directories,``]}))}async function h(){let e=await i?.chooseDirectory?.();e&&s(t=>t.directories.includes(e)?t:{...t,directories:[...t.directories,e],primary:t.primary||e})}function g(e,t){s(n=>{let r=n.directories[e]??``,i=n.directories.map((n,r)=>r===e?t:n),a=n.primary;return a===r&&(a=t),!a&&t&&(a=t),{...n,directories:i,primary:a}})}function _(e){s(t=>{let n=t.directories[e],r=t.directories.filter((t,n)=>n!==e);return{...t,directories:r,primary:t.primary===n?r.find(Boolean)??``:t.primary}})}async function v(){if(f(!0),p)return;let e=pT(o);l(!0);try{t?(await Y.updateProject(gT,t.id,e),V.success(`Project "${e.name}" updated`)):(await Y.createProject(gT,e),V.success(`Project "${e.name}" created`)),await r()}catch(e){V.error(`Save failed: ${e.message}`)}finally{l(!1)}}return(0,H.jsx)(Su,{open:e,onOpenChange:n,children:(0,H.jsxs)(Du,{className:`sm:max-w-2xl`,children:[(0,H.jsxs)(Ou,{children:[(0,H.jsx)(Au,{children:t?`Edit project`:`Create project`}),(0,H.jsx)(ju,{children:`These paths belong to This device. The Primary directory becomes the Session working directory; every listed directory is available to the Session.`})]}),(0,H.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{htmlFor:`project-name`,children:`Name`}),(0,H.jsx)(Ag,{id:`project-name`,value:o.name,onChange:e=>s(t=>({...t,name:e.target.value})),placeholder:`Defaults to Primary folder name`,maxLength:128,autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(GS,{children:`Source directories`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:`Choose local folders or enter absolute paths.`})]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[a&&(0,H.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void h(),children:[(0,H.jsx)(ar,{}),` Choose folder`]}),(0,H.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:m,children:[(0,H.jsx)(Ir,{}),` `,a?`Enter path`:`Add path`]})]})]}),(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-[var(--border)]`,children:o.directories.length===0?(0,H.jsxs)(`button`,{type:`button`,className:`flex min-h-24 w-full items-center justify-center gap-2 text-sm text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]/40 hover:text-[var(--foreground)]`,onClick:a?()=>void h():m,children:[(0,H.jsx)(ar,{className:`size-4`}),a?`Choose a source folder`:`Add an absolute directory path`]}):(0,H.jsx)(`div`,{className:`divide-y divide-[var(--border)]`,children:o.directories.map((e,t)=>{let n=e!==``&&e===o.primary;return(0,H.jsxs)(`div`,{className:`grid gap-2 p-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center`,children:[(0,H.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,H.jsx)(sr,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]`}),(0,H.jsx)(Ag,{value:e,onChange:e=>g(t,e.target.value),placeholder:`/Users/name/Workspace/project`,className:`pl-8 font-mono text-xs`,"aria-label":`Source directory ${t+1}`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,H.jsxs)(J,{type:`button`,variant:n?`secondary`:`ghost`,size:`sm`,className:X(n&&`text-[var(--primary)]`),disabled:!e.trim(),onClick:()=>s(t=>({...t,primary:e})),children:[n?(0,H.jsx)(Pn,{}):(0,H.jsx)(ri,{}),n?`Primary`:`Make primary`]}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove source directory ${t+1}`,onClick:()=>_(t),children:(0,H.jsx)(di,{})})]})]},t)})})}),d&&p&&(0,H.jsx)(`p`,{className:`text-xs text-[var(--destructive)]`,role:`alert`,children:p})]}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,H.jsxs)(J,{type:`submit`,disabled:c,children:[c?(0,H.jsx)(B,{className:`animate-spin`}):null,t?`Save changes`:`Create project`]})]})]})]})})}function bT(e){let t=pT(e);if(!t.name)return`Enter a project name.`;if(t.directories.length===0)return`Add at least one source directory.`;if(t.directories.some(e=>!xT(e)))return`Every source directory must be an absolute path.`;if(!t.primary||!t.directories.includes(t.primary))return`Choose one listed directory as Primary.`}function xT(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}var ST={codex:{src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAGcklEQVR42s2YbayXZR3HP9efc3g4wEEcgiKSIuQENCnEkUo5ZeUxS4eVtnzR1gpdTzO1CNfDirlc9aJMrfmi1Zo2K2wtQsk0TM6gLWxATUklFQNFoIOcwznA+fSi7023twcQa617++9/77qvh9/j9/f9XfB/9pTXM0ktQCmlDKonAvOBWUAnsBv4C7CmlLI9c1uAzW1KKf7HEucA1AnqEnW9+pK6V92v9qkvZvwW9fgj7NVSh1V7HpOFqkWlFNXZwNeBLqAfWAlsBF4BjgPmARcAB4FfAo/EeqcB+4CtwHpgdSmlX21l78E3YqEp6kr/9SxXL81Yh9oejTvVT6l7PPzznHqPellt72HN89oOI0RbYmAUcD3wLuBe4HOllGcbcztiobnAGGAb8DiwGdgOjIyl5gBXA+eqk4CfAL1q64iWip/b8j5bfVn9q3p6XSt1hHq+ert6IFb4nfrxBP6r3K/OU7+j7lN3qNdUMXXUAM77OPUmdVBdFgFa+Z+mfjZuUN2cgJ5cWz9cHTHEGV9OIqxT5xzOdTQ2eqv6LXWb2pO4aY+mXeqaCLJd/Z46q+5udZK6SH2/Or4K4ig0Sr0v62/Nnm2Hc1W7ekMEqZ5d6twsHKmuyvgKdUHNJdXvktqcgbwvbEDItfn2sHpC0zvUNFim9kage9Q/JXPelu+jY+rd6hV1U6tnqz/IN9Un1A15f1n9fuADdYb6uPqUOu81AmXgg1m4O+Y+TX1QfaUmUIfaHWC8MGOnqF9UN6r9EeJG9Uz1DPXz6gsR7KnE5cxYeJfaNZSFxqu/zaIlMf3ECLSnIdC6WPCqxEh3A2/uUMfU9h6rzle/28jGreom9YKES6nj0PnA2cA64L6g84QhkHxYkHoscAMwExgHLAf6gEuBK4EO9X7gwVLKHqBb3Qw8DFwLvDf7PQ8MpEb+u/6ptwUflsYKJS5bFQudm3mdsZrRtlu9Tj0p6P0JdW2+P5MUn1vPInWq+pmai7+R2GzVXXZvNvlIbezUHN6jnhUhO5MZAwG5aUNk6zT1rhxmYmpxFKzjXJf6fDDpw9V4q/Ffh/BWXNoC2kId9qUU9AA/K6U8HVxpVRhTSnka+CnwJNALvAm4E7gDWBilhpdSVgBLs/9i9bi6IM+lUp+stteYQD/QASxKTB2I0AUYGY33l1IGU4/2Z6wdmAg8ASwGHgUWhgl8NDFWgDXAauDNwCV1gbqBncBFwKmZ/BKwKoIuSeBenYJ74Cjkzli3L0X5CuCrGXsPMDEW/1uoyvEhfYcEeijVeQHw9pp77gYuB34TvnMXcAbwYiwj0F65DGivrbXm7p1x49643PChgWTaMGDqIYFKKbvi50FgmdpVShkopfQAD8Ts10ejDmAGcJU6rZTSV7mslNKXQF8UgrYPGBWLH4wgBxr09rXxGw1HJwX7k5KfVqc2iuZc9SvqlmTQ2qT6lKT+dYGCCgAfUDuz/pxk7OqUjhKIWRrIuW2oWnZeDUdU7w8aT6gTMvXK1K2/qzvVH6s/z5qd6mPh3KvVsbVa16M+Wqtp03PejjqTrKp1S70wcL5V/X0OOJhyML/aPGvGZLz+rEkdXJTysk4d3RBotTo5Zy7JuoeqtG92Fl3R8NfqLPXmFERTIJekYJ6ZIrkh5t4QgjYl+yxIAe5uCLQnAk2PlXenoH/gcK3OeYH89TXKOivIuyOCbQy1qLjS3epZdeJeO2xtVWgj0D/UP4favBCq87V62DQFOkF9JHB+TePbRaEM/XHjr9R31glazTorIvAqdWTG3xJrVM+2kMH2VwnTyKISWmm0GNGgn+PU96mXp3GsE7RZobPba/HUVVFU9eJYaLv6TXWOOvxIXLrqJuaof4g5bxliXnujek9O/Gyu9V83qqc3GoMvpWG4SR03VGMxpFD5fSgx06d+Oy1Macw9Sf1YyFZFR25PazSioeQ09cm4bHbNI62jNYrm94tA/BeATwIXA+vVZ4K+JwLTgXPy/iPgh7lw6D3Up5dyUD0ldWwGcCuwJYL6ulrpRlxcllh6dojWeDD/e4LqndG6PeA5Je3T8sxbWcHCMV/H1C8DYv4FaYVPBkYAW8KJ3pHi2wY8Fgq8Ky31bODdmb8CuLmUsql+iXHM1zCJp9YR5oxPLfpjsqc3VzR7A4zr03VMOGoAv5ELqyHWDqYhmBQ+MzPXMz3AJqC7lLKtIvD/lQur//XzT+4u16KSSLsQAAAAAElFTkSuQmCC`,monochrome:!0},claude:{src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAEYElEQVR4nMVXW4hVVRjedrMii+6FRRRFUQ9iVNAFKipoKAeC1vrXGTUkSn0xGpyz/nVmHjpRYJQvZQ+R0EOXhyQksQsVKFo9WBORdc6sf59RiWlUyCmly5SWJ/69195n7T3nOo31w2Lm/Ovyf+v7b2sHQQcZXbnyVCoVrpsYFGcE/4eQgdcJoU6oDo2PqMubrakOL7uUNGwkLW6ZU+PVtQNXxMbjYTU83x4kfDenALaX7zqFEI54IH6ulMVZMwAgTLr5z+cUAAtp+ZTPQqjVE4En9XL5JEI4FjGE8FqQkxDVUIhqNERYFcxGamv65ocIoQdib12Ik5N5Wlu4IAVnoOjvJVTDqfsQfuO1bY2NG3E1aVkaQ3VbBgTKJZlYQLksnSuJ6xsA5L2pcQOP+XsIYcoH3lRIw2du8V+Mvh4E85I5i/BRaggh5PiI9FrenejHSg+dH4EqijsJ4WjGdaiGOtIdImzKoDawdbcZONe76bGUBSMfjUGr5Y7i76N1eullhHAwaxw2+ZdpKVXOZ4RtOer2WK1uciy84un3VcritMTPoZFbOF4I1a7c/mqzzGkpdY5qLUv+bQnhTzJq0AH8xbvZKkJ4yf1+mlC+nDP+aw0LNwSzETJwc6jh2+yB8j1r5Iue7muL8JZz186c8Xpo1Irg30htTd98i+qZXED97f1/nBB+yBt2pfvtZmfuK684vWbU4lp56dndAzFqMSHsbm5o5uCc52Dcg+KcUBfuCzWMuACnOMOidYfTBlcZFOftLy85sxMbhLDOO6DlCBF+4uDLseUPPuPd6GAaEQsJ4Q83Mc11PfK9gZ0c2YTqDfa7Raldyq3rlglvHOCUJqPKhNBndf+CzO0oimD4wlE06W7Qq5FM6kXtGeGR0Axc1bWvm9HOhYhrOB9ULQ5cw/7sYJzpHSOEHYRyM/ueBzcqi/IFaxSSUdCxLOeFHyOhgTdd5LcDMMW1gTtgh3j5JCnnbYX9ZQ08Swi/JxFOBjZEf1seLjdzlYz3Fu6P9sd1Ytpbd5gzpaVhpohQPh4FUCO6t9eKcCMhVBJDbUB8nA+2OJPEHXxu0mOaitXi2lxNP2KNXM1l2iK843Tb0pZrYEOSctyULMJXMWA1une4cHHQi1gjV2fo1fB+8hi1Gp50+h85fUMtn4vXqHsI1avZHpGyM26HxJVdGa8HwbxGE1KHOO9TYCV5uyvJx0NUD7COiwmv5YZTK4kLXQDGgTgiFvIj1v2e7LopWa0eZmp96uIuKPc7RtYnekI5EencU4vzvtGI5JZIF7tpOr7QLJ7to/xhgupTx8oujm7WV4riEmfsqP/YIC0/zD/dCGGRK3IHegZgG+33oO/LsAgPumifmFEvGpV0anxo+UUxs/0LmN2ejFMUXGlzWZSZi+s6G/lyBmiUMmVBq/6eb50IFxEuq7WSuDXICSF84FJwa34umtewngx8w608OBFCydeQho0nxEDQCQDfkGu9l6r/PYhOXzpdyD/VGsqNWs3dHgAAAABJRU5ErkJggg==`,monochrome:!1},traex:{src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAF9SURBVHgB7Zm9SsNQFMf/EYWiVB2KKGLBScHFN9BJurmoa0dn9QGqD1CdHbtWFzd10jfQQdBJqIgKGYw4VCR+nGD0ptqmsSectD0/CKXpbXJ+3HvOyYfVP5B+RxvTgzZHBaRRAWlUQBoVkEYFpOkNGzC0MgtJnPJZw99DBcZ2FiFJmIDmgDSdn8S1PB9d4aFwiDgY2cwhnZuK9J/IAq5TxevNI+Lg7amKqGgO/DrgYIplTNPnAyN9E8OYPF5FZmOu7hgKPrufZ+svkXOgHhR8di/vfWbW5719dvE0MMYPPjUz6m3E3doBWoFlBszgfUjCnAkzeB+6TGl1JuJNYuOJk/W1ccMiQGW1slwKlFe7eAJ7+2cJuZ8lsrJUwsvF/fc+us5JxBIiTIna4H1MCY7gCbYkJij464Xdhg3Jl3D/0bT+gj0HmummXMET2omlCc2By/GtwHeq3dO3BSQFXULSdN8dGdV6p3yOpGDpOzJhVEAaFZBGBaRRAWlUQJoPEeV5RYlN/QYAAAAASUVORK5CYII=`,monochrome:!1}},CT=`local`,wT={starting:`Starting…`,installing:`Installing…`,updating:`Updating…`,verifying:`Verifying installation…`,complete:`Complete`};function TT(){let[e,t]=(0,u.useState)(null),[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)({}),c=(0,u.useRef)(0),l=(0,u.useCallback)(async(e=!1)=>{let n=++c.current;e&&a(!0),r(null);try{let e=await Y.listProviderClis(CT);n===c.current&&t(e)}catch(e){n===c.current&&(t(null),r(e instanceof Error?e.message:String(e)))}finally{n===c.current&&a(!1)}},[]);(0,u.useEffect)(()=>{l()},[l]);let d=async(e,t)=>{try{let n=(await Y.startProviderCliOperation(CT,e,t)).job;for(s(t=>({...t,[e]:n}));n.state===`running`;)await PT(750),n=await Y.getProviderCliJob(CT,n.id),s(t=>({...t,[e]:n}));n.state===`succeeded`?(V.success(`${NT(e)} ${t} completed`),await l(),s(t=>{let n={...t};return delete n[e],n})):V.error(n.error??`${NT(e)} ${t} failed`)}catch(t){V.error(t.message),s(t=>{let n={...t};return delete n[e],n})}};return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Providers`}),(0,H.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs text-[var(--muted-foreground)]`,children:`Inspect and manage the coding-agent providers installed on this device.`})]}),(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:i,onClick:()=>void l(!0),children:[(0,H.jsx)(zr,{className:i?`animate-spin`:``}),`Refresh`]})})]}),n&&(0,H.jsxs)(`div`,{className:`rounded-lg border border-[var(--destructive)]/35 bg-[var(--destructive)]/8 px-4 py-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-[var(--destructive)]`,children:[(0,H.jsx)(ci,{className:`size-4`}),` Could not inspect Providers`]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:n}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,className:`mt-3`,onClick:()=>void l(!0),children:[(0,H.jsx)(zr,{}),` Retry`]})]}),e===null&&!n?(0,H.jsx)(`div`,{className:`grid gap-3`,"aria-label":`Loading Providers`,children:[0,1,2].map(e=>(0,H.jsx)(DT,{},e))}):(0,H.jsx)(`div`,{className:`grid gap-3`,children:e?.providerClis.map(t=>(0,H.jsx)(ET,{provider:t,job:o[t.id],readOnly:e.management===`read_only`,onOperation:d},t.id))})]})}function ET({provider:e,job:t,readOnly:n,onOperation:r}){let i=e.availability===`installed`?e.updateState===`available`&&e.canUpdate?`update`:void 0:e.canInstall?`install`:void 0,a=t?.state===`running`;return(0,H.jsx)(fC,{className:`min-w-0`,children:(0,H.jsxs)(hC,{className:`grid gap-3 p-4 text-xs`,children:[(0,H.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 md:col-span-2 xl:col-span-1`,children:[(0,H.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--background)]`,children:(0,H.jsx)(`img`,{src:ST[e.id].src,alt:``,"aria-hidden":`true`,className:X(`size-full object-cover`,ST[e.id].monochrome&&`brightness-0 dark:invert`)})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(mC,{children:e.name}),(0,H.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]`,children:e.binary})]})]}),(0,H.jsx)(kT,{icon:yr,label:`Executable`,value:e.executablePath??`Not found on Runtime PATH`,mono:!0}),(0,H.jsx)(kT,{icon:zr,label:`Version`,value:jT(e),mono:!0,noWrap:!0}),(0,H.jsx)(kT,{icon:mr,label:`Authentication`,value:MT(e)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:col-span-2 xl:col-span-1 xl:justify-end`,children:[(0,H.jsx)(OT,{provider:e}),!n&&i&&(0,H.jsx)(AT,{provider:e,operation:i,disabled:a,onConfirm:()=>r(e.id,i)})]})]}),e.error&&(0,H.jsx)(`p`,{className:`rounded-md bg-[var(--destructive)]/8 px-2.5 py-2 text-[11px] text-[var(--destructive)]`,children:e.error}),t&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-[var(--muted)]/45 px-2.5 py-2 text-[11px]`,children:[a?(0,H.jsx)(zr,{className:`size-3.5 animate-spin text-[var(--primary)]`}):t.state===`succeeded`?(0,H.jsx)(Vn,{className:`size-3.5 text-[var(--success)]`}):(0,H.jsx)(ci,{className:`size-3.5 text-[var(--destructive)]`}),(0,H.jsx)(`span`,{children:t.error??wT[t.stage]})]})]})})}function DT(){return(0,H.jsxs)(`div`,{"aria-hidden":`true`,className:`grid animate-pulse gap-4 rounded-xl border border-[var(--border)] p-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2 xl:col-span-1`,children:[(0,H.jsx)(`div`,{className:`size-9 rounded-lg bg-[var(--muted)]`}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(`div`,{className:`h-3.5 w-20 rounded bg-[var(--muted)]`}),(0,H.jsx)(`div`,{className:`h-2.5 w-12 rounded bg-[var(--muted)]`})]})]}),[`w-full`,`w-24`,`w-32`].map((e,t)=>(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(`div`,{className:`h-2.5 w-16 rounded bg-[var(--muted)]`}),(0,H.jsx)(`div`,{className:`h-3 rounded bg-[var(--muted)] ${e}`})]},t)),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 md:col-span-2 xl:col-span-1 xl:justify-end`,children:[(0,H.jsx)(`div`,{className:`h-5 w-24 rounded-full bg-[var(--muted)]`}),(0,H.jsx)(`div`,{className:`h-8 w-24 rounded-md bg-[var(--muted)]`})]})]})}function OT({provider:e}){return e.availability===`missing`?(0,H.jsx)(MC,{variant:`warning`,children:`Not installed`}):e.availability===`broken`?(0,H.jsx)(MC,{variant:`destructive`,children:`Unavailable`}):e.updateState===`available`?(0,H.jsx)(MC,{variant:`warning`,children:`New version`}):(0,H.jsx)(MC,{variant:`success`,children:`Installed`})}function kT({icon:e,label:t,value:n,mono:r=!1,noWrap:i=!1}){return(0,H.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2`,children:[(0,H.jsx)(e,{className:`mt-0.5 size-3.5 text-[var(--muted-foreground)]`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-[var(--muted-foreground)]`,children:t}),(0,H.jsx)(`div`,{className:X(`mt-0.5`,r&&`font-mono text-[11px]`,r&&!i&&`break-all`,i&&`whitespace-nowrap`),children:n})]})]})}function AT({provider:e,operation:t,disabled:n,onConfirm:r}){let i=t===`install`?`Install`:`Update`;return(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsxs)(J,{size:`sm`,className:`w-full sm:w-auto`,disabled:n,children:[n?(0,H.jsx)(zr,{className:`animate-spin`}):(0,H.jsx)(Yn,{}),n?`Working…`:i]})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsxs)(vu,{children:[i,` `,e.name,`?`]}),(0,H.jsxs)(yu,{children:[`Rynx will run `,e.name,`'s official `,t,` mechanism on this Runtime. The daemon will verify the executable and version when it finishes.`]})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{onClick:()=>void r(),children:i})]})]})]})}function jT(e){return e.currentVersion?e.latestVersion?e.updateState===`available`?`${e.currentVersion} → ${e.latestVersion}`:`${e.currentVersion} · latest`:`${e.currentVersion} · latest unknown`:e.availability===`missing`?`—`:`Unknown`}function MT(e){let t=e.authMode?` · ${e.authMode}`:``;return e.authState===`ready`?`Authenticated${t}`:e.authState===`required`?`Sign-in required${t}`:`Unknown${t}`}function NT(e){return e===`codex`?`Codex`:e===`claude`?`Claude Code`:`Traex`}function PT(e){return new Promise(t=>window.setTimeout(t,e))}function FT(e,t){if(e instanceof Hx)switch(e.code){case`offer_expired`:return`This Share Link has expired. Generate a new link on the remote Host and try again.`;case`offer_rejected`:return`The remote Host rejected this Share Link. It may already have been used, expired, or revoked. Generate a new link and use it once.`;case`invalid_offer`:return`This is not a valid Rynx Share Link. Copy and paste the complete link from the remote Host.`}return`${t} failed: ${e instanceof Error?e.message:String(e)}`}function IT(){let{runtimeSelector:e,selectRuntime:t,updateRuntimes:n}=xS(),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)({}),[m,h]=(0,u.useState)({});async function g(){try{let e=await Y.listRuntimes();i(e),n(e)}catch(e){i([]),V.error(`Failed to load Runtimes: ${e.message}`)}}(0,u.useEffect)(()=>{g()},[]);async function _(e){d(e.selector);try{let t=await Y.testRuntime(e.selector);p(n=>({...n,[e.selector]:t})),h(t=>{let n={...t};return delete n[e.selector],n}),V.success(`${e.displayName} is reachable`)}catch(t){p(t=>{let n={...t};return delete n[e.selector],n});let n={code:t instanceof Hx?t.code:void 0,message:t.message};h(t=>({...t,[e.selector]:n})),V.error(n.code===`authentication_failed`?`Authorization is no longer valid. Generate a new Share Link on the remote host, then reauthorize this Runtime.`:`Connection test failed: ${n.message}`)}finally{d(null)}}async function v(n){try{await Y.forgetRuntime(n.daemonId),p(e=>{let t={...e};return delete t[n.selector],t}),h(e=>{let t={...e};return delete t[n.selector],t}),V.success(`Forgot ${n.displayName}`),e===n.selector&&t(`local`),await g()}catch(e){V.error(`Forget failed: ${e.message}`)}}return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsx)(RT,{}),(0,H.jsxs)(fC,{children:[(0,H.jsxs)(pC,{className:`items-start`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsxs)(mC,{children:[`Runtimes`,` `,(0,H.jsx)(`span`,{className:`ml-1 text-[var(--muted-foreground)]`,children:r?.length??0})]}),(0,H.jsx)(`p`,{className:`max-w-2xl text-xs text-[var(--muted-foreground)]`,children:`Pair this Control Plane with remote Rynx daemons. Client keys stay in the local backend and never enter the browser.`})]}),(0,H.jsxs)(J,{size:`sm`,onClick:()=>o(!0),children:[(0,H.jsx)(Ir,{}),` Add Runtime`]})]}),(0,H.jsx)(hC,{className:`p-0`,children:(0,H.jsxs)(`div`,{className:`divide-y divide-[var(--border)]`,children:[r===null&&(0,H.jsx)(`div`,{className:`px-5 py-10 text-center text-sm text-[var(--muted-foreground)]`,children:`Loading Runtimes…`}),r?.map(e=>{let t=f[e.selector],n=m[e.selector]?.code===`authentication_failed`;return(0,H.jsxs)(`article`,{className:`grid gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)(`div`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:e.binding===`local`?(0,H.jsx)(hr,{className:`size-4`}):(0,H.jsx)(Wr,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`font-medium`,children:e.displayName}),(0,H.jsx)(MC,{variant:e.binding===`local`?`default`:`outline`,children:e.binding}),t&&(0,H.jsxs)(MC,{variant:`success`,children:[(0,H.jsx)(Vn,{className:`mr-1 size-3`}),` reachable`]}),n&&(0,H.jsxs)(MC,{variant:`warning`,children:[(0,H.jsx)(Xr,{className:`size-3`}),` authorization required`]})]}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-[var(--muted-foreground)]`,children:e.daemonId}),e.endpoint&&(0,H.jsx)(`div`,{className:`mt-1 truncate text-xs text-[var(--muted-foreground)]`,children:e.endpoint}),e.identityKeyFingerprint&&(0,H.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5 truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:[(0,H.jsx)(Yr,{className:`size-3 shrink-0`}),e.identityKeyFingerprint]}),t&&(0,H.jsxs)(`div`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:[`Instance `,t.status.daemonInstanceId]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[e.binding===`direct`&&(0,H.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>c(e),children:[(0,H.jsx)(Yr,{}),`Reauthorize`]}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:l===e.selector,onClick:()=>void _(e),children:[(0,H.jsx)(zr,{className:l===e.selector?`animate-spin`:``}),`Test`]}),e.binding===`direct`&&(0,H.jsx)(JT,{target:e,onForget:()=>v(e)})]})]},e.selector)})]})})]}),(0,H.jsx)(`div`,{className:`rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 px-4 py-3 text-xs text-[var(--muted-foreground)]`,children:`Sessions, terminals, and Session-scoped resources follow the selected Runtime. The standalone Emulator manager in Settings controls This device only. A remote failure never falls back to this device.`}),(0,H.jsx)(qT,{open:a,onOpenChange:o,onAdded:async e=>{p(t=>({...t,[e.target.selector]:e})),await g()}}),(0,H.jsx)(qT,{open:s!==null,target:s,onOpenChange:e=>{e||c(null)},onAdded:async e=>{p(t=>({...t,[e.target.selector]:e})),h(t=>{let n={...t};return delete n[e.target.selector],n}),await g()}})]})}var LT=`__rynx_custom_share_address__`;function RT(){let[e,t]=(0,u.useState)(null),[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(!1),[d,f]=(0,u.useState)(``),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(``),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),x=(0,u.useRef)(null),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(!1),[O,k]=(0,u.useState)(null),[A,j]=(0,u.useState)(null),M=(0,u.useCallback)(async(e=!1)=>{D(!0);try{C(await Y.listRuntimeAccess()),T(null),e&&V.success(`Shared access refreshed`)}catch(t){let n=t.message;T(n),e&&V.error(`Failed to refresh shared access: ${n}`)}finally{D(!1)}},[]),N=(0,u.useCallback)(async(e=!1)=>{s(!0);try{let n=await Y.listRuntimeShareAddresses();t(n),a(null),r(e=>e?.kind===`custom`||e&&n.some(t=>t.address===e.address)?e:n[0]?{kind:`detected`,address:n[0].address}:null),e&&V.success(`Network addresses refreshed`)}catch(n){let r=n.message;t(e=>e??[]),a(r),e&&V.error(`Failed to refresh network addresses: ${r}`)}finally{s(!1)}},[]);(0,u.useEffect)(()=>{M(),N()},[M,N]);let P=n?.address??``,F=h.trim(),I=y&&y.address===P.trim()&&y.clientLabel===F?y.code:``;function L(t){if(t===LT){f(n?.kind===`custom`?n.address:``),m(!1),l(!0);return}t!==VT(n)&&e?.some(e=>e.address===t)&&r({kind:`detected`,address:t})}function ee(){let e=d.trim();if(!HT(e)){m(!0);return}r({kind:`custom`,address:e}),l(!1),m(!1)}async function te(){let e=P.trim();if(!e){V.error(`Choose an address that the other device can reach`);return}v(!0);try{let t=await Y.shareRuntime({address:e,...F?{clientLabel:F}:{}});b({code:t.pairingCode,address:e,clientLabel:F}),V.success(`Pairing link generated`),await M()}catch(e){V.error(`Failed to generate pairing link: ${e.message}`)}finally{v(!1)}}async function ne(){if(!I)return;let e=await NC(I,x.current);e===`clipboard`||e===`selection`?V.success(`Pairing link copied`):e===`selected`?V.info(`Pairing link selected — press Ctrl+C or ⌘C to copy`):V.error(`Copy is unavailable — select the pairing link and copy it manually`)}async function re(e){k(e.grantId);try{let t=await Y.revokeRuntimeAccess(e.grantId);V.success(`Revoked ${GT(e)}${t.closedConnections>0?` and closed ${t.closedConnections} active connection${t.closedConnections===1?``:`s`}`:``}`),await M()}catch(e){V.error(`Revoke failed: ${e.message}`)}finally{k(null)}}async function R(e){j(e.grantId);try{await Y.deleteRevokedRuntimeAccess(e.grantId),V.success(`Removed revoked access record for ${GT(e)}`),await M()}catch(e){V.error(`Remove failed: ${e.message}`)}finally{j(null)}}let ie=S?.filter(e=>e.revokedAt===null).length??0;return(0,H.jsxs)(fC,{children:[(0,H.jsx)(pC,{className:`items-start`,children:(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(qr,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(mC,{children:`Share this device`}),(0,H.jsx)(`p`,{className:`max-w-2xl text-xs text-[var(--muted-foreground)]`,children:`Generate a revocable pairing link so another Rynx Control Plane can connect to this Runtime. Use a LAN, Tailscale, or tunnel address reachable from that device.`})]})]})}),(0,H.jsxs)(hC,{className:`grid gap-6`,children:[(0,H.jsxs)(`form`,{className:`grid gap-3`,onSubmit:e=>{e.preventDefault(),te()},children:[(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] md:items-end`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{htmlFor:`runtime-share-address`,children:`Connection address`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 gap-1.5`,children:[(0,H.jsxs)(my,{value:n?.kind===`custom`?VT(n):n?.address,onValueChange:L,disabled:e===null,children:[(0,H.jsx)(_y,{id:`runtime-share-address`,className:`min-w-0 flex-1`,"aria-describedby":`runtime-share-address-help`,children:(0,H.jsx)(gy,{placeholder:e===null?`Detecting addresses…`:`No address detected`,children:n?.kind===`custom`?n.address:n?BT(e??[],n.address):void 0})}),(0,H.jsxs)(by,{align:`start`,children:[n?.kind===`custom`&&(0,H.jsxs)(Sy,{value:VT(n),children:[`Custom (`,n.address,`)`]}),e?.map(e=>(0,H.jsx)(Sy,{value:e.address,children:zT(e)},e.address)),(n?.kind===`custom`||!!e?.length)&&(0,H.jsx)(Cy,{}),(0,H.jsx)(Sy,{value:LT,children:`Enter custom address…`})]})]}),(0,H.jsx)(J,{type:`button`,variant:`outline`,size:`icon`,disabled:o,"aria-label":`Refresh network addresses`,title:`Refresh network addresses`,onClick:()=>void N(!0),children:(0,H.jsx)(zr,{className:o?`animate-spin`:``})})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{htmlFor:`runtime-share-label`,children:`Client label`}),(0,H.jsx)(Ag,{id:`runtime-share-label`,value:h,onChange:e=>g(e.target.value),placeholder:`Alice’s laptop (optional)`,maxLength:128})]}),(0,H.jsxs)(J,{type:`submit`,disabled:_||!n,children:[_?(0,H.jsx)(zr,{className:`animate-spin`}):(0,H.jsx)(_r,{}),`Generate Link`]})]}),(0,H.jsx)(`p`,{id:`runtime-share-address-help`,className:i?`text-xs text-[var(--destructive)]`:`text-xs text-[var(--muted-foreground)]`,role:i?`alert`:void 0,children:i?`Could not refresh network addresses: ${i}`:n?.kind===`custom`?`Using a custom host or ws(s) endpoint. Make sure the other device can reach it.`:e?.length?`Detected from this device. Tailnet addresses are listed first.`:e===null?`Looking for reachable IPv4 interfaces on this device…`:`No reachable IPv4 interface was found. Check the Runtime listener or enter a custom address.`}),I&&(0,H.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3`,children:[(0,H.jsx)(GS,{htmlFor:`runtime-pairing-code`,children:`Pairing link`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,H.jsx)(Ag,{id:`runtime-pairing-code`,ref:x,value:I,readOnly:!0,className:`font-mono text-xs`,spellCheck:!1}),(0,H.jsxs)(J,{type:`button`,variant:`outline`,onClick:()=>void ne(),children:[(0,H.jsx)(Jn,{}),` Copy`]})]}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Treat this link as a credential. After it is used, the client appears below and can be revoked.`})]})]}),(0,H.jsxs)(`section`,{className:`grid gap-3 border-t border-[var(--border)] pt-4`,"aria-labelledby":`runtime-access-title`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`h2`,{id:`runtime-access-title`,className:`text-sm font-medium`,children:[`Shared access `,(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:ie})]}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-[var(--muted-foreground)]`,children:`Active clients can reconnect until their grant is revoked.`})]}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:E,"aria-label":`Refresh shared access`,onClick:()=>void M(!0),children:(0,H.jsx)(zr,{className:E?`animate-spin`:``})})]}),S===null&&!w&&(0,H.jsx)(`div`,{className:`py-4 text-center text-xs text-[var(--muted-foreground)]`,role:`status`,children:`Loading shared access…`}),w&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2`,children:[(0,H.jsxs)(`p`,{className:`text-xs text-[var(--destructive)]`,role:`alert`,children:[`Could not load shared access: `,w]}),(0,H.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void M(),children:`Retry`})]}),S?.length===0&&!w&&(0,H.jsx)(`div`,{className:`rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-center text-xs text-[var(--muted-foreground)]`,children:`No shared Runtime access yet.`}),S&&S.length>0&&(0,H.jsx)(`ul`,{className:`divide-y divide-[var(--border)] overflow-hidden rounded-lg border border-[var(--border)]`,children:S.map(e=>(0,H.jsxs)(`li`,{className:`grid gap-3 px-3 py-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:GT(e)}),(0,H.jsxs)(MC,{variant:e.revokedAt?`destructive`:`success`,children:[e.revokedAt?(0,H.jsx)(Xr,{className:`size-3`}):(0,H.jsx)(Yr,{className:`size-3`}),e.revokedAt?`revoked`:`active`]})]}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:e.grantId}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:e.lastUsedAt?`Last used ${KT(e.lastUsedAt)}`:`Created ${KT(e.createdAt)} · never connected`})]}),e.revokedAt?(0,H.jsx)(WT,{client:e,disabled:A===e.grantId,onRemove:()=>R(e)}):(0,H.jsx)(UT,{client:e,disabled:O===e.grantId,onRevoke:()=>re(e)})]},e.grantId))})]})]}),(0,H.jsx)(Su,{open:c,onOpenChange:e=>{l(e),e||m(!1)},children:(0,H.jsxs)(Du,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Ou,{children:[(0,H.jsx)(Au,{children:`Enter custom address`}),(0,H.jsx)(ju,{children:`Use a DNS name, custom port, reverse proxy, or tunnel when the detected interfaces are not the route the other device should dial.`})]}),(0,H.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),ee()},children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{htmlFor:`runtime-custom-share-address`,children:`Host or WebSocket URL`}),(0,H.jsx)(Ag,{id:`runtime-custom-share-address`,value:d,onChange:e=>{f(e.target.value),e.target.value.trim()&&m(!1)},placeholder:`runtime.example.com or wss://runtime.example.com`,maxLength:2048,"aria-invalid":p,"aria-describedby":`runtime-custom-share-address-help`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,autoFocus:!0}),(0,H.jsx)(`p`,{id:`runtime-custom-share-address-help`,className:p?`text-xs text-[var(--destructive)]`:`text-xs text-[var(--muted-foreground)]`,children:p?`Enter a host or a complete ws:// or wss:// URL without spaces.`:`Rynx adds the listener port for a host and supplies the Runtime path.`})]}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(Tu,{asChild:!0,children:(0,H.jsx)(J,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,H.jsx)(J,{type:`submit`,disabled:!d.trim(),children:`Use Address`})]})]})]})})]})}function zT(e){return`${e.interfaceName} (${e.address})`}function BT(e,t){let n=e.find(e=>e.address===t);return n?zT(n):t}function VT(e){return e?.kind===`custom`?`__rynx_custom_share_address_current__:${e.address}`:void 0}function HT(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function UT({client:e,disabled:t,onRevoke:n}){return(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsxs)(J,{type:`button`,variant:`destructive`,size:`sm`,disabled:t,children:[t?(0,H.jsx)(zr,{className:`animate-spin`}):(0,H.jsx)(Xr,{}),`Revoke`]})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsxs)(vu,{children:[`Revoke access for “`,GT(e),`”?`]}),(0,H.jsx)(yu,{children:`This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately.`})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:()=>void n(),children:`Revoke Access`})]})]})]})}function WT({client:e,disabled:t,onRemove:n}){return(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:t,children:[t?(0,H.jsx)(zr,{className:`animate-spin`}):(0,H.jsx)(si,{}),`Remove Record`]})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsxs)(vu,{children:[`Remove revoked record for “`,GT(e),`”?`]}),(0,H.jsx)(yu,{children:`This removes the revoked authorization record from this Host. It does not restore access or delete the credential stored on the client device.`})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:()=>void n(),children:`Remove Record`})]})]})]})}function GT(e){return e.clientLabel??e.clientId}function KT(e){let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function qT({open:e,target:t=null,onOpenChange:n,onAdded:r}){let[i,a]=(0,u.useState)(``),[o,s]=(0,u.useState)(``),[c,l]=(0,u.useState)(!1),d=t!==null;(0,u.useEffect)(()=>{e&&(a(t?.displayName??``),s(``))},[e,t]);async function f(){let e=o.trim();if(e){l(!0);try{let o=await Y.pairRuntime({offer:e,...i.trim()?{displayName:i.trim()}:{},...t?{replaceExisting:!0,expectedDaemonId:t.daemonId}:{}});V.success(d?`Reauthorized ${o.target.displayName}`:`Paired ${o.target.displayName}`),await r(o),a(``),s(``),n(!1)}catch(e){V.error(FT(e,d?`Reauthorization`:`Pairing`))}finally{l(!1)}}}return(0,H.jsx)(Su,{open:e,onOpenChange:n,children:(0,H.jsxs)(Du,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Ou,{children:[(0,H.jsx)(Au,{children:d?`Reauthorize Runtime`:`Add Runtime`}),(0,H.jsx)(ju,{children:d?`Generate a fresh Share Link on the remote Host and paste it here. The old local credential is replaced only after the new connection is authenticated.`:`On the remote host, share the Runtime and paste its pairing link here. The local backend keeps the resulting client credential out of the browser.`})]}),(0,H.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,H.jsxs)(`div`,{className:`grid gap-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{htmlFor:`runtime-name`,children:`Display name`}),(0,H.jsx)(Ag,{id:`runtime-name`,value:i,onChange:e=>a(e.target.value),placeholder:`Remote lab`,maxLength:128})]}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(GS,{htmlFor:`runtime-offer`,children:`Pairing link`}),(0,H.jsx)(Ag,{id:`runtime-offer`,value:o,onChange:e=>s(e.target.value),placeholder:`rynx://pair?code=...`,className:`font-mono text-xs`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1}),(0,H.jsxs)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:[`Generate one from`,` `,(0,H.jsx)(`span`,{className:`font-medium text-[var(--foreground)]`,children:`Share this device`}),` on the remote Control Plane.`]})]})]}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(Tu,{asChild:!0,children:(0,H.jsx)(J,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,H.jsxs)(J,{type:`submit`,disabled:c||!o.trim(),children:[c?(0,H.jsx)(zr,{className:`animate-spin`}):(0,H.jsx)(Yr,{}),d?`Reauthorize`:`Add Runtime`]})]})]})]})})}function JT({target:e,onForget:t}){return(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsxs)(J,{variant:`ghost`,size:`sm`,className:`text-[var(--destructive)]`,children:[(0,H.jsx)(si,{}),(0,H.jsxs)(`span`,{className:`sr-only`,children:[`Forget `,e.displayName]})]})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsxs)(vu,{children:[`Forget “`,e.displayName,`”?`]}),(0,H.jsxs)(yu,{children:[`Removes this route and its protected client credential from the local Control Plane. The remote grant remains until an operator runs `,(0,H.jsx)(`code`,{children:`rynx runtime clients revoke`}),`on that daemon.`]})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:()=>void t(),children:`Forget Runtime`})]})]})]})}function YT(e,t){return t===`install`||e?.phase===`installing`}var XT=`rynx.control.session-launch-selection.v2`,ZT=`default`;function QT(e){return`${e.kind}:${e.id}`}function $T(e){return e===`provider:claude`?{kind:`provider`,id:`claude`}:e===`provider:codex`?{kind:`provider`,id:`codex`}:e===`provider:traex`?{kind:`provider`,id:`traex`}:e.startsWith(`agent:`)&&e.length>6?{kind:`agent`,id:e.slice(6)}:null}function eE(e,t){return e.kind===`provider`?t.providers.some(t=>t.id===e.id):t.agents.some(t=>t.id===e.id)}function tE(e,t){let n=t?$T(t):null;if(n&&eE(n,e)&&(n.kind===`agent`&&e.agents.some(e=>e.id===n.id&&e.ready)||n.kind===`provider`&&e.providers.some(e=>e.id===n.id&&e.ready)))return n;for(let t of[`claude`,`codex`,`traex`])if(e.providers.some(e=>e.id===t&&e.ready))return{kind:`provider`,id:t};let r=e.providers.find(e=>e.ready);if(r)return{kind:`provider`,id:r.id};let i=e.agents.find(e=>e.ready);return i?{kind:`agent`,id:i.id}:e.providers[0]?{kind:`provider`,id:e.providers[0].id}:e.agents[0]?{kind:`agent`,id:e.agents[0].id}:null}function nE(e,t){if(!t)return null;try{return t.getItem(iE(e))}catch{return null}}function rE(e,t,n){if(t)try{t.setItem(iE(e),QT(n))}catch{}}function iE(e){return`${XT}:${encodeURIComponent(e)}`}function aE(e,t,n,r){let i=n?{projectId:n}:{},a=r?.permissionPreset&&r.permissionPreset!=="default"?{permissionPreset:r.permissionPreset}:{};return e.kind===`provider`?{provider:e.id,title:t,...i,...r?.model?{model:r.model}:{},...r?.reasoningEffort?{reasoningEffort:r.reasoningEffort}:{},...a}:{agent:e.id,title:t,...i,...a}}function oE(e,t,n=ZT){if(!e||e.kind!==`provider`)return{permissionPreset:n};let r=t.providers.find(t=>t.id===e.id),i=r?.models?.find(e=>e.isDefault)??r?.models?.[0],a=i?.defaultReasoningEffort&&i.reasoningOptions.some(e=>e.value===i.defaultReasoningEffort)?i.defaultReasoningEffort:i?.reasoningOptions.find(e=>e.value===`medium`)?.value??i?.reasoningOptions[0]?.value;return{permissionPreset:n,...i?{model:i.id}:{},...a?{reasoningEffort:a}:{}}}function sE(e){let t=e.replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length<=64?t:`${n.slice(0,61).join(``).trimEnd()}…`}function cE(e){return{providers:[],agents:e.map(e=>({...e,ready:!0,readiness:`unverified`}))}}function lE(e){return e.readiness===`unverified`?`unverified`:e.ready?`ready`:`needs_setup`}function uE(e){return e===`claude`?`Claude Code`:e===`traex`?`Traex`:`Codex`}function dE(e,t){if(!e)return null;if(e.kind===`provider`)return t.providers.find(t=>t.id===e.id)??null;let n=t.agents.find(t=>t.id===e.id);return n?{name:n.name??n.id,ready:n.ready,...n.reason?{reason:n.reason}:{},...n.readiness?{readiness:n.readiness}:{}}:null}var fE=ax,pE=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(ox,{ref:n,className:X(`inline-flex h-9 items-center gap-1 rounded-lg bg-[var(--muted)] p-1 text-[var(--muted-foreground)]`,e),...t}));pE.displayName=`TabsList`;var mE=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(sx,{ref:n,className:X(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none data-[state=active]:bg-[var(--background)] data-[state=active]:text-[var(--foreground)] data-[state=active]:shadow-sm`,e),...t}));mE.displayName=`TabsTrigger`;var hE=u.forwardRef(({className:e,...t},n)=>(0,H.jsx)(cx,{ref:n,className:X(`mt-4 focus-visible:outline-none`,e),...t}));hE.displayName=`TabsContent`;function gE(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:`idle`,backgroundTaskCount:0,waitingForInteraction:!1,todos:[],historyLoaded:!1}}function _E(e,t){return e===`startup`&&t!==void 0&&(/^Starting MCP servers?:/i.test(t)||/^MCP startup /i.test(t))}function vE(e){return e.filter(e=>`text`in e).map(e=>e.text).join(``)}function yE(e){let t=e.data.content.flatMap((e,t)=>`text`in e?[t]:[]);return t.length===1&&e.truncations?.some(({field:e})=>e===`data.content[${t[0]}].text`)===!0}function bE(e){return e.flatMap((e,t)=>e.type===`input_image`?[{...e,partIndex:t}]:[])}function xE(e){return e.flatMap((e,t)=>e.type===`input_file`?[{...e,partIndex:t}]:[])}function SE(e){let t=e.slice();for(let e=1;e<t.length;e+=1){let n=t[e],r=t[e-1];n.type!==`reasoning`||n.data.model!==`traex`||r.type!==`message`||r.data.role!==`assistant`||r.data.model!==`traex`||r.responseId!==n.responseId||n.createdAt<r.createdAt||n.createdAt-r.createdAt>500||(t[e]=r,t[e-1]=n)}return t}function CE(e){return{...e,items:e.items.slice(),byId:{...e.byId},callIndex:{...e.callIndex},interactionIndex:{...e.interactionIndex},pendingOutputs:{...e.pendingOutputs},pendingInteractionResolutions:{...e.pendingInteractionResolutions},childStates:{...e.childStates},turns:{...e.turns}}}function wE(e,t,n){e.items[t]=n}function TE(e,t){let n=e.items.length;return e.items.push(t),n}function EE(e,t){let n=gE();for(let e of SE(t))WE(n,e);for(let t of e.items){if(t.kind!==`message`||t.role!==`user`||!t.optimistic)continue;let e={...t,images:t.images.slice()};n.byId[e.id]=TE(n,e)}return n}function DE(e,t,n){if(!n)return;let r=e.turns[t];e.turns[t]=r?{...r,model:r.model??n}:{status:`completed`,model:n}}function OE(e){let t=0;for(let n of e)n.kind===`interaction`&&n.status===`pending`&&(t+=1),n.kind===`tool`&&n.children&&(t+=OE(n.children));return t}function kE(e){e.waitingForInteraction=OE(e.items)>0||Object.values(e.childStates).some(e=>e.waitingForInteraction)}function AE(e){let t={...e,status:`pending`};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function jE(e,t){return e.map(e=>e.kind===`interaction`?t.has(e.id)?AE(e):e.status===`pending`?{...e,status:`inactive`}:e:e.kind===`tool`&&e.children?{...e,children:jE(e.children,t)}:e)}function ME(e,t=new Set){for(let n of e)n.kind===`interaction`&&t.add(n.id),n.kind===`tool`&&n.children&&ME(n.children,t);return t}function NE(e,t){let n=new Set(t.pendingInteractions.map(({interaction:e})=>e.interactionId));for(let[t,r]of Object.entries(e.childStates)){let i=CE(r);i.items=jE(i.items,n),kE(i),e.childStates[t]=i;let a=e.callIndex[t];if(a!==void 0){let t=e.items[a];wE(e,a,{...t,children:i.items})}}e.items=jE(e.items,n);let r=ME(e.items);for(let t of Object.values(e.childStates))ME(t.items,r);for(let{responseId:n,interaction:i}of t.pendingInteractions){if(r.has(i.interactionId))continue;let t={kind:`interaction`,id:i.interactionId,responseId:n,request:i,status:`pending`};e.interactionIndex[i.interactionId]=TE(e,t),r.add(i.interactionId)}let i=new Set(t.activeResponseIds);for(let[t,n]of Object.entries(e.turns))i.has(t)||n.status===`running`&&(e.turns[t]={...n,status:`completed`},GE(e,t));KE(e,i);for(let t of i)e.turns[t]={...e.turns[t],status:`running`};e.runStatus=t.status,e.statusKind=t.statusKind,e.backgroundTaskCount=t.backgroundTaskCount??0,e.waitingForInteraction=n.size>0}function PE(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function FE(e,t,n,r){let i=e.byId[t];if(i!==void 0)return i;let a=TE(e,r());return e.byId[t]=a,a}function IE(e,t){e.items.splice(t,1);for(let n of[e.byId,e.callIndex,e.interactionIndex])for(let[e,r]of Object.entries(n))r===t?delete n[e]:r>t&&(n[e]=r-1)}function LE(e,t){for(let n=e.items.length-1;n>=0;--n){let r=e.items[n];r?.kind===`compaction`&&r.status===`in_progress`&&(t===void 0||r.responseId===t)&&IE(e,n)}}function RE(e,t){if(t){let n=e.byId[t];if(n!==void 0&&e.items[n]?.kind===`message`&&e.items[n].role===`user`&&e.items[n].optimistic)return n}return e.items.findIndex(e=>e.kind===`message`&&e.role===`user`&&e.optimistic)}function zE(e,t,n){let r={kind:`message`,id:t,responseId:t,role:`user`,text:vE(n),images:bE(n),files:xE(n),streaming:!1,optimistic:!0,pendingContent:n.map(e=>({...e}))},i=e.byId[t];if(i!==void 0){e.items[i]?.kind===`message`&&e.items[i].optimistic&&wE(e,i,r);return}e.byId[t]=TE(e,r)}function BE(e,t,n){let r=e.byId[t];if(r===void 0||e.items[r]?.kind!==`message`||!e.items[r].optimistic)return!1;let i=e.byId[n];if(i!==void 0&&i!==r)return IE(e,r),!0;let a=e.items[r];return delete e.byId[t],wE(e,r,{...a,id:n,responseId:n}),e.byId[n]=r,!0}function VE(e){let t=e=>{if(Array.isArray(e))return e.map(t);if(typeof e==`object`&&e){let n=e;return Object.fromEntries(Object.keys(n).sort().map(e=>[e,t(n[e])]))}return e};return JSON.stringify(t(e))}function HE(e,t,n=!1){let r=new Set(t.map(e=>e.pendingId));for(let n of t){if(e.byId[n.pendingId]===void 0){let t=VE(n.content),i=e.items.find(e=>e.kind===`message`&&e.role===`user`&&e.optimistic===!0&&!r.has(e.id)&&e.pendingContent!==void 0&&VE(e.pendingContent)===t);i&&BE(e,i.id,n.pendingId)}zE(e,n.pendingId,n.content)}if(n)for(let t=e.items.length-1;t>=0;--t){let n=e.items[t];n?.kind===`message`&&n.role===`user`&&n.optimistic&&!r.has(n.id)&&IE(e,t)}}function UE(e,t,n){let r=CE(e.childStates[t]??gE());WE(r,{...n,parentToolCallId:void 0}),kE(r),e.childStates[t]=r;let i=e.callIndex[t];if(i!==void 0){let t=e.items[i];wE(e,i,{...t,children:r.items})}}function WE(e,t,n,r=!1){if(t.parentToolCallId){UE(e,t.parentToolCallId,t);return}switch(t.type){case`message`:{DE(e,t.responseId,t.data.model);let i={kind:`message`,id:t.id,responseId:t.responseId,role:t.data.role,text:vE(t.data.content),images:bE(t.data.content),files:xE(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1,...yE(t)?{textPrefixTruncated:!0}:{}},a=e.byId[t.id];if(a!==void 0){if(wE(e,a,i),r&&t.data.role===`user`){let t=RE(e,n);t!==-1&&t!==a&&IE(e,t)}return}if(r&&t.data.role===`user`){let r=RE(e,n);if(r!==-1){let n=e.items[r];delete e.byId[n.id],wE(e,r,i),e.byId[t.id]=r;return}}e.byId[t.id]=TE(e,i);return}case`reasoning`:{DE(e,t.responseId,t.data.model);let n={kind:`reasoning`,id:t.id,responseId:t.responseId,summary:t.data.summary.map(e=>e.text),model:t.data.model,streaming:!1},r=e.byId[t.id];r===void 0?e.byId[t.id]=TE(e,n):wE(e,r,n);return}case`function_call`:{let n=t.data.callId,r=e.pendingOutputs[n],i=e.childStates[n]?.items,a={kind:`tool`,id:n,responseId:t.responseId,name:t.data.name,arguments:t.data.arguments,status:r?r.status??`completed`:t.status,output:r?.output,exitCode:r?.exitCode,generatedImage:r?.generatedImage,generatedImageItemId:r?.generatedImageItemId,...i&&i.length?{children:i}:{}};r&&delete e.pendingOutputs[n];let o=e.callIndex[n];o===void 0?e.callIndex[n]=TE(e,a):wE(e,o,a);return}case`function_call_output`:{let n=t.data.callId,r=e.callIndex[n];if(r===void 0){e.pendingOutputs[n]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode,generatedImage:t.data.generatedImage,generatedImageItemId:t.id};return}let i=e.items[r];wE(e,r,{...i,output:t.data.output,status:t.data.status??`completed`,exitCode:t.data.exitCode,generatedImage:t.data.generatedImage,generatedImageItemId:t.id});return}case`terminal_command`:{if(t.data.stdout!==void 0||t.data.stderr!==void 0)for(let n=e.items.length-1;n>=0;--n){let r=e.items[n];if(r?.kind===`terminal_command`&&r.responseId===t.responseId&&r.command===t.data.command&&r.stdout===void 0&&r.stderr===void 0){wE(e,n,{...r,...t.data.stdout===void 0?{}:{stdout:t.data.stdout},...t.data.stderr===void 0?{}:{stderr:t.data.stderr}}),e.byId[t.id]=n;return}}let n={kind:`terminal_command`,id:t.id,responseId:t.responseId,command:t.data.command,...t.data.stdout?{stdout:t.data.stdout}:{},...t.data.stderr?{stderr:t.data.stderr}:{}},r=e.byId[t.id];r===void 0?e.byId[t.id]=TE(e,n):wE(e,r,n);return}case`compaction`:{LE(e);let n={kind:`compaction`,id:t.id,responseId:t.responseId,status:`completed`,summary:t.data.summary,sequence:t.data.sequence},r=e.byId[t.id];r===void 0?e.byId[t.id]=TE(e,n):wE(e,r,n);return}case`interaction_request`:{let n=t.data.interaction,r=n.interactionId,i=e.interactionIndex[r],a=e.pendingInteractionResolutions[r],o=i===void 0?void 0:e.items[i],s={kind:`interaction`,id:r,responseId:t.responseId,request:n,status:o?.status??`pending`,...o?.resolution?{resolution:o.resolution}:{},...o?.reason?{reason:o.reason}:{},...o?.resolvedAt===void 0?{}:{resolvedAt:o.resolvedAt}};a&&(s=PE(s,a),delete e.pendingInteractionResolutions[r]),i===void 0?e.interactionIndex[r]=TE(e,s):wE(e,i,s),e.byId[t.id]=e.interactionIndex[r];return}case`interaction_resolution`:{let n=t.data,r=e.interactionIndex[n.interactionId];if(r===void 0){e.pendingInteractionResolutions[n.interactionId]={...n,responseId:t.responseId,itemId:t.id};return}let i=e.items[r];wE(e,r,PE(i,n)),e.byId[t.id]=r;return}case`error`:{let n={kind:`error`,id:t.id,responseId:t.responseId,source:t.data.source,code:t.data.code,message:t.data.message},r=e.byId[t.id];r===void 0?e.byId[t.id]=TE(e,n):wE(e,r,n);return}}}function GE(e,t){let n=e=>e===t;qE(e,n),e.items=YE(e.items,t);for(let[r,i]of Object.entries(e.childStates)){let a=CE(i);qE(a,n),a.items=YE(a.items,t),kE(a),e.childStates[r]=a;let o=e.callIndex[r];if(o!==void 0){let t=e.items[o];wE(e,o,{...t,children:a.items})}}}function KE(e,t){let n=e=>!t.has(e);qE(e,n);for(let[t,r]of Object.entries(e.childStates)){let i=CE(r);qE(i,n),kE(i),e.childStates[t]=i;let a=e.callIndex[t];if(a!==void 0){let t=e.items[a];wE(e,a,{...t,children:i.items})}}}function qE(e,t){for(let n=e.items.length-1;n>=0;--n){let r=e.items[n];r?.kind===`message`&&t(r.responseId)&&r.role===`assistant`&&r.liveDraft===!0&&IE(e,n)}}function JE(e,t){let n=e.items.filter(e=>e.kind===`message`&&e.responseId===t&&e.role===`assistant`&&e.liveDraft!==!0);if(n.length!==0)for(let r=e.items.length-1;r>=0;--r){let i=e.items[r];i?.kind===`message`&&i.responseId===t&&i.role===`assistant`&&i.liveDraft===!0&&n.some(e=>e.text===i.text||e.textPrefixTruncated===!0&&e.text.length>0&&i.text.startsWith(e.text))&&IE(e,r)}}function YE(e,t){return e.map(e=>{let n=e.kind===`tool`&&e.children?{...e,children:YE(e.children,t)}:e;return n.responseId===t?n.kind===`tool`&&n.status===`in_progress`?{...n,status:`incomplete`}:(n.kind===`message`||n.kind===`reasoning`)&&n.streaming?{...n,streaming:!1}:n.kind===`interaction`&&n.status===`pending`?{...n,status:`inactive`,reason:`Turn ended before this interaction was resolved`}:n:n})}function XE(e){return Object.values(e.turns).some(e=>e.status===`running`)}function ZE(e){e.note=void 0,e.statusKind=void 0}function QE(e,t){switch(t.type){case`session.status`:e.runStatus=t.status,t.runtimeSessionId&&(e.runtimeSessionId=t.runtimeSessionId),e.note=t.note,e.statusKind=t.statusKind,t.backgroundTaskCount===void 0?(t.status===`running`||t.status===`failed`)&&(e.backgroundTaskCount=0):e.backgroundTaskCount=t.backgroundTaskCount;return;case`session.collaboration_mode`:e.collaborationMode=t.mode;return;case`response.created`:e.turns[t.responseId]={status:`running`,model:t.model},e.runStatus=`running`,e.backgroundTaskCount=0,ZE(e);return;case`response.output_text.delta`:{ZE(e);let n=e.byId[t.itemId],r=n===void 0?void 0:e.items[n];if(t.discard===!0){n!==void 0&&r?.kind===`message`&&r.role===`assistant`&&r.responseId===t.responseId&&r.liveDraft===!0&&IE(e,n);return}let i=e.turns[t.responseId]?.status;if(i===`completed`||i===`failed`||i===`cancelled`||r?.kind===`message`&&r.role===`assistant`&&r.liveDraft!==!0)return;let a=FE(e,t.itemId,t.responseId,()=>({kind:`message`,id:t.itemId,responseId:t.responseId,role:`assistant`,text:``,images:[],files:[],streaming:!0,liveDraft:!0})),o=e.items[a];e.items[a]={...o,text:o.text+t.delta,streaming:!0},t.final&&JE(e,t.responseId);return}case`response.reasoning_summary_text.delta`:{ZE(e);let n=FE(e,t.itemId,t.responseId,()=>({kind:`reasoning`,id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),r=e.items[n],i=r.summary.slice();i[t.summaryIndex]=(i[t.summaryIndex]??``)+t.delta,e.items[n]={...r,summary:i,streaming:!0};return}case`response.function_call_output.delta`:{ZE(e);let n=e.callIndex[t.callId];if(n===void 0){let n=e.pendingOutputs[t.callId]??{output:``};e.pendingOutputs[t.callId]={...n,output:(n.output??``)+t.delta};return}let r=e.items[n];e.items[n]={...r,output:(r.output??``)+t.delta};return}case`session.interaction.requested`:{ZE(e),WE(e,t.item);let n=e.interactionIndex[t.interaction.interactionId];if(n!==void 0){let t=e.items[n];(t.status===`pending`||t.status===`inactive`)&&wE(e,n,AE(t))}return}case`session.interaction.resolved`:case`session.interaction.cancelled`:ZE(e),WE(e,t.item);return;case`session.interrupted`:{ZE(e);let n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:`cancelled`};let r=!1;for(let n=e.items.length-1;n>=0;--n){let i=e.items[n];if(i?.kind===`message`&&i.role===`assistant`&&i.responseId===t.responseId){e.items[n]={...i,interrupted:!0,streaming:!1,liveDraft:!1},r=!0;break}}if(!r){let n=`interrupted_${t.responseId}`;e.byId[n]===void 0&&(e.byId[n]=TE(e,{kind:`error`,id:n,responseId:t.responseId,source:`execution`,code:`response_stopped`,message:`Response stopped`}))}GE(e,t.responseId),e.runStatus=XE(e)?`running`:`idle`;return}case`response.output_item.done`:{ZE(e);let n=t.item;if(n.type===`message`&&n.data.role===`assistant`&&e.turns[t.responseId]?.status===`cancelled`){let r=e.byId[`interrupted_${t.responseId}`];r!==void 0&&IE(e,r),n={...n,data:{...n.data,interrupted:!0}}}WE(e,n);return}case`response.completed`:{ZE(e);let n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:n?.status===`cancelled`?`cancelled`:`completed`,usage:t.usage},GE(e,t.responseId),!XE(e)&&e.runStatus!==`failed`&&(e.runStatus=`idle`);return}case`response.failed`:{ZE(e);let n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:`failed`},e.items.some(e=>e.kind===`error`&&e.responseId===t.responseId&&e.code===t.error.code)||TE(e,{kind:`error`,id:`failed_${t.responseId}_${t.error.code}`,responseId:t.responseId,source:t.error.source,code:t.error.code,message:t.error.message}),GE(e,t.responseId),e.runStatus=XE(e)?`running`:`idle`;return}case`session.input.consumed`:ZE(e),WE(e,t.item,t.clearedPendingId,!0);return;case`session.todos`:e.todos=t.todos;return;case`response.compaction.in_progress`:{let n=`compaction_loading_${t.responseId??t.sessionId}`;e.byId[n]===void 0&&(e.byId[n]=TE(e,{kind:`compaction`,id:n,responseId:t.responseId??n,status:`in_progress`}));return}case`response.compaction.completed`:case`response.compaction.failed`:LE(e);return;case`session.rotated`:for(let t=e.items.length-1;t>=0;--t){let n=e.items[t];n?.kind===`message`&&n.role===`user`&&n.optimistic&&IE(e,t)}TE(e,{kind:`divider`,id:`rotate_${t.newSessionId}`,responseId:`rotate_${t.newSessionId}`,label:t.kind===`fork`?`forked to a new session`:`context cleared — new session`,newSessionId:t.newSessionId,rotateKind:t.kind}),e.runStatus=`idle`,e.backgroundTaskCount=0,ZE(e);return}}function $E(e,t){switch(t.kind){case`reset`:return gE();case`snapshot`:{let n=EE(e,t.items);return HE(n,t.pendingInputs??[]),NE(n,t.runtime),n.historyLoaded=!0,n}case`reconcile_snapshot`:{let n=CE(e);for(let e of SE(t.items))WE(n,e);return HE(n,t.pendingInputs??[],t.pruneMissingPending),NE(n,t.runtime),n.historyLoaded=!0,n.error=void 0,n}case`history`:{let n=EE(e,t.items);return kE(n),n.historyLoaded=!0,n}case`reconcile_history`:{let n=CE(e);for(let e of SE(t.items))WE(n,e);return kE(n),n.historyLoaded=!0,n.error=void 0,n}case`event`:{let n=CE(e);return QE(n,t.event),kE(n),n}case`optimistic_user`:{let n=CE(e);return zE(n,t.id,[...t.attachments??[],...t.text?[{type:`input_text`,text:t.text}]:[]]),n}case`discard_optimistic_user`:{let n=e.byId[t.id];if(n===void 0||e.items[n]?.kind!==`message`||!e.items[n].optimistic)return e;let r=CE(e);return IE(r,n),r}case`stream_error`:{let n=CE(e);return n.error=t.message,n}case`stream_done`:return e}}function eD(e){let t;for(let n of e.items){let r=e.turns[n.responseId];r&&(t=r)}return t}function tD(e){let t=!1,n=e.map(e=>e.kind===`error`?e.code===`codex_error`&&e.message===`Codex turn was interrupted`||e.code===`traex_error`&&e.message===`Traex turn was interrupted`?(t=!0,{...e,code:`response_stopped`,message:`Response stopped`}):e.code===`codex_error`&&e.message===`Codex turn failed`||e.code===`traex_error`&&e.message===`Traex turn failed`||e.code===`claude_error`&&e.message===`claude turn failed`?(t=!0,{...e,code:`agent_error`,message:`Agent turn failed`}):e:e);return t?n:e}var nD=`browser:`,rD=`emulator:`;function iD(e){return e?e===`browser`?{type:`browser`,pageId:null}:e.startsWith(nD)?{type:`browser`,pageId:e.slice(8).trim()||null}:e===`emulator`?{type:`emulator`,bindingId:null}:e.startsWith(rD)?{type:`emulator`,bindingId:e.slice(9).trim()||null}:null:null}function aD(e){return e?`${nD}${e}`:`browser`}function oD(e){return e?`${rD}${e}`:`emulator`}function sD(e,t){let n=new Set(t),r=new Set,i=[];for(let t of e)!n.has(t)||r.has(t)||(r.add(t),i.push(t));for(let e of t)r.has(e)||(r.add(e),i.push(e));return i}function cD(e,t){let n=Math.max(0,Math.max(0,e)-420);return Math.min(n,Math.max(Math.min(360,n),t))}function lD(e,t,n){return!e||e.pages.length===0?null:t&&e.pages.some(e=>e.pageId===t)?t:n&&e.pages.some(e=>e.pageId===n)?n:e.activePageId&&e.pages.some(t=>t.pageId===e.activePageId)?e.activePageId:e.pages[0]?.pageId??null}function uD(e,t){return!e||!t?.activePageId||e.includes(t.activePageId)?null:t.pages.some(e=>e.pageId===t.activePageId)?t.activePageId:null}var dD=/^[A-Za-z0-9][A-Za-z0-9._~-]*$/,fD=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,pD=/^[\x20-\x7e]*$/,mD=new Set([`accept-encoding`,`authorization`,`connection`,`content-length`,`cookie`,`host`,`keep-alive`,`origin`,`proxy-authenticate`,`proxy-authorization`,`proxy-connection`,`referer`,`set-cookie`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`user-agent`]);function hD(e){let t=_D(e,[`sessionId`,`expectedRevision`,`enabled`,`headers`],`browser.request-headers.set params`);return{sessionId:yD(t.sessionId,`browser.request-headers.set sessionId`),expectedRevision:yD(t.expectedRevision,`browser.request-headers.set expectedRevision`),...gD(t,`browser.request-headers.set params`)}}function gD(e,t){let n=xD(e.enabled,`${t} enabled`);if(!Array.isArray(e.headers))throw SD(`${t} headers must be an array`);if(e.headers.length>32)throw SD(`${t} headers exceeds 32 entries`);let r=new Set,i={enabled:n,headers:e.headers.map((e,n)=>{let i=_D(e,[`name`,`value`],`${t} headers[${n}]`),a=bD(i.name,`${t} headers[${n}] name`,128);if(!fD.test(a))throw SD(`${t} headers[${n}] name is not an HTTP header token`);let o=a.toLowerCase();if(mD.has(o)||o.startsWith(`proxy-`)||o.startsWith(`sec-`))throw SD(`${t} headers[${n}] name is controlled by the Browser`);if(r.has(o))throw SD(`${t} headers contains duplicate names`);if(r.add(o),typeof i.value!=`string`)throw SD(`${t} headers[${n}] value must be a string`);if(i.value.length>8192)throw SD(`${t} headers[${n}] value is too long`);if(!pD.test(i.value))throw SD(`${t} headers[${n}] value must be printable ASCII`);return{name:a,value:i.value}})};if(new TextEncoder().encode(JSON.stringify(i)).byteLength>24576)throw SD(`${t} exceeds its serialized byte limit`);return i}function _D(e,t,n){let r=vD(e,n),i=new Set(t);for(let e of Object.keys(r))if(!i.has(e))throw SD(`${n} contains unknown field ${e}`);return r}function vD(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw SD(`${t} must be an object`);return e}function yD(e,t){let n=bD(e,t,512);if(!dD.test(n))throw SD(`${t} must be an opaque ASCII token`);return n}function bD(e,t,n){if(typeof e!=`string`||e.length===0||e.length>n)throw SD(`${t} must be a non-empty string of at most ${n} characters`);return e}function xD(e,t){if(typeof e!=`boolean`)throw SD(`${t} must be a boolean`);return e}function SD(e){return TypeError(`Invalid Runtime Browser protocol: ${e}`)}var CD=5242880,wD=20971520,TD=8192,ED=4e7,DD=[`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/svg+xml`];function OD(){return{enabled:!0,mediaTypes:[...DD],maxImagesPerMessage:4,maxImageBytes:CD,maxMessageBytes:wD,maxImageSide:TD,maxImagePixels:ED}}var kD={fields:64,optionsPerField:128,actions:16,routingSkeletonBytes:36864};new TextEncoder;var AD=16384;kD.fields,kD.optionsPerField,kD.actions,new TextEncoder;function jD(e,t){let n=new Map;for(let e of t)e.type===`interaction_request`&&n.set(e.data.interaction.interactionId,e);return{status:e.status,...e.statusKind===void 0?{}:{statusKind:e.statusKind},...e.backgroundTaskCount===void 0?{}:{backgroundTaskCount:e.backgroundTaskCount},activeResponseIds:[...e.activeResponseIds],pendingInteractions:e.pendingInteractions.flatMap(e=>{let t=n.get(e.interactionId);return!t||t.responseId!==e.responseId?[]:[{responseId:e.responseId,interaction:t.data.interaction}]})}}4*Math.ceil(AD/3),new Set(Object.keys({"status.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:null},"provider.cli.status.list":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.provider-cli.status.v1`},"project.list":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.project.manage.v1`},"project.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.project.manage.v1`},"project.create":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.project.manage.v1`},"project.update":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.project.manage.v1`},"project.delete":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.project.manage.v1`},"emulator.devices.list":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.active.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.attach":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.tap":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.type":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.button":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.rotate":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.launch":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.gesture":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.kill":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"emulator.shutdown":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.emulator.unary.v1`},"session.emulator.state.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.devices.list":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.attach":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.detach":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.tap":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.type":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.button":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.rotate":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.launch":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.emulator.gesture":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.emulator.v1`},"session.list":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.list.v1`},"session.agentOptions.list":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.agent-options.v1`},"session.launchOptions.list":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.launch-options.v2`},"session.execution.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.execution-settings.v1`},"session.execution.update":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.execution-settings.v1`},"session.create":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.create.v1`},"session.fork":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.fork.v1`},"session.message.send":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.message.v1`},"session.resource.policy.get":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.resources.v2`},"session.resource.upload.begin":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.resources.v2`},"session.resource.upload.chunk":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.resources.v2`},"session.resource.upload.commit":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.resources.v2`},"session.resource.get":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.resources.v2`},"session.resource.read":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.resources.v2`},"session.resource.delete":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.resources.v2`},"session.file.get":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.files.v1`},"session.file.read":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.files.v1`},"session.workspace.file.get":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.workspace-files.v1`},"session.workspace.file.read":{retryPolicy:`safe`,introducedCoreVersion:2,requiredSemanticCapability:`semantic.session.workspace-files.v1`},"session.message.enqueue":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.message-queue.v1`},"session.terminal.start":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.terminal-start.v1`},"session.delete":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.delete.v1`},"session.snapshot.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.snapshot.v1`},"session.interrupt":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.interrupt.v1`},"session.interaction.resolve":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.session.interaction.v1`},"browser.state.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.request-headers.get":{retryPolicy:`safe`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.request-headers.v1`},"browser.request-headers.set":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.request-headers.v1`},"browser.open":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.close":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.page.create":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.page.close":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.page.activate":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.page.navigate":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.page.back":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.page.forward":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`},"browser.page.reload":{retryPolicy:`never`,introducedCoreVersion:1,requiredSemanticCapability:`semantic.browser.v1`}})),new TextEncoder;var MD=0;function ND(e){let t=globalThis.crypto;if(typeof t?.randomUUID==`function`)return`${e}_${t.randomUUID()}`;if(typeof t?.getRandomValues==`function`){let n=t.getRandomValues(new Uint8Array(16));return`${e}_${Array.from(n,e=>e.toString(16).padStart(2,`0`)).join(``)}`}return MD=MD+1>>>0,`${e}_${Date.now().toString(36)}_${MD.toString(36)}`}var PD=256,FD=4194304;function ID(e,t,n,r){return e||(n?t:r)}function LD(e){return e.type===`response.created`||e.type===`session.input.consumed`}function RD(e,t,n){return n&&e!==null&&t===e}function zD(e,t){return e&&t}function BD(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;--e){let n=t[e];if(n?.[1].status===`running`)return n[0]}}function VD(e,{runtimeSelector:t,allowSend:n=!0}={}){let[r,i]=(0,u.useReducer)($E,void 0,gE),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1),l=(0,u.useRef)(null),d=(0,u.useRef)(0),f=(0,u.useRef)(null),p=(0,u.useRef)(null);(0,u.useEffect)(()=>{if(i({kind:`reset`}),f.current=null,p.current=null,o(!1),c(!1),!e)return;let n=new AbortController,r=!1,a=!0,s;return(async()=>{let l=500;for(;!n.signal.aborted;){let u=new AbortController,d=()=>u.abort();n.signal.addEventListener(`abort`,d,{once:!0});let m=!1,h=!1,g=!1,_={events:[],utf8Bytes:0},v,y,b=new Promise((e,t)=>{v=e,y=t}),x=Y.streamSession(e,e=>{if(!(r||u.signal.aborted)){if(e.event===`ready`){let t=UD(s,e.data);s=t.daemonInstanceId,t.changed&&(a=!0,i({kind:`reset`}),c(!1)),v()}else if(e.event===`event`){let t=e.data,n=f.current;n!==null&&LD(t)&&(p.current=n,RD(f.current,p.current,m)&&(f.current=null,p.current=null,o(!1))),m?i({kind:`event`,event:t}):HD(_,t)||(g=!0,u.abort())}else e.event===`error`&&i({kind:`stream_error`,message:String(e.data.message??`stream error`)})}},u.signal,t).then(()=>(y(Error(`session stream closed before ready`)),{error:void 0})).catch(e=>(y(e),{error:e}));try{await b,l=500;let o=500,s,c=0,d=[],f=[];for(;;){let l=new AbortController,p=()=>l.abort();u.signal.addEventListener(`abort`,p,{once:!0}),u.signal.aborted&&l.abort();let m=t?Y.getSessionSnapshotPage(e,s,l.signal,t).then(e=>({kind:`snapshot_page`,page:e})).catch(e=>({kind:`snapshot_error`,error:e})):Y.getSessionSnapshot(e,l.signal).then(e=>({kind:`snapshot`,snapshot:e})).catch(e=>({kind:`snapshot_error`,error:e})),_=await Promise.race([m,x.then(()=>({kind:`stream_ended`}))]);if(u.signal.removeEventListener(`abort`,p),_.kind===`stream_ended`){l.abort();break}if(r||n.signal.aborted)return;if(g)break;if(_.kind===`snapshot_page`){let{page:t}=_;if(t.sessionId!==e||t.hasMore&&(!t.nextAfterId||t.nextAfterId===s)){i({kind:`stream_error`,message:`Session snapshot page did not advance`}),u.abort();break}if(d.push(...t.items),f=t.pendingInputs??[],i({kind:a&&c===0?`history`:`reconcile_history`,items:t.items}),c+=1,o=500,t.hasMore){s=t.nextAfterId;continue}i({kind:`reconcile_snapshot`,items:[],pendingInputs:f,pruneMissingPending:!a,runtime:jD(t.runtime,d)}),h=!0,a=!1;break}if(_.kind===`snapshot`){let{snapshot:e}=_;i({kind:a?`snapshot`:`reconcile_snapshot`,items:e.items,pendingInputs:e.pendingInputs??[],...a?{}:{pruneMissingPending:!0},runtime:e.runtime}),h=!0,a=!1;break}let{error:v}=_;i({kind:`stream_error`,message:v instanceof Error?v.message:String(v)});let y=await Promise.race([x.then(()=>`stream_ended`),WD(o,n.signal).then(()=>`retry`)]);if(n.signal.aborted)return;if(y===`stream_ended`)break;o=Math.min(o*2,8e3)}}catch(e){!r&&!n.signal.aborted&&!g&&i({kind:`stream_error`,message:e instanceof Error?e.message:String(e)})}finally{if(g||(m=!0),!r&&!n.signal.aborted&&!g){for(let e of _.events.splice(0))i({kind:`event`,event:e});_.utf8Bytes=0,h&&(c(!0),RD(f.current,p.current,!0)&&(f.current=null,p.current=null,o(!1)))}}let S=await x;if(r||c(!1),n.signal.removeEventListener(`abort`,d),u.abort(),n.signal.aborted)return;S.error,await WD(l,n.signal),l=Math.min(l*2,8e3)}})(),()=>{r=!0,n.abort()}},[t,e]);let m=(0,u.useCallback)(async r=>{if(!e||!n)return;let a=typeof r==`string`?r:r.text,s=typeof r==`string`?[]:r.attachments,c=typeof r==`string`?ND(`msg`):r.clientMessageId??ND(`msg`),u=new AbortController,m=++d.current;l.current=u,f.current=m,p.current=null,o(!0);let h=c;i({kind:`optimistic_user`,id:h,text:a,attachments:s});try{await Y.sendSessionMessage(e,{content:[...s,...a?[{type:`input_text`,text:a}]:[]],clientMessageId:c},()=>{},u.signal,t)}catch(e){throw u.signal.aborted||(Ux(e)&&i({kind:`discard_optimistic_user`,id:h}),i({kind:`stream_error`,message:e.message})),f.current===m&&(f.current=null,p.current=null,o(!1)),e}finally{l.current===u&&(l.current=null)}},[n,t,e]),h=(0,u.useCallback)(async()=>{if(l.current?.abort(),f.current=null,p.current=null,o(!1),!e)return;let n=BD(r.turns);n&&i({kind:`event`,event:{type:`session.interrupted`,sessionId:e,responseId:n}});try{await Y.interruptSession(e,t)}catch{}},[t,e,r.turns]);return(0,u.useEffect)(()=>{if(!a)return;if(zD(s,r.runStatus===`running`||r.waitingForInteraction)){f.current=null,p.current=null,o(!1);return}let e=f.current,t=window.setTimeout(()=>{f.current===e&&(f.current=null,p.current=null,o(!1))},15e3);return()=>window.clearTimeout(t)},[s,a,r.runStatus,r.waitingForInteraction]),{state:r,pendingSend:a,current:s,send:m,stop:h}}function HD(e,t,n={}){let r=n.events??PD,i=n.utf8Bytes??FD,a;try{a=new TextEncoder().encode(JSON.stringify(t)).byteLength}catch{return!1}return e.events.length>=r||a>i||e.utf8Bytes+a>i?!1:(e.events.push(t),e.utf8Bytes+=a,!0)}function UD(e,t){let n=t&&typeof t==`object`&&!Array.isArray(t)?t.daemonInstanceId:void 0;return typeof n!=`string`||n.length===0?{daemonInstanceId:e,changed:!1}:{daemonInstanceId:n,changed:e!==void 0&&e!==n}}function WD(e,t){return t.aborted?Promise.resolve():new Promise(n=>{let r=window.setTimeout(i,e);t.addEventListener(`abort`,i,{once:!0});function i(){window.clearTimeout(r),t.removeEventListener(`abort`,i),n()}})}var GD=4096,KD=4096,qD=512,JD=1024,YD=new Uint8Array([82,66,83,70]),XD=38,ZD=1,QD=2,$D=new TextEncoder,eO=new TextDecoder(`utf-8`,{fatal:!0});function tO(e){let t=rO(e);switch(t.type){case`browser.surface.ready`:{aO(t,[`type`,`subscriptionId`,`browserGeneration`,`viewportRevision`,`sourceWidth`,`sourceHeight`,`deviceScaleFactor`,`format`,`grantedRole`],`Browser Surface ready frame`);let e=fO(t.sourceWidth,`sourceWidth`),n=fO(t.sourceHeight,`sourceHeight`);return pO(e,n),{type:`browser.surface.ready`,subscriptionId:oO(t.subscriptionId,`subscriptionId`),browserGeneration:cO(t.browserGeneration,`browserGeneration`),viewportRevision:lO(t.viewportRevision,`viewportRevision`),sourceWidth:e,sourceHeight:n,deviceScaleFactor:dO(t.deviceScaleFactor,.25,8,`deviceScaleFactor`),format:mO(t.format),grantedRole:hO(t.grantedRole,[`view`,`control`],`grantedRole`)}}case`browser.surface.driver.changed`:{aO(t,[`type`,`subscriptionId`,`browserGeneration`,`driver`,`driverSubscriptionId`],`driver changed frame`,!0);let e=hO(t.driver,[`none`,`desktop`,`stream`],`driver`),n=t.driverSubscriptionId===void 0?void 0:oO(t.driverSubscriptionId,`driverSubscriptionId`);if(e===`stream`!=(n!==void 0))throw _O(`driverSubscriptionId is required only when driver is stream`);return{type:`browser.surface.driver.changed`,subscriptionId:oO(t.subscriptionId,`subscriptionId`),browserGeneration:cO(t.browserGeneration,`browserGeneration`),driver:e,...n===void 0?{}:{driverSubscriptionId:n}}}case`browser.surface.closed`:{aO(t,[`type`,`subscriptionId`,`reason`,`message`],`Browser Surface closed frame`,!0);let e=t.message===void 0?void 0:sO(t.message,`message`,JD);return{type:`browser.surface.closed`,subscriptionId:oO(t.subscriptionId,`subscriptionId`),reason:hO(t.reason,[`browser_closed`,`page_closed`,`generation_changed`,`replaced`,`cancelled`,`unauthorized`,`unsupported`,`capacity`,`idle_timeout`,`protocol_error`,`internal_error`],`reason`),...e===void 0?{}:{message:e}}}default:throw _O(`unknown Browser Surface server frame type`)}}function nO(e){if(!(e instanceof Uint8Array)||e.byteLength<39||e.byteLength>4194854)throw _O(`Browser Surface image frame has an invalid byte length`);for(let t=0;t<YD.length;t+=1)if(e[t]!==YD[t])throw _O(`Browser Surface image frame has invalid magic`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==1||t.getUint16(6,!1)!==0)throw _O(`Browser Surface image frame header is unsupported`);let n=t.getUint8(5),r=n===ZD?`jpeg`:n===QD?`png`:void 0;if(r===void 0)throw _O(`Browser Surface image frame format is unsupported`);let i=t.getUint16(32,!1),a=t.getUint32(34,!1);if(i===0||i>qD||a===0||a>4194304||XD+i+a!==e.byteLength)throw _O(`Browser Surface image frame lengths are invalid`);let o;try{o=eO.decode(e.subarray(XD,XD+i))}catch{throw _O(`subscriptionId must be valid UTF-8`)}o=oO(o,`subscriptionId`);let s=gO(t.getBigUint64(8,!1),`frameSequence`),c=t.getUint32(16,!1),l=gO(t.getBigUint64(20,!1),`timestampMilliseconds`),u=fO(t.getUint16(28,!1),`width`),d=fO(t.getUint16(30,!1),`height`);return pO(u,d),{subscriptionId:o,frameSequence:s,viewportRevision:c,timestampMilliseconds:l,width:u,height:d,format:r,encodedBytes:new Uint8Array(e.subarray(XD+i))}}function rO(e){let t=e;if(typeof e==`string`){if($D.encode(e).byteLength>32768)throw _O(`Browser Surface control frame exceeds its byte limit`);try{t=JSON.parse(e)}catch{throw _O(`Browser Surface control frame must be valid JSON`)}}let n=iO(t,`Browser Surface control frame`),r;try{r=JSON.stringify(n)}catch{throw _O(`Browser Surface control frame must be serializable`)}if($D.encode(r).byteLength>32768)throw _O(`Browser Surface control frame exceeds its byte limit`);return n}function iO(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw _O(`${t} must be an object`);return e}function aO(e,t,n,r=!1){let i=Object.keys(e),a=r?t.length-1:t.length;if(i.length<a||i.length>t.length||i.some(e=>!t.includes(e))||t.slice(0,a).some(t=>!Object.hasOwn(e,t)))throw _O(`${n} contains unknown or missing fields`)}function oO(e,t){if(typeof e!=`string`||e.length===0||$D.encode(e).byteLength>qD||!/^[\x21-\x7e]+$/.test(e))throw _O(`${t} must be a bounded opaque identifier`);return e}function sO(e,t,n){if(typeof e!=`string`||e.includes(`\0`)||$D.encode(e).byteLength>n)throw _O(`${t} exceeds its text byte limit`);return e}function cO(e,t){if(!Number.isSafeInteger(e)||e<1)throw _O(`${t} must be a positive safe integer`);return e}function lO(e,t){if(!Number.isSafeInteger(e)||e<0)throw _O(`${t} must be a nonnegative safe integer`);return e}function uO(e,t,n,r){if(!Number.isInteger(e)||e<t||e>n)throw _O(`${r} must be an integer from ${t} to ${n}`);return e}function dO(e,t,n,r){if(typeof e!=`number`||!Number.isFinite(e)||e<t||e>n)throw _O(`${r} must be a finite number from ${t} to ${n}`);return e}function fO(e,t){return uO(e,1,t.toLowerCase().includes(`height`)?KD:GD,t)}function pO(e,t){if(e*t>8847360)throw _O(`Browser Surface viewport exceeds its maximum pixels`)}function mO(e){return hO(e,[`jpeg`,`png`],`format`)}function hO(e,t,n){if(typeof e!=`string`||!t.includes(e))throw _O(`${n} is unsupported`);return e}function gO(e,t){if(e>BigInt(2**53-1))throw _O(`${t} exceeds a safe integer`);return Number(e)}function _O(e){return TypeError(`Invalid Runtime Browser Surface: ${e}`)}var vO=1e4,yO=16,bO=1,xO=[500,1e3,2e3,4e3,8e3,15e3];function SO(e){return xO[Math.max(0,Math.min(Math.trunc(e),xO.length-1))]}function CO(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function wO(e){return e===`browser_closed`||e===`generation_changed`||e===`cancelled`||e===`capacity`||e===`idle_timeout`||e===`internal_error`}function TO(e){let t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function EO(e){return!(e instanceof Error)||!e.message?`Browser operation failed`:e.message===`failed_precondition`?"Browser Host is unavailable. On a headless Runtime, run `rynx browser install` on that host.":e.message.replaceAll(`_`,` `)}function DO(e,t,n){return n&&e===`local`&&t.executionBackend===`embedded-electron`&&t.capabilities.includes(`desktop-direct-view`)}function OO(e,t,n){return!n||e!==`local`?!1:t.status===`unavailable`||t.status===`ready`&&t.executionBackend===`headless-chromium`}function kO(e,t,n){return n&&e===`local`&&t.status===`ready`&&t.executionBackend===`embedded-electron`&&!t.capabilities.includes(`desktop-direct-view`)}async function AO(e,t){let n=e.pages.findIndex(t=>t.pageId===e.activePageId);await t.close(e.browserGeneration);let r=await t.open(e.pages[0]?.url);t.onProgress?.(r);for(let n of e.pages.slice(1))r=await t.createPage(r.browserGeneration,n.url),t.onProgress?.(r);let i=n>=0?r.pages[n]:void 0;return i&&r.activePageId!==i.pageId&&(r=await t.activatePage(r.browserGeneration,i.pageId),t.onProgress?.(r)),r}function jO({scrollLeft:e,viewportWidth:t,contentWidth:n,availableWidth:r=t}){let i=Math.max(0,n-t),a=n-r>bO;return{hasOverflow:a,canScrollLeft:a&&e>bO,canScrollRight:a&&e<i-bO}}function MO(e){return Math.max(120,e*.75)}function NO({scrollLeft:e,viewportWidth:t,tabLeft:n,tabWidth:r,inset:i=4}){let a=e,o=e+t,s=Math.max(0,n-i),c=n+r+i;return s<a?s-a:c>o?c-o:0}function PO(e,t,n,r){return{deltaX:FO(e+n),deltaY:FO(t+r)}}function FO(e){return Number.isFinite(e)?Math.max(-1e4,Math.min(vO,e)):0}function IO(e){if(!e)return[];let t=new TextEncoder,n=[],r=``,i=0;for(let a of e){let e=t.encode(a).byteLength;if(i+e>4096){if(n.push(r),n.length>=yO)throw RangeError(`Browser text input is too large`);r=``,i=0}r+=a,i+=e}return r&&n.push(r),n}function LO(e,t){if(t.type===`pointerdown`){let n=RO(t.button);return n&&e.set(t.pointerId,n),n}let n=e.get(t.pointerId);return e.delete(t.pointerId),n??RO(t.button)}function RO(e){if(e===0)return`left`;if(e===1)return`middle`;if(e===2)return`right`;if(e===3)return`back`;if(e===4)return`forward`}var zO=1,BO=2;function VO({runtimeSelector:e,sessionId:t,browserGeneration:n,pageId:r,toolbarHost:i,readOnly:a=!1}){let o=(0,u.useRef)(null),s=(0,u.useRef)(null),c=(0,u.useRef)(void 0),l=(0,u.useRef)(void 0),f=(0,u.useRef)(0),p=(0,u.useRef)(0),m=(0,u.useRef)(0),h=(0,u.useRef)(0),g=(0,u.useRef)(void 0),_=(0,u.useRef)(!1),v=(0,u.useRef)(!1),y=(0,u.useRef)(!1),b=(0,u.useRef)(void 0),x=(0,u.useRef)(void 0),S=(0,u.useRef)(void 0),C=(0,u.useRef)(new Map),[w,T]=(0,u.useState)(`connecting`),[E,D]=(0,u.useState)(),[O,k]=(0,u.useState)(),[A,j]=(0,u.useState)(`none`),[M,N]=(0,u.useState)(),[P,F]=(0,u.useState)(!1),[I,L]=(0,u.useState)(!1),ee=A===`stream`&&M===O?.subscriptionId,te=(0,u.useCallback)(()=>{S.current!==void 0&&(window.cancelAnimationFrame(S.current),S.current=void 0),b.current=void 0,x.current=void 0,C.current.clear()},[]),ne=(0,u.useCallback)(()=>{g.current!==void 0&&(window.clearTimeout(g.current),g.current=void 0)},[]),re=(0,u.useCallback)(async({refreshCapability:i=!1,preserveFrame:s=!1}={})=>{ne();let u=++m.current;c.current?.close(1e3,`Browser Surface reconnecting`),c.current=void 0,l.current=void 0,f.current=0,p.current=0,y.current=!1,v.current=!1,te(),T(`connecting`),D(void 0),k(void 0),j(`none`),N(void 0),L(!1),s||(_.current=!1,F(!1));let d=e=>{if(m.current!==u)return;D(e),T(`connecting`);let t=SO(h.current++);g.current=window.setTimeout(()=>{g.current=void 0,re({preserveFrame:!0})},t)};try{let s=await Qx(i);if(m.current!==u)return;let p=new WebSocket(WO({runtimeSelector:e,sessionId:t,pageId:r,browserGeneration:n,capability:s,readOnly:a}));p.binaryType=`arraybuffer`,c.current=p;let g=i,b=!1;p.onmessage=e=>{if(m.current!==u||c.current!==p)return;if(typeof e.data==`string`){try{let t=JSON.parse(e.data);if(t&&typeof t==`object`&&`type`in t&&t.type===`error`){let e=`message`in t&&typeof t.message==`string`?t.message:`Browser Surface failed`;D(e);return}let n=tO(t);if(n.type===`browser.surface.ready`){l.current=n,f.current=n.viewportRevision,ne(),k(n),T(`ready`);return}if(n.type===`browser.surface.driver.changed`){let e=n.driver===`stream`&&n.driverSubscriptionId===l.current?.subscriptionId;y.current=e,e||te(),j(n.driver),N(n.driverSubscriptionId);return}y.current=!1,te();let r=n.message??JO(n.reason);b=!0,wO(n.reason)?(d(r),p.close(1e3,`recovering Browser Surface`)):(D(r),T(`closed`))}catch{b=!0,D(`Browser Surface sent an invalid control frame`),T(`closed`),p.close(4400,`invalid Browser Surface control`)}return}if(!(e.data instanceof ArrayBuffer)){D(`Browser Surface sent an invalid image frame`),p.close(4400,`invalid Browser Surface image`);return}let t=()=>m.current===u&&c.current===p;HO(e.data,p,o.current,l.current,t).then(e=>{e===void 0||!t()||(f.current=e,_.current=!0,v.current=!0,h.current=0,F(!0),L(!0))}).catch(()=>{t()&&(b=!0,D(`Browser preview could not be decoded`),T(`closed`),p.close(4400,`Browser Surface image decode failed`))})},p.onclose=e=>{if(m.current===u&&c.current===p&&(c.current=void 0,y.current=!1,te(),!b)){if((e.code===4403||e.code===1006)&&!g){g=!0,re({refreshCapability:!0,preserveFrame:!0});return}if(CO(e.code)){d(YO(e.code));return}T(`closed`),D(t=>t??YO(e.code))}},p.onerror=()=>{c.current===p&&D(`Browser preview transport failed`)}}catch(e){if(m.current!==u)return;d(e instanceof Error?e.message:`Browser preview could not connect`)}},[e,t,r,n,a,te,ne]);(0,u.useEffect)(()=>(re(),()=>{m.current+=1,ne(),te(),c.current?.close(1e3,`Browser Surface view unmounted`),c.current=void 0}),[re,te,ne]);let R=(0,u.useCallback)(()=>{h.current=0,re({preserveFrame:!0})},[re]),ie=(0,u.useCallback)(e=>{let t=c.current;return!t||t.readyState!==WebSocket.OPEN?!1:(t.send(JSON.stringify(e)),!0)},[]),ae=(0,u.useCallback)(()=>{let e=l.current;!e||!v.current||(ie({type:`browser.surface.driver.take`,subscriptionId:e.subscriptionId,browserGeneration:e.browserGeneration,viewportRevision:f.current}),s.current?.focus())},[ie]),oe=(0,u.useCallback)(()=>{let e=l.current;e&&(te(),s.current&&(s.current.value=``),ie({type:`browser.surface.driver.release`,subscriptionId:e.subscriptionId,browserGeneration:e.browserGeneration}))},[ie,te]),se=(0,u.useCallback)(e=>{let t=l.current;return!t||!v.current||!y.current?!1:ie({type:`browser.surface.input`,subscriptionId:t.subscriptionId,browserGeneration:t.browserGeneration,viewportRevision:f.current,inputSequence:p.current++,event:e})},[ie]),ce=(0,u.useCallback)(e=>{let t;try{t=IO(e)}catch{return D(`Text input is limited to 64 KiB at a time.`),!1}let n=!1;for(let e of t){if(!se({type:`text.insert`,text:e}))return n;n=!0}return n},[se]),le=(0,u.useCallback)(()=>{S.current!==void 0&&(window.cancelAnimationFrame(S.current),S.current=void 0);let e=b.current,t=x.current;b.current=void 0,x.current=void 0,y.current&&(e&&se({...e}),t&&se({...t}))},[se]),ue=(0,u.useCallback)(()=>{S.current===void 0&&(S.current=window.requestAnimationFrame(le))},[le]);(0,u.useEffect)(()=>{y.current=ee,ee||(te(),s.current&&(s.current.value=``,s.current.blur()))},[ee,te]);let de=(0,u.useCallback)(e=>{if(!ee)return;let t=GO(e.currentTarget,e.clientX,e.clientY);if(!t)return;if(e.type===`pointermove`){b.current={type:`pointer.move`,...t,modifiers:KO(e)},ue(),e.preventDefault();return}le(),e.type===`pointerdown`&&(s.current?.focus(),e.currentTarget.setPointerCapture(e.pointerId));let n=e.type===`pointerdown`?`pointer.down`:`pointer.up`,r=LO(C.current,e);if(!r)return;let i={type:n,...t,button:r,modifiers:KO(e)};se(i)&&e.preventDefault()},[ee,se,le,ue]),fe=(0,u.useCallback)(e=>{if(!ee)return;let t=GO(e.currentTarget,e.clientX,e.clientY);if(!t)return;let n=e.deltaMode===zO?16:e.deltaMode===BO?Math.max(1,e.currentTarget.clientHeight):1,r=x.current,i=PO(r?.deltaX??0,r?.deltaY??0,e.deltaX*n,e.deltaY*n);x.current={type:`wheel`,...t,...i,modifiers:KO(e)},ue(),e.preventDefault()},[ee,ue]),pe=(0,u.useCallback)(e=>{if(e.nativeEvent.isComposing||e.key===`Process`||e.key===`Dead`)return;le();let t=se({type:e.type===`keydown`?`key.down`:`key.up`,key:e.key,code:e.code,repeat:e.repeat,modifiers:KO(e)}),n=UO({type:e.type,key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,isComposing:e.nativeEvent.isComposing}),r=n!==void 0&&ce(n);(t||r)&&e.preventDefault()},[se,ce,le]),me=(0,u.useCallback)(e=>{le();let t=e.clipboardData.getData(`text/plain`);t&&ce(t)&&e.preventDefault()},[ce,le]),he=(0,u.useCallback)(e=>{let t=e.data||e.currentTarget.value;e.currentTarget.value=``,t&&ce(t)},[ce]);return(0,H.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-[#111318]`,children:[(0,H.jsx)(`canvas`,{ref:o,className:`max-h-full max-w-full outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]`,"aria-label":ee?`Interactive browser preview`:`Browser preview`,tabIndex:-1,onPointerMove:de,onPointerDown:de,onPointerUp:de,onPointerCancel:de,onWheel:fe}),(0,H.jsx)(`textarea`,{ref:s,"aria-label":`Browser keyboard input`,className:`pointer-events-none absolute left-0 top-0 size-px resize-none opacity-0`,tabIndex:ee?0:-1,autoComplete:`off`,spellCheck:!1,onKeyDown:pe,onKeyUp:pe,onPaste:me,onCompositionEnd:he}),w===`connecting`&&(0,H.jsx)(qO,{preserveFrame:P,icon:(0,H.jsx)(B,{className:`size-5 animate-spin`}),label:P?`Reconnecting preview…`:`Connecting preview…`}),w===`ready`&&!I&&(0,H.jsx)(qO,{icon:(0,H.jsx)(B,{className:`size-5 animate-spin`}),label:`Waiting for first frame…`}),w===`closed`&&(0,H.jsx)(`div`,{className:`absolute inset-0 grid place-items-center bg-[#111318]/90 px-6 text-center`,children:(0,H.jsxs)(`div`,{className:`max-w-sm`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-white`,children:`Preview disconnected`}),(0,H.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs leading-5 text-white/60`,children:E??`The Browser Surface ended.`})]})}),i&&(0,d.createPortal)((0,H.jsx)(`div`,{className:`flex items-center`,children:w===`closed`?(0,H.jsx)(J,{size:`icon-sm`,variant:`outline`,className:`size-8`,"aria-label":`Reconnect browser preview`,title:`Reconnect browser preview`,onClick:R,children:(0,H.jsx)(zr,{className:`size-4`})}):w!==`ready`||!I?(0,H.jsx)(J,{size:`icon-sm`,variant:`outline`,className:`size-8`,"aria-label":_.current?`Reconnecting browser preview`:`Connecting browser preview`,title:_.current?`Reconnecting browser preview`:`Connecting browser preview`,disabled:!0,children:(0,H.jsx)(B,{className:`size-4 animate-spin`})}):a?(0,H.jsx)(J,{size:`icon-sm`,variant:`outline`,className:`size-8`,"aria-label":`Browser preview is read only`,title:`Browser preview is read only`,disabled:!0,children:(0,H.jsx)(Tr,{className:`size-4`})}):ee?(0,H.jsx)(J,{size:`icon-sm`,variant:`outline`,className:`size-8`,"aria-label":`Release browser control`,title:`Release browser control`,onClick:oe,children:(0,H.jsx)(Tr,{className:`size-4`})}):(0,H.jsx)(J,{size:`icon-sm`,className:`size-8`,"aria-label":`Take browser control`,title:`Take browser control`,onClick:ae,children:(0,H.jsx)(Er,{className:`size-4`})})}),i),(0,H.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:E??(ee?`Browser control active`:`Browser preview ${w}`)})]})}async function HO(e,t,n,r,i){let a=nO(new Uint8Array(e));if(!r||a.subscriptionId!==r.subscriptionId||a.format!==r.format)throw Error(`Browser Surface image does not match the active subscription`);let o=await createImageBitmap(new Blob([a.encodedBytes],{type:a.format===`jpeg`?`image/jpeg`:`image/png`}));try{if(!i()||!n||t.readyState!==WebSocket.OPEN)return;n.width=a.width,n.height=a.height;let e=n.getContext(`2d`,{alpha:!1});if(!e)throw Error(`Browser preview canvas is unavailable`);return e.drawImage(o,0,0,a.width,a.height),t.send(JSON.stringify({type:`browser.surface.frame.ack`,subscriptionId:r.subscriptionId,frameSequence:a.frameSequence})),a.viewportRevision}finally{o.close()}}function UO(e){if(!(e.type!==`keydown`||e.isComposing||e.key===`Process`||e.key===`Dead`||e.altKey||e.ctrlKey||e.metaKey||Array.from(e.key).length!==1))return e.key}function WO(e){let t=location.protocol===`https:`?`wss`:`ws`,n=new URLSearchParams({generation:String(e.browserGeneration),role:e.readOnly?`view`:`control`,format:`jpeg`,quality:`75`,maximumFrameRate:`15`,capability:e.capability});return Vx(n),`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/browser/pages/${encodeURIComponent(e.pageId)}/surface?${n.toString()}`}function GO(e,t,n){let r=e.getBoundingClientRect();if(!(r.width<=0||r.height<=0||e.width<=0||e.height<=0))return{x:Math.max(0,Math.min(e.width,(t-r.left)*e.width/r.width)),y:Math.max(0,Math.min(e.height,(n-r.top)*e.height/r.height))}}function KO(e){let t=[];return e.altKey&&t.push(`alt`),e.ctrlKey&&t.push(`control`),e.metaKey&&t.push(`meta`),e.shiftKey&&t.push(`shift`),t}function qO({icon:e,label:t,preserveFrame:n=!1}){return(0,H.jsx)(`div`,{className:n?`absolute inset-0 grid place-items-center bg-[#111318]/55 text-white`:`absolute inset-0 grid place-items-center bg-[#111318] text-white/70`,children:(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-3 text-sm`,children:[e,t]})})}function JO(e){return e===`replaced`?`This preview was opened somewhere else.`:e===`generation_changed`?`The Browser was restarted.`:e===`page_closed`?`This Browser page was closed.`:e===`idle_timeout`?`The Browser preview timed out.`:e===`unauthorized`?`Browser preview authorization expired.`:`The Browser preview ended.`}function YO(e){return e===4403?`Browser preview authorization failed.`:e===4406?`The selected Runtime cannot provide this Browser preview.`:e===4408?`The Browser preview client was too slow.`:e===1012?`The selected Runtime disconnected.`:`The Browser preview connection closed.`}var XO=400;function ZO({runtimeSelector:e,sessionId:t,browserGeneration:n,pageId:r}){let i=(0,u.useRef)(null),[a,o]=(0,u.useState)(0),[s,c]=(0,u.useState)(`mounting`),[l,d]=(0,u.useState)(`unavailable`),[f,p]=(0,u.useState)(!1),[m,h]=(0,u.useState)(),g=(0,u.useMemo)(()=>({runtimeSelector:e,sessionId:t,browserGeneration:n,pageId:r}),[e,t,n,r]);(0,u.useEffect)(()=>{let e=window.rynxDesktopBrowser,t=i.current;if(!e||!t){c(`unavailable`);return}let n=!1,r=0,a,o=$O(g),s=async()=>{if(n)return;let r=QO(t.getBoundingClientRect());if(!r){e.park(g);return}try{let t=await e.mount(g,r);if(n)return;if(t===`mounted`){c(`mounted`),a!==void 0&&window.clearTimeout(a),a=void 0;return}}catch{}n||(c(`mounting`),a=window.setTimeout(()=>void s(),XO))},l=()=>{window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>void s())},u=new ResizeObserver(l);u.observe(t),window.addEventListener(`resize`,l),window.addEventListener(`scroll`,l,!0);let f=e.onState(e=>{if($O(e.resource)===o){if(e.state===`closed`){c(`unavailable`);return}l()}}),m=e.onDriver(e=>{$O(e.resource)===o&&(d(e.driver),e.driver===`desktop`&&(p(!1),h(void 0)))});return d(e.getDriver(g)),c(`mounting`),l(),()=>{n=!0,u.disconnect(),f(),m(),window.removeEventListener(`resize`,l),window.removeEventListener(`scroll`,l,!0),window.cancelAnimationFrame(r),a!==void 0&&window.clearTimeout(a),e.park(g)}},[g,a]);let _=async()=>{let e=window.rynxDesktopBrowser;if(!(!e||f)){p(!0),h(void 0);try{if(await e.takeBack(g)!==`taken`)throw Error(`The remote controller is no longer available.`)}catch(e){p(!1),h(e instanceof Error?e.message:`Could not take back browser control.`)}}};return(0,H.jsxs)(`div`,{ref:i,className:`relative flex min-h-0 flex-1 overflow-hidden bg-white`,"aria-label":`Embedded session browser page`,children:[s!==`mounted`&&(0,H.jsx)(`div`,{className:`absolute inset-0 z-0 grid place-items-center bg-[var(--muted)]/20 p-4 text-center`,children:s===`mounting`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),`Attaching the local browser…`]}):(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--muted-foreground)]`,children:`The local desktop browser is unavailable.`}),(0,H.jsxs)(J,{size:`sm`,variant:`outline`,onClick:()=>o(e=>e+1),children:[(0,H.jsx)(zr,{}),`Retry`]})]})}),s===`mounted`&&l===`stream`&&(0,H.jsx)(`div`,{className:`absolute inset-0 z-20 grid place-items-center bg-black/45 p-4 text-center backdrop-blur-[1px]`,children:(0,H.jsxs)(`div`,{className:`max-w-sm rounded-lg border border-white/20 bg-[var(--card)] p-4 shadow-lg`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-[var(--foreground)]`,children:`Controlled from a remote viewer`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:`Local mouse and keyboard input are paused to prevent two controllers from acting at once.`}),(0,H.jsxs)(J,{className:`mt-3`,size:`sm`,disabled:f,onClick:()=>void _(),children:[f?(0,H.jsx)(B,{className:`animate-spin`}):null,`Take back control`]}),m?(0,H.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-[var(--destructive)]`,children:m}):null]})})]})}function QO(e){let t=Math.max(0,Math.ceil(e.left)),n=Math.max(0,Math.ceil(e.top)),r=Math.min(window.innerWidth,Math.floor(e.right)),i=Math.min(window.innerHeight,Math.floor(e.bottom));return r<=t||i<=n?null:{x:t,y:n,width:r-t,height:i-n}}function $O(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}var ek=`size-11 sm:size-8`;function tk({sessionId:e,runtimeSelector:t,pageId:n,browserResource:r,readOnly:i=!1}){let{browser:a,loading:o,pendingAction:s,error:c,disabled:l,load:d,openBrowser:f,closeBrowser:p,recreateForDesktop:m,navigatePage:h,backPage:g,forwardPage:_,reloadPage:v}=r,y=(0,u.useMemo)(()=>a?.pages.find(e=>e.pageId===n),[a,n]),b=a!==null&&DO(t,a,window.rynxDesktopBrowser!==void 0),x=a!==null&&a.sessionId===e&&OO(t,a,window.rynxDesktopBrowser!==void 0),S=a!==null&&a.sessionId===e&&kO(t,a,window.rynxDesktopBrowser!==void 0),C=(0,u.useRef)(null),[w,T]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let n=`${t}\n${e}`;i||!x||C.current===n||(C.current=n,m())},[x,i,m,t,e]),o&&a===null?(0,H.jsx)(ak,{label:`Loading browser…`}):a===null?i?(0,H.jsx)(ok,{label:`Browser is not running for this Session.`}):(0,H.jsx)(nk,{error:c,pending:s!==null,onOpen:e=>void f(e),onRetry:()=>void d(!0)}):(0,H.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]`,"aria-label":`Session browser page`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 border-b border-[var(--border)] px-2 py-2 sm:flex-nowrap sm:px-3`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,H.jsx)(ik,{label:`Go back`,disabled:l||!y?.canGoBack,onClick:()=>y&&void g(y.pageId),children:(0,H.jsx)(An,{})}),(0,H.jsx)(ik,{label:`Go forward`,disabled:l||!y?.canGoForward,onClick:()=>y&&void _(y.pageId),children:(0,H.jsx)(jn,{})}),(0,H.jsx)(ik,{label:`Reload page`,disabled:l||!y,onClick:()=>y&&void v(y.pageId),children:(0,H.jsx)(Br,{className:y?.loading?`animate-spin`:void 0})})]}),y?(0,H.jsx)(rk,{page:y,disabled:l,onNavigate:e=>void h(y.pageId,e)},`${y.pageId}\n${y.url}`):(0,H.jsx)(`div`,{className:`h-11 min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 sm:h-8`}),!b&&(0,H.jsx)(`div`,{ref:T,className:`flex shrink-0 items-center`}),!i&&S&&(0,H.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:s!==null,onClick:()=>void m(),children:`Open in app`}),!i&&(0,H.jsx)(ik,{label:`Stop browser`,disabled:s!==null,onClick:()=>void p(),children:(0,H.jsx)(Lr,{})})]}),(0,H.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[x?(0,H.jsx)(ak,{label:`Opening in Desktop…`}):a.status===`ready`&&y?b?(0,H.jsx)(ZO,{runtimeSelector:t,sessionId:e,browserGeneration:a.browserGeneration,pageId:y.pageId}):(0,H.jsx)(VO,{runtimeSelector:t,sessionId:e,browserGeneration:a.browserGeneration,pageId:y.pageId,readOnly:i,toolbarHost:w}):a.status===`ready`?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-[var(--muted-foreground)]`,children:`No browser page is open.`}):a.status===`unavailable`&&i?(0,H.jsx)(ok,{label:`Browser is unavailable.`}):a.status===`unavailable`?(0,H.jsx)(sk,{error:c,pending:s!==null,onRestart:()=>void f()}):(0,H.jsx)(ak,{label:a.status===`closing`?`Closing browser…`:`Starting browser…`}),c&&a.status!==`unavailable`&&(0,H.jsx)(`div`,{role:`alert`,className:`absolute bottom-3 left-1/2 max-w-[calc(100%-1.5rem)] -translate-x-1/2 rounded-md border border-[var(--destructive)]/30 bg-[var(--card)] px-3 py-2 text-xs text-[var(--destructive)] shadow-sm`,children:c})]}),(0,H.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:s??c??(a.status===`ready`?`Browser ready`:`Browser ${a.status}`)})]})}function nk({error:e,pending:t,onOpen:n,onRetry:r}){let[i,a]=(0,u.useState)(``);return(0,H.jsx)(U_,{className:`min-h-0 flex-1 bg-[var(--muted)]/20`,children:(0,H.jsx)(`main`,{className:`flex min-h-full items-center justify-center p-4 sm:p-6`,children:(0,H.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),n(TO(i))},className:`w-full max-w-xl rounded-lg border border-[var(--border)] bg-[var(--card)] p-4 shadow-sm sm:p-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]`,children:(0,H.jsx)(Xn,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h3`,{className:`text-base font-semibold`,children:`Open a browser for this session`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-[var(--muted-foreground)]`,children:`The browser runs on the selected Runtime, beside the agent using it.`})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,H.jsx)(Ag,{value:i,onChange:e=>a(e.target.value),"aria-label":`Initial browser address`,placeholder:`https://example.com (optional)`,className:`h-11 flex-1 sm:h-9`,disabled:t,autoFocus:!0}),(0,H.jsxs)(J,{type:`submit`,className:`h-11 sm:h-9`,disabled:t,children:[t?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(Xn,{}),t?`Opening…`:`Open browser`]})]}),e&&(0,H.jsxs)(`div`,{role:`alert`,className:`mt-3 flex items-center justify-between gap-3 rounded-md bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]`,children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:`Retry`})]}),(0,H.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,children:t?`Starting browser`:``})]})})})}function rk({page:e,disabled:t,onNavigate:n}){let[r,i]=(0,u.useState)(e.url);return(0,H.jsx)(`form`,{onSubmit:e=>{e.preventDefault();let t=TO(r);t&&n(t)},className:`order-last flex min-w-full flex-1 sm:order-none sm:min-w-0`,children:(0,H.jsx)(Ag,{value:r,onChange:e=>i(e.target.value),"aria-label":`Browser address`,className:`h-11 rounded-lg bg-[var(--muted)]/35 font-mono text-xs sm:h-8`,disabled:t,spellCheck:!1})})}function ik({label:e,disabled:t,onClick:n,children:r}){return(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:ek,"aria-label":e,title:e,disabled:t,onClick:n,children:r})}function ak({label:e}){return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center gap-2 bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]`,"aria-live":`polite`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),e]})}function ok({label:e}){return(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]`,"aria-live":`polite`,children:e})}function sk({error:e,pending:t,onRestart:n}){return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center`,role:`status`,children:[(0,H.jsx)(zr,{className:`size-5 text-[var(--muted-foreground)]`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Browser is unavailable`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:e??`The selected Runtime cannot provide this browser right now.`})]}),(0,H.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:t,onClick:n,children:[t&&(0,H.jsx)(B,{className:`animate-spin`}),t?`Restarting…`:`Restart browser`]})]})}function ck({open:e,onClose:t,runtimeSelector:n,sessionId:r}){let[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)([]),[d,f]=(0,u.useState)(!1),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(!e)return;let t=!1;return f(!0),g(null),Y.getRuntimeBrowserRequestHeaders(n,r).then(e=>{t||(a(e.revision),s(e.enabled),l(e.headers.map(e=>({...e}))))}).catch(e=>{t||g(lk(e))}).finally(()=>{t||f(!1)}),()=>{t=!0}},[e,n,r]);let _=(e,t,n)=>{l(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},v=async()=>{if(!(i===null||p)){m(!0),g(null);try{let e=hD({sessionId:r,expectedRevision:i,enabled:o,headers:c}),s=await Y.updateRuntimeBrowserRequestHeaders(n,e);a(s.revision),V.success(`Browser request headers updated`),t()}catch(e){if(e instanceof Hx&&e.status===409)try{let e=await Y.getRuntimeBrowserRequestHeaders(n,r);a(e.revision),g(`These settings changed elsewhere. Your draft was preserved; review it and Save again to replace the latest version.`)}catch(e){g(lk(e))}else g(lk(e))}finally{m(!1)}}};return(0,H.jsxs)(`div`,{className:`space-y-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:`Browser request headers`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-[var(--muted-foreground)]`,children:`Apply request headers to all requests, including subresources, from every Browser page in this Session. Changes affect existing and future pages.`})]}),d?(0,H.jsxs)(`div`,{className:`flex min-h-44 items-center justify-center text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`mr-2 size-4 animate-spin`}),` Loading settings…`]}):(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border border-[var(--border)] p-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-medium`,children:`Enable request headers`}),(0,H.jsx)(`div`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Turning this off keeps the rows below without sending them.`})]}),(0,H.jsx)(Ub,{checked:o,onCheckedChange:s,disabled:i===null||p,"aria-label":`Enable Browser request headers`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)_2rem] gap-2 px-1 text-xs font-medium text-[var(--muted-foreground)]`,children:[(0,H.jsx)(`span`,{children:`Name`}),(0,H.jsx)(`span`,{children:`Value`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Actions`})]}),c.length===0&&(0,H.jsx)(`div`,{className:`rounded-lg border border-dashed border-[var(--border)] px-3 py-6 text-center text-sm text-[var(--muted-foreground)]`,children:`No request headers configured.`}),c.map((e,t)=>(0,H.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)_2rem] gap-2`,children:[(0,H.jsx)(Ag,{value:e.name,onChange:e=>_(t,`name`,e.target.value),placeholder:`X-Example`,disabled:p,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,"aria-label":`Header ${t+1} name`}),(0,H.jsx)(Ag,{value:e.value,onChange:e=>_(t,`value`,e.target.value),placeholder:`value`,disabled:p,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,"aria-label":`Header ${t+1} value`}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:p,onClick:()=>l(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove header ${t+1}`,title:`Remove header`,children:(0,H.jsx)(si,{})})]},t)),(0,H.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:p||c.length>=32,onClick:()=>l(e=>[...e,{name:``,value:``}]),children:[(0,H.jsx)(Ir,{}),` Add header`]}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--muted-foreground)]`,children:`Values are sent to every origin requested by the Session Browser. Treat them as sensitive and avoid unrelated third-party pages while enabled.`})]}),h&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-[var(--destructive)]`,children:h})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-[var(--border)] pt-4`,children:[(0,H.jsx)(J,{type:`button`,variant:`outline`,onClick:t,disabled:p,children:`Cancel`}),(0,H.jsxs)(J,{type:`button`,onClick:()=>void v(),disabled:i===null||d||p,children:[p&&(0,H.jsx)(B,{className:`animate-spin`}),` Save`]})]})]})}function lk(e){return e instanceof Error?e.message:`Browser settings are unavailable`}var uk=[{id:`browser-request-headers`,label:`Browser headers`,icon:Xn}];function dk({open:e,onOpenChange:t,runtimeSelector:n,sessionId:r}){let[i,a]=(0,u.useState)(`browser-request-headers`);return(0,H.jsx)(Su,{open:e,onOpenChange:t,children:(0,H.jsxs)(Du,{className:`max-h-[calc(100dvh-2rem)] gap-0 overflow-hidden p-0 sm:max-w-5xl`,children:[(0,H.jsxs)(Ou,{className:`border-b border-[var(--border)] p-5 pr-12`,children:[(0,H.jsx)(Au,{children:`Session settings`}),(0,H.jsx)(ju,{children:`Manage shared behavior for this Session.`})]}),(0,H.jsxs)(`div`,{className:`grid min-h-0 grid-cols-1 sm:grid-cols-[13rem_minmax(0,1fr)]`,children:[(0,H.jsx)(`nav`,{"aria-label":`Session settings sections`,className:`flex gap-1 overflow-x-auto border-b border-[var(--border)] bg-[var(--muted)]/30 p-2 sm:flex-col sm:border-r sm:border-b-0`,children:uk.map(e=>{let t=e.icon,n=i===e.id;return(0,H.jsxs)(`button`,{type:`button`,"aria-current":n?`page`:void 0,onClick:()=>a(e.id),className:`flex shrink-0 items-center gap-2 rounded-md px-3 py-2 text-left text-sm font-medium sm:w-full `+(n?`bg-[var(--accent)] text-[var(--accent-foreground)]`:`text-[var(--muted-foreground)] hover:bg-[var(--accent)]/60 hover:text-[var(--foreground)]`),children:[(0,H.jsx)(t,{className:`size-4`}),(0,H.jsx)(`span`,{children:e.label})]},e.id)})}),(0,H.jsx)(`div`,{className:`min-h-0 overflow-y-auto p-5`,children:i===`browser-request-headers`&&(0,H.jsx)(ck,{open:e,onClose:()=>t(!1),runtimeSelector:n,sessionId:r})})]})]})})}function fk(e,t,n,r){return n===r?t:e}function pk(e,t){return e.key!==t.key||t.streamCurrent===!0&&e.streamCurrent!==!0}function mk(e){return e?e.tool===`skills-cli`?{source:e.source}:{source:e.command}:{}}var hk=OD(),gk={...hk,enabled:!1};function _k({policy:e,upload:t,deleteResource:n,onChange:r}){let[i,a]=(0,u.useState)([]),o=(0,u.useRef)([]),s=(0,u.useRef)(new Map),c=(0,u.useCallback)(e=>{a(t=>{let n=e(t);return o.current=n,n})},[]);(0,u.useEffect)(()=>()=>{for(let e of s.current.values())e.abort();for(let e of o.current)e.previewUrl&&URL.revokeObjectURL(e.previewUrl)},[]);let l=(0,u.useCallback)(i=>{if(!e.enabled||i.length===0)return;r?.();let a=o.current.filter(e=>e.type===`input_image`).length;for(let r of i){let i=r.type.startsWith(`image/`)?`input_image`:`input_file`,l=ND(`attachment`),u=ND(`upl`),d=i===`input_image`?URL.createObjectURL(r):void 0,f;if(i===`input_image`?(a+=1,a>e.maxImagesPerMessage?f=`Attach up to ${e.maxImagesPerMessage} images`:e.mediaTypes.includes(r.type)?(r.size<=0||r.size>e.maxImageBytes)&&(f=`Image must be smaller than ${bk(e.maxImageBytes)}`):f=`Unsupported image type`):(r.size<=0||!Number.isSafeInteger(r.size))&&(f=`File is empty or too large for this browser`),f){c(e=>[...e,{id:l,file:r,clientUploadId:u,type:i,previewUrl:d,state:`failed`,error:f}]);continue}let p={id:l,file:r,clientUploadId:u,type:i,previewUrl:d,state:t?`uploading`:`ready`};if(c(e=>[...e,p]),!t)continue;let m=new AbortController;s.current.set(l,m),t(r,u,i,m.signal).then(e=>{if(s.current.delete(l),!o.current.some(e=>e.id===l)){n?.(e).catch(()=>void 0);return}c(t=>t.map(t=>t.id===l?{...t,state:`ready`,resource:e}:t))}).catch(e=>{s.current.delete(l),!m.signal.aborted&&c(t=>t.map(t=>t.id===l?{...t,state:`failed`,error:e instanceof Error?e.message:`Upload failed`}:t))})}},[n,r,e,c,t]);return{items:i,addFiles:l,onPaste:(0,u.useCallback)(e=>{let t=Array.from(e.clipboardData.files).filter(e=>e.type.startsWith(`image/`));t.length!==0&&(e.preventDefault(),l(t))},[l]),remove:(0,u.useCallback)(e=>{r?.(),s.current.get(e.id)?.abort(),s.current.delete(e.id),c(t=>t.filter(t=>t.id!==e.id)),e.previewUrl&&URL.revokeObjectURL(e.previewUrl),e.resource&&n?.(e.resource).catch(()=>void 0)},[n,r,c]),clear:(0,u.useCallback)(()=>{for(let e of s.current.values())e.abort();s.current.clear();for(let e of o.current)e.previewUrl&&URL.revokeObjectURL(e.previewUrl);o.current=[],a([])},[]),hasPending:i.some(e=>e.state===`uploading`),hasFailed:i.some(e=>e.state===`failed`),readyResources:i.flatMap(e=>e.state===`ready`&&e.resource?[e.resource]:[]),readyUploads:i.flatMap(e=>e.state===`ready`?[{file:e.file,clientUploadId:e.clientUploadId,type:e.type}]:[])}}function vk({items:e,disabled:t,onRemove:n,className:r}){return e.length===0?null:(0,H.jsx)(`div`,{className:X(`flex gap-2 overflow-x-auto px-2 pb-2`,r),"aria-label":`Attachments`,children:e.map(e=>(0,H.jsxs)(`div`,{className:X(`group relative h-20 shrink-0 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]`,e.type===`input_image`?`w-20`:`w-52`),title:e.error??e.file.name,children:[e.previewUrl?(0,H.jsx)(`img`,{src:e.previewUrl,alt:e.file.name,className:`size-full object-cover`}):(0,H.jsxs)(`div`,{className:`flex size-full items-center gap-2 px-3 pr-8`,children:[(0,H.jsx)(nr,{className:`size-5 shrink-0 text-[var(--primary)]`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-xs font-medium`,children:e.file.name}),(0,H.jsx)(`div`,{className:`text-[10px] text-[var(--muted-foreground)]`,children:xk(e.file.size)})]})]}),e.state===`uploading`&&(0,H.jsx)(`div`,{className:`absolute inset-0 grid place-items-center bg-black/45 text-white`,children:(0,H.jsx)(B,{className:`size-5 animate-spin`})}),e.state===`failed`&&(0,H.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 bg-[var(--destructive)] px-1 py-0.5 text-center text-[9px] text-white`,children:`Upload failed`}),(0,H.jsx)(`button`,{type:`button`,className:`absolute right-1 top-1 grid size-5 place-items-center rounded-full bg-black/65 text-white opacity-90 transition-opacity hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-45`,"aria-label":`Remove ${e.file.name}`,disabled:t,onClick:()=>n(e),children:(0,H.jsx)(di,{className:`size-3`})})]},e.id))})}function yk({policy:e,disabled:t,onFiles:n,className:r}){let i=(0,u.useRef)(null);function a(e){n(Array.from(e.target.files??[])),e.target.value=``}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{ref:i,type:`file`,multiple:!0,className:`hidden`,onChange:a}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:X(`size-8 shrink-0`,r),disabled:t||!e.enabled,"aria-label":`Attach files`,title:`Attach images or files`,onClick:()=>i.current?.click(),children:e.enabled?(0,H.jsx)(Nr,{}):(0,H.jsx)(pr,{})})]})}function bk(e){return`${Math.round(e/1048576)} MB`}function xk(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}var Sk=200;function Ck({initialDraft:e,model:t,running:n,collaborationMode:r,streamCurrent:i,disabled:a,sessionId:o,runtimeSelector:s,onSend:c,onStop:l}){let[d,f]=(0,u.useState)(e??``),[p,m]=(0,u.useState)(gk),[h,g]=(0,u.useState)(!1),_=(0,u.useRef)(null),v=(0,u.useRef)(!1),y=(0,u.useRef)(void 0),b=(0,u.useRef)(0),x=(0,u.useRef)(!1),S=_k({policy:p,upload:(e,t,n,r)=>Y.uploadSessionResource(s,o,e,t,n,r),deleteResource:e=>Y.deleteSessionResource(s,o,e.resourceId),onChange:()=>{y.current=void 0}});(0,u.useEffect)(()=>{let e=!1;return Y.getSessionResourcePolicy(s,o).then(t=>{e||m(t)}).catch(()=>{e||m(gk)}),()=>{e=!0}},[s,o]),(0,u.useEffect)(()=>{e!==void 0&&f(t=>t||e)},[e]),(0,u.useLayoutEffect)(()=>{let e=_.current;if(!e)return;e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${Math.min(t,Sk)}px`,e.style.overflowY=t>Sk?`auto`:`hidden`},[d]);async function C(){if(x.current)return;let e=d,t=b.current,n=d.trim(),r=S.readyResources;if(!n&&r.length===0||S.hasPending||S.hasFailed)return;let i=r.length>0?y.current??ND(`msg`):void 0;i&&(y.current=i),x.current=!0,g(!0),f(``);try{await c({text:n,attachments:r,clientMessageId:i}),S.clear(),y.current=void 0}catch(n){V.error(`Could not send message: ${n instanceof Error?n.message:`unknown error`}`),Ux(n)?f(n=>fk(n,e,b.current,t)):(S.clear(),y.current=void 0)}finally{x.current=!1,g(!1)}}let w=!a&&!h&&!S.hasPending&&!S.hasFailed&&(!!d.trim()||S.items.length>0);return(0,H.jsx)(`div`,{className:`px-4 pb-3 pt-1`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-[var(--border)] bg-[var(--card)] p-2 shadow-[var(--shadow-sm)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),var(--shadow-sm)]`,children:[(0,H.jsx)(vk,{items:S.items,disabled:h,onRemove:S.remove}),(0,H.jsx)(`textarea`,{ref:_,value:d,rows:1,placeholder:`Message… (Enter to send · Shift+Enter for newline)`,disabled:a,onChange:e=>{b.current+=1,y.current=void 0,f(e.target.value)},onPaste:e=>{h||S.onPaste(e)},onCompositionStart:()=>{v.current=!0},onCompositionEnd:()=>{v.current=!1},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!v.current&&!e.nativeEvent.isComposing&&e.keyCode!==229&&(e.preventDefault(),w&&C())},className:X(`block min-h-[52px] w-full resize-none overflow-hidden border-0 bg-transparent px-2 py-1.5`,`text-sm leading-relaxed placeholder:text-[var(--muted-foreground)]`,`focus-visible:outline-none`,`disabled:cursor-not-allowed disabled:opacity-50`),style:{maxHeight:Sk}}),(0,H.jsxs)(`div`,{className:`flex min-h-8 items-center gap-2 pt-1`,children:[(0,H.jsx)(yk,{policy:p,disabled:a||h,onFiles:S.addFiles}),(0,H.jsx)(wk,{fallbackModel:t,running:n,collaborationMode:r,streamCurrent:i,sessionId:o,runtimeSelector:s}),n?(0,H.jsxs)(J,{variant:`outline`,className:`ml-auto h-8 shrink-0`,onClick:l,title:`Stop the running turn`,children:[(0,H.jsx)(ni,{}),` Stop`]}):(0,H.jsxs)(J,{className:`ml-auto h-8 shrink-0`,onClick:C,disabled:!w,children:[(0,H.jsx)(Ur,{}),` Send`]})]})]})})}function wk({fallbackModel:e,running:t,collaborationMode:n,streamCurrent:r,sessionId:i,runtimeSelector:a}){let[o,s]=(0,u.useState)(null),[c,l]=(0,u.useState)([]),[d,f]=(0,u.useState)(!0),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(!1),_=(0,u.useRef)({key:null,streamCurrent:void 0});(0,u.useEffect)(()=>{let e=`${a}\0${i}`,t=_.current,n={key:e,streamCurrent:r};if(_.current=n,!pk(t,n))return;let o=!1,c=t.key!==e;return c&&(f(!0),s(null),l([])),Promise.all([Y.getSessionExecutionSettings(a,i),Y.listSessionLaunchOptions(a)]).then(([e,t])=>{o||(s(e),l(t.providers.find(t=>t.id===e.provider)?.models??[]))}).catch(()=>{}).finally(()=>{!o&&c&&f(!1)}),()=>{o=!0}},[a,i,r]),(0,u.useEffect)(()=>{n&&s(e=>e&&{...e,collaborationMode:n})},[n]);let v=c.find(e=>e.id===o?.model),y=v?.reasoningOptions.find(e=>e.value===o?.reasoningEffort),b=v?`${v.label}${y?` / ${y.label}`:``}`:o?.model??e,x=t||p||d||!o||c.length===0;async function S(e,n){if(!(p||t)){m(!0);try{let t=await Y.updateSessionExecutionSettings(a,i,{model:e,reasoningEffort:n});s(t)}catch(e){V.error(`Could not change model: ${e instanceof Error?e.message:`unknown error`}`)}finally{m(!1)}}}async function C(){if(!o||h)return;let e=o,t=o.collaborationMode===`plan`?`default`:`plan`;g(!0),s({...o,collaborationMode:t});try{let e=await Y.updateSessionExecutionSettings(a,i,{model:o.model,reasoningEffort:o.reasoningEffort,collaborationMode:t});s(e)}catch(n){s(e);let r=t===`plan`?`enter`:`exit`;V.error(`Could not ${r} Plan mode: ${n instanceof Error?n.message:`unknown error`}`)}finally{g(!1)}}let w=o?.provider===`codex`||o?.provider===`traex`,T=o?.collaborationMode===`plan`,E=T?`Exit Plan mode`:`Enter Plan mode`,D=w?(0,H.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:X(`h-7 shrink-0 gap-1 px-2 text-[11px] font-medium`,T?`bg-[color-mix(in_srgb,var(--primary)_10%,transparent)] text-[var(--primary)] hover:bg-[color-mix(in_srgb,var(--primary)_14%,transparent)]`:`text-[var(--muted-foreground)] hover:text-[var(--foreground)]`),"aria-label":E,"aria-pressed":T,"data-testid":`session-plan-mode-toggle`,"data-active":T?`true`:void 0,title:E,disabled:h,onClick:()=>void C(),children:[h?(0,H.jsx)(B,{className:`size-3 animate-spin`}):(0,H.jsx)(nr,{className:`size-3`,strokeWidth:1.8}),(0,H.jsx)(`span`,{children:`Plan`})]}):null;return!b&&!D?null:c.length===0||!o?(0,H.jsxs)(H.Fragment,{children:[b?(0,H.jsx)(`span`,{className:`min-w-0 max-w-52 truncate px-2 font-mono text-[10px] text-[var(--muted-foreground)]`,children:b}):null,D]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(xg,{children:[(0,H.jsx)(Sg,{asChild:!0,children:(0,H.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,disabled:x,className:`h-7 min-w-0 max-w-52 justify-start gap-1.5 px-2 font-normal text-[11px] text-[var(--muted-foreground)]`,"aria-label":`Model and thinking effort`,title:t?`Model settings can be changed after the current turn finishes`:`Change model and thinking effort for the next turn`,children:[p?(0,H.jsx)(B,{className:`size-3 animate-spin`}):null,(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:b}),(0,H.jsx)(Fn,{className:`size-3 shrink-0 opacity-55`})]})}),(0,H.jsxs)(Cg,{align:`start`,className:`min-w-56`,children:[(0,H.jsx)(Tg,{className:`font-mono text-[9px] uppercase tracking-[0.12em]`,children:`Model → Thinking effort`}),c.map(e=>{let t=o.model===e.id;return e.reasoningOptions.length===0?(0,H.jsxs)(wg,{onSelect:()=>void S(e.id,null),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),t&&(0,H.jsx)(Pn,{className:`size-3.5 text-[var(--primary)]`})]},e.id):(0,H.jsxs)(Dg,{children:[(0,H.jsxs)(Og,{children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),t&&(0,H.jsx)(Pn,{className:`size-3.5 text-[var(--primary)]`})]}),(0,H.jsxs)(kg,{children:[(0,H.jsx)(Tg,{className:`font-mono text-[9px] uppercase tracking-[0.12em]`,children:`Thinking effort`}),e.reasoningOptions.map(n=>{let r=t&&o.reasoningEffort===n.value;return(0,H.jsxs)(wg,{onSelect:()=>void S(e.id,n.value),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),r&&(0,H.jsx)(Pn,{className:`size-3.5 text-[var(--primary)]`})]},n.value)})]})]},e.id)})]})]}),D]})}var Tk=24,Ek={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function Dk({pages:e,order:t,selectedPageId:n,selectionDisabled:r,mutationDisabled:i,createDisabled:a,createPending:o,emulatorAttached:s,emulator:c,onSelectPage:l,onClosePage:d,onCreatePage:f,onSelectEmulator:p,onCloseEmulator:m,onAddEmulator:h,headerLeadingAction:g,settingsAction:_,leadingAction:v,trailingAction:y}){let b=(0,u.useRef)(null),x=(0,u.useRef)(null),S=(0,u.useRef)(null),C=(0,u.useRef)(null),w=(0,u.useRef)(null),T=(0,u.useRef)(null),[E,D]=(0,u.useState)(Ek),O=t.flatMap(t=>{if(t===oD())return c?[{type:`emulator`,key:t,emulator:c}]:[];let n=e.find(e=>aD(e.pageId)===t);return n?[{type:`browser`,key:t,page:n}]:[]}),k=O.map(e=>e.key).join(`
|
|
56
|
+
`),A=O.length,j=(0,u.useCallback)(()=>{let e=b.current,t=x.current,n=S.current;if(!(!e||!t||!n))return jO({scrollLeft:t.scrollLeft,viewportWidth:t.clientWidth,contentWidth:n.scrollWidth,availableWidth:e.clientWidth})},[]),M=(0,u.useCallback)(()=>{let e=j();e&&D(t=>Ak(t,e)?t:e)},[j]),N=(0,u.useCallback)(()=>{w.current===null&&(w.current=window.requestAnimationFrame(()=>{w.current=null,M()}))},[M]),P=(0,u.useCallback)(e=>{let t=x.current,n=C.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=NO({scrollLeft:t.scrollLeft,viewportWidth:t.clientWidth,tabLeft:t.scrollLeft+i.left-r.left,tabWidth:i.width,inset:Tk});a!==0&&t.scrollBy({left:a,behavior:e})},[]),F=(0,u.useCallback)(e=>{let t=x.current;if(!t)return;let n=MO(t.clientWidth);t.scrollBy({left:e===`left`?-n:n,behavior:kk()})},[]);(0,u.useEffect)(()=>()=>{w.current!==null&&window.cancelAnimationFrame(w.current)},[]),(0,u.useLayoutEffect)(()=>{let e=b.current,t=x.current,n=S.current;if(!e||!t||!n)return;let r=()=>{let e=t.clientWidth,n=T.current===null||Math.abs(e-T.current)>1;T.current=e,N(),n&&P(`auto`)},i=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return i?.observe(e),i?.observe(t),i?.observe(n),window.addEventListener(`resize`,r),M(),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[P,N,M]),(0,u.useEffect)(()=>{let e=x.current;if(!e)return;let t=t=>{if(t.ctrlKey||t.deltaY===0||Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;let n=j();(t.deltaY<0?n?.canScrollLeft:n?.canScrollRight)&&(t.preventDefault(),e.scrollLeft+=t.deltaY,N())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[j,N]),(0,u.useLayoutEffect)(()=>{P(kk()),N()},[k,P,N,E.hasOverflow,n]);function I(e,t){let n;if(e.key===`ArrowLeft`?n=(t-1+A)%A:e.key===`ArrowRight`?n=(t+1)%A:e.key===`Home`?n=0:e.key===`End`&&(n=A-1),n===void 0||n===t)return;e.preventDefault();let r=S.current?.querySelectorAll(`[role="tab"]`).item(n);r?.focus(),r?.click()}return(0,H.jsxs)(`div`,{className:`desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-end gap-1 border-b border-[var(--border)] bg-[var(--muted)]/30 pl-2 pr-3 pt-1 sm:pr-4`,children:[g&&(0,H.jsx)(`div`,{className:`mb-1 flex h-8 shrink-0 items-center`,children:g}),(0,H.jsxs)(`div`,{ref:b,className:`flex min-w-0 flex-1 items-end gap-1`,children:[E.hasOverflow&&(0,H.jsx)(Ok,{direction:`left`,disabled:!E.canScrollLeft,onClick:()=>F(`left`)}),(0,H.jsx)(`div`,{ref:x,className:`min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,style:jk(E),onScroll:N,children:(0,H.jsx)(`div`,{ref:S,className:`flex w-max items-end gap-1`,role:`tablist`,"aria-label":`Session resources`,children:O.map((e,t)=>{if(e.type===`emulator`){let n=e.emulator;return(0,H.jsxs)(`div`,{ref:n.selected?C:void 0,role:`presentation`,className:n.selected?`group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2`:`group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]`,children:[(0,H.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.selected,"aria-label":n.label,title:n.label,tabIndex:n.selected?0:-1,onClick:p,onKeyDown:e=>I(e,t),className:`flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[n.busy?(0,H.jsx)(B,{className:`size-3 shrink-0 animate-spin`}):(0,H.jsx)($r,{className:`size-3 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:n.label})]}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Close emulator tab`,title:`Close emulator tab`,onClick:m,className:`ml-1`,children:(0,H.jsx)(di,{className:`size-3`})})]},e.key)}let a=e.page,o=a.pageId===n,s=a.title||a.url||`New page`;return(0,H.jsxs)(`div`,{ref:o?C:void 0,role:`presentation`,className:o?`group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2`:`group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]`,children:[(0,H.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o,"aria-label":s,title:s,tabIndex:o?0:-1,disabled:r,onClick:()=>l(a.pageId),onKeyDown:e=>I(e,t),className:`flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[a.loading?(0,H.jsx)(B,{className:`size-3 shrink-0 animate-spin`}):(0,H.jsx)(Xn,{className:`size-3 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:s})]}),(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Close ${s}`,title:`Close ${s}`,disabled:i,onClick:()=>d(a.pageId),className:`ml-1`,children:(0,H.jsx)(di,{className:`size-3`})})]},e.key)})})}),E.hasOverflow&&(0,H.jsx)(Ok,{direction:`right`,disabled:!E.canScrollRight,onClick:()=>F(`right`)})]}),(0,H.jsxs)(xg,{children:[(0,H.jsx)(Sg,{asChild:!0,children:(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mb-1 size-8`,"aria-label":`Add Session resource`,title:`Add Session resource`,children:(0,H.jsx)(Ir,{})})}),(0,H.jsxs)(Cg,{align:`end`,children:[(0,H.jsxs)(wg,{disabled:a,"aria-busy":o,onSelect:f,children:[o?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(Xn,{}),o?`Creating browser tab…`:`New browser tab`]}),(0,H.jsxs)(wg,{onSelect:h,children:[(0,H.jsx)($r,{}),c||s?`Show emulator`:`Attach emulator`]})]})]}),_&&(0,H.jsx)(`div`,{className:`mb-1 shrink-0`,children:_}),v&&(0,H.jsx)(`div`,{className:`mb-1 shrink-0`,children:v}),y&&(0,H.jsx)(`div`,{className:`mb-1 ml-0.5 shrink-0`,children:y})]})}function Ok({direction:e,disabled:t,onClick:n}){let r=e===`left`?In:Ln;return(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mb-1 size-7`,"aria-label":`Scroll resource tabs ${e}`,title:`Scroll resource tabs ${e}`,disabled:t,onClick:n,children:(0,H.jsx)(r,{})})}function kk(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function Ak(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function jk(e){let t=`${Tk}px`,n;return e.canScrollLeft&&e.canScrollRight?n=`linear-gradient(to right, transparent, #000 ${t}, #000 calc(100% - ${t}), transparent)`:e.canScrollLeft?n=`linear-gradient(to right, transparent, #000 ${t}, #000 100%)`:e.canScrollRight&&(n=`linear-gradient(to right, #000 0, #000 calc(100% - ${t}), transparent)`),n?{WebkitMaskImage:n,maskImage:n}:void 0}var Mk=8,Nk=4e3;function Pk({sessionId:e,runtimeSelector:t,controller:n,readOnly:r=!1}){return n.binding?(0,H.jsx)(Ik,{sessionId:e,runtimeSelector:t,binding:n.binding,controller:n,readOnly:r}):r?(0,H.jsx)(zk,{icon:(0,H.jsx)(xr,{className:`size-5`}),label:`No Emulator is attached.`}):(0,H.jsx)(Fk,{controller:n})}function Fk({controller:e}){let[t,n]=(0,u.useState)(null),r=async t=>{n(t);try{await e.attach(t)}catch(e){V.error(`Could not attach Emulator: ${e.message}`)}finally{n(null)}};return(0,H.jsx)(U_,{className:`min-h-0 flex-1`,children:(0,H.jsx)(`div`,{className:`p-4 sm:p-5`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,H.jsxs)(`div`,{className:`mb-4 flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Attach an Emulator`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:`Only devices available to this Session are shown. Attaching does not affect another Session.`})]}),(0,H.jsx)(J,{variant:`ghost`,size:`icon-sm`,onClick:()=>void e.reloadDevices(),title:`Refresh devices`,"aria-label":`Refresh devices`,children:(0,H.jsx)(zr,{className:X(`size-4`,e.devicesLoading&&`animate-spin`)})})]}),e.error&&(0,H.jsx)(`div`,{className:`mb-3 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]`,children:e.error.message}),e.devicesLoading&&e.devices.length===0?(0,H.jsx)(`div`,{className:`grid min-h-40 place-items-center`,"aria-live":`polite`,children:(0,H.jsx)(zk,{icon:(0,H.jsx)(B,{className:`size-5 animate-spin`}),label:`Loading devices…`})}):e.devices.length===0?(0,H.jsxs)(`div`,{className:`rounded-md border border-dashed border-[var(--border)] px-5 py-10 text-center`,children:[(0,H.jsx)(xr,{className:`mx-auto mb-3 size-6 text-[var(--muted-foreground)]`}),(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`No Emulator is available`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:`Boot a simulator on this Runtime, or release one from another Session.`})]}):(0,H.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:e.devices.map(n=>(0,H.jsxs)(`button`,{type:`button`,disabled:e.mutating,onClick:()=>void r(n.id),className:`group flex min-h-20 items-center gap-3 rounded-md border border-[var(--border)] bg-[var(--card)] p-3 text-left transition-colors hover:border-[var(--primary)]/50 hover:bg-[var(--primary)]/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-60`,children:[(0,H.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-[var(--primary)]/10 text-[var(--primary)]`,children:t===n.id?(0,H.jsx)(B,{className:`size-4 animate-spin`}):(0,H.jsx)(xr,{className:`size-4`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:n.name}),(0,H.jsxs)(`span`,{className:`mt-1 flex items-center gap-2`,children:[(0,H.jsx)(Rk,{state:n.state}),(0,H.jsx)(`span`,{className:`font-mono text-[9px] uppercase text-[var(--muted-foreground)]`,children:n.backend})]})]})]},`${n.backend}:${n.id}`))})]})})})}function Ik({sessionId:e,runtimeSelector:t,binding:n,controller:r,readOnly:i}){let[a,o]=(0,u.useState)(null),[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(null),m=(0,u.useRef)(null),h=(0,u.useRef)(null),g=(0,u.useRef)(null),_=(0,u.useRef)(null),v=(0,u.useRef)(null);(0,u.useEffect)(()=>{o(null),c(!1),p(null),d(null);let r=!1,i,a,s=0,l=0,u=!1,f=null,m,g=`png`,_=()=>{a!==void 0&&window.clearTimeout(a),a=void 0,d(null)},v=(e,t=!1)=>{if(a!==void 0&&window.clearTimeout(a),t||f===null){d(e);return}a=window.setTimeout(()=>{a=void 0,r||d(e)},Nk)},y=e=>{if(r)return;let t=URL.createObjectURL(e),n=f;f=t,o(t),_(),s=0,u=!1,n&&window.setTimeout(()=>URL.revokeObjectURL(n),1e3)},b=(e,t=!1)=>{if(r)return;i!==void 0&&window.clearTimeout(i);let n=t?0:Math.min(8e3,500*2**s++);i=window.setTimeout(()=>void e(t),n)},x=async(i=!1)=>{let a=++l;try{let o=await Qx(i);if(r||a!==l)return;let s=new WebSocket(Lk({runtimeSelector:t,sessionId:e,bindingId:n.bindingId,maximumFrameRate:n.backend===`ios`?30:5,capability:o}));m=s,s.binaryType=`arraybuffer`,s.onmessage=e=>{if(r||a!==l||m!==s)return;if(typeof e.data==`string`){try{let t=JSON.parse(e.data);if(t.type!==`emulator.surface.ready`||typeof t.surfaceId!=`string`||t.format!==`png`&&t.format!==`jpeg`)throw Error(`invalid Emulator Surface ready frame`);g=t.format,h.current={socket:s,surfaceId:t.surfaceId,inputSequence:0}}catch{s.close(4400,`invalid Emulator Surface ready frame`)}return}let t=e.data instanceof ArrayBuffer||e.data instanceof Blob?e.data:null,n=g===`jpeg`?`image/jpeg`:`image/png`;(t instanceof Blob||t)&&y(new Blob([t],{type:n}))},s.onclose=e=>{if(r||a!==l||m!==s)return;h.current?.socket===s&&(h.current=null);let t=Error(e.code===4406?`emulator_surface_upgrade_required`:e.reason||`Remote Emulator Surface disconnected`);v(t,e.code===4406),e.code!==4406&&((e.code===4403||e.code===1006)&&!u?(u=!0,b(x,!0)):b(x))},s.onerror=()=>void 0}catch(e){if(r||a!==l)return;v(e instanceof Error?e:Error(String(e))),b(x)}};return x(),()=>{r=!0,l+=1,h.current=null,m?.close(1e3,`Session Emulator pane closed`),i!==void 0&&window.clearTimeout(i),a!==void 0&&window.clearTimeout(a),f&&URL.revokeObjectURL(f)}},[n.backend,n.bindingId,t,e]);let y=(0,u.useCallback)((e,t,n)=>{let r=h.current;if(!r||r.socket.readyState!==WebSocket.OPEN||n!==void 0&&r.surfaceId!==n)return!1;try{return r.socket.send(JSON.stringify({type:`emulator.surface.touch`,surfaceId:r.surfaceId,inputSequence:r.inputSequence++,phase:e,...t})),!0}catch{return!1}},[]),b=(0,u.useCallback)(()=>{_.current!==null&&window.cancelAnimationFrame(_.current),_.current=null;let e=g.current;g.current=null,e&&y(`move`,e,e.surfaceId)},[y]),x=(0,u.useCallback)(e=>{let t=m.current;if(!t)return null;let n=t.getBoundingClientRect();return n.width<=0||n.height<=0?null:{x:Math.max(0,Math.min(1,(e.clientX-n.left)/n.width)),y:Math.max(0,Math.min(1,(e.clientY-n.top)/n.height))}},[]),S=e=>{if(r.mutating)return;let t=x(e.nativeEvent);if(!t)return;e.currentTarget.setPointerCapture(e.pointerId);let n=h.current?.surfaceId??null,i=n!==null&&y(`begin`,t,n);v.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,lastPoint:t,points:[{type:`begin`,...t}],live:i,surfaceId:i?n:null}},C=e=>{let t=v.current;if(!t||t.pointerId!==e.pointerId)return;let n=x(e.nativeEvent);n&&t.live?(t.lastPoint=n,g.current=t.surfaceId?{...n,surfaceId:t.surfaceId}:null,_.current===null&&(_.current=window.requestAnimationFrame(()=>b()))):n&&t.points.length<255&&(t.lastPoint=n,t.points.push({type:`move`,...n}))},w=e=>{let t=v.current;if(v.current=null,!t||t.pointerId!==e.pointerId)return;let n=x(e.nativeEvent);if(n){if(t.live){b(),t.surfaceId&&y(`end`,n,t.surfaceId);return}(Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>Mk?r.gesture([...t.points,{type:`end`,...n}]):r.tap(n.x,n.y)).catch(e=>V.error(`Emulator input failed: ${e.message}`))}},T=async()=>{try{await r.detach()}catch(e){V.error(`Could not detach Emulator: ${e.message}`)}};return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--background)]`,children:[(0,H.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-xs font-medium`,children:n.deviceName??n.deviceId}),(0,H.jsx)(Rk,{state:n.deviceState}),!n.available&&(0,H.jsx)(MC,{variant:`outline`,children:`Unavailable`}),l&&a&&(0,H.jsxs)(MC,{variant:`outline`,className:`gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]`,children:[(0,H.jsx)(B,{className:`size-2.5 animate-spin`}),`Reconnecting`]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(J,{variant:`ghost`,size:`icon-sm`,disabled:!n.available||r.mutating,title:`Home`,"aria-label":`Home`,onClick:()=>void r.button(`home`).catch(e=>V.error(`Home failed: ${e.message}`)),children:(0,H.jsx)(dr,{})}),(0,H.jsxs)(J,{variant:`ghost`,size:`sm`,disabled:r.mutating,title:`Detach from this session`,onClick:()=>void T(),children:[r.mutating?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(li,{}),`Detach`]})]})]}),(0,H.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 items-center justify-center overflow-hidden p-3`,children:[!s&&!l&&(0,H.jsx)(`div`,{className:`absolute inset-0 z-10 grid place-items-center bg-[var(--background)]`,children:(0,H.jsx)(zk,{icon:(0,H.jsx)(B,{className:`size-5 animate-spin`}),label:`Connecting to Emulator…`})}),l&&!a&&(0,H.jsxs)(`div`,{className:`max-w-sm text-center`,children:[(0,H.jsx)(xr,{className:`mx-auto mb-3 size-7 text-[var(--muted-foreground)]`}),(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:t===`local`?`Preview is unavailable`:`Remote Emulator Surface is unavailable`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-[var(--muted-foreground)]`,children:l.message===`emulator_surface_upgrade_required`?`Upgrade the selected Runtime daemon to a version with Emulator Surface support.`:l.message})]}),a&&(0,H.jsx)(`img`,{ref:m,src:a,alt:n.deviceName??n.deviceId,draggable:!1,onLoad:e=>{p({width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalHeight}),c(!0)},onPointerDown:i?void 0:S,onPointerMove:i?void 0:C,onPointerUp:i?void 0:w,onPointerCancel:i?void 0:()=>{let e=v.current;v.current=null,e?.live&&(b(),e.surfaceId&&y(`end`,e.lastPoint,e.surfaceId))},className:`max-h-full max-w-full touch-none select-none rounded-md bg-black object-contain shadow-[var(--shadow-md)]`,style:f?{aspectRatio:`${f.width} / ${f.height}`}:void 0})]})]})}function Lk(e){let t=location.protocol===`https:`?`wss`:`ws`,n=new URLSearchParams({bindingId:e.bindingId,maximumFrameRate:String(e.maximumFrameRate),capability:e.capability});return Vx(n),`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/emulator/surface?${n.toString()}`}function Rk({state:e}){return(0,H.jsxs)(MC,{variant:`outline`,className:X(`gap-1 px-1.5 py-0 font-mono text-[8px] uppercase`,e===`booted`&&`border-[var(--success)]/30 text-[var(--success)]`,e===`shutdown`&&`text-[var(--muted-foreground)]`),children:[(0,H.jsx)(`span`,{className:X(`size-1 rounded-full bg-current`,e===`booted`&&`animate-pulse`)}),e]})}function zk({icon:e,label:t}){return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-2 text-[var(--muted-foreground)]`,children:[e,(0,H.jsx)(`span`,{className:`text-xs`,children:t})]})}var Bk=`Collapsible`,[Vk,Hk]=Wi(Bk),[Uk,Wk]=Vk(Bk),Gk=u.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=ea({prop:r,defaultProp:i??!1,onChange:o,caller:Bk});return(0,H.jsx)(Uk,{scope:n,disabled:a,contentId:Qi(),open:c,onOpenToggle:u.useCallback(()=>l(e=>!e),[l]),children:(0,H.jsx)(W.div,{"data-state":Zk(c),"data-disabled":a?``:void 0,...s,ref:t})})});Gk.displayName=Bk;var Kk=`CollapsibleTrigger`,qk=u.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Wk(Kk,n);return(0,H.jsx)(W.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Zk(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:U(e.onClick,i.onOpenToggle)})});qk.displayName=Kk;var Jk=`CollapsibleContent`,Yk=u.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Wk(Jk,e.__scopeCollapsible);return(0,H.jsx)(Qa,{present:n||i.open,children:({present:e})=>(0,H.jsx)(Xk,{...r,ref:t,present:e})})});Yk.displayName=Jk;var Xk=u.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Wk(Jk,n),[s,c]=u.useState(r),l=u.useRef(null),d=Ji(t,l),f=u.useRef(0),p=f.current,m=u.useRef(0),h=m.current,g=o.open||s,_=u.useRef(g),v=u.useRef(void 0);return u.useEffect(()=>{let e=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(e)},[]),Yi(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();f.current=t.height,m.current=t.width,_.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,H.jsx)(W.div,{"data-state":Zk(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!g,...a,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&i})});function Zk(e){return e?`open`:`closed`}var Qk=Gk,$k=qk,eA=Yk,tA=Qk,nA=$k,rA=eA;function iA({status:e}){return e===`completed`?(0,H.jsx)(Pn,{className:`size-3 shrink-0 text-[var(--success)]`}):e===`in_progress`?(0,H.jsx)(B,{className:`size-3 shrink-0 animate-spin text-[var(--primary)]`}):(0,H.jsx)(Kn,{className:`size-3 shrink-0 text-[var(--muted-foreground)]`})}function aA({todos:e}){let[t,n]=(0,u.useState)(!0);if(e.length===0)return null;let r=e.filter(e=>e.status===`completed`).length;return(0,H.jsxs)(tA,{open:t,onOpenChange:n,className:`mx-auto mt-2 w-[calc(100%-2rem)] max-w-3xl rounded-md border border-[var(--border)] bg-[var(--muted)]/30`,children:[(0,H.jsxs)(nA,{className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs`,children:[(0,H.jsx)(Ln,{className:X(`size-3 shrink-0 text-[var(--muted-foreground)] transition-transform`,t&&`rotate-90`)}),(0,H.jsx)(`span`,{className:`label-caps text-[var(--muted-foreground)]`,children:`Tasks`}),(0,H.jsxs)(`span`,{className:`font-mono text-[var(--muted-foreground)]`,children:[r,`/`,e.length]})]}),(0,H.jsx)(rA,{className:`overflow-hidden px-3 pb-2`,children:(0,H.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,H.jsx)(iA,{status:e.status}),(0,H.jsx)(`span`,{className:X(`truncate`,e.status===`completed`&&`text-[var(--muted-foreground)] line-through`),children:e.subject})]},e.id))})})]})}function oA({item:e}){return(0,H.jsxs)(`div`,{className:`my-1 flex items-center gap-2 px-1 py-1 text-sm italic text-[var(--muted-foreground)]`,children:[(0,H.jsx)(Qr,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:e.status===`in_progress`?`animate-pulse`:void 0,children:e.status===`in_progress`?`Compacting conversation…`:`Conversation compacted`})]})}function sA({open:e,src:t,alt:n,onOpenChange:r}){return(0,H.jsx)(Su,{open:e,onOpenChange:r,children:(0,H.jsxs)(Du,{showCloseButton:!1,"aria-describedby":void 0,className:`inset-0 left-0 top-0 h-dvh max-h-none w-screen max-w-none translate-x-0 translate-y-0 place-items-center gap-0 rounded-none bg-black/80 p-4 text-white ring-0 sm:max-w-none`,onClick:()=>r(!1),children:[(0,H.jsx)(Au,{className:`sr-only`,children:n}),(0,H.jsxs)(`div`,{className:`absolute right-4 top-4 z-10 flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`grid size-9 place-items-center rounded-full bg-black/60 text-white transition-colors hover:bg-black/75 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white`,"aria-label":`Open original image`,children:(0,H.jsx)(er,{className:`size-4`})}),(0,H.jsx)(Tu,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`grid size-9 place-items-center rounded-full bg-black/60 text-white transition-colors hover:bg-black/75 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white`,"aria-label":`Close image preview`,children:(0,H.jsx)(di,{className:`size-5`})})})]}),(0,H.jsx)(`img`,{src:t,alt:n,className:`block h-auto max-h-[calc(100dvh-2rem)] min-h-0 w-auto max-w-[calc(100vw-2rem)] min-w-0 rounded-md object-contain shadow-2xl`,onClick:e=>e.stopPropagation()})]})})}function cA(e,t,n){let[r,i]=(0,u.useState)(e),a=(0,u.useRef)(0),o=(0,u.useRef)(0),s=(0,u.useRef)(e);return s.current=e,(0,u.useEffect)(()=>{if(!n){window.clearTimeout(o.current),o.current=0,a.current=0,i(e);return}if(Object.is(r,e))return;let c=Date.now()-a.current;if(a.current===0||c>=t){window.clearTimeout(o.current),o.current=0,a.current=Date.now(),i(e);return}o.current===0&&(o.current=window.setTimeout(()=>{o.current=0,a.current=Date.now(),i(s.current)},t-c))},[n,t,r,e]),(0,u.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]),n?r:e}var lA=/^\$(?:\{[A-Z_][A-Z0-9_]*\}|[A-Z_][A-Z0-9_]+(?![A-Za-z0-9_]))/,uA=/^ {0,3}(`{3,}|~{3,})/;function dA(e){let t=``,n=``,r=0,i=!1;for(let a=0;a<e.length;a+=1){let o=e[a],s=a===0||e[a-1]===`
|
|
57
|
+
`;if(!r&&s){let r=e.slice(a).match(uA);if(r){let e=r[1];n?e[0]===n[0]&&e.length>=n.length&&(n=``):n=e,t+=r[0],a+=r[0].length-1;continue}}if(n){t+=o;continue}if(o==="`"){let n=1;for(;e[a+n]==="`";)n+=1;r===0?r=n:n===r&&(r=0),t+=e.slice(a,a+n),a+=n-1;continue}if(r){t+=o;continue}if(o===`\\`&&(e[a+1]===`\\`||e[a+1]===`$`)){t+=e.slice(a,a+2),a+=1;continue}if(o===`$`){let n=1;for(;e[a+n]===`$`;)n+=1;if(n===1&&!i&&(/\d/.test(e[a+1]??``)||lA.test(e.slice(a)))){t+=`\\$`;continue}i=!i,t+=e.slice(a,a+n),a+=n-1;continue}if(!i){let n=e.slice(a,a+2);if(n===`\\(`||n===`\\)`){t+=`$`,a+=1;continue}if(n===`\\[`||n===`\\]`){t+=`$$`,a+=1;continue}}t+=o}return t}var fA=/:\d+(?::\d+)?$/,pA=/^[a-z][a-z\d+.-]*:/i;function mA(e,t){let n;try{n=decodeURI(e).replace(fA,``)}catch{return null}if(!n||n.includes(`\0`)||n.includes(`
|
|
58
|
+
`)||n.includes(`\r`)||n.includes(`?`)||n.includes(`#`)||pA.test(n)||n.startsWith(`//`))return null;if(n.startsWith(`/`)||t)return n;let r=n.indexOf(`/`);return r>0&&!/\s/.test(n.slice(0,r))?n:null}var hA=`data-rynx-workspace-image`,gA=`/__rynx_workspace_image__`,_A=(0,u.lazy)(()=>g(()=>import(`./markdown-streamdown-4N4AcNp5.js`).then(e=>({default:e.MarkdownStreamdown})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),vA=100,yA=5e4,bA=5e3,xA=2e5,SA=X(`min-w-0 wrap-anywhere text-sm leading-relaxed`,`[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5`,`[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:text-xs`,`[&_code]:font-mono [&_h1]:mt-3 [&_h2]:mt-3 [&_h3]:mt-2`,`[&_a]:text-[var(--primary)] [&_a]:underline [&_a]:underline-offset-2`);function CA(e){let t=0,n=0;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);i===32||i>=9&&i<=13?n=0:(n+=1,n>t&&(t=n))}return t}function wA(e){return e.length>yA||CA(e)>bA}function TA({text:e,className:t}){let n=e.length>xA,r=n?e.slice(0,xA):e;return(0,H.jsxs)(`div`,{className:X(`whitespace-pre-wrap break-all font-mono text-sm`,t),children:[r,n&&(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:`\n… [${e.length-xA} more characters not shown]`})]})}var EA=(0,u.createContext)(null),DA=`wrap-anywhere font-medium text-[var(--primary)] underline`;function OA(e){let t=(0,u.useContext)(EA),n=(0,u.useMemo)(()=>t&&e?Y.sessionWorkspaceFileContentUrl(t.runtimeSelector,t.sessionId,e):null,[e,t]),[r,i]=(0,u.useState)(null);return(0,u.useEffect)(()=>{if(i(null),!n)return;let e=new AbortController;return fetch(n,{method:`HEAD`,signal:e.signal}).then(e=>{e.ok&&i(n)}).catch(()=>void 0),()=>e.abort()},[n]),r}function kA({href:e,children:t,className:n,title:r,node:i,...a}){let o=typeof e==`string`?mA(e,!0):null,s=OA(o),[c,l]=(0,u.useState)(!1);return o?s?(0,H.jsx)(`a`,{...a,href:s,target:`_blank`,rel:`noreferrer`,title:r??o,"data-streamdown":`link`,className:X(DA,`decoration-dotted underline-offset-2`,n),children:t}):(0,H.jsx)(`span`,{title:r??o,children:t}):e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:X(`wrap-anywhere appearance-none text-left font-medium text-[var(--primary)] underline`,n),"data-streamdown":`link`,onClick:()=>l(!0),children:t}),(0,H.jsx)(Bw,{open:c,url:e,onOpenChange:l,onConfirm:()=>window.open(e,`_blank`,`noreferrer`)})]}):(0,H.jsx)(`span`,{className:n,children:t})}function AA({children:e,className:t,node:n,...r}){let i=OA(mA(typeof e==`string`?e:``,!1));if(!i)return(0,H.jsx)(`code`,{...r,className:X(`rounded bg-[var(--muted)] px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,children:e});let a=()=>window.open(i,`_blank`,`noreferrer`);return(0,H.jsx)(`code`,{...r,role:`link`,tabIndex:0,className:X(`cursor-pointer font-mono underline decoration-dotted underline-offset-2 transition-colors hover:text-[var(--foreground)]`,t),"data-streamdown":`inline-code`,onClick:a,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},children:e})}function jA({src:e,alt:t=``,className:n,node:r,...i}){let a=i[hA],o=typeof a==`string`?mA(a,!0):null,s=OA(o),[c,l]=(0,u.useState)(!1),[d,f]=(0,u.useState)(!1);if((0,u.useEffect)(()=>f(!1),[s]),!o||!s)return(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:t||`Image unavailable`});if(d)return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[var(--muted-foreground)]`,children:[(0,H.jsx)(fr,{className:`size-4`,"aria-hidden":`true`}),t||`Image unavailable`]});let p={...i};return delete p[hA],(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`group my-2 block max-w-full overflow-hidden rounded-md text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ring)]`,"aria-label":`Open ${t||`image`}`,onClick:()=>l(!0),children:(0,H.jsx)(`img`,{...p,src:s,alt:t,loading:`lazy`,className:X(`block h-auto max-h-80 max-w-full rounded-md object-contain transition-opacity group-hover:opacity-90`,n),onError:()=>f(!0)})}),(0,H.jsx)(sA,{open:c,src:s,alt:t||`Markdown image`,onOpenChange:l})]})}var MA={a:kA,inlineCode:AA,img:jA};function NA({isOpen:e,onClose:t,onConfirm:n,url:r}){return(0,H.jsx)(Bw,{open:e,url:r,onOpenChange:e=>{e||t()},onConfirm:n})}function PA({children:e,className:t,workspaceFiles:n,breaks:r=!1,streaming:i=!1}){let a=(0,u.useMemo)(()=>n?{runtimeSelector:n.runtimeSelector,sessionId:n.sessionId}:null,[n?.runtimeSelector,n?.sessionId]),o=(0,u.useMemo)(()=>wA(e),[e]),s=cA((0,u.useMemo)(()=>o?e:dA(e),[e,o]),vA,i);return o?(0,H.jsx)(TA,{text:e,className:t}):(0,H.jsx)(u.Suspense,{fallback:(0,H.jsx)(`div`,{className:X(`whitespace-pre-wrap break-words text-sm`,t),children:s}),children:(0,H.jsx)(EA.Provider,{value:a,children:(0,H.jsx)(_A,{breaks:r,shikiTheme:[`github-light`,`github-dark`],linkSafety:{enabled:!0,renderModal:NA},components:MA,className:X(SA,t),children:s})})})}function FA(e,t,n={},r={},i=!0){let a={},o={};for(let s of e){if(s.type===`text`){let e=typeof t[s.id]==`string`?t[s.id]:``;i&&s.required&&!e.trim()?o[s.id]=`${s.label} is required`:e.length>0&&(a[s.id]=e);continue}let e=new Set(s.options.map(e=>e.value)),c=s.allowOther===!0&&r[s.id]===!0,l=c?(n[s.id]??``).trim():``;if(s.multiple){let e=Array.isArray(t[s.id])?t[s.id]:[],n=s.options.map(e=>e.value).filter(t=>e.includes(t));l&&!n.includes(l)&&n.push(l),i&&c&&!l?o[s.id]=`${s.label}: enter a value for Other`:i&&s.required&&n.length===0?o[s.id]=`${s.label} is required`:n.length>0&&(a[s.id]=n);continue}let u=typeof t[s.id]==`string`?t[s.id]:``,d=c?l:e.has(u)?u:``;i&&c&&!l?o[s.id]=`${s.label}: enter a value for Other`:i&&s.required&&!d?o[s.id]=`${s.label} is required`:d&&(a[s.id]=d)}return Object.keys(o).length>0?{ok:!1,errors:o}:{ok:!0,answers:a}}function IA({sessionId:e,item:t,canResolve:n=!0}){let{runtimeSelector:r}=xS(),i=(0,u.useId)().replaceAll(`:`,``),[a,o]=(0,u.useState)({}),[s,c]=(0,u.useState)({}),[l,d]=(0,u.useState)({}),[f,p]=(0,u.useState)({}),[m,h]=(0,u.useState)(()=>t.request.fields[0]?.id),[g,_]=(0,u.useState)(),[v,y]=(0,u.useState)(),b=t.status===`pending`;function x(e){p(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})}function S(e,t){o(n=>({...n,[e]:t})),x(e)}function C(e,t){d(n=>({...n,[e]:t})),x(e)}function w(e){let n=t.request.fields,r=Math.max(n.findIndex(e=>e.id===m),0),i=n.findIndex(t=>t.id===e);if(!(i<0)){if(i>r){let e=n[r];if(e){let t=FA([e],a,s,l);if(!t.ok){p(e=>({...e,...t.errors}));return}x(e.id)}}h(e)}}async function T(i){if(!n)return;let o=FA(t.request.fields,a,s,l,i.requiresAnswers);if(!o.ok){p(o.errors);let e=t.request.fields.find(e=>o.errors[e.id]);e&&h(e.id);return}p({}),_(void 0),y(i.id);try{await Yx(e,t.id,{actionId:i.id,...Object.keys(o.answers).length>0?{answers:o.answers}:{}},r)}catch(e){y(void 0),_(e instanceof Error?e.message:String(e))}}let E=t.request.kind===`permission`?Jr:t.request.kind===`form`?vr:Hn,D=Math.max(t.request.fields.findIndex(e=>e.id===m),0),O=t.request.fields.length===0||D===t.request.fields.length-1,k=t.request.actions.filter(e=>!e.requiresAnswers||O),A=t.request.context?.toolName===`ExitPlanMode`&&!!t.request.context.summary;return(0,H.jsxs)(`section`,{"aria-labelledby":`${i}-title`,"aria-busy":v!==void 0,className:X(`min-w-0 max-w-full overflow-hidden rounded-lg border p-3 text-xs shadow-sm`,t.request.kind===`permission`?`border-[var(--warning)]/40 bg-[var(--warning)]/5`:`border-[var(--primary)]/30 bg-[var(--primary)]/5`),children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(E,{"aria-hidden":`true`,className:X(`mt-0.5 size-4 shrink-0`,t.request.kind===`permission`?`text-[var(--warning)]`:`text-[var(--primary)]`)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{id:`${i}-title`,className:`font-medium text-[var(--foreground)]`,children:t.request.title}),t.request.description&&(0,H.jsx)(`p`,{className:`mt-1 leading-relaxed text-[var(--muted-foreground)]`,children:t.request.description})]})]}),(0,H.jsx)(RA,{item:t}),b&&!n?(0,H.jsx)(`div`,{role:`status`,className:`mt-3 text-[var(--muted-foreground)]`,children:`Pending interaction · resolve it on the owning Runtime.`}):b?(0,H.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-3`,children:[A?(0,H.jsx)(LA,{plan:t.request.context.summary,actions:t.request.actions,feedback:typeof a.feedback==`string`?a.feedback:``,busyActionId:v,onFeedback:e=>S(`feedback`,e),onSubmit:e=>void T(e)}):(0,H.jsx)(Mg,{idPrefix:i,fields:t.request.fields,activeFieldId:m,answers:a,otherValues:s,otherSelections:l,errors:f,disabled:v!==void 0,onNavigate:w,onAnswerChange:S,onOtherSelectionChange:C,onOtherValueChange:(e,t)=>{c(n=>({...n,[e]:t})),x(e)}}),g&&(0,H.jsxs)(`p`,{role:`alert`,className:`text-[var(--destructive)]`,children:[`Could not submit: `,g]}),!A&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[k.map(e=>(0,H.jsxs)(J,{type:`button`,size:`sm`,variant:VA(e),className:`h-auto max-w-full whitespace-normal break-words py-1.5 text-left`,disabled:v!==void 0,title:e.description,"aria-label":e.description?`${e.label}. ${e.description}`:void 0,onClick:()=>void T(e),children:[v===e.id&&(0,H.jsx)(B,{"aria-hidden":`true`,className:`animate-spin`}),e.label]},e.id)),v&&(0,H.jsxs)(`span`,{role:`status`,className:`text-[var(--muted-foreground)]`,children:[`Submitting `,t.request.actions.find(e=>e.id===v)?.label,`…`]})]})]}):(0,H.jsx)(BA,{item:t})]})}function LA({plan:e,actions:t,feedback:n,busyActionId:r,onFeedback:i,onSubmit:a}){let[o,s]=(0,u.useState)(!1),c=e=>t.find(t=>t.id===e),l=e=>{let t=c(e);t&&a(t)};return(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-testid":`exit-plan-mode-review`,children:[(0,H.jsx)(`p`,{className:`text-[var(--muted-foreground)]`,children:`Claude finished planning and wants to proceed.`}),(0,H.jsx)(`div`,{className:`rounded-md border bg-[var(--background)]/60 p-3`,children:(0,H.jsx)(PA,{className:`[&>:first-child]:mt-0 [&>:last-child]:mb-0`,children:e})}),o?(0,H.jsxs)(`div`,{className:`grid gap-2`,"data-testid":`exit-plan-mode-feedback`,children:[(0,H.jsx)(jg,{autoFocus:!0,className:`min-h-20 text-xs`,placeholder:`What should change about the plan? (optional)`,value:n,disabled:r!==void 0,onChange:e=>i(e.target.value)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(J,{size:`sm`,disabled:r!==void 0,onClick:()=>l(`deny_feedback`),children:[r===`deny_feedback`?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(di,{}),`Reject plan`]}),(0,H.jsx)(J,{size:`sm`,variant:`ghost`,disabled:r!==void 0,onClick:()=>s(!1),children:`Cancel`})]})]}):(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(J,{size:`sm`,disabled:r!==void 0,onClick:()=>l(`allow_auto`),children:[r===`allow_auto`?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(fi,{}),`Yes, and use auto mode`]}),(0,H.jsxs)(J,{size:`sm`,variant:`outline`,disabled:r!==void 0,onClick:()=>l(`allow_manual`),children:[r===`allow_manual`?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(Pn,{}),`Yes, manually approve edits`]}),(0,H.jsxs)(J,{size:`sm`,variant:`outline`,disabled:r!==void 0,onClick:()=>s(!0),children:[(0,H.jsx)(di,{}),` Reject with feedback`]})]})]})}function RA({item:e}){let t=e.request.context;return!t||t.toolName===`ExitPlanMode`?null:(0,H.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-1.5`,children:[t.summary&&(0,H.jsx)(`p`,{className:`break-words leading-relaxed text-[var(--muted-foreground)]`,children:t.summary}),t.toolName&&(0,H.jsxs)(`div`,{className:`font-mono text-[10px] text-[var(--muted-foreground)]`,children:[`tool · `,t.toolName]}),t.command&&(0,H.jsx)(zA,{value:t.command}),t.cwd&&(0,H.jsx)(`div`,{className:`min-w-0 whitespace-pre-wrap break-all font-mono text-[10px] text-[var(--muted-foreground)]`,children:t.cwd}),t.diff&&(0,H.jsx)(zA,{value:t.diff,tall:!0})]})}function zA({value:e,tall:t=!1}){return(0,H.jsx)(`pre`,{className:X(`min-w-0 max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md bg-[var(--muted)] p-2 font-mono text-[11px] leading-relaxed`,t?`max-h-56`:`max-h-32`),children:(0,H.jsx)(`code`,{className:`block min-w-0`,children:e})})}function BA({item:e}){if(e.status!==`resolved`){let t=e.status===`expired`?`Expired`:e.status===`inactive`?`No longer active`:`Cancelled`;return(0,H.jsxs)(`div`,{role:`status`,className:`mt-3 text-[var(--muted-foreground)]`,children:[t,e.reason?` · ${e.reason}`:``]})}let t=e.request.actions.find(t=>t.id===e.resolution?.actionId),n=e.request.fields.flatMap(t=>{let n=e.resolution?.answers?.[t.id];if(n===void 0)return[];let r=t.type===`text`&&t.secret?`••••••••`:Array.isArray(n)?n.join(`, `):n;return[{id:t.id,label:t.label,value:r}]});return(0,H.jsxs)(`div`,{"aria-live":`polite`,className:`mt-3 grid gap-1.5 text-[var(--muted-foreground)]`,children:[(0,H.jsxs)(`div`,{children:[`Resolved · `,t?.label??e.resolution?.actionId??`answered`]}),n.map(e=>(0,H.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-2 text-[11px]`,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsx)(`span`,{className:`break-words text-[var(--foreground)]`,children:e.value})]},e.id))]})}function VA(e){return e.style===`primary`?`default`:e.style===`danger`?`destructive`:`outline`}function HA({item:e}){let t=e.rotateKind===`fork`?cr:Qn;return(0,H.jsxs)(`div`,{className:`my-2 flex items-center gap-2 text-[10px] text-[var(--muted-foreground)]`,children:[(0,H.jsx)(`div`,{className:`h-px flex-1 bg-[var(--border)]`}),(0,H.jsx)(t,{className:`size-3 shrink-0 text-[var(--primary)]`}),(0,H.jsx)(`span`,{className:`label-caps`,children:e.label}),(0,H.jsx)(`span`,{className:`font-mono opacity-70`,children:e.newSessionId.slice(0,12)}),(0,H.jsx)(`div`,{className:`h-px flex-1 bg-[var(--border)]`})]})}function UA({item:e}){return e.code===`response_stopped`?(0,H.jsxs)(`div`,{className:`my-1 flex items-center gap-2 px-1 py-1 text-xs text-[var(--muted-foreground)]`,children:[(0,H.jsx)(Wn,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:`Response stopped`})]}):(0,H.jsxs)(`div`,{className:`my-1 flex gap-2 rounded-md border border-[var(--destructive)]/40 bg-[var(--destructive)]/5 px-3 py-2 text-sm`,children:[(0,H.jsx)(ci,{className:`size-4 shrink-0 text-[var(--destructive)]`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`label-caps text-[10px] text-[var(--destructive)]`,children:[e.source,` error · `,e.code]}),(0,H.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-[var(--foreground)]/80`,children:e.message})]})]})}function WA({item:e,sessionId:t,runtimeSelector:n}){let[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(()=>new Set),[s,c]=(0,u.useState)({}),l=e.images??[],d=e.files??[],f=l.find(e=>GA(e)===r);return e.role===`user`?(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsxs)(`div`,{className:`max-w-[85%] rounded-md rounded-br-sm bg-[var(--primary)]/10 p-2 text-sm dark:bg-[var(--primary)]/25 dark:ring-1 dark:ring-inset dark:ring-[var(--primary)]/35`,children:[l.length>0&&(0,H.jsx)(`div`,{className:`grid gap-1.5 ${l.length===1?`grid-cols-1`:`grid-cols-2`}`,children:l.map(r=>{let l=GA(r),u=JA(KA(n,t,e.id,r),s[l]??0),d=a.has(l);return(0,H.jsx)(`button`,{type:`button`,className:`group relative size-28 overflow-hidden rounded-md border border-black/10 bg-[var(--muted)] text-[var(--muted-foreground)] sm:size-36`,onClick:()=>{d?(o(e=>{let t=new Set(e);return t.delete(l),t}),c(e=>({...e,[l]:(e[l]??0)+1}))):i(l)},"aria-label":`${d?`Retry`:`Open`} ${r.filename??`attached image`}`,children:d?(0,H.jsxs)(`span`,{className:`flex size-full items-center justify-center gap-2 px-3 text-xs`,children:[(0,H.jsx)(fr,{className:`size-4`}),`Image unavailable`]}):(0,H.jsx)(`img`,{src:u,alt:r.filename??`Attached image`,loading:`lazy`,className:`size-full object-cover transition-transform group-hover:scale-[1.02]`,onError:()=>o(e=>new Set(e).add(l))})},l)})}),d.length>0&&(0,H.jsx)(`div`,{className:l.length>0?`mt-2 space-y-1.5`:`space-y-1.5`,children:d.map(r=>(0,H.jsxs)(`a`,{href:KA(n,t,e.id,r),target:`_blank`,rel:`noreferrer`,className:`flex min-w-0 items-center gap-2 rounded-md border border-black/10 bg-[var(--card)]/80 px-2.5 py-2 text-left text-[var(--foreground)] transition-colors hover:bg-[var(--card)]`,children:[(0,H.jsx)(nr,{className:`size-4 shrink-0 text-[var(--primary)]`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-xs font-medium`,children:r.filename??`Attached file`}),(0,H.jsxs)(`span`,{className:`block truncate text-[10px] text-[var(--muted-foreground)]`,children:[r.mediaType,r.byteLength?` · ${qA(r.byteLength)}`:``]})]}),(0,H.jsx)(er,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`})]},GA(r)))}),e.text&&(0,H.jsx)(PA,{breaks:!0,className:`px-1 [&>:first-child]:mt-0 [&>:last-child]:mb-0 ${l.length||d.length?`pt-2`:``}`,workspaceFiles:{runtimeSelector:n,sessionId:t},children:e.text}),f&&(0,H.jsx)(sA,{open:!0,src:KA(n,t,e.id,f),alt:f.filename??`Attached image`,onOpenChange:e=>{e||i(null)}})]})}):(0,H.jsx)(`div`,{className:`flex justify-start`,children:(0,H.jsxs)(`div`,{className:`flex min-w-0 max-w-[90%] flex-col items-start`,children:[(0,H.jsxs)(`div`,{className:`rounded-md rounded-bl-sm bg-[var(--muted)] px-3.5 py-2.5`,children:[e.text&&(0,H.jsx)(PA,{className:`[&>:first-child]:mt-0 [&>:last-child]:mb-0`,streaming:e.streaming,workspaceFiles:{runtimeSelector:n,sessionId:t},children:e.text}),e.streaming&&(0,H.jsx)(`span`,{className:`ml-0.5 inline-block h-4 w-[3px] translate-y-0.5 animate-pulse rounded-full bg-[var(--primary)] align-middle`})]}),e.interrupted&&(0,H.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 px-1 text-xs text-[var(--muted-foreground)]`,"data-testid":`assistant-interrupted-indicator`,children:[(0,H.jsx)(Wn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Response stopped`})]})]})})}function GA(e){return`resourceId`in e&&e.resourceId?`resource:${e.resourceId}`:`path:${e.partIndex}`}function KA(e,t,n,r){return`resourceId`in r&&r.resourceId?Y.sessionResourceContentUrl(e,t,r):Y.sessionItemFileContentUrl(e,t,n,r.partIndex)}function qA(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function JA(e,t){return t===0?e:`${e}${e.includes(`?`)?`&`:`?`}retry=${t}`}function YA({item:e}){let t=e.summary.filter(Boolean).join(`
|
|
59
|
+
|
|
60
|
+
`).trim(),[n,r]=(0,u.useState)(e.streaming??!1);return(0,u.useEffect)(()=>{r(e.streaming??!1)},[e.streaming]),!t&&!e.streaming?null:(0,H.jsxs)(tA,{open:n,onOpenChange:r,className:`my-0.5`,children:[(0,H.jsxs)(nA,{className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50`,children:[(0,H.jsx)(Ln,{className:X(`size-3 shrink-0 transition-transform`,n&&`rotate-90`)}),(0,H.jsx)(ei,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:X(`label-caps text-[10px]`,e.streaming&&`animate-pulse`),children:e.streaming?`Thinking…`:`Thought`})]}),(0,H.jsx)(rA,{className:`overflow-hidden pl-7`,children:(0,H.jsx)(`div`,{className:`mt-1 border-l-2 border-[var(--border)] pl-3 text-[var(--muted-foreground)]`,children:t?(0,H.jsx)(PA,{children:t}):(0,H.jsx)(`span`,{className:`animate-pulse text-xs`,children:`…`})})})]})}var XA=12e3;function ZA(e){return e.length<=XA?{text:e,truncated:!1}:{text:e.slice(0,XA),truncated:!0}}function QA({item:e}){let[t,n]=(0,u.useState)(!1),r=e.stdout?ZA(e.stdout):null,i=e.stderr?ZA(e.stderr):null,a=!!(r||i);return(0,H.jsxs)(tA,{open:t,onOpenChange:n,className:`my-0.5`,children:[(0,H.jsxs)(nA,{className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50`,children:[(0,H.jsx)(Ln,{className:X(`size-3 shrink-0 text-[var(--muted-foreground)] transition-transform`,t&&`rotate-90`)}),(0,H.jsx)(ti,{className:`size-3.5 shrink-0 text-[var(--primary)]`}),(0,H.jsxs)(`span`,{className:`truncate font-mono`,children:[(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:`$ `}),e.command]})]}),(0,H.jsxs)(rA,{className:`overflow-hidden pl-7`,children:[r&&(0,H.jsxs)(`pre`,{className:`mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed`,children:[(0,H.jsx)(`code`,{children:r.text}),r.truncated&&(0,H.jsx)(`div`,{className:`mt-1 text-[var(--muted-foreground)]`,children:`… output truncated`})]}),i&&(0,H.jsxs)(`pre`,{className:`mt-1 overflow-auto rounded-md border border-[var(--destructive)]/40 p-2 text-[11px] leading-relaxed text-[var(--destructive)]`,children:[(0,H.jsx)(`code`,{children:i.text}),i.truncated&&(0,H.jsx)(`div`,{className:`mt-1 text-[var(--muted-foreground)]`,children:`… output truncated`})]}),!a&&(0,H.jsx)(`div`,{className:`mt-1 text-[11px] text-[var(--muted-foreground)]`,children:`(no output)`})]})]})}var $A=80,ej=12e3;function tj(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function nj(e){try{let t=JSON.parse(e);for(let e of[`command`,`cmd`,`path`,`file`,`file_path`,`query`,`url`,`pattern`,`description`]){let n=t[e];if(typeof n==`string`&&n)return n}let n=JSON.stringify(t);return n===`{}`?``:n}catch{return e}}function rj(e,t){if(e===`apply_patch`)try{let e=JSON.parse(t);if(Array.isArray(e.changes)&&e.changes.length>0){if(e.changes.length===1){let t=e.changes[0];if(t&&typeof t==`object`){let e=Reflect.get(t,`path`);if(typeof e==`string`&&e)return{name:`Edit`,summary:e}}}return{name:`Edit`,summary:`${e.changes.length} files`}}}catch{}return{name:e,summary:nj(t)}}function ij(e){let t=e,n=!1,r=t.split(`
|
|
61
|
+
`);return r.length>$A&&(t=r.slice(0,$A).join(`
|
|
62
|
+
`),n=!0),t.length>ej&&(t=t.slice(0,ej),n=!0),{text:t,truncated:n}}function aj({status:e}){return e===`in_progress`?(0,H.jsx)(B,{className:`size-3.5 shrink-0 animate-spin text-[var(--primary)]`}):e===`failed`?(0,H.jsx)(Gn,{className:`size-3.5 shrink-0 text-[var(--destructive)]`}):e===`incomplete`?(0,H.jsx)(Un,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}):(0,H.jsx)(Pn,{className:`size-3.5 shrink-0 text-[var(--success)]`})}function oj({item:e,sessionId:t,runtimeSelector:n,canResolveInteractions:r=!0}){let[i,a]=(0,u.useState)(!1),o=rj(e.name,e.arguments),s=e.output?ij(e.output):null,c=!!e.arguments&&e.arguments!==`{}`,l=e.children??[],d=e.generatedImage?`resourceId`in e.generatedImage&&e.generatedImage.resourceId?Y.sessionResourceContentUrl(n,t,e.generatedImage):e.generatedImageItemId?Y.sessionItemFileContentUrl(n,t,e.generatedImageItemId,0):void 0:void 0,[f,p]=(0,u.useState)(!1),[m,h]=(0,u.useState)(!1);return(0,H.jsxs)(tA,{open:i,onOpenChange:a,className:`my-0.5`,children:[(0,H.jsxs)(nA,{className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50`,children:[(0,H.jsx)(Ln,{className:X(`size-3 shrink-0 text-[var(--muted-foreground)] transition-transform`,i&&`rotate-90`)}),(0,H.jsx)(aj,{status:e.status}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono font-medium`,children:o.name}),o.summary&&(0,H.jsx)(`span`,{className:`truncate text-[var(--muted-foreground)]`,children:o.summary})]}),d&&(0,H.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>h(!0),className:`ml-7 mt-1 block w-fit max-w-[min(28rem,calc(100%-1.75rem))] overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]`,"aria-label":`Preview ${e.generatedImage?.filename??`generated image`}`,children:f?(0,H.jsxs)(`span`,{className:`flex h-24 items-center justify-center gap-2 px-5 text-xs text-[var(--muted-foreground)]`,children:[(0,H.jsx)(fr,{className:`size-4`}),` Image unavailable`]}):(0,H.jsx)(`img`,{src:d,alt:e.generatedImage?.filename??`Generated image`,loading:`lazy`,className:`block max-h-80 w-auto max-w-full object-contain`,onError:()=>p(!0)})}),d&&!f&&(0,H.jsx)(sA,{open:m,src:d,alt:e.generatedImage?.filename??`Generated image`,onOpenChange:h}),(0,H.jsxs)(rA,{className:`overflow-hidden pl-7`,children:[c&&(0,H.jsx)(`pre`,{className:`mt-1 overflow-auto rounded-md bg-[var(--muted)] p-2 text-[11px] leading-relaxed`,children:(0,H.jsx)(`code`,{children:tj(e.arguments)})}),s&&(0,H.jsxs)(`pre`,{className:`mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed`,children:[(0,H.jsx)(`code`,{children:s.text}),s.truncated&&(0,H.jsx)(`div`,{className:`mt-1 text-[var(--muted-foreground)]`,children:`… output truncated`})]}),e.exitCode!=null&&e.exitCode!==0&&(0,H.jsxs)(`div`,{className:`mt-1 text-[11px] text-[var(--destructive)]`,children:[`exit code `,e.exitCode]}),l.length>0&&(0,H.jsxs)(`div`,{className:`mt-1 border-l border-[var(--primary)]/30 pl-2`,children:[(0,H.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-1.5 text-[11px] text-[var(--muted-foreground)]`,children:[(0,H.jsx)(ui,{className:`size-3 shrink-0 text-[var(--primary)]`}),(0,H.jsxs)(`span`,{className:`font-mono`,children:[l.length,` sub-agent step`,l.length===1?``:`s`]})]}),l.map(e=>(0,H.jsx)(sj,{item:e,sessionId:t,runtimeSelector:n,canResolveInteractions:r},e.id))]})]})]})}function sj({item:e,sessionId:t,runtimeSelector:n,canResolveInteractions:r=!0}){switch(e.kind){case`message`:return e.isMeta?null:(0,H.jsx)(WA,{item:e,sessionId:t,runtimeSelector:n});case`tool`:return(0,H.jsx)(oj,{item:e,sessionId:t,runtimeSelector:n,canResolveInteractions:r});case`reasoning`:return(0,H.jsx)(YA,{item:e});case`terminal_command`:return(0,H.jsx)(QA,{item:e});case`compaction`:return(0,H.jsx)(oA,{item:e});case`divider`:return(0,H.jsx)(HA,{item:e});case`error`:return(0,H.jsx)(UA,{item:e});case`interaction`:return(0,H.jsx)(IA,{sessionId:t,item:e,canResolve:r})}}function cj(){return(0,H.jsx)(`div`,{className:`flex items-center gap-1.5 py-2 pl-1`,children:[0,1,2].map(e=>(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-[var(--primary)]`,style:{animation:`typing-dot 1.3s ease-in-out infinite`,animationDelay:`${e*.18}s`}},e))})}function lj({count:e}){return(0,H.jsxs)(`div`,{"data-testid":`background-task-indicator`,role:`status`,"aria-live":`polite`,className:`flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":`true`}),(0,H.jsxs)(`span`,{children:[e,` background `,e===1?`task`:`tasks`,` still running`]})]})}function uj({message:e}){return(0,H.jsxs)(`div`,{"data-testid":`runner-starting-indicator`,role:`status`,"aria-live":`polite`,className:`flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 shrink-0 animate-spin text-[var(--muted-foreground)]`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:e??`Starting up… getting your terminal ready.`})]})}function dj({message:e}){let t=/^MCP startup (?:failed|cancelled|incomplete)/i.test(e);return(0,H.jsxs)(`div`,{"data-testid":`mcp-startup-indicator`,role:`status`,"aria-live":`polite`,className:`flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(t?ci:B,{className:`size-4 shrink-0 ${t?``:`animate-spin`}`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:e})]})}function fj(e){return e<60?`${e}s`:`${Math.floor(e/60)}m ${e%60}s`}function pj({message:e}){let t=(0,u.useRef)(Date.now()),[n,r]=(0,u.useState)(0);return(0,u.useEffect)(()=>{let e=()=>r(Math.floor((Date.now()-t.current)/1e3));e();let n=window.setInterval(e,1e3);return()=>window.clearInterval(n)},[]),(0,H.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--card))] px-3 py-2.5`,children:[(0,H.jsx)(B,{className:`mt-0.5 size-4 shrink-0 animate-spin text-[var(--warning)]`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-[var(--foreground)]`,children:`Queued for capacity`}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--muted-foreground)]`,children:[`Waiting `,fj(n)]})]}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-[var(--muted-foreground)]`,children:e}),(0,H.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-[var(--muted-foreground)]`,children:`Use Stop below to interrupt.`})]})]})}function mj({items:e,historyLoaded:t,running:n,backgroundTaskCount:r=0,startingUp:i=!1,startupStatus:a,mcpStatus:o,waitingForInteraction:s,queueStatus:c,sessionId:l,runtimeSelector:d,canResolveInteractions:f=!0}){let p=(0,u.useRef)(null),[m,h]=(0,u.useState)(!0),g=e[e.length-1],_=g?.kind===`message`&&g.role===`assistant`&&!!g.streaming,v=(i||!!a)&&!c,y=n&&!v&&!_&&!s&&!c;return(0,u.useEffect)(()=>{m&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[e,n,r,i,a,o,c,m]),(0,H.jsx)(U_,{className:`min-w-0 flex-1`,viewportRef:p,viewportProps:{onScroll:e=>{let t=e.currentTarget;h(t.scrollHeight-t.scrollTop-t.clientHeight<40)},"aria-busy":!t},children:(0,H.jsx)(`div`,{className:`mx-auto w-full max-w-3xl space-y-3 px-4 py-3`,children:!t&&e.length===0&&!c&&!v?(0,H.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex items-center justify-center gap-2 py-10 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin text-[var(--primary)]`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Loading conversation…`})]}):e.length===0&&!n&&r===0&&!c&&!v?(0,H.jsx)(`p`,{className:`py-10 text-center text-sm text-[var(--muted-foreground)]`,children:`Send a message to start a turn.`}):(0,H.jsxs)(H.Fragment,{children:[e.map(e=>(0,H.jsx)(sj,{item:e,sessionId:l,runtimeSelector:d,canResolveInteractions:f},e.id)),v&&(0,H.jsx)(uj,{message:a}),o&&(0,H.jsx)(dj,{message:o}),c&&(0,H.jsx)(pj,{message:c}),y&&(0,H.jsx)(cj,{}),r>0&&(0,H.jsx)(lj,{count:r})]})})})}var hj=2500,gj=new Map;function _j({sessionId:e,runtimeSelector:t,active:n,polling:r=n,readOnly:i=!1}){let a=`${t}\n${e}`,o=(0,u.useRef)(a);o.current=a;let s=(0,u.useRef)(n);s.current=n;let c=(0,u.useRef)(0),l=(0,u.useRef)(0),d=(0,u.useRef)(!1),f=(0,u.useRef)(null),p=(0,u.useRef)(null),[m,h]=(0,u.useState)(()=>gj.get(a)??null),[g,_]=(0,u.useState)(()=>!gj.has(a)),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(null),S=(0,u.useCallback)(e=>{p.current=e,x(e)},[]),C=(0,u.useCallback)(e=>{f.current=e,gj.set(a,e),h(e)},[a]),w=(0,u.useCallback)(async n=>{if(!s.current||d.current)return;let r=a,i=c.current,u=l.current;n&&_(!0);try{let a=await Y.getRuntimeBrowserState(t,e);return!s.current||c.current!==i||l.current!==u||o.current!==r||d.current?void 0:(C(a),n&&S(null),a)}catch(e){if(!s.current||c.current!==i||l.current!==u||o.current!==r)return;n&&S(EO(e));return}finally{s.current&&c.current===i&&l.current===u&&o.current===r&&n&&_(!1)}},[a,t,e,C,S]);(0,u.useEffect)(()=>{let e=++c.current,t=gj.has(a);if(C(gj.get(a)??null),S(null),_(n&&!t),y(null),d.current=!1,n)return w(!t),()=>{c.current===e&&(c.current+=1)}},[a,n,w,C,S]),(0,u.useEffect)(()=>{if(!n||!r)return;let e=window.setInterval(()=>void w(!1),hj);return()=>window.clearInterval(e)},[n,w,r]);let T=(0,u.useCallback)(async(e,t)=>{if(i||!s.current||d.current)return;let n=a,r=c.current;l.current+=1,d.current=!0,y(e),S(null);try{let e=await t();return s.current&&c.current===r&&o.current===n?(C(e),e):void 0}catch(e){s.current&&c.current===r&&o.current===n&&S(EO(e));return}finally{s.current&&c.current===r&&o.current===n&&(d.current=!1,y(null),_(!1))}},[i,a,C,S]),E=(0,u.useCallback)((e,t)=>{let n=f.current;return n?T(e,()=>t(n.browserGeneration)):Promise.resolve(void 0)},[T]),D=(0,u.useCallback)(n=>T(`Starting browser`,()=>Y.openRuntimeBrowser(t,e,n)),[t,e,T]),O=(0,u.useCallback)(async()=>{if(i)return;let n=f.current;if(!s.current||!n||d.current)return;let r=a,u=c.current;l.current+=1,d.current=!0,y(`Closing browser`),S(null);try{await Y.closeRuntimeBrowser(t,e,n.browserGeneration),s.current&&c.current===u&&o.current===r&&C(null)}catch(e){s.current&&c.current===u&&o.current===r&&S(EO(e))}finally{s.current&&c.current===u&&o.current===r&&(d.current=!1,y(null))}},[i,a,t,e,C,S]),k=(0,u.useCallback)(async()=>{if(i)return;let n=f.current;if(!s.current||!n||d.current)return;let r=a,u=c.current;l.current+=1,d.current=!0,y(`Opening in Desktop`),S(null);try{let i=await AO(n,{close:n=>Y.closeRuntimeBrowser(t,e,n).then(()=>void 0),open:n=>Y.openRuntimeBrowser(t,e,n),createPage:(n,r)=>Y.createRuntimeBrowserPage(t,e,n,r),activatePage:(n,r)=>Y.activateRuntimeBrowserPage(t,e,n,r),onProgress:e=>{s.current&&c.current===u&&o.current===r&&(C(e),y(`Restoring browser tabs`))}});return s.current&&c.current===u&&o.current===r?(C(i),(i.executionBackend!==`embedded-electron`||!i.capabilities.includes(`desktop-direct-view`))&&S(`Desktop Browser Host is unavailable; using streamed browser`),i):void 0}catch(n){let i=await Y.getRuntimeBrowserState(t,e).catch(()=>void 0);s.current&&c.current===u&&o.current===r&&(i!==void 0&&C(i),S(EO(n)));return}finally{s.current&&c.current===u&&o.current===r&&(d.current=!1,y(null),_(!1))}},[i,a,t,e,C,S]);return{browser:m,loading:g,pendingAction:v,error:b,currentError:()=>p.current,disabled:i||v!==null||m?.status!==`ready`,createDisabled:i||v!==null,load:w,openBrowser:D,closeBrowser:O,recreateForDesktop:k,createPage:()=>E(`Creating page`,n=>Y.createRuntimeBrowserPage(t,e,n)),closePage:n=>E(`Closing page`,r=>Y.closeRuntimeBrowserPage(t,e,r,n)),activatePage:n=>E(`Switching page`,r=>Y.activateRuntimeBrowserPage(t,e,r,n)),navigatePage:(n,r)=>E(`Navigating`,i=>Y.navigateRuntimeBrowserPage(t,e,i,n,r)),backPage:n=>E(`Going back`,r=>Y.backRuntimeBrowserPage(t,e,r,n)),forwardPage:n=>E(`Going forward`,r=>Y.forwardRuntimeBrowserPage(t,e,r,n)),reloadPage:n=>E(`Reloading page`,r=>Y.reloadRuntimeBrowserPage(t,e,r,n))}}var vj=2500,yj=new Map;function bj({sessionId:e,runtimeSelector:t,active:n,polling:r=n,devicesActive:i=!1,readOnly:a=!1}){let o=`${t}\n${e}`,[s,c]=(0,u.useState)(()=>yj.get(o)??null),[l,d]=(0,u.useState)([]),[f,p]=(0,u.useState)(()=>n&&!yj.has(o)),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(null),b=(0,u.useRef)(0),x=(0,u.useRef)(0),S=(0,u.useRef)(!1),C=(0,u.useRef)(!1),w=(0,u.useRef)(!1),T=(0,u.useRef)(null);T.current=s;let E=(0,u.useCallback)(e=>{T.current=e,yj.set(o,e),c(e)},[o]),D=(0,u.useCallback)(async()=>{if(S.current)return;let n=b.current,r=x.current;C.current||p(!0);try{let i=await Y.getSessionEmulator(t,e);if(b.current!==n||x.current!==r||S.current)return;E(i),y(null)}catch(e){if(b.current!==n||x.current!==r||S.current)return;y(xj(e))}finally{b.current===n&&x.current===r&&!S.current&&(C.current=!0,p(!1))}},[t,e,E]),O=(0,u.useCallback)(async()=>{if(S.current)return;let n=b.current,r=x.current;h(!0);try{let i=await Y.listSessionEmulatorDevices(t,e);if(b.current!==n||x.current!==r||S.current)return;d(i),y(null)}catch(e){if(b.current!==n||x.current!==r||S.current)return;y(xj(e))}finally{b.current===n&&x.current===r&&!S.current&&(w.current=!0,h(!1))}},[t,e]);(0,u.useEffect)(()=>{b.current+=1;let e=yj.has(o);E(yj.get(o)??null),d([]),y(null),p(n&&!e),h(!1),_(!1),S.current=!1,C.current=e,w.current=!1,n&&D()},[n,D,o,E]),(0,u.useEffect)(()=>{if(!n||!r)return;let e=window.setInterval(()=>void D(),vj);return()=>window.clearInterval(e)},[n,r,D]),(0,u.useEffect)(()=>{!n||!i||f||g||s||w.current||O()},[n,s,i,f,g,O]);let k=(0,u.useCallback)(async(e,t)=>{if(a)throw Error(`Session Portal is read only`);let n=b.current,r=++x.current;S.current=!0,_(!0),y(null);try{let i=await e();return b.current!==n||x.current!==r?null:(t?.(i),i)}catch(e){throw b.current===n&&x.current===r&&y(xj(e)),e}finally{b.current===n&&x.current===r&&(S.current=!1,_(!1))}},[a]),A=(0,u.useCallback)(n=>k(()=>Y.attachSessionEmulator(t,e,n),e=>E(e)),[k,t,e]),j=(0,u.useCallback)(async()=>{let n=T.current;return n?await k(()=>Y.detachSessionEmulator(t,e,n.bindingId),()=>E(null))!==null:!1},[k,t,e]),M=(0,u.useCallback)(async e=>{let t=T.current;if(!t)throw Error(`This Session has no Emulator attached`);await k(()=>e(t))},[k]);return{binding:s,devices:l,loading:f,devicesLoading:m,mutating:a||g,error:v,reload:D,reloadDevices:O,attach:A,detach:j,tap:(n,r)=>M(i=>Y.tapSessionEmulator(t,e,i.bindingId,n,r)),gesture:n=>M(r=>Y.gestureSessionEmulator(t,e,r.bindingId,n)),button:n=>M(r=>Y.buttonSessionEmulator(t,e,r.bindingId,n))}}function xj(e){return e instanceof Error?e:Error(String(e))}var Sj=`rynx.session-resource-dock-width`;function Cj({session:e,runtimeSelector:t,leadingControls:n,initialDraft:r,initialMessage:i,sendInitialMessage:a=!1,onInitialMessageStarted:o,onInitialMessageConsumed:s,onInitialMessageFailed:c,terminalSlotRef:l,onTerminalActiveChange:d,readOnly:f=!1}){let[p,m]=bn(),h=p.get(`view`),g=h===`terminal`?`terminal`:`chat`;(0,u.useEffect)(()=>(d?.(e.id,g===`terminal`),()=>d?.(e.id,!1)),[d,e.id,g]);let _=iD(p.get(`surface`)),v=p.get(`panel`)===`resources`,y=h===`browser`||_!==null||v,b=_?.type===`browser`?_.pageId:null,x=(0,u.useRef)(null),S=(0,u.useRef)(null),C=(0,u.useRef)(`browser`),w=(0,u.useRef)(null),T=(0,u.useRef)(0),E=(0,u.useRef)(null),[D]=(0,u.useState)(wj),O=(0,u.useRef)(D),k=(0,u.useRef)(null),A=(0,u.useRef)(null),j=(0,u.useRef)(null),M=(0,u.useRef)(null),N=(0,u.useRef)(null),P=(0,u.useRef)(null),F=(0,u.useRef)(!1),[I,L]=(0,u.useState)(!1),[ee,te]=(0,u.useState)(!1),[ne,re]=(0,u.useState)(null),[R,ie]=(0,u.useState)(360),[ae,oe]=(0,u.useState)(!1),[se,ce]=(0,u.useState)(!1),[le,ue]=(0,u.useState)([]),[de,fe]=(0,u.useState)(!!i),[pe,me]=(0,u.useState)(!1),he=(0,u.useRef)(null),{state:ge,pendingSend:_e,current:ve,send:ye,stop:be}=VD(e.id,{runtimeSelector:t,allowSend:!f}),xe=_j({sessionId:e.id,runtimeSelector:t,active:!0,polling:y,readOnly:f}),Se=bj({sessionId:e.id,runtimeSelector:t,active:!0,polling:y,devicesActive:_?.type===`emulator`,readOnly:f}),Ce=(0,u.useMemo)(()=>lD(xe.browser,b,x.current),[xe.browser,b]),we=ID(_e,ge.runStatus===`running`||ge.waitingForInteraction,ve,e.status===`running`),Te=ve?ge.backgroundTaskCount:0,Ee=e.agent??(e.provider?uE(e.provider):void 0),De=eD(ge)?.model,Oe=(0,u.useMemo)(()=>tD(ge.items),[ge.items]),ke=(0,u.useMemo)(()=>!i||Oe.length>0?Oe:[{kind:`message`,id:`optimistic_initial`,responseId:`optimistic_initial`,role:`user`,text:i,images:[],files:[],streaming:!1,optimistic:!0}],[i,Oe]),Ae=_E(ge.statusKind,ge.note)?ge.note:void 0,je=ge.statusKind===`startup`&&Ae===void 0,Me=ge.waitingForInteraction||ge.runStatus===`running`&&!je,Ne=je||!Me&&(_e||de),Pe=xe.browser?.pages??[],Fe=_?.type===`emulator`||I,Ie=xe.loading||Se.loading,Le=Pe.length>0||Fe,Re=(0,u.useMemo)(()=>[...Pe.map(e=>aD(e.pageId)),...Fe?[oD()]:[]],[Pe,Fe]),ze=(0,u.useMemo)(()=>sD(le,Re),[Re,le]);(0,u.useEffect)(()=>{ue(e=>{let t=sD(e,Re);return Ej(e,t)?e:t})},[Re]),(0,u.useEffect)(()=>{let e=E.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width,n=cD(t,1/0);ie(n);let r=O.current,i=cD(t,r??t*.44);r!==null&&e.style.setProperty(`--session-resource-dock-width`,`${i}px`),k.current=i,re(i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,u.useEffect)(()=>()=>{j.current!==null&&window.cancelAnimationFrame(j.current),N.current?.(),Tj(P)},[]),(0,u.useEffect)(()=>{x.current=null,S.current=null,C.current=`browser`,w.current=null,L(!1),ce(!1),ue([]),T.current+=1},[t,e.id]),(0,u.useEffect)(()=>{!i||!a||he.current===i||(he.current=i,fe(!0),o?.(),ye(i).catch(e=>{fe(!1),Ux(e)&&c?.(i)}))},[i,c,o,ye,a]),(0,u.useEffect)(()=>{i&&Oe.some(e=>e.kind===`message`&&e.role===`user`&&e.optimistic!==!0&&e.text===i)&&(fe(!1),s?.())},[i,s,Oe]);let Be=(e,t=!0)=>{t&&(T.current+=1);let n=new URLSearchParams(p);e?(n.set(`surface`,e),n.delete(`panel`)):(n.delete(`surface`),n.set(`panel`,`resources`)),n.get(`view`)===`browser`&&n.set(`view`,`chat`),m(n,{replace:!0})},Ve=()=>{T.current+=1,ce(!1);let e=new URLSearchParams(p);e.delete(`surface`),e.delete(`panel`),e.get(`view`)===`browser`&&e.set(`view`,`chat`),m(e,{replace:!0})},He=()=>{if(C.current===`emulator`&&I){Be(oD(w.current));return}if(x.current){Be(aD(x.current));return}if(I){Be(oD(w.current));return}Be(null)};(0,u.useEffect)(()=>{_&&(C.current=_.type,_.type===`emulator`&&L(!0))},[_?.type]),(0,u.useEffect)(()=>{let e=Se.binding?.bindingId??null;e&&(w.current&&e!==w.current?L(!0):w.current||L(!0),w.current=e)},[Se.binding?.bindingId]),(0,u.useEffect)(()=>{if(h!==`browser`)return;let e=new URLSearchParams(p);e.set(`view`,`chat`),e.set(`surface`,aD(Ce)),e.delete(`panel`),m(e,{replace:!0})},[h,p,Ce,m]),(0,u.useEffect)(()=>{if(_?.type!==`browser`)return;Ce&&(x.current=Ce);let e=aD(Ce);if(p.get(`surface`)===e)return;let t=new URLSearchParams(p);t.set(`surface`,e),m(t,{replace:!0})},[_?.type,p,Ce,m]),(0,u.useEffect)(()=>{let e=Pe.map(e=>e.pageId),t=uD(S.current,xe.browser);S.current=e,!(!t||_?.type!==`browser`)&&(x.current=t,Be(aD(t),!1))},[Pe,xe.browser,_?.type]),(0,u.useEffect)(()=>{if(_?.type!==`emulator`)return;let e=oD(Se.binding?.bindingId);if(p.get(`surface`)===e)return;let t=new URLSearchParams(p);t.set(`surface`,e),m(t,{replace:!0})},[Se.binding?.bindingId,_?.type,p,m]),(0,u.useEffect)(()=>{if(!(!y||Ie)){if(!Le){_&&Be(null,!1);return}_?.type===`browser`&&Ce||_?.type===`emulator`&&Fe||(C.current===`emulator`&&Fe?Be(oD(Se.binding?.bindingId),!1):Ce?Be(aD(Ce),!1):Fe&&Be(oD(Se.binding?.bindingId),!1))}},[Se.binding?.bindingId,Fe,Le,_?.type,y,Ie,Ce]);let Ue=async()=>{if(F.current)return;F.current=!0,te(!0);let e=T.current;try{let t=xe.browser?.status===`ready`?await xe.createPage():await xe.openBrowser(),n=t?.activePageId??t?.pages.at(-1)?.pageId;if(!t){V.error(`Could not create Browser tab: ${xe.currentError()??`Browser is unavailable`}`);return}n&&T.current===e&&Be(aD(n),!1)}finally{F.current=!1,te(!1)}},We=e=>{let t=E.current;if(!t)return null;let n=cD(t.getBoundingClientRect().width,e);return t.style.setProperty(`--session-resource-dock-width`,`${n}px`),k.current=n,n},Ge=e=>{let t=E.current;return t?We(t.getBoundingClientRect().right-e):null},Ke=e=>{if(e!==null){O.current=e,re(e);try{window.localStorage.setItem(Sj,String(Math.round(e)))}catch{}}},qe=e=>{M.current=e,j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null;let e=M.current;M.current=null,e!==null&&Ge(e)}))},Je=(e,t,n)=>{if(A.current!==t)return;j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current=null;let r=n===void 0?k.current:Ge(n);Ke(r),A.current=null,N.current?.(),N.current=null,e.hasPointerCapture(t)&&e.releasePointerCapture(t),Tj(P),oe(!1)},Ye=e=>{if(e.button!==0)return;e.preventDefault(),N.current?.(),A.current=e.pointerId;let t=e.currentTarget;t.setPointerCapture(e.pointerId);let n=e=>{A.current===e.pointerId&&qe(e.clientX)},r=e=>{Je(t,e.pointerId,e.clientX)},i=e=>{Je(t,e.pointerId)};window.addEventListener(`pointermove`,n,!0),window.addEventListener(`pointerup`,r,!0),window.addEventListener(`pointercancel`,i,!0),N.current=()=>{window.removeEventListener(`pointermove`,n,!0),window.removeEventListener(`pointerup`,r,!0),window.removeEventListener(`pointercancel`,i,!0)};let a=document.documentElement.style;P.current={cursor:a.cursor,userSelect:a.userSelect},a.cursor=`col-resize`,a.userSelect=`none`,oe(!0),Ge(e.clientX)},Xe=e=>{let t=E.current;if(!t)return;let n=k.current??cD(t.getBoundingClientRect().width,t.getBoundingClientRect().width*.44),r=e.shiftKey?32:16,i=null;e.key===`ArrowLeft`&&(i=n+r),e.key===`ArrowRight`&&(i=n-r),e.key===`Home`&&(i=0),e.key===`End`&&(i=1/0),i!==null&&(e.preventDefault(),Ke(We(i)))},Ze=e=>{T.current+=1;let t=new URLSearchParams(p);t.set(`view`,e),m(t,{replace:!0})},Qe=(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:`size-9 shrink-0`,"aria-label":g===`chat`?`Open terminal`:`Open chat`,title:g===`chat`?`Open terminal`:`Open chat`,onClick:()=>Ze(g===`chat`?`terminal`:`chat`),children:g===`chat`?(0,H.jsx)(oi,{}):(0,H.jsx)(br,{})}),$e=(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:`size-9 shrink-0`,"aria-label":y?`Hide Session resources`:`Show Session resources`,title:y?`Hide Session resources`:`Show Session resources`,onClick:y?Ve:He,children:y?(0,H.jsx)(jr,{}):(0,H.jsx)(Mr,{})}),et=(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hidden size-8 shrink-0 lg:inline-flex`,"aria-label":se?`Restore split view`:`Expand resource pane`,"aria-pressed":se,title:se?`Restore split view`:`Expand resource pane`,onClick:()=>ce(e=>!e),children:se?(0,H.jsx)(Qr,{}):(0,H.jsx)($n,{})}),tt=f?void 0:(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-8 shrink-0`,"aria-label":`Session settings`,title:`Session settings`,onClick:()=>me(!0),children:(0,H.jsx)(Kr,{})});return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[(0,H.jsxs)(`div`,{ref:E,className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden [--session-resource-dock-width:44%]`,children:[(0,H.jsxs)(`section`,{"aria-hidden":se,className:X(`min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,se?`hidden`:`flex`),children:[(0,H.jsxs)(`header`,{className:`desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3 sm:px-4`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[n,(0,H.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-medium`,children:e.title??Ee??`session`})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[Qe,!y&&$e]})]}),(0,H.jsxs)(fE,{value:g,className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-0`,children:[(0,H.jsxs)(hE,{value:`chat`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:[(0,H.jsx)(aA,{todos:ge.todos}),(0,H.jsx)(mj,{items:ke,historyLoaded:ge.historyLoaded,running:we,backgroundTaskCount:Te,startingUp:Ne,startupStatus:je?ge.note:void 0,mcpStatus:Ae,waitingForInteraction:ge.waitingForInteraction,queueStatus:ge.statusKind===`queue`?ge.note:void 0,sessionId:e.id,runtimeSelector:t,canResolveInteractions:!f}),!f&&(0,H.jsx)(Ck,{initialDraft:r,model:De,running:we,collaborationMode:ge.collaborationMode,streamCurrent:ve,sessionId:e.id,runtimeSelector:t,onSend:ye,onStop:be})]}),(0,H.jsx)(hE,{value:`terminal`,forceMount:!0,"aria-hidden":g!==`terminal`,className:`mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:invisible data-[state=inactive]:absolute data-[state=inactive]:inset-0`,children:(0,H.jsx)(`div`,{ref:l,className:`flex min-h-0 flex-1 flex-col`})})]})]}),y&&(0,H.jsxs)(H.Fragment,{children:[!se&&(0,H.jsx)(`div`,{role:`separator`,"aria-label":`Resize Session resources`,"aria-orientation":`vertical`,"aria-valuemin":Math.min(360,R),"aria-valuemax":R,"aria-valuenow":Math.round(ne??360),"aria-valuetext":`${Math.round(ne??360)} pixels wide`,tabIndex:0,title:`Drag to resize Session resources`,className:`group relative z-30 -mx-1 hidden w-2 shrink-0 cursor-col-resize touch-none outline-none lg:block`,onPointerDown:Ye,onKeyDown:Xe,children:(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 bg-[var(--border)] transition-[width,background-color] duration-150 group-hover:w-0.5 group-hover:bg-[var(--primary)] group-focus-visible:w-0.5 group-focus-visible:bg-[var(--primary)] ${ae?`w-0.5 bg-[var(--primary)]`:`w-px`}`})}),(0,H.jsxs)(`aside`,{className:X(`flex min-h-0 min-w-0 flex-col overflow-hidden bg-[var(--card)]`,se?`h-full w-full`:`absolute inset-0 z-20 lg:static lg:z-auto lg:w-[var(--session-resource-dock-width)] lg:min-w-[22.5rem] lg:max-w-[calc(100%_-_26.25rem)]`),"aria-label":`Session resources`,children:[Le&&(0,H.jsx)(Dk,{pages:Pe,order:ze,selectedPageId:_?.type===`browser`?Ce:null,selectionDisabled:xe.pendingAction!==null,mutationDisabled:xe.disabled,createDisabled:f||xe.createDisabled||ee,createPending:ee,emulatorAttached:!!Se.binding,emulator:Fe?{selected:_?.type===`emulator`,label:Se.binding?.deviceName??`Emulator`,busy:Se.loading||Se.mutating}:null,onSelectPage:e=>{x.current=e,Be(aD(e)),xe.browser?.status===`ready`&&xe.activatePage(e)},onClosePage:e=>{T.current+=1,x.current===e&&(x.current=null),xe.closePage(e)},onCreatePage:()=>{f||Ue()},onSelectEmulator:()=>{L(!0),Be(oD(Se.binding?.bindingId))},onCloseEmulator:()=>{L(!1),C.current=`browser`,Be(Ce?aD(Ce):null)},onAddEmulator:()=>{L(!0),Be(oD(Se.binding?.bindingId))},headerLeadingAction:se?n:void 0,settingsAction:tt,leadingAction:et,trailingAction:$e}),!Le&&(0,H.jsxs)(H.Fragment,{children:[se&&n&&(0,H.jsx)(`div`,{className:`absolute left-3 top-1.5 z-10 flex h-8 items-center`,children:n}),(0,H.jsxs)(`div`,{className:`absolute right-3 top-1.5 z-10 flex items-center gap-1 sm:right-4`,children:[tt,et,$e]})]}),Le?_?.type===`emulator`?(0,H.jsx)(Pk,{sessionId:e.id,runtimeSelector:t,controller:Se,readOnly:f}):_?.type===`browser`?(0,H.jsx)(tk,{sessionId:e.id,runtimeSelector:t,pageId:Ce,browserResource:xe,readOnly:f}):(0,H.jsxs)(`div`,{className:`grid min-h-0 flex-1 place-items-center`,"aria-live":`polite`,children:[(0,H.jsx)(B,{className:`size-5 animate-spin text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Selecting Session resource`})]}):(0,H.jsx)(Dj,{browserBusy:f||xe.createDisabled||ee,emulatorBusy:f||Se.mutating,onOpenBrowser:()=>{f||Ue()},onOpenEmulator:()=>{L(!0),Be(oD(Se.binding?.bindingId))}})]})]})]}),(0,H.jsx)(dk,{open:pe,onOpenChange:me,runtimeSelector:t,sessionId:e.id})]})}function wj(){if(typeof window>`u`)return null;try{let e=Number(window.localStorage.getItem(Sj));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function Tj(e){let t=e.current;!t||typeof document>`u`||(document.documentElement.style.cursor=t.cursor,document.documentElement.style.userSelect=t.userSelect,e.current=null)}function Ej(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Dj({browserBusy:e,emulatorBusy:t,onOpenBrowser:n,onOpenEmulator:r}){return(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-64 space-y-1`,"aria-label":`Session resource choices`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:e,onClick:n,className:`flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50`,children:[e?(0,H.jsx)(B,{className:`size-4 shrink-0 animate-spin`}):(0,H.jsx)(Xn,{className:`size-4 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{children:`Browser`})]}),(0,H.jsxs)(`button`,{type:`button`,disabled:t,onClick:r,className:`flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50`,children:[t?(0,H.jsx)(B,{className:`size-4 shrink-0 animate-spin`}):(0,H.jsx)($r,{className:`size-4 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{children:`Emulator`})]})]})})}var Oj=400,kj=160;function Aj({sessions:e,runtimeSelector:t,runtimeLabel:n,listError:r,loading:i,selectedId:a,onCollapsedChange:o,onSelect:s,onNew:c,onRetry:l,onFork:d,onDeleted:f,readOnly:p=!1}){let[m,h]=(0,u.useState)(``),g=m.trim().toLocaleLowerCase(),_=(0,u.useMemo)(()=>g?e.filter(e=>[e.title,e.id,e.provider,e.provider?uE(e.provider):void 0,e.agent,e.source].some(e=>e?.toLocaleLowerCase().includes(g))):e,[g,e]);async function v(e){try{await Y.closeSession(e,t)}catch(e){V.error(`Delete session failed: ${e instanceof Error?e.message:String(e)}`);return}f(e)}return(0,H.jsxs)(`aside`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-[var(--card)]/35`,"aria-label":`Sessions`,children:[(0,H.jsxs)(`div`,{className:`app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] p-2.5`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex h-7 items-center gap-2 px-0.5`,children:[(0,H.jsxs)(hn,{to:zx(jx(t)),className:`app-no-drag flex items-center gap-2`,"aria-label":`Rynx Sessions`,children:[(0,H.jsx)(`img`,{src:NS,alt:`rynx`,className:`h-5 w-auto dark:brightness-0 dark:invert`}),(0,H.jsx)(`span`,{className:`label-caps text-[8px] text-[var(--muted-foreground)]`,children:`control`})]}),(0,H.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`app-no-drag ml-auto hidden md:inline-flex`,onClick:()=>o(!0),title:`Collapse session list`,"aria-label":`Collapse session list`,"aria-expanded":`true`,children:(0,H.jsx)(kr,{className:`size-3.5`})})]}),(0,H.jsxs)(`div`,{className:`app-no-drag flex items-center gap-2`,children:[(0,H.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Search sessions`}),(0,H.jsx)(Hr,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]`}),(0,H.jsx)(Ag,{value:m,onChange:e=>h(e.target.value),placeholder:`Search sessions`,className:`h-11 rounded-md pl-8 text-xs md:h-8`})]}),!p&&(0,H.jsx)(J,{size:`icon`,className:`size-11 shrink-0 md:size-8`,onClick:c,title:`New session`,"aria-label":`New session`,children:(0,H.jsx)(Ir,{})})]})]}),r&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 border-b border-[var(--border)] bg-[var(--warning)]/8 px-3 py-2 text-xs`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 text-[var(--warning)]`,children:r}),(0,H.jsx)(J,{variant:`ghost`,size:`sm`,className:`h-6 shrink-0 px-2 text-[10px]`,onClick:l,children:`Retry`})]}),(0,H.jsx)(U_,{className:`min-h-0 flex-1`,children:i&&e.length===0?(0,H.jsx)(Mj,{}):e.length===0?(0,H.jsxs)(`div`,{className:`grid place-items-center gap-3 px-5 py-10 text-center`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`p`,{className:`text-sm font-medium`,children:[`No sessions on `,n]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:`Create one to start a conversation and terminal.`})]}),!p&&(0,H.jsxs)(J,{size:`sm`,className:`h-11 md:h-8`,onClick:c,children:[(0,H.jsx)(Ir,{}),` New session`]})]}):_.length===0?(0,H.jsxs)(`div`,{className:`px-5 py-10 text-center text-xs text-[var(--muted-foreground)]`,children:[`No sessions match “`,m.trim(),`”.`]}):(0,H.jsx)(`ul`,{className:`space-y-0.5 px-1.5 py-1.5`,children:_.map(e=>(0,H.jsx)(jj,{session:e,runtimeLabel:n,selected:a===e.id,onSelect:()=>s(e.id),onFork:()=>d(e.id),onDelete:()=>v(e.id),readOnly:p},e.id))})})]})}function jj({session:e,runtimeLabel:t,selected:n,onSelect:r,onFork:i,onDelete:a,readOnly:o}){let[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(!1),[f,p]=(0,u.useState)(!1),[m,h]=(0,u.useState)(!1),g=(0,u.useRef)(null),_=(0,u.useRef)(null),v=Nj(e.updatedAt??e.createdAt),y=e.agent??(e.provider?uE(e.provider):void 0),b=e.title??y??e.source??`Untitled session`;(0,u.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.clearTimeout(_.current)},[]);let x=()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},S=()=>{_.current!==null&&(window.clearTimeout(_.current),_.current=null)},C=()=>{x(),S(),!f&&d(!0)},w=()=>{S(),!(f||l||g.current!==null)&&(g.current=window.setTimeout(()=>{g.current=null,d(!0)},Oj))},T=()=>{x(),S(),d(!1)},E=()=>{x(),S(),l&&(_.current=window.setTimeout(()=>{_.current=null,d(!1)},kj))};return(0,H.jsxs)(`li`,{className:X(`group relative flex min-h-9 items-center rounded-md transition-colors`,n?`bg-[var(--muted)]/70`:`hover:bg-[var(--muted)]/40`),onMouseEnter:w,onMouseLeave:E,children:[(0,H.jsxs)(xg,{modal:!1,open:l,onOpenChange:e=>{e?C():T()},children:[(0,H.jsx)(Sg,{asChild:!0,children:(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute right-0 top-2 size-px`})}),(0,H.jsxs)(Cg,{side:`right`,align:`start`,sideOffset:8,className:`w-72 p-3`,"aria-label":`Details for ${b}`,onMouseEnter:C,onMouseLeave:E,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),children:[(0,H.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-center justify-between gap-3`,children:[(0,H.jsx)(`p`,{className:`min-w-0 truncate text-xs font-medium`,children:b}),(0,H.jsx)(`span`,{className:`shrink-0 text-[10px] text-[var(--muted-foreground)]`,children:v})]}),(0,H.jsxs)(`div`,{className:`space-y-2 font-mono text-[11px] leading-4`,children:[y&&(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,"aria-label":`Target: ${y}`,children:[(0,H.jsx)(Mn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:y})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,"aria-label":`Source: ${e.source}`,children:[(0,H.jsx)(Nn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e.source})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,"aria-label":`Session: ${e.id}`,children:[(0,H.jsx)(rr,{"aria-hidden":`true`,className:`mt-px size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{className:`min-w-0 select-text break-all`,children:e.id})]})]})]})]}),(0,H.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 px-2.5 py-2 text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]`,"aria-current":n?`page`:void 0,onClick:r,onFocus:C,onBlur:E,children:(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:b})}),!o&&(0,H.jsxs)(`div`,{className:`group/actions relative mr-2 size-8 shrink-0`,onMouseEnter:T,onMouseLeave:w,children:[e.status===`running`&&(0,H.jsx)(`span`,{role:`status`,"aria-label":`Running`,title:`Running`,className:`pointer-events-none absolute inset-0 grid place-items-center text-[var(--muted-foreground)] transition-opacity duration-150 group-hover:opacity-0 group-focus-within/actions:opacity-0 group-has-data-[state=open]/actions:opacity-0 [@media(hover:none)]:opacity-0`,children:(0,H.jsx)(B,{className:`size-3.5 animate-spin motion-reduce:animate-none`})}),(0,H.jsxs)(xg,{open:f,onOpenChange:e=>{p(e),e&&T()},children:[(0,H.jsx)(Sg,{asChild:!0,children:(0,H.jsx)(J,{variant:`ghost`,size:`icon`,className:`absolute inset-0 size-8 text-[var(--muted-foreground)] opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100`,title:`Session actions for ${b}`,"aria-label":`Session actions for ${b}`,children:(0,H.jsx)(Zn,{})})}),(0,H.jsxs)(Cg,{align:`end`,children:[(0,H.jsxs)(wg,{disabled:m||e.status===`running`,onSelect:()=>{h(!0),i().finally(()=>h(!1))},children:[m?(0,H.jsx)(B,{className:`animate-spin motion-reduce:animate-none`}):(0,H.jsx)(lr,{}),`Fork session`]}),(0,H.jsxs)(wg,{variant:`destructive`,onSelect:()=>c(!0),children:[(0,H.jsx)(si,{}),`Delete session`]})]})]}),(0,H.jsx)(uu,{open:s,onOpenChange:c,children:(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsx)(vu,{children:`Delete this session?`}),(0,H.jsxs)(yu,{children:[`“`,b,`” will be deleted from `,t,`. This cannot be undone.`]})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:()=>void a(),children:`Delete`})]})]})})]})]})}function Mj(){return(0,H.jsx)(`div`,{"aria-label":`Loading sessions`,className:`space-y-0.5 px-1.5 py-1.5`,children:Array.from({length:6},(e,t)=>(0,H.jsx)(`div`,{className:`grid min-h-9 content-center rounded-md px-2.5`,children:(0,H.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-[var(--muted)]`})},t))})}function Nj(e){let t=Date.parse(e);if(!Number.isFinite(t))return`unknown`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<60?`now`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<604800?`${Math.floor(n/86400)}d ago`:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}var Pj=`!no-project`,Fj=`!new-project`;function Ij({runtimeLabel:e,options:t,selection:n,configuration:r,projects:i,projectId:a,loading:o,projectsLoading:s,submitting:c,error:l,projectError:d,listCollapsed:f,onShowSessions:p,onRetryOptions:m,onSelectionChange:h,onConfigurationChange:g,onProjectChange:_,onNewProject:v,onSubmit:y}){let[b,x]=(0,u.useState)(``),S=(0,u.useRef)(null),C=(0,u.useRef)(!1),w=(0,u.useRef)(void 0),T=_k({policy:hk,onChange:()=>{w.current=void 0}}),E=dE(n,t),D=a?i.find(e=>e.id===a):void 0,O=!!((b.trim()||T.items.length>0)&&n&&!o&&!c&&!T.hasPending&&!T.hasFailed);async function k(){let e=b.trim();if(!e&&T.items.length===0||!n||o||c||T.hasPending||T.hasFailed)return;let t=T.items.length>0?w.current??ND(`msg`):void 0;t&&(w.current=t),await y({text:e,attachments:T.readyUploads,...t?{clientMessageId:t}:{}})&&(T.clear(),x(``),w.current=void 0)}return(0,H.jsxs)(`main`,{className:`relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-[radial-gradient(circle_at_50%_-10%,color-mix(in_srgb,var(--primary)_9%,transparent),transparent_38%)]`,children:[f&&(0,H.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`desktop-macos-titlebar-leading-control absolute left-3 top-2.5 z-10 hidden md:inline-flex`,onClick:p,title:`Show session list`,"aria-label":`Show session list`,children:(0,H.jsx)(Ar,{className:`size-3.5`})}),(0,H.jsx)(`div`,{className:`desktop-macos-home-titlebar`,"aria-hidden":`true`}),(0,H.jsx)(U_,{className:`h-full`,viewportClassName:`[&>div]:!flex [&>div]:min-h-full [&>div]:flex-col`,children:(0,H.jsxs)(`div`,{className:`mx-auto grid w-full max-w-3xl flex-1 content-center px-4 py-8 sm:px-6 lg:py-12`,children:[(0,H.jsx)(`div`,{className:`mb-6 flex items-center gap-2 md:hidden`,children:(0,H.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`h-11 px-2`,onClick:p,children:[(0,H.jsx)(An,{}),` Sessions`]})}),(0,H.jsxs)(`div`,{className:`mb-7`,children:[(0,H.jsx)(`p`,{className:`label-caps mb-3 text-[10px] text-[var(--primary)]`,children:`New session`}),(0,H.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.035em] sm:text-4xl`,children:`What should we work on?`}),(0,H.jsxs)(`p`,{className:`mt-3 max-w-2xl text-sm leading-6 text-[var(--muted-foreground)] sm:text-base`,children:[`Describe the outcome you want. The session and terminal will run on`,` `,(0,H.jsx)(`span`,{className:`font-medium text-[var(--foreground)]`,children:e}),`.`]})]}),(0,H.jsxs)(`form`,{ref:S,onSubmit:e=>{e.preventDefault(),k()},children:[(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_12px_34px_rgba(24,24,27,0.08)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),0_12px_34px_rgba(24,24,27,0.08)]`,"aria-busy":c,children:[(0,H.jsx)(`label`,{htmlFor:`session-initial-prompt`,className:`sr-only`,children:`Initial task`}),(0,H.jsx)(vk,{items:T.items,disabled:c,onRemove:T.remove,className:`px-5 pt-4`}),(0,H.jsx)(jg,{id:`session-initial-prompt`,value:b,disabled:c,rows:7,className:`min-h-40 max-h-[min(45dvh,24rem)] resize-none overflow-y-auto rounded-none border-0 bg-transparent px-5 py-5 text-base leading-7 shadow-none focus-visible:border-0 focus-visible:ring-0 md:text-base`,placeholder:`Fix a bug, build a feature, or investigate the codebase…`,onChange:e=>{w.current=void 0,x(e.target.value)},onPaste:T.onPaste,onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||C.current||e.nativeEvent.isComposing||e.keyCode===229||(e.preventDefault(),S.current?.requestSubmit())}}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-[var(--border)] bg-[var(--muted)]/15 p-2.5 sm:flex-nowrap sm:pl-4`,children:[(0,H.jsx)(yk,{policy:hk,disabled:c,onFiles:T.addFiles}),(0,H.jsx)(`label`,{htmlFor:`session-project`,className:`sr-only`,children:`Project`}),(0,H.jsxs)(my,{value:a?`project:${a}`:Pj,disabled:s||c,onValueChange:e=>{if(e===Fj){v();return}_(e===Pj?null:e.startsWith(`project:`)?e.slice(8):null)},children:[(0,H.jsx)(_y,{id:`session-project`,className:`w-36 bg-[var(--background)] sm:w-40`,"aria-label":`Project`,children:(0,H.jsx)(gy,{placeholder:s?`Loading projects…`:`Choose project`,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[D?(0,H.jsx)(sr,{className:`size-3.5 shrink-0 text-[var(--primary)]`}):(0,H.jsx)(or,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{className:`truncate`,children:D?.name??`No project`})]})})}),(0,H.jsxs)(by,{align:`start`,children:[i.length>0&&(0,H.jsxs)(hy,{children:[(0,H.jsxs)(xy,{className:`font-mono text-[9px] uppercase tracking-[0.12em]`,children:[`Projects on `,e]}),i.map(e=>(0,H.jsx)(Sy,{value:`project:${e.id}`,textValue:e.name,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(sr,{className:`size-3.5 shrink-0 text-[var(--primary)]`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.id))]}),i.length>0&&(0,H.jsx)(Cy,{}),(0,H.jsx)(Sy,{value:Fj,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(or,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{children:`New project`})]})}),(0,H.jsx)(Sy,{value:Pj,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(di,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{children:`No project`})]})})]})]}),(0,H.jsx)(Lj,{options:t,selection:n,configuration:r,selectedOption:E,disabled:o||c,loading:o,onSelectionChange:h,onConfigurationChange:g}),(0,H.jsx)(`label`,{htmlFor:`session-permission`,className:`sr-only`,children:`Permissions`}),(0,H.jsxs)(my,{value:r.permissionPreset,disabled:c,onValueChange:e=>g({...r,permissionPreset:e}),children:[(0,H.jsx)(_y,{id:`session-permission`,className:`w-36 bg-[var(--background)] sm:w-40`,"aria-label":`Permissions`,children:(0,H.jsx)(gy,{children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(Zr,{className:`size-3.5 shrink-0 text-[var(--muted-foreground)]`}),(0,H.jsx)(`span`,{className:`truncate`,children:Rj(r.permissionPreset)})]})})}),(0,H.jsxs)(by,{align:`end`,children:[(0,H.jsx)(Sy,{value:`default`,children:`Default permissions`}),(0,H.jsx)(Sy,{value:`read-only`,children:`Read only`}),(0,H.jsx)(Sy,{value:`workspace-write`,children:`Workspace write`}),(0,H.jsx)(Sy,{value:`full-access`,children:`Full access`})]})]}),(0,H.jsx)(J,{type:`submit`,size:`icon`,className:`size-11 shrink-0 rounded-full md:size-10`,disabled:!O,"aria-label":c?`Starting session`:`Start session`,children:c?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(Ur,{})})]})]}),(0,H.jsxs)(`div`,{className:`mt-2 flex min-h-6 flex-wrap items-start justify-between gap-x-4 gap-y-1 px-1 text-xs text-[var(--muted-foreground)]`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,role:l||d?`alert`:`status`,"aria-live":l||d?`assertive`:`polite`,children:[(0,H.jsx)(`span`,{children:l??d??(E&&!E.ready?`${E.reason??`${E.name} needs setup on ${e}.`} Start to open its login terminal; your task will wait safely.`:``)}),l&&t.providers.length===0&&t.agents.length===0&&!o&&(0,H.jsx)(J,{type:`button`,variant:`link`,size:`sm`,className:`h-auto px-0 text-xs`,onClick:m,children:`Retry`})]}),(0,H.jsx)(`span`,{className:`hidden font-mono text-[10px] sm:inline`,children:`Enter to start · Shift+Enter for newline`})]})]})]})})]})}function Lj({options:e,selection:t,configuration:n,selectedOption:r,disabled:i,loading:a,onSelectionChange:o,onConfigurationChange:s}){let c=(t?.kind===`provider`?e.providers.find(e=>e.id===t.id):void 0)?.models?.find(e=>e.id===n.model),l=c?.reasoningOptions.find(e=>e.value===n.reasoningEffort),u=(e,t,r)=>{o({kind:`provider`,id:e}),s({permissionPreset:n.permissionPreset,...t?{model:t}:{},...r?{reasoningEffort:r}:{}})};return(0,H.jsxs)(xg,{children:[(0,H.jsx)(Sg,{asChild:!0,children:(0,H.jsxs)(J,{id:`session-launch-target`,type:`button`,variant:`outline`,disabled:i,className:`w-44 justify-start bg-[var(--background)] font-normal sm:w-48 md:ml-auto`,"aria-label":`Run with`,children:[r?(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,H.jsx)(zj,{status:lE(r)}),(0,H.jsxs)(`span`,{className:`truncate`,children:[r.name,c?` / ${c.label}`:``,l?` / ${l.label}`:``]})]}):(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[var(--muted-foreground)]`,children:a?`Loading…`:`Choose runtime / model / thinking`}),(0,H.jsx)(Fn,{className:`ml-auto size-3.5 shrink-0 opacity-55`})]})}),(0,H.jsxs)(Cg,{align:`end`,className:`min-w-56`,children:[e.providers.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Tg,{className:`font-mono text-[9px] uppercase tracking-[0.12em]`,children:`Providers · Runtime → Model → Thinking`}),e.providers.map(e=>{let r=e.models??[],i=t?.kind===`provider`&&t.id===e.id;return r.length===0?(0,H.jsxs)(wg,{onSelect:()=>u(e.id),children:[(0,H.jsx)(zj,{status:lE(e)}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),i&&(0,H.jsx)(Pn,{className:`size-3.5 text-[var(--primary)]`})]},`provider:${e.id}`):(0,H.jsxs)(Dg,{children:[(0,H.jsxs)(Og,{children:[(0,H.jsx)(zj,{status:lE(e)}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]}),(0,H.jsxs)(kg,{children:[(0,H.jsx)(Tg,{className:`font-mono text-[9px] uppercase tracking-[0.12em]`,children:`Model`}),r.map(t=>{let r=i&&n.model===t.id;return t.reasoningOptions.length===0?(0,H.jsxs)(wg,{onSelect:()=>u(e.id,t.id),children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.label,t.isDefault?` · default`:``]}),r&&(0,H.jsx)(Pn,{className:`size-3.5 text-[var(--primary)]`})]},t.id):(0,H.jsxs)(Dg,{children:[(0,H.jsx)(Og,{children:(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.label,t.isDefault?` · default`:``]})}),(0,H.jsxs)(kg,{children:[(0,H.jsx)(Tg,{className:`font-mono text-[9px] uppercase tracking-[0.12em]`,children:`Thinking effort`}),t.reasoningOptions.map(i=>{let a=r&&n.reasoningEffort===i.value;return(0,H.jsxs)(wg,{onSelect:()=>u(e.id,t.id,i.value),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i.label}),a&&(0,H.jsx)(Pn,{className:`size-3.5 text-[var(--primary)]`})]},i.value)})]})]},t.id)})]})]},`provider:${e.id}`)})]}),e.providers.length>0&&e.agents.length>0&&(0,H.jsx)(Eg,{}),e.agents.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Tg,{className:`font-mono text-[9px] uppercase tracking-[0.12em]`,children:`Agents`}),e.agents.map(e=>{let n=t?.kind===`agent`&&t.id===e.id;return(0,H.jsxs)(wg,{onSelect:()=>o({kind:`agent`,id:e.id}),children:[(0,H.jsx)(zj,{status:lE(e)}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name??e.id}),n&&(0,H.jsx)(Pn,{className:`size-3.5 text-[var(--primary)]`})]},`agent:${e.id}`)})]})]})]})}function Rj(e){return{default:`Default`,"read-only":`Read only`,"workspace-write":`Workspace write`,"full-access":`Full access`}[e]}function zj({status:e}){let t=e===`ready`?`Ready`:e===`needs_setup`?`Needs setup`:`Readiness not reported`;return(0,H.jsxs)(`span`,{className:`inline-flex size-3.5 shrink-0 items-center justify-center`,title:t,children:[(0,H.jsx)(`span`,{className:`size-2 rounded-full ${e===`ready`?`bg-[var(--success)]`:e===`needs_setup`?`bg-[var(--warning)]`:`bg-[var(--muted-foreground)]/55`}`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:t})]})}var Bj=`rynx.control.theme`;function Vj(){let e=localStorage.getItem(Bj);return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function Hj(){let[e,t]=(0,u.useState)(Vj);return(0,u.useEffect)(()=>{document.documentElement.classList.toggle(`dark`,e===`dark`),localStorage.setItem(Bj,e)},[e]),{theme:e,toggle:()=>t(e=>e===`dark`?`light`:`dark`)}}var Uj=2,Wj=1,Gj=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Uj,Math.floor(u/e.css.cell.width)),rows:Math.max(Wj,Math.floor(l/e.css.cell.height))}}},Kj=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=Jj.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function qj(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var Jj=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!qj(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},Yj=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Xj(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var Zj=class{constructor(e=Xj,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||Yj;this._linkProvider=this._terminal.registerLinkProvider(new Kj(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},Qj=Object.defineProperty,$j=Object.getOwnPropertyDescriptor,eM=(e,t,n,r)=>{for(var i=r>1?void 0:r?$j(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Qj(t,n,i),i},tM=(e,t)=>(n,r)=>t(n,r,e),nM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?sM.isErrorNoTelemetry(e)?new sM(e.message+`
|
|
63
|
+
|
|
64
|
+
`+e.stack):Error(e.message+`
|
|
65
|
+
|
|
66
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function rM(e){aM(e)||nM.onUnexpectedError(e)}var iM=`Canceled`;function aM(e){return e instanceof oM||e instanceof Error&&e.name===iM&&e.message===iM}var oM=class extends Error{constructor(){super(iM),this.name=this.message}},sM=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},cM;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(cM||={});var lM=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||cM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};lM.empty=new lM(e=>{});function uM(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var dM;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(dM||={});var fM=null;function pM(e){return fM?.trackDisposable(e),e}function mM(e){fM?.markAsDisposed(e)}function hM(e,t){fM?.setParent(e,t)}function gM(e){if(dM.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function _M(...e){return vM(()=>gM(e))}function vM(e){let t=pM({dispose:uM(()=>{mM(t),e()})});return t}var yM=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,pM(this)}dispose(){this._isDisposed||(mM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{gM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return hM(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),hM(e,null))}};yM.DISABLE_DISPOSED_WARNING=!1;var bM=yM,xM=class{constructor(){this._store=new bM,pM(this),hM(this._store,this)}dispose(){mM(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};xM.None=Object.freeze({dispose(){}});var SM=class{constructor(){this._isDisposed=!1,pM(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&hM(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,mM(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&hM(e,null),e}},CM=typeof process<`u`&&`title`in process,wM=CM?`node`:navigator.userAgent,TM=CM?`node`:navigator.platform,EM=wM.includes(`Firefox`),DM=wM.includes(`Edge`),OM=/^((?!chrome|android).)*safari/i.test(wM);function kM(){if(!OM)return 0;let e=wM.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(TM),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(TM),TM.indexOf(`Linux`),/\bCrOS\b/.test(wM);var AM=``,jM=0,MM=0,NM=0,PM=0,FM={css:`#00000000`,rgba:0},IM;(e=>{function t(e,t,n,r){return r===void 0?`#${VM(e)}${VM(t)}${VM(n)}`:`#${VM(e)}${VM(t)}${VM(n)}${VM(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(IM||={});var LM;(e=>{function t(e,t){if(PM=(t.rgba&255)/255,PM===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return jM=a+Math.round((n-a)*PM),MM=o+Math.round((r-o)*PM),NM=s+Math.round((i-s)*PM),{css:IM.toCss(jM,MM,NM),rgba:IM.toRgba(jM,MM,NM)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=BM.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return IM.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[jM,MM,NM]=BM.toChannels(t),{css:IM.toCss(jM,MM,NM),rgba:t}}e.opaque=i;function a(e,t){return PM=Math.round(t*255),[jM,MM,NM]=BM.toChannels(e.rgba),{css:IM.toCss(jM,MM,NM,PM),rgba:IM.toRgba(jM,MM,NM,PM)}}e.opacity=a;function o(e,t){return PM=e.rgba&255,a(e,PM*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(LM||={});var RM;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return jM=parseInt(e.slice(1,2).repeat(2),16),MM=parseInt(e.slice(2,3).repeat(2),16),NM=parseInt(e.slice(3,4).repeat(2),16),IM.toColor(jM,MM,NM);case 5:return jM=parseInt(e.slice(1,2).repeat(2),16),MM=parseInt(e.slice(2,3).repeat(2),16),NM=parseInt(e.slice(3,4).repeat(2),16),PM=parseInt(e.slice(4,5).repeat(2),16),IM.toColor(jM,MM,NM,PM);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return jM=parseInt(r[1]),MM=parseInt(r[2]),NM=parseInt(r[3]),PM=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),IM.toColor(jM,MM,NM,PM);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[jM,MM,NM,PM]=t.getImageData(0,0,1,1).data,PM!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:IM.toRgba(jM,MM,NM,PM),css:e}}e.toColor=r})(RM||={});var zM;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(zM||={});var BM;(e=>{function t(e,t){if(PM=(t&255)/255,PM===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return jM=a+Math.round((n-a)*PM),MM=o+Math.round((r-o)*PM),NM=s+Math.round((i-s)*PM),IM.toRgba(jM,MM,NM)}e.blend=t;function n(e,t,n){let a=zM.relativeLuminance(e>>8),o=zM.relativeLuminance(t>>8);if(HM(a,o)<n){if(o<a){let o=r(e,t,n),s=HM(a,zM.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>HM(a,zM.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=HM(a,zM.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>HM(a,zM.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=HM(zM.relativeLuminance2(o,s,c),zM.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=HM(zM.relativeLuminance2(o,s,c),zM.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=HM(zM.relativeLuminance2(o,s,c),zM.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=HM(zM.relativeLuminance2(o,s,c),zM.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(BM||={});function VM(e){let t=e.toString(16);return t.length<2?`0`+t:t}function HM(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function UM(e){if(!e)throw Error(`value must not be falsy`);return e}function WM(e){return 57508<=e&&e<=57558}function GM(e){return 57520<=e&&e<=57527}function KM(e){return 57344<=e&&e<=63743}function qM(e){return 9472<=e&&e<=9631}function JM(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function YM(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!JM(e)&&!WM(e)&&!KM(e)}function XM(e){return WM(e)||qM(e)}function ZM(){return{css:{canvas:QM(),cell:QM()},device:{canvas:QM(),cell:QM(),char:{width:0,height:0,left:0,top:0}}}}function QM(){return{width:0,height:0}}function $M(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var eN=0,tN=0,nN=!1,rN=!1,iN=!1,aN,oN=0,sN=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,tN=0,eN=0,rN=!1,nN=!1,iN=!1,aN=this._themeService.colors,oN=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));oN=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(tN=e.backgroundColorRGB.rgba>>8&16777215,rN=!0),e.foregroundColorRGB&&(eN=e.foregroundColorRGB.rgba>>8&16777215,nN=!0)}),iN=this._selectionRenderModel.isCellSelected(this._terminal,t,n),iN){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:tN=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:tN=(this.result.fg&16777215)<<8|255;break;default:tN=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:tN=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:tN=(this.result.bg&16777215)<<8|255}tN=BM.blend(tN,(this._coreBrowserService.isFocused?aN.selectionBackgroundOpaque:aN.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else tN=(this._coreBrowserService.isFocused?aN.selectionBackgroundOpaque:aN.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(rN=!0,aN.selectionForeground&&(eN=aN.selectionForeground.rgba>>8&16777215,nN=!0),XM(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))eN=(this._coreBrowserService.isFocused?aN.selectionBackgroundOpaque:aN.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:eN=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:eN=(this.result.bg&16777215)<<8|255}else switch(this.result.fg&50331648){case 16777216:case 33554432:eN=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:eN=(this.result.fg&16777215)<<8|255;break;default:eN=this._themeService.colors.foreground.rgba}eN=BM.blend(eN,(this._coreBrowserService.isFocused?aN.selectionBackgroundOpaque:aN.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}nN=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(tN=e.backgroundColorRGB.rgba>>8&16777215,rN=!0),e.foregroundColorRGB&&(eN=e.foregroundColorRGB.rgba>>8&16777215,nN=!0)}),rN&&(tN=iN?e.bg&-150994944|tN|50331648:e.bg&-16777216|tN|50331648),nN&&(eN=e.fg&-83886080|eN|50331648),this.result.fg&67108864&&(rN&&!nN&&(eN=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|aN.background.rgba>>8&16777215|50331648,nN=!0),!rN&&nN&&(tN=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|aN.foreground.rgba>>8&16777215|50331648,rN=!0)),aN=void 0,this.result.bg=rN?tN:this.result.bg,this.result.fg=nN?eN:this.result.fg,this.result.ext&=536870911,this.result.ext|=oN<<29&3758096384}},cN=.5,lN=EM||DM?`bottom`:`ideographic`,uN={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},dN={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},fN={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},pN={"":{d:`M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655`,type:0},"":{d:`M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5`,type:0},"":{d:`M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82`,type:0},"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}};pN[``]=pN[``],pN[``]=pN[``];function mN(e,t,n,r,i,a,o,s){let c=uN[t];if(c)return hN(e,c,n,r,i,a),!0;let l=dN[t];if(l)return _N(e,l,n,r,i,a),!0;let u=fN[t];if(u)return vN(e,u,n,r,i,a,s),!0;let d=pN[t];return d?(yN(e,d,n,r,i,a,o,s),!0):!1}function hN(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}var gN=new Map;function _N(e,t,n,r,i,a){let o=gN.get(t);o||(o=new Map,gN.set(t,o));let s=e.fillStyle;if(typeof s!=`string`)throw Error(`Unexpected fillStyle type "${s}"`);let c=o.get(s);if(!c){let n=t[0].length,r=t.length,i=e.canvas.ownerDocument.createElement(`canvas`);i.width=n,i.height=r;let a=UM(i.getContext(`2d`)),l=new ImageData(n,r),u,d,f,p;if(s.startsWith(`#`))u=parseInt(s.slice(1,3),16),d=parseInt(s.slice(3,5),16),f=parseInt(s.slice(5,7),16),p=s.length>7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;e<r;e++)for(let r=0;r<n;r++)l.data[(e*n+r)*4]=u,l.data[(e*n+r)*4+1]=d,l.data[(e*n+r)*4+2]=f,l.data[(e*n+r)*4+3]=t[e][r]*(p*255);a.putImageData(l,0,0),c=UM(e.createPattern(i,null)),o.set(s,c)}e.fillStyle=c,e.fillRect(n,r,i,a)}function vN(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[s,c]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(s);let t;t=typeof c==`function`?c(.15,.15/a*i):c;for(let s of t.split(` `)){let t=s[0],c=xN[t];if(!c){console.error(`Could not find drawing instructions for "${t}"`);continue}let l=s.substring(1).split(`,`);!l[0]||!l[1]||c(e,SN(l,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}function yN(e,t,n,r,i,a,o,s){let c=new Path2D;c.rect(n,r,i,a),e.clip(c),e.beginPath();let l=o/12;e.lineWidth=s*l;for(let o of t.d.split(` `)){let c=o[0],u=xN[c];if(!u){console.error(`Could not find drawing instructions for "${c}"`);continue}let d=o.substring(1).split(`,`);!d[0]||!d[1]||u(e,SN(d,i,a,n,r,!1,s,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function bN(e,t,n=0){return Math.max(Math.min(e,t),n)}var xN={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function SN(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<l.length;e+=2)l[e]*=t-s*o-c*o,a&&l[e]!==0&&(l[e]=bN(Math.round(l[e]+.5)-.5,t,0)),l[e]+=r+s*o;for(let e=1;e<l.length;e+=2)l[e]*=n,a&&l[e]!==0&&(l[e]=bN(Math.round(l[e]+.5)-.5,n,0)),l[e]+=i;return l}var CN=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},wN=class{constructor(){this._data=new CN}set(e,t,n,r,i){this._data.get(e,t)||this._data.set(e,t,new CN),this._data.get(e,t).set(n,r,i)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}},TN=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},EN=class extends TN{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},DN=class extends TN{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ON=!CM&&`requestIdleCallback`in window?DN:EN,kN=class e{constructor(){this.fg=0,this.bg=0,this.extended=new AN}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},AN=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},jN=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};jN.Undefined=new jN(void 0);var MN=globalThis.performance&&typeof globalThis.performance.now==`function`,NN=class e{static create(t){return new e(t)}constructor(e){this._now=MN&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},PN;(e=>{e.None=()=>xM.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(_M(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new KN({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new KN({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new KN({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new KN({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new KN({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new KN;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new KN(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof bM?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(PN||={});var FN=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new NN,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};FN.all=new Set,FN._idPool=0;var IN=FN,LN=-1,RN=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new VN(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};RN._idPool=1;var zN=RN,BN=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
67
|
+
`).slice(2).join(`
|
|
68
|
+
`))}},VN=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},HN=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},UN=0,WN=class{constructor(e){this.value=e,this.id=UN++}},GN=2,KN=class{constructor(e){this._size=0,this._options=e,this._leakageMon=LN>0||this._options?.leakWarningThreshold?new zN(e?.onListenerError??rM,this._options?.leakWarningThreshold??LN):void 0,this._perfMon=this._options?._profName?new IN(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new HN(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||rM)(n),xM.None}if(this._disposed)return xM.None;t&&(e=e.bind(t));let r=new WN(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=BN.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof WN?(this._deliveryQueue??=new qN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=vM(()=>{i?.(),this._removeListener(r)});return n instanceof bM?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*GN<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||rM;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof WN)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},qN=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},JN={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},YN=2,XN,ZN=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new wN,this._cacheMapCombined=new wN,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new kN,this._textureSize=512,this._onAddTextureAtlasCanvas=new KN,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new KN,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=tP(e,this._config.deviceCellWidth*4+YN*2,this._config.deviceCellHeight+YN*2),this._tmpCtx=UM(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new ON;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==r)n=e,r=t[e].canvas.width;else if(e-n===3)break;let i=t.slice(n,n+4),a=i.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new QN(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new QN(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i,a){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i,a)}getRasterizedGlyph(e,t,n,r,i,a){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i,a)}_getFromCacheMap(e,t,n,r,i,a,o){return XN=e.get(t,n,r,i),XN||(XN=this._drawToCache(t,n,r,i,a,o),e.set(t,n,r,i,XN)),XN}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return FM;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=kN.toColorRGB(t);i=IM.toColor(e[0],e[1],e[2]);break;default:i=n?LM.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(i=LM.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=kN.toColorRGB(a);d=IM.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=LM.opaque(d)),s&&(d=LM.multiplyOpacity(d,cN)),d}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=BM.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=IM.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+YN*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<c&&(this._tmpCanvas.width=c);let l=Math.min(this._config.deviceCellHeight+YN*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=i,this._workAttributeData.isInvisible())return JN;let u=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),f=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),m=!!this._workAttributeData.isUnderline(),h=!!this._workAttributeData.isStrikethrough(),g=!!this._workAttributeData.isOverline(),_=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(d){let e=_;_=y,y=e;let t=v;v=b,b=t}let x=this._getBackgroundColor(b,y,d,f);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let S=u?this._config.fontWeightBold:this._config.fontWeight,C=p?`italic`:``;this._tmpCtx.font=`${C} ${S} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=lN;let w=s.length===1&&WM(s.charCodeAt(0)),T=s.length===1&&GM(s.charCodeAt(0)),E=this._getForegroundColor(n,b,y,r,v,_,d,f,u,XM(s.charCodeAt(0)));this._tmpCtx.fillStyle=E.css;let D=T?0:YN*2,O=!1;this._config.customGlyphs!==!1&&(O=mN(this._tmpCtx,s,D,D,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let k=!w,A;if(A=typeof t==`number`?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),m){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())k=!1,this._tmpCtx.strokeStyle=`rgb(${kN.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{k=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=D,r=Math.ceil(D+this._config.deviceCharHeight)-t-(a?e*2:0),i=r+e,o=r+e*2,c=this._workAttributeData.getUnderlineVariantOffset();for(let a=0;a<A;a++){this._tmpCtx.save();let s=n+a*this._config.deviceCellWidth,l=n+(a+1)*this._config.deviceCellWidth,u=s+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r),this._tmpCtx.moveTo(s,o),this._tmpCtx.lineTo(l,o);break;case 3:let n=e<=1?o:Math.ceil(D+this._config.deviceCharHeight-e/2)-t,a=e<=1?r:Math.ceil(D+this._config.deviceCharHeight+e/2)-t,d=new Path2D;d.rect(s,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(d),this._tmpCtx.moveTo(s-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(s-this._config.deviceCellWidth/2,a,s,a,s,i),this._tmpCtx.bezierCurveTo(s,n,u,n,u,i),this._tmpCtx.bezierCurveTo(u,a,l,a,l,i),this._tmpCtx.bezierCurveTo(l,n,l+this._config.deviceCellWidth/2,n,l+this._config.deviceCellWidth/2,i);break;case 4:let f=c===0?0:c>=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=$M(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!O&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*A,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(s,D,D+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(D,D+t),this._tmpCtx.lineTo(D+this._config.deviceCharWidth*A,D+t),this._tmpCtx.stroke()}if(O||this._tmpCtx.fillText(s,D,D+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=$N(this._tmpCtx.getImageData(D,D,this._config.deviceCellWidth,this._config.deviceCellHeight),x,E,k);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(s,D,D+this._config.deviceCharHeight-t),e=$N(this._tmpCtx.getImageData(D,D,this._config.deviceCellWidth,this._config.deviceCellHeight),x,E,k),e);t++);}if(h){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(D,D+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(D+this._config.deviceCharWidth*A,D+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let j=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),M;if(M=this._config.allowTransparency?eP(j):$N(j,x,E,k),M)return JN;let N=this._findGlyphBoundingBox(j,this._workBoundingBox,c,T,O,D),P,F;for(;;){if(this._activePages.length===0){let e=this._createNewPage();P=e,F=e.currentRow,F.height=N.size.y;break}P=this._activePages[this._activePages.length-1],F=P.currentRow;for(let e of this._activePages)N.size.y<=e.currentRow.height&&(P=e,F=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=F.height&&N.size.y<=t.height&&(P=this._activePages[e],F=t);if(N.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new QN(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),P=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+N.size.x>=P.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+N.size.y>=P.canvas.height||F.height>N.size.y+2){let t=!1;if(P.currentRow.y+P.currentRow.height+N.size.y>=P.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+N.size.y<e.canvas.height){n=e;break}if(n)P=n;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&F.y+N.size.y<=P.canvas.height&&F.height>=N.size.y&&F.x+N.size.x<=P.canvas.width)t=!0;else{let e=this._createNewPage();P=e,F=e.currentRow,F.height=N.size.y,t=!0}}t||(P.currentRow.height>0&&P.fixedRows.push(P.currentRow),F={x:0,y:P.currentRow.y+P.currentRow.height,height:N.size.y},P.fixedRows.push(F),P.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+N.size.x<=P.canvas.width)break;F===P.currentRow?(F.x=0,F.y+=F.height,F.height=0):P.fixedRows.splice(P.fixedRows.indexOf(F),1)}return N.texturePage=this._pages.indexOf(P),N.texturePosition.x=F.x,N.texturePosition.y=F.y,N.texturePositionClipSpace.x=F.x/P.canvas.width,N.texturePositionClipSpace.y=F.y/P.canvas.height,N.sizeClipSpace.x/=P.canvas.width,N.sizeClipSpace.y/=P.canvas.height,F.height=Math.max(F.height,N.size.y),F.x+=N.size.x,P.ctx.putImageData(j,N.texturePosition.x-this._workBoundingBox.left,N.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,N.size.x,N.size.y),P.addGlyph(N),P.version++,N}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+r*4+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+n*4+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+n*4+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+r*4+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},QN=class{constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=tP(e,t,t),this.ctx=UM(this.canvas.getContext(`2d`,{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function $N(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function eP(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function tP(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function nP(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:FM,cursorAccent:FM,selectionForeground:FM,selectionBackgroundTransparent:FM,selectionBackgroundOpaque:FM,selectionInactiveBackgroundTransparent:FM,selectionInactiveBackgroundOpaque:FM,overviewRulerBorder:FM,scrollbarSliderBackground:FM,scrollbarSliderHoverBackground:FM,scrollbarSliderActiveBackground:FM,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function rP(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function iP(e){return(e&50331648)==16777216||(e&50331648)==33554432}var aP=[];function oP(e,t,n,r,i,a,o,s,c){let l=nP(r,i,a,o,t,n,s,c);for(let t=0;t<aP.length;t++){let n=aP[t],r=n.ownedBy.indexOf(e);if(r>=0){if(rP(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),aP.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<aP.length;t++){let n=aP[t];if(rP(n.config,l))return n.ownedBy.push(e),n.atlas}let u=e._core,d={atlas:new ZN(document,l,u.unicodeService),config:l,ownedBy:[e]};return aP.push(d),d.atlas}function sP(e){for(let t=0;t<aP.length;t++){let n=aP[t].ownedBy.indexOf(e);if(n!==-1){aP[t].ownedBy.length===1?(aP[t].atlas.dispose(),aP.splice(t,1)):aP[t].ownedBy.splice(n,1);break}}}var cP=600,lP=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}))}_restartInterval(e=cP){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=cP-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=cP-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},cP)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function uP(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return vM(()=>r?.disconnect())}function dP(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var fP=class e extends kN{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new AN,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dP(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},pP=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function mP(e,t,n){let r=UM(e.createProgram());if(e.attachShader(r,UM(hP(e,e.VERTEX_SHADER,t))),e.attachShader(r,UM(hP(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function hP(e,t,n){let r=UM(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function gP(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r}var _P=class{constructor(e){this.texture=e,this.version=-1}},vP=`#version 300 es
|
|
69
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
70
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
71
|
+
layout (location = 2) in vec2 a_offset;
|
|
72
|
+
layout (location = 3) in vec2 a_size;
|
|
73
|
+
layout (location = 4) in float a_texpage;
|
|
74
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
75
|
+
layout (location = 6) in vec2 a_texsize;
|
|
76
|
+
|
|
77
|
+
uniform mat4 u_projection;
|
|
78
|
+
uniform vec2 u_resolution;
|
|
79
|
+
|
|
80
|
+
out vec2 v_texcoord;
|
|
81
|
+
flat out int v_texpage;
|
|
82
|
+
|
|
83
|
+
void main() {
|
|
84
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
85
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
86
|
+
v_texpage = int(a_texpage);
|
|
87
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
88
|
+
}`;function yP(e){let t=``;for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
89
|
+
precision lowp float;
|
|
90
|
+
|
|
91
|
+
in vec2 v_texcoord;
|
|
92
|
+
flat in int v_texpage;
|
|
93
|
+
|
|
94
|
+
uniform sampler2D u_texture[${e}];
|
|
95
|
+
|
|
96
|
+
out vec4 outColor;
|
|
97
|
+
|
|
98
|
+
void main() {
|
|
99
|
+
if (v_texpage == 0) {
|
|
100
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
101
|
+
} ${t}
|
|
102
|
+
}`}var bP=11,xP=bP*Float32Array.BYTES_PER_ELEMENT,SP=2,CP=0,wP,TP=0,EP=0,DP=class extends xM{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let i=this._gl;ZN.maxAtlasPages===void 0&&(ZN.maxAtlasPages=Math.min(32,UM(i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS))),ZN.maxTextureSize=UM(i.getParameter(i.MAX_TEXTURE_SIZE))),this._program=UM(mP(i,vP,yP(ZN.maxAtlasPages))),this._register(vM(()=>i.deleteProgram(this._program))),this._projectionLocation=UM(i.getUniformLocation(this._program,`u_projection`)),this._resolutionLocation=UM(i.getUniformLocation(this._program,`u_resolution`)),this._textureLocation=UM(i.getUniformLocation(this._program,`u_texture`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(vM(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(vM(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=UM(i.createBuffer()),this._register(vM(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,2,i.FLOAT,!1,xP,0),i.vertexAttribDivisor(2,1),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,i.FLOAT,!1,xP,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(3,1),i.enableVertexAttribArray(4),i.vertexAttribPointer(4,1,i.FLOAT,!1,xP,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(4,1),i.enableVertexAttribArray(5),i.vertexAttribPointer(5,2,i.FLOAT,!1,xP,5*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(5,1),i.enableVertexAttribArray(6),i.vertexAttribPointer(6,2,i.FLOAT,!1,xP,7*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(6,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,xP,9*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.useProgram(this._program);let l=new Int32Array(ZN.maxAtlasPages);for(let e=0;e<ZN.maxAtlasPages;e++)l[e]=e;i.uniform1iv(this._textureLocation,l),i.uniformMatrix4fv(this._projectionLocation,!1,pP),this._atlasTextures=[];for(let e=0;e<ZN.maxAtlasPages;e++){let t=new _P(UM(i.createTexture()));this._register(vM(()=>i.deleteTexture(t.texture))),i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[e]=t}i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(e,t,n,r,i,a,o,s,c){this._updateCell(this._vertices.attributes,e,t,n,r,i,a,o,s,c)}_updateCell(e,t,n,r,i,a,o,s,c,l){if(CP=(n*this._terminal.cols+t)*bP,r===0||r===void 0){e.fill(0,CP,CP+bP-1-SP);return}this._atlas&&(wP=s&&s.length>1?this._atlas.getRasterizedGlyphCombinedChar(s,i,a,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,i,a,o,!1,this._terminal.element),TP=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),i!==l&&wP.offset.x>TP?(EP=wP.offset.x-TP,e[CP]=-(wP.offset.x-EP)+this._dimensions.device.char.left,e[CP+1]=-wP.offset.y+this._dimensions.device.char.top,e[CP+2]=(wP.size.x-EP)/this._dimensions.device.canvas.width,e[CP+3]=wP.size.y/this._dimensions.device.canvas.height,e[CP+4]=wP.texturePage,e[CP+5]=wP.texturePositionClipSpace.x+EP/this._atlas.pages[wP.texturePage].canvas.width,e[CP+6]=wP.texturePositionClipSpace.y,e[CP+7]=wP.sizeClipSpace.x-EP/this._atlas.pages[wP.texturePage].canvas.width,e[CP+8]=wP.sizeClipSpace.y):(e[CP]=-wP.offset.x+this._dimensions.device.char.left,e[CP+1]=-wP.offset.y+this._dimensions.device.char.top,e[CP+2]=wP.size.x/this._dimensions.device.canvas.width,e[CP+3]=wP.size.y/this._dimensions.device.canvas.height,e[CP+4]=wP.texturePage,e[CP+5]=wP.texturePositionClipSpace.x,e[CP+6]=wP.texturePositionClipSpace.y,e[CP+7]=wP.sizeClipSpace.x,e[CP+8]=wP.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&YM(r,c,wP.size.x,this._dimensions.device.cell.width)&&(e[CP+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*bP;this._vertices.count===t?this._vertices.attributes.fill(0):this._vertices.attributes=new Float32Array(t);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count===t?this._vertices.attributesBuffers[n].fill(0):this._vertices.attributesBuffers[n]=new Float32Array(t);this._vertices.count=t,n=0;for(let t=0;t<e.rows;t++)for(let r=0;r<e.cols;r++)this._vertices.attributes[n+9]=r/e.cols,this._vertices.attributes[n+10]=t/e.rows,n+=bP}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let t=0;t<e.lineLengths.length;t++){let i=t*this._terminal.cols*bP,a=this._vertices.attributes.subarray(i,i+e.lineLengths[t]*bP);n.set(a,r),r+=a.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,n.subarray(0,r),t.STREAM_DRAW);for(let e=0;e<this._atlas.pages.length;e++)this._atlas.pages[e].version!==this._atlasTextures[e].version&&this._bindAtlasPageTexture(t,this._atlas,e);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/bP)}setAtlas(e){this._atlas=e;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(e,t,n){e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[n].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[n].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[n].version=t.pages[n].version}setDimensions(e){this._dimensions=e}},OP=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function kP(){return new OP}var AP=4,jP=1,MP=2,NP=3,PP=2147483648,FP=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=kP()}resize(e,t){let n=e*t*AP;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},IP=`#version 300 es
|
|
103
|
+
layout (location = 0) in vec2 a_position;
|
|
104
|
+
layout (location = 1) in vec2 a_size;
|
|
105
|
+
layout (location = 2) in vec4 a_color;
|
|
106
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
107
|
+
|
|
108
|
+
uniform mat4 u_projection;
|
|
109
|
+
|
|
110
|
+
out vec4 v_color;
|
|
111
|
+
|
|
112
|
+
void main() {
|
|
113
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
114
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
115
|
+
v_color = a_color;
|
|
116
|
+
}`,LP=`#version 300 es
|
|
117
|
+
precision lowp float;
|
|
118
|
+
|
|
119
|
+
in vec4 v_color;
|
|
120
|
+
|
|
121
|
+
out vec4 outColor;
|
|
122
|
+
|
|
123
|
+
void main() {
|
|
124
|
+
outColor = v_color;
|
|
125
|
+
}`,RP=8,zP=RP*Float32Array.BYTES_PER_ELEMENT,BP=20*RP,VP=class{constructor(){this.attributes=new Float32Array(BP),this.count=0}},HP=0,UP=0,WP=0,GP=0,KP=0,qP=0,JP=0,YP=class extends xM{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new VP,this._verticesCursor=new VP;let i=this._gl;this._program=UM(mP(i,IP,LP)),this._register(vM(()=>i.deleteProgram(this._program))),this._projectionLocation=UM(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(vM(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(vM(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=UM(i.createBuffer()),this._register(vM(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,zP,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,zP,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,zP,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,pP),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*AP,d=e.cells[u+jP],f=e.cells[u+MP],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*RP,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*RP,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*RP,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*RP,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*RP,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*RP,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:HP=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:HP=(n&16777215)<<8;break;default:HP=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:HP=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:HP=(r&16777215)<<8;break;default:HP=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=gP(e.attributes,this._terminal.rows*this._terminal.cols*RP)),UP=i*this._dimensions.device.cell.width,WP=o*this._dimensions.device.cell.height,GP=(HP>>24&255)/255,KP=(HP>>16&255)/255,qP=(HP>>8&255)/255,JP=1,this._addRectangle(e.attributes,t,UP,WP,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,GP,KP,qP,JP)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},XP=class extends xM{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(vM(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=UM(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=oP(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=lN,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},ZP=class extends XP{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&iP(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},QP=typeof window==`object`?window:globalThis,$P=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new KN,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new KN,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};$P.INSTANCE=new $P;var eF=$P;function tF(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}eF.INSTANCE.onDidChangeZoomLevel,eF.INSTANCE.onDidChangeFullscreen;var nF=typeof navigator==`object`?navigator.userAgent:``;nF.indexOf(`Firefox`);var rF=nF.indexOf(`AppleWebKit`)>=0;!(nF.indexOf(`Chrome`)>=0)&&nF.indexOf(`Safari`),nF.indexOf(`Electron/`),nF.indexOf(`Android`);var iF=!1;if(typeof QP.matchMedia==`function`){let e=QP.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=QP.matchMedia(`(display-mode: fullscreen)`);iF=e.matches,tF(QP,e,({matches:e})=>{iF&&t.matches||(iF=e)})}function aF(){return iF}var oF=`en`,sF=!1,cF=!1,lF=!1,uF=oF,dF,fF=globalThis,pF;typeof fF.vscode<`u`&&typeof fF.vscode.process<`u`?pF=fF.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(pF=process);var mF=typeof pF?.versions?.electron==`string`&&pF?.type===`renderer`;if(typeof pF==`object`){pF.platform,pF.platform,sF=pF.platform===`linux`,sF&&pF.env.SNAP&&pF.env.SNAP_REVISION,pF.env.CI||pF.env.BUILD_ARTIFACTSTAGINGDIRECTORY,uF=oF;let e=pF.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,uF=t.resolvedLanguage||oF,t.languagePack?.translationsConfigFile}catch{}cF=!0}else typeof navigator==`object`&&!mF?(dF=navigator.userAgent,dF.indexOf(`Windows`),dF.indexOf(`Macintosh`),(dF.indexOf(`Macintosh`)>=0||dF.indexOf(`iPad`)>=0||dF.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,sF=dF.indexOf(`Linux`)>=0,dF?.indexOf(`Mobi`),lF=!0,uF=globalThis._VSCODE_NLS_LANGUAGE||oF,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var hF=cF;lF&&typeof fF.importScripts==`function`&&fF.origin;var gF=dF,_F=uF,vF;(e=>{function t(){return _F}e.value=t;function n(){return _F.length===2?_F===`en`:_F.length>=3&&_F[0]===`e`&&_F[1]===`n`&&_F[2]===`-`}e.isDefaultVariant=n;function r(){return _F===`en`}e.isDefault=r})(vF||={});var yF=typeof fF.postMessage==`function`&&!fF.importScripts;(()=>{if(yF){let e=[];fF.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),fF.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var bF=!!(gF&&gF.indexOf(`Chrome`)>=0);gF&&gF.indexOf(`Firefox`),!bF&&gF&&gF.indexOf(`Safari`),gF&&gF.indexOf(`Edg/`),gF&&gF.indexOf(`Android`);var xF=typeof navigator==`object`?navigator:{};hF||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||xF&&xF.clipboard&&xF.clipboard.writeText,hF||xF&&xF.clipboard&&xF.clipboard.readText,hF||aF()||xF.keyboard,`ontouchstart`in QP||xF.maxTouchPoints,QP.PointerEvent&&(`ontouchstart`in QP||navigator.maxTouchPoints);var SF=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},CF=new SF,wF=new SF,TF=new SF;Array(230);var EF;(e=>{function t(e){return CF.keyCodeToStr(e)}e.toString=t;function n(e){return CF.strToKeyCode(e)}e.fromString=n;function r(e){return wF.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return TF.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return wF.strToKeyCode(e)||TF.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return CF.keyCodeToStr(e)}e.toElectronAccelerator=o})(EF||={});var DF=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),OF;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof kF?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:PN.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:DF})})(OF||={});var kF=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?DF:(this._emitter||=new KN,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var AF;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(AF||={});var jF=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new KN,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await PN.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};jF.EMPTY=jF.fromArray([]);function MF(e){return NF(e,0)}function NF(e,t){switch(typeof e){case`object`:return e===null?PF(349,t):Array.isArray(e)?LF(e,t):RF(e,t);case`string`:return IF(e,t);case`boolean`:return FF(e,t);case`number`:return PF(e,t);case`undefined`:return PF(937,t);default:return PF(617,t)}}function PF(e,t){return(t<<5)-t+e|0}function FF(e,t){return PF(e?433:863,t)}function IF(e,t){t=PF(149417,t);for(let n=0,r=e.length;n<r;n++)t=PF(e.charCodeAt(n),t);return t}function LF(e,t){return t=PF(104579,t),e.reduce((e,t)=>NF(t,e),t)}function RF(e,t){return t=PF(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=IF(n,t),NF(e[n],t)),t)}var{registerWindow:zF,getWindow:BF,getDocument:VF,getWindows:HF,getWindowsCount:UF,getWindowId:WF,getWindowById:GF,hasWindow:KF,onDidRegisterWindow:qF,onWillUnregisterWindow:JF,onDidUnregisterWindow:YF}=function(){let e=new Map,t={window:QP,disposables:new bM};e.set(QP.vscodeWindowId,t);let n=new KN,r=new KN,i=new KN;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return xM.None;let a=new bM,o={window:t,disposables:a.add(new bM)};return e.set(t.vscodeWindowId,o),a.add(vM(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(ZF(t,$F.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:QP},getDocument(e){return BF(e).document}}}(),XF=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function ZF(e,t,n,r){return new XF(e,t,n,r)}var QF=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};QF.None=new QF(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=MF(n),a=r.get(i);if(a)a.users+=1;else{let o=new KN,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(vM(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var $F={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:rF?`webkitAnimationStart`:`animationstart`,ANIMATION_END:rF?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:rF?`webkitAnimationIteration`:`animationiteration`},eI=class extends xM{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new SM,this._charAtlasDisposable=this._register(new SM),this._observerDisposable=this._register(new SM),this._model=new FP,this._workCell=new fP,this._workCell2=new fP,this._rectangleRenderer=this._register(new SM),this._glyphRenderer=this._register(new SM),this._onChangeTextureAtlas=this._register(new KN),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new KN),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new KN),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new KN),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new KN),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new sN(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new ZP(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=ZM(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(ZF(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(ZF(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,sP(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=uP(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=uP(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(vM(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),sP(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new YP(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new DP(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=oP(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=_M(PN.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),PN.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new lP(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=nI(e,n.rows-1,0),t=nI(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||w<p[0]||w>=p[1],d?(l=!0,r=new tI(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*AP,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),E&&o===S&&(y===w&&(this._model.cursor={x:w,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+r.getWidth()-1),y>=w&&y<=T&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+jP]!==this._cellColorResolver.result.bg||this._model.cells[v+MP]!==this._cellColorResolver.result.fg||this._model.cells[v+NP]!==this._cellColorResolver.result.ext)&&(D=!0,h.length>1&&(g|=PP),this._model.cells[v]=g,this._model.cells[v+jP]=this._cellColorResolver.result.bg,this._model.cells[v+MP]=this._cellColorResolver.result.fg,this._model.cells[v+NP]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*AP,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,AM,0,0),this._model.cells[b]=0,this._model.cells[b+jP]=this._cellColorResolver.result.bg,this._model.cells[b+MP]=this._cellColorResolver.result.fg,this._model.cells[b+NP]=this._cellColorResolver.result.ext;y--}}D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},tI=class extends kN{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function nI(e,t,n=0){return Math.max(Math.min(e,t),n)}var rI=`di$target`,iI=`di$dependencies`,aI=new Map;function oI(e){if(aI.has(e))return aI.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);sI(t,e,r)};return t._id=e,aI.set(e,t),t}function sI(e,t,n){t[rI]===t?t[iI].push({id:e,index:n}):(t[iI]=[{id:e,index:n}],t[rI]=t)}oI(`BufferService`),oI(`CoreMouseService`),oI(`CoreService`),oI(`CharsetService`),oI(`InstantiationService`),oI(`LogService`);var cI=oI(`OptionsService`);oI(`OscLinkService`),oI(`UnicodeService`),oI(`DecorationService`);var lI={trace:0,debug:1,info:2,warn:3,error:4,off:5},uI=`xterm.js: `,dI=class extends xM{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),fI=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=lI[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:uI)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};dI=eM([tM(0,cI)],dI);var fI,pI=class extends xM{constructor(e){if(OM&&kM()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new KN),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new KN),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new KN),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new KN),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new eI(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(PN.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(PN.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(PN.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(PN.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(vM(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},mI=Object.defineProperty,hI=Object.getOwnPropertyDescriptor,gI=(e,t)=>{for(var n in t)mI(e,n,{get:t[n],enumerable:!0})},_I=(e,t,n,r)=>{for(var i=r>1?void 0:r?hI(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&mI(t,n,i),i},Z=(e,t)=>(n,r)=>t(n,r,e),vI=`Terminal input`,yI={get:()=>vI,set:e=>vI=e},bI=`Too much output to announce, navigate to rows manually to read`,xI={get:()=>bI,set:e=>bI=e};function SI(e){return e.replace(/\r?\n/g,`\r`)}function CI(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function wI(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function TI(e,t,n,r){e.stopPropagation(),e.clipboardData&&EI(e.clipboardData.getData(`text/plain`),t,n,r)}function EI(e,t,n,r){e=SI(e),e=CI(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function DI(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function OI(e,t,n,r,i){DI(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function kI(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function AI(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var jI=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},MI=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},NI=``,PI=` `,FI=class e{constructor(){this.fg=0,this.bg=0,this.extended=new II}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},II=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},LI=class e extends FI{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new II,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?kI(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},RI=`di$target`,zI=`di$dependencies`,BI=new Map;function VI(e){return e[zI]||[]}function HI(e){if(BI.has(e))return BI.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);UI(t,e,r)};return t._id=e,BI.set(e,t),t}function UI(e,t,n){t[RI]===t?t[zI].push({id:e,index:n}):(t[zI]=[{id:e,index:n}],t[RI]=t)}var WI=HI(`BufferService`),GI=HI(`CoreMouseService`),KI=HI(`CoreService`),qI=HI(`CharsetService`),JI=HI(`InstantiationService`),YI=HI(`LogService`),XI=HI(`OptionsService`),ZI=HI(`OscLinkService`),QI=HI(`UnicodeService`),$I=HI(`DecorationService`),eL=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new LI,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):tL(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};eL=_I([Z(0,WI),Z(1,XI),Z(2,ZI)],eL);function tL(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
126
|
+
|
|
127
|
+
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var nL=HI(`CharSizeService`),rL=HI(`CoreBrowserService`),iL=HI(`MouseService`),aL=HI(`RenderService`),oL=HI(`SelectionService`),sL=HI(`CharacterJoinerService`),cL=HI(`ThemeService`),lL=HI(`LinkProviderService`),uL=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?gL.isErrorNoTelemetry(e)?new gL(e.message+`
|
|
128
|
+
|
|
129
|
+
`+e.stack):Error(e.message+`
|
|
130
|
+
|
|
131
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function dL(e){pL(e)||uL.onUnexpectedError(e)}var fL=`Canceled`;function pL(e){return e instanceof mL||e instanceof Error&&e.name===fL&&e.message===fL}var mL=class extends Error{constructor(){super(fL),this.name=this.message}};function hL(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var gL=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},_L=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function vL(e,t=0){return e[e.length-(1+t)]}var yL;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(yL||={});var bL=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||yL.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};bL.empty=new bL(e=>{});function xL(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var SL;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(SL||={});var CL=null;function wL(e){return CL?.trackDisposable(e),e}function TL(e){CL?.markAsDisposed(e)}function EL(e,t){CL?.setParent(e,t)}function DL(e){return CL?.markAsSingleton(e),e}function OL(e){if(SL.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function kL(...e){return AL(()=>OL(e))}function AL(e){let t=wL({dispose:xL(()=>{TL(t),e()})});return t}var jL=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,wL(this)}dispose(){this._isDisposed||(TL(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{OL(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return EL(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),EL(e,null))}};jL.DISABLE_DISPOSED_WARNING=!1;var ML=jL,NL=class{constructor(){this._store=new ML,wL(this),EL(this._store,this)}dispose(){TL(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};NL.None=Object.freeze({dispose(){}});var PL=class{constructor(){this._isDisposed=!1,wL(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&EL(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,TL(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&EL(e,null),e}},FL=typeof window==`object`?window:globalThis,IL=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};IL.Undefined=new IL(void 0);var LL=IL,RL=class{constructor(){this._first=LL.Undefined,this._last=LL.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===LL.Undefined}clear(){let e=this._first;for(;e!==LL.Undefined;){let t=e.next;e.prev=LL.Undefined,e.next=LL.Undefined,e=t}this._first=LL.Undefined,this._last=LL.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new LL(e);if(this._first===LL.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==LL.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==LL.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==LL.Undefined&&e.next!==LL.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===LL.Undefined&&e.next===LL.Undefined?(this._first=LL.Undefined,this._last=LL.Undefined):e.next===LL.Undefined?(this._last=this._last.prev,this._last.next=LL.Undefined):e.prev===LL.Undefined&&(this._first=this._first.next,this._first.prev=LL.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==LL.Undefined;)yield e.element,e=e.next}},zL=globalThis.performance&&typeof globalThis.performance.now==`function`,BL=class e{static create(t){return new e(t)}constructor(e){this._now=zL&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},VL;(e=>{e.None=()=>NL.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(kL(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new Q({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new Q({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Q({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new Q;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Q(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof ML?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(VL||={});var HL=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new BL,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};HL.all=new Set,HL._idPool=0;var UL=HL,WL=-1,GL=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new JL(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};GL._idPool=1;var KL=GL,qL=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
132
|
+
`).slice(2).join(`
|
|
133
|
+
`))}},JL=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},YL=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},XL=0,ZL=class{constructor(e){this.value=e,this.id=XL++}},QL=2,Q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=WL>0||this._options?.leakWarningThreshold?new KL(e?.onListenerError??dL,this._options?.leakWarningThreshold??WL):void 0,this._perfMon=this._options?._profName?new UL(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new YL(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||dL)(n),NL.None}if(this._disposed)return NL.None;t&&(e=e.bind(t));let r=new ZL(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=qL.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ZL?(this._deliveryQueue??=new $L,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=AL(()=>{i?.(),this._removeListener(r)});return n instanceof ML?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*QL<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||dL;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof ZL)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},$L=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},eR=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};eR.INSTANCE=new eR;var tR=eR;function nR(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}tR.INSTANCE.onDidChangeZoomLevel;function rR(e){return tR.INSTANCE.getZoomFactor(e)}tR.INSTANCE.onDidChangeFullscreen;var iR=typeof navigator==`object`?navigator.userAgent:``,aR=iR.indexOf(`Firefox`)>=0,oR=iR.indexOf(`AppleWebKit`)>=0,sR=iR.indexOf(`Chrome`)>=0,cR=!sR&&iR.indexOf(`Safari`)>=0;iR.indexOf(`Electron/`),iR.indexOf(`Android`);var lR=!1;if(typeof FL.matchMedia==`function`){let e=FL.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=FL.matchMedia(`(display-mode: fullscreen)`);lR=e.matches,nR(FL,e,({matches:e})=>{lR&&t.matches||(lR=e)})}function uR(){return lR}var dR=`en`,fR=!1,pR=!1,mR=!1,hR=!1,gR=!1,_R=dR,vR,yR=globalThis,bR;typeof yR.vscode<`u`&&typeof yR.vscode.process<`u`?bR=yR.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(bR=process);var xR=typeof bR?.versions?.electron==`string`&&bR?.type===`renderer`;if(typeof bR==`object`){fR=bR.platform===`win32`,pR=bR.platform===`darwin`,mR=bR.platform===`linux`,mR&&bR.env.SNAP&&bR.env.SNAP_REVISION,bR.env.CI||bR.env.BUILD_ARTIFACTSTAGINGDIRECTORY,_R=dR;let e=bR.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,_R=t.resolvedLanguage||dR,t.languagePack?.translationsConfigFile}catch{}hR=!0}else typeof navigator==`object`&&!xR?(vR=navigator.userAgent,fR=vR.indexOf(`Windows`)>=0,pR=vR.indexOf(`Macintosh`)>=0,(vR.indexOf(`Macintosh`)>=0||vR.indexOf(`iPad`)>=0||vR.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,mR=vR.indexOf(`Linux`)>=0,vR?.indexOf(`Mobi`),gR=!0,_R=globalThis._VSCODE_NLS_LANGUAGE||dR,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var SR=fR,CR=pR,wR=mR,TR=hR;gR&&typeof yR.importScripts==`function`&&yR.origin;var ER=vR,DR=_R,OR;(e=>{function t(){return DR}e.value=t;function n(){return DR.length===2?DR===`en`:DR.length>=3&&DR[0]===`e`&&DR[1]===`n`&&DR[2]===`-`}e.isDefaultVariant=n;function r(){return DR===`en`}e.isDefault=r})(OR||={});var kR=typeof yR.postMessage==`function`&&!yR.importScripts;(()=>{if(kR){let e=[];yR.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),yR.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var AR=!!(ER&&ER.indexOf(`Chrome`)>=0);ER&&ER.indexOf(`Firefox`),!AR&&ER&&ER.indexOf(`Safari`),ER&&ER.indexOf(`Edg/`),ER&&ER.indexOf(`Android`);var jR=typeof navigator==`object`?navigator:{};TR||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||jR&&jR.clipboard&&jR.clipboard.writeText,TR||jR&&jR.clipboard&&jR.clipboard.readText,TR||uR()||jR.keyboard,`ontouchstart`in FL||jR.maxTouchPoints,FL.PointerEvent&&(`ontouchstart`in FL||navigator.maxTouchPoints);var MR=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},NR=new MR,PR=new MR,FR=new MR,IR=Array(230),LR;(e=>{function t(e){return NR.keyCodeToStr(e)}e.toString=t;function n(e){return NR.strToKeyCode(e)}e.fromString=n;function r(e){return PR.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return FR.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return PR.strToKeyCode(e)||FR.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return NR.keyCodeToStr(e)}e.toElectronAccelerator=o})(LR||={});var RR=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new zR([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},zR=class{constructor(e){if(e.length===0)throw hL(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function BR(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return LR.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(aR)switch(t){case 59:return 85;case 60:if(wR)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(CR)return 57}else if(oR&&(CR&&t===93||!CR&&t===92))return 57;return IR[t]||0}var VR=CR?256:2048,HR=512,UR=1024,WR=CR?2048:256,GR=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=BR(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=VR),this.altKey&&(t|=HR),this.shiftKey&&(t|=UR),this.metaKey&&(t|=WR),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new RR(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},KR=new WeakMap;function qR(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var JR=class{static getSameOriginWindowChain(e){let t=KR.get(e);if(!t){t=[],KR.set(e,t);let n=e,r;do r=qR(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},YR=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=JR.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},XR=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(sR){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?aR&&!CR?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=cR&&SR?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?aR&&!CR?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},ZR=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),QR;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof $R?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:VL.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ZR})})(QR||={});var $R=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ZR:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},ez=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new _L(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new _L(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},tz=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new _L(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=AL(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var nz;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(nz||={});var rz=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await VL.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};rz.EMPTY=rz.fromArray([]);function iz(e){return az(e,0)}function az(e,t){switch(typeof e){case`object`:return e===null?oz(349,t):Array.isArray(e)?lz(e,t):uz(e,t);case`string`:return cz(e,t);case`boolean`:return sz(e,t);case`number`:return oz(e,t);case`undefined`:return oz(937,t);default:return oz(617,t)}}function oz(e,t){return(t<<5)-t+e|0}function sz(e,t){return oz(e?433:863,t)}function cz(e,t){t=oz(149417,t);for(let n=0,r=e.length;n<r;n++)t=oz(e.charCodeAt(n),t);return t}function lz(e,t){return t=oz(104579,t),e.reduce((e,t)=>az(t,e),t)}function uz(e,t){return t=oz(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=cz(n,t),az(e[n],t)),t)}var{registerWindow:dz,getWindow:fz,getDocument:pz,getWindows:mz,getWindowsCount:hz,getWindowId:gz,getWindowById:_z,hasWindow:vz,onDidRegisterWindow:yz,onWillUnregisterWindow:bz,onDidUnregisterWindow:xz}=function(){let e=new Map,t={window:FL,disposables:new ML};e.set(FL.vscodeWindowId,t);let n=new Q,r=new Q,i=new Q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return NL.None;let a=new ML,o={window:t,disposables:a.add(new ML)};return e.set(t.vscodeWindowId,o),a.add(AL(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Cz(t,Mz.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:FL},getDocument(e){return fz(e).document}}}(),Sz=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Cz(e,t,n,r){return new Sz(e,t,n,r)}function wz(e,t){return function(n){return t(new YR(e,n))}}function Tz(e){return function(t){return e(new GR(t))}}var Ez=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=wz(fz(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=Tz(n)),Cz(e,t,i,r)},Dz,Oz=class extends tz{constructor(e){super(),this.defaultTarget=e&&fz(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},kz=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){dL(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(kz.sort),a.shift().execute();r.set(i,!1)};Dz=(t,r,a=0)=>{let o=gz(t),s=new kz(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var Az=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Az.None=new Az(0,0);function jz(e){let t=e.getBoundingClientRect(),n=fz(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=iz(n),a=r.get(i);if(a)a.users+=1;else{let o=new Q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(AL(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Mz={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:oR?`webkitAnimationStart`:`animationstart`,ANIMATION_END:oR?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:oR?`webkitAnimationIteration`:`animationiteration`},Nz=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=Pz(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Pz(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Pz(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Pz(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Pz(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Pz(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Pz(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Pz(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Pz(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Pz(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Pz(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Pz(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Pz(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Pz(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Pz(e){return typeof e==`number`?`${e}px`:e}function Fz(e){return new Nz(e)}var Iz=class{constructor(){this._hooks=new ML,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(AL(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=fz(e)}this._hooks.add(Cz(a,Mz.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(Cz(a,Mz.POINTER_UP,e=>this.stopMonitoring(!0)))}};function Lz(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var Rz;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Rz||={});var zz=class e extends NL{constructor(){super(),this.dispatched=!1,this.targets=new RL,this.ignoreTargets=new RL,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(VL.runAndSubscribe(yz,({window:e,disposables:t})=>{t.add(Cz(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(Cz(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(Cz(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:FL,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=DL(new e),AL(e.INSTANCE.targets.push(t))):NL.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=DL(new e),AL(e.INSTANCE.ignoreTargets.push(t))):NL.None}static isTouchDevice(){return`ontouchstart`in FL||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(Rz.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-vL(s.rollingPageX))<30&&Math.abs(s.initialPageY-vL(s.rollingPageY))<30){let e=this.newGestureEvent(Rz.Tap,s.initialTarget);e.pageX=vL(s.rollingPageX),e.pageY=vL(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-vL(s.rollingPageX))<30&&Math.abs(s.initialPageY-vL(s.rollingPageY))<30){let e=this.newGestureEvent(Rz.Contextmenu,s.initialTarget);e.pageX=vL(s.rollingPageX),e.pageY=vL(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=vL(s.rollingPageX),n=vL(s.rollingPageY),i=vL(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(Rz.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===Rz.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Rz.Change||t.type===Rz.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=Dz(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(Rz.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(Rz.Change,i.initialTarget);a.translationX=r.pageX-vL(i.rollingPageX),a.translationY=r.pageY-vL(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};zz.SCROLL_FRICTION=-.005,zz.HOLD_DELAY=700,zz.CLEAR_TAP_COUNT_TIME=400,_I([Lz],zz,`isTouchDevice`,1);var Bz=zz,Vz=class extends NL{onclick(e,t){this._register(Cz(e,Mz.CLICK,n=>t(new YR(fz(e),n))))}onmousedown(e,t){this._register(Cz(e,Mz.MOUSE_DOWN,n=>t(new YR(fz(e),n))))}onmouseover(e,t){this._register(Cz(e,Mz.MOUSE_OVER,n=>t(new YR(fz(e),n))))}onmouseleave(e,t){this._register(Cz(e,Mz.MOUSE_LEAVE,n=>t(new YR(fz(e),n))))}onkeydown(e,t){this._register(Cz(e,Mz.KEY_DOWN,e=>t(new GR(e))))}onkeyup(e,t){this._register(Cz(e,Mz.KEY_UP,e=>t(new GR(e))))}oninput(e,t){this._register(Cz(e,Mz.INPUT,t))}onblur(e,t){this._register(Cz(e,Mz.BLUR,t))}onfocus(e,t){this._register(Cz(e,Mz.FOCUS,t))}onchange(e,t){this._register(Cz(e,Mz.CHANGE,t))}ignoreGesture(e){return Bz.ignoreTarget(e)}},Hz=11,Uz=class extends Vz{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=Hz+`px`,this.domNode.style.height=Hz+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new Iz),this._register(Ez(this.bgDomNode,Mz.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Ez(this.domNode,Mz.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Oz),this._pointerdownScheduleRepeatTimer=this._register(new ez)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,fz(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},Wz=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Gz=class extends NL{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Wz(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Yz(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Yz.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Kz=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function qz(e,t){let n=t-e;return function(t){return e+n*Zz(t)}}function Jz(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Yz=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),Jz(qz(e,r),qz(i,t),.33)}return qz(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new Kz(this.scrollLeft(t),this.scrollTop(t),!1):new Kz(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Xz(e){return e**3}function Zz(e){return 1-Xz(1-e)}var Qz=class extends NL{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new ez)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},$z=140,eB=class extends Vz{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Qz(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Iz),this._shouldRender=!0,this.domNode=Fz(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(Cz(this.domNode.domNode,Mz.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Uz(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Fz(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Cz(this.slider.domNode,Mz.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=jz(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(SR&&a>$z){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},tB=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},nB=class extends eB{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new tB(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},rB=class extends eB{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new tB(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},iB=500,aB=50,oB=!0,sB=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},cB=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(sR){let t=rR(fz(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new sB(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};cB.INSTANCE=new cB;var lB=cB,uB=class extends Vz{constructor(e,t,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=fB(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new rB(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new nB(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Fz(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Fz(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Fz(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new ez),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=OL(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,CR&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new XR(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=OL(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(Cz(this._listenOnDomNode,Mz.MOUSE_WHEEL,e=>{this._onMouseWheel(new XR(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=lB.INSTANCE;oB&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!CR&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=aB*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=aB*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(oB&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),iB)}},dB=class extends uB{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function fB(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,CR&&(t.className+=` mac`),t}var pB=class extends NL{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Gz({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>Dz(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new dB(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(VL.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(AL(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(AL(()=>this._styleElement.remove())),this._register(VL.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
134
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};pB=_I([Z(2,WI),Z(3,rL),Z(4,GI),Z(5,cL),Z(6,XI),Z(7,aL)],pB);var mB=class extends NL{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(AL(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};mB=_I([Z(1,WI),Z(2,rL),Z(3,$I),Z(4,aL)],mB);var hB=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},gB={full:0,left:0,center:0,right:0},_B={full:0,left:0,center:0,right:0},vB={full:0,left:0,center:0,right:0},yB=class extends NL{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new hB,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(AL(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);_B.full=this._canvas.width,_B.left=e,_B.center=t,_B.right=e,this._refreshDrawHeightConstants(),vB.full=1,vB.left=1,vB.center=1+_B.left,vB.right=1+_B.left+_B.center}_refreshDrawHeightConstants(){gB.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);gB.left=t,gB.center=t,gB.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gB.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gB.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gB.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gB.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(vB[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-gB[e.position||`full`]/2),_B[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+gB[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};yB=_I([Z(2,WI),Z(3,$I),Z(4,aL),Z(5,XI),Z(6,cL),Z(7,rL)],yB);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
135
|
+
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var bB;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(bB||={});var xB;(e=>e.ST=`${$.ESC}\\`)(xB||={});var SB=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};SB=_I([Z(2,WI),Z(3,XI),Z(4,KI),Z(5,aL)],SB);var CB=0,wB=0,TB=0,EB=0,DB={css:`#00000000`,rgba:0},OB;(e=>{function t(e,t,n,r){return r===void 0?`#${NB(e)}${NB(t)}${NB(n)}`:`#${NB(e)}${NB(t)}${NB(n)}${NB(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(OB||={});var kB;(e=>{function t(e,t){if(EB=(t.rgba&255)/255,EB===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return CB=a+Math.round((n-a)*EB),wB=o+Math.round((r-o)*EB),TB=s+Math.round((i-s)*EB),{css:OB.toCss(CB,wB,TB),rgba:OB.toRgba(CB,wB,TB)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=MB.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return OB.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[CB,wB,TB]=MB.toChannels(t),{css:OB.toCss(CB,wB,TB),rgba:t}}e.opaque=i;function a(e,t){return EB=Math.round(t*255),[CB,wB,TB]=MB.toChannels(e.rgba),{css:OB.toCss(CB,wB,TB,EB),rgba:OB.toRgba(CB,wB,TB,EB)}}e.opacity=a;function o(e,t){return EB=e.rgba&255,a(e,EB*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(kB||={});var AB;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return CB=parseInt(e.slice(1,2).repeat(2),16),wB=parseInt(e.slice(2,3).repeat(2),16),TB=parseInt(e.slice(3,4).repeat(2),16),OB.toColor(CB,wB,TB);case 5:return CB=parseInt(e.slice(1,2).repeat(2),16),wB=parseInt(e.slice(2,3).repeat(2),16),TB=parseInt(e.slice(3,4).repeat(2),16),EB=parseInt(e.slice(4,5).repeat(2),16),OB.toColor(CB,wB,TB,EB);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return CB=parseInt(r[1]),wB=parseInt(r[2]),TB=parseInt(r[3]),EB=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),OB.toColor(CB,wB,TB,EB);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[CB,wB,TB,EB]=t.getImageData(0,0,1,1).data,EB!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:OB.toRgba(CB,wB,TB,EB),css:e}}e.toColor=r})(AB||={});var jB;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(jB||={});var MB;(e=>{function t(e,t){if(EB=(t&255)/255,EB===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return CB=a+Math.round((n-a)*EB),wB=o+Math.round((r-o)*EB),TB=s+Math.round((i-s)*EB),OB.toRgba(CB,wB,TB)}e.blend=t;function n(e,t,n){let a=jB.relativeLuminance(e>>8),o=jB.relativeLuminance(t>>8);if(PB(a,o)<n){if(o<a){let o=r(e,t,n),s=PB(a,jB.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>PB(a,jB.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=PB(a,jB.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>PB(a,jB.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=PB(jB.relativeLuminance2(o,s,c),jB.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=PB(jB.relativeLuminance2(o,s,c),jB.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=PB(jB.relativeLuminance2(o,s,c),jB.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=PB(jB.relativeLuminance2(o,s,c),jB.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(MB||={});function NB(e){let t=e.toString(16);return t.length<2?`0`+t:t}function PB(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var FB=class extends FI{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},IB=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new LI}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||PI.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)IB._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||PI.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};IB=_I([Z(0,WI)],IB);function LB(e){return 57508<=e&&e<=57558}function RB(e){return 9472<=e&&e<=9631}function zB(e){return LB(e)||RB(e)}function BB(){return{css:{canvas:VB(),cell:VB()},device:{canvas:VB(),cell:VB(),char:{width:0,height:0,left:0,top:0}}}}function VB(){return{width:0,height:0}}var HB=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new LI,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new FB(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let ee=N.getChars()||PI;if(ee===` `&&(N.isUnderline()||N.isOverline())&&(ee=`\xA0`),T=m*s-c.get(ee,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=PI:_+=ee,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?PI:N.getChars()||PI,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault())){if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${FI.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let te=N.getFgColor(),ne=N.getFgColorMode(),re=N.getBgColor(),R=N.getBgColorMode(),ie=!!N.isInverse();if(ie){let e=te;te=re,re=e;let t=ne;ne=R,R=t}let ae,oe,se=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&se||(e.backgroundColorRGB&&(R=50331648,re=e.backgroundColorRGB.rgba>>8&16777215,ae=e.backgroundColorRGB),e.foregroundColorRGB&&(ne=50331648,te=e.foregroundColorRGB.rgba>>8&16777215,oe=e.foregroundColorRGB),se=e.options.layer===`top`)}),!se&&P&&(ae=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,re=ae.rgba>>8&16777215,R=50331648,se=!0,p.selectionForeground&&(ne=50331648,te=p.selectionForeground.rgba>>8&16777215,oe=p.selectionForeground)),se&&D.push(`xterm-decoration-top`);let ce;switch(R){case 16777216:case 33554432:ce=p.ansi[re],D.push(`xterm-bg-${re}`);break;case 50331648:ce=OB.toColor(re>>16,re>>8&255,re&255),this._addStyle(h,`background-color:#${UB((re>>>0).toString(16),`0`,6)}`);break;default:ie?(ce=p.foreground,D.push(`xterm-bg-257`)):ce=p.background}switch(ae||N.isDim()&&(ae=kB.multiplyOpacity(ce,.5)),ne){case 16777216:case 33554432:N.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(h,ce,p.ansi[te],N,ae,void 0)||D.push(`xterm-fg-${te}`);break;case 50331648:let e=OB.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(h,ce,e,N,ae,oe)||this._addStyle(h,`color:#${UB(te.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ce,p.foreground,N,ae,oe)||ie&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||zB(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=kB.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};HB=_I([Z(1,sL),Z(2,XI),Z(3,rL),Z(4,KI),Z(5,$I),Z(6,cL)],HB);function UB(e,t,n){for(;e.length<n;)e=t+e;return e}var WB=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},GB=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function KB(){return new GB}var qB=`xterm-dom-renderer-owner-`,JB=`xterm-rows`,YB=`xterm-fg-`,XB=`xterm-bg-`,ZB=`xterm-focus`,QB=`xterm-selection`,$B=1,eV=class extends NL{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=$B++,this._rowElements=[],this._selectionRenderModel=KB(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(JB),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(QB),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=BB(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(HB,document),this._element.classList.add(qB+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(AL(()=>{this._element.classList.remove(qB+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new WB(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${JB} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${JB} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${JB} .xterm-dim { color: ${kB.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${JB}.${ZB} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${JB}.${ZB} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${JB}.${ZB} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${JB} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${JB} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${JB} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${JB} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${JB} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${QB} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${QB} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${QB} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${YB}${n} { color: ${r.css}; }${this._terminalSelector} .${YB}${n}.xterm-dim { color: ${kB.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${XB}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${YB}257 { color: ${kB.opaque(e.background).css}; }${this._terminalSelector} .${YB}257.xterm-dim { color: ${kB.multiplyOpacity(kB.opaque(e.background),.5).css}; }${this._terminalSelector} .${XB}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(ZB),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ZB),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${qB}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};eV=_I([Z(7,JI),Z(8,nL),Z(9,XI),Z(10,WI),Z(11,KI),Z(12,rL),Z(13,cL)],eV);var tV=class extends NL{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new iV(this._optionsService))}catch{this._measureStrategy=this._register(new rV(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};tV=_I([Z(2,XI)],tV);var nV=class extends NL{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},rV=class extends nV{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},iV=class extends nV{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},aV=class extends NL{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new oV(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(VL.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Cz(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(Cz(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},oV=class extends NL{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new PL),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(AL(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Cz(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},sV=class extends NL{constructor(){super(),this.linkProviders=[],this._register(AL(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function cV(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function lV(e,t,n,r,i,a,o,s,c){if(!a)return;let l=cV(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var uV=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return lV(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=cV(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};uV=_I([Z(0,aL),Z(1,nL)],uV);var dV=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},fV={};gI(fV,{getSafariVersion:()=>yV,isChromeOS:()=>TV,isFirefox:()=>gV,isIpad:()=>xV,isIphone:()=>SV,isLegacyEdge:()=>_V,isLinux:()=>wV,isMac:()=>bV,isNode:()=>pV,isSafari:()=>vV,isWindows:()=>CV});var pV=typeof process<`u`&&`title`in process,mV=pV?`node`:navigator.userAgent,hV=pV?`node`:navigator.platform,gV=mV.includes(`Firefox`),_V=mV.includes(`Edge`),vV=/^((?!chrome|android).)*safari/i.test(mV);function yV(){if(!vV)return 0;let e=mV.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var bV=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(hV),xV=hV===`iPad`,SV=hV===`iPhone`,CV=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(hV),wV=hV.indexOf(`Linux`)>=0,TV=/\bCrOS\b/.test(mV),EV=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},DV=class extends EV{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},OV=class extends EV{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},kV=!pV&&`requestIdleCallback`in window?OV:DV,AV=class{constructor(){this._queue=new kV}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},jV=class extends NL{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new PL),this._pausedResizeTask=new AV,this._observerDisposable=this._register(new PL),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new dV((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new MV(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(AL(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=AL(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};jV=_I([Z(2,XI),Z(3,nL),Z(4,KI),Z(5,$I),Z(6,WI),Z(7,rL),Z(8,cL)],jV);var MV=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function NV(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return IV(i,a,e,t,n,r)+LV(a,t,n,r)+RV(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,GV(Math.abs(i-e),WV(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return GV(FV(a>t?e:i,n)+(s-1)*n.cols+1+PV(a>t?i:e,n),WV(o,r))}function PV(e,t){return e-1}function FV(e,t){return t.cols-e}function IV(e,t,n,r,i,a){return LV(t,r,i,a).length===0?``:GV(UV(e,t,e,t-BV(t,i),!1,i).length,WV(`D`,a))}function LV(e,t,n,r){let i=e-BV(e,n),a=t-BV(t,n);return GV(Math.abs(i-a)-zV(e,t,n),WV(HV(e,t),r))}function RV(e,t,n,r,i,a){let o;o=LV(t,r,i,a).length>0?r-BV(r,i):t;let s=r,c=VV(e,t,n,r,i,a);return GV(UV(e,o,n,s,c===`C`,i).length,WV(c,a))}function zV(e,t,n){let r=0,i=e-BV(e,n),a=t-BV(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=HV(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function BV(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function VV(e,t,n,r,i,a){let o;return o=LV(n,r,i,a).length>0?r-BV(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function HV(e,t){return e>t?`A`:`B`}function UV(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function WV(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function GV(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var KV=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function qV(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var JV=50,YV=15,XV=50,ZV=500,QV=RegExp(`\xA0`,`g`),$V=class extends NL{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new LI,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new KV(this._bufferService),this._activeSelectionMode=0,this._register(AL(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(QV,` `)).join(CV?`\r
|
|
136
|
+
`:`
|
|
137
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),wV&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=qV(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=cV(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-JV),JV),t/=JV,t/Math.abs(t)+Math.round(t*(YV-1)))}shouldForceSelection(e){return bV?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),XV)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(bV&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<ZV&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=NV(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=qV(n,this._bufferService.cols)}};$V=_I([Z(3,WI),Z(4,KI),Z(5,iL),Z(6,XI),Z(7,aL),Z(8,rL)],$V);var eH=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},tH=class{constructor(){this._color=new eH,this._css=new eH}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},nH=Object.freeze((()=>{let e=[AB.toColor(`#2e3436`),AB.toColor(`#cc0000`),AB.toColor(`#4e9a06`),AB.toColor(`#c4a000`),AB.toColor(`#3465a4`),AB.toColor(`#75507b`),AB.toColor(`#06989a`),AB.toColor(`#d3d7cf`),AB.toColor(`#555753`),AB.toColor(`#ef2929`),AB.toColor(`#8ae234`),AB.toColor(`#fce94f`),AB.toColor(`#729fcf`),AB.toColor(`#ad7fa8`),AB.toColor(`#34e2e2`),AB.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:OB.toCss(r,i,a),rgba:OB.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:OB.toCss(n,n,n),rgba:OB.toRgba(n,n,n)})}return e})()),rH=AB.toColor(`#ffffff`),iH=AB.toColor(`#000000`),aH=AB.toColor(`#ffffff`),oH=iH,sH={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},cH=rH,lH=class extends NL{constructor(e){super(),this._optionsService=e,this._contrastCache=new tH,this._halfContrastCache=new tH,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:rH,background:iH,cursor:aH,cursorAccent:oH,selectionForeground:void 0,selectionBackgroundTransparent:sH,selectionBackgroundOpaque:kB.blend(iH,sH),selectionInactiveBackgroundTransparent:sH,selectionInactiveBackgroundOpaque:kB.blend(iH,sH),scrollbarSliderBackground:kB.opacity(rH,.2),scrollbarSliderHoverBackground:kB.opacity(rH,.4),scrollbarSliderActiveBackground:kB.opacity(rH,.5),overviewRulerBorder:rH,ansi:nH.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=uH(e.foreground,rH),t.background=uH(e.background,iH),t.cursor=kB.blend(t.background,uH(e.cursor,aH)),t.cursorAccent=kB.blend(t.background,uH(e.cursorAccent,oH)),t.selectionBackgroundTransparent=uH(e.selectionBackground,sH),t.selectionBackgroundOpaque=kB.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=uH(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=kB.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?uH(e.selectionForeground,DB):void 0,t.selectionForeground===DB&&(t.selectionForeground=void 0),kB.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=kB.opacity(t.selectionBackgroundTransparent,.3)),kB.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=kB.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=uH(e.scrollbarSliderBackground,kB.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=uH(e.scrollbarSliderHoverBackground,kB.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=uH(e.scrollbarSliderActiveBackground,kB.opacity(t.foreground,.5)),t.overviewRulerBorder=uH(e.overviewRulerBorder,cH),t.ansi=nH.slice(),t.ansi[0]=uH(e.black,nH[0]),t.ansi[1]=uH(e.red,nH[1]),t.ansi[2]=uH(e.green,nH[2]),t.ansi[3]=uH(e.yellow,nH[3]),t.ansi[4]=uH(e.blue,nH[4]),t.ansi[5]=uH(e.magenta,nH[5]),t.ansi[6]=uH(e.cyan,nH[6]),t.ansi[7]=uH(e.white,nH[7]),t.ansi[8]=uH(e.brightBlack,nH[8]),t.ansi[9]=uH(e.brightRed,nH[9]),t.ansi[10]=uH(e.brightGreen,nH[10]),t.ansi[11]=uH(e.brightYellow,nH[11]),t.ansi[12]=uH(e.brightBlue,nH[12]),t.ansi[13]=uH(e.brightMagenta,nH[13]),t.ansi[14]=uH(e.brightCyan,nH[14]),t.ansi[15]=uH(e.brightWhite,nH[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=uH(e.extendedAnsi[r],nH[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};lH=_I([Z(0,XI)],lH);function uH(e,t){if(e!==void 0)try{return AB.toColor(e)}catch{}return t}var dH=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},fH=class{constructor(){this._services=new dH,this._services.set(JI,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=VI(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},pH={trace:0,debug:1,info:2,warn:3,error:4,off:5},mH=`xterm.js: `,hH=class extends NL{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),gH=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=pH[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:mH)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};hH=_I([Z(0,XI)],hH);var gH,_H=class extends NL{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},vH=3,yH=Object.freeze(new FI),bH=0,xH=2,SH=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*vH);let r=t||LI.fromCharData([0,NI,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*vH+0],n=t&2097151;return[this._data[e*vH+1],t&2097152?this._combined[e]:n?kI(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*vH+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*vH+0]=e|2097152|t[2]<<22):this._data[e*vH+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*vH+0]>>22}hasWidth(e){return this._data[e*vH+0]&12582912}getFg(e){return this._data[e*vH+1]}getBg(e){return this._data[e*vH+2]}hasContent(e){return this._data[e*vH+0]&4194303}getCodePoint(e){let t=this._data[e*vH+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*vH+0]&2097152}getString(e){let t=this._data[e*vH+0];return t&2097152?this._combined[e]:t&2097151?kI(t&2097151):``}isProtected(e){return this._data[e*vH+2]&536870912}loadCell(e,t){return bH=e*vH,t.content=this._data[bH+0],t.fg=this._data[bH+1],t.bg=this._data[bH+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*vH+0]=t.content,this._data[e*vH+1]=t.fg,this._data[e*vH+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*vH+0]=t|n<<22,this._data[e*vH+1]=r.fg,this._data[e*vH+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*vH+0];r&2097152?this._combined[e]+=kI(t):r&2097151?(this._combined[e]=kI(r&2097151)+kI(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*vH+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new LI;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new LI;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*xH<this._data.buffer.byteLength;let n=e*vH;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*xH<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*xH<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*vH+0]&4194303)return e+(this._data[e*vH+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*vH+0]&4194303||this._data[e*vH+2]&50331648)return e+(this._data[e*vH+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<vH;e++)this._data[(n+i)*vH+e]=a[(t+i)*vH+e];a[(t+i)*vH+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<vH;e++)this._data[(n+i)*vH+e]=a[(t+i)*vH+e];a[(t+i)*vH+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*vH+0],n=e&2097151,a=e&2097152?this._combined[t]:n?kI(n):PI;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function CH(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=DH(u,d,t),p=1,m=0;for(;p<u.length;){let e=DH(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function wH(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function TH(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function EH(e,t,n){let r=[],i=e.map((n,r)=>DH(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=DH(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function DH(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var OH=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),OL(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};OH._nextId=1;var kH=OH,AH={},jH=AH.B;AH[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:``,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},AH.A={"#":`£`},AH.B=void 0,AH[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},AH.C=AH[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},AH.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},AH.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},AH.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},AH.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},AH.E=AH[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},AH.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},AH.H=AH[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},AH[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var MH=4294967295,NH=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=yH.clone(),this.savedCharset=jH,this.markers=[],this._nullCell=LI.fromCharData([0,NI,1,0]),this._whitespaceCell=LI.fromCharData([0,PI,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new kV,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _H(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new II),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new II),this._whitespaceCell}getBlankLine(e,t){return new SH(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>MH?MH:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=yH);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _H(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(yH),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new SH(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new SH(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=CH(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(yH),n);if(r.length>0){let n=wH(this.lines,r);TH(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(yH),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new SH(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(yH),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=EH(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(yH,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=DH(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new kH(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},PH=class extends NL{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new NH(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new NH(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},FH=2,IH=1,LH=class extends NL{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,FH),this.rows=Math.max(e.rawOptions.rows||0,IH),this.buffers=this._register(new PH(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};LH=_I([Z(0,XI)],LH);var RH={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:bV,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},zH=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],BH=class extends NL{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...RH};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(AL(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in RH))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in RH))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=RH[e],!VH(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=RH[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=zH.includes(t)?t:RH[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function VH(e){return e===`block`||e===`underline`||e===`bar`}function HH(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&HH(e[r],t-1);return n}var UH=Object.freeze({insertMode:!1}),WH=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),GH=class extends NL{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=HH(UH),this.decPrivateModes=HH(WH)}reset(){this.modes=HH(UH),this.decPrivateModes=HH(WH)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};GH=_I([Z(0,WI),Z(1,YI),Z(2,XI)],GH);var KH={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function qH(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var JH=String.fromCharCode,YH={DEFAULT:e=>{let t=[qH(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${JH(t[0])}${JH(t[1])}${JH(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${qH(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${qH(e,!0)};${e.x};${e.y}${t}`}},XH=class extends NL{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(KH))this.addProtocol(e,KH[e]);for(let e of Object.keys(YH))this.addEncoding(e,YH[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};XH=_I([Z(0,WI),Z(1,KI),Z(2,XI)],XH);var ZH=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],QH=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],$H;function eU(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var tU=class{constructor(){if(this.version=`6`,!$H){$H=new Uint8Array(65536),$H.fill(1),$H[0]=0,$H.fill(0,1,32),$H.fill(0,127,160),$H.fill(2,4352,4448),$H[9001]=2,$H[9002]=2,$H.fill(2,11904,42192),$H[12351]=1,$H.fill(2,44032,55204),$H.fill(2,63744,64256),$H.fill(2,65040,65050),$H.fill(2,65072,65136),$H.fill(2,65280,65377),$H.fill(2,65504,65511);for(let e=0;e<ZH.length;++e)$H.fill(0,ZH[e][0],ZH[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?$H[e]:eU(e,QH)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=nU.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return nU.createPropertyValue(0,n,r)}},nU=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new tU;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},rU=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function iU(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var aU=2147483647,oU=256,sU=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>oU)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>aU?aU:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>aU?aU:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,aU):e}},cU=[],lU=class{constructor(){this._state=0,this._active=cU,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=cU}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=cU,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||cU,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,AI(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=cU,this._id=-1,this._state=0}}},uU=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=AI(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},dU=[],fU=class{constructor(){this._handlers=Object.create(null),this._active=dU,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=dU}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=dU,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||dU,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,AI(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=dU,this._ident=0}},pU=new sU;pU.addParam(0);var mU=class{constructor(e){this._handler=e,this._data=``,this._params=pU,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():pU,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=AI(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=pU,this._data=``,this._hitLimit=!1,e));return this._params=pU,this._data=``,this._hitLimit=!1,t}},hU=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},gU=160,_U=function(){let e=new hU(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(gU,0,2,0),e.add(gU,8,5,8),e.add(gU,6,0,6),e.add(gU,11,0,11),e.add(gU,13,13,13),e}(),vU=class extends NL{constructor(e=_U){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new sU,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(AL(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new lU),this._dcsParser=this._register(new fU),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:gU)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<gU){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<gU){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<gU){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<gU){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<gU){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<gU){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},yU=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,bU=/^[\da-f]+$/;function xU(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=yU.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),bU.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function SU(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function CU(e,t=16){let[n,r,i]=e;return`rgb:${SU(n,t)}/${SU(r,t)}/${SU(i,t)}`}var wU={"(":0,")":1,"*":2,"+":3,"-":1,".":2},TU=131072,EU=10;function DU(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var OU=5e3,kU=0,AU=class extends NL{constructor(e,t,n,r,i,a,o,s,c=new vU){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new jI,this._utf8Decoder=new MI,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=yH.clone(),this._eraseAttrDataInternal=yH.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new jU(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(bB.IND,()=>this.index()),this._parser.setExecuteHandler(bB.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(bB.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new uU(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new uU(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new uU(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new uU(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new uU(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new uU(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new uU(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new uU(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new uU(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new uU(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new uU(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new uU(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in AH)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new mU((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),OU))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${OU} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>TU&&(a=this._parseStack.position+TU)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<TU&&(this._parseBuffer=new Uint32Array(Math.min(e.length,TU))),o||this._dirtyRowTracker.clearRange(),e.length>TU)for(let t=a;t<e.length;t+=TU){let a=t+TU<e.length?t+TU:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=nU.extractWidth(t);let n=nU.extractShouldJoin(t),m=n?nU.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(kI(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof SH&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!DU(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new mU(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new uU(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(yH));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=nU.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,jH),this._charsetService.setgCharset(1,jH),this._charsetService.setgCharset(2,jH),this._charsetService.setgCharset(3,jH);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=FI.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=yH.fg,e.bg=yH.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=yH.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=yH.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=yH.fg&16777215,r.bg&=-67108864,r.bg|=yH.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=yH.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!DU(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>EU&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>EU&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(MU(n)){if(r===`?`)t.push({type:0,index:n});else{let e=xU(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=xU(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);MU(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,jH),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(wU[e[0]],AH[e[1]]||jH),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=yH.clone(),this._eraseAttrDataInternal=yH.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new LI;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},jU=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(kU=e,e=t,t=kU),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};jU=_I([Z(0,WI)],jU);function MU(e){return 0<=e&&e<256}var NU=5e7,PU=12,FU=50,IU=class extends NL{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>NU)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=PU?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=PU)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>FU&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},LU=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};LU=_I([Z(0,WI)],LU);var RU=!1,zU=class extends NL{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new PL),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new fH,this.optionsService=this._register(new BH(e)),this._instantiationService.setService(XI,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(LH)),this._instantiationService.setService(WI,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(hH)),this._instantiationService.setService(YI,this._logService),this.coreService=this._register(this._instantiationService.createInstance(GH)),this._instantiationService.setService(KI,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(XH)),this._instantiationService.setService(GI,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(nU)),this._instantiationService.setService(QI,this.unicodeService),this._charsetService=this._instantiationService.createInstance(rU),this._instantiationService.setService(qI,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(LU),this._instantiationService.setService(ZI,this._oscLinkService),this._inputHandler=this._register(new AU(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(VL.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(VL.forward(this._bufferService.onResize,this._onResize)),this._register(VL.forward(this.coreService.onData,this._onData)),this._register(VL.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new IU((e,t)=>this._inputHandler.parse(e,t))),this._register(VL.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!RU&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),RU=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,FH),t=Math.max(t,IH),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(iU.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(iU(this._bufferService),!1))),this._windowsWrappingHeuristics.value=AL(()=>{for(let t of e)t.dispose()})}}},BU={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function VU(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=BU[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var HU=0,UU=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new kV,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new kV,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(HU=this._search(t),HU===-1)||this._getKey(this._array[HU])!==t)return!1;do if(this._array[HU]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(HU),!0;while(++HU<this._array.length&&this._getKey(this._array[HU])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(HU=this._search(e),!(HU<0||HU>=this._array.length)&&this._getKey(this._array[HU])===e))do yield this._array[HU];while(++HU<this._array.length&&this._getKey(this._array[HU])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(HU=this._search(e),!(HU<0||HU>=this._array.length)&&this._getKey(this._array[HU])===e))do t(this._array[HU]);while(++HU<this._array.length&&this._getKey(this._array[HU])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},WU=0,GU=0,KU=class extends NL{constructor(){super(),this._decorations=new UU(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(AL(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new qU(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{WU=t.options.x??0,GU=WU+(t.options.width??1),e>=WU&&e<GU&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},qU=class extends ML{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?AB.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?AB.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},JU=1e3,YU=class{constructor(e,t=JU){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},XU=20,ZU=class extends NL{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new YU(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
138
|
+
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Cz(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(AL(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<XU+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
139
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===XU+1&&(this._liveRegion.textContent+=xI.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};ZU=_I([Z(1,JI),Z(2,rL),Z(3,aL)],ZU);var QU=class extends NL{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(AL(()=>{OL(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Cz(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Cz(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(Cz(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(Cz(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&$U(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,OL(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};QU=_I([Z(1,iL),Z(2,aL),Z(3,WI),Z(4,lL)],QU);function $U(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var eW=class extends zU{constructor(e={}){super(e),this._linkifier=this._register(new PL),this.browser=fV,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new PL),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(KU),this._instantiationService.setService($I,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(sV),this._instantiationService.setService(lL,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(eL)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(VL.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(VL.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(VL.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(VL.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(AL(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=kB.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${CU(r)}${xB.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=OB.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=OB.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ZU,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(Cz(this.element,`copy`,e=>{this.hasSelection()&&wI(e,this._selectionService)}));let e=e=>TI(e,this.textarea,this.coreService,this.optionsService);this._register(Cz(this.textarea,`paste`,e)),this._register(Cz(this.element,`paste`,e)),gV?this._register(Cz(this.element,`mousedown`,e=>{e.button===2&&OI(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Cz(this.element,`contextmenu`,e=>{OI(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),wV&&this._register(Cz(this.element,`auxclick`,e=>{e.button===1&&DI(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Cz(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(Cz(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(Cz(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(Cz(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(Cz(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(Cz(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(Cz(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(Cz(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,yI.get()),TV||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(aV,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(rL,this._coreBrowserService),this._register(Cz(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(Cz(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(tV,this._document,this._helperContainer),this._instantiationService.setService(nL,this._charSizeService),this._themeService=this._instantiationService.createInstance(lH),this._instantiationService.setService(cL,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(IB),this._instantiationService.setService(sL,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(jV,this.rows,this.screenElement)),this._instantiationService.setService(aL,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(SB,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(uV),this._instantiationService.setService(iL,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(QU,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(pB,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance($V,this.element,this.screenElement,r)),this._instantiationService.setService(oL,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(VL.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(mB,this.screenElement)),this._register(Cz(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ZU,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yB,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yB,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(eV,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Cz(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(Cz(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){EI(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=VU(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(tW(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(yH));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`)}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function tW(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var nW=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},rW=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new LI)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},iW=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new rW(t)}getNullCell(){return new LI}},aW=class extends NL{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new iW(this._core.buffers.normal,`normal`),this._alternate=new iW(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},oW=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},sW=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},cW=[`cols`,`rows`],lW=0,uW=class extends NL{constructor(e){super(),this._core=this._register(new eW(e)),this._addonManager=this._register(new nW),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(cW.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new oW(this._core),this._parser}get unicode(){return this._checkProposedApi(),new sW(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new aW(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
140
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return yI.get()},set promptLabel(e){yI.set(e)},get tooMuchOutput(){return xI.get()},set tooMuchOutput(e){xI.set(e)}}}_verifyIntegers(...e){for(lW of e)if(lW===1/0||isNaN(lW)||lW%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(lW of e)if(lW&&(lW===1/0||isNaN(lW)||lW%1!=0||lW<0))throw Error(`This API only accepts positive integers`)}};function dW(e,t){if(typeof document>`u`)return t;try{let n=document.createElement(`span`);n.style.color=`var(${e})`,n.style.position=`absolute`,n.style.opacity=`0`,n.style.pointerEvents=`none`,document.body.appendChild(n);let r=getComputedStyle(n).color;return n.remove(),r||t}catch{return t}}function fW(){let e=dW(`--card`,`#0b0b12`),t=dW(`--foreground`,`#e5e5ef`);return{background:e,foreground:t,cursor:`#a855f7`,cursorAccent:e,selectionBackground:`#9333ea55`,...typeof document<`u`&&document.documentElement.classList.contains(`dark`)?{}:{black:t,white:`#3f3f46`,brightWhite:t,brightBlack:`#a1a1aa`}}}function pW(e,t){e.preventDefault(),window.open(t,`_blank`,`noopener,noreferrer`)}function mW(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t;if(n.t===`opened`){let e=Number.isInteger(n.cols)&&Number.isInteger(n.rows)&&n.cols>0&&n.rows>0?{cols:n.cols,rows:n.rows}:void 0;return{kind:`opened`,...e?{dimensions:e}:{}}}return n.t===`dimensions`&&Number.isInteger(n.cols)&&Number.isInteger(n.rows)&&n.cols>0&&n.rows>0?{kind:`dimensions`,dimensions:{cols:n.cols,rows:n.rows}}:n.t===`error`?{kind:`error`,message:typeof n.message==`string`&&n.message.trim()?n.message:`Terminal bridge error`}:null}function hW(e){return e===1001||e===1006||e===1012||e===1013}function gW(e,t,n){return!e&&t&&n.kind===`closed`&&(n.code===4404||hW(n.code))}function _W(e){if(typeof e==`object`&&e){let t=e.status;if(typeof t==`number`&&t>=500)return!0}let t=e instanceof Error?e.message:String(e);return/failed to fetch|fetch failed|load failed|network\s*error/i.test(t)}var vW=`\x1B[13;2u`;function yW(e){return e.key===`Enter`&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?vW:null}var bW=new TextEncoder,xW=2e4;function SW(e,t,n){return e===0?``:`\x1b[<${e<0?64:65};${t};${n}M`.repeat(Math.abs(e))}function CW(e,t,n,r){if(t.mouseTrackingMode===`none`||!t.sgrEncoding)return{consume:!1,data:``,partial:0};if(e.shiftKey||e.deltaY===0||n===null)return{consume:!1,data:``,partial:r};let i;i=e.deltaMode===1?e.deltaY:e.deltaMode===2?e.deltaY*n.rows:e.deltaY/n.cellHeight;let a=r+i,o=Math.trunc(a),s=Math.max(-50,Math.min(50,o)),c=(e,t)=>Math.min(Math.max(e,1),t);return{consume:!0,data:SW(s,c(Math.floor((e.clientX-n.left)/n.cellWidth)+1,n.cols),c(Math.floor((e.clientY-n.top)/n.cellHeight)+1,n.rows)),partial:s===o?a-o:0}}function wW(e){let t;try{t=new pI}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function TW(e,t){return t?(e.clipboardData?.setData(`text/plain`,t),e.preventDefault(),!0):!1}var EW=class{url;onState;term;fit;webgl;listenerCtl;resizeObserver;ws=null;dataDispose=null;disposed=!1;connectedOnce=!1;connectionGeneration=0;layoutVisible=!1;wheelPartialLines=0;constructor(e,t,n,r=!1){this.url=t,this.onState=n,this.term=new uW({fontFamily:`'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,fontSize:13,scrollback:xW,cursorBlink:!0,theme:fW(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0,disableStdin:!1}),this.fit=new Gj,this.term.loadAddon(this.fit),this.term.loadAddon(new Zj(pW)),this.term.open(e),this.webgl=wW(this.term),this.listenerCtl=new AbortController;let{signal:i}=this.listenerCtl;e.addEventListener(`copy`,e=>TW(e,this.term.getSelection()),{capture:!0,signal:i}),this.onState({kind:`connecting`}),this.resizeObserver=new ResizeObserver(e=>{if(this.disposed)return;let t=e[0]?.contentRect,n=!!t&&t.width>0&&t.height>0;if(this.layoutVisible=n,!this.connectedOnce&&!this.ws){n&&this.connect();return}n&&this.sendResize()}),this.resizeObserver.observe(e)}async connect(){if(this.disposed)return;let e=++this.connectionGeneration;this.connectedOnce=!0;try{this.fit.fit()}catch{this.term.resize(80,24)}let t;try{if(t=typeof this.url==`function`?await this.url({cols:this.term.cols,rows:this.term.rows}):this.url,this.disposed||e!==this.connectionGeneration)return;let n=new URL(t);n.searchParams.set(`cols`,String(this.term.cols)),n.searchParams.set(`rows`,String(this.term.rows)),t=n.toString()}catch(t){if(this.disposed||e!==this.connectionGeneration)return;_W(t)?this.onState({kind:`closed`,code:1006,reason:`Terminal connection temporarily unavailable`}):this.onState({kind:`error`,message:t instanceof Error?t.message:`Could not prepare terminal connection`});return}let n;try{n=new WebSocket(t)}catch(t){if(this.disposed||e!==this.connectionGeneration)return;this.onState({kind:`error`,message:t instanceof Error?t.message:`Could not open terminal connection`});return}n.binaryType=`arraybuffer`,this.ws=n;let r=null;n.addEventListener(`open`,()=>{this.sendResize(),this.term.focus()},{signal:this.listenerCtl.signal}),n.addEventListener(`message`,e=>{if(e.data instanceof ArrayBuffer){this.writeOutput(new Uint8Array(e.data));return}if(typeof e.data!=`string`)return;let t=mW(e.data);t?.kind===`opened`?this.onState({kind:`connected`}):t?.kind===`error`&&(r=t.message,this.onState({kind:`error`,message:t.message}))},{signal:this.listenerCtl.signal}),n.addEventListener(`close`,e=>{this.ws===n&&(this.ws=null,this.dataDispose?.dispose(),this.dataDispose=null,(r===null||e.code!==4500)&&this.onState({kind:`closed`,reason:e.reason||`code ${e.code}`,code:e.code}))},{signal:this.listenerCtl.signal}),n.addEventListener(`error`,()=>{this.ws===n&&this.onState({kind:`error`,message:`Terminal WebSocket error`})},{signal:this.listenerCtl.signal}),this.dataDispose?.dispose(),this.dataDispose=this.term.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(bW.encode(e))}),this.term.attachCustomKeyEventHandler(e=>{let t=yW(e);return t===null||(e.type===`keydown`&&(e.preventDefault(),n.readyState===WebSocket.OPEN&&n.send(bW.encode(t))),!1)}),this.term.attachCustomWheelEventHandler(e=>{let t=CW(e,{mouseTrackingMode:this.term.modes.mouseTrackingMode,sgrEncoding:this.sgrMouseEncodingActive()},this.screenMetrics(),this.wheelPartialLines);return this.wheelPartialLines=t.partial,!t.consume||(t.data&&this.term.input(t.data,!0),e.preventDefault(),!1)})}setTheme(){this.term.options.theme=fW()}focus(){this.term.focus()}dispose(){if(this.disposed)return;this.disposed=!0,this.connectionGeneration+=1,this.listenerCtl.abort(),this.resizeObserver.disconnect(),this.dataDispose?.dispose();let e=this.ws;this.ws=null;try{e?.close()}catch{}this.webgl?.dispose(),this.term.dispose()}writeOutput(e){this.term.write(e)}sgrMouseEncodingActive(){return this.term._core?.coreMouseService?.activeEncoding===`SGR`}screenMetrics(){let{cols:e,rows:t}=this.term,n=this.term.element?.querySelector(`.xterm-screen`)?.getBoundingClientRect();return!n||n.width<=0||n.height<=0||e<=0||t<=0?null:{left:n.left,top:n.top,cellWidth:n.width/e,cellHeight:n.height/t,cols:e,rows:t}}sendResize(){if(!(!this.layoutVisible||!this.ws||this.ws.readyState!==WebSocket.OPEN)){try{this.fit.fit()}catch{return}this.ws.send(JSON.stringify({t:`resize`,cols:this.term.cols,rows:this.term.rows}))}}},DW=[500,1e3,2e3,4e3,8e3];function OW({sessionId:e,runtimeSelector:t,active:n,role:r=`owner`,setup:i}){let[a,o]=(0,u.useState)({kind:`connecting`}),[s,c]=(0,u.useState)(0),[l,d]=(0,u.useState)(!1),[f,p]=(0,u.useState)(!1),[m,h]=(0,u.useState)(null),g=(0,u.useRef)(0),_=(0,u.useRef)(null),v=(0,u.useRef)(null),y=(0,u.useRef)(n),b=`${t}\u0000${e}`,x=(0,u.useRef)(b);x.current=b;let{theme:S}=Hj(),C=(0,u.useCallback)(e=>o(e),[]);(0,u.useEffect)(()=>{v.current?.setTheme()},[S]),(0,u.useEffect)(()=>{h(null),p(!1)},[b]);let w=(0,u.useCallback)(n=>{if(n===null)return;C({kind:`connecting`});let i=null,a=!1;return queueMicrotask(()=>{a||(i=new EW(n,({cols:n,rows:i})=>qx(t,e,{role:r,cols:n,rows:i,refreshCapability:!0}),C,r===`read-only`),v.current=i)}),()=>{a=!0,i?.dispose(),v.current=null}},[e,t,r,C]);(0,u.useEffect)(()=>{if(a.kind===`connected`){_.current=Date.now(),d(!1);return}if(a.kind!==`closed`)return;if(!hW(a.code)){d(!1);return}if(_.current!==null&&Date.now()-_.current>=3e4&&(g.current=0),_.current=null,g.current>=DW.length){d(!1);return}let e=DW[g.current];g.current+=1,d(!0);let t=!1,n=()=>{t||(t=!0,c(e=>e+1))},r=window.setTimeout(n,e),i=()=>{document.visibilityState===`visible`&&n()};return document.addEventListener(`visibilitychange`,i),()=>{window.clearTimeout(r),document.removeEventListener(`visibilitychange`,i)}},[a]);let T=(0,u.useCallback)(()=>{g.current=0,_.current=null,d(!1),c(e=>e+1)},[]);(0,u.useEffect)(()=>{let e=y.current;y.current=n,!e&&n&&v.current?.focus(),gW(e,n,a)&&(g.current=0,_.current=null,d(!1),a.kind===`closed`&&a.code===4404&&C({kind:`probing`}),c(e=>e+1))},[n,a,C]);let E=(0,u.useCallback)(async()=>{if(f)return;let n=b;p(!0),h(null);try{if(await Y.startSessionTerminal(t,e),x.current!==n)return;T()}catch(e){if(x.current!==n)return;h(e instanceof Error?e.message:`Could not start terminal`)}finally{x.current===n&&p(!1)}},[T,t,e,f,b]);return(0,H.jsx)(`div`,{"data-state":a.kind,className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]`,children:(0,H.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden p-1`,children:[(0,H.jsx)(`div`,{ref:w,className:`h-full w-full overflow-hidden`},s),a.kind!==`connected`&&(0,H.jsx)(kW,{state:a,reconnectPending:l,startingTerminal:f,startError:m,onRetry:T,onStartTerminal:()=>void E(),setup:i,readOnly:r===`read-only`})]})})}function kW({state:e,reconnectPending:t,startingTerminal:n,startError:r,onRetry:i,onStartTerminal:a,setup:o,readOnly:s}){return(0,H.jsxs)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-[var(--background)]/85 text-sm text-[var(--foreground)] backdrop-blur-[1px]`,children:[e.kind===`connecting`&&(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),`Connecting…`]}),e.kind===`closed`&&t&&(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),`Reconnecting…`]}),e.kind===`closed`&&!t&&(e.code===4404?(0,H.jsx)(AW,{starting:n,error:r,onStart:a,setup:o,readOnly:s}):(0,H.jsx)(jW,{message:e.reason||`Terminal connection closed`,onRetry:i})),e.kind===`probing`&&(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),`Checking terminal…`]}),e.kind===`error`&&(0,H.jsx)(jW,{message:e.message,onRetry:i})]})}function AW({starting:e,error:t,onStart:n,setup:r,readOnly:i}){let a=r?.target??`Provider`,o=r?.kind===`delivery_unknown`?`Task delivery needs confirmation`:r?.kind===`required`?`${a} needs setup`:`Terminal is not running`,s=r?.kind===`delivery_unknown`?`Rynx could not confirm whether the queued task was accepted. Open the terminal and check its history before retrying.`:r?.kind===`required`?r.taskQueued?`Complete login or first-run setup. The queued task will start automatically when ${a} is ready.`:r.reason??`Complete ${a} login or first-run setup before starting this Session.`:`Start it when you need terminal access for this Session.`,c=r?.kind===`required`?`Open ${a} setup`:`Start terminal`;return(0,H.jsxs)(`div`,{className:`grid max-w-sm place-items-center gap-3 px-6 text-center`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:o}),(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:s})]}),t&&(0,H.jsx)(`span`,{className:`text-[var(--destructive)]`,children:t}),!i&&(0,H.jsxs)(J,{variant:`outline`,size:`sm`,disabled:e,onClick:n,children:[e?(0,H.jsx)(B,{className:`animate-spin`}):(0,H.jsx)(Fr,{}),e?`Opening…`:c]})]})}function jW({message:e,onRetry:t}){return(0,H.jsxs)(`div`,{className:`grid max-w-sm place-items-center gap-3 px-6 text-center`,children:[(0,H.jsx)(`span`,{className:`text-[var(--muted-foreground)]`,children:e}),(0,H.jsxs)(J,{variant:`outline`,size:`sm`,onClick:t,children:[(0,H.jsx)(zr,{}),` Retry`]})]})}function MW(e,t){return`${e}\u0000${t}`}function NW(e,t){return[...e.filter(e=>e.runtimeSelector===t.runtimeSelector&&e.key!==t.key),t].slice(-8)}function PW({selected:e,slot:t,visible:n}){let[r,i]=(0,u.useState)([]),[a,o]=(0,u.useState)(null);(0,u.useEffect)(()=>{e&&i(t=>{let n=t[t.length-1];return n&&FW(n,e)?t:NW(t,e)})},[e]);let s=e?NW(r,e):r;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{ref:o,className:`pointer-events-none invisible absolute inset-0 min-h-0 min-w-0 overflow-hidden`,"aria-hidden":`true`}),s.map(r=>(0,H.jsx)(IW,{entry:r,parkingHost:a,slot:e?.key===r.key?t:null,visible:e?.key===r.key&&n},r.key))]})}function FW(e,t){return e.key===t.key&&e.runtimeSelector===t.runtimeSelector&&e.sessionId===t.sessionId&&e.readOnly===t.readOnly&&e.setup?.kind===t.setup?.kind&&e.setup?.target===t.setup?.target&&(e.setup?.kind!==`required`||t.setup?.kind!==`required`||e.setup.taskQueued===t.setup.taskQueued&&e.setup.reason===t.setup.reason)}function IW({entry:e,parkingHost:t,slot:n,visible:r}){let i=(0,u.useRef)(null);if(i.current===null&&typeof document<`u`){let t=document.createElement(`div`);t.className=`flex h-full min-h-0 w-full min-w-0 flex-col`,t.dataset.warmTerminal=e.key,i.current=t}(0,u.useLayoutEffect)(()=>{let e=i.current,r=n??t;if(!(!e||!r))return r.appendChild(e),()=>e.remove()},[t,n]);let a=i.current;return a?(0,d.createPortal)((0,H.jsx)(OW,{sessionId:e.sessionId,runtimeSelector:e.runtimeSelector,active:r,role:e.readOnly?`read-only`:`owner`,setup:e.setup}),a,e.key):null}function LW(){let e=Rx(),t=e?.access===`read_only`,n=e?.scope===`single_session`?e.sessionId:void 0,r=!!n,i=nt(),{sessionId:a}=it(),{runtimeSelector:o,selectedRuntime:s}=xS(),{status:c,operation:l}=kS(),d=YT(c,l),[f,p]=(0,u.useState)([]),[m,h]=(0,u.useState)({providers:[],agents:[]}),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)({permissionPreset:`default`}),[b,x]=(0,u.useState)([]),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(!0),[E,D]=(0,u.useState)(!0),[O,k]=(0,u.useState)(),[A,j]=(0,u.useState)(),[M,N]=(0,u.useState)(),[P,F]=(0,u.useState)(!0),[I,L]=(0,u.useState)(!1),[ee,te]=(0,u.useState)(!1),[ne,re]=(0,u.useState)(null),[R,ie]=(0,u.useState)(null),[ae,oe]=(0,u.useState)(!1),[se,ce]=(0,u.useState)(),[le,ue]=(0,u.useState)(),de=(0,u.useRef)(!1),fe=(0,u.useRef)(0),pe=(0,u.useRef)(0),me=(0,u.useRef)(0),he=(0,u.useRef)(0),ge=(0,u.useRef)(void 0),_e=(0,u.useRef)(o),ve=(0,u.useRef)(o),ye=(0,u.useRef)(d);ye.current=d;let be=(0,u.useRef)({selector:o});be.current.selector!==o&&(be.current={selector:o});let xe=be.current,Se=n??a??null,Ce=(0,u.useRef)(Se);(0,u.useEffect)(()=>{!n||a===n||i(zx(Ax(o,n)),{replace:!0})},[i,o,a,n]),(0,u.useEffect)(()=>()=>{he.current+=1},[]),(0,u.useEffect)(()=>{Ce.current!==Se&&(Ce.current=Se,he.current+=1)},[Se]);let we=(0,u.useCallback)(async(e=!1)=>{if(ye.current)return;let t=++fe.current;e&&F(!0);try{let e=await Y.listSessions(o);if(fe.current!==t)return;_e.current=o,p(e),N(void 0)}catch(e){if(fe.current!==t||ye.current)return;N(`Could not load sessions: ${e.message}`)}finally{fe.current===t&&F(!1)}},[o]);(0,u.useEffect)(()=>{ve.current!==o&&(ve.current=o,ge.current=void 0,me.current+=1,fe.current+=1,p([]),x([]),C(null),j(void 0),D(!0),N(void 0),F(!0))},[o]);let Te=(0,u.useCallback)(async()=>{if(e){x([]),C(null),j(void 0),D(!1);return}if(ye.current)return;let t=++me.current;D(!0),j(void 0);try{let e=await Y.listProjects(o);if(me.current!==t)return;x(e),C(t=>t&&e.some(e=>e.id===t)?t:null)}catch(e){if(me.current!==t||ye.current)return;x([]),C(null),j(`Could not load projects: ${e.message}`)}finally{me.current===t&&D(!1)}},[e,t,o]);(0,u.useEffect)(()=>{if(d){fe.current+=1,N(void 0),F(!1);return}we(!0);let e=setInterval(()=>void we(),4e3);return()=>clearInterval(e)},[we,d]);let Ee=(0,u.useCallback)(async()=>{if(e){h({providers:[],agents:[]}),_(null),k(void 0),T(!1);return}if(ye.current)return;let t=++pe.current;T(!0),k(void 0);try{let e;try{e=await Y.listSessionLaunchOptions(o)}catch(t){if(!(t instanceof Hx)||t.code!==`incompatible`&&t.code!==`method_not_found`)throw t;e=cE(await Y.listSessionAgentOptions(o))}if(pe.current!==t)return;let n=nE(o,typeof window>`u`?void 0:window.localStorage),r=tE(e,n);h(e),_(r),y(oE(r,e))}catch(e){if(pe.current!==t||ye.current)return;h({providers:[],agents:[]}),_(null),y({permissionPreset:`default`}),k(`Could not load launch options: ${e.message}`)}finally{pe.current===t&&T(!1)}},[e,t,o]);(0,u.useEffect)(()=>{if(d){pe.current+=1,k(void 0),T(!1);return}return h({providers:[],agents:[]}),_(null),y({permissionPreset:`default`}),T(!0),k(void 0),te(!1),ce(void 0),ue(void 0),Ee(),()=>{pe.current+=1}},[Ee,d]),(0,u.useEffect)(()=>{if(d){me.current+=1,j(void 0),D(!1);return}return x([]),C(null),D(!0),j(void 0),Te(),()=>{me.current+=1}},[Te,d]);let De=(0,u.useCallback)(async e=>{if(de.current)return!1;let t=e.text,n=g;if(!n)return k(`Choose a provider or Agent before starting.`),!1;let r=dE(n,m);if(!r)return k(`Choose a provider or Agent before starting.`),!1;let a=!r.ready&&r.readiness!==`unverified`;if(a&&e.attachments.length>0)return k(`${r.name} must finish login or first-run setup before starting with files.`),!1;let o=be.current,c=s.displayName,l=++he.current,u=sE(t||e.attachments[0]?.file.name||`File`),d;de.current=!0,oe(!0),k(void 0);try{let s=ge.current,f=s&&s.selector===o.selector&&s.selection.kind===n.kind&&s.selection.id===n.id&&s.projectId===S&&s.configuration.model===v.model&&s.configuration.reasoningEffort===v.reasoningEffort&&s.configuration.permissionPreset===v.permissionPreset?s.sessionId:(await Y.createSession(aE(n,u,S??void 0,v),o.selector)).sessionId;if(d=f,ge.current={selector:o.selector,selection:n,projectId:S,configuration:{...v},sessionId:f},!a&&e.attachments.length===0){let e=new Date().toISOString(),r=n.kind===`agent`?m.agents.find(e=>e.id===n.id)?.runtime:void 0,a=n.kind===`provider`?n.id:RW(r)?r:void 0,s={id:f,...a?{provider:a}:{},title:u,status:`running`,createdAt:e,updatedAt:e,source:`console`};return _e.current=o.selector,p(e=>[s,...e.filter(e=>e.id!==f)]),ue({sessionId:f,message:t,started:!1}),te(!1),ge.current=void 0,i(zx(Ax(o.selector,f))),!0}let h,g=!1,_=!1;if(a)try{await Y.enqueueSessionMessage(o.selector,f,t),g=!0}catch(e){h=e}else try{if(!(await Y.getSessionResourcePolicy(o.selector,f)).enabled)throw new Hx(`Session file resources are unavailable on this Runtime`,409,`failed_precondition`,`not_started`);let n=await Promise.all(e.attachments.map(e=>Y.uploadSessionResource(o.selector,f,e.file,e.clientUploadId,e.type)));_=!0,await Y.sendSessionMessage(f,{content:[...n.map(e=>e.type===`input_image`?{type:e.type,resourceId:e.resourceId,mediaType:e.mediaType,filename:e.filename,byteLength:e.byteLength,width:e.width,height:e.height}:{type:e.type,resourceId:e.resourceId,mediaType:e.mediaType,filename:e.filename,byteLength:e.byteLength}),...t?[{type:`input_text`,text:t}]:[]],clientMessageId:e.clientMessageId},()=>{},void 0,o.selector)}catch(e){h=e}let y=!!(!g&&(e.attachments.length>0&&!_&&h||Ux(h)));if(be.current!==o)return ge.current=void 0,h?y?V.error(`Session created on ${c}, but the first message was not sent: ${h.message}`):V.warning(`Session created on ${c}, but message delivery is unknown. Check its history before retrying.`):V.success(`Session started on ${c}; switch back to view it.`),!0;if(he.current!==l)return ge.current=void 0,h?y?V.error(`Session created on ${c}, but the first message was not sent. Open it to retry.`):V.warning(`Session created on ${c}, but message delivery is unknown. Check its history before retrying.`):V.success(`Session started on ${c} in the background.`),!0;if(e.attachments.length>0&&y)return k(`Session created, but the first file message was not sent: ${h.message}. Retry will reuse this Session.`),we(),!1;let b=new Date().toISOString(),x={id:f,...n.kind===`provider`?{provider:n.id}:{agent:n.id},title:u,status:y?`idle`:`running`,createdAt:b,updatedAt:b,source:`console`,...g?{setupStatus:`waiting_for_provider`}:{}};return _e.current=o.selector,p(e=>[x,...e.filter(e=>e.id!==f)]),ce(y?{sessionId:f,message:t}:void 0),te(!1),ge.current=void 0,i(zx(g?`${Ax(o.selector,f)}?view=terminal`:Ax(o.selector,f))),we(),g?V.info(`${r.name} needs setup. The task is queued and will start automatically when the Provider is ready.`):h&&(y?V.error(`Session created, but the first message was not sent: ${h.message}`):V.warning(`Session created, but message delivery is unknown. Check its history before retrying.`)),!0}catch(e){let t=e instanceof Hx&&e.outcome===`unknown`,n=d?`Session created, but its first message was not sent: ${e.message}. Retry will reuse this Session.`:t?`Session creation outcome is unknown. Check the Session list before retrying.`:`Could not start session: ${e.message}`;return be.current===o&&he.current===l?k(n):t?V.warning(`Session creation on ${c} may have succeeded. Check its Session list before retrying.`):V.error(`Could not start Session on ${c}: ${e.message}`),!d&&t?(ge.current=void 0,!0):!1}finally{de.current=!1,oe(!1)}},[m,v,g,i,S,we,s.displayName]),Oe=_e.current===o?f:[],ke=Oe.find(e=>e.id===Se)??null,Ae=ke?dE(ke.provider?{kind:`provider`,id:ke.provider}:ke.agent?{kind:`agent`,id:ke.agent}:null,m):null,je=ke?.setupStatus===`delivery_unknown`?{kind:`delivery_unknown`,target:Ae?.name??(ke.provider?uE(ke.provider):ke.agent)}:ke&&(ke.setupStatus===`waiting_for_provider`||Ae?.ready===!1)?{kind:`required`,target:Ae?.name??(ke.provider?uE(ke.provider):ke.agent),taskQueued:ke.setupStatus===`waiting_for_provider`,...Ae?.reason?{reason:Ae.reason}:{}}:void 0;(0,u.useEffect)(()=>{se?.sessionId===ke?.id&&ce(void 0)},[se,ke?.id]);let Me=ke&&!r?(0,H.jsxs)(`div`,{className:X(`flex shrink-0 items-center gap-1`,I&&`desktop-macos-titlebar-leading-inset`),children:[(0,H.jsx)(J,{variant:`ghost`,size:`icon`,className:`size-10 md:hidden`,title:`Back to sessions`,"aria-label":`Back to sessions`,onClick:()=>{te(!0),i(zx(jx(o)),{replace:!0})},children:(0,H.jsx)(An,{})}),I&&(0,H.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`-ml-1 hidden md:inline-flex`,title:`Show session list`,"aria-label":`Show session list`,onClick:()=>L(!1),children:(0,H.jsx)(Ar,{className:`size-3.5`})})]}):void 0,Ne=(0,u.useCallback)((e,t)=>{ie(n=>t?e:n===e?null:n)},[]),Pe=ke?{key:MW(o,ke.id),runtimeSelector:o,sessionId:ke.id,readOnly:!!t,setup:je}:null;return(0,H.jsxs)(`div`,{className:X(`grid h-full min-h-0 min-w-0 bg-[var(--background)]`,r||I?`grid-cols-[minmax(0,1fr)]`:`md:grid-cols-[14rem_minmax(0,1fr)]`),children:[!r&&!I&&(0,H.jsx)(`div`,{className:X(`min-h-0 min-w-0 border-r border-[var(--border)]`,(!ee||ke)&&`hidden md:block`),children:(0,H.jsx)(Aj,{sessions:Oe,runtimeSelector:o,runtimeLabel:s.displayName,listError:M,loading:P,selectedId:Se,readOnly:!!e,onCollapsedChange:L,onSelect:e=>{he.current+=1,ge.current=void 0,te(!1),ce(void 0),i(zx(Ax(o,e)))},onNew:()=>{he.current+=1,ge.current=void 0,te(!1),ce(void 0),ue(void 0),i(zx(jx(o)))},onRetry:()=>void we(!0),onFork:async e=>{try{let t=await Y.forkSession(o,e,{operationId:`web_${crypto.randomUUID()}`});if(be.current!==xe)return;await we(),te(!1),i(zx(Ax(o,t.sessionId))),V.success(`Session forked`)}catch(e){V.error(`Fork session failed: ${e instanceof Error?e.message:String(e)}`)}},onDeleted:e=>{be.current===xe&&(Se===e&&i(zx(jx(o)),{replace:!0}),we())}},o)}),(0,H.jsxs)(`div`,{className:`relative min-h-0 min-w-0 overflow-hidden`,children:[ke?(0,H.jsx)(Cj,{session:ke,runtimeSelector:o,readOnly:t,leadingControls:Me,initialDraft:se?.sessionId===ke.id?se.message:void 0,initialMessage:le?.sessionId===ke.id?le.message:void 0,sendInitialMessage:le?.sessionId===ke.id&&!le.started,onInitialMessageStarted:()=>{ue(e=>e?.sessionId===ke.id?{...e,started:!0}:e)},onInitialMessageConsumed:()=>{ue(e=>e?.sessionId===ke.id?void 0:e)},onInitialMessageFailed:e=>{ue(e=>e?.sessionId===ke.id?void 0:e),ce({sessionId:ke.id,message:e})},terminalSlotRef:re,onTerminalActiveChange:Ne},`${o}:${ke.id}`):Se&&P?(0,H.jsx)(`div`,{className:`grid h-full min-h-0 min-w-0 place-items-center`,role:`status`,"aria-live":`polite`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-[var(--muted-foreground)]`,children:[(0,H.jsx)(B,{className:`size-4 animate-spin`}),` Loading session…`]})}):e?(0,H.jsx)(`div`,{className:`grid h-full min-h-0 min-w-0 place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]`,children:Se?`Session not found.`:`Choose a Session from the list.`}):(0,H.jsx)(`div`,{className:X(`h-full min-h-0 min-w-0`,ee&&!I&&`hidden md:block`),children:(0,H.jsx)(Ij,{runtimeLabel:s.displayName,options:m,selection:g,configuration:v,projects:b,projectId:S,loading:w,projectsLoading:E,submitting:ae,error:O??M??(Se?`Session not found. Start a new session or choose another from the list.`:void 0),projectError:A,listCollapsed:I,onShowSessions:()=>{he.current+=1,L(!1),te(!0)},onRetryOptions:()=>{Ee()},onSelectionChange:e=>{ge.current=void 0,_(e),y(t=>oE(e,m,t.permissionPreset)),k(void 0),rE(o,typeof window>`u`?void 0:window.localStorage,e)},onConfigurationChange:e=>{ge.current=void 0,y(e),k(void 0)},onProjectChange:e=>{ge.current=void 0,C(e),k(void 0)},onNewProject:()=>{i(px.projects,{state:{returnTo:jx(o),createProject:!0}})},onSubmit:De},o)}),(0,H.jsx)(PW,{selected:Pe,slot:ne,visible:R===ke?.id})]})]})}function RW(e){return e===`codex`||e===`claude`||e===`traex`}function zW(){let[e,t]=(0,u.useState)(null),[n,r]=(0,u.useState)(``),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(``),[d,f]=(0,u.useState)(``),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)(!1);async function y(){try{let e=await Y.listSkills();t(e),r(t=>e.some(e=>e.name===t)?t:e[0]?.name??``)}catch(e){t([]),V.error(`Failed to load Skills: ${e.message}`)}}(0,u.useEffect)(()=>{y()},[]),(0,u.useEffect)(()=>{if(!n){a(null);return}let e=!1;return s(!0),Y.getSkill(n).then(t=>{e||(a(t),l((t.files.find(e=>e.path===`SKILL.md`)??t.files[0])?.path??``))}).catch(t=>!e&&V.error(`Load Skill failed: ${t.message}`)).finally(()=>!e&&s(!1)),()=>{e=!0}},[n]),(0,u.useEffect)(()=>{if(!n||!c){f(``);return}let e=!1;return m(!0),Y.readSkillFile(n,c).then(t=>!e&&f(t.content)).catch(t=>!e&&f(`⚠ ${t.message}`)).finally(()=>!e&&m(!1)),()=>{e=!0}},[c,n]);let b=e?.filter(e=>{let t=e.ref?.install.tool===`skills-cli`?e.ref.install.source:``;return t.includes(`/artifacts/skills/`)||t.includes(`\\artifacts\\skills\\`)}).length??0;return(0,H.jsxs)(`div`,{className:`grid gap-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Skills`}),(0,H.jsxs)(`p`,{className:`mt-1 text-sm text-[var(--muted-foreground)]`,children:[`Local catalog discovered from `,(0,H.jsx)(`code`,{children:`~/.rynx/skills`}),`.`]})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(J,{variant:`outline`,onClick:()=>void y(),children:[(0,H.jsx)(zr,{}),` Refresh`]}),(0,H.jsx)(KS,{onInstalled:e=>{t(e),r(e[0]?.name??``)},triggerLabel:`From URL`,triggerVariant:`outline`}),(0,H.jsxs)(J,{variant:`outline`,onClick:()=>v(!0),children:[(0,H.jsx)(tr,{}),` From ZIP`]}),(0,H.jsxs)(J,{onClick:()=>g(!0),children:[(0,H.jsx)(Dr,{}),` From runtime`]})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(qW,{label:`skills`,value:e?.length??0,detail:`Registered catalog entries`}),(0,H.jsx)(qW,{label:`local imports`,value:b,detail:`Immutable runtime copies`}),(0,H.jsx)(qW,{label:`selectable`,value:e?.filter(e=>e.ref).length??0,detail:`Skills with a valid receipt`})]}),(0,H.jsxs)(`div`,{className:`grid min-h-[640px] gap-4 lg:grid-cols-[320px_minmax(0,1fr)]`,children:[(0,H.jsxs)(fC,{className:`overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[var(--border)] px-4 py-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Skill list`}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--muted-foreground)]`,children:e?.length??0})]}),(0,H.jsxs)(`div`,{className:`grid gap-2 p-2`,children:[e===null&&(0,H.jsx)(`div`,{className:`px-3 py-6 text-sm text-[var(--muted-foreground)]`,children:`Loading Skills…`}),e?.length===0&&(0,H.jsx)(`div`,{className:`rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-sm text-[var(--muted-foreground)]`,children:`No local Skills registered yet.`}),e?.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.name),className:X(`flex w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors`,n===e.name?`border-[var(--primary)] bg-[var(--primary)]/10`:`border-[var(--border)] hover:bg-[var(--muted)]/45`),children:[(0,H.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-amber-500/10 text-amber-600`,children:(0,H.jsx)(nr,{className:`size-4`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold`,children:e.name}),n===e.name&&(0,H.jsx)(Ln,{className:`size-4 shrink-0 text-[var(--primary)]`})]}),(0,H.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-[var(--muted-foreground)]`,children:e.description}),(0,H.jsx)(`span`,{className:`mt-2 inline-block rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]`,children:e.ref?WW(e):`receipt-less`})]})]},e.name))]})]}),(0,H.jsx)(VW,{detail:i,loading:o,activeFile:c,onSelectFile:l,fileContent:d,fileLoading:p,onDeleted:y})]}),(0,H.jsx)(HW,{open:h,onOpenChange:g,onImported:async e=>{await y(),e&&r(e)}}),(0,H.jsx)(BW,{open:_,onOpenChange:v,onImported:async e=>{await y(),e&&r(e)}})]})}function BW({open:e,onOpenChange:t,onImported:n}){let[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)([]),l=r&&(!r.name.toLowerCase().endsWith(`.zip`)||r.size>20971520);async function d(){if(!(!r||l)){o(!0),c([]);try{let e=await Y.importSkillArchive(r.name,await KW(r));c(e);let t=e.find(e=>e.status===`created`||e.status===`updated`)?.name;await n(t)}catch(e){V.error(`Import ZIP failed: ${e.message}`)}finally{o(!1)}}}return(0,H.jsx)(Su,{open:e,onOpenChange:e=>{t(e),e||(i(null),c([]))},children:(0,H.jsxs)(Du,{className:`sm:max-w-xl`,children:[(0,H.jsx)(Ou,{children:(0,H.jsx)(Au,{children:`Import Skills from ZIP`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`label`,{className:`grid cursor-pointer place-items-center gap-2 rounded-lg border border-dashed border-[var(--border)] px-4 py-8 text-center hover:bg-[var(--muted)]/30`,children:[(0,H.jsx)(`input`,{type:`file`,accept:`.zip,application/zip`,className:`sr-only`,onChange:e=>{i(e.target.files?.[0]??null),c([])}}),(0,H.jsx)(tr,{className:`size-6 text-[var(--primary)]`}),(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:r?.name??`Choose a .zip archive`}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--muted-foreground)]`,children:`One Skill at the root or multiple Skill directories, up to 20 MB.`})]}),l&&(0,H.jsx)(`div`,{className:`text-xs text-[var(--destructive)]`,children:`Choose a .zip archive no larger than 20 MB.`}),s.length>0&&(0,H.jsx)(GW,{results:s})]}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:`Done`}),(0,H.jsx)(J,{disabled:!r||!!l||a,onClick:()=>void d(),children:a?`Importing…`:`Import`})]})]})})}function VW({detail:e,loading:t,activeFile:n,onSelectFile:r,fileContent:i,fileLoading:a,onDeleted:o}){if(t||!e)return(0,H.jsx)(fC,{className:`p-6 text-sm text-[var(--muted-foreground)]`,children:t?`Loading Skill…`:`Select a Skill to inspect its files.`});let s=mk(e.ref?.install);return(0,H.jsxs)(fC,{className:`overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-[var(--border)] px-5 py-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`font-mono text-lg font-semibold`,children:e.name}),(0,H.jsx)(`span`,{className:`rounded bg-[var(--muted)] px-2 py-1 text-[10px] text-[var(--muted-foreground)]`,children:WW(e)})]}),(0,H.jsx)(`p`,{className:`mt-2 text-sm text-[var(--muted-foreground)]`,children:e.description}),s.source&&(0,H.jsx)(`div`,{className:`mt-2 max-w-2xl truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:s.source})]}),(0,H.jsx)(UW,{name:e.name,onDeleted:o})]}),(0,H.jsxs)(`div`,{className:`grid min-h-[500px] lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,H.jsxs)(`div`,{className:`border-b border-[var(--border)] p-3 lg:border-b-0 lg:border-r`,children:[(0,H.jsxs)(`div`,{className:`label-caps mb-2 px-1 text-[10px] text-[var(--muted-foreground)]`,children:[`files · `,e.files.length]}),(0,H.jsx)(`div`,{className:`grid gap-1`,children:e.files.map(e=>(0,H.jsxs)(`button`,{onClick:()=>r(e.path),className:X(`flex items-center gap-2 rounded-md px-2 py-2 text-left text-xs`,n===e.path?`bg-[var(--primary)]/10 text-[var(--primary)]`:`hover:bg-[var(--muted)]/50`),children:[(0,H.jsx)(nr,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.path}),(0,H.jsx)(`span`,{className:`text-[10px] text-[var(--muted-foreground)]`,children:JW(e.size)})]},e.path))})]}),(0,H.jsxs)(`div`,{className:`min-w-0 p-4`,children:[(0,H.jsx)(`div`,{className:`mb-3 truncate font-mono text-xs text-[var(--muted-foreground)]`,children:n||`No file selected`}),(0,H.jsx)(`pre`,{className:`min-h-[440px] overflow-auto whitespace-pre-wrap break-words rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4 font-mono text-xs leading-5`,children:a?`Loading…`:i})]})]})]})}function HW({open:e,onOpenChange:t,onImported:n}){let[r,i]=(0,u.useState)([]),[a,o]=(0,u.useState)(``),[s,c]=(0,u.useState)([]),[l,d]=(0,u.useState)(new Set),[f,p]=(0,u.useState)(!1),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)([]);(0,u.useEffect)(()=>{if(!e)return;let t=!1;return Y.listAgentRuntimeOptions().then(e=>{if(t)return;i(e);let n=e.find(e=>e.available)??e[0];o(n?.id??``)}).catch(e=>!t&&V.error(`Load runtimes failed: ${e.message}`)),()=>{t=!0}},[e]);function v(){c([]),d(new Set),_([]),p(!1),h(!1)}async function y(){if(a){p(!0),c([]),d(new Set),_([]);try{let e=await Y.scanLocalSkills(a);c(e)}catch(e){V.error(`Scan local Skills failed: ${e.message}`)}finally{p(!1)}}}async function b(){if(!(!a||l.size===0)){h(!0);try{let e=await Y.importLocalSkills(a,[...l]);_(e);let t=e.find(e=>e.status===`created`||e.status===`updated`)?.name;await n(t),V.success(`Local Skill import finished: ${e.filter(e=>e.status===`created`||e.status===`updated`).length} changed`)}catch(e){V.error(`Import local Skills failed: ${e.message}`)}finally{h(!1)}}}let x=s.length>0&&s.every(e=>l.has(e.key));return(0,H.jsx)(Su,{open:e,onOpenChange:e=>{t(e),e||v()},children:(0,H.jsxs)(Du,{className:`sm:max-w-3xl`,children:[(0,H.jsx)(Ou,{children:(0,H.jsx)(Au,{children:`Import Skills from a local runtime`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]`,children:[(0,H.jsxs)(my,{value:a,onValueChange:e=>{o(e),v()},disabled:r.length===0,children:[(0,H.jsx)(_y,{children:(0,H.jsx)(gy,{placeholder:`No local runtime found`})}),(0,H.jsx)(by,{children:r.map(e=>(0,H.jsxs)(Sy,{value:e.id,children:[e.name,e.version?` · ${e.version}`:``,e.available?``:` · CLI missing`]},e.id))})]}),(0,H.jsxs)(J,{variant:`outline`,disabled:!a||f,onClick:()=>void y(),children:[(0,H.jsx)(zr,{className:f?`animate-spin`:``}),` Scan`]}),(0,H.jsxs)(J,{variant:`outline`,disabled:s.length===0,onClick:()=>d(x?new Set:new Set(s.map(e=>e.key))),children:[(0,H.jsx)(Pn,{}),` `,x?`Clear`:`All`]})]}),(0,H.jsxs)(`div`,{className:`max-h-80 overflow-y-auto rounded-lg border border-[var(--border)]`,children:[f&&(0,H.jsx)(`div`,{className:`px-4 py-6 text-sm text-[var(--muted-foreground)]`,children:`Scanning local runtime Skill roots…`}),!f&&s.length===0&&(0,H.jsx)(`div`,{className:`px-4 py-6 text-sm text-[var(--muted-foreground)]`,children:`Choose a runtime family and click Scan. The local Skill directory can be scanned even when its CLI is missing.`}),!f&&s.map(e=>(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 border-b border-[var(--border)] px-4 py-3 last:border-0 hover:bg-[var(--muted)]/40`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4`,checked:l.has(e.key),onChange:()=>d(t=>{let n=new Set(t);return n.has(e.key)?n.delete(e.key):n.add(e.key),n})}),(0,H.jsx)(ur,{className:`mt-0.5 size-4 shrink-0 text-[var(--primary)]`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,H.jsx)(`span`,{className:`rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]`,children:e.root}),(0,H.jsxs)(`span`,{className:`rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]`,children:[e.fileCount,` files`]})]}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs text-[var(--muted-foreground)]`,children:e.description}),(0,H.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[var(--muted-foreground)]`,children:e.sourcePath})]})]},e.key))]}),g.length>0&&(0,H.jsx)(`div`,{className:`max-h-44 overflow-y-auto rounded-lg border border-[var(--border)]`,children:g.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-[var(--border)] px-4 py-3 text-sm last:border-0`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`font-mono font-medium`,children:e.name}),e.message&&(0,H.jsx)(`div`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:e.message})]}),(0,H.jsx)(`span`,{className:X(`rounded px-2 py-1 text-xs`,e.status===`failed`||e.status===`conflict`?`bg-red-500/10 text-red-600`:e.status===`skipped`?`bg-[var(--muted)] text-[var(--muted-foreground)]`:`bg-emerald-500/10 text-emerald-600`),children:e.status})]},`${e.name}-${t}`))})]}),(0,H.jsxs)(ku,{children:[(0,H.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:`Done`}),(0,H.jsx)(J,{disabled:l.size===0||m,onClick:()=>void b(),children:m?`Importing…`:`Import ${l.size||``}`})]})]})})}function UW({name:e,onDeleted:t}){return(0,H.jsxs)(uu,{children:[(0,H.jsx)(du,{asChild:!0,children:(0,H.jsxs)(J,{variant:`ghost`,size:`sm`,className:`text-[var(--destructive)]`,children:[(0,H.jsx)(si,{}),` Remove`]})}),(0,H.jsxs)(mu,{children:[(0,H.jsxs)(hu,{children:[(0,H.jsxs)(vu,{children:[`Remove Skill "`,e,`"?`]}),(0,H.jsx)(yu,{children:`Removes the current catalog registration. Immutable artifacts referenced by existing Agents are preserved.`})]}),(0,H.jsxs)(gu,{children:[(0,H.jsx)(xu,{children:`Cancel`}),(0,H.jsx)(bu,{variant:`destructive`,onClick:async()=>{try{await Y.deleteSkill(e),V.success(`Skill "${e}" removed`),await t()}catch(e){V.error(`Remove failed: ${e.message}`)}},children:`Remove`})]})]})]})}function WW(e){let t=e.ref?.install.tool===`skills-cli`?e.ref.install.source:``;return t.includes(`/artifacts/skills/`)||t.includes(`\\artifacts\\skills\\`)?`local runtime`:e.ref?.install.tool===`command`?e.ref.install.command:t?`URL / repository`:`receipt-less`}function GW({results:e}){return(0,H.jsx)(`div`,{className:`max-h-44 overflow-y-auto rounded-lg border border-[var(--border)]`,children:e.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-[var(--border)] px-4 py-3 text-sm last:border-0`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`font-mono font-medium`,children:e.name}),e.message&&(0,H.jsx)(`div`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:e.message})]}),(0,H.jsx)(`span`,{className:X(`rounded px-2 py-1 text-xs`,e.status===`failed`||e.status===`conflict`?`bg-red-500/10 text-red-600`:e.status===`skipped`?`bg-[var(--muted)] text-[var(--muted-foreground)]`:`bg-emerald-500/10 text-emerald-600`),children:e.status})]},`${e.name}-${t}`))})}function KW(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`File read failed`)),r.onload=()=>{let e=String(r.result??``);t(e.includes(`,`)?e.slice(e.indexOf(`,`)+1):e)},r.readAsDataURL(e)})}function qW({label:e,value:t,detail:n}){return(0,H.jsxs)(fC,{className:`p-4`,children:[(0,H.jsx)(`div`,{className:`label-caps text-[10px] text-[var(--muted-foreground)]`,children:e}),(0,H.jsx)(`div`,{className:`mt-2 text-2xl font-semibold`,children:t}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-[var(--muted-foreground)]`,children:n})]})}function JW(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function YW(e){return e.daemonBuild?.restartRequired??!0}function XW(){let e=wS();return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(PS,{bridge:e,children:(0,H.jsx)(ZW,{desktopIntegrationAvailable:!0})}),(0,H.jsx)(zS,{bridge:e})]}):(0,H.jsx)(ZW,{desktopIntegrationAvailable:!1})}function ZW({desktopIntegrationAvailable:e}){let t=Rx(),{theme:n,toggle:r}=Hj(),i=$e(),a=Ex(i.pathname,e),o=(0,u.useRef)(null),[s,c]=(0,u.useState)([]),[l,d]=(0,u.useState)([]),[f,p]=(0,u.useState)(!1),m=(0,u.useCallback)(async()=>{try{c(await Y.listAgents())}catch(e){V.error(`Failed to load agents: ${e.message}`)}},[]),h=(0,u.useCallback)(async()=>{let e=await Promise.allSettled([Y.listPlugins(),Y.listAgents()]);e[0].status===`fulfilled`&&d(e[0].value),e[1].status===`fulfilled`&&c(e[1].value)},[]);(0,u.useEffect)(()=>{a&&a!==`emulator`&&h()},[h,a]),(0,u.useEffect)(()=>{if(t)return;let e=!0,n=async()=>{try{let t=await Y.meta();e&&p(YW(t))}catch{}};n();let r=window.setInterval(()=>void n(),15e3);return()=>{e=!1,window.clearInterval(r)}},[t]),(0,u.useEffect)(()=>{let e=window.requestAnimationFrame(()=>o.current?.focus({preventScroll:!0}));return()=>window.cancelAnimationFrame(e)},[i.pathname]);let g=ot([{path:`/`,element:(0,H.jsx)(Et,{replace:!0,to:px.sessions})},{path:mx,element:(0,H.jsx)(Et,{replace:!0,to:hx})},{path:px.overview,element:(0,H.jsx)(Rw,{plugins:l,agents:s,desktopIntegrationAvailable:e})},{path:px.runtimes,element:(0,H.jsx)(IT,{})},{path:px.providers,element:(0,H.jsx)(TT,{})},{path:px.projects,element:(0,H.jsx)(_T,{})},{path:px.plugins,element:(0,H.jsx)(Jw,{plugins:l,theme:n,onChange:h})},{path:px.agents,element:(0,H.jsx)(CC,{agents:s,onChange:m})},{path:px.skills,element:(0,H.jsx)(zW,{})},{path:gx,element:(0,H.jsx)(LW,{})},{path:_x,element:(0,H.jsx)(LW,{})},{path:px.sessions,element:(0,H.jsx)(LW,{})},{path:`${px.sessions}/:sessionId`,element:(0,H.jsx)(QW,{})},{path:px.emulator,element:(0,H.jsx)(ww,{})},...e?[{path:px.localRuntime,element:(0,H.jsx)(jw,{})},{path:px.computerUse,element:(0,H.jsx)(WC,{})}]:Sx.map(e=>({path:px[e],element:(0,H.jsx)(Et,{replace:!0,to:hx})})),...Object.entries(bx).map(([e,t])=>({path:t,element:(0,H.jsx)(Et,{replace:!0,to:px[e]})})),...Object.entries(xx).map(([e,t])=>({path:e,element:(0,H.jsx)(Et,{replace:!0,to:t})})),{path:`*`,element:(0,H.jsx)(Et,{replace:!0,to:px.sessions})}]);return(0,H.jsx)(MS,{theme:n,onToggleTheme:r,children:(0,H.jsxs)(`div`,{ref:o,id:`main-content`,tabIndex:-1,className:`flex h-full min-h-0 flex-col overflow-hidden focus:outline-none`,children:[f&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-start gap-2 border-b border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] px-4 py-2 text-xs text-[var(--warning)]`,children:[(0,H.jsx)(ci,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}),e?(0,H.jsxs)(`span`,{children:[`The local Runtime is running an older build. Restart it from`,` `,(0,H.jsx)(`strong`,{children:`Settings → Local Runtime`}),`, then reload this page.`]}):(0,H.jsxs)(`span`,{children:[`The resident daemon is running an older build. Run`,` `,(0,H.jsx)(`code`,{className:`font-mono font-semibold`,children:`rynx restart`}),`, then reload this page.`]})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a?(0,H.jsx)(VS,{activeView:a,desktopIntegrationAvailable:e,children:g}):g})]})})}function QW(){let{sessionId:e}=it(),t=$e();if(!e)return(0,H.jsx)(Et,{replace:!0,to:px.sessions});let n=Ox(t.search)??`local`;return(0,H.jsx)(Et,{replace:!0,to:Ax(n,e)})}function $W(e){let{theme:t}=Hj();return(0,H.jsx)(Vi,{theme:t,...e})}window.rynxDesktopIntegration?.platform===`darwin`&&(document.documentElement.dataset.rynxDesktopPlatform=`macos`),(0,f.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(u.StrictMode,{children:(0,H.jsx)(pn,{children:(0,H.jsx)(bS,{children:(0,H.jsxs)(OS,{children:[(0,H.jsx)(XW,{}),(0,H.jsx)($W,{richColors:!0,position:`top-right`})]})})})}));export{iu as a,z as c,r as d,X as i,g as l,gA as n,Mc as o,mA as r,Ui as s,hA as t,s as u};
|